diff --git a/.github/actions/build-jtreg/action.yml b/.github/actions/build-jtreg/action.yml index 0ba9937fb452..d00b297c1600 100644 --- a/.github/actions/build-jtreg/action.yml +++ b/.github/actions/build-jtreg/action.yml @@ -37,13 +37,13 @@ runs: - name: 'Check cache for already built JTReg' id: get-cached - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: jtreg/installed key: jtreg-${{ steps.version.outputs.value }} - name: 'Checkout the JTReg source' - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: openjdk/jtreg ref: jtreg-${{ steps.version.outputs.value }} @@ -61,7 +61,7 @@ runs: if: (steps.get-cached.outputs.cache-hit != 'true') - name: 'Upload JTReg artifact' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: bundles-jtreg-${{ steps.version.outputs.value }} path: jtreg/installed diff --git a/.github/actions/do-build/action.yml b/.github/actions/do-build/action.yml index 6f2c2ce02180..6f6bbdabb687 100644 --- a/.github/actions/do-build/action.yml +++ b/.github/actions/do-build/action.yml @@ -66,7 +66,7 @@ runs: shell: bash - name: 'Upload build logs' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: failure-logs-${{ inputs.platform }}${{ inputs.debug-suffix }} path: failure-logs @@ -74,7 +74,7 @@ runs: # This is the best way I found to abort the job with an error message - name: 'Notify about build failures' - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: core.setFailed('Build failed. See summary for details.') if: steps.check.outputs.failure == 'true' diff --git a/.github/actions/get-bootjdk/action.yml b/.github/actions/get-bootjdk/action.yml index 25ee1d8dfa0a..278aad7dcb38 100644 --- a/.github/actions/get-bootjdk/action.yml +++ b/.github/actions/get-bootjdk/action.yml @@ -65,7 +65,7 @@ runs: - name: 'Check cache for BootJDK' id: get-cached-bootjdk - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: bootjdk/jdk key: boot-jdk-${{ inputs.platform }}-${{ steps.sha256.outputs.value }} diff --git a/.github/actions/get-bundles/action.yml b/.github/actions/get-bundles/action.yml index 0e52320a3506..694e3791cdf0 100644 --- a/.github/actions/get-bundles/action.yml +++ b/.github/actions/get-bundles/action.yml @@ -48,19 +48,20 @@ runs: steps: - name: 'Download bundles artifact' id: download-bundles - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }} path: bundles continue-on-error: true - name: 'Download bundles artifact (retry)' - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }} path: bundles if: steps.download-bundles.outcome == 'failure' + - name: 'Unpack bundles' run: | if [[ -e bundles/jdk-${{ inputs.platform }}${{ inputs.debug-suffix }}.zip ]]; then diff --git a/.github/actions/get-gtest/action.yml b/.github/actions/get-gtest/action.yml index 5de2b10cd320..05635bbfbe11 100644 --- a/.github/actions/get-gtest/action.yml +++ b/.github/actions/get-gtest/action.yml @@ -40,7 +40,7 @@ runs: var: GTEST_VERSION - name: 'Checkout GTest source' - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: google/googletest ref: 'v${{ steps.version.outputs.value }}' diff --git a/.github/actions/get-jtreg/action.yml b/.github/actions/get-jtreg/action.yml index 78a3a4c9eddd..eb80471a79c0 100644 --- a/.github/actions/get-jtreg/action.yml +++ b/.github/actions/get-jtreg/action.yml @@ -41,7 +41,7 @@ runs: - name: 'Download JTReg artifact' id: download-jtreg - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: bundles-jtreg-${{ steps.version.outputs.value }} path: jtreg/installed diff --git a/.github/actions/get-msys2/action.yml b/.github/actions/get-msys2/action.yml index 7ac3172f7089..ed69c25e7766 100644 --- a/.github/actions/get-msys2/action.yml +++ b/.github/actions/get-msys2/action.yml @@ -31,7 +31,7 @@ runs: steps: - name: 'Install MSYS2' id: msys2 - uses: msys2/setup-msys2@v2.28.0 + uses: msys2/setup-msys2@v2.31.0 with: install: 'autoconf tar unzip zip make' path-type: minimal diff --git a/.github/actions/upload-bundles/action.yml b/.github/actions/upload-bundles/action.yml index 62a8fa58865c..2915ba8b3ec0 100644 --- a/.github/actions/upload-bundles/action.yml +++ b/.github/actions/upload-bundles/action.yml @@ -69,7 +69,7 @@ runs: shell: bash - name: 'Upload bundles artifact' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: bundles-${{ inputs.platform }}${{ inputs.debug-suffix }} path: bundles diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000000..d3f63784ecec --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,5 @@ + + + +--------- +- [ ] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). diff --git a/.github/workflows/build-cross-compile.yml b/.github/workflows/build-cross-compile.yml index f8e7306a8c06..4b080aded7d2 100644 --- a/.github/workflows/build-cross-compile.yml +++ b/.github/workflows/build-cross-compile.yml @@ -90,7 +90,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: 'Get the BootJDK' id: bootjdk @@ -118,7 +118,7 @@ jobs: - name: 'Check cache for sysroot' id: get-cached-sysroot - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: sysroot key: sysroot-${{ matrix.debian-arch }}-${{ hashFiles('./.github/workflows/build-cross-compile.yml') }} diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index f3ea4e4fb6ad..7f0678dbab66 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -78,7 +78,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: 'Get the BootJDK' id: bootjdk diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 90bb6af044ff..687a2af057f4 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -71,7 +71,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: 'Get the BootJDK' id: bootjdk diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 9bb43a8b83ce..85d1146f12c4 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -31,6 +31,9 @@ on: platform: required: true type: string + runs-on: + required: true + type: string extra-conf-options: required: false type: string @@ -63,7 +66,7 @@ env: jobs: build-windows: name: build - runs-on: windows-2025 + runs-on: ${{ inputs.runs-on }} defaults: run: shell: bash @@ -79,7 +82,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: 'Get MSYS2' uses: ./.github/actions/get-msys2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4ed67792ef7..44802abfda8b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,7 @@ jobs: steps: - name: 'Checkout the scripts' - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: sparse-checkout: | .github @@ -258,6 +258,7 @@ jobs: uses: ./.github/workflows/build-windows.yml with: platform: windows-x64 + runs-on: windows-2022 msvc-toolset-version: '14.44' msvc-toolset-architecture: 'x86.x64' configure-arguments: ${{ github.event.inputs.configure-arguments }} @@ -270,6 +271,7 @@ jobs: uses: ./.github/workflows/build-windows.yml with: platform: windows-aarch64 + runs-on: windows-2022 msvc-toolset-version: '14.44' msvc-toolset-architecture: 'arm64' make-target: 'hotspot' @@ -327,4 +329,4 @@ jobs: with: platform: windows-x64 bootjdk-platform: windows-x64 - runs-on: windows-2025 + runs-on: windows-2022 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3517fa53941e..76990dbbe6cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -123,7 +123,7 @@ jobs: steps: - name: 'Checkout the JDK source' - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: 'Get MSYS2' uses: ./.github/actions/get-msys2 @@ -214,7 +214,7 @@ jobs: if: always() - name: 'Upload test results' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: path: results name: ${{ steps.package.outputs.artifact-name }} @@ -222,7 +222,7 @@ jobs: # This is the best way I found to abort the job with an error message - name: 'Notify about test failures' - uses: actions/github-script@v7 + uses: actions/github-script@v8 with: script: core.setFailed('${{ steps.run-tests.outputs.error-message }}') if: steps.run-tests.outputs.failure == 'true' diff --git a/.jcheck/conf b/.jcheck/conf index 8bd21f7117b3..fd9a62ff0a58 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1,7 +1,7 @@ [general] project=jdk-updates jbs=JDK -version=21.0.11 +version=21.0.12 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists diff --git a/doc/building.html b/doc/building.html index 26720dd5b39c..cd3662e5b2a3 100644 --- a/doc/building.html +++ b/doc/building.html @@ -598,7 +598,7 @@

Microsoft Visual Studio

(Note that this version is often presented as "MSVC 14.28", and reported by cl.exe as 19.28.) Older versions will not be accepted by configure and will not work. The maximum accepted version -of Visual Studio is 2022.

+of Visual Studio is 2026.

If you have multiple versions of Visual Studio installed, configure will by default pick the latest. You can request a specific version to be used by setting diff --git a/doc/building.md b/doc/building.md index addc74aae516..45104bb499f0 100644 --- a/doc/building.md +++ b/doc/building.md @@ -389,7 +389,7 @@ available for this update. The minimum accepted version is Visual Studio 2019 version 16.8. (Note that this version is often presented as "MSVC 14.28", and reported by cl.exe as 19.28.) Older versions will not be accepted by `configure` and will not work. The -maximum accepted version of Visual Studio is 2022. +maximum accepted version of Visual Studio is 2026. If you have multiple versions of Visual Studio installed, `configure` will by default pick the latest. You can request a specific version to be used by diff --git a/make/Global.gmk b/make/Global.gmk index e5e76b475b94..fae21f0b4280 100644 --- a/make/Global.gmk +++ b/make/Global.gmk @@ -103,6 +103,7 @@ help: $(info $(_) # method is 'auto', 'ignore' or 'fail' (default)) $(info $(_) TEST="test1 ..." # Use the given test descriptor(s) for testing, e.g.) $(info $(_) # make test TEST="jdk_lang gtest:all") + $(info $(_) TEST_DEPS="dependency1 ..." # Specify additional dependencies for running tests, e.g docs-jdk) $(info $(_) JTREG="OPT1=x;OPT2=y" # Control the JTREG test harness, use 'help' to list) $(info $(_) GTEST="OPT1=x;OPT2=y" # Control the GTEST test harness, use 'help' to list) $(info $(_) MICRO="OPT1=x;OPT2=y" # Control the MICRO test harness, use 'help' to list) diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk index 31c80e2f7267..e38f9e105475 100644 --- a/make/InitSupport.gmk +++ b/make/InitSupport.gmk @@ -50,7 +50,7 @@ ifeq ($(HAS_SPEC),) # Make control variables, handled by Init.gmk INIT_CONTROL_VARIABLES += LOG CONF CONF_NAME SPEC JOBS TEST_JOBS CONF_CHECK \ - COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS + COMPARE_BUILD JTREG GTEST MICRO TEST_OPTS TEST_VM_OPTS TEST_DEPS # All known make control variables MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER SPEC_FILTER diff --git a/make/Main.gmk b/make/Main.gmk index 62d43c689e49..722a6d854e89 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -774,13 +774,13 @@ $(eval $(call SetupTarget, build-microbenchmark, \ $(eval $(call SetupTarget, test, \ MAKEFILE := RunTests, \ ARGS := TEST="$(TEST)", \ - DEPS := jdk-image test-image, \ + DEPS := jdk-image test-image $(TEST_DEPS), \ )) $(eval $(call SetupTarget, exploded-test, \ MAKEFILE := RunTests, \ ARGS := TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR), \ - DEPS := exploded-image test-image, \ + DEPS := exploded-image test-image $(TEST_DEPS), \ )) ifeq ($(JCOV_ENABLED), true) @@ -1061,8 +1061,8 @@ else test-make-compile-commands: compile-commands # Declare dependency for all generated test targets - $(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image)) - $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image)) + $(foreach t, $(filter-out test-make%, $(ALL_TEST_TARGETS)), $(eval $t: jdk-image test-image $(TEST_DEPS))) + $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image $(TEST_DEPS))) interim-image: $(INTERIM_JMOD_TARGETS) @@ -1293,9 +1293,13 @@ test-hotspot-jtreg-native: test-hotspot_native_sanity test-hotspot-gtest: exploded-test-gtest test-jdk-jtreg-native: test-jdk_native_sanity +# Set dependencies for doc tests +$(eval $(call AddTestDependency, docs_all, docs-jdk)) +test-docs: test-docs_all + ALL_TARGETS += $(RUN_TEST_TARGETS) run-test exploded-run-test check \ test-hotspot-jtreg test-hotspot-jtreg-native test-hotspot-gtest \ - test-jdk-jtreg-native + test-jdk-jtreg-native test-docs ################################################################################ ################################################################################ diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk index 34137c502d4a..aa0bf8f8ac8f 100644 --- a/make/MainSupport.gmk +++ b/make/MainSupport.gmk @@ -132,6 +132,15 @@ define CleanModule $(call Clean-include, $1) endef +define AddTestDependency + test-$(strip $1): $2 + + exploded-test-$(strip $1): $2 + + ifneq ($(filter $(TEST), $1), ) + TEST_DEPS += $2 + endif +endef ################################################################################ diff --git a/make/RunTests.gmk b/make/RunTests.gmk index b490f9f77489..f61125f53315 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -263,6 +263,7 @@ jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt lib-test_JTREG_PROBLEM_LIST += $(TOPDIR)/test/lib-test/ProblemList.txt +docs_JTREG_PROBLEM_LIST += $(TOPDIR)/test/docs/ProblemList.txt ################################################################################ # Parse test selection @@ -866,6 +867,8 @@ define SetupRunJtregTestBody $1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) + $1_JTREG_BASIC_OPTIONS += -e:DOCS_JDK_IMAGE_DIR=$$(DOCS_JDK_IMAGE_DIR) + ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), ) $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)" endif diff --git a/make/autoconf/basic_tools.m4 b/make/autoconf/basic_tools.m4 index 3ad7d778be15..caef5f73ca8e 100644 --- a/make/autoconf/basic_tools.m4 +++ b/make/autoconf/basic_tools.m4 @@ -148,7 +148,7 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION], if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then MAKE_EXPECTED_ENV='cygwin' elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys2"; then - MAKE_EXPECTED_ENV='msys' + MAKE_EXPECTED_ENV='cygwin|msys' elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl1" || test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl2"; then if test "x$OPENJDK_BUILD_CPU" = "xaarch64"; then MAKE_EXPECTED_ENV='aarch64-.*-linux-gnu' @@ -159,7 +159,7 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION], AC_MSG_ERROR([Unknown Windows environment]) fi MAKE_BUILT_FOR=`$MAKE_CANDIDATE --version | $GREP -i 'built for'` - IS_MAKE_CORRECT_ENV=`$ECHO $MAKE_BUILT_FOR | $GREP $MAKE_EXPECTED_ENV` + IS_MAKE_CORRECT_ENV=`$ECHO $MAKE_BUILT_FOR | $GREP -E $MAKE_EXPECTED_ENV` else # Not relevant for non-Windows IS_MAKE_CORRECT_ENV=true diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4 index 069ced05f329..a2b576ac1ab3 100644 --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -380,7 +380,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION], [ # Restore old path, except for the microsoft toolchain, which requires the # toolchain path to remain in place. Otherwise the compiler will not work in - # some siutations in later configure checks. + # some situations in later configure checks. if test "x$TOOLCHAIN_TYPE" != "xmicrosoft"; then PATH="$OLD_PATH" fi @@ -389,10 +389,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_POST_DETECTION], # This is necessary since AC_PROG_CC defaults CFLAGS to "-g -O2" CFLAGS="$ORG_CFLAGS" CXXFLAGS="$ORG_CXXFLAGS" - - # filter out some unwanted additions autoconf may add to CXX; we saw this on macOS with autoconf 2.72 - UTIL_GET_NON_MATCHING_VALUES(cxx_filtered, $CXX, -std=c++11 -std=gnu++11) - CXX="$cxx_filtered" ]) # Check if a compiler is of the toolchain type we expect, and save the version diff --git a/make/autoconf/toolchain_microsoft.m4 b/make/autoconf/toolchain_microsoft.m4 index 51bba4871925..13e93f270739 100644 --- a/make/autoconf/toolchain_microsoft.m4 +++ b/make/autoconf/toolchain_microsoft.m4 @@ -25,7 +25,7 @@ ################################################################################ # The order of these defines the priority by which we try to find them. -VALID_VS_VERSIONS="2022 2019" +VALID_VS_VERSIONS="2022 2019 2026" VS_DESCRIPTION_2019="Microsoft Visual Studio 2019" VS_VERSION_INTERNAL_2019=142 @@ -57,6 +57,21 @@ VS_SDK_PLATFORM_NAME_2022= VS_SUPPORTED_2022=true VS_TOOLSET_SUPPORTED_2022=true +VS_DESCRIPTION_2026="Microsoft Visual Studio 2026" +VS_VERSION_INTERNAL_2026=145 +VS_MSVCR_2026=vcruntime140.dll +VS_VCRUNTIME_1_2026=vcruntime140_1.dll +VS_MSVCP_2026=msvcp140.dll +VS_ENVVAR_2026="VS180COMNTOOLS" +VS_USE_UCRT_2026="true" +VS_VS_INSTALLDIR_2026="Microsoft Visual Studio/18" +VS_EDITIONS_2026="BuildTools Community Professional Enterprise" +VS_SDK_INSTALLDIR_2026= +VS_VS_PLATFORM_NAME_2026="v145" +VS_SDK_PLATFORM_NAME_2026= +VS_SUPPORTED_2026=true +VS_TOOLSET_SUPPORTED_2026=true + ################################################################################ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT], diff --git a/make/autoconf/util.m4 b/make/autoconf/util.m4 index 76426005f81d..c87411c8ab3f 100644 --- a/make/autoconf/util.m4 +++ b/make/autoconf/util.m4 @@ -26,6 +26,70 @@ m4_include([util_paths.m4]) ############################################################################### +# Overwrite the existing version of AC_PROG_CC with our own custom variant. +# Unlike the regular AC_PROG_CC, the compiler list must always be passed. +AC_DEFUN([AC_PROG_CC], +[ + AC_LANG_PUSH(C) + AC_ARG_VAR([CC], [C compiler command]) + AC_ARG_VAR([CFLAGS], [C compiler flags]) + + _AC_ARG_VAR_LDFLAGS() + _AC_ARG_VAR_LIBS() + _AC_ARG_VAR_CPPFLAGS() + + AC_CHECK_TOOLS(CC, [$1]) + + test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) + + # Provide some information about the compiler. + _AS_ECHO_LOG([checking for _AC_LANG compiler version]) + set X $ac_compile + ac_compiler=$[2] + for ac_option in --version -v -V -qversion -version; do + _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) + done + + m4_expand_once([_AC_COMPILER_EXEEXT]) + m4_expand_once([_AC_COMPILER_OBJEXT]) + + _AC_PROG_CC_G + + AC_LANG_POP(C) +]) + +############################################################################### +# Overwrite the existing version of AC_PROG_CXX with our own custom variant. +# Unlike the regular AC_PROG_CXX, the compiler list must always be passed. +AC_DEFUN([AC_PROG_CXX], +[ + AC_LANG_PUSH(C++) + AC_ARG_VAR([CXX], [C++ compiler command]) + AC_ARG_VAR([CXXFLAGS], [C++ compiler flags]) + + _AC_ARG_VAR_LDFLAGS() + _AC_ARG_VAR_LIBS() + _AC_ARG_VAR_CPPFLAGS() + + AC_CHECK_TOOLS(CXX, [$1]) + + # Provide some information about the compiler. + _AS_ECHO_LOG([checking for _AC_LANG compiler version]) + set X $ac_compile + ac_compiler=$[2] + for ac_option in --version -v -V -qversion; do + _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) + done + + m4_expand_once([_AC_COMPILER_EXEEXT]) + m4_expand_once([_AC_COMPILER_OBJEXT]) + + _AC_PROG_CXX_G + + AC_LANG_POP(C++) +]) + +################################################################################ # Create a function/macro that takes a series of named arguments. The call is # similar to AC_DEFUN, but the setup of the function looks like this: # UTIL_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [ diff --git a/make/common/FindTests.gmk b/make/common/FindTests.gmk index b12630349c0d..5bdce82efa3c 100644 --- a/make/common/FindTests.gmk +++ b/make/common/FindTests.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ $(eval $(call IncludeCustomExtension, common/FindTests.gmk)) TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR) # JTREG_TESTROOTS might have been set by a custom extension -JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools jaxp lib-test) +JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools jaxp lib-test docs) # Extract the names of the Jtreg group files from the TEST.ROOT files. The # TEST.ROOT files being properties files can be interpreted as makefiles so diff --git a/make/conf/github-actions.conf b/make/conf/github-actions.conf index 0157f5119ce0..b35533eb1ce6 100644 --- a/make/conf/github-actions.conf +++ b/make/conf/github-actions.conf @@ -29,17 +29,17 @@ GTEST_VERSION=1.14.0 JTREG_VERSION=7.5.2+1 LINUX_X64_BOOT_JDK_EXT=tar.gz -LINUX_X64_BOOT_JDK_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jdk_x64_linux_hotspot_21.0.6_7.tar.gz -LINUX_X64_BOOT_JDK_SHA256=a2650fba422283fbed20d936ce5d2a52906a5414ec17b2f7676dddb87201dbae +LINUX_X64_BOOT_JDK_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_linux_hotspot_21.0.11_10.tar.gz +LINUX_X64_BOOT_JDK_SHA256=4b2220e232a97997b436ca6ab15cbf70171ecff52958a46159dfa5a8c44ca4de MACOS_AARCH64_BOOT_JDK_EXT=tar.gz -MACOS_AARCH64_BOOT_JDK_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jdk_aarch64_mac_hotspot_21.0.6_7.tar.gz -MACOS_AARCH64_BOOT_JDK_SHA256=4ef4083919126a3d93e603284b405c7493905497485a92b375f5d6c3e8f7e8f2 +MACOS_AARCH64_BOOT_JDK_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_aarch64_mac_hotspot_21.0.11_10.tar.gz +MACOS_AARCH64_BOOT_JDK_SHA256=6ebcf221c9b41507b14c098e93c6ead6440b8d9bd154f8ec666c4c73abbdb201 MACOS_X64_BOOT_JDK_EXT=tar.gz -MACOS_X64_BOOT_JDK_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jdk_x64_mac_hotspot_21.0.6_7.tar.gz -MACOS_X64_BOOT_JDK_SHA256=7aacfc400078ad65b7c7de3ec75ff74bf5c2077d6740b350f85ae10be4f71e76 +MACOS_X64_BOOT_JDK_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_mac_hotspot_21.0.11_10.tar.gz +MACOS_X64_BOOT_JDK_SHA256=34180eb03e6d207c388cce3da668f6cc7cd7508c185c24782fadac2c9c0e66f9 WINDOWS_X64_BOOT_JDK_EXT=zip -WINDOWS_X64_BOOT_JDK_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jdk_x64_windows_hotspot_21.0.6_7.zip -WINDOWS_X64_BOOT_JDK_SHA256=897c8eebb0f85a99ccecbd482ebae9a45d88c19d6077054f6529ebab49b6d259 +WINDOWS_X64_BOOT_JDK_URL=https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_windows_hotspot_21.0.11_10.zip +WINDOWS_X64_BOOT_JDK_SHA256=d3625e7cadf23787ea540229544b6e2ab494b3b54da1801879e583e1dfee0a64 diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 220897030d59..a3dd255b0f15 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -952,7 +952,7 @@ var getJibProfilesProfiles = function (input, common, data) { // Profiles used to run tests using Jib for internal dependencies. var testedProfile = input.testedProfile; - if (testedProfile == null) { + if (testedProfile == null || testedProfile == "docs") { testedProfile = input.build_os + "-" + input.build_cpu; } var testedProfileJdk = testedProfile + ".jdk"; @@ -994,25 +994,38 @@ var getJibProfilesProfiles = function (input, common, data) { testOnlyProfilesPrebuilt["run-test-prebuilt"]["dependencies"].push(testedProfile + ".jdk_symbols"); } + var testOnlyProfilesPrebuiltDocs = { + "run-test-prebuilt-docs": clone(testOnlyProfilesPrebuilt["run-test-prebuilt"]) + }; + + testOnlyProfilesPrebuiltDocs["run-test-prebuilt-docs"].dependencies.push("docs.doc_api_spec", "tidy"); + testOnlyProfilesPrebuiltDocs["run-test-prebuilt-docs"].environment["DOCS_JDK_IMAGE_DIR"] + = input.get("docs.doc_api_spec", "install_path"); + testOnlyProfilesPrebuiltDocs["run-test-prebuilt-docs"].environment["TIDY"] + = input.get("tidy", "home_path") + "/bin/tidy"; + testOnlyProfilesPrebuiltDocs["run-test-prebuilt-docs"].labels = "test-docs"; + // If actually running the run-test-prebuilt profile, verify that the input // variable is valid and if so, add the appropriate target_* values from // the tested profile. Use testImageProfile value as backup. - if (input.profile == "run-test-prebuilt") { + if (input.profile == "run-test-prebuilt" || input.profile == "run-test-prebuilt-docs") { if (profiles[testedProfile] == null && profiles[testImageProfile] == null) { error("testedProfile is not defined: " + testedProfile + " " + testImageProfile); } } - if (profiles[testedProfile] != null) { - testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"] - = profiles[testedProfile]["target_os"]; - testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"] - = profiles[testedProfile]["target_cpu"]; - } else if (profiles[testImageProfile] != null) { - testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_os"] - = profiles[testImageProfile]["target_os"]; - testOnlyProfilesPrebuilt["run-test-prebuilt"]["target_cpu"] - = profiles[testImageProfile]["target_cpu"]; + function updateProfileTargets(profiles, testedProfile, testImageProfile, targetProfile, runTestProfile) { + var profileToCheck = profiles[testedProfile] || profiles[testImageProfile]; + + if (profileToCheck != null) { + targetProfile[runTestProfile]["target_os"] = profileToCheck["target_os"]; + targetProfile[runTestProfile]["target_cpu"] = profileToCheck["target_cpu"]; + } } + + updateProfileTargets(profiles, testedProfile, testImageProfile, testOnlyProfilesPrebuilt, "run-test-prebuilt"); + updateProfileTargets(profiles, testedProfile, testImageProfile, testOnlyProfilesPrebuiltDocs, "run-test-prebuilt-docs"); + + profiles = concatObjects(profiles, testOnlyProfilesPrebuiltDocs); profiles = concatObjects(profiles, testOnlyProfilesPrebuilt); // On macosx add the devkit bin dir to the path in all the run-test profiles. @@ -1062,6 +1075,8 @@ var getJibProfilesProfiles = function (input, common, data) { } profiles["run-test-prebuilt"] = concatObjects(profiles["run-test-prebuilt"], runTestPrebuiltSrcFullExtra); + profiles["run-test-prebuilt-docs"] = concatObjects(profiles["run-test-prebuilt-docs"], + runTestPrebuiltSrcFullExtra); } // Generate the missing platform attributes diff --git a/make/conf/version-numbers.conf b/make/conf/version-numbers.conf index dfab158b4c89..aecbc27c216f 100644 --- a/make/conf/version-numbers.conf +++ b/make/conf/version-numbers.conf @@ -28,12 +28,12 @@ DEFAULT_VERSION_FEATURE=21 DEFAULT_VERSION_INTERIM=0 -DEFAULT_VERSION_UPDATE=11 +DEFAULT_VERSION_UPDATE=12 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2026-04-21 +DEFAULT_VERSION_DATE=2026-07-21 DEFAULT_VERSION_CLASSFILE_MAJOR=65 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_VERSION_DOCS_API_SINCE=11 diff --git a/src/hotspot/cpu/arm/arm_32.ad b/src/hotspot/cpu/arm/arm_32.ad index affe5a816fca..dd9217d73a9c 100644 --- a/src/hotspot/cpu/arm/arm_32.ad +++ b/src/hotspot/cpu/arm/arm_32.ad @@ -62,22 +62,22 @@ register %{ // Integer/Long Registers // ---------------------------- -reg_def R_R0 (SOC, SOC, Op_RegI, 0, R(0)->as_VMReg()); -reg_def R_R1 (SOC, SOC, Op_RegI, 1, R(1)->as_VMReg()); -reg_def R_R2 (SOC, SOC, Op_RegI, 2, R(2)->as_VMReg()); -reg_def R_R3 (SOC, SOC, Op_RegI, 3, R(3)->as_VMReg()); -reg_def R_R4 (SOC, SOE, Op_RegI, 4, R(4)->as_VMReg()); -reg_def R_R5 (SOC, SOE, Op_RegI, 5, R(5)->as_VMReg()); -reg_def R_R6 (SOC, SOE, Op_RegI, 6, R(6)->as_VMReg()); -reg_def R_R7 (SOC, SOE, Op_RegI, 7, R(7)->as_VMReg()); -reg_def R_R8 (SOC, SOE, Op_RegI, 8, R(8)->as_VMReg()); -reg_def R_R9 (SOC, SOE, Op_RegI, 9, R(9)->as_VMReg()); -reg_def R_R10(NS, SOE, Op_RegI, 10, R(10)->as_VMReg()); -reg_def R_R11(NS, SOE, Op_RegI, 11, R(11)->as_VMReg()); -reg_def R_R12(SOC, SOC, Op_RegI, 12, R(12)->as_VMReg()); -reg_def R_R13(NS, NS, Op_RegI, 13, R(13)->as_VMReg()); -reg_def R_R14(SOC, SOC, Op_RegI, 14, R(14)->as_VMReg()); -reg_def R_R15(NS, NS, Op_RegI, 15, R(15)->as_VMReg()); +reg_def R_R0 (SOC, SOC, Op_RegI, 0, as_Register(0)->as_VMReg()); +reg_def R_R1 (SOC, SOC, Op_RegI, 1, as_Register(1)->as_VMReg()); +reg_def R_R2 (SOC, SOC, Op_RegI, 2, as_Register(2)->as_VMReg()); +reg_def R_R3 (SOC, SOC, Op_RegI, 3, as_Register(3)->as_VMReg()); +reg_def R_R4 (SOC, SOE, Op_RegI, 4, as_Register(4)->as_VMReg()); +reg_def R_R5 (SOC, SOE, Op_RegI, 5, as_Register(5)->as_VMReg()); +reg_def R_R6 (SOC, SOE, Op_RegI, 6, as_Register(6)->as_VMReg()); +reg_def R_R7 (SOC, SOE, Op_RegI, 7, as_Register(7)->as_VMReg()); +reg_def R_R8 (SOC, SOE, Op_RegI, 8, as_Register(8)->as_VMReg()); +reg_def R_R9 (SOC, SOE, Op_RegI, 9, as_Register(9)->as_VMReg()); +reg_def R_R10(NS, SOE, Op_RegI, 10, as_Register(10)->as_VMReg()); +reg_def R_R11(NS, SOE, Op_RegI, 11, as_Register(11)->as_VMReg()); +reg_def R_R12(SOC, SOC, Op_RegI, 12, as_Register(12)->as_VMReg()); +reg_def R_R13(NS, NS, Op_RegI, 13, as_Register(13)->as_VMReg()); +reg_def R_R14(SOC, SOC, Op_RegI, 14, as_Register(14)->as_VMReg()); +reg_def R_R15(NS, NS, Op_RegI, 15, as_Register(15)->as_VMReg()); // ---------------------------- // Float/Double Registers diff --git a/src/hotspot/cpu/arm/assembler_arm_32.hpp b/src/hotspot/cpu/arm/assembler_arm_32.hpp index dd04ad1ab3a3..5972782233bb 100644 --- a/src/hotspot/cpu/arm/assembler_arm_32.hpp +++ b/src/hotspot/cpu/arm/assembler_arm_32.hpp @@ -114,7 +114,7 @@ class RegisterSet { } RegisterSet(Register first, Register last) { - assert(first < last, "encoding constraint"); + assert(first->encoding() < last->encoding(), "encoding constraint"); _encoding = (1 << (last->encoding() + 1)) - (1 << first->encoding()); } diff --git a/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp b/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp index 3d8dbc38071e..cc4043d3fffa 100644 --- a/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp +++ b/src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp @@ -182,7 +182,7 @@ void MonitorEnterStub::emit_code(LIR_Assembler* ce) { const Register lock_reg = _lock_reg->as_pointer_register(); ce->verify_reserved_argument_area_size(2); - if (obj_reg < lock_reg) { + if (obj_reg->encoding() < lock_reg->encoding()) { __ stmia(SP, RegisterSet(obj_reg) | RegisterSet(lock_reg)); } else { __ str(obj_reg, Address(SP)); diff --git a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp index 45786898458b..dcac4271a643 100644 --- a/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIRAssembler_arm.cpp @@ -152,8 +152,14 @@ void LIR_Assembler::osr_entry() { int monitor_offset = (method()->max_locals() + 2 * (number_of_locks - 1)) * BytesPerWord; for (int i = 0; i < number_of_locks; i++) { int slot_offset = monitor_offset - (i * 2 * BytesPerWord); - __ ldr(R1, Address(OSR_buf, slot_offset + 0*BytesPerWord)); - __ ldr(R2, Address(OSR_buf, slot_offset + 1*BytesPerWord)); + if (slot_offset >= 4096 - BytesPerWord) { + __ add_slow(R2, OSR_buf, slot_offset); + __ ldr(R1, Address(R2, 0*BytesPerWord)); + __ ldr(R2, Address(R2, 1*BytesPerWord)); + } else { + __ ldr(R1, Address(OSR_buf, slot_offset + 0*BytesPerWord)); + __ ldr(R2, Address(OSR_buf, slot_offset + 1*BytesPerWord)); + } __ str(R1, frame_map()->address_for_monitor_lock(i)); __ str(R2, frame_map()->address_for_monitor_object(i)); } @@ -2653,11 +2659,11 @@ void LIR_Assembler::volatile_move_op(LIR_Opr src, LIR_Opr dest, BasicType type, const Register src_hi = src->as_register_hi(); assert(addr->index()->is_illegal() && addr->disp() == 0, "The address is simple already"); - if (src_lo < src_hi) { + if (src_lo->encoding() < src_hi->encoding()) { null_check_offset = __ offset(); __ stmia(addr->base()->as_register(), RegisterSet(src_lo) | RegisterSet(src_hi)); } else { - assert(src_lo < Rtemp, "Rtemp is higher than any allocatable register"); + assert(src_lo->encoding() < Rtemp->encoding(), "Rtemp is higher than any allocatable register"); __ mov(Rtemp, src_hi); null_check_offset = __ offset(); __ stmia(addr->base()->as_register(), RegisterSet(src_lo) | RegisterSet(Rtemp)); @@ -2670,10 +2676,10 @@ void LIR_Assembler::volatile_move_op(LIR_Opr src, LIR_Opr dest, BasicType type, assert(addr->index()->is_illegal() && addr->disp() == 0, "The address is simple already"); null_check_offset = __ offset(); - if (dest_lo < dest_hi) { + if (dest_lo->encoding() < dest_hi->encoding()) { __ ldmia(addr->base()->as_register(), RegisterSet(dest_lo) | RegisterSet(dest_hi)); } else { - assert(dest_lo < Rtemp, "Rtemp is higher than any allocatable register"); + assert(dest_lo->encoding() < Rtemp->encoding(), "Rtemp is higher than any allocatable register"); __ ldmia(addr->base()->as_register(), RegisterSet(dest_lo) | RegisterSet(Rtemp)); __ mov(dest_hi, Rtemp); } diff --git a/src/hotspot/cpu/arm/interp_masm_arm.cpp b/src/hotspot/cpu/arm/interp_masm_arm.cpp index f49b6ed06ece..2678b74bd780 100644 --- a/src/hotspot/cpu/arm/interp_masm_arm.cpp +++ b/src/hotspot/cpu/arm/interp_masm_arm.cpp @@ -406,7 +406,7 @@ void InterpreterMacroAssembler::pop_i(Register r) { void InterpreterMacroAssembler::pop_l(Register lo, Register hi) { assert_different_registers(lo, hi); - assert(lo < hi, "lo must be < hi"); + assert(lo->encoding() < hi->encoding(), "lo must be < hi"); pop(RegisterSet(lo) | RegisterSet(hi)); } @@ -456,7 +456,7 @@ void InterpreterMacroAssembler::push_i(Register r) { void InterpreterMacroAssembler::push_l(Register lo, Register hi) { assert_different_registers(lo, hi); - assert(lo < hi, "lo must be < hi"); + assert(lo->encoding() < hi->encoding(), "lo must be < hi"); push(RegisterSet(lo) | RegisterSet(hi)); } diff --git a/src/hotspot/cpu/arm/register_arm.cpp b/src/hotspot/cpu/arm/register_arm.cpp index a0ae9ff4f92a..a4c5a3f20bb1 100644 --- a/src/hotspot/cpu/arm/register_arm.cpp +++ b/src/hotspot/cpu/arm/register_arm.cpp @@ -26,12 +26,19 @@ #include "register_arm.hpp" #include "utilities/debug.hpp" -const int ConcreteRegisterImpl::max_gpr = ConcreteRegisterImpl::num_gpr; -const int ConcreteRegisterImpl::max_fpr = ConcreteRegisterImpl::num_fpr + - ConcreteRegisterImpl::max_gpr; +Register::RegisterImpl all_RegisterImpls [Register::number_of_registers + 1]; +FloatRegister::FloatRegisterImpl all_FloatRegisterImpls [FloatRegister::number_of_registers + 1]; +VFPSystemRegister::VFPSystemRegisterImpl all_VFPSystemRegisterImpls [VFPSystemRegister::number_of_registers + 1] { + { -1 }, //vfpsnoreg + { VFPSystemRegister::FPSID }, + { VFPSystemRegister::FPSCR }, + { VFPSystemRegister::MVFR0 }, + { VFPSystemRegister::MVFR1 } +}; -const char* RegisterImpl::name() const { - const char* names[number_of_registers] = { +const char* Register::RegisterImpl::name() const { + static const char* names[number_of_registers + 1] = { + "noreg", "r0", "r1", "r2", "r3", "r4", "r5", "r6", #if (FP_REG_NUM == 7) "fp", @@ -46,13 +53,14 @@ const char* RegisterImpl::name() const { #endif "r12", "sp", "lr", "pc" }; - return is_valid() ? names[encoding()] : "noreg"; + return names[encoding() + 1]; } -const char* FloatRegisterImpl::name() const { - const char* names[number_of_registers] = { - "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", - "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", +const char* FloatRegister::FloatRegisterImpl::name() const { + static const char* names[number_of_registers + 1] = { + "fnoreg", + "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", + "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31" #ifdef COMPILER2 @@ -62,5 +70,5 @@ const char* FloatRegisterImpl::name() const { "s56", "s57?","s58", "s59?","s60", "s61?","s62", "s63?" #endif }; - return is_valid() ? names[encoding()] : "fnoreg"; + return names[encoding() + 1]; } diff --git a/src/hotspot/cpu/arm/register_arm.hpp b/src/hotspot/cpu/arm/register_arm.hpp index 9f486d2a6258..d56fcf04dd99 100644 --- a/src/hotspot/cpu/arm/register_arm.hpp +++ b/src/hotspot/cpu/arm/register_arm.hpp @@ -31,26 +31,6 @@ class VMRegImpl; typedef VMRegImpl* VMReg; -// These are declared ucontext.h -#undef R0 -#undef R1 -#undef R2 -#undef R3 -#undef R4 -#undef R5 -#undef R6 -#undef R7 -#undef R8 -#undef R9 -#undef R10 -#undef R11 -#undef R12 -#undef R13 -#undef R14 -#undef R15 - -#define R(r) ((Register)(r)) - ///////////////////////////////// // Support for different ARM ABIs // Note: default ABI is for linux @@ -94,25 +74,86 @@ typedef VMRegImpl* VMReg; #define ALIGN_WIDE_ARGUMENTS 1 #endif -#define R0 ((Register)0) -#define R1 ((Register)1) -#define R2 ((Register)2) -#define R3 ((Register)3) -#define R4 ((Register)4) -#define R5 ((Register)5) -#define R6 ((Register)6) -#define R7 ((Register)7) -#define R8 ((Register)8) -#define R9 ((Register)9) -#define R10 ((Register)10) -#define R11 ((Register)11) -#define R12 ((Register)12) -#define R13 ((Register)13) -#define R14 ((Register)14) -#define R15 ((Register)15) - - -#define FP ((Register)FP_REG_NUM) +class Register { + private: + int _encoding; + + constexpr explicit Register(int encoding) : _encoding(encoding) {} + + public: + enum { + number_of_registers = 16, + max_slots_per_register = 1 + }; + + class RegisterImpl : public AbstractRegisterImpl { + friend class Register; + + static constexpr const RegisterImpl* first(); + + public: + + // accessors and testers + int raw_encoding() const { return this - first(); } + int encoding() const { assert(is_valid(), "invalid register"); return raw_encoding(); } + bool is_valid() const { return 0 <= raw_encoding() && raw_encoding() < number_of_registers; } + + inline Register successor() const; + + VMReg as_VMReg() const; + + const char* name() const; + }; + + + inline friend constexpr Register as_Register(int encoding); + + constexpr Register() : _encoding(-1) {} //noreg + + int operator==(const Register r) const { return _encoding == r._encoding; } + int operator!=(const Register r) const { return _encoding != r._encoding; } + + const RegisterImpl* operator->() const { return RegisterImpl::first() + _encoding; } +}; + +extern Register::RegisterImpl all_RegisterImpls[Register::number_of_registers + 1] INTERNAL_VISIBILITY; + +inline constexpr const Register::RegisterImpl* Register::RegisterImpl::first() { + return all_RegisterImpls + 1; +} + +constexpr Register noreg = Register(); + +inline constexpr Register as_Register(int encoding) { + if (0 <= encoding && encoding < Register::number_of_registers) { + return Register(encoding); + } + return noreg; +} + +inline Register Register::RegisterImpl::successor() const { + assert(is_valid(), "sainty"); + return as_Register(encoding() + 1); +} + +constexpr Register R0 = as_Register( 0); +constexpr Register R1 = as_Register( 1); +constexpr Register R2 = as_Register( 2); +constexpr Register R3 = as_Register( 3); +constexpr Register R4 = as_Register( 4); +constexpr Register R5 = as_Register( 5); +constexpr Register R6 = as_Register( 6); +constexpr Register R7 = as_Register( 7); +constexpr Register R8 = as_Register( 8); +constexpr Register R9 = as_Register( 9); +constexpr Register R10 = as_Register(10); +constexpr Register R11 = as_Register(11); +constexpr Register R12 = as_Register(12); +constexpr Register R13 = as_Register(13); +constexpr Register R14 = as_Register(14); +constexpr Register R15 = as_Register(15); + +constexpr Register FP = as_Register(FP_REG_NUM); // Safe use of registers which may be FP on some platforms. // @@ -122,282 +163,340 @@ typedef VMRegImpl* VMReg; // as FP on supported ABIs (and replace R# by altFP_#_11). altFP_#_11 // must be #define to R11 if and only if # is FP_REG_NUM. #if (FP_REG_NUM == 7) -#define altFP_7_11 ((Register)11) +constexpr Register altFP_7_11 = R11; #else -#define altFP_7_11 ((Register)7) +constexpr Register altFP_7_11 = R7; #endif -#define SP R13 -#define LR R14 -#define PC R15 +constexpr Register SP = R13; +constexpr Register LR = R14; +constexpr Register PC = R15; -class RegisterImpl; -typedef RegisterImpl* Register; +class FloatRegister { + private: + int _encoding; -inline Register as_Register(int encoding) { - return (Register)(intptr_t)encoding; -} + constexpr explicit FloatRegister(int encoding) : _encoding(encoding) {} -class RegisterImpl : public AbstractRegisterImpl { public: enum { - number_of_registers = 16 + number_of_registers = NOT_COMPILER2(32) COMPILER2_PRESENT(64), + max_slots_per_register = 1 }; - Register successor() const { return as_Register(encoding() + 1); } + class FloatRegisterImpl : public AbstractRegisterImpl { + friend class FloatRegister; - inline friend Register as_Register(int encoding); + static constexpr const FloatRegisterImpl* first(); - VMReg as_VMReg(); + public: - // accessors - int encoding() const { assert(is_valid(), "invalid register"); return value(); } - const char* name() const; + // accessors and testers + int raw_encoding() const { return this - first(); } + int encoding() const { assert(is_valid(), "invalid register"); return raw_encoding(); } + bool is_valid() const { return 0 <= raw_encoding() && raw_encoding() < number_of_registers; } + inline FloatRegister successor() const; - // testers - bool is_valid() const { return 0 <= value() && value() < number_of_registers; } + VMReg as_VMReg() const; -}; - -CONSTANT_REGISTER_DECLARATION(Register, noreg, (-1)); + int hi_bits() const { + return (encoding() >> 1) & 0xf; + } + int lo_bit() const { + return encoding() & 1; + } -// Use FloatRegister as shortcut -class FloatRegisterImpl; -typedef FloatRegisterImpl* FloatRegister; + int hi_bit() const { + return encoding() >> 5; + } -inline FloatRegister as_FloatRegister(int encoding) { - return (FloatRegister)(intptr_t)encoding; -} - -class FloatRegisterImpl : public AbstractRegisterImpl { - public: - enum { - number_of_registers = NOT_COMPILER2(32) COMPILER2_PRESENT(64) + const char* name() const; }; - inline friend FloatRegister as_FloatRegister(int encoding); + inline friend constexpr FloatRegister as_FloatRegister(int encoding); - VMReg as_VMReg(); + constexpr FloatRegister() : _encoding(-1) {} // fnoreg - int encoding() const { assert(is_valid(), "invalid register"); return value(); } - bool is_valid() const { return 0 <= (intx)this && (intx)this < number_of_registers; } - FloatRegister successor() const { return as_FloatRegister(encoding() + 1); } + int operator==(const FloatRegister r) const { return _encoding == r._encoding; } + int operator!=(const FloatRegister r) const { return _encoding != r._encoding; } - const char* name() const; + const FloatRegisterImpl* operator->() const { return FloatRegisterImpl::first() + _encoding; } +}; - int hi_bits() const { - return (encoding() >> 1) & 0xf; - } +extern FloatRegister::FloatRegisterImpl all_FloatRegisterImpls[FloatRegister::number_of_registers + 1] INTERNAL_VISIBILITY; - int lo_bit() const { - return encoding() & 1; - } +inline constexpr const FloatRegister::FloatRegisterImpl* FloatRegister::FloatRegisterImpl::first() { + return all_FloatRegisterImpls + 1; +} - int hi_bit() const { - return encoding() >> 5; +constexpr FloatRegister fnoreg = FloatRegister(); + +inline constexpr FloatRegister as_FloatRegister(int encoding) { + if (0 <= encoding && encoding < FloatRegister::number_of_registers) { + return FloatRegister(encoding); } -}; + return fnoreg; +} -CONSTANT_REGISTER_DECLARATION(FloatRegister, fnoreg, (-1)); +inline FloatRegister FloatRegister::FloatRegisterImpl::successor() const { + assert(is_valid(), "sainty"); + return as_FloatRegister(encoding() + 1); +} /* * S1-S6 are named with "_reg" suffix to avoid conflict with * constants defined in sharedRuntimeTrig.cpp */ -CONSTANT_REGISTER_DECLARATION(FloatRegister, S0, ( 0)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S1_reg, ( 1)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S2_reg, ( 2)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S3_reg, ( 3)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S4_reg, ( 4)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S5_reg, ( 5)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S6_reg, ( 6)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S7, ( 7)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S8, ( 8)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S9, ( 9)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S10, (10)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S11, (11)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S12, (12)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S13, (13)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S14, (14)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S15, (15)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S16, (16)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S17, (17)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S18, (18)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S19, (19)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S20, (20)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S21, (21)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S22, (22)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S23, (23)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S24, (24)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S25, (25)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S26, (26)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S27, (27)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S28, (28)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S29, (29)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S30, (30)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, S31, (31)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, Stemp, (30)); - -CONSTANT_REGISTER_DECLARATION(FloatRegister, D0, ( 0)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D1, ( 2)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D2, ( 4)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D3, ( 6)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D4, ( 8)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D5, ( 10)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D6, ( 12)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D7, ( 14)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D8, ( 16)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D9, ( 18)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D10, ( 20)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D11, ( 22)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D12, ( 24)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D13, ( 26)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D14, ( 28)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D15, (30)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D16, (32)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D17, (34)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D18, (36)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D19, (38)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D20, (40)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D21, (42)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D22, (44)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D23, (46)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D24, (48)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D25, (50)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D26, (52)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D27, (54)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D28, (56)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D29, (58)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D30, (60)); -CONSTANT_REGISTER_DECLARATION(FloatRegister, D31, (62)); +constexpr FloatRegister S0 = as_FloatRegister( 0); +constexpr FloatRegister S1_reg = as_FloatRegister(1); +constexpr FloatRegister S2_reg = as_FloatRegister(2); +constexpr FloatRegister S3_reg = as_FloatRegister(3); +constexpr FloatRegister S4_reg = as_FloatRegister(4); +constexpr FloatRegister S5_reg = as_FloatRegister(5); +constexpr FloatRegister S6_reg = as_FloatRegister(6); +constexpr FloatRegister S7 = as_FloatRegister( 7); +constexpr FloatRegister S8 = as_FloatRegister( 8); +constexpr FloatRegister S9 = as_FloatRegister( 9); +constexpr FloatRegister S10 = as_FloatRegister(10); +constexpr FloatRegister S11 = as_FloatRegister(11); +constexpr FloatRegister S12 = as_FloatRegister(12); +constexpr FloatRegister S13 = as_FloatRegister(13); +constexpr FloatRegister S14 = as_FloatRegister(14); +constexpr FloatRegister S15 = as_FloatRegister(15); +constexpr FloatRegister S16 = as_FloatRegister(16); +constexpr FloatRegister S17 = as_FloatRegister(17); +constexpr FloatRegister S18 = as_FloatRegister(18); +constexpr FloatRegister S19 = as_FloatRegister(19); +constexpr FloatRegister S20 = as_FloatRegister(20); +constexpr FloatRegister S21 = as_FloatRegister(21); +constexpr FloatRegister S22 = as_FloatRegister(22); +constexpr FloatRegister S23 = as_FloatRegister(23); +constexpr FloatRegister S24 = as_FloatRegister(24); +constexpr FloatRegister S25 = as_FloatRegister(25); +constexpr FloatRegister S26 = as_FloatRegister(26); +constexpr FloatRegister S27 = as_FloatRegister(27); +constexpr FloatRegister S28 = as_FloatRegister(28); +constexpr FloatRegister S29 = as_FloatRegister(29); +constexpr FloatRegister S30 = as_FloatRegister(30); +constexpr FloatRegister S31 = as_FloatRegister(31); +constexpr FloatRegister Stemp = S30; + +constexpr FloatRegister D0 = as_FloatRegister( 0); +constexpr FloatRegister D1 = as_FloatRegister( 2); +constexpr FloatRegister D2 = as_FloatRegister( 4); +constexpr FloatRegister D3 = as_FloatRegister( 6); +constexpr FloatRegister D4 = as_FloatRegister( 8); +constexpr FloatRegister D5 = as_FloatRegister(10); +constexpr FloatRegister D6 = as_FloatRegister(12); +constexpr FloatRegister D7 = as_FloatRegister(14); +constexpr FloatRegister D8 = as_FloatRegister(16); +constexpr FloatRegister D9 = as_FloatRegister(18); +constexpr FloatRegister D10 = as_FloatRegister(20); +constexpr FloatRegister D11 = as_FloatRegister(22); +constexpr FloatRegister D12 = as_FloatRegister(24); +constexpr FloatRegister D13 = as_FloatRegister(26); +constexpr FloatRegister D14 = as_FloatRegister(28); +constexpr FloatRegister D15 = as_FloatRegister(30); +constexpr FloatRegister D16 = as_FloatRegister(32); +constexpr FloatRegister D17 = as_FloatRegister(34); +constexpr FloatRegister D18 = as_FloatRegister(36); +constexpr FloatRegister D19 = as_FloatRegister(38); +constexpr FloatRegister D20 = as_FloatRegister(40); +constexpr FloatRegister D21 = as_FloatRegister(42); +constexpr FloatRegister D22 = as_FloatRegister(44); +constexpr FloatRegister D23 = as_FloatRegister(46); +constexpr FloatRegister D24 = as_FloatRegister(48); +constexpr FloatRegister D25 = as_FloatRegister(50); +constexpr FloatRegister D26 = as_FloatRegister(52); +constexpr FloatRegister D27 = as_FloatRegister(54); +constexpr FloatRegister D28 = as_FloatRegister(56); +constexpr FloatRegister D29 = as_FloatRegister(58); +constexpr FloatRegister D30 = as_FloatRegister(60); +constexpr FloatRegister D31 = as_FloatRegister(62); class ConcreteRegisterImpl : public AbstractRegisterImpl { public: enum { - log_vmregs_per_word = LogBytesPerWord - LogBytesPerInt, // VMRegs are of 4-byte size -#ifdef COMPILER2 - log_bytes_per_fpr = 2, // quad vectors -#else - log_bytes_per_fpr = 2, // double vectors -#endif - log_words_per_fpr = log_bytes_per_fpr - LogBytesPerWord, - words_per_fpr = 1 << log_words_per_fpr, - log_vmregs_per_fpr = log_bytes_per_fpr - LogBytesPerInt, - log_vmregs_per_gpr = log_vmregs_per_word, - vmregs_per_gpr = 1 << log_vmregs_per_gpr, - vmregs_per_fpr = 1 << log_vmregs_per_fpr, - - num_gpr = RegisterImpl::number_of_registers << log_vmregs_per_gpr, - max_gpr0 = num_gpr, - num_fpr = FloatRegisterImpl::number_of_registers << log_vmregs_per_fpr, - max_fpr0 = max_gpr0 + num_fpr, - number_of_registers = num_gpr + num_fpr + 1+1 // APSR and FPSCR so that c2's REG_COUNT <= ConcreteRegisterImpl::number_of_registers - }; + max_gpr = Register::number_of_registers * Register::max_slots_per_register, + max_fpr = max_gpr + FloatRegister::number_of_registers * FloatRegister::max_slots_per_register, - static const int max_gpr; - static const int max_fpr; + number_of_registers = max_fpr + 1+1 // APSR and FPSCR so that c2's REG_COUNT <= ConcreteRegisterImpl::number_of_registers + }; }; -class VFPSystemRegisterImpl; -typedef VFPSystemRegisterImpl* VFPSystemRegister; -class VFPSystemRegisterImpl : public AbstractRegisterImpl { +typedef AbstractRegSet RegSet; +typedef AbstractRegSet FloatRegSet; + +template <> +inline Register AbstractRegSet::first() { + if (_bitset == 0) { return noreg; } + return as_Register(count_trailing_zeros(_bitset)); +} + + +template <> +inline FloatRegister AbstractRegSet::first() { + uint32_t first = _bitset & -_bitset; + return first ? as_FloatRegister(exact_log2(first)) : fnoreg; +} + + +class VFPSystemRegister { + private: + int _store_idx; + + constexpr explicit VFPSystemRegister(int store_idx) : _store_idx(store_idx) {} + + enum { + _FPSID_store_idx = 0, + _FPSCR_store_idx = 1, + _MVFR0_store_idx = 2, + _MVFR1_store_idx = 3 + }; + public: - int encoding() const { return value(); } + enum { + FPSID = 0, + FPSCR = 1, + MVFR0 = 6, + MVFR1 = 7, + number_of_registers = 4 + }; + + class VFPSystemRegisterImpl : public AbstractRegisterImpl { + friend class VFPSystemRegister; + + int _encoding; + + static constexpr const VFPSystemRegisterImpl* first(); + + public: + constexpr VFPSystemRegisterImpl(int encoding) : _encoding(encoding) {} + + int encoding() const { return _encoding; } + }; + + inline friend constexpr VFPSystemRegister as_VFPSystemRegister(int encoding); + + constexpr VFPSystemRegister() : _store_idx(-1) {} // vfpsnoreg + + int operator==(const VFPSystemRegister r) const { return _store_idx == r._store_idx; } + int operator!=(const VFPSystemRegister r) const { return _store_idx != r._store_idx; } + + const VFPSystemRegisterImpl* operator->() const { return VFPSystemRegisterImpl::first() + _store_idx; } }; -#define FPSID ((VFPSystemRegister)0) -#define FPSCR ((VFPSystemRegister)1) -#define MVFR0 ((VFPSystemRegister)0x6) -#define MVFR1 ((VFPSystemRegister)0x7) +extern VFPSystemRegister::VFPSystemRegisterImpl all_VFPSystemRegisterImpls[VFPSystemRegister::number_of_registers + 1] INTERNAL_VISIBILITY; + +inline constexpr const VFPSystemRegister::VFPSystemRegisterImpl* VFPSystemRegister::VFPSystemRegisterImpl::first() { + return all_VFPSystemRegisterImpls + 1; +} + +constexpr VFPSystemRegister vfpsnoreg = VFPSystemRegister(); + +inline constexpr VFPSystemRegister as_VFPSystemRegister(int encoding) { + switch (encoding) { + case VFPSystemRegister::FPSID: return VFPSystemRegister(VFPSystemRegister::_FPSID_store_idx); + case VFPSystemRegister::FPSCR: return VFPSystemRegister(VFPSystemRegister::_FPSCR_store_idx); + case VFPSystemRegister::MVFR0: return VFPSystemRegister(VFPSystemRegister::_MVFR0_store_idx); + case VFPSystemRegister::MVFR1: return VFPSystemRegister(VFPSystemRegister::_MVFR1_store_idx); + default: return vfpsnoreg; + } +} + +constexpr VFPSystemRegister FPSID = as_VFPSystemRegister(VFPSystemRegister::FPSID); +constexpr VFPSystemRegister FPSCR = as_VFPSystemRegister(VFPSystemRegister::FPSCR); +constexpr VFPSystemRegister MVFR0 = as_VFPSystemRegister(VFPSystemRegister::MVFR0); +constexpr VFPSystemRegister MVFR1 = as_VFPSystemRegister(VFPSystemRegister::MVFR1); /* * Register definitions shared across interpreter and compiler */ -#define Rexception_obj R4 -#define Rexception_pc R5 +constexpr Register Rexception_obj = R4; +constexpr Register Rexception_pc = R5; /* * Interpreter register definitions common to C++ and template interpreters. */ -#define Rlocals R8 -#define Rmethod R9 -#define Rthread R10 -#define Rtemp R12 +constexpr Register Rlocals = R8; +constexpr Register Rmethod = R9; +constexpr Register Rthread = R10; +constexpr Register Rtemp = R12; // Interpreter calling conventions -#define Rparams SP -#define Rsender_sp R4 +constexpr Register Rparams = SP; +constexpr Register Rsender_sp = R4; // JSR292 // Note: R5_mh is needed only during the call setup, including adapters // This does not seem to conflict with Rexception_pc // In case of issues, R3 might be OK but adapters calling the runtime would have to save it -#define R5_mh R5 // MethodHandle register, used during the call setup -#define Rmh_SP_save FP // for C1 +constexpr Register R5_mh = R5; // MethodHandle register, used during the call setup +constexpr Register Rmh_SP_save = FP; // for C1 /* * C++ Interpreter Register Defines */ -#define Rsave0 R4 -#define Rsave1 R5 -#define Rsave2 R6 -#define Rstate altFP_7_11 // R7 or R11 -#define Ricklass R8 +constexpr Register Rsave0 = R4; +constexpr Register Rsave1 = R5; +constexpr Register Rsave2 = R6; +constexpr Register Rstate = altFP_7_11; // R7 or R11 +constexpr Register Ricklass = R8; /* * TemplateTable Interpreter Register Usage */ // Temporary registers -#define R0_tmp R0 -#define R1_tmp R1 -#define R2_tmp R2 -#define R3_tmp R3 -#define R4_tmp R4 -#define R5_tmp R5 -#define R12_tmp R12 -#define LR_tmp LR +constexpr Register R0_tmp = R0; +constexpr Register R1_tmp = R1; +constexpr Register R2_tmp = R2; +constexpr Register R3_tmp = R3; +constexpr Register R4_tmp = R4; +constexpr Register R5_tmp = R5; +constexpr Register R12_tmp = R12; +constexpr Register LR_tmp = LR; -#define S0_tmp S0 -#define S1_tmp S1_reg +constexpr FloatRegister S0_tmp = S0; +constexpr FloatRegister S1_tmp = S1_reg; -#define D0_tmp D0 -#define D1_tmp D1 +constexpr FloatRegister D0_tmp = D0; +constexpr FloatRegister D1_tmp = D1; // Temporary registers saved across VM calls (according to C calling conventions) -#define Rtmp_save0 R4 -#define Rtmp_save1 R5 +constexpr Register Rtmp_save0 = R4; +constexpr Register Rtmp_save1 = R5; // Cached TOS value -#define R0_tos R0 +constexpr Register R0_tos = R0; -#define R0_tos_lo R0 -#define R1_tos_hi R1 +constexpr Register R0_tos_lo = R0; +constexpr Register R1_tos_hi = R1; -#define S0_tos S0 -#define D0_tos D0 +constexpr FloatRegister S0_tos = S0; +constexpr FloatRegister D0_tos = D0; // Dispatch table -#define RdispatchTable R6 +constexpr Register RdispatchTable = R6; // Bytecode pointer -#define Rbcp altFP_7_11 +constexpr Register Rbcp = altFP_7_11; // Pre-loaded next bytecode for the dispatch -#define R3_bytecode R3 +constexpr Register R3_bytecode = R3; // Conventions between bytecode templates and stubs -#define R2_ClassCastException_obj R2 -#define R4_ArrayIndexOutOfBounds_index R4 +constexpr Register R2_ClassCastException_obj = R2; +constexpr Register R4_ArrayIndexOutOfBounds_index = R4; // Interpreter expression stack top -#define Rstack_top SP +constexpr Register Rstack_top = SP; /* * Linux 32-bit ARM C ABI Register calling conventions @@ -420,10 +519,11 @@ class VFPSystemRegisterImpl : public AbstractRegisterImpl { * R14 (LR) Link register * R15 (PC) Program Counter */ -#define c_rarg0 R0 -#define c_rarg1 R1 -#define c_rarg2 R2 -#define c_rarg3 R3 + +constexpr Register c_rarg0 = R0; +constexpr Register c_rarg1 = R1; +constexpr Register c_rarg2 = R2; +constexpr Register c_rarg3 = R3; #define GPR_PARAMS 4 @@ -431,10 +531,10 @@ class VFPSystemRegisterImpl : public AbstractRegisterImpl { // Java ABI // XXX Is this correct? -#define j_rarg0 c_rarg0 -#define j_rarg1 c_rarg1 -#define j_rarg2 c_rarg2 -#define j_rarg3 c_rarg3 +constexpr Register j_rarg0 = c_rarg0; +constexpr Register j_rarg1 = c_rarg1; +constexpr Register j_rarg2 = c_rarg2; +constexpr Register j_rarg3 = c_rarg3; #endif // CPU_ARM_REGISTER_ARM_HPP diff --git a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp index d55cdfb02514..d53b360b977b 100644 --- a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp +++ b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp @@ -71,7 +71,7 @@ class RegisterSaver { enum RegisterLayout { - fpu_save_size = FloatRegisterImpl::number_of_registers, + fpu_save_size = FloatRegister::number_of_registers, #ifndef __SOFTFP__ D0_offset = 0, #endif @@ -140,8 +140,8 @@ OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, if (VM_Version::has_vfp3_32()) { __ fpush(FloatRegisterSet(D16, 16)); } else { - if (FloatRegisterImpl::number_of_registers > 32) { - assert(FloatRegisterImpl::number_of_registers == 64, "nb fp registers should be 64"); + if (FloatRegister::number_of_registers > 32) { + assert(FloatRegister::number_of_registers == 64, "nb fp registers should be 64"); __ sub(SP, SP, 32 * wordSize); } } @@ -183,8 +183,8 @@ void RegisterSaver::restore_live_registers(MacroAssembler* masm, bool restore_lr if (VM_Version::has_vfp3_32()) { __ fpop(FloatRegisterSet(D16, 16)); } else { - if (FloatRegisterImpl::number_of_registers > 32) { - assert(FloatRegisterImpl::number_of_registers == 64, "nb fp registers should be 64"); + if (FloatRegister::number_of_registers > 32) { + assert(FloatRegister::number_of_registers == 64, "nb fp registers should be 64"); __ add(SP, SP, 32 * wordSize); } } diff --git a/src/hotspot/cpu/arm/vmreg_arm.cpp b/src/hotspot/cpu/arm/vmreg_arm.cpp index c7c972db5c9b..c82f60c97d05 100644 --- a/src/hotspot/cpu/arm/vmreg_arm.cpp +++ b/src/hotspot/cpu/arm/vmreg_arm.cpp @@ -31,14 +31,14 @@ void VMRegImpl::set_regName() { Register reg = ::as_Register(0); int i; for (i = 0; i < ConcreteRegisterImpl::max_gpr; reg = reg->successor()) { - for (int j = 0; j < (1 << ConcreteRegisterImpl::log_vmregs_per_gpr); j++) { + for (int j = 0; j < Register::max_slots_per_register; j++) { regName[i++] = reg->name(); } } #ifndef __SOFTFP__ FloatRegister freg = ::as_FloatRegister(0); for ( ; i < ConcreteRegisterImpl::max_fpr ; ) { - for (int j = 0; j < (1 << ConcreteRegisterImpl::log_vmregs_per_fpr); j++) { + for (int j = 0; j < Register::max_slots_per_register; j++) { regName[i++] = freg->name(); } freg = freg->successor(); diff --git a/src/hotspot/cpu/arm/vmreg_arm.hpp b/src/hotspot/cpu/arm/vmreg_arm.hpp index c13f443b804f..f1dfd09a1e69 100644 --- a/src/hotspot/cpu/arm/vmreg_arm.hpp +++ b/src/hotspot/cpu/arm/vmreg_arm.hpp @@ -36,20 +36,20 @@ inline Register as_Register() { assert(is_Register(), "must be"); assert(is_concrete(), "concrete register expected"); - return ::as_Register(value() >> ConcreteRegisterImpl::log_vmregs_per_gpr); + return ::as_Register(value() / Register::max_slots_per_register); } inline FloatRegister as_FloatRegister() { assert(is_FloatRegister(), "must be"); assert(is_concrete(), "concrete register expected"); - return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) >> ConcreteRegisterImpl::log_vmregs_per_fpr); + return ::as_FloatRegister((value() - ConcreteRegisterImpl::max_gpr) / FloatRegister::max_slots_per_register); } inline bool is_concrete() { if (is_Register()) { - return ((value() & right_n_bits(ConcreteRegisterImpl::log_vmregs_per_gpr)) == 0); + return (value() % Register::max_slots_per_register == 0); } else if (is_FloatRegister()) { - return (((value() - ConcreteRegisterImpl::max_gpr) & right_n_bits(ConcreteRegisterImpl::log_vmregs_per_fpr)) == 0); + return (value() % FloatRegister::max_slots_per_register == 0); // Single slot } else { return false; } diff --git a/src/hotspot/cpu/arm/vmreg_arm.inline.hpp b/src/hotspot/cpu/arm/vmreg_arm.inline.hpp index f122b9ede701..3e5c18dbda0a 100644 --- a/src/hotspot/cpu/arm/vmreg_arm.inline.hpp +++ b/src/hotspot/cpu/arm/vmreg_arm.inline.hpp @@ -25,11 +25,11 @@ #ifndef CPU_ARM_VMREG_ARM_INLINE_HPP #define CPU_ARM_VMREG_ARM_INLINE_HPP -inline VMReg RegisterImpl::as_VMReg() { - return VMRegImpl::as_VMReg(encoding() << ConcreteRegisterImpl::log_vmregs_per_gpr); +inline VMReg Register::RegisterImpl::as_VMReg() const { + return VMRegImpl::as_VMReg(encoding() * Register::max_slots_per_register); } -inline VMReg FloatRegisterImpl::as_VMReg() { - return VMRegImpl::as_VMReg((encoding() << ConcreteRegisterImpl::log_vmregs_per_fpr) + ConcreteRegisterImpl::max_gpr); +inline VMReg FloatRegister::FloatRegisterImpl::as_VMReg() const { + return VMRegImpl::as_VMReg((encoding() * FloatRegister::max_slots_per_register) + ConcreteRegisterImpl::max_gpr); } #endif // CPU_ARM_VMREG_ARM_INLINE_HPP diff --git a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp index d504c71e2b8b..608f8f919463 100644 --- a/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c2_MacroAssembler_ppc.cpp @@ -594,9 +594,11 @@ void C2_MacroAssembler::count_positives(Register src, Register cnt, Register res bind(Lslow); // Fallback to slow version. subf(tmp0, src, result); // Bytes known positive. - subf_(tmp0, tmp0, cnt); // Remaining Bytes. + clrldi(tmp1, cnt, 32); // Clear garbage from upper 32 bits. + subf_(tmp0, tmp0, tmp1); // Remaining Bytes. beq(CCR0, Ldone); mtctr(tmp0); + bind(Lloop); lbz(tmp0, 0, result); andi_(tmp0, tmp0, 0x80); diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp index adc40748fe7c..7e847e651844 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp @@ -4440,7 +4440,7 @@ void MacroAssembler::push_cont_fastpath() { Label done; ld_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread); cmpld(CCR0, R1_SP, R0); - ble(CCR0, done); + ble(CCR0, done); // if (SP <= _cont_fastpath) goto done; st_ptr(R1_SP, JavaThread::cont_fastpath_offset(), R16_thread); bind(done); } @@ -4449,7 +4449,7 @@ void MacroAssembler::pop_cont_fastpath() { Label done; ld_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread); cmpld(CCR0, R1_SP, R0); - ble(CCR0, done); + blt(CCR0, done); // if (SP < _cont_fastpath) goto done; li(R0, 0); st_ptr(R0, JavaThread::cont_fastpath_offset(), R16_thread); bind(done); diff --git a/src/hotspot/cpu/ppc/registerMap_ppc.cpp b/src/hotspot/cpu/ppc/registerMap_ppc.cpp new file mode 100644 index 000000000000..e26e85df555f --- /dev/null +++ b/src/hotspot/cpu/ppc/registerMap_ppc.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026 SAP SE. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include "runtime/registerMap.hpp" + +address RegisterMap::pd_location(VMReg base_reg, int slot_idx) const { + if (base_reg->is_VectorSRegister()) { + // Not all physical slots belonging to a VectorRegister have corresponding + // valid VMReg locations in the RegisterMap. + // (See RegisterSaver::push_frame_reg_args_and_save_live_registers.) + // However, the slots are always saved to the stack in a contiguous region + // of memory so we can calculate the address of the upper slots by + // offsetting from the base address. + assert(base_reg->is_concrete(), "must pass base reg"); + address base_location = location(base_reg, nullptr); + if (base_location != nullptr) { + intptr_t offset_in_bytes = slot_idx * VMRegImpl::stack_slot_size; + return base_location + offset_in_bytes; + } else { + return nullptr; + } + } else { + return location(base_reg->next(slot_idx), nullptr); + } +} diff --git a/src/hotspot/cpu/ppc/registerMap_ppc.hpp b/src/hotspot/cpu/ppc/registerMap_ppc.hpp index 01eb642107cb..607c712d10f2 100644 --- a/src/hotspot/cpu/ppc/registerMap_ppc.hpp +++ b/src/hotspot/cpu/ppc/registerMap_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2013 SAP SE. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,9 +35,7 @@ // Since there is none, we just return null. address pd_location(VMReg reg) const { return nullptr; } - address pd_location(VMReg base_reg, int slot_idx) const { - return location(base_reg->next(slot_idx), nullptr); - } + address pd_location(VMReg base_reg, int slot_idx) const; // no PD state to clear or copy: void pd_clear() {} diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp index 2281c083b98c..0790eceddc25 100644 --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp @@ -105,7 +105,7 @@ class RegisterSaver { // During deoptimization only the result registers need to be restored // all the other values have already been extracted. - static void restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes); + static void restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes, bool save_vectors); // Constants and data structures: @@ -355,6 +355,7 @@ OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssemble __ li(R30, offset); __ stxvd2x(as_VectorSRegister(reg_num), R30, R1_SP); + // RegisterMap::pd_location only uses the first VMReg for each VectorRegister. if (generate_oop_map) { map->set_callee_saved(VMRegImpl::stack2reg(offset>>2), RegisterSaver_LiveVSRegs[i].vmreg); @@ -528,10 +529,14 @@ void RegisterSaver::restore_argument_registers_and_pop_frame(MacroAssembler*masm } // Restore the registers that might be holding a result. -void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes) { +void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes, bool save_vectors) { const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / sizeof(RegisterSaver::LiveRegType); - const int register_save_size = regstosave_num * reg_size; // VS registers not relevant here. + const int vecregstosave_num = save_vectors ? (sizeof(RegisterSaver_LiveVSRegs) / + sizeof(RegisterSaver::LiveRegType)) + : 0; + const int register_save_size = regstosave_num * reg_size + vecregstosave_num * vs_reg_size; + const int register_save_offset = frame_size_in_bytes - register_save_size; // restore all result registers (ints and floats) @@ -560,7 +565,7 @@ void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_siz offset += reg_size; } - assert(offset == frame_size_in_bytes, "consistency check"); + assert(offset == frame_size_in_bytes - (save_vectors ? vecregstosave_num * vs_reg_size : 0), "consistency check"); } // Is vector's size (in bytes) bigger than a size saved by default? @@ -2984,7 +2989,8 @@ void SharedRuntime::generate_deopt_blob() { &first_frame_size_in_bytes, /*generate_oop_map=*/ true, return_pc_adjustment_no_exception, - RegisterSaver::return_pc_is_lr); + RegisterSaver::return_pc_is_lr, + /*save_vectors*/ SuperwordUseVSX); assert(map != nullptr, "OopMap must have been created"); __ li(exec_mode_reg, Deoptimization::Unpack_deopt); @@ -3019,7 +3025,8 @@ void SharedRuntime::generate_deopt_blob() { &first_frame_size_in_bytes, /*generate_oop_map=*/ false, /*return_pc_adjustment_exception=*/ 0, - RegisterSaver::return_pc_is_pre_saved); + RegisterSaver::return_pc_is_pre_saved, + /*save_vectors*/ SuperwordUseVSX); // Deopt during an exception. Save exec mode for unpack_frames. __ li(exec_mode_reg, Deoptimization::Unpack_exception); @@ -3037,7 +3044,8 @@ void SharedRuntime::generate_deopt_blob() { &first_frame_size_in_bytes, /*generate_oop_map=*/ false, /*return_pc_adjustment_reexecute=*/ 0, - RegisterSaver::return_pc_is_pre_saved); + RegisterSaver::return_pc_is_pre_saved, + /*save_vectors*/ SuperwordUseVSX); __ li(exec_mode_reg, Deoptimization::Unpack_reexecute); #endif @@ -3063,7 +3071,7 @@ void SharedRuntime::generate_deopt_blob() { // Restore only the result registers that have been saved // by save_volatile_registers(...). - RegisterSaver::restore_result_registers(masm, first_frame_size_in_bytes); + RegisterSaver::restore_result_registers(masm, first_frame_size_in_bytes, /*save_vectors*/ SuperwordUseVSX); // reload the exec mode from the UnrollBlock (it might have changed) __ lwz(exec_mode_reg, in_bytes(Deoptimization::UnrollBlock::unpack_kind_offset()), unroll_block_reg); diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.cpp b/src/hotspot/cpu/ppc/vm_version_ppc.cpp index e5037482c447..0543885a4752 100644 --- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp +++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp @@ -26,6 +26,7 @@ #include "precompiled.hpp" #include "asm/assembler.inline.hpp" #include "asm/macroAssembler.inline.hpp" +#include "compiler/compilerDefinitions.inline.hpp" #include "compiler/disassembler.hpp" #include "jvm.h" #include "memory/resourceArea.hpp" @@ -130,7 +131,7 @@ void VM_Version::initialize() { } if (PowerArchitecturePPC64 >= 8) { - if (FLAG_IS_DEFAULT(SuperwordUseVSX)) { + if (FLAG_IS_DEFAULT(SuperwordUseVSX) && CompilerConfig::is_c2_enabled()) { FLAG_SET_ERGO(SuperwordUseVSX, true); } } else { diff --git a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp index 26d60441c2d2..ed828f9356b4 100644 --- a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp @@ -298,7 +298,7 @@ void ShenandoahBarrierSetAssembler::load_reference_barrier(MacroAssembler* masm, } else { assert(is_phantom, "only remaining strength"); assert(!is_narrow, "phantom access cannot be narrow"); - target = CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_weak); + target = CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_phantom); } __ call(target); __ mv(t0, x10); diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 67592d37bb5d..a4bd69fa0583 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -177,7 +177,7 @@ static void vmembk_print_on(outputStream* os); //////////////////////////////////////////////////////////////////////////////// // global variables (for a description see os_aix.hpp) -julong os::Aix::_physical_memory = 0; +physical_memory_size_type os::Aix::_physical_memory = 0; pthread_t os::Aix::_main_thread = ((pthread_t)0); @@ -265,28 +265,29 @@ static bool is_close_to_brk(address a) { return false; } -julong os::free_memory() { - return Aix::available_memory(); +bool os::free_memory(physical_memory_size_type& value) { + return Aix::available_memory(value); } -julong os::available_memory() { - return Aix::available_memory(); +bool os::available_memory(physical_memory_size_type& value) { + return Aix::available_memory(value); } -julong os::Aix::available_memory() { +bool os::Aix::available_memory(physical_memory_size_type& value) { // Avoid expensive API call here, as returned value will always be null. if (os::Aix::on_pase()) { return 0x0LL; } os::Aix::meminfo_t mi; if (os::Aix::get_meminfo(&mi)) { - return mi.real_free; + value = static_cast(mi.real_free); + return true; } else { - return ULONG_MAX; + return false; } } -julong os::physical_memory() { +physical_memory_size_type os::physical_memory() { return Aix::physical_memory(); } @@ -357,7 +358,7 @@ void os::Aix::initialize_system_info() { if (!os::Aix::get_meminfo(&mi)) { assert(false, "os::Aix::get_meminfo failed."); } - _physical_memory = (julong) mi.real_total; + _physical_memory = static_cast(mi.real_total); } // Helper function for tracing page sizes. @@ -1133,6 +1134,8 @@ static void* dll_load_library(const char *filename, int *eno, char *ebuf, int eb dflags |= RTLD_MEMBER; } + Events::log_dll_message(nullptr, "Attempting to load shared library %s", filename); + void* result; const char* error_report = nullptr; result = Aix_dlopen(filename, dflags, eno, &error_report); @@ -2406,7 +2409,7 @@ jint os::init_2(void) { } trcVerbose("processor count: %d", os::_processor_count); - trcVerbose("physical memory: %lu", Aix::_physical_memory); + trcVerbose("physical memory: " PHYS_MEM_TYPE_FORMAT, Aix::_physical_memory); // Initially build up the loaded dll map. LoadedLibraries::reload(); diff --git a/src/hotspot/os/aix/os_aix.hpp b/src/hotspot/os/aix/os_aix.hpp index 8cb49b5fe74a..7e47ced50887 100644 --- a/src/hotspot/os/aix/os_aix.hpp +++ b/src/hotspot/os/aix/os_aix.hpp @@ -35,7 +35,7 @@ class os::Aix { private: - static julong _physical_memory; + static physical_memory_size_type _physical_memory; static pthread_t _main_thread; // -1 = uninitialized, 0 = AIX, 1 = OS/400 (PASE) @@ -58,9 +58,9 @@ class os::Aix { // 1 - EXTSHM=ON static int _extshm; - static julong available_memory(); - static julong free_memory(); - static julong physical_memory() { return _physical_memory; } + static bool available_memory(physical_memory_size_type& value); + static bool free_memory(physical_memory_size_type& value); + static physical_memory_size_type physical_memory() { return _physical_memory; } static void initialize_system_info(); // OS recognitions (PASE/AIX, OS level) call this before calling any diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 155920e0a5a2..4db4c9c3a085 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -120,7 +120,7 @@ //////////////////////////////////////////////////////////////////////////////// // global variables -julong os::Bsd::_physical_memory = 0; +physical_memory_size_type os::Bsd::_physical_memory = 0; #ifdef __APPLE__ mach_timebase_info_data_t os::Bsd::_timebase_info = {0, 0}; @@ -139,17 +139,17 @@ static volatile int processor_id_next = 0; //////////////////////////////////////////////////////////////////////////////// // utility functions -julong os::available_memory() { - return Bsd::available_memory(); +bool os::available_memory(physical_memory_size_type& value) { + return Bsd::available_memory(value); } -julong os::free_memory() { - return Bsd::available_memory(); +bool os::free_memory(physical_memory_size_type& value) { + return Bsd::available_memory(value); } // available here means free -julong os::Bsd::available_memory() { - uint64_t available = physical_memory() >> 2; +bool os::Bsd::available_memory(physical_memory_size_type& value) { + physical_memory_size_type available = physical_memory() >> 2; #ifdef __APPLE__ mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; vm_statistics64_data_t vmstat; @@ -159,9 +159,12 @@ julong os::Bsd::available_memory() { "host_statistics64 failed - check mach_host_self() and count"); if (kerr == KERN_SUCCESS) { available = vmstat.free_count * os::vm_page_size(); + } else { + return false; } #endif - return available; + value = available; + return true; } // for more info see : @@ -180,7 +183,7 @@ void os::Bsd::print_uptime_info(outputStream* st) { } } -julong os::physical_memory() { +physical_memory_size_type os::physical_memory() { return Bsd::physical_memory(); } @@ -254,7 +257,7 @@ void os::Bsd::initialize_system_info() { len = sizeof(mem_val); if (sysctl(mib, 2, &mem_val, &len, nullptr, 0) != -1) { assert(len == sizeof(mem_val), "unexpected data size"); - _physical_memory = mem_val; + _physical_memory = static_cast(mem_val); } else { _physical_memory = 256 * 1024 * 1024; // fallback (XXXBSD?) } @@ -265,7 +268,7 @@ void os::Bsd::initialize_system_info() { // datasize rlimit restricts us anyway. struct rlimit limits; getrlimit(RLIMIT_DATA, &limits); - _physical_memory = MIN2(_physical_memory, (julong)limits.rlim_cur); + _physical_memory = MIN2(_physical_memory, static_cast(limits.rlim_cur)); } #endif } @@ -987,6 +990,8 @@ void *os::Bsd::dlopen_helper(const char *filename, int mode) { assert(rtn == 0, "fegetenv must succeed"); #endif // IA32 + Events::log_dll_message(nullptr, "Attempting to load shared library %s", filename); + void * result= ::dlopen(filename, RTLD_LAZY); #ifndef IA32 @@ -1415,10 +1420,13 @@ void os::print_memory_info(outputStream* st) { st->print("Memory:"); st->print(" " SIZE_FORMAT "k page", os::vm_page_size()>>10); - st->print(", physical " UINT64_FORMAT "k", - os::physical_memory() >> 10); - st->print("(" UINT64_FORMAT "k free)", - os::available_memory() >> 10); + physical_memory_size_type phys_mem = os::physical_memory(); + st->print(", physical " PHYS_MEM_TYPE_FORMAT "k", + phys_mem >> 10); + physical_memory_size_type avail_mem = 0; + (void)os::available_memory(avail_mem); + st->print("(" PHYS_MEM_TYPE_FORMAT "k free)", + avail_mem >> 10); if((sysctlbyname("vm.swapusage", &swap_usage, &size, nullptr, 0) == 0) || (errno == ENOMEM)) { if (size >= offset_of(xsw_usage, xsu_used)) { diff --git a/src/hotspot/os/bsd/os_bsd.hpp b/src/hotspot/os/bsd/os_bsd.hpp index f79212bc43c0..f8317ed0c8d7 100644 --- a/src/hotspot/os/bsd/os_bsd.hpp +++ b/src/hotspot/os/bsd/os_bsd.hpp @@ -42,12 +42,12 @@ class os::Bsd { protected: - static julong _physical_memory; + static physical_memory_size_type _physical_memory; static pthread_t _main_thread; - static julong available_memory(); - static julong free_memory(); - static julong physical_memory() { return _physical_memory; } + static bool available_memory(physical_memory_size_type& value); + static bool free_memory(physical_memory_size_type& value); + static physical_memory_size_type physical_memory() { return _physical_memory; } static void initialize_system_info(); static void rebuild_cpu_to_node_map(); diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp index 1186c78b865a..99648021a5b1 100644 --- a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp @@ -62,7 +62,7 @@ CgroupSubsystem* CgroupSubsystemFactory::create() { CgroupV1MemoryController* memory = nullptr; CgroupV1Controller* cpuset = nullptr; CgroupV1CpuController* cpu = nullptr; - CgroupV1Controller* cpuacct = nullptr; + CgroupV1CpuacctController* cpuacct = nullptr; CgroupV1Controller* pids = nullptr; CgroupInfo cg_infos[CG_INFO_LENGTH]; u1 cg_type_flags = INVALID_CGROUPS_GENERIC; @@ -105,9 +105,10 @@ CgroupSubsystem* CgroupSubsystemFactory::create() { CgroupV2CpuController* cpu = new CgroupV2CpuController(CgroupV2Controller(cg_infos[CPU_IDX]._mount_path, cg_infos[CPU_IDX]._cgroup_path, cg_infos[CPU_IDX]._read_only)); + CgroupV2CpuacctController* cpuacct = new CgroupV2CpuacctController(cpu); log_debug(os, container)("Detected cgroups v2 unified hierarchy"); cleanup(cg_infos); - return new CgroupV2Subsystem(memory, cpu, mem_other); + return new CgroupV2Subsystem(memory, cpu, cpuacct, mem_other); } /* @@ -150,7 +151,7 @@ CgroupSubsystem* CgroupSubsystemFactory::create() { cpu = new CgroupV1CpuController(CgroupV1Controller(info._root_mount_path, info._mount_path, info._read_only)); cpu->set_subsystem_path(info._cgroup_path); } else if (strcmp(info._name, "cpuacct") == 0) { - cpuacct = new CgroupV1Controller(info._root_mount_path, info._mount_path, info._read_only); + cpuacct = new CgroupV1CpuacctController(CgroupV1Controller(info._root_mount_path, info._mount_path, info._read_only)); cpuacct->set_subsystem_path(info._cgroup_path); } else if (strcmp(info._name, "pids") == 0) { pids = new CgroupV1Controller(info._root_mount_path, info._mount_path, info._read_only); @@ -669,8 +670,8 @@ jlong CgroupSubsystem::memory_limit_in_bytes() { if (!memory_limit->should_check_metric()) { return memory_limit->value(); } - jlong phys_mem = os::Linux::physical_memory(); - log_trace(os, container)("total physical memory: " JLONG_FORMAT, phys_mem); + julong phys_mem = static_cast(os::Linux::physical_memory()); + log_trace(os, container)("total physical memory: " JULONG_FORMAT, phys_mem); jlong mem_limit = contrl->controller()->read_memory_limit_in_bytes(phys_mem); // Update cached metric to avoid re-reading container settings too often memory_limit->set_value(mem_limit, OSCONTAINER_CACHE_TIMEOUT); @@ -840,16 +841,20 @@ jlong CgroupController::limit_from_str(char* limit_str) { // CgroupSubsystem implementations jlong CgroupSubsystem::memory_and_swap_limit_in_bytes() { - julong phys_mem = os::Linux::physical_memory(); + julong phys_mem = static_cast(os::Linux::physical_memory()); julong host_swap = os::Linux::host_swap(); return memory_controller()->controller()->memory_and_swap_limit_in_bytes(phys_mem, host_swap); } jlong CgroupSubsystem::memory_soft_limit_in_bytes() { - julong phys_mem = os::Linux::physical_memory(); + julong phys_mem = static_cast(os::Linux::physical_memory()); return memory_controller()->controller()->memory_soft_limit_in_bytes(phys_mem); } +jlong CgroupSubsystem::memory_throttle_limit_in_bytes() { + return memory_controller()->controller()->memory_throttle_limit_in_bytes(); +} + jlong CgroupSubsystem::memory_usage_in_bytes() { return memory_controller()->controller()->memory_usage_in_bytes(); } @@ -878,7 +883,11 @@ int CgroupSubsystem::cpu_shares() { return cpu_controller()->controller()->cpu_shares(); } +jlong CgroupSubsystem::cpu_usage_in_micros() { + return cpuacct_controller()->cpu_usage_in_micros(); +} + void CgroupSubsystem::print_version_specific_info(outputStream* st) { - julong phys_mem = os::Linux::physical_memory(); + julong phys_mem = static_cast(os::Linux::physical_memory()); memory_controller()->controller()->print_version_specific_info(st, phys_mem); } diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.hpp b/src/hotspot/os/linux/cgroupSubsystem_linux.hpp index 6b32408f801c..13db41d1fa6e 100644 --- a/src/hotspot/os/linux/cgroupSubsystem_linux.hpp +++ b/src/hotspot/os/linux/cgroupSubsystem_linux.hpp @@ -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 @@ -227,6 +227,18 @@ class CgroupCpuController: public CHeapObj { virtual const char* cgroup_path() = 0; }; +// Pure virtual class representing version agnostic CPU accounting controllers +class CgroupCpuacctController: public CHeapObj { + public: + virtual jlong cpu_usage_in_micros() = 0; + virtual bool needs_hierarchy_adjustment() = 0; + virtual bool is_read_only() = 0; + virtual const char* subsystem_path() = 0; + virtual void set_subsystem_path(const char* cgroup_path) = 0; + virtual const char* mount_point() = 0; + virtual const char* cgroup_path() = 0; +}; + // Pure virtual class representing version agnostic memory controllers class CgroupMemoryController: public CHeapObj { public: @@ -234,6 +246,7 @@ class CgroupMemoryController: public CHeapObj { virtual jlong memory_usage_in_bytes() = 0; virtual jlong memory_and_swap_limit_in_bytes(julong host_mem, julong host_swap) = 0; virtual jlong memory_soft_limit_in_bytes(julong upper_bound) = 0; + virtual jlong memory_throttle_limit_in_bytes() = 0; virtual jlong memory_max_usage_in_bytes() = 0; virtual jlong rss_usage_in_bytes() = 0; virtual jlong cache_usage_in_bytes() = 0; @@ -260,14 +273,18 @@ class CgroupSubsystem: public CHeapObj { virtual const char * container_type() = 0; virtual CachingCgroupController* memory_controller() = 0; virtual CachingCgroupController* cpu_controller() = 0; + virtual CgroupCpuacctController* cpuacct_controller() = 0; int cpu_quota(); int cpu_period(); int cpu_shares(); + jlong cpu_usage_in_micros(); + jlong memory_usage_in_bytes(); jlong memory_and_swap_limit_in_bytes(); jlong memory_soft_limit_in_bytes(); + jlong memory_throttle_limit_in_bytes(); jlong memory_max_usage_in_bytes(); jlong rss_usage_in_bytes(); jlong cache_usage_in_bytes(); diff --git a/src/hotspot/os/linux/cgroupUtil_linux.cpp b/src/hotspot/os/linux/cgroupUtil_linux.cpp index b52ef87dcaee..72dda36504d3 100644 --- a/src/hotspot/os/linux/cgroupUtil_linux.cpp +++ b/src/hotspot/os/linux/cgroupUtil_linux.cpp @@ -65,7 +65,7 @@ void CgroupUtil::adjust_controller(CgroupMemoryController* mem) { char* cg_path = os::strdup(orig); char* last_slash; assert(cg_path[0] == '/', "cgroup path must start with '/'"); - julong phys_mem = os::Linux::physical_memory(); + julong phys_mem = static_cast(os::Linux::physical_memory()); char* limit_cg_path = nullptr; jlong limit = mem->read_memory_limit_in_bytes(phys_mem); jlong lowest_limit = limit < 0 ? phys_mem : limit; diff --git a/src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp b/src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp index 8c8f558116a0..75544ff6059e 100644 --- a/src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp @@ -243,10 +243,16 @@ jlong CgroupV1MemoryController::memory_soft_limit_in_bytes(julong phys_mem) { } } +jlong CgroupV1MemoryController::memory_throttle_limit_in_bytes() { + // Log this string at trace level so as to make tests happy. + log_trace(os, container)("Memory Throttle Limit is not supported."); + return OSCONTAINER_ERROR; // not supported +} + // Constructor CgroupV1Subsystem::CgroupV1Subsystem(CgroupV1Controller* cpuset, CgroupV1CpuController* cpu, - CgroupV1Controller* cpuacct, + CgroupV1CpuacctController* cpuacct, CgroupV1Controller* pids, CgroupV1MemoryController* memory) : _cpuset(cpuset), @@ -415,6 +421,13 @@ int CgroupV1CpuController::cpu_shares() { return shares_int; } +jlong CgroupV1CpuacctController::cpu_usage_in_micros() { + julong cpu_usage; + CONTAINER_READ_NUMBER_CHECKED(reader(), "/cpuacct.usage", "CPU Usage", cpu_usage); + // Output is in nanoseconds, convert to microseconds. + return (jlong)cpu_usage / 1000; +} + /* pids_max * * Return the maximum number of tasks available to the process diff --git a/src/hotspot/os/linux/cgroupV1Subsystem_linux.hpp b/src/hotspot/os/linux/cgroupV1Subsystem_linux.hpp index 250d0273fc4d..ad1feb38f9e2 100644 --- a/src/hotspot/os/linux/cgroupV1Subsystem_linux.hpp +++ b/src/hotspot/os/linux/cgroupV1Subsystem_linux.hpp @@ -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 @@ -81,6 +81,7 @@ class CgroupV1MemoryController final : public CgroupMemoryController { jlong memory_usage_in_bytes() override; jlong memory_and_swap_limit_in_bytes(julong host_mem, julong host_swap) override; jlong memory_soft_limit_in_bytes(julong upper_bound) override; + jlong memory_throttle_limit_in_bytes() override; jlong memory_max_usage_in_bytes() override; jlong rss_usage_in_bytes() override; jlong cache_usage_in_bytes() override; @@ -140,12 +141,41 @@ class CgroupV1CpuController final : public CgroupCpuController { } }; +class CgroupV1CpuacctController final : public CgroupCpuacctController { + + private: + CgroupV1Controller _reader; + CgroupV1Controller* reader() { return &_reader; } + public: + jlong cpu_usage_in_micros() override; + void set_subsystem_path(const char *cgroup_path) override { + reader()->set_subsystem_path(cgroup_path); + } + bool is_read_only() override { + return reader()->is_read_only(); + } + const char* subsystem_path() override { + return reader()->subsystem_path(); + } + const char* mount_point() override { + return reader()->mount_point(); + } + bool needs_hierarchy_adjustment() override { + return reader()->needs_hierarchy_adjustment(); + } + const char* cgroup_path() override { return reader()->cgroup_path(); } + + public: + CgroupV1CpuacctController(const CgroupV1Controller& reader) : _reader(reader) { + } +}; + class CgroupV1Subsystem: public CgroupSubsystem { public: CgroupV1Subsystem(CgroupV1Controller* cpuset, CgroupV1CpuController* cpu, - CgroupV1Controller* cpuacct, + CgroupV1CpuacctController* cpuacct, CgroupV1Controller* pids, CgroupV1MemoryController* memory); @@ -165,13 +195,14 @@ class CgroupV1Subsystem: public CgroupSubsystem { } CachingCgroupController* memory_controller() { return _memory; } CachingCgroupController* cpu_controller() { return _cpu; } + CgroupCpuacctController* cpuacct_controller() { return _cpuacct; } private: /* controllers */ CachingCgroupController* _memory = nullptr; CgroupV1Controller* _cpuset = nullptr; CachingCgroupController* _cpu = nullptr; - CgroupV1Controller* _cpuacct = nullptr; + CgroupV1CpuacctController* _cpuacct = nullptr; CgroupV1Controller* _pids = nullptr; }; diff --git a/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp b/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp index 4367eba4c43a..395a78d4addc 100644 --- a/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, 2025, Red Hat Inc. + * 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 @@ -25,6 +26,8 @@ #include "cgroupV2Subsystem_linux.hpp" #include "cgroupUtil_linux.hpp" +#include + // Constructor CgroupV2Controller::CgroupV2Controller(char* mount_path, char *cgroup_path, @@ -60,22 +63,39 @@ int CgroupV2CpuController::cpu_shares() { log_debug(os, container)("CPU Shares is: %d", -1); return -1; } + // cg v2 values must be in range [1-10000] + assert(shares_int >= 1 && shares_int <= 10000, "invariant"); // CPU shares (OCI) value needs to get translated into // a proper Cgroups v2 value. See: - // https://github.com/containers/crun/blob/master/crun.1.md#cpu-controller + // https://github.com/containers/crun/blob/1.24/crun.1.md#cpu-controller // // Use the inverse of (x == OCI value, y == cgroupsv2 value): - // ((262142 * y - 1)/9999) + 2 = x + // y = 10^(log2(x)^2/612 + 125/612 * log2(x) - 7.0/34.0) + // + // By re-arranging it to the standard quadratic form: + // log2(x)^2 + 125 * log2(x) - (126 + 612 * log_10(y)) = 0 + // + // Therefore, log2(x) = (-125 + sqrt( 125^2 - 4 * (-(126 + 612 * log_10(y)))))/2 // - int x = 262142 * shares_int - 1; - double frac = x/9999.0; - x = ((int)frac) + 2; + // As a result we have the inverse (we can discount substraction of the + // square root value since those values result in very small numbers and the + // cpu shares values - OCI - are in range [2,262144]): + // + // x = 2^((-125 + sqrt(16129 + 2448* log10(y)))/2) + // + double log_multiplicand = log10(shares_int); + double discriminant = 16129 + 2448 * log_multiplicand; + double square_root = sqrt(discriminant); + double exponent = (-125 + square_root)/2; + double scaled_val = pow(2, exponent); + int x = (int) scaled_val; log_trace(os, container)("Scaled CPU shares value is: %d", x); // Since the scaled value is not precise, return the closest // multiple of PER_CPU_SHARES for a more conservative mapping if ( x <= PER_CPU_SHARES ) { - // will always map to 1 CPU + // Don't do the multiples of PER_CPU_SHARES mapping since we + // have a value <= PER_CPU_SHARES log_debug(os, container)("CPU Shares is: %d", x); return x; } @@ -114,12 +134,14 @@ int CgroupV2CpuController::cpu_quota() { // Constructor CgroupV2Subsystem::CgroupV2Subsystem(CgroupV2MemoryController * memory, CgroupV2CpuController* cpu, + CgroupV2CpuacctController* cpuacct, CgroupV2Controller unified) : _unified(unified) { CgroupUtil::adjust_controller(memory); CgroupUtil::adjust_controller(cpu); _memory = new CachingCgroupController(memory); _cpu = new CachingCgroupController(cpu); + _cpuacct = cpuacct; } bool CgroupV2Subsystem::is_containerized() { @@ -152,6 +174,17 @@ int CgroupV2CpuController::cpu_period() { return period; } +jlong CgroupV2CpuController::cpu_usage_in_micros() { + julong cpu_usage; + bool is_ok = reader()->read_numerical_key_value("/cpu.stat", "usage_usec", &cpu_usage); + if (!is_ok) { + log_trace(os, container)("CPU Usage failed: %d", OSCONTAINER_ERROR); + return OSCONTAINER_ERROR; + } + log_trace(os, container)("CPU Usage is: " JULONG_FORMAT, cpu_usage); + return (jlong)cpu_usage; +} + /* memory_usage_in_bytes * * Return the amount of used memory used by this cgroup and descendents @@ -173,10 +206,16 @@ jlong CgroupV2MemoryController::memory_soft_limit_in_bytes(julong phys_mem) { return mem_soft_limit; } +jlong CgroupV2MemoryController::memory_throttle_limit_in_bytes() { + jlong mem_throttle_limit; + CONTAINER_READ_NUMBER_CHECKED_MAX(reader(), "/memory.high", "Memory Throttle Limit", mem_throttle_limit); + return mem_throttle_limit; +} + jlong CgroupV2MemoryController::memory_max_usage_in_bytes() { - // Log this string at trace level so as to make tests happy. - log_trace(os, container)("Maximum Memory Usage is not supported."); - return OSCONTAINER_ERROR; // not supported + julong mem_max_usage; + CONTAINER_READ_NUMBER_CHECKED(reader(), "/memory.peak", "Maximum Memory Usage", mem_max_usage); + return mem_max_usage; } jlong CgroupV2MemoryController::rss_usage_in_bytes() { diff --git a/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp b/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp index 0a053fa7e45e..2915aea01896 100644 --- a/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp +++ b/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, 2024, Red Hat Inc. + * 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 @@ -61,6 +62,34 @@ class CgroupV2CpuController: public CgroupCpuController { int cpu_quota() override; int cpu_period() override; int cpu_shares() override; + jlong cpu_usage_in_micros(); + bool is_read_only() override { + return reader()->is_read_only(); + } + const char* subsystem_path() override { + return reader()->subsystem_path(); + } + bool needs_hierarchy_adjustment() override { + return reader()->needs_hierarchy_adjustment(); + } + void set_subsystem_path(const char* cgroup_path) override { + reader()->set_subsystem_path(cgroup_path); + } + const char* mount_point() override { return reader()->mount_point(); } + const char* cgroup_path() override { return reader()->cgroup_path(); } +}; + +class CgroupV2CpuacctController: public CgroupCpuacctController { + private: + CgroupV2CpuController* _reader; + CgroupV2CpuController* reader() { return _reader; } + public: + CgroupV2CpuacctController(CgroupV2CpuController* reader) : _reader(reader) { + } + // In cgroup v2, cpu usage is a part of the cpu controller. + jlong cpu_usage_in_micros() override { + return reader()->cpu_usage_in_micros(); + } bool is_read_only() override { return reader()->is_read_only(); } @@ -88,6 +117,7 @@ class CgroupV2MemoryController final: public CgroupMemoryController { jlong read_memory_limit_in_bytes(julong upper_bound) override; jlong memory_and_swap_limit_in_bytes(julong host_mem, julong host_swp) override; jlong memory_soft_limit_in_bytes(julong upper_bound) override; + jlong memory_throttle_limit_in_bytes() override; jlong memory_usage_in_bytes() override; jlong memory_max_usage_in_bytes() override; jlong rss_usage_in_bytes() override; @@ -117,11 +147,14 @@ class CgroupV2Subsystem: public CgroupSubsystem { CachingCgroupController* _memory = nullptr; CachingCgroupController* _cpu = nullptr; + CgroupCpuacctController* _cpuacct = nullptr; + CgroupV2Controller* unified() { return &_unified; } public: CgroupV2Subsystem(CgroupV2MemoryController * memory, CgroupV2CpuController* cpu, + CgroupV2CpuacctController* cpuacct, CgroupV2Controller unified); char * cpu_cpuset_cpus() override; @@ -136,6 +169,7 @@ class CgroupV2Subsystem: public CgroupSubsystem { } CachingCgroupController* memory_controller() override { return _memory; } CachingCgroupController* cpu_controller() override { return _cpu; } + CgroupCpuacctController* cpuacct_controller() override { return _cpuacct; }; }; #endif // CGROUP_V2_SUBSYSTEM_LINUX_HPP diff --git a/src/hotspot/os/linux/osContainer_linux.cpp b/src/hotspot/os/linux/osContainer_linux.cpp index 536869c785d9..8b91486122ca 100644 --- a/src/hotspot/os/linux/osContainer_linux.cpp +++ b/src/hotspot/os/linux/osContainer_linux.cpp @@ -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 @@ -117,6 +117,11 @@ jlong OSContainer::memory_soft_limit_in_bytes() { return cgroup_subsystem->memory_soft_limit_in_bytes(); } +jlong OSContainer::memory_throttle_limit_in_bytes() { + assert(cgroup_subsystem != nullptr, "cgroup subsystem not available"); + return cgroup_subsystem->memory_throttle_limit_in_bytes(); +} + jlong OSContainer::memory_usage_in_bytes() { assert(cgroup_subsystem != nullptr, "cgroup subsystem not available"); return cgroup_subsystem->memory_usage_in_bytes(); @@ -172,6 +177,11 @@ int OSContainer::cpu_shares() { return cgroup_subsystem->cpu_shares(); } +jlong OSContainer::cpu_usage_in_micros() { + assert(cgroup_subsystem != nullptr, "cgroup subsystem not available"); + return cgroup_subsystem->cpu_usage_in_micros(); +} + jlong OSContainer::pids_max() { assert(cgroup_subsystem != nullptr, "cgroup subsystem not available"); return cgroup_subsystem->pids_max(); diff --git a/src/hotspot/os/linux/osContainer_linux.hpp b/src/hotspot/os/linux/osContainer_linux.hpp index bb03ba3b005a..56bd80cb8f96 100644 --- a/src/hotspot/os/linux/osContainer_linux.hpp +++ b/src/hotspot/os/linux/osContainer_linux.hpp @@ -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 @@ -53,6 +53,7 @@ class OSContainer: AllStatic { static jlong memory_limit_in_bytes(); static jlong memory_and_swap_limit_in_bytes(); static jlong memory_soft_limit_in_bytes(); + static jlong memory_throttle_limit_in_bytes(); static jlong memory_usage_in_bytes(); static jlong memory_max_usage_in_bytes(); static jlong rss_usage_in_bytes(); @@ -68,6 +69,8 @@ class OSContainer: AllStatic { static int cpu_shares(); + static jlong cpu_usage_in_micros(); + static jlong pids_max(); static jlong pids_current(); }; diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index b7389523017b..9edcb82cd200 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -161,7 +161,7 @@ enum CoredumpFilterBit { //////////////////////////////////////////////////////////////////////////////// // global variables -julong os::Linux::_physical_memory = 0; +physical_memory_size_type os::Linux::_physical_memory = 0; address os::Linux::_initial_thread_stack_bottom = nullptr; uintptr_t os::Linux::_initial_thread_stack_size = 0; @@ -236,15 +236,16 @@ julong os::Linux::available_memory_in_container() { return avail_mem; } -julong os::available_memory() { - return Linux::available_memory(); +bool os::available_memory(physical_memory_size_type& value) { + return Linux::available_memory(value); } -julong os::Linux::available_memory() { +bool os::Linux::available_memory(physical_memory_size_type& value) { julong avail_mem = available_memory_in_container(); if (avail_mem != static_cast(-1L)) { log_trace(os)("available container memory: " JULONG_FORMAT, avail_mem); - return avail_mem; + value = static_cast(avail_mem); + return true; } FILE *fp = os::fopen("/proc/meminfo", "r"); @@ -259,43 +260,52 @@ julong os::Linux::available_memory() { fclose(fp); } if (avail_mem == static_cast(-1L)) { - avail_mem = free_memory(); + physical_memory_size_type free_mem = 0; + if (!free_memory(free_mem)) { + return false; + } + avail_mem = static_cast(free_mem); } log_trace(os)("available memory: " JULONG_FORMAT, avail_mem); - return avail_mem; + value = static_cast(avail_mem); + return true; } -julong os::free_memory() { - return Linux::free_memory(); +bool os::free_memory(physical_memory_size_type& value) { + return Linux::free_memory(value); } -julong os::Linux::free_memory() { +bool os::Linux::free_memory(physical_memory_size_type& value) { // values in struct sysinfo are "unsigned long" struct sysinfo si; julong free_mem = available_memory_in_container(); if (free_mem != static_cast(-1L)) { log_trace(os)("free container memory: " JULONG_FORMAT, free_mem); - return free_mem; + value = static_cast(free_mem); + return true; } - sysinfo(&si); + int ret = sysinfo(&si); + if (ret != 0) { + return false; + } free_mem = (julong)si.freeram * si.mem_unit; log_trace(os)("free memory: " JULONG_FORMAT, free_mem); - return free_mem; + value = static_cast(free_mem); + return true; } -julong os::physical_memory() { - jlong phys_mem = 0; +physical_memory_size_type os::physical_memory() { if (OSContainer::is_containerized()) { jlong mem_limit; if ((mem_limit = OSContainer::memory_limit_in_bytes()) > 0) { log_trace(os)("total container memory: " JLONG_FORMAT, mem_limit); - return mem_limit; + return static_cast(mem_limit); } } - phys_mem = Linux::physical_memory(); - log_trace(os)("total system memory: " JLONG_FORMAT, phys_mem); + physical_memory_size_type phys_mem = Linux::physical_memory(); + log_trace(os)("total system memory: " PHYS_MEM_TYPE_FORMAT, phys_mem); return phys_mem; } @@ -452,7 +462,7 @@ void os::Linux::initialize_system_info() { fclose(fp); } } - _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE); + _physical_memory = static_cast(sysconf(_SC_PHYS_PAGES)) * static_cast(sysconf(_SC_PAGESIZE)); assert(processor_count() > 0, "linux error"); } @@ -1832,6 +1842,8 @@ void * os::Linux::dlopen_helper(const char *filename, char *ebuf, assert(rtn == 0, "fegetenv must succeed"); #endif // IA32 + Events::log_dll_message(nullptr, "Attempting to load shared library %s", filename); + void * result = ::dlopen(filename, RTLD_LAZY); if (result == nullptr) { const char* error_report = ::dlerror(); @@ -2379,9 +2391,18 @@ bool os::Linux::print_container_info(outputStream* st) { st->print_cr("%s", i == OSCONTAINER_ERROR ? "not supported" : "no shares"); } + jlong j = OSContainer::cpu_usage_in_micros(); + st->print("cpu_usage_in_micros: "); + if (j >= 0) { + st->print_cr(JLONG_FORMAT, j); + } else { + st->print_cr("%s", j == OSCONTAINER_ERROR ? "not supported" : "no usage"); + } + OSContainer::print_container_helper(st, OSContainer::memory_limit_in_bytes(), "memory_limit_in_bytes"); OSContainer::print_container_helper(st, OSContainer::memory_and_swap_limit_in_bytes(), "memory_and_swap_limit_in_bytes"); OSContainer::print_container_helper(st, OSContainer::memory_soft_limit_in_bytes(), "memory_soft_limit_in_bytes"); + OSContainer::print_container_helper(st, OSContainer::memory_throttle_limit_in_bytes(), "memory_throttle_limit_in_bytes"); OSContainer::print_container_helper(st, OSContainer::memory_usage_in_bytes(), "memory_usage_in_bytes"); OSContainer::print_container_helper(st, OSContainer::memory_max_usage_in_bytes(), "memory_max_usage_in_bytes"); OSContainer::print_container_helper(st, OSContainer::rss_usage_in_bytes(), "rss_usage_in_bytes"); @@ -2389,7 +2410,7 @@ bool os::Linux::print_container_info(outputStream* st) { OSContainer::print_version_specific_info(st); - jlong j = OSContainer::pids_max(); + j = OSContainer::pids_max(); st->print("maximum number of tasks: "); if (j > 0) { st->print_cr(JLONG_FORMAT, j); @@ -2436,11 +2457,13 @@ void os::print_memory_info(outputStream* st) { // values in struct sysinfo are "unsigned long" struct sysinfo si; sysinfo(&si); - - st->print(", physical " UINT64_FORMAT "k", - os::physical_memory() >> 10); - st->print("(" UINT64_FORMAT "k free)", - os::available_memory() >> 10); + physical_memory_size_type phys_mem = physical_memory(); + st->print(", physical " PHYS_MEM_TYPE_FORMAT "k", + phys_mem >> 10); + physical_memory_size_type avail_mem = 0; + (void)os::available_memory(avail_mem); + st->print("(" PHYS_MEM_TYPE_FORMAT "k free)", + avail_mem >> 10); st->print(", swap " UINT64_FORMAT "k", ((jlong)si.totalswap * si.mem_unit) >> 10); st->print("(" UINT64_FORMAT "k free)", @@ -5392,7 +5415,7 @@ int os::get_core_path(char* buffer, size_t bufferSize) { if (core_pattern[0] == '|') { written = jio_snprintf(buffer, bufferSize, - "\"%s\" (or dumping to %s/core.%d)", + "\"%s\" (alternatively, falling back to %s/core.%d)", &core_pattern[1], p, current_process_id()); } else if (pid_pos != nullptr) { *pid_pos = '\0'; diff --git a/src/hotspot/os/linux/os_linux.hpp b/src/hotspot/os/linux/os_linux.hpp index 49f2777d1396..ed6c52aade44 100644 --- a/src/hotspot/os/linux/os_linux.hpp +++ b/src/hotspot/os/linux/os_linux.hpp @@ -51,11 +51,11 @@ class os::Linux { protected: - static julong _physical_memory; + static physical_memory_size_type _physical_memory; static pthread_t _main_thread; - static julong available_memory(); - static julong free_memory(); + static bool available_memory(physical_memory_size_type& value); + static bool free_memory(physical_memory_size_type& value); static void initialize_system_info(); @@ -127,7 +127,7 @@ class os::Linux { static address initial_thread_stack_bottom(void) { return _initial_thread_stack_bottom; } static uintptr_t initial_thread_stack_size(void) { return _initial_thread_stack_size; } - static julong physical_memory() { return _physical_memory; } + static physical_memory_size_type physical_memory() { return _physical_memory; } static julong host_swap(); static intptr_t* ucontext_get_sp(const ucontext_t* uc); diff --git a/src/hotspot/os/posix/os_posix.cpp b/src/hotspot/os/posix/os_posix.cpp index 7f95560a19e1..7d139712002c 100644 --- a/src/hotspot/os/posix/os_posix.cpp +++ b/src/hotspot/os/posix/os_posix.cpp @@ -105,49 +105,63 @@ static int clock_tics_per_sec = 100; size_t os::_os_min_stack_allowed = PTHREAD_STACK_MIN; // Check core dump limit and report possible place where core can be found -void os::check_dump_limit(char* buffer, size_t bufferSize) { +void os::check_core_dump_prerequisites(char* buffer, size_t bufferSize, bool check_only) { + stringStream buf(buffer, bufferSize); if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) { - jio_snprintf(buffer, bufferSize, "CreateCoredumpOnCrash is disabled from command line"); - VMError::record_coredump_status(buffer, false); - return; - } - - int n; - struct rlimit rlim; - bool success; - - char core_path[PATH_MAX]; - n = get_core_path(core_path, PATH_MAX); - - if (n <= 0) { - jio_snprintf(buffer, bufferSize, "core.%d (may not exist)", current_process_id()); - success = true; + buf.print("CreateCoredumpOnCrash is disabled from command line"); + VMError::record_coredump_status(buf.freeze(), false); + } else { + struct rlimit rlim; + bool success = true; + bool warn = true; + char core_path[PATH_MAX]; + if (get_core_path(core_path, PATH_MAX) <= 0) { + // In the warning message, let the user know. + if (check_only) { + buf.print("the core path couldn't be determined. It commonly defaults to "); + } + buf.print("core.%d%s", current_process_id(), check_only ? "" : " (may not exist)"); #ifdef LINUX - } else if (core_path[0] == '"') { // redirect to user process - jio_snprintf(buffer, bufferSize, "Core dumps may be processed with %s", core_path); - success = true; + } else if (core_path[0] == '"') { // redirect to user process + if (check_only) { + buf.print("core dumps may be further processed by the following: "); + } else { + buf.print("Determined by the following: "); + } + buf.print("%s", core_path); #endif - } else if (getrlimit(RLIMIT_CORE, &rlim) != 0) { - jio_snprintf(buffer, bufferSize, "%s (may not exist)", core_path); - success = true; - } else { - switch(rlim.rlim_cur) { - case RLIM_INFINITY: - jio_snprintf(buffer, bufferSize, "%s", core_path); - success = true; - break; - case 0: - jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again"); - success = false; - break; - default: - jio_snprintf(buffer, bufferSize, "%s (max size " UINT64_FORMAT " k). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", core_path, uint64_t(rlim.rlim_cur) / K); - success = true; - break; + } else if (getrlimit(RLIMIT_CORE, &rlim) != 0) { + if (check_only) { + buf.print("the rlimit couldn't be determined. If resource limits permit, the core dump will be located at "); + } + buf.print("%s%s", core_path, check_only ? "" : " (may not exist)"); + } else { + switch(rlim.rlim_cur) { + case RLIM_INFINITY: + buf.print("%s", core_path); + warn = false; + break; + case 0: + buf.print("%s dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again", check_only ? "core" : "Core"); + success = false; + break; + default: + if (check_only) { + buf.print("core dumps are constrained "); + } else { + buf.print( "%s ", core_path); + } + buf.print( "(max size " UINT64_FORMAT " k). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", uint64_t(rlim.rlim_cur) / K); + break; + } + } + const char* result = buf.freeze(); + if (!check_only) { + VMError::record_coredump_status(result, success); + } else if (warn) { + warning("CreateCoredumpOnCrash specified, but %s", result); } } - - VMError::record_coredump_status(buffer, success); } int os::get_native_stack(address* stack, int frames, int toSkip) { diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp index 7c39c5af466d..790db31348c3 100644 --- a/src/hotspot/os/posix/perfMemory_posix.cpp +++ b/src/hotspot/os/posix/perfMemory_posix.cpp @@ -112,6 +112,10 @@ static void save_memory_to_file(char* addr, size_t size) { result = ::close(fd); if (result == OS_ERR) { warning("Could not close %s: %s\n", destfile, os::strerror(errno)); + } else { + if (!successful_write) { + remove(destfile); + } } } FREE_C_HEAP_ARRAY(char, destfile); @@ -954,6 +958,7 @@ static int create_sharedmem_file(const char* dirname, const char* filename, size warning("Insufficient space for shared memory file:\n %s\nTry using the -Djava.io.tmpdir= option to select an alternate temp location.\n", filename); } result = OS_ERR; + remove(filename); break; } } diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 669e96e54058..3f82eaa053a0 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -832,25 +832,30 @@ jlong os::elapsed_frequency() { } -julong os::available_memory() { - return win32::available_memory(); +bool os::available_memory(physical_memory_size_type& value) { + return win32::available_memory(value); } -julong os::free_memory() { - return win32::available_memory(); +bool os::free_memory(physical_memory_size_type& value) { + return win32::available_memory(value); } -julong os::win32::available_memory() { +bool os::win32::available_memory(physical_memory_size_type& value) { // Use GlobalMemoryStatusEx() because GlobalMemoryStatus() may return incorrect // value if total memory is larger than 4GB MEMORYSTATUSEX ms; ms.dwLength = sizeof(ms); - GlobalMemoryStatusEx(&ms); - - return (julong)ms.ullAvailPhys; + BOOL res = GlobalMemoryStatusEx(&ms); + if (res == TRUE) { + value = static_cast(ms.ullAvailPhys); + return true; + } else { + assert(false, "GlobalMemoryStatusEx failed in os::win32::available_memory(): %lu", ::GetLastError()); + return false; + } } -julong os::physical_memory() { +physical_memory_size_type os::physical_memory() { return win32::physical_memory(); } @@ -1269,38 +1274,50 @@ void os::shutdown() { static HANDLE dumpFile = nullptr; -// Check if dump file can be created. -void os::check_dump_limit(char* buffer, size_t buffsz) { - bool status = true; +// Check if core dump is active and if a core dump file can be created +void os::check_core_dump_prerequisites(char* buffer, size_t bufferSize, bool check_only) { if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) { - jio_snprintf(buffer, buffsz, "CreateCoredumpOnCrash is disabled from command line"); - status = false; - } - + jio_snprintf(buffer, bufferSize, "CreateCoredumpOnCrash is disabled from command line"); + VMError::record_coredump_status(buffer, false); + } else { + bool success = true; + bool warn = true; #ifndef ASSERT - if (!os::win32::is_windows_server() && FLAG_IS_DEFAULT(CreateCoredumpOnCrash)) { - jio_snprintf(buffer, buffsz, "Minidumps are not enabled by default on client versions of Windows"); - status = false; - } + if (!os::win32::is_windows_server() && FLAG_IS_DEFAULT(CreateCoredumpOnCrash)) { + jio_snprintf(buffer, bufferSize, "Minidumps are not enabled by default on client versions of Windows"); + success = false; + warn = true; + } #endif - if (status) { - const char* cwd = get_current_directory(nullptr, 0); - int pid = current_process_id(); - if (cwd != nullptr) { - jio_snprintf(buffer, buffsz, "%s\\hs_err_pid%u.mdmp", cwd, pid); - } else { - jio_snprintf(buffer, buffsz, ".\\hs_err_pid%u.mdmp", pid); + if (success) { + if (!check_only) { + const char* cwd = get_current_directory(nullptr, 0); + int pid = current_process_id(); + if (cwd != nullptr) { + jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp", cwd, pid); + } else { + jio_snprintf(buffer, bufferSize, ".\\hs_err_pid%u.mdmp", pid); + } + + if (dumpFile == nullptr && + (dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)) + == INVALID_HANDLE_VALUE) { + jio_snprintf(buffer, bufferSize, "Failed to create minidump file (0x%x).", GetLastError()); + success = false; + } + } else { + // For now on Windows, there are no more checks that we can do + warn = false; + } } - if (dumpFile == nullptr && - (dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)) - == INVALID_HANDLE_VALUE) { - jio_snprintf(buffer, buffsz, "Failed to create minidump file (0x%x).", GetLastError()); - status = false; + if (!check_only) { + VMError::record_coredump_status(buffer, success); + } else if (warn) { + warning("CreateCoredumpOnCrash specified, but %s", buffer); } } - VMError::record_coredump_status(buffer, status); } void os::abort(bool dump_core, void* siginfo, const void* context) { @@ -1844,6 +1861,7 @@ void * os::dll_load_utf8(const char *utf8_name, char *ebuf, int ebuflen) { void * os::dll_load(const char *name, char *ebuf, int ebuflen) { log_info(os)("attempting shared library load of %s", name); + Events::log_dll_message(nullptr, "Attempting to load shared library %s", name); void * result = LoadLibrary(name); if (result != nullptr) { @@ -4274,25 +4292,25 @@ int os::current_process_id() { return (_initial_pid ? _initial_pid : _getpid()); } -int os::win32::_processor_type = 0; +int os::win32::_processor_type = 0; // Processor level is not available on non-NT systems, use vm_version instead -int os::win32::_processor_level = 0; -julong os::win32::_physical_memory = 0; +int os::win32::_processor_level = 0; +physical_memory_size_type os::win32::_physical_memory = 0; -bool os::win32::_is_windows_server = false; +bool os::win32::_is_windows_server = false; // 6573254 // Currently, the bug is observed across all the supported Windows releases, // including the latest one (as of this writing - Windows Server 2012 R2) -bool os::win32::_has_exit_bug = true; +bool os::win32::_has_exit_bug = true; -int os::win32::_major_version = 0; -int os::win32::_minor_version = 0; -int os::win32::_build_number = 0; -int os::win32::_build_minor = 0; +int os::win32::_major_version = 0; +int os::win32::_minor_version = 0; +int os::win32::_build_number = 0; +int os::win32::_build_minor = 0; -bool os::win32::_processor_group_warning_displayed = false; -bool os::win32::_job_object_processor_group_warning_displayed = false; +bool os::win32::_processor_group_warning_displayed = false; +bool os::win32::_job_object_processor_group_warning_displayed = false; void getWindowsInstallationType(char* buffer, int bufferSize) { HKEY hKey; @@ -4507,8 +4525,11 @@ void os::win32::initialize_system_info() { // also returns dwAvailPhys (free physical memory bytes), dwTotalVirtual, dwAvailVirtual, // dwMemoryLoad (% of memory in use) - GlobalMemoryStatusEx(&ms); - _physical_memory = ms.ullTotalPhys; + BOOL res = GlobalMemoryStatusEx(&ms); + if (res != TRUE) { + assert(false, "GlobalMemoryStatusEx failed in os::win32::initialize_system_info(): %lu", ::GetLastError()); + } + _physical_memory = static_cast(ms.ullTotalPhys); if (FLAG_IS_DEFAULT(MaxRAM)) { // Adjust MaxRAM according to the maximum virtual address space available. diff --git a/src/hotspot/os/windows/os_windows.hpp b/src/hotspot/os/windows/os_windows.hpp index c4e5483ce8e3..abbccbf234cb 100644 --- a/src/hotspot/os/windows/os_windows.hpp +++ b/src/hotspot/os/windows/os_windows.hpp @@ -38,18 +38,18 @@ class os::win32 { friend class os; protected: - static int _processor_type; - static int _processor_level; - static julong _physical_memory; - static bool _is_windows_server; - static bool _has_exit_bug; - static bool _processor_group_warning_displayed; - static bool _job_object_processor_group_warning_displayed; - - static int _major_version; - static int _minor_version; - static int _build_number; - static int _build_minor; + static int _processor_type; + static int _processor_level; + static physical_memory_size_type _physical_memory; + static bool _is_windows_server; + static bool _has_exit_bug; + static bool _processor_group_warning_displayed; + static bool _job_object_processor_group_warning_displayed; + + static int _major_version; + static int _minor_version; + static int _build_number; + static int _build_minor; static void print_windows_version(outputStream* st); static void print_uptime_info(outputStream* st); @@ -102,9 +102,9 @@ class os::win32 { static int processor_level() { return _processor_level; } - static julong available_memory(); - static julong free_memory(); - static julong physical_memory() { return _physical_memory; } + static bool available_memory(physical_memory_size_type& value); + static bool free_memory(physical_memory_size_type& value); + static physical_memory_size_type physical_memory() { return _physical_memory; } // load dll from Windows system directory or Windows directory static HINSTANCE load_Windows_dll(const char* name, char *ebuf, int ebuflen); diff --git a/src/hotspot/os_cpu/linux_arm/macroAssembler_linux_arm_32.cpp b/src/hotspot/os_cpu/linux_arm/macroAssembler_linux_arm_32.cpp index 0a3968ffa706..f8c59cbcc5d1 100644 --- a/src/hotspot/os_cpu/linux_arm/macroAssembler_linux_arm_32.cpp +++ b/src/hotspot/os_cpu/linux_arm/macroAssembler_linux_arm_32.cpp @@ -247,9 +247,9 @@ void MacroAssembler::atomic_cas64(Register memval_lo, Register memval_hi, Regist Label loop; assert_different_registers(memval_lo, memval_hi, result, oldval_lo, oldval_hi, newval_lo, newval_hi, base); - assert(memval_hi == memval_lo + 1 && memval_lo < R9, "cmpxchg_long: illegal registers"); - assert(oldval_hi == oldval_lo + 1 && oldval_lo < R9, "cmpxchg_long: illegal registers"); - assert(newval_hi == newval_lo + 1 && newval_lo < R9, "cmpxchg_long: illegal registers"); + assert(memval_hi == as_Register(memval_lo->encoding() + 1) && memval_lo->encoding() < R9->encoding(), "cmpxchg_long: illegal registers"); + assert(oldval_hi == as_Register(oldval_lo->encoding() + 1) && oldval_lo->encoding() < R9->encoding(), "cmpxchg_long: illegal registers"); + assert(newval_hi == as_Register(newval_lo->encoding() + 1) && newval_lo->encoding() < R9->encoding(), "cmpxchg_long: illegal registers"); assert(result != R10, "cmpxchg_long: illegal registers"); assert(base != R10, "cmpxchg_long: illegal registers"); diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index b3705c869af6..90ca95e5d17b 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -1035,7 +1035,9 @@ void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) { if (new_c2_count <= old_c2_count && new_c1_count <= old_c1_count) return; // Now, we do the more expensive operations. - julong free_memory = os::free_memory(); + physical_memory_size_type free_memory = 0; + // Return value ignored - defaulting to 0 on failure. + (void)os::free_memory(free_memory); // If SegmentedCodeCache is off, both values refer to the single heap (with type CodeBlobType::All). size_t available_cc_np = CodeCache::unallocated_capacity(CodeBlobType::MethodNonProfiled), available_cc_p = CodeCache::unallocated_capacity(CodeBlobType::MethodProfiled); diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 03d4a1854992..3a5e017d48ad 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -30,6 +30,7 @@ #include "code/icBuffer.hpp" #include "compiler/oopMap.hpp" #include "gc/g1/g1Allocator.inline.hpp" +#include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1Arguments.hpp" #include "gc/g1/g1BarrierSet.hpp" #include "gc/g1/g1BatchedTask.hpp" @@ -492,6 +493,13 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(uint node_index, size_t word_ gclocker_retry_count += 1; } + // Has the gc overhead limit been reached in the meantime? If so, this mutator + // should receive null even when unsuccessfully scheduling a collection as well + // for global consistency. + if (gc_overhead_limit_exceeded()) { + return nullptr; + } + // We can reach here if we were unsuccessful in scheduling a // collection (because another thread beat us to it) or if we were // stalled due to the GC locker. In either can we should retry the @@ -760,7 +768,12 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size) { GCLocker::stall_until_clear(); gclocker_retry_count += 1; } - + // Has the gc overhead limit been reached in the meantime? If so, this mutator + // should receive null even when unsuccessfully scheduling a collection as well + // for global consistency. + if (gc_overhead_limit_exceeded()) { + return nullptr; + } // We can reach here if we were unsuccessful in scheduling a // collection (because another thread beat us to it) or if we were @@ -981,27 +994,64 @@ void G1CollectedHeap::resize_heap_if_necessary() { } } +void G1CollectedHeap::update_gc_overhead_counter() { + assert(SafepointSynchronize::is_at_safepoint(), "precondition"); + + if (!UseGCOverheadLimit) { + return; + } + + bool gc_time_over_limit = (_policy->analytics()->long_term_pause_time_ratio() * 100) >= GCTimeLimit; + double free_space_percent = percent_of(num_free_or_available_regions() * HeapRegion::GrainBytes, max_capacity()); + bool free_space_below_limit = free_space_percent < GCHeapFreeLimit; + + log_debug(gc)("GC Overhead Limit: GC Time %f Free Space %f Counter %zu", + (_policy->analytics()->long_term_pause_time_ratio() * 100), + free_space_percent, + _gc_overhead_counter); + + if (gc_time_over_limit && free_space_below_limit) { + _gc_overhead_counter++; + } else { + _gc_overhead_counter = 0; + } +} + +bool G1CollectedHeap::gc_overhead_limit_exceeded() { + return _gc_overhead_counter >= GCOverheadLimitThreshold; +} + HeapWord* G1CollectedHeap::satisfy_failed_allocation_helper(size_t word_size, bool do_gc, bool maximal_compaction, bool expect_null_mutator_alloc_region, bool* gc_succeeded) { *gc_succeeded = true; - // Let's attempt the allocation first. - HeapWord* result = - attempt_allocation_at_safepoint(word_size, - expect_null_mutator_alloc_region); - if (result != nullptr) { - return result; - } + // Skip allocation if GC overhead limit has been exceeded to let the mutator run + // into an OOME. It can either exit "gracefully" or try to free up memory asap. + // For the latter situation, keep running GCs. If the mutator frees up enough + // memory quickly enough, the overhead(s) will go below the threshold(s) again + // and the VM may continue running. + // If we did not continue garbage collections, the (gc overhead) limit may decrease + // enough by itself to not count as exceeding the limit any more, in the worst + // case bouncing back-and-forth all the time. + if (!gc_overhead_limit_exceeded()) { + // Let's attempt the allocation first. + HeapWord* result = + attempt_allocation_at_safepoint(word_size, + expect_null_mutator_alloc_region); + if (result != nullptr) { + return result; + } - // In a G1 heap, we're supposed to keep allocation from failing by - // incremental pauses. Therefore, at least for now, we'll favor - // expansion over collection. (This might change in the future if we can - // do something smarter than full collection to satisfy a failed alloc.) - result = expand_and_allocate(word_size); - if (result != nullptr) { - return result; + // In a G1 heap, we're supposed to keep allocation from failing by + // incremental pauses. Therefore, at least for now, we'll favor + // expansion over collection. (This might change in the future if we can + // do something smarter than full collection to satisfy a failed alloc.) + result = expand_and_allocate(word_size); + if (result != nullptr) { + return result; + } } if (do_gc) { @@ -1025,6 +1075,10 @@ HeapWord* G1CollectedHeap::satisfy_failed_allocation(size_t word_size, bool* succeeded) { assert_at_safepoint_on_vm_thread(); + // Update GC overhead limits after the initial garbage collection leading to this + // allocation attempt. + update_gc_overhead_counter(); + // Attempts to allocate followed by Full GC. HeapWord* result = satisfy_failed_allocation_helper(word_size, @@ -1062,6 +1116,10 @@ HeapWord* G1CollectedHeap::satisfy_failed_allocation(size_t word_size, assert(!soft_ref_policy()->should_clear_all_soft_refs(), "Flag should have been handled and cleared prior to this point"); + if (gc_overhead_limit_exceeded()) { + log_info(gc)("GC Overhead Limit exceeded too often (%zu).", GCOverheadLimitThreshold); + } + // What else? We might try synchronous finalization later. If the total // space available is large enough for the allocation, then a more // complete compaction phase than we've tried so far might be @@ -1230,6 +1288,7 @@ class HumongousRegionSetChecker : public HeapRegionSetChecker { G1CollectedHeap::G1CollectedHeap() : CollectedHeap(), + _gc_overhead_counter(0), _service_thread(nullptr), _periodic_gc_task(nullptr), _free_arena_memory_task(nullptr), diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index c247909dd708..352e5ea7d35f 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -170,6 +170,17 @@ class G1CollectedHeap : public CollectedHeap { friend class G1CheckRegionAttrTableClosure; private: + // GC Overhead Limit functionality related members. + // + // The goal is to return null for allocations prematurely (before really going + // OOME) in case both GC CPU usage (>= GCTimeLimit) and not much available free + // memory (<= GCHeapFreeLimit) so that applications can exit gracefully or try + // to keep running by easing off memory. + uintx _gc_overhead_counter; // The number of consecutive garbage collections we were over the limits. + + void update_gc_overhead_counter(); + bool gc_overhead_limit_exceeded(); + G1ServiceThread* _service_thread; G1ServiceTask* _periodic_gc_task; G1MonotonicArenaFreeMemoryTask* _free_arena_memory_task; diff --git a/src/hotspot/share/gc/shared/gcInitLogger.cpp b/src/hotspot/share/gc/shared/gcInitLogger.cpp index 1dfc27c53337..5956122323d4 100644 --- a/src/hotspot/share/gc/shared/gcInitLogger.cpp +++ b/src/hotspot/share/gc/shared/gcInitLogger.cpp @@ -63,8 +63,8 @@ void GCInitLogger::print_cpu() { } void GCInitLogger::print_memory() { - julong memory = os::physical_memory(); - log_info_p(gc, init)("Memory: " JULONG_FORMAT "%s", + physical_memory_size_type memory = os::physical_memory(); + log_info_p(gc, init)("Memory: " PHYS_MEM_TYPE_FORMAT "%s", byte_size_in_proper_unit(memory), proper_unit_for_byte_size(memory)); } diff --git a/src/hotspot/share/gc/shared/gc_globals.hpp b/src/hotspot/share/gc/shared/gc_globals.hpp index 5d7202685401..98cd6137e985 100644 --- a/src/hotspot/share/gc/shared/gc_globals.hpp +++ b/src/hotspot/share/gc/shared/gc_globals.hpp @@ -477,7 +477,7 @@ "Estimate of footprint other than Java Heap") \ range(0, max_uintx) \ \ - product(bool, UseGCOverheadLimit, true, \ + product(bool, UseGCOverheadLimit, falseInDebug, \ "Use policy to limit of proportion of time spent in GC " \ "before an OutOfMemory error is thrown") \ \ diff --git a/src/hotspot/share/gc/x/xLargePages.cpp b/src/hotspot/share/gc/x/xLargePages.cpp index 13da763c6a39..0afb4ac6d702 100644 --- a/src/hotspot/share/gc/x/xLargePages.cpp +++ b/src/hotspot/share/gc/x/xLargePages.cpp @@ -31,7 +31,8 @@ XLargePages::State XLargePages::_state; void XLargePages::initialize() { pd_initialize(); - log_info_p(gc, init)("Memory: " JULONG_FORMAT "M", os::physical_memory() / M); + const size_t memory = os::physical_memory(); + log_info_p(gc, init)("Memory: " PROPERFMT, PROPERFMTARGS(memory)); log_info_p(gc, init)("Large Page Support: %s", to_string()); } diff --git a/src/hotspot/share/gc/z/zLargePages.cpp b/src/hotspot/share/gc/z/zLargePages.cpp index 88656d153811..9a35e246f4b6 100644 --- a/src/hotspot/share/gc/z/zLargePages.cpp +++ b/src/hotspot/share/gc/z/zLargePages.cpp @@ -31,7 +31,8 @@ ZLargePages::State ZLargePages::_state; void ZLargePages::initialize() { pd_initialize(); - log_info_p(gc, init)("Memory: " JULONG_FORMAT "M", os::physical_memory() / M); + const size_t memory = static_cast(os::physical_memory()); + log_info_p(gc, init)("Memory: " PROPERFMT, PROPERFMTARGS(memory)); log_info_p(gc, init)("Large Page Support: %s", to_string()); } diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp index 7157c346db01..e78bd11fb647 100644 --- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp +++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp @@ -402,9 +402,9 @@ JVM_ENTRY_NO_ENV(jlong, jfr_host_total_memory(JNIEnv* env, jobject jvm)) #ifdef LINUX // We want the host memory, not the container limit. // os::physical_memory() would return the container limit. - return os::Linux::physical_memory(); + return static_cast(os::Linux::physical_memory()); #else - return os::physical_memory(); + return static_cast(os::physical_memory()); #endif JVM_END diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp index 4ba2e3329f81..d2d3fec79e38 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.cpp @@ -35,6 +35,7 @@ #include "memory/resourceArea.hpp" #include "oops/access.inline.hpp" #include "oops/oop.inline.hpp" +#include "runtime/os.hpp" #include "utilities/align.hpp" UnifiedOopRef DFSClosure::_reference_stack[max_dfs_depth]; @@ -68,9 +69,27 @@ void DFSClosure::find_leaks_from_root_set(EdgeStore* edge_store, rs.process(); } +static address calculate_headroom_limit() { + static constexpr size_t required_headroom = K * 64; + const Thread* const t = Thread::current_or_null(); + return t->stack_end() + required_headroom; +} + DFSClosure::DFSClosure(EdgeStore* edge_store, JFRBitSet* mark_bits, const Edge* start_edge) :_edge_store(edge_store), _mark_bits(mark_bits), _start_edge(start_edge), - _max_depth(max_dfs_depth), _depth(0), _ignore_root_set(false) { + _max_depth(max_dfs_depth), _depth(0), _ignore_root_set(false), + _headroom_limit(calculate_headroom_limit()) { +} + +bool DFSClosure::have_headroom() const { + const address sp = (address) os::current_stack_pointer(); +#ifdef ASSERT + const Thread* const t = Thread::current_or_null(); + assert(t->is_VM_thread(), "invariant"); + assert(t->is_in_full_stack(_headroom_limit), "invariant"); + assert(t->is_in_full_stack(sp), "invariant"); +#endif + return sp > _headroom_limit; } void DFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) { @@ -98,7 +117,7 @@ void DFSClosure::closure_impl(UnifiedOopRef reference, const oop pointee) { } } assert(_max_depth >= 1, "invariant"); - if (_depth < _max_depth - 1) { + if (_depth < _max_depth - 1 && have_headroom()) { _depth++; pointee->oop_iterate(this); assert(_depth > 0, "invariant"); diff --git a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp index be0cd2a5d7eb..a22b5137380f 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/dfsClosure.hpp @@ -46,12 +46,15 @@ class DFSClosure : public BasicOopIterateClosure { size_t _max_depth; size_t _depth; bool _ignore_root_set; + const address _headroom_limit; DFSClosure(EdgeStore* edge_store, JFRBitSet* mark_bits, const Edge* start_edge); void add_chain(); void closure_impl(UnifiedOopRef reference, const oop pointee); + bool have_headroom() const; + public: virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS_EXCEPT_REFERENT; } diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp index 311c54becd8e..465491cd1d5a 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp @@ -236,12 +236,25 @@ void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, bool // quick reject, will not fit return; } - sample = _list->reuse(_priority_queue->pop()); + ObjectSample* popped = _priority_queue->pop(); + size_t popped_span = popped->span(); + ObjectSample* previous = popped->prev(); + sample = _list->reuse(popped); + assert(sample != nullptr, "invariant"); + if (previous != nullptr) { + push_span(previous, popped_span); + sample->set_span(span); + } else { + // The removed sample was the youngest sample in the list, which means the new sample is now the youngest + // sample. It should cover the spans of both. + sample->set_span(span + popped_span); + } } else { sample = _list->get(); + assert(sample != nullptr, "invariant"); + sample->set_span(span); } - assert(sample != nullptr, "invariant"); sample->set_thread_id(thread_id); if (virtual_thread) { sample->set_thread_is_virtual(); @@ -255,7 +268,6 @@ void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, bool sample->set_stack_trace_hash(stacktrace_hash); } - sample->set_span(allocated); sample->set_object(cast_to_oop(obj)); sample->set_allocated(allocated); sample->set_allocation_time(JfrTicks::now()); @@ -282,14 +294,18 @@ void ObjectSampler::remove_dead(ObjectSample* sample) { ObjectSample* const previous = sample->prev(); // push span onto previous if (previous != nullptr) { - _priority_queue->remove(previous); - previous->add_span(sample->span()); - _priority_queue->push(previous); + push_span(previous, sample->span()); } _priority_queue->remove(sample); _list->release(sample); } +void ObjectSampler::push_span(ObjectSample* sample, size_t span) { + _priority_queue->remove(sample); + sample->add_span(span); + _priority_queue->push(sample); +} + ObjectSample* ObjectSampler::last() const { return _list->last(); } diff --git a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp index 3789227b6008..6ae1b0a06833 100644 --- a/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp +++ b/src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp @@ -64,6 +64,7 @@ class ObjectSampler : public CHeapObj { void add(HeapWord* object, size_t size, traceid thread_id, bool virtual_thread, const JfrBlobHandle& bh, JavaThread* thread); void scavenge(); void remove_dead(ObjectSample* sample); + void push_span(ObjectSample* sample, size_t span); const ObjectSample* item_at(int index) const; ObjectSample* item_at(int index); diff --git a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp index ff52b4104fdb..80a160ab84ba 100644 --- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp +++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp @@ -515,10 +515,13 @@ TRACE_REQUEST_FUNC(ThreadAllocationStatistics) { * the total memory reported is the amount of memory configured for the guest OS by the hypervisor. */ TRACE_REQUEST_FUNC(PhysicalMemory) { - u8 totalPhysicalMemory = os::physical_memory(); + physical_memory_size_type totalPhysicalMemory = os::physical_memory(); EventPhysicalMemory event; event.set_totalSize(totalPhysicalMemory); - event.set_usedSize(totalPhysicalMemory - os::available_memory()); + physical_memory_size_type avail_mem = 0; + // Return value ignored - defaulting to 0 on failure. + (void)os::available_memory(avail_mem); + event.set_usedSize(totalPhysicalMemory - avail_mem); event.commit(); } diff --git a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp index 09455a3ea1fa..0c191e3e1898 100644 --- a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp +++ b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -228,7 +228,7 @@ bool JfrRecorder::on_create_vm_2() { } bool JfrRecorder::on_create_vm_3() { - assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence"); + JVMTI_ONLY( assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence, phase is %d", (int)JvmtiEnvBase::get_phase()); ) return Arguments::is_dumping_archive() || launch_command_line_recordings(JavaThread::current()); } diff --git a/src/hotspot/share/prims/jvmtiAgentList.cpp b/src/hotspot/share/prims/jvmtiAgentList.cpp index 2a0f71728888..2857927ac31a 100644 --- a/src/hotspot/share/prims/jvmtiAgentList.cpp +++ b/src/hotspot/share/prims/jvmtiAgentList.cpp @@ -200,6 +200,11 @@ void JvmtiAgentList::load_xrun_agents() { // Invokes Agent_OnAttach for agents loaded dynamically during runtime. void JvmtiAgentList::load_agent(const char* agent_name, bool is_absolute_path, const char* options, outputStream* st) { + if (JvmtiEnvBase::get_phase() != JVMTI_PHASE_LIVE) { + st->print_cr("Dynamic agent loading is only permitted in the live phase"); + return; + } + JvmtiAgent* const agent = new JvmtiAgent(agent_name, options, is_absolute_path, /* dynamic agent */ true); if (agent->load(st)) { add(agent); diff --git a/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp b/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp index 0c33a7c29248..46c6bb8e2566 100644 --- a/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp +++ b/src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp @@ -992,6 +992,11 @@ void JvmtiClassFileReconstituter::write_u8(u8 x) { void JvmtiClassFileReconstituter::copy_bytecodes(const methodHandle& mh, unsigned char* bytecodes) { + // We must copy bytecodes only from linked classes. + // Being linked guarantees we are not getting bytecodes at + // the same time the linking process is rewriting them. + guarantee(mh->method_holder()->is_linked(), "Bytecodes must be copied from a linked class"); + // use a BytecodeStream to iterate over the bytecodes. JVM/fast bytecodes // and the breakpoint bytecode are converted to their original bytecodes. diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp index a0203ad852e2..0a9c3848b4af 100644 --- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp @@ -1153,9 +1153,11 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions_single_step(Old2N } } + physical_memory_size_type avail_mem = 0; + (void)os::available_memory(avail_mem); log_debug(redefine, class, load) - ("loading name=%s kind=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), _class_load_kind, os::available_memory() >> 10); + ("loading name=%s kind=%d (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", + the_class->external_name(), _class_load_kind, avail_mem >> 10); // class bytes... const unsigned char* class_bytes; @@ -1321,8 +1323,9 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions_single_step(Old2N _object_klass_redefined = true; } + (void)os::available_memory(avail_mem); log_debug(redefine, class, load) - ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", the_class->external_name(), os::available_memory() >> 10); + ("loaded name=%s (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", the_class->external_name(), avail_mem >> 10); } return JVMTI_ERROR_NONE; @@ -2376,9 +2379,12 @@ void VM_EnhancedRedefineClasses::redefine_single_class(Thread *current, Instance // increment the classRedefinedCount field in the_class and in any // direct and indirect subclasses of the_class increment_class_counter(current, new_class); + + physical_memory_size_type avail_mem = 0; + (void)os::available_memory(avail_mem); log_info(redefine, class, load) - ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)", - new_class->external_name(), java_lang_Class::classRedefinedCount(new_class->java_mirror()), os::available_memory() >> 10); + ("redefined name=%s, count=%d (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", + new_class->external_name(), java_lang_Class::classRedefinedCount(new_class->java_mirror()), avail_mem >> 10); Events::log_redefinition(current, "redefined class name=%s, count=%d", new_class->external_name(), java_lang_Class::classRedefinedCount(new_class->java_mirror())); diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp index 29579cdf5513..79d2d195d8b0 100644 --- a/src/hotspot/share/prims/jvmtiEnv.cpp +++ b/src/hotspot/share/prims/jvmtiEnv.cpp @@ -462,6 +462,18 @@ JvmtiEnv::RetransformClasses(jint class_count, const jclass* classes) { InstanceKlass* ik = InstanceKlass::cast(klass); if (ik->get_cached_class_file_bytes() == nullptr) { + // Link the class to avoid races with the rewriter. This will call the verifier also + // on the class. Linking is also done in VM_RedefineClasses below, but we need + // to keep that for other VM_RedefineClasses callers. + JavaThread* THREAD = current_thread; + ik->link_class(THREAD); + if (HAS_PENDING_EXCEPTION) { + // Retransform/JVMTI swallows error messages. Using this class will rerun the verifier in a context + // that propagates the VerifyError, if thrown. + CLEAR_PENDING_EXCEPTION; + return JVMTI_ERROR_INVALID_CLASS; + } + // Not cached, we need to reconstitute the class file from the // VM representation. We don't attach the reconstituted class // bytes to the InstanceKlass here because they have not been @@ -3700,7 +3712,8 @@ jvmtiError JvmtiEnv::GetBytecodes(Method* method, jint* bytecode_count_ptr, unsigned char** bytecodes_ptr) { NULL_CHECK(method, JVMTI_ERROR_INVALID_METHODID); - methodHandle mh(Thread::current(), method); + JavaThread* current_thread = JavaThread::current(); + methodHandle mh(current_thread, method); jint size = (jint)mh->code_size(); jvmtiError err = allocate(size, bytecodes_ptr); if (err != JVMTI_ERROR_NONE) { @@ -3709,6 +3722,13 @@ JvmtiEnv::GetBytecodes(Method* method, jint* bytecode_count_ptr, unsigned char** (*bytecode_count_ptr) = size; // get byte codes + // Make sure the class is verified and rewritten first. + JavaThread* THREAD = current_thread; + mh->method_holder()->link_class(THREAD); + if (HAS_PENDING_EXCEPTION) { + CLEAR_PENDING_EXCEPTION; + return JVMTI_ERROR_INVALID_CLASS; + } JvmtiClassFileReconstituter::copy_bytecodes(mh, *bytecodes_ptr); return JVMTI_ERROR_NONE; diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp index e2fc7a48867b..0cc156beb4a3 100644 --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp @@ -1375,10 +1375,12 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() { // constant pools HandleMark hm(current); InstanceKlass* the_class = get_ik(_class_defs[i].klass); - + physical_memory_size_type avail_mem = 0; + // Return value ignored - defaulting to 0 on failure. + (void)os::available_memory(avail_mem); log_debug(redefine, class, load) - ("loading name=%s kind=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), _class_load_kind, os::available_memory() >> 10); + ("loading name=%s kind=%d (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", + the_class->external_name(), _class_load_kind, avail_mem >> 10); ClassFileStream st((u1*)_class_defs[i].class_bytes, _class_defs[i].class_byte_count, @@ -1544,9 +1546,10 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() { return JVMTI_ERROR_INTERNAL; } } - + // Return value ignored - defaulting to 0 on failure. + (void)os::available_memory(avail_mem); log_debug(redefine, class, load) - ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", the_class->external_name(), os::available_memory() >> 10); + ("loaded name=%s (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", the_class->external_name(), avail_mem >> 10); } return JVMTI_ERROR_NONE; @@ -4455,9 +4458,12 @@ void VM_RedefineClasses::redefine_single_class(Thread* current, jclass the_jclas ResourceMark rm(current); // increment the classRedefinedCount field in the_class and in any // direct and indirect subclasses of the_class + physical_memory_size_type avail_mem = 0; + // Return value ignored - defaulting to 0 on failure. + (void)os::available_memory(avail_mem); log_info(redefine, class, load) - ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror()), os::available_memory() >> 10); + ("redefined name=%s, count=%d (avail_mem=" PHYS_MEM_TYPE_FORMAT "K)", + the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror()), avail_mem >> 10); Events::log_redefinition(current, "redefined class name=%s, count=%d", the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror())); diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index c1dbb482f5fb..3288f5f27d61 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -2408,8 +2408,8 @@ WB_END // Physical memory of the host machine (including containers) WB_ENTRY(jlong, WB_HostPhysicalMemory(JNIEnv* env, jobject o)) - LINUX_ONLY(return os::Linux::physical_memory();) - return os::physical_memory(); + LINUX_ONLY(return static_cast(os::Linux::physical_memory());) + return static_cast(os::physical_memory()); WB_END // Physical swap of the host machine (including containers), Linux only. diff --git a/src/hotspot/share/runtime/abstract_vm_version.cpp b/src/hotspot/share/runtime/abstract_vm_version.cpp index 8939b84bebee..0e800056a4e1 100644 --- a/src/hotspot/share/runtime/abstract_vm_version.cpp +++ b/src/hotspot/share/runtime/abstract_vm_version.cpp @@ -262,6 +262,8 @@ const char* Abstract_VM_Version::internal_vm_info_string() { #define HOTSPOT_BUILD_COMPILER "MS VC++ 17.13 (VS2022)" #elif _MSC_VER == 1944 #define HOTSPOT_BUILD_COMPILER "MS VC++ 17.14 (VS2022)" + #elif _MSC_VER == 1950 + #define HOTSPOT_BUILD_COMPILER "MS VC++ 18.0 (VS2026)" #else #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER) #endif diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 976023e92348..58a84bd35289 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -1588,13 +1588,13 @@ void Arguments::set_heap_size() { !FLAG_IS_DEFAULT(MaxRAM)); if (override_coop_limit) { if (FLAG_IS_DEFAULT(MaxRAM)) { - phys_mem = os::physical_memory(); + phys_mem = static_cast(os::physical_memory()); FLAG_SET_ERGO(MaxRAM, (uint64_t)phys_mem); } else { phys_mem = (julong)MaxRAM; } } else { - phys_mem = FLAG_IS_DEFAULT(MaxRAM) ? MIN2(os::physical_memory(), (julong)MaxRAM) + phys_mem = FLAG_IS_DEFAULT(MaxRAM) ? MIN2(static_cast(os::physical_memory()), (julong)MaxRAM) : (julong)MaxRAM; } @@ -1730,7 +1730,8 @@ jint Arguments::set_aggressive_heap_flags() { // Thus, we need to make sure we're using a julong for intermediate // calculations. julong initHeapSize; - julong total_memory = os::physical_memory(); + physical_memory_size_type phys_mem = os::physical_memory(); + julong total_memory = static_cast(phys_mem); if (total_memory < (julong) 256 * M) { jio_fprintf(defaultStream::error_stream(), diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index 2e8d3bcdab15..a4b3409a1065 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1175,12 +1175,13 @@ void os::print_summary_info(outputStream* st, char* buf, size_t buflen) { #endif // PRODUCT get_summary_cpu_info(buf, buflen); st->print("%s, ", buf); - size_t mem = physical_memory()/G; + physical_memory_size_type phys_mem = physical_memory(); + physical_memory_size_type mem = phys_mem/G; if (mem == 0) { // for low memory systems - mem = physical_memory()/M; - st->print("%d cores, " SIZE_FORMAT "M, ", processor_count(), mem); + mem = phys_mem/M; + st->print("%d cores, " PHYS_MEM_TYPE_FORMAT "M, ", processor_count(), mem); } else { - st->print("%d cores, " SIZE_FORMAT "G, ", processor_count(), mem); + st->print("%d cores, " PHYS_MEM_TYPE_FORMAT "G, ", processor_count(), mem); } get_summary_os_info(buf, buflen); st->print_raw(buf); @@ -1901,17 +1902,17 @@ bool os::is_server_class_machine() { return true; } // Then actually look at the machine - bool result = false; - const unsigned int server_processors = 2; - const julong server_memory = 2UL * G; + bool result = false; + const unsigned int server_processors = 2; + const physical_memory_size_type server_memory = 2UL * G; // We seem not to get our full complement of memory. // We allow some part (1/8?) of the memory to be "missing", // based on the sizes of DIMMs, and maybe graphics cards. - const julong missing_memory = 256UL * M; - + const physical_memory_size_type missing_memory = 256UL * M; + physical_memory_size_type phys_mem = os::physical_memory(); /* Is this a server class machine? */ if ((os::active_processor_count() >= (int)server_processors) && - (os::physical_memory() >= (server_memory - missing_memory))) { + (phys_mem >= server_memory - missing_memory)) { const unsigned int logical_processors = VM_Version::logical_processors_per_package(); if (logical_processors > 1) { diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index f3e306479b4d..54f90f69605b 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -320,10 +320,10 @@ class os: AllStatic { // For example, on Linux, "available" memory (`MemAvailable` in `/proc/meminfo`) is greater // than "free" memory (`MemFree` in `/proc/meminfo`) because Linux can free memory // aggressively (e.g. clear caches) so that it becomes available. - static julong available_memory(); - static julong free_memory(); + [[nodiscard]] static bool available_memory(physical_memory_size_type& value); + [[nodiscard]] static bool free_memory(physical_memory_size_type& value); - static julong physical_memory(); + static physical_memory_size_type physical_memory(); static bool has_allocatable_memory_limit(size_t* limit); static bool is_server_class_machine(); @@ -926,7 +926,7 @@ class os: AllStatic { // provided buffer as a scratch buffer. The status message which will be written // into the error log either is file location or a short error message, depending // on the checking result. - static void check_dump_limit(char* buffer, size_t bufferSize); + static void check_core_dump_prerequisites(char* buffer, size_t bufferSize, bool check_only = false); // Get the default path to the core file // Returns the length of the string diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index ce4c3b9cc14d..b0c43d146245 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -36,6 +36,8 @@ #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" +#include "runtime/globals.hpp" +#include "runtime/globals_extension.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaThread.inline.hpp" #include "runtime/nonJavaThread.hpp" diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp index 1469c7a42aa6..a15bb1710618 100644 --- a/src/hotspot/share/runtime/threadSMR.cpp +++ b/src/hotspot/share/runtime/threadSMR.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -727,7 +727,8 @@ JavaThread* ThreadsList::find_JavaThread_from_java_tid(jlong java_tid) const { } } } - } else if (!thread->is_exiting()) { + } else if (includes(thread) && !thread->is_exiting()) { + // The thread is protected by this list and has not yet exited return thread; } return nullptr; @@ -866,7 +867,7 @@ void ThreadsSMRSupport::add_thread(JavaThread *thread){ ThreadsList *old_list = xchg_java_thread_list(new_list); free_list(old_list); - if (ThreadIdTable::is_initialized()) { + if (ThreadIdTable::is_initialized_acquire()) { jlong tid = SharedRuntime::get_java_tid(thread); ThreadIdTable::add_thread(tid, thread); } diff --git a/src/hotspot/share/runtime/threads.cpp b/src/hotspot/share/runtime/threads.cpp index f3b5cea106f7..091a25ad06d0 100644 --- a/src/hotspot/share/runtime/threads.cpp +++ b/src/hotspot/share/runtime/threads.cpp @@ -63,6 +63,7 @@ #include "runtime/flags/jvmFlagLimit.hpp" #include "runtime/handles.inline.hpp" #include "runtime/globals.hpp" +#include "runtime/globals_extension.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/java.hpp" #include "runtime/javaCalls.hpp" @@ -688,6 +689,11 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { log_info(os)("Initialized VM with process ID %d", os::current_process_id()); + if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && CreateCoredumpOnCrash) { + char buffer[2*JVM_MAXPATHLEN]; + os::check_core_dump_prerequisites(buffer, sizeof(buffer), true); + } + // Signal Dispatcher needs to be started before VMInit event is posted os::initialize_jdk_signal_support(CHECK_JNI_ERR); @@ -1044,7 +1050,7 @@ void Threads::remove(JavaThread* p, bool is_daemon) { MutexLocker throttle_ml(UseThreadsLockThrottleLock ? ThreadsLockThrottle_lock : nullptr); MonitorLocker ml(Threads_lock); - if (ThreadIdTable::is_initialized()) { + if (ThreadIdTable::is_initialized_acquire()) { // This cleanup must be done before the current thread's GC barrier // is detached since we need to touch the threadObj oop. jlong tid = SharedRuntime::get_java_tid(p); diff --git a/src/hotspot/share/services/management.cpp b/src/hotspot/share/services/management.cpp index a9c50a8bf06d..5de75840f3d3 100644 --- a/src/hotspot/share/services/management.cpp +++ b/src/hotspot/share/services/management.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -978,7 +978,7 @@ static jlong get_long_attribute(jmmLongAttribute att) { return ClassLoadingService::class_method_data_size(); case JMM_OS_MEM_TOTAL_PHYSICAL_BYTES: - return os::physical_memory(); + return static_cast(os::physical_memory()); default: return -1; @@ -1130,6 +1130,7 @@ JVM_ENTRY(jint, jmm_GetThreadInfo(JNIEnv *env, jlongArray ids, jint maxDepth, jo // create dummy snapshot dump_result.add_thread_snapshot(); } else { + assert(dump_result.t_list()->includes(jt), "Must be protected"); dump_result.add_thread_snapshot(jt); } } diff --git a/src/hotspot/share/services/threadIdTable.cpp b/src/hotspot/share/services/threadIdTable.cpp index 168b2e085adf..3355fc26eaaf 100644 --- a/src/hotspot/share/services/threadIdTable.cpp +++ b/src/hotspot/share/services/threadIdTable.cpp @@ -1,6 +1,6 @@ /* -* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "classfile/javaClasses.inline.hpp" -#include "runtime/atomic.hpp" +#include "runtime/handles.hpp" #include "runtime/interfaceSupport.inline.hpp" #include "runtime/javaThread.inline.hpp" #include "runtime/threadSMR.hpp" @@ -83,24 +83,25 @@ class ThreadIdTableConfig : public AllStatic { // Lazily creates the table and populates it with the given // thread list void ThreadIdTable::lazy_initialize(const ThreadsList *threads) { - if (!_is_initialized) { + if (!Atomic::load_acquire(&_is_initialized)) { { // There is no obvious benefit in allowing the thread table // to be concurrently populated during initialization. MutexLocker ml(ThreadIdTableCreate_lock); - if (_is_initialized) { + if (Atomic::load(&_is_initialized)) { return; } create_table(threads->length()); - _is_initialized = true; + Atomic::release_store(&_is_initialized, true); } + for (uint i = 0; i < threads->length(); i++) { JavaThread* thread = threads->thread_at(i); - oop tobj = thread->threadObj(); + Handle tobj = Handle(JavaThread::current(), thread->threadObj()); if (tobj != nullptr) { - jlong java_tid = java_lang_Thread::thread_id(tobj); MutexLocker ml(Threads_lock); if (!thread->is_exiting()) { + jlong java_tid = java_lang_Thread::thread_id(tobj()); // Must be inside the lock to ensure that we don't add a thread to the table // that has just passed the removal point in Threads::remove(). add_thread(java_tid, thread); @@ -213,7 +214,7 @@ class ThreadGet : public StackObj { }; void ThreadIdTable::do_concurrent_work(JavaThread* jt) { - assert(_is_initialized, "Thread table is not initialized"); + assert(Atomic::load(&_is_initialized), "Thread table is not initialized"); _has_work = false; double load_factor = get_load_factor(); log_debug(thread, table)("Concurrent work, load factor: %g", load_factor); @@ -223,7 +224,8 @@ void ThreadIdTable::do_concurrent_work(JavaThread* jt) { } JavaThread* ThreadIdTable::add_thread(jlong tid, JavaThread* java_thread) { - assert(_is_initialized, "Thread table is not initialized"); + assert(Threads_lock->owned_by_self(), "Must hold Threads_lock"); + assert(Atomic::load(&_is_initialized), "Thread table is not initialized"); Thread* thread = Thread::current(); ThreadIdTableLookup lookup(tid); ThreadGet tg; @@ -242,7 +244,7 @@ JavaThread* ThreadIdTable::add_thread(jlong tid, JavaThread* java_thread) { } JavaThread* ThreadIdTable::find_thread_by_tid(jlong tid) { - assert(_is_initialized, "Thread table is not initialized"); + assert(Atomic::load(&_is_initialized), "Thread table is not initialized"); Thread* thread = Thread::current(); ThreadIdTableLookup lookup(tid); ThreadGet tg; @@ -251,7 +253,8 @@ JavaThread* ThreadIdTable::find_thread_by_tid(jlong tid) { } bool ThreadIdTable::remove_thread(jlong tid) { - assert(_is_initialized, "Thread table is not initialized"); + assert(Threads_lock->owned_by_self(), "Must hold Threads_lock"); + assert(Atomic::load(&_is_initialized), "Thread table is not initialized"); Thread* thread = Thread::current(); ThreadIdTableLookup lookup(tid); return _local_table->remove(thread, lookup); diff --git a/src/hotspot/share/services/threadIdTable.hpp b/src/hotspot/share/services/threadIdTable.hpp index 12772aed88c0..a292d04452a2 100644 --- a/src/hotspot/share/services/threadIdTable.hpp +++ b/src/hotspot/share/services/threadIdTable.hpp @@ -1,6 +1,6 @@ /* -* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ #define SHARE_SERVICES_THREADIDTABLE_HPP #include "memory/allStatic.hpp" +#include "runtime/atomic.hpp" class JavaThread; class ThreadsList; @@ -41,7 +42,9 @@ class ThreadIdTable : public AllStatic { public: // Initialization static void lazy_initialize(const ThreadsList* threads); - static bool is_initialized() { return _is_initialized; } + static bool is_initialized_acquire() { + return Atomic::load_acquire(&_is_initialized); + } // Lookup and list management static JavaThread* find_thread_by_tid(jlong tid); diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index 9d4cae2a08d4..2711a4e30079 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -131,6 +131,7 @@ class oopDesc; #define UINT64_FORMAT_X "0x%" PRIx64 #define UINT64_FORMAT_X_0 "0x%016" PRIx64 #define UINT64_FORMAT_W(width) "%" #width PRIu64 +#define PHYS_MEM_TYPE_FORMAT "%" PRIu64 // Format integers which change size between 32- and 64-bit. #define SSIZE_FORMAT "%" PRIdPTR @@ -426,6 +427,11 @@ inline size_t byte_size_in_exact_unit(size_t s) { #define HEAP_CHANGE_FORMAT_ARGS(_name_, _prev_used_, _prev_capacity_, _used_, _capacity_) \ (_name_), (_prev_used_) / K, (_prev_capacity_) / K, (_used_) / K, (_capacity_) / K +// This typedef is to address the issue of running a 32-bit VM. In this case the amount +// of physical memory may not fit in size_t, so we have to have a larger type. Once 32-bit +// is deprecated, one can use size_t. +typedef uint64_t physical_memory_size_type; + //---------------------------------------------------------------------------------------------------- // VM type definitions diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 9adbac965cf8..ef47ce60a079 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2020 SAP SE. All rights reserved. * Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -1740,7 +1740,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt ShowMessageBoxOnError = false; } - os::check_dump_limit(buffer, sizeof(buffer)); + os::check_core_dump_prerequisites(buffer, sizeof(buffer)); // reset signal handlers or exception filter; make sure recursive crashes // are handled properly. @@ -2392,10 +2392,12 @@ static void print_process_memory_usage_platform(outputStream *st) os::Linux::meminfo_t info; if (os::Linux::query_process_memory_info(&info)) { ssize_t phys_total_kb = os::physical_memory() / K; - ssize_t phys_avail_kb = os::available_memory() / K; + physical_memory_size_type avail_mem = 0; + (void)os::available_memory(avail_mem); + physical_memory_size_type phys_avail_kb = avail_mem / K; int rss_percentile = (int)(info.vmrss * 100.0 / phys_total_kb); st->print_cr("Resident Set Size: " SSIZE_FORMAT "K (%d%% of " - SSIZE_FORMAT "K total physical memory with " SSIZE_FORMAT "K free physical memory)", + SSIZE_FORMAT "K total physical memory with " PHYS_MEM_TYPE_FORMAT "K free physical memory)", info.vmrss, rss_percentile, phys_total_kb, phys_avail_kb); } else { st->print_cr("Could not open /proc/self/status to get process memory related information"); @@ -2415,10 +2417,12 @@ static void print_process_memory_usage_platform(outputStream *st) if (ret != 0) { ssize_t rss_kb = pmex.WorkingSetSize / K; ssize_t phys_total_kb = os::physical_memory() / K; - ssize_t phys_avail_kb = os::available_memory() / K; + physical_memory_size_type avail_mem = 0; + (void)os::available_memory(avail_mem); + physical_memory_size_type phys_avail_kb = avail_mem / K; int rss_percentile = (int)(rss_kb * 100.0 / phys_total_kb); st->print_cr("Resident Set Size: " SSIZE_FORMAT "K (%d%% of " - SSIZE_FORMAT "K total physical memory with " SSIZE_FORMAT "K free physical memory)", + SSIZE_FORMAT "K total physical memory with " PHYS_MEM_TYPE_FORMAT "K free physical memory)", rss_kb, rss_percentile, phys_total_kb, phys_avail_kb); } else { st->print_cr("GetProcessMemoryInfo() call did not succeed"); @@ -2437,10 +2441,12 @@ static void print_process_memory_usage_platform(outputStream *st) if (ret == KERN_SUCCESS) { ssize_t rss_kb = info.resident_size / K; ssize_t phys_total_kb = os::physical_memory() / K; - ssize_t phys_avail_kb = os::available_memory() / K; + physical_memory_size_type avail_mem = 0; + (void)os::available_memory(avail_mem); + physical_memory_size_type phys_avail_kb = avail_mem / K; int rss_percentile = (int)(rss_kb * 100.0 / phys_total_kb); st->print_cr("Resident Set Size: " SSIZE_FORMAT "K (%d%% of " - SSIZE_FORMAT "K total physical memory with " SSIZE_FORMAT "K free physical memory)", + SSIZE_FORMAT "K total physical memory with " PHYS_MEM_TYPE_FORMAT "K free physical memory)", rss_kb, rss_percentile, phys_total_kb, phys_avail_kb); } else { st->print_cr("task_info() call did not succeed"); diff --git a/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java b/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java index ddb4d8e27183..3bdd7dc2a64e 100644 --- a/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java +++ b/src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java @@ -154,22 +154,39 @@ private long getFromCpuMax(int tokenIdx) { @Override public long getCpuShares() { long sharesRaw = getLongVal("cpu.weight"); - if (sharesRaw == 100 || sharesRaw <= 0) { + // cg v2 value must be in range [1,10000] + if (sharesRaw == 100 || sharesRaw <= 0 || sharesRaw > 10000) { return CgroupSubsystem.LONG_RETVAL_UNLIMITED; } int shares = (int)sharesRaw; // CPU shares (OCI) value needs to get translated into // a proper Cgroups v2 value. See: - // https://github.com/containers/crun/blob/master/crun.1.md#cpu-controller + // https://github.com/containers/crun/blob/1.24/crun.1.md#cpu-controller // // Use the inverse of (x == OCI value, y == cgroupsv2 value): - // ((262142 * y - 1)/9999) + 2 = x + // y = 10^(log2(x)^2/612 + 125/612 * log2(x) - 7.0/34.0) // - int x = 262142 * shares - 1; - double frac = x/9999.0; - x = ((int)frac) + 2; + // By re-arranging it to the standard quadratic form: + // log2(x)^2 + 125 * log2(x) - (126 + 612 * log_10(y)) = 0 + // + // Therefore, log2(x) = (-125 + sqrt( 125^2 - 4 * (-(126 + 612 * log_10(y)))))/2 + // + // As a result we have the inverse (we can discount substraction of the + // square root value since those values result in very small numbers and the + // cpu shares values - OCI - are in range [2-262144]) + // + // x = 2^((-125 + sqrt(16129 + 2448* log10(y)))/2) + // + double logMultiplicand = Math.log10(shares); + double discriminant = 16129 + 2448 * logMultiplicand; + double squareRoot = Math.sqrt(discriminant); + double exponent = (-125 + squareRoot)/2; + double scaledValue = Math.pow(2, exponent); + + int x = (int)scaledValue; if ( x <= PER_CPU_SHARES ) { - return PER_CPU_SHARES; // mimic cgroups v1 + // Return the back-mapped value. + return x; } int f = x/PER_CPU_SHARES; int lower_multiple = f * PER_CPU_SHARES; diff --git a/src/java.base/share/classes/java/net/InetAddress.java b/src/java.base/share/classes/java/net/InetAddress.java index fcc2e2700269..9fd5f4e59c9c 100644 --- a/src/java.base/share/classes/java/net/InetAddress.java +++ b/src/java.base/share/classes/java/net/InetAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -194,8 +194,8 @@ * caching. Likewise, a system admin can configure a different * negative caching TTL value when needed or extend the usage of the stale data. * - *

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

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

*
networkaddress.cache.ttl
diff --git a/src/java.base/share/classes/java/net/doc-files/net-properties.html b/src/java.base/share/classes/java/net/doc-files/net-properties.html index fc401e90b6b0..24f7a12a07fd 100644 --- a/src/java.base/share/classes/java/net/doc-files/net-properties.html +++ b/src/java.base/share/classes/java/net/doc-files/net-properties.html @@ -1,6 +1,6 @@ ", 3); + if (cend < 0) return false; + i = (unsigned) cend + 3; + continue; + } + if (i + 9 <= len && !memcmp (svg + i, "", 3); + if (cend < 0) return false; + i = (unsigned) cend + 3; + continue; + } + + bool closing = (i + 1 < len && svg[i + 1] == '/'); + bool special = (i + 1 < len && (svg[i + 1] == '!' || svg[i + 1] == '?')); + + unsigned gt = i + 1; + char quote = 0; + while (gt < len) + { + char c = svg[gt]; + if (quote) + { + if (c == quote) quote = 0; + } + else + { + if (c == '"' || c == '\'') + quote = c; + else if (c == '>') + break; + } + gt++; + } + if (gt >= len) + return false; + + if (special) + { + i = gt + 1; + continue; + } + + unsigned p = i + (closing ? 2 : 1); + while (p < gt && isspace ((unsigned char) svg[p])) p++; + const char *name = svg + p; + unsigned name_len = 0; + while (p + name_len < gt) + { + unsigned char c = (unsigned char) name[name_len]; + if (!(isalnum (c) || c == '_' || c == '-' || c == ':')) + break; + name_len++; + } + bool is_defs = (name_len == 4 && !memcmp (name, "defs", 4)); + + if (closing) + { + if (!depth) + { + i = gt + 1; + continue; + } + + open_elem_t e = stack[--depth]; + unsigned end = gt + 1; + + if (e.id.len) + { + if (unlikely (!id_entries->push_or_fail (id_entry_t {e.id, (uint32_t) e.start, (uint32_t) end}))) + return false; + + if (e.in_defs_content) + { + if (unlikely (!defs_entries->push_or_fail ())) + return false; + auto &slot = defs_entries->tail (); + slot.id = e.id; + slot.start = e.start; + slot.end = end; + } + + hb_codepoint_t gid; + if (parse_glyph_id_span (e.id, &gid)) + { + if (unlikely (!glyph_spans->push_or_fail (glyph_entry_t {gid, (uint32_t) e.start, (uint32_t) end}))) + return false; + } + } + + if (e.is_defs && defs_depth) + defs_depth--; + + i = end; + continue; + } + + SVG::svg_id_span_t id = {}; + parse_id_in_start_tag (svg, i, gt, &id); + + unsigned r = gt; + while (r > i && isspace ((unsigned char) svg[r - 1])) r--; + bool self_closing = (r > i && svg[r - 1] == '/'); + + open_elem_t e = {}; + e.start = i; + e.id = id; + e.in_defs_content = defs_depth > 0; + e.is_defs = is_defs; + + if (self_closing) + { + unsigned end = gt + 1; + if (e.id.len) + { + if (unlikely (!id_entries->push_or_fail (id_entry_t {e.id, (uint32_t) e.start, (uint32_t) end}))) + return false; + + if (e.in_defs_content) + { + if (unlikely (!defs_entries->push_or_fail ())) + return false; + auto &slot = defs_entries->tail (); + slot.id = e.id; + slot.start = e.start; + slot.end = end; + } + + hb_codepoint_t gid; + if (parse_glyph_id_span (e.id, &gid)) + { + if (unlikely (!glyph_spans->push_or_fail (glyph_entry_t {gid, (uint32_t) e.start, (uint32_t) end}))) + return false; + } + } + } + else + { + if (unlikely (depth >= MAX_DEPTH)) + return false; + stack[depth++] = e; + if (is_defs) + defs_depth++; + } + + i = gt + 1; + } + + return true; +} + +} /* namespace _hb_svg_cache_impl */ + +inline +SVG::accelerator_t::accelerator_t (hb_face_t *face) +{ + table = hb_sanitize_context_t ().reference_table (face); + doc_caches.init (); + unsigned doc_count = table->get_document_count (); + if (doc_count && unlikely (!doc_caches.resize (doc_count))) + doc_caches.clear (); + for (unsigned i = 0; i < doc_caches.length; i++) + doc_caches.arrayZ[i].set_relaxed (nullptr); +} + +inline +SVG::accelerator_t::~accelerator_t () +{ + for (unsigned i = 0; i < doc_caches.length; i++) + destroy_doc_cache (doc_caches.arrayZ[i].get_relaxed ()); + doc_caches.fini (); + table.destroy (); +} + +inline void +SVG::accelerator_t::destroy_doc_cache (svg_doc_cache_t *doc) +{ + if (!doc) + return; + doc->glyph_spans.fini (); + doc->defs_entries.fini (); + doc->id_spans.fini (); + hb_blob_destroy (doc->blob); + hb_free (doc); +} + +inline SVG::svg_doc_cache_t * +SVG::accelerator_t::make_doc_cache (hb_blob_t *image, + const char *svg, + unsigned len, + hb_codepoint_t start_glyph, + hb_codepoint_t end_glyph) const +{ + static const uint32_t INVALID_SPAN = 0xFFFFFFFFu; + + auto *doc = (svg_doc_cache_t *) hb_malloc (sizeof (svg_doc_cache_t)); + if (!doc) + return nullptr; + + doc->blob = nullptr; + doc->svg = nullptr; + doc->len = 0; + doc->defs_entries.init (); + doc->start_glyph = HB_CODEPOINT_INVALID; + doc->end_glyph = HB_CODEPOINT_INVALID; + doc->glyph_spans.init (); + doc->id_spans.init (); + + doc->blob = hb_blob_reference (image); + doc->svg = svg; + doc->len = len; + doc->start_glyph = start_glyph; + doc->end_glyph = end_glyph; + + if (unlikely (start_glyph == HB_CODEPOINT_INVALID || end_glyph < start_glyph)) + { + destroy_doc_cache (doc); + return nullptr; + } + + unsigned glyph_count = end_glyph - start_glyph + 1; + if (!doc->glyph_spans.resize ((int) glyph_count)) + { + destroy_doc_cache (doc); + return nullptr; + } + for (unsigned i = 0; i < glyph_count; i++) + doc->glyph_spans.arrayZ[i] = hb_pair_t (INVALID_SPAN, INVALID_SPAN); + + hb_vector_t<_hb_svg_cache_impl::glyph_entry_t> glyph_spans; + glyph_spans.init (); + hb_vector_t<_hb_svg_cache_impl::id_entry_t> id_entries; + id_entries.init (); + if (!_hb_svg_cache_impl::parse_cache_entries_linear (svg, len, + &doc->defs_entries, + &glyph_spans, + &id_entries)) + { + id_entries.fini (); + glyph_spans.fini (); + destroy_doc_cache (doc); + return nullptr; + } + + for (unsigned i = 0; i < glyph_spans.length; i++) + { + const auto &span = glyph_spans.arrayZ[i]; + if (unlikely (span.glyph < start_glyph || span.glyph > end_glyph)) + continue; + doc->glyph_spans.arrayZ[span.glyph - start_glyph] = hb_pair_t (span.start, span.end); + } + + for (unsigned i = 0; i < id_entries.length; i++) + { + const auto &e = id_entries.arrayZ[i]; + hb_pair_t *out = nullptr; + if (doc->id_spans.has (e.id, &out)) + continue; + if (unlikely (!doc->id_spans.set (e.id, hb_pair_t (e.start, e.end)))) + { + id_entries.fini (); + glyph_spans.fini (); + destroy_doc_cache (doc); + return nullptr; + } + } + + id_entries.fini (); + glyph_spans.fini (); + return doc; +} + +inline const SVG::svg_doc_cache_t * +SVG::accelerator_t::get_or_create_doc_cache (hb_blob_t *image, + const char *svg, + unsigned len, + unsigned doc_index, + hb_codepoint_t start_glyph, + hb_codepoint_t end_glyph) const +{ + if (doc_index >= doc_caches.length) + return nullptr; + + auto &slot = doc_caches.arrayZ[doc_index]; + auto *doc = slot.get_acquire (); + if (doc) + return doc; + + auto *fresh = make_doc_cache (image, svg, len, start_glyph, end_glyph); + if (!fresh) + return nullptr; + + auto *expected = (svg_doc_cache_t *) nullptr; + if (slot.cmpexch (expected, fresh)) + return fresh; + + destroy_doc_cache (fresh); + return expected; +} + +inline const char * +SVG::accelerator_t::doc_cache_get_svg (const svg_doc_cache_t *doc, + unsigned *len) const +{ + if (!doc) + { + if (len) *len = 0; + return nullptr; + } + if (len) *len = doc->len; + return doc->svg; +} + +inline const hb_vector_t * +SVG::accelerator_t::doc_cache_get_defs_entries (const svg_doc_cache_t *doc) const +{ + return doc ? &doc->defs_entries : nullptr; +} + +inline bool +SVG::accelerator_t::doc_cache_get_glyph_span (const svg_doc_cache_t *doc, + hb_codepoint_t glyph, + unsigned *start, + unsigned *end) const +{ + static const uint32_t INVALID_SPAN = 0xFFFFFFFFu; + if (!doc || doc->start_glyph == HB_CODEPOINT_INVALID || + glyph < doc->start_glyph || glyph > doc->end_glyph) + return false; + + const auto &span = doc->glyph_spans.arrayZ[glyph - doc->start_glyph]; + if (span.first == INVALID_SPAN) + return false; + if (unlikely (span.first > span.second || span.second > doc->len)) + return false; + + if (start) *start = span.first; + if (end) *end = span.second; + return true; +} + +inline bool +SVG::accelerator_t::doc_cache_find_id_span (const svg_doc_cache_t *doc, + svg_id_span_t id, + unsigned *start, + unsigned *end) const +{ + if (!doc || !id.p || !id.len) + return false; + hb_pair_t *span = nullptr; + if (!doc->id_spans.has (id, &span)) + return false; + if (unlikely (span->first > span->second || span->second > doc->len)) + return false; + if (start) *start = span->first; + if (end) *end = span->second; + return true; +} + +inline bool +SVG::accelerator_t::doc_cache_find_id_cstr (const svg_doc_cache_t *doc, + const char *id, + unsigned *start, + unsigned *end) const +{ + if (!id) return false; + svg_id_span_t key = {id, (unsigned) strlen (id)}; + return doc_cache_find_id_span (doc, key, start, end); +} + struct SVG_accelerator_t : SVG::accelerator_t { SVG_accelerator_t (hb_face_t *face) : SVG::accelerator_t (face) {} }; diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GDEF/GDEF.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GDEF/GDEF.hh index 89e110990bc6..23412914feb5 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GDEF/GDEF.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GDEF/GDEF.hh @@ -616,7 +616,7 @@ struct GDEFVersion1_2 public: DEFINE_SIZE_MIN (4 + 4 * Types::size); - unsigned int get_size () const + size_t get_size () const { return min_size + (version.to_int () >= 0x00010002u ? markGlyphSetsDef.static_size : 0) + @@ -755,7 +755,7 @@ struct GDEF ComponentGlyph = 4 }; - unsigned int get_size () const + size_t get_size () const { switch (u.version.major) { case 1: return u.version1.get_size (); diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/CursivePosFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/CursivePosFormat1.hh index f5a09e07d736..c96f66da9b3f 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/CursivePosFormat1.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/CursivePosFormat1.hh @@ -51,7 +51,11 @@ struct EntryExitRecord }; static inline void -reverse_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction, unsigned int new_parent) +reverse_cursive_minor_offset (hb_glyph_position_t *pos, + unsigned int len, + unsigned int i, + hb_direction_t direction, + unsigned int new_parent) { int chain = pos[i].attach_chain(), type = pos[i].attach_type(); if (likely (!chain || 0 == (type & ATTACH_TYPE_CURSIVE))) @@ -61,18 +65,28 @@ reverse_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direc unsigned int j = (int) i + chain; + if (unlikely (j >= len)) + return; + /* Stop if we see new parent in the chain. */ if (j == new_parent) return; - reverse_cursive_minor_offset (pos, j, direction, new_parent); + int16_t reversed_chain = -chain; + /* The old edge was cleared above; if the reversed distance truncates, + * keep it detached instead of storing a poisoned chain. + */ + if (unlikely (reversed_chain != -chain)) + return; + + reverse_cursive_minor_offset (pos, len, j, direction, new_parent); if (HB_DIRECTION_IS_HORIZONTAL (direction)) pos[j].y_offset = -pos[i].y_offset; else pos[j].x_offset = -pos[i].x_offset; - pos[j].attach_chain() = -chain; + pos[j].attach_chain() = reversed_chain; pos[j].attach_type() = type; } @@ -228,7 +242,7 @@ struct CursivePosFormat1 * previous connection now attaches to new parent. Watch out for case * where new parent is on the path from old chain... */ - reverse_cursive_minor_offset (pos, child, c->direction, parent); + reverse_cursive_minor_offset (pos, buffer->len, child, c->direction, parent); pos[child].attach_chain() = (int) parent - (int) child; if (pos[child].attach_chain() != (int) parent - (int) child) diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairSet.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairSet.hh index e610fcd75170..d8428a125622 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairSet.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairSet.hh @@ -24,11 +24,11 @@ struct PairSet : ValueBase public: DEFINE_SIZE_MIN (2); - static unsigned get_size (unsigned len1, unsigned len2) + static size_t get_size (unsigned len1, unsigned len2) { return Types::HBGlyphID::static_size + Value::static_size * (len1 + len2); } - static unsigned get_size (const ValueFormat valueFormats[2]) + static size_t get_size (const ValueFormat valueFormats[2]) { unsigned len1 = valueFormats[0].get_len (); unsigned len2 = valueFormats[1].get_len (); @@ -39,7 +39,7 @@ struct PairSet : ValueBase { const ValueFormat *valueFormats; unsigned int len1; /* valueFormats[0].get_len() */ - unsigned int stride; /* bytes */ + size_t stride; /* bytes */ }; bool sanitize (hb_sanitize_context_t *c, const sanitize_closure_t *closure) const diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat1.hh index 1a14be020f93..b33e761bac21 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat1.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat1.hh @@ -100,7 +100,7 @@ struct SinglePosFormat1 : ValueBase if (likely (index == NOT_COVERED)) return false; /* This is ugly... */ - hb_buffer_t buffer; + hb_buffer_t buffer {}; buffer.props.direction = direction; OT::hb_ot_apply_context_t c (1, font, &buffer, table_blob); diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat2.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat2.hh index 455796b4b27e..686126c9f5ee 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat2.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat2.hh @@ -104,7 +104,7 @@ struct SinglePosFormat2 : ValueBase if (unlikely (index >= valueCount)) return false; /* This is ugly... */ - hb_buffer_t buffer; + hb_buffer_t buffer {}; buffer.props.direction = direction; OT::hb_ot_apply_context_t c (1, font, &buffer, table_blob); diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/ValueFormat.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/ValueFormat.hh index b961a5139d80..613de17bf6a9 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/ValueFormat.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/ValueFormat.hh @@ -64,7 +64,7 @@ struct ValueFormat : HBUINT16 // be added to ValueFormat. As such, we use the faster hb_popcount8 // that only processes the lowest 8 bits. unsigned int get_len () const { return hb_popcount8 ((uint8_t) *this); } - unsigned int get_size () const { return get_len () * Value::static_size; } + size_t get_size () const { return get_len () * Value::static_size; } hb_vector_t get_device_table_indices () const { unsigned i = 0; diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/VARC.cc b/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/VARC.cc index f0e7f9345791..792a7553d8f9 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/VARC.cc +++ b/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/VARC.cc @@ -228,28 +228,28 @@ VarComponent::get_path_at (const hb_varc_context_t &c, #define PROCESS_TRANSFORM_COMPONENTS \ HB_STMT_START { \ - PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TRANSLATE_X, translateX); \ - PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TRANSLATE_Y, translateY); \ - PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_ROTATION, rotation); \ - PROCESS_TRANSFORM_COMPONENT (F6DOT10, 1.0f, HAVE_SCALE_X, scaleX); \ - PROCESS_TRANSFORM_COMPONENT (F6DOT10, 1.0f, HAVE_SCALE_Y, scaleY); \ - PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_SKEW_X, skewX); \ - PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_SKEW_Y, skewY); \ - PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TCENTER_X, tCenterX); \ - PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TCENTER_Y, tCenterY); \ + PROCESS_TRANSFORM_COMPONENT ( 0, FWORD, HAVE_TRANSLATE_X, translateX); \ + PROCESS_TRANSFORM_COMPONENT ( 0, FWORD, HAVE_TRANSLATE_Y, translateY); \ + PROCESS_TRANSFORM_COMPONENT (12, F4DOT12, HAVE_ROTATION, rotation); \ + PROCESS_TRANSFORM_COMPONENT (10, F6DOT10, HAVE_SCALE_X, scaleX); \ + PROCESS_TRANSFORM_COMPONENT (10, F6DOT10, HAVE_SCALE_Y, scaleY); \ + PROCESS_TRANSFORM_COMPONENT (12, F4DOT12, HAVE_SKEW_X, skewX); \ + PROCESS_TRANSFORM_COMPONENT (12, F4DOT12, HAVE_SKEW_Y, skewY); \ + PROCESS_TRANSFORM_COMPONENT ( 0, FWORD, HAVE_TCENTER_X, tCenterX); \ + PROCESS_TRANSFORM_COMPONENT ( 0, FWORD, HAVE_TCENTER_Y, tCenterY); \ } HB_STMT_END hb_transform_decomposed_t<> transform; // Read transform components -#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \ +#define PROCESS_TRANSFORM_COMPONENT(shift, type, flag, name) \ if (flags & (unsigned) flags_t::flag) \ { \ static_assert (type::static_size == HBINT16::static_size, ""); \ if (unlikely (unsigned (end - record) < HBINT16::static_size)) \ return hb_ubytes_t (); \ hb_barrier (); \ - transform.name = mult * * (const HBINT16 *) record; \ + transform.name = * (const HBINT16 *) record; \ record += HBINT16::static_size; \ } PROCESS_TRANSFORM_COMPONENTS; @@ -270,9 +270,8 @@ VarComponent::get_path_at (const hb_varc_context_t &c, { // Only use coord_setter if there's actually any axis overrides. coord_setter_t coord_setter (axisIndices ? component_coords : hb_array ()); - // Go backwards, to reduce coord_setter vector reallocations. - for (unsigned i = axisIndices.length; i; i--) - coord_setter[axisIndices[i - 1]] = axisValues[i - 1]; + for (unsigned i = 0; i < axisIndices.length; i++) + coord_setter[axisIndices[i]] = roundf (axisValues[i]); if (axisIndices) component_coords = coord_setter.get_coords (); @@ -281,39 +280,35 @@ VarComponent::get_path_at (const hb_varc_context_t &c, { float transformValues[9]; unsigned numTransformValues = 0; -#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \ +#define PROCESS_TRANSFORM_COMPONENT(shift, type, flag, name) \ if (flags & (unsigned) flags_t::flag) \ - transformValues[numTransformValues++] = transform.name / mult; + transformValues[numTransformValues++] = transform.name; PROCESS_TRANSFORM_COMPONENTS; #undef PROCESS_TRANSFORM_COMPONENT varStore.get_delta (transformVarIdx, coords, hb_array (transformValues, numTransformValues), cache); numTransformValues = 0; -#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \ +#define PROCESS_TRANSFORM_COMPONENT(shift, type, flag, name) \ if (flags & (unsigned) flags_t::flag) \ - transform.name = transformValues[numTransformValues++] * mult; + transform.name = transformValues[numTransformValues++]; PROCESS_TRANSFORM_COMPONENTS; #undef PROCESS_TRANSFORM_COMPONENT } // Divide them by their divisors -#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \ - if (flags & (unsigned) flags_t::flag) \ - { \ - HBINT16 int_v; \ - int_v = roundf (transform.name); \ - type typed_v = * (const type *) &int_v; \ - float float_v = (float) typed_v; \ - transform.name = float_v; \ - } +#define PROCESS_TRANSFORM_COMPONENT(shift, type, flag, name) \ + if (shift && (flags & (unsigned) flags_t::flag)) \ + transform.name *= 1.f / (1 << shift); PROCESS_TRANSFORM_COMPONENTS; #undef PROCESS_TRANSFORM_COMPONENT if (!(flags & (unsigned) flags_t::HAVE_SCALE_Y)) transform.scaleY = transform.scaleX; + transform.rotation *= HB_PI; + transform.skewX *= HB_PI; + transform.skewY *= HB_PI; + total_transform.transform (transform.to_transform ()); - total_transform.scale (c.font->x_mult ? 1.f / c.font->x_multf : 0.f, - c.font->y_mult ? 1.f / c.font->y_multf : 0.f); bool same_coords = component_coords.length == coords.length && component_coords.arrayZ == coords.arrayZ; @@ -348,14 +343,18 @@ VARC::get_path_at (const hb_varc_context_t &c, { if (c.draw_session) { + hb_transform_t<> leaf_transform = transform; + leaf_transform.x0 *= c.font->x_multf; + leaf_transform.y0 *= c.font->y_multf; + // Build a transforming pen to apply the transform. hb_draw_funcs_t *transformer_funcs = hb_transforming_pen_get_funcs (); - hb_transforming_pen_context_t context {transform, + hb_transforming_pen_context_t context {leaf_transform, c.draw_session->funcs, c.draw_session->draw_data, &c.draw_session->st}; hb_draw_session_t transformer_session {transformer_funcs, &context}; - hb_draw_session_t &shape_draw_session = transform.is_identity () ? *c.draw_session : transformer_session; + hb_draw_session_t &shape_draw_session = leaf_transform.is_identity () ? *c.draw_session : transformer_session; if (c.font->face->table.glyf->get_path_at (c.font, glyph, shape_draw_session, coords, c.scratch.glyf_scratch)) return true; #ifndef HB_NO_CFF @@ -375,7 +374,10 @@ VARC::get_path_at (const hb_varc_context_t &c, return false; hb_extents_t<> comp_extents (glyph_extents); - transform.transform_extents (comp_extents); + hb_transform_t<> leaf_transform = transform; + leaf_transform.x0 *= c.font->x_multf; + leaf_transform.y0 *= c.font->y_multf; + leaf_transform.transform_extents (comp_extents); c.extents->union_ (comp_extents); } return true; @@ -399,8 +401,6 @@ VARC::get_path_at (const hb_varc_context_t &c, parent_cache : (this+varStore).create_cache (&static_cache); - transform.scale (c.font->x_multf, c.font->y_multf); - VarCompositeGlyph::get_path_at (c, glyph, coords, transform, diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/CompositeGlyph.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/CompositeGlyph.hh index fb347770e6f4..7243e180101d 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/CompositeGlyph.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/CompositeGlyph.hh @@ -33,7 +33,7 @@ struct CompositeGlyphRecord }; public: - unsigned int get_size () const + size_t get_size () const { unsigned int size = min_size; /* glyphIndex is 24bit instead of 16bit */ diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/Glyph.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/Glyph.hh index 8f5287e9457f..432b4dfe4644 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/Glyph.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/Glyph.hh @@ -384,20 +384,24 @@ struct Glyph { #ifndef HB_NO_BEYOND_64K if (glyf_accelerator.GVAR->has_data ()) - glyf_accelerator.GVAR->apply_deltas_to_points (gid, - coords, - points.as_array ().sub_array (old_length), - scratch, - gvar_cache, - phantom_only && type == SIMPLE); + { + if (!glyf_accelerator.GVAR->apply_deltas_to_points (gid, + coords, + points.as_array ().sub_array (old_length), + scratch, + gvar_cache, + phantom_only && type == SIMPLE)) + return false; + } else #endif - glyf_accelerator.gvar->apply_deltas_to_points (gid, - coords, - points.as_array ().sub_array (old_length), - scratch, - gvar_cache, - phantom_only && type == SIMPLE); + if (!glyf_accelerator.gvar->apply_deltas_to_points (gid, + coords, + points.as_array ().sub_array (old_length), + scratch, + gvar_cache, + phantom_only && type == SIMPLE)) + return false; } #endif diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/SimpleGlyph.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/SimpleGlyph.hh index 507c94f7f3d1..d94a2f3ddfe9 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/SimpleGlyph.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/SimpleGlyph.hh @@ -186,6 +186,7 @@ struct SimpleGlyph /* One extra item at the end, for the instruction-count below. */ if (unlikely (!bytes.check_range (&endPtsOfContours[num_contours]))) return false; unsigned int num_points = endPtsOfContours[num_contours - 1] + 1; + if (unlikely (num_points < (unsigned) num_contours)) return false; unsigned old_length = points.length; points.alloc (points.length + num_points + 4); // Allocate for phantom points, to avoid a possible copy diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf.hh index 3fe2506bec90..9f5f267f96af 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf.hh @@ -121,7 +121,7 @@ struct glyf if (!use_short_loca) { - padded_offsets.resize (0); + padded_offsets.clear (); for (auto &g : glyphs) padded_offsets.push (g.length ()); } @@ -226,7 +226,7 @@ struct glyf_accelerator_t if (gid >= num_glyphs) return false; auto &all_points = scratch.all_points; - all_points.resize (0); + all_points.clear (); bool phantom_only = !consumer.is_consuming_contour_points (); if (unlikely (!glyph_for_gid (gid).get_points (font, *this, all_points, scratch, nullptr, nullptr, nullptr, true, true, phantom_only, coords, gvar_cache))) diff --git a/src/java.desktop/share/native/libharfbuzz/OT/name/name.hh b/src/java.desktop/share/native/libharfbuzz/OT/name/name.hh index b440379afbe6..50ec34d542aa 100644 --- a/src/java.desktop/share/native/libharfbuzz/OT/name/name.hh +++ b/src/java.desktop/share/native/libharfbuzz/OT/name/name.hh @@ -312,7 +312,7 @@ struct name { static constexpr hb_tag_t tableTag = HB_OT_TAG_name; - unsigned int get_size () const + size_t get_size () const { return min_size + count * nameRecordZ.item_size; } template { bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; constexpr unsigned min_size = OT::ClassDefFormat1_3::min_size; if (vertex_len < min_size) return false; hb_barrier (); @@ -48,7 +48,7 @@ struct ClassDefFormat2 : public OT::ClassDefFormat2_4 { bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; constexpr unsigned min_size = OT::ClassDefFormat2_4::min_size; if (vertex_len < min_size) return false; hb_barrier (); @@ -114,7 +114,7 @@ struct ClassDef : public OT::ClassDef bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; if (vertex_len < OT::ClassDef::min_size) return false; hb_barrier (); switch (u.format.v) diff --git a/src/java.desktop/share/native/libharfbuzz/graph/coverage-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/coverage-graph.hh index 46c703524d98..5778ee9e1d35 100644 --- a/src/java.desktop/share/native/libharfbuzz/graph/coverage-graph.hh +++ b/src/java.desktop/share/native/libharfbuzz/graph/coverage-graph.hh @@ -36,7 +36,7 @@ static bool sanitize ( const OT::Layout::Common::CoverageFormat1_3* thiz, graph_t::vertex_t& vertex ) { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; constexpr unsigned min_size = OT::Layout::Common::CoverageFormat1_3::min_size; if (vertex_len < min_size) return false; hb_barrier (); @@ -47,7 +47,7 @@ static bool sanitize ( const OT::Layout::Common::CoverageFormat2_4* thiz, graph_t::vertex_t& vertex ) { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; constexpr unsigned min_size = OT::Layout::Common::CoverageFormat2_4::min_size; if (vertex_len < min_size) return false; hb_barrier (); @@ -158,7 +158,7 @@ struct Coverage : public OT::Layout::Common::Coverage bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; if (vertex_len < OT::Layout::Common::Coverage::min_size) return false; hb_barrier (); switch (u.format.v) diff --git a/src/java.desktop/share/native/libharfbuzz/graph/graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/graph.hh index 78ae1a9dd5be..9ca7434ca197 100644 --- a/src/java.desktop/share/native/libharfbuzz/graph/graph.hh +++ b/src/java.desktop/share/native/libharfbuzz/graph/graph.hh @@ -814,6 +814,11 @@ struct graph_t if (unlikely (!check_success (!connected_roots.in_error ()))) break; unsigned next_space = this->next_space (); + if (next_space >= HB_REPACKER_MAX_SPACES) + { + check_success (false); + break; + } num_roots_for_space_.push (0); for (unsigned root : connected_roots) { @@ -1062,6 +1067,12 @@ struct graph_t */ unsigned duplicate (unsigned node_idx) { + if (vertices_.length >= HB_REPACKER_MAX_VERTICES) + { + check_success (false); + return -1; + } + positions_invalid = true; distance_invalid = true; @@ -1221,6 +1232,12 @@ struct graph_t */ unsigned new_node (char* head, char* tail) { + if (vertices_.length >= HB_REPACKER_MAX_VERTICES) + { + check_success (false); + return -1; + } + positions_invalid = true; distance_invalid = true; @@ -1384,6 +1401,11 @@ struct graph_t void move_to_new_space (const hb_set_t& indices) { + if (num_roots_for_space_.length >= HB_REPACKER_MAX_SPACES) + { + check_success (false); + return; + } num_roots_for_space_.push (0); unsigned new_space = num_roots_for_space_.length - 1; diff --git a/src/java.desktop/share/native/libharfbuzz/graph/gsubgpos-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/gsubgpos-graph.hh index ea6bcd239a03..73f4b15660ff 100644 --- a/src/java.desktop/share/native/libharfbuzz/graph/gsubgpos-graph.hh +++ b/src/java.desktop/share/native/libharfbuzz/graph/gsubgpos-graph.hh @@ -52,7 +52,7 @@ struct ExtensionFormat1 : public OT::ExtensionFormat1 bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; return vertex_len >= OT::ExtensionFormat1::static_size; } @@ -76,7 +76,7 @@ struct Lookup : public OT::Lookup bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; if (vertex_len < OT::Lookup::min_size) return false; hb_barrier (); return vertex_len >= this->get_size (); @@ -390,7 +390,7 @@ struct LookupList : public OT::LookupList { bool sanitize (const graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; if (vertex_len < OT::LookupList::min_size) return false; hb_barrier (); return vertex_len >= OT::LookupList::item_size * this->len; @@ -424,7 +424,7 @@ struct GSTAR : public OT::GSUBGPOS bool sanitize (const graph_t::vertex_t& vertex) { - int64_t len = vertex.obj.tail - vertex.obj.head; + size_t len = vertex.obj.tail - vertex.obj.head; if (len < OT::GSUBGPOS::min_size) return false; hb_barrier (); return len >= get_size (); diff --git a/src/java.desktop/share/native/libharfbuzz/graph/markbasepos-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/markbasepos-graph.hh index 6d1a3d4ae4b0..a653f402ab1c 100644 --- a/src/java.desktop/share/native/libharfbuzz/graph/markbasepos-graph.hh +++ b/src/java.desktop/share/native/libharfbuzz/graph/markbasepos-graph.hh @@ -38,7 +38,7 @@ struct AnchorMatrix : public OT::Layout::GPOS_impl::AnchorMatrix { bool sanitize (graph_t::vertex_t& vertex, unsigned class_count) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; if (vertex_len < AnchorMatrix::min_size) return false; hb_barrier (); @@ -126,7 +126,7 @@ struct MarkArray : public OT::Layout::GPOS_impl::MarkArray { bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; unsigned min_size = MarkArray::min_size; if (vertex_len < min_size) return false; hb_barrier (); @@ -207,7 +207,7 @@ struct MarkBasePosFormat1 : public OT::Layout::GPOS_impl::MarkBasePosFormat1_2= MarkBasePosFormat1::static_size; } @@ -430,7 +430,6 @@ struct MarkBasePosFormat1 : public OT::Layout::GPOS_impl::MarkBasePosFormat1_2baseCoverage), prime_id, base_coverage_id); - graph.duplicate (prime_id, base_coverage_id); auto mark_coverage = sc.c.graph.as_table (this_index, &markCoverage); @@ -493,7 +492,7 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; if (vertex_len < u.format.v.get_size ()) return false; hb_barrier (); diff --git a/src/java.desktop/share/native/libharfbuzz/graph/pairpos-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/pairpos-graph.hh index 85950b63457c..7c3b048195d8 100644 --- a/src/java.desktop/share/native/libharfbuzz/graph/pairpos-graph.hh +++ b/src/java.desktop/share/native/libharfbuzz/graph/pairpos-graph.hh @@ -39,7 +39,7 @@ struct PairPosFormat1 : public OT::Layout::GPOS_impl::PairPosFormat1_3::min_size; if (vertex_len < min_size) return false; hb_barrier (); @@ -422,7 +422,6 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4objidx = class_def_2_id; class_def_link->position = 10; graph.vertices_[class_def_2_id].add_parent (pair_pos_prime_id, false); - graph.duplicate (pair_pos_prime_id, class_def_2_id); return pair_pos_prime_id; } @@ -624,7 +623,7 @@ struct PairPos : public OT::Layout::GPOS_impl::PairPos bool sanitize (graph_t::vertex_t& vertex) const { - int64_t vertex_len = vertex.obj.tail - vertex.obj.head; + size_t vertex_len = vertex.obj.tail - vertex.obj.head; if (vertex_len < u.format.v.get_size ()) return false; hb_barrier (); diff --git a/src/java.desktop/share/native/libharfbuzz/graph/serialize.hh b/src/java.desktop/share/native/libharfbuzz/graph/serialize.hh index 37fac8909e50..4f89f1011d80 100644 --- a/src/java.desktop/share/native/libharfbuzz/graph/serialize.hh +++ b/src/java.desktop/share/native/libharfbuzz/graph/serialize.hh @@ -108,7 +108,7 @@ inline bool will_overflow (graph_t& graph, hb_vector_t* overflows = nullptr) { - if (overflows) overflows->resize (0); + if (overflows) overflows->clear (); graph.update_positions (); hb_hashmap_t record_set; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh index 2a6b813972fd..1186cad41f81 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh @@ -861,7 +861,7 @@ struct KerxSubTable { friend struct kerx; - unsigned int get_size () const { return u.header.length; } + size_t get_size () const { return u.header.length; } unsigned int get_type () const { return u.header.coverage & u.header.SubtableType; } template diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh index 2cbb86c75668..fef21450b27d 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh @@ -987,9 +987,16 @@ struct hb_aat_layout_chain_accelerator_t { unsigned count = chain.get_subtable_count (); - unsigned size = sizeof (hb_aat_layout_chain_accelerator_t) - - HB_VAR_ARRAY * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t) + - count * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t); + unsigned product; + if (unlikely (hb_unsigned_mul_overflows (count, + sizeof (hb_accelerate_subtables_context_t::hb_applicable_t), &product))) + return nullptr; + + unsigned size; + if (unlikely (hb_unsigned_add_overflows (sizeof (hb_aat_layout_chain_accelerator_t) - + HB_VAR_ARRAY * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t), product, &size))) { + return nullptr; + } /* The following is a calloc because when we are collecting subtables, * some of them might be invalid and hence not collect; as a result, @@ -1026,7 +1033,7 @@ struct ChainSubtable template friend struct Chain; - unsigned int get_size () const { return length; } + size_t get_size () const { return length; } unsigned int get_type () const { return coverage & 0xFF; } unsigned int get_coverage () const { return coverage >> (sizeof (HBUINT) * 8 - 8); } @@ -1236,7 +1243,7 @@ struct Chain c->reverse_buffer (); } - unsigned int get_size () const { return length; } + size_t get_size () const { return length; } template typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const diff --git a/src/java.desktop/share/native/libharfbuzz/hb-algs.hh b/src/java.desktop/share/native/libharfbuzz/hb-algs.hh index 651ffcda01de..05053b1f8581 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-algs.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-algs.hh @@ -89,7 +89,16 @@ static inline constexpr uint32_t hb_uint32_swap (uint32_t v) { return (hb_uint16_swap (v) << 16) | hb_uint16_swap (v >> 16); } template -struct __attribute__((packed)) hb_packed_t { Type v; }; +struct __attribute__((packed)) hb_packed_t +{ + hb_packed_t () = default; + constexpr hb_packed_t (Type V) : v (V) {} + operator Type () const { return v; } + hb_packed_t & operator = (Type V) { v = V; return *this; } + + private: + Type v; +}; #ifndef HB_FAST_NUM_ACCESS @@ -134,9 +143,9 @@ struct HBInt #if HB_FAST_NUM_ACCESS { if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) - ((hb_packed_t *) v)->v = V; + *((hb_packed_t *) v) = V; else - ((hb_packed_t *) v)->v = __builtin_bswap16 (V); + *((hb_packed_t *) v) = __builtin_bswap16 (V); } #else : v {BE ? uint8_t ((V >> 8) & 0xFF) : uint8_t ((V ) & 0xFF), @@ -147,9 +156,9 @@ struct HBInt { #if HB_FAST_NUM_ACCESS return (BE == (__BYTE_ORDER == __BIG_ENDIAN)) ? - ((const hb_packed_t *) v)->v + (uint16_t) *((const hb_packed_t *) v) : - __builtin_bswap16 (((const hb_packed_t *) v)->v) + __builtin_bswap16 ((uint16_t) *((const hb_packed_t *) v)) ; #else return (BE ? (v[0] << 8) : (v[0] )) @@ -186,9 +195,9 @@ struct HBInt #if HB_FAST_NUM_ACCESS { if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) - ((hb_packed_t *) v)->v = V; + *((hb_packed_t *) v) = V; else - ((hb_packed_t *) v)->v = __builtin_bswap32 (V); + *((hb_packed_t *) v) = __builtin_bswap32 (V); } #else : v {BE ? uint8_t ((V >> 24) & 0xFF) : uint8_t ((V ) & 0xFF), @@ -200,9 +209,9 @@ struct HBInt constexpr operator Type () const { #if HB_FAST_NUM_ACCESS return (BE == (__BYTE_ORDER == __BIG_ENDIAN)) ? - ((const hb_packed_t *) v)->v + (uint32_t) *((const hb_packed_t *) v) : - __builtin_bswap32 (((const hb_packed_t *) v)->v) + __builtin_bswap32 ((uint32_t) *((const hb_packed_t *) v)) ; #else return (BE ? (v[0] << 24) : (v[0] )) @@ -226,9 +235,9 @@ struct HBInt #if HB_FAST_NUM_ACCESS { if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) - ((hb_packed_t *) v)->v = V; + *((hb_packed_t *) v) = V; else - ((hb_packed_t *) v)->v = __builtin_bswap64 (V); + *((hb_packed_t *) v) = __builtin_bswap64 (V); } #else : v {BE ? uint8_t ((V >> 56) & 0xFF) : uint8_t ((V ) & 0xFF), @@ -244,9 +253,9 @@ struct HBInt constexpr operator Type () const { #if HB_FAST_NUM_ACCESS return (BE == (__BYTE_ORDER == __BIG_ENDIAN)) ? - ((const hb_packed_t *) v)->v + (uint64_t) *((const hb_packed_t *) v) : - __builtin_bswap64 (((const hb_packed_t *) v)->v) + __builtin_bswap64 ((uint64_t) *((const hb_packed_t *) v)) ; #else return (BE ? (uint64_t (v[0]) << 56) : (uint64_t (v[0]) )) @@ -276,12 +285,12 @@ struct HBFloat { #if HB_FAST_NUM_ACCESS { - if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) - { - ((hb_packed_t *) v)->v = V; - return; - } - } + if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) + { + *((hb_packed_t *) v) = V; + return; + } + } #endif union { @@ -289,7 +298,7 @@ struct HBFloat hb_packed_t i; } u = {{V}}; - const HBInt I = u.i.v; + const HBInt I = (IntType) u.i; for (unsigned i = 0; i < Bytes; i++) v[i] = I.v[i]; } @@ -297,10 +306,10 @@ struct HBFloat /* c++14 constexpr */ operator Type () const { #if HB_FAST_NUM_ACCESS - { - if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) - return ((const hb_packed_t *) v)->v; - } + { + if (BE == (__BYTE_ORDER == __BIG_ENDIAN)) + return (Type) *((const hb_packed_t *) v); + } #endif HBInt I; @@ -312,7 +321,7 @@ struct HBFloat hb_packed_t f; } u = {{I}}; - return u.f.v; + return (Type) u.f; } private: uint8_t v[Bytes]; }; @@ -1191,6 +1200,21 @@ hb_unsigned_mul_overflows (unsigned int count, unsigned int size, unsigned *resu return (size > 0) && (count >= ((unsigned int) -1) / size); } +static inline bool +hb_unsigned_add_overflows (unsigned int a, unsigned int b, unsigned *result = nullptr) +{ +#if hb_has_builtin(__builtin_add_overflow) + unsigned stack_result; + if (!result) + result = &stack_result; + return __builtin_add_overflow (a, b, result); +#endif + + if (result) + *result = a + b; + return b > (unsigned int) -1 - a; +} + /* * Sort and search. @@ -1315,15 +1339,12 @@ static inline void sort_r_swap(char *__restrict a, char *__restrict b, /* swap a, b iff a>b */ /* a and b must not be equal! */ /* __restrict is same as restrict but better support on old machines */ -template +template static inline int sort_r_cmpswap(char *__restrict a, char *__restrict b, size_t w, - int (*compar)(const void *_a, - const void *_b, - Ts... _ds), - Ts... ds) + Compar compar) { - if(compar(a, b, ds...) > 0) { + if(compar(a, b) > 0) { sort_r_swap(a, b, w); return 1; } @@ -1348,23 +1369,17 @@ static inline void sort_r_swap_blocks(char *ptr, size_t na, size_t nb) /* Implement recursive quicksort ourselves */ /* Note: quicksort is not stable, equivalent values may be swapped */ -template +template static inline void sort_r_simple(void *base, size_t nel, size_t w, - int (*compar)(const void *_a, - const void *_b, - Ts... _ds), - Ts... ds) + Compar compar) { char *b = (char *)base, *end = b + nel*w; - /* for(size_t i=0; i b && sort_r_cmpswap(pj-w,pj,w,compar,ds...); pj -= w) {} + for(pj = pi; pj > b && sort_r_cmpswap(pj-w,pj,w,compar); pj -= w) {} } } else @@ -1375,68 +1390,36 @@ static inline void sort_r_simple(void *base, size_t nel, size_t w, char *pl, *ple, *pr, *pre, *pivot; char *last = b+w*(nel-1), *tmp; - /* - Use median of second, middle and second-last items as pivot. - First and last may have been swapped with pivot and therefore be extreme - */ char *l[3]; l[0] = b + w; l[1] = b+w*(nel/2); l[2] = last - w; - /* printf("pivots: %i, %i, %i\n", *(int*)l[0], *(int*)l[1], *(int*)l[2]); */ - - if(compar(l[0],l[1],ds...) > 0) { SORT_R_SWAP(l[0], l[1], tmp); } - if(compar(l[1],l[2],ds...) > 0) { + if(compar(l[0],l[1]) > 0) { SORT_R_SWAP(l[0], l[1], tmp); } + if(compar(l[1],l[2]) > 0) { SORT_R_SWAP(l[1], l[2], tmp); - if(compar(l[0],l[1],ds...) > 0) { SORT_R_SWAP(l[0], l[1], tmp); } + if(compar(l[0],l[1]) > 0) { SORT_R_SWAP(l[0], l[1], tmp); } } - /* swap mid value (l[1]), and last element to put pivot as last element */ if(l[1] != last) { sort_r_swap(l[1], last, w); } - /* - pl is the next item on the left to be compared to the pivot - pr is the last item on the right that was compared to the pivot - ple is the left position to put the next item that equals the pivot - ple is the last right position where we put an item that equals the pivot - v- end (beyond the array) - EEEEEELLLLLLLLuuuuuuuuGGGGGGGEEEEEEEE. - ^- b ^- ple ^- pl ^- pr ^- pre ^- last (where the pivot is) - Pivot comparison key: - E = equal, L = less than, u = unknown, G = greater than, E = equal - */ pivot = last; ple = pl = b; pre = pr = last; - /* - Strategy: - Loop into the list from the left and right at the same time to find: - - an item on the left that is greater than the pivot - - an item on the right that is less than the pivot - Once found, they are swapped and the loop continues. - Meanwhile items that are equal to the pivot are moved to the edges of the - array. - */ while(pl < pr) { - /* Move left hand items which are equal to the pivot to the far left. - break when we find an item that is greater than the pivot */ for(; pl < pr; pl += w) { - cmp = compar(pl, pivot, ds...); + cmp = compar(pl, pivot); if(cmp > 0) { break; } else if(cmp == 0) { if(ple < pl) { sort_r_swap(ple, pl, w); } ple += w; } } - /* break if last batch of left hand items were equal to pivot */ if(pl >= pr) { break; } - /* Move right hand items which are equal to the pivot to the far right. - break when we find an item that is less than the pivot */ for(; pl < pr; ) { - pr -= w; /* Move right pointer onto an unprocessed item */ - cmp = compar(pr, pivot, ds...); + pr -= w; + cmp = compar(pr, pivot); if(cmp == 0) { pre -= w; if(pr < pre) { sort_r_swap(pr, pre, w); } @@ -1449,22 +1432,13 @@ static inline void sort_r_simple(void *base, size_t nel, size_t w, } } - pl = pr; /* pr may have gone below pl */ + pl = pr; - /* - Now we need to go from: EEELLLGGGGEEEE - to: LLLEEEEEEEGGGG - Pivot comparison key: - E = equal, L = less than, u = unknown, G = greater than, E = equal - */ sort_r_swap_blocks(b, ple-b, pl-ple); sort_r_swap_blocks(pr, pre-pr, end-pre); - /*for(size_t i=0; i static inline void @@ -1664,6 +1624,13 @@ double solve_itp (func_t f, double min_y, double max_y, double &ya, double &yb, double &y) { + // Guard against degenerate interval + if (b - a <= 0.0) + { + y = ya; + return a; + } + unsigned n1_2 = (unsigned) (hb_max (ceil (log2 ((b - a) / epsilon)) - 1.0, 0.0)); const unsigned n0 = 1; // Hardwired const double k1 = 0.2 / (b - a); // Hardwired. @@ -1674,7 +1641,8 @@ double solve_itp (func_t f, { double x1_2 = 0.5 * (a + b); double r = scaled_epsilon - 0.5 * (b - a); - double xf = (yb * a - ya * b) / (yb - ya); + // Guard against yb == ya to prevent division by zero + double xf = (yb != ya) ? (yb * a - ya * b) / (yb - ya) : x1_2; double sigma = x1_2 - xf; double b_a = b - a; // This has k2 = 2 hardwired for efficiency. @@ -1705,4 +1673,51 @@ double solve_itp (func_t f, } +/* + * Scope guard: runs a callable at scope exit (RAII cleanup for + * non-HB-type resources — raw malloc'd buffers, paired init/end + * calls like inflateInit/inflateEnd, FT_Done_* handles, etc.). + * + * Prefer hb_unique_ptr_t etc. for HB types; this is + * for the long tail of cleanup that those wrappers don't cover. + * + * Usage: + * void *buf = hb_malloc (len); + * if (!buf) return false; + * HB_SCOPE_GUARD (hb_free (buf)); + * ... multiple fallible operations ... + * return true; // buf freed automatically on any return path + */ +template +struct hb_scope_guard_t +{ + explicit hb_scope_guard_t (F &&f) : f (std::move (f)), active (true) {} + hb_scope_guard_t (hb_scope_guard_t &&o) noexcept + : f (std::move (o.f)), active (o.active) { o.active = false; } + hb_scope_guard_t (const hb_scope_guard_t &) = delete; + hb_scope_guard_t &operator= (const hb_scope_guard_t &) = delete; + hb_scope_guard_t &operator= (hb_scope_guard_t &&) = delete; + ~hb_scope_guard_t () { if (active) f (); } + + /* Release: dismiss the guard so the cleanup does NOT run. Use + * when transferring ownership out of the scope. */ + void release () { active = false; } + + private: + F f; + bool active; +}; + +template +static inline hb_scope_guard_t hb_make_scope_guard (F &&f) +{ return hb_scope_guard_t (std::forward (f)); } + +#define HB_SCOPE_GUARD_NAME_(line) hb_scope_guard_##line +#define HB_SCOPE_GUARD_NAME(line) HB_SCOPE_GUARD_NAME_(line) +#define HB_SCOPE_GUARD(stmt) \ + auto HB_SCOPE_GUARD_NAME(__LINE__) = \ + hb_make_scope_guard ([&]() { stmt; }); \ + (void) HB_SCOPE_GUARD_NAME(__LINE__) + + #endif /* HB_ALGS_HH */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-array.hh b/src/java.desktop/share/native/libharfbuzz/hb-array.hh index 71d3bcdf1eac..dd3369307ef8 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-array.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-array.hh @@ -32,6 +32,8 @@ #include "hb-iter.hh" #include "hb-null.hh" +#include + template struct hb_sorted_array_t; @@ -219,26 +221,54 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&> return false; } - hb_sorted_array_t qsort (int (*cmp_)(const void*, const void*)) + hb_sorted_array_t qsort (int (*cmp)(const void*, const void*)) { - //static_assert (hb_enable_if (hb_is_trivially_copy_assignable(Type)), ""); if (likely (length)) - hb_qsort (arrayZ, length, this->get_item_size (), cmp_); + hb_qsort (arrayZ, length, this->get_item_size (), cmp); return hb_sorted_array_t (*this); } - hb_sorted_array_t qsort () + /* std::sort wants a strict-weak `a < b` boolean, but our other + * qsort overload (and most existing call sites) follow the C + * qsort convention of returning negative / zero / positive ints. + * Adapt to either via overload resolution: bool passes through; + * any other arithmetic return type is treated as the int signed + * comparator. */ + template static bool _qsort_lt (T v) { return v < 0; } + static bool _qsort_lt (bool v) { return v; } + + template + hb_sorted_array_t qsort (Compar compar) { - //static_assert (hb_enable_if (hb_is_trivially_copy_assignable(Type)), ""); if (likely (length)) - hb_qsort (arrayZ, length, this->get_item_size (), Type::cmp); + std::sort (arrayZ, arrayZ + length, + [&] (const Type &a, const Type &b) + { return _qsort_lt (compar (a, b)); }); return hb_sorted_array_t (*this); } + private: + template ::value)> + hb_sorted_array_t _qsort (hb_priority<1>) + { + return qsort ([] (const Type &a, const Type &b) { return Type::cmp (&a, &b) < 0; }); + } + hb_sorted_array_t _qsort (hb_priority<0>) + { + return qsort ((int(*)(const void*, const void*)) Type::cmp); + } + public: + + hb_sorted_array_t qsort () + { + return _qsort (hb_prioritize); + } + /* * Other methods. */ - unsigned int get_size () const { return length * this->get_item_size (); } + size_t get_size () const { return length * this->get_item_size (); } /* * Reverse the order of items in this array in the range [start, end). diff --git a/src/java.desktop/share/native/libharfbuzz/hb-atomic.hh b/src/java.desktop/share/native/libharfbuzz/hb-atomic.hh index 05aaf5a155e7..f95a30794755 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-atomic.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-atomic.hh @@ -193,6 +193,9 @@ struct hb_atomic_t T *get_acquire () const { return v.load (std::memory_order_acquire); } bool cmpexch (T *old, T *new_) { return v.compare_exchange_weak (old, new_, std::memory_order_acq_rel, std::memory_order_relaxed); } + hb_atomic_t &operator= (const hb_atomic_t& o) { set_relaxed (o.get_relaxed ()); return *this; } + hb_atomic_t &operator= (hb_atomic_t&& o){ set_relaxed (o.get_relaxed ()); o.set_relaxed ({}); return *this; } + operator bool () const { return get_acquire () != nullptr; } T *operator->() const { return get_acquire (); } template diff --git a/src/java.desktop/share/native/libharfbuzz/hb-bimap.hh b/src/java.desktop/share/native/libharfbuzz/hb-bimap.hh index f9c0e8870ff4..35aa9aa4e793 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-bimap.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-bimap.hh @@ -115,7 +115,7 @@ struct hb_inc_bimap_t void clear () { forw_map.clear (); - back_map.resize (0); + back_map.clear (); } /* Add a mapping from lhs to rhs with a unique value if lhs is unknown. diff --git a/src/java.desktop/share/native/libharfbuzz/hb-bit-set-invertible.hh b/src/java.desktop/share/native/libharfbuzz/hb-bit-set-invertible.hh index 4028dd635311..2c97f416fe60 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-bit-set-invertible.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-bit-set-invertible.hh @@ -173,7 +173,14 @@ struct hb_bit_set_invertible_t bool is_subset (const hb_bit_set_invertible_t &larger_set) const { if (unlikely (inverted != larger_set.inverted)) - return hb_all (hb_iter (s) | hb_map (larger_set.s)); + { + if (inverted) + return hb_all (iter (), larger_set.s); + else + // larger set is inverted so larger_set.s is the set of things that are not present + // in larger_set, therefore if s has any of those it can't be a subset. + return !s.intersects (larger_set.s); + } else return unlikely (inverted) ? larger_set.s.is_subset (s) : s.is_subset (larger_set.s); } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-bit-set.hh b/src/java.desktop/share/native/libharfbuzz/hb-bit-set.hh index f86d5750854f..9e29d2af323c 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-bit-set.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-bit-set.hh @@ -117,9 +117,15 @@ struct hb_bit_set_t void clear () { - resize (0); - if (likely (successful)) - population = 0; + /* Early-out on already-empty. Protects the Null singleton + * (which is zero-initialized) from any writes. Any non-empty + * instance is a real heap object with writable storage, so + * clearing through the vector's always-safe clear() is fine + * even if we entered error state. */ + if (!pages.length && !population) return; + pages.clear (); + page_map.clear (); + population = 0; } bool is_empty () const { @@ -438,23 +444,31 @@ struct hb_bit_set_t return false; uint32_t spi = 0; - for (uint32_t lpi = 0; spi < page_map.length && lpi < larger_set.page_map.length; lpi++) + uint32_t lpi = 0; + while (spi < page_map.length && lpi < larger_set.page_map.length) { uint32_t spm = page_map.arrayZ[spi].major; uint32_t lpm = larger_set.page_map.arrayZ[lpi].major; auto sp = page_at (spi); - if (spm < lpm && !sp.is_empty ()) - return false; + if (spm < lpm) { + if (!sp.is_empty ()) + return false; + spi++; + continue; + } - if (lpm < spm) + if (lpm < spm) { + lpi++; continue; + } auto lp = larger_set.page_at (lpi); if (!sp.is_subset (lp)) return false; spi++; + lpi++; } while (spi < page_map.length) diff --git a/src/java.desktop/share/native/libharfbuzz/hb-blob.cc b/src/java.desktop/share/native/libharfbuzz/hb-blob.cc index a19599fac09a..e60259f52da1 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-blob.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-blob.cc @@ -615,36 +615,20 @@ hb_blob_create_from_file (const char *file_name) return likely (blob) ? blob : hb_blob_get_empty (); } -/** - * hb_blob_create_from_file_or_fail: - * @file_name: A filename - * - * Creates a new blob containing the data from the specified file. - * - * The filename is passed directly to the system on all platforms, - * except on Windows, where the filename is interpreted as UTF-8. - * Only if the filename is not valid UTF-8, it will be interpreted - * according to the system codepage. - * - * Returns: An #hb_blob_t pointer with the content of the file, - * or `NULL` if failed. - * - * Since: 2.8.2 - **/ -hb_blob_t * -hb_blob_create_from_file_or_fail (const char *file_name) -{ - /* Adopted from glib's gmappedfile.c with Matthias Clasen and - Allison Lortie permission but changed a lot to suit our need. */ #if defined(HAVE_MMAP) && !defined(HB_NO_MMAP) +static hb_blob_t * +_hb_blob_try_mmap (const char *file_name) +{ hb_mapped_file_t *file = (hb_mapped_file_t *) hb_calloc (1, sizeof (hb_mapped_file_t)); if (unlikely (!file)) return nullptr; + auto file_guard = hb_make_scope_guard ([&]() { hb_free (file); }); int fd = open (file_name, O_RDONLY | O_BINARY, 0); - if (unlikely (fd == -1)) goto fail_without_close; + if (unlikely (fd == -1)) return nullptr; + auto fd_guard = hb_make_scope_guard ([&]() { close (fd); }); struct stat st; - if (unlikely (fstat (fd, &st) == -1)) goto fail; + if (unlikely (fstat (fd, &st) == -1)) return nullptr; file->length = (unsigned long) st.st_size; @@ -662,38 +646,36 @@ hb_blob_create_from_file_or_fail (const char *file_name) file->contents = (char *) mmap (nullptr, file->length, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, fd, 0); + if (unlikely (file->contents == MAP_FAILED)) return nullptr; - if (unlikely (file->contents == MAP_FAILED)) goto fail; - - close (fd); - + file_guard.release (); + /* fd_guard closes fd on return (ownership ends after mmap). */ return hb_blob_create_or_fail (file->contents, file->length, HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE, (void *) file, (hb_destroy_func_t) _hb_mapped_file_destroy); - -fail: - close (fd); -fail_without_close: - hb_free (file); - +} #elif defined(_WIN32) && !defined(HB_NO_MMAP) +static hb_blob_t * +_hb_blob_try_mmap (const char *file_name) +{ hb_mapped_file_t *file = (hb_mapped_file_t *) hb_calloc (1, sizeof (hb_mapped_file_t)); if (unlikely (!file)) return nullptr; + auto file_guard = hb_make_scope_guard ([&]() { hb_free (file); }); - HANDLE fd; - int conversion; unsigned int size = strlen (file_name) + 1; - wchar_t * wchar_file_name = (wchar_t *) hb_malloc (sizeof (wchar_t) * size); - if (unlikely (!wchar_file_name)) goto fail_without_close; + wchar_t *wchar_file_name = (wchar_t *) hb_malloc (sizeof (wchar_t) * size); + if (unlikely (!wchar_file_name)) return nullptr; /* Assume file name is given in UTF-8 encoding */ - conversion = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, file_name, -1, wchar_file_name, size); + int conversion = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS, file_name, -1, wchar_file_name, size); if (conversion <= 0) { /* Conversion failed due to invalid UTF-8 characters, Repeat conversion based on system code page */ - mbstowcs(wchar_file_name, file_name, size); + mbstowcs (wchar_file_name, file_name, size); } + + HANDLE fd; #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) { CREATEFILE2_EXTENDED_PARAMETERS ceparams = { 0 }; @@ -713,7 +695,8 @@ hb_blob_create_from_file_or_fail (const char *file_name) #endif hb_free (wchar_file_name); - if (unlikely (fd == INVALID_HANDLE_VALUE)) goto fail_without_close; + if (unlikely (fd == INVALID_HANDLE_VALUE)) return nullptr; + auto fd_guard = hb_make_scope_guard ([&]() { CloseHandle (fd); }); #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) { @@ -726,35 +709,36 @@ hb_blob_create_from_file_or_fail (const char *file_name) file->length = (unsigned long) GetFileSize (fd, nullptr); file->mapping = CreateFileMapping (fd, nullptr, PAGE_READONLY, 0, 0, nullptr); #endif - if (unlikely (!file->mapping)) goto fail; + if (unlikely (!file->mapping)) return nullptr; #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) file->contents = (char *) MapViewOfFileFromApp (file->mapping, FILE_MAP_READ, 0, 0); #else file->contents = (char *) MapViewOfFile (file->mapping, FILE_MAP_READ, 0, 0, 0); #endif - if (unlikely (!file->contents)) goto fail; + if (unlikely (!file->contents)) return nullptr; - CloseHandle (fd); + file_guard.release (); + /* fd_guard closes fd on return. */ return hb_blob_create_or_fail (file->contents, file->length, HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE, (void *) file, (hb_destroy_func_t) _hb_mapped_file_destroy); - -fail: - CloseHandle (fd); -fail_without_close: - hb_free (file); - +} #endif - /* The following tries to read a file without knowing its size beforehand - It's used as a fallback for systems without mmap or to read from pipes */ +/* Read a file without knowing its size beforehand. Used as a fallback + * for systems without mmap or to read from pipes. */ +static hb_blob_t * +_hb_blob_read_file (const char *file_name) +{ unsigned long len = 0, allocated = BUFSIZ * 16; char *data = (char *) hb_malloc (allocated); if (unlikely (!data)) return nullptr; + auto data_guard = hb_make_scope_guard ([&]() { hb_free (data); }); FILE *fp = fopen (file_name, "rb"); - if (unlikely (!fp)) goto fread_fail_without_close; + if (unlikely (!fp)) return nullptr; + HB_SCOPE_GUARD (fclose (fp)); while (!feof (fp)) { @@ -763,9 +747,9 @@ hb_blob_create_from_file_or_fail (const char *file_name) allocated *= 2; /* Don't allocate and go more than ~536MB, our mmap reader still can cover files like that but lets limit our fallback reader */ - if (unlikely (allocated > (2 << 28))) goto fread_fail; + if (unlikely (allocated > (2 << 28))) return nullptr; char *new_data = (char *) hb_realloc (data, allocated); - if (unlikely (!new_data)) goto fread_fail; + if (unlikely (!new_data)) return nullptr; data = new_data; } @@ -775,19 +759,41 @@ hb_blob_create_from_file_or_fail (const char *file_name) #ifdef EINTR // armcc doesn't have it if (unlikely (err == EINTR)) continue; #endif - if (unlikely (err)) goto fread_fail; + if (unlikely (err)) return nullptr; len += addition; } - fclose (fp); + data_guard.release (); return hb_blob_create_or_fail (data, len, HB_MEMORY_MODE_WRITABLE, data, (hb_destroy_func_t) hb_free); +} -fread_fail: - fclose (fp); -fread_fail_without_close: - hb_free (data); - return nullptr; +/** + * hb_blob_create_from_file_or_fail: + * @file_name: A filename + * + * Creates a new blob containing the data from the specified file. + * + * The filename is passed directly to the system on all platforms, + * except on Windows, where the filename is interpreted as UTF-8. + * Only if the filename is not valid UTF-8, it will be interpreted + * according to the system codepage. + * + * Returns: An #hb_blob_t pointer with the content of the file, + * or `NULL` if failed. + * + * Since: 2.8.2 + **/ +hb_blob_t * +hb_blob_create_from_file_or_fail (const char *file_name) +{ + /* Adopted from glib's gmappedfile.c with Matthias Clasen and + Allison Lortie permission but changed a lot to suit our need. */ +#if (defined(HAVE_MMAP) || defined(_WIN32)) && !defined(HB_NO_MMAP) + if (hb_blob_t *blob = _hb_blob_try_mmap (file_name)) + return blob; +#endif + return _hb_blob_read_file (file_name); } #endif /* !HB_NO_OPEN */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-blob.hh b/src/java.desktop/share/native/libharfbuzz/hb-blob.hh index b1b3b94d3ddc..1703efa92b1e 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-blob.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-blob.hh @@ -50,6 +50,21 @@ struct hb_blob_t } } + void replace_buffer (const char *new_data, + unsigned new_length, + hb_memory_mode_t new_mode, + void *new_user_data, + hb_destroy_func_t new_destroy) + { + if (new_data != data) + destroy_user_data (); + data = new_data; + length = new_length; + mode = new_mode; + user_data = new_user_data; + destroy = new_destroy; + } + HB_INTERNAL bool try_make_writable (); HB_INTERNAL bool try_make_writable_inplace (); HB_INTERNAL bool try_make_writable_inplace_unix (); @@ -67,6 +82,149 @@ struct hb_blob_t void *user_data = nullptr; hb_destroy_func_t destroy = nullptr; + + /* + * Blob-recycling helpers. + * + * Encoders that produce a sized byte buffer and wrap it as an + * hb_blob_t can amortize malloc/blob-allocation across repeated + * renders by handing the output blob back via a recycle slot. On + * the next encode these helpers reuse (or realloc) the buffer and + * the same hb_blob_t handle is returned, skipping malloc/free + * and blob-handle churn across glyph-by-glyph encoding loops. + * + * Blobs managed by this machinery are identified by the address + * of recycle_data_destroy. + */ + + struct recycle_data_t + { + char *buf; + unsigned capacity; + }; + + static inline void recycle_data_destroy (void *user_data) + { + auto *bd = (recycle_data_t *) user_data; + hb_free (bd->buf); + hb_free (bd); + } + + /* Acquire a buffer of at least @needed bytes. If @recycled is + * one of our blobs, reuse its buffer (or realloc it). + * *@out_capacity receives the actual capacity (>= @needed). + * *@out_replaced_buf is set to the recycled buf when realloc + * fails and a fresh buffer was allocated instead -- the caller + * must hb_free() that buf after recycle_finalize() runs. Returns + * nullptr on allocation failure. */ + static inline char * + recycle_acquire (hb_blob_t *recycled, + unsigned needed, + unsigned *out_capacity, + char **out_replaced_buf) + { + *out_replaced_buf = nullptr; + + if (recycled && recycled->destroy == recycle_data_destroy) + { + auto *bd = (recycle_data_t *) recycled->user_data; + if (bd->capacity >= needed) + { + *out_capacity = bd->capacity; + return bd->buf; + } + /* Grow with a 1.5x ramp to amortize repeated growth. */ + unsigned alloc_bytes = needed; + if (unlikely (hb_unsigned_add_overflows (needed, needed / 2, + &alloc_bytes))) + alloc_bytes = needed; + char *new_buf = (char *) hb_realloc (bd->buf, alloc_bytes); + if (new_buf) + { + bd->buf = new_buf; + bd->capacity = alloc_bytes; + *out_capacity = alloc_bytes; + return new_buf; + } + /* Realloc failed. Fall through to a fresh hb_malloc and stash + * the old buf for the caller to free after recycle_finalize. */ + *out_replaced_buf = bd->buf; + } + + char *buf = (char *) hb_malloc (needed); + if (unlikely (!buf)) + return nullptr; + *out_capacity = needed; + return buf; + } + + /* Wrap @buf (of @capacity, with @length used) into an hb_blob_t. + * If @recycled is one of our blobs, update and return it (cheap); + * otherwise create a new blob. Pass @replaced_recycled_buf from + * recycle_acquire(). */ + static inline hb_blob_t * + recycle_finalize (char *buf, + unsigned capacity, + unsigned length, + hb_blob_t *recycled, + char *replaced_recycled_buf) + { + if (recycled && recycled->destroy == recycle_data_destroy) + { + auto *bd = (recycle_data_t *) recycled->user_data; + if (replaced_recycled_buf && replaced_recycled_buf != buf) + hb_free (replaced_recycled_buf); + bd->buf = buf; + bd->capacity = capacity; + recycled->data = (const char *) buf; + recycled->length = length; + return recycled; + } + + /* No recycled blob to update -- create a fresh one with our + * destroy closure so the next recycle round can reuse it. */ + recycle_data_t *bd = (recycle_data_t *) hb_malloc (sizeof (*bd)); + if (unlikely (!bd)) + { + hb_free (buf); + return nullptr; + } + bd->buf = buf; + bd->capacity = capacity; + + return hb_blob_create ((const char *) buf, length, + HB_MEMORY_MODE_WRITABLE, + bd, recycle_data_destroy); + } + + /* Discard @buf returned by recycle_acquire without committing to + * a blob. Frees @buf if it was a fresh allocation; leaves any + * recycled buffer untouched. */ + static inline void + recycle_abort (char *buf, hb_blob_t *recycled) + { + if (!buf) return; + if (recycled && recycled->destroy == recycle_data_destroy) + { + auto *bd = (recycle_data_t *) recycled->user_data; + if (buf == bd->buf) return; /* owned by the recycled blob */ + } + hb_free (buf); + } + + /* Stash @blob in @slot as the recycled output for the next + * encode. Destroys any previously stashed blob. Safe to call + * with @blob = nullptr or the empty-singleton blob (treated as + * "drop"). */ + static inline void + recycle_stash (hb_blob_t **slot, hb_blob_t *blob) + { + hb_blob_destroy (*slot); + *slot = nullptr; + if (!blob || blob == hb_blob_get_empty ()) + return; + *slot = blob; + } }; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer-serialize.cc b/src/java.desktop/share/native/libharfbuzz/hb-buffer-serialize.cc index 6787da6f65f5..b3190ffc8ef4 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-buffer-serialize.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer-serialize.cc @@ -114,6 +114,17 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, *buf_consumed = 0; hb_position_t x = 0, y = 0; + + /* Calculate the advance of the previous glyphs */ + if (pos && (flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES)) + { + for (unsigned int i = 0; i < start; i++) + { + x += pos[i].x_advance; + y += pos[i].y_advance; + } + } + for (unsigned int i = start; i < end; i++) { char b[1024]; @@ -151,7 +162,7 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer, p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"cl\":%u", info[i].cluster)); } - if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) + if (pos && !(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) { p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d", x+pos[i].x_offset, y+pos[i].y_offset)); @@ -272,6 +283,17 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, *buf_consumed = 0; hb_position_t x = 0, y = 0; + + /* Calculate the advance of the previous glyphs */ + if (pos && (flags & HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES)) + { + for (unsigned int i = 0; i < start; i++) + { + x += pos[i].x_advance; + y += pos[i].y_advance; + } + } + for (unsigned int i = start; i < end; i++) { char b[1024]; @@ -297,7 +319,7 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer, p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "=%u", info[i].cluster)); } - if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) + if (pos && !(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS)) { if (x+pos[i].x_offset || y+pos[i].y_offset) p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "@%d,%d", x+pos[i].x_offset, y+pos[i].y_offset)); @@ -417,9 +439,9 @@ _hb_buffer_serialize_unicode_text (hb_buffer_t *buffer, * A human-readable, plain text format. * The serialized glyphs will look something like: * - * ``` + * |[ * [uni0651=0@518,0+0|uni0628=0+1897] - * ``` + * ]| * * - The serialized glyphs are delimited with `[` and `]`. * - Glyphs are separated with `|` @@ -435,10 +457,10 @@ _hb_buffer_serialize_unicode_text (hb_buffer_t *buffer, * A machine-readable, structured format. * The serialized glyphs will look something like: * - * ``` + * |[ * [{"g":"uni0651","cl":0,"dx":518,"dy":0,"ax":0,"ay":0}, - * {"g":"uni0628","cl":0,"dx":0,"dy":0,"ax":1897,"ay":0}] - * ``` + * {"g":"uni0628","cl":0,"dx":0,"dy":0,"ax":1897,"ay":0}] + * ]| * * Each glyph is a JSON object, with the following properties: * - `g`: the glyph name or glyph index if @@ -530,9 +552,9 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer, * A human-readable, plain text format. * The serialized codepoints will look something like: * - * ``` + * |[ *   - * ``` + * ]| * * - Glyphs are separated with `|` * - Unicode codepoints are expressed as zero-padded four (or more) @@ -550,9 +572,9 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer, * * For example: * - * ``` + * |[ * [{u:1617,cl:0},{u:1576,cl:1}] - * ``` + * ]| * * Return value: * The number of serialized items. diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer-verify.cc b/src/java.desktop/share/native/libharfbuzz/hb-buffer-verify.cc index 0c9190bf6f88..647c270c02a4 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-buffer-verify.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer-verify.cc @@ -101,9 +101,9 @@ buffer_verify_unsafe_to_break (hb_buffer_t *buffer, /* Check that breaking up shaping at safe-to-break is indeed safe. */ - hb_buffer_t *fragment = hb_buffer_create_similar (buffer); + hb_unique_ptr_t fragment (hb_buffer_create_similar (buffer)); hb_buffer_set_flags (fragment, (hb_buffer_flags_t (hb_buffer_get_flags (fragment) & ~HB_BUFFER_FLAG_VERIFY))); - hb_buffer_t *reconstruction = hb_buffer_create_similar (buffer); + hb_unique_ptr_t reconstruction (hb_buffer_create_similar (buffer)); hb_buffer_set_flags (reconstruction, (hb_buffer_flags_t (hb_buffer_get_flags (reconstruction) & ~HB_BUFFER_FLAG_VERIFY))); unsigned int num_glyphs; @@ -164,11 +164,7 @@ buffer_verify_unsafe_to_break (hb_buffer_t *buffer, hb_buffer_append (fragment, text_buffer, text_start, text_end); if (!hb_shape_full (font, fragment, features, num_features, shapers) || fragment->successful) - { - hb_buffer_destroy (reconstruction); - hb_buffer_destroy (fragment); return true; - } hb_buffer_append (reconstruction, fragment, 0, -1); start = end; @@ -193,9 +189,6 @@ buffer_verify_unsafe_to_break (hb_buffer_t *buffer, } } - hb_buffer_destroy (reconstruction); - hb_buffer_destroy (fragment); - return ret; } @@ -238,11 +231,13 @@ buffer_verify_unsafe_to_concat (hb_buffer_t *buffer, * the one from original buffer in step 1. */ - hb_buffer_t *fragments[2] {hb_buffer_create_similar (buffer), - hb_buffer_create_similar (buffer)}; + hb_unique_ptr_t fragments[2] { + hb_unique_ptr_t (hb_buffer_create_similar (buffer)), + hb_unique_ptr_t (hb_buffer_create_similar (buffer)), + }; hb_buffer_set_flags (fragments[0], (hb_buffer_flags_t (hb_buffer_get_flags (fragments[0]) & ~HB_BUFFER_FLAG_VERIFY))); hb_buffer_set_flags (fragments[1], (hb_buffer_flags_t (hb_buffer_get_flags (fragments[1]) & ~HB_BUFFER_FLAG_VERIFY))); - hb_buffer_t *reconstruction = hb_buffer_create_similar (buffer); + hb_unique_ptr_t reconstruction (hb_buffer_create_similar (buffer)); hb_buffer_set_flags (reconstruction, (hb_buffer_flags_t (hb_buffer_get_flags (reconstruction) & ~HB_BUFFER_FLAG_VERIFY))); hb_segment_properties_t props; hb_buffer_get_segment_properties (buffer, &props); @@ -308,17 +303,16 @@ buffer_verify_unsafe_to_concat (hb_buffer_t *buffer, } bool ret = true; - hb_buffer_diff_flags_t diff; /* * Shape the two fragment streams. */ if (!hb_shape_full (font, fragments[0], features, num_features, shapers) || !fragments[0]->successful) - goto out; + return ret; if (!hb_shape_full (font, fragments[1], features, num_features, shapers) || !fragments[1]->successful) - goto out; + return ret; if (!forward) { @@ -363,7 +357,7 @@ buffer_verify_unsafe_to_concat (hb_buffer_t *buffer, /* * Diff results. */ - diff = hb_buffer_diff (reconstruction, buffer, (hb_codepoint_t) -1, 0); + hb_buffer_diff_flags_t diff = hb_buffer_diff (reconstruction, buffer, (hb_codepoint_t) -1, 0); if (diff & ~HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH) { buffer_verify_error (buffer, font, BUFFER_VERIFY_ERROR "unsafe-to-concat test failed."); @@ -375,11 +369,6 @@ buffer_verify_unsafe_to_concat (hb_buffer_t *buffer, } } -out: - hb_buffer_destroy (reconstruction); - hb_buffer_destroy (fragments[0]); - hb_buffer_destroy (fragments[1]); - return ret; } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer.cc b/src/java.desktop/share/native/libharfbuzz/hb-buffer.cc index 8f6da312cdd0..f4eb6040de78 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-buffer.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer.cc @@ -547,12 +547,6 @@ void hb_buffer_t::merge_clusters_impl (unsigned int start, unsigned int end) { - if (!HB_BUFFER_CLUSTER_LEVEL_IS_MONOTONE (cluster_level)) - { - unsafe_to_break (start, end); - return; - } - max_ops -= end - start; if (unlikely (max_ops < 0)) successful = false; @@ -581,15 +575,9 @@ hb_buffer_t::merge_clusters_impl (unsigned int start, set_cluster (info[i], cluster); } void -hb_buffer_t::merge_out_clusters (unsigned int start, - unsigned int end) +hb_buffer_t::merge_out_clusters_impl (unsigned int start, + unsigned int end) { - if (!HB_BUFFER_CLUSTER_LEVEL_IS_MONOTONE (cluster_level)) - return; - - if (unlikely (end - start < 2)) - return; - max_ops -= end - start; if (unlikely (max_ops < 0)) successful = false; @@ -972,6 +960,9 @@ void hb_buffer_set_content_type (hb_buffer_t *buffer, hb_buffer_content_type_t content_type) { + if (unlikely (hb_object_is_immutable (buffer))) + return; + buffer->content_type = content_type; } @@ -1822,6 +1813,9 @@ hb_buffer_add_utf (hb_buffer_t *buffer, if (item_length == -1) item_length = text_length - item_offset; + item_offset = hb_min (item_offset, (unsigned) text_length); + item_length = hb_clamp (item_length, 0, text_length - (int) item_offset); + if (unlikely (item_length < 0 || item_length > INT_MAX / 8 || !buffer->ensure (buffer->len + item_length * sizeof (T) / 4))) @@ -2290,6 +2284,22 @@ hb_buffer_diff (hb_buffer_t *buffer, * Debugging. */ +void +hb_buffer_t::changed () +{ +#ifdef HB_NO_BUFFER_MESSAGE + return; +#else + if (!message_depth) + return; + + if (changed_func) + changed_func (this, changed_data); + else + update_digest (); +#endif +} + #ifndef HB_NO_BUFFER_MESSAGE /** * hb_buffer_set_message_func: @@ -2307,7 +2317,8 @@ hb_buffer_set_message_func (hb_buffer_t *buffer, hb_buffer_message_func_t func, void *user_data, hb_destroy_func_t destroy) { - if (unlikely (hb_object_is_immutable (buffer))) + if (unlikely (hb_object_is_immutable (buffer)) || + unlikely (buffer->message_depth)) { if (destroy) destroy (user_data); @@ -2327,6 +2338,23 @@ hb_buffer_set_message_func (hb_buffer_t *buffer, buffer->message_destroy = nullptr; } } +/** + * hb_buffer_changed: + * @buffer: An #hb_buffer_t + * + * Called by a message callback after modifying buffer glyph indices, + * to update internal caches. + * + * If not called from inside a message callback, does nothing. + * + * Since: 13.0.0 + **/ +void +hb_buffer_changed (hb_buffer_t *buffer) +{ + buffer->changed (); +} + bool hb_buffer_t::message_impl (hb_font_t *font, const char *fmt, va_list ap) { diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer.h b/src/java.desktop/share/native/libharfbuzz/hb-buffer.h index 332001ef1712..a06b823ccee7 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-buffer.h +++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer.h @@ -495,7 +495,7 @@ typedef enum { (1u << HB_BUFFER_CLUSTER_LEVEL_GRAPHEMES)))) /** - * HB_BUFFER_CLUSTER_LEVEL_IS_CHARACTERS + * HB_BUFFER_CLUSTER_LEVEL_IS_CHARACTERS: * @level: #hb_buffer_cluster_level_t to test * * Tests whether a cluster level does not group cluster values by graphemes. @@ -505,7 +505,7 @@ typedef enum { */ #define HB_BUFFER_CLUSTER_LEVEL_IS_CHARACTERS(level) \ ((bool) ((1u << (unsigned) (level)) & \ - ((1u << HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARCATERS) | \ + ((1u << HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS) | \ (1u << HB_BUFFER_CLUSTER_LEVEL_CHARACTERS)))) HB_EXTERN void @@ -672,7 +672,12 @@ hb_buffer_normalize_glyphs (hb_buffer_t *buffer); * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS: serialize glyph extents. * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS: serialize glyph flags. Since: 1.5.0 * @HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES: do not serialize glyph advances, - * glyph offsets will reflect absolute glyph positions. Since: 1.8.0 + * glyph offsets will reflect absolute glyph positions. Since: 1.8.0. + * Note: when this flag is used with a partial range of the buffer (i.e. + * @start is not 0), calculating the absolute positions has a cost + * proportional to @start. If the buffer is serialized in many small + * chunks, this can lead to quadratic behavior. It is recommended to + * use a larger @buf_size to minimize this cost. * @HB_BUFFER_SERIALIZE_FLAG_DEFINED: All currently defined flags. Since: 4.4.0 * * Flags that control what glyph information are serialized in hb_buffer_serialize_glyphs(). @@ -865,6 +870,9 @@ hb_buffer_set_message_func (hb_buffer_t *buffer, hb_buffer_message_func_t func, void *user_data, hb_destroy_func_t destroy); +HB_EXTERN void +hb_buffer_changed (hb_buffer_t *buffer); + HB_END_DECLS diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer.hh b/src/java.desktop/share/native/libharfbuzz/hb-buffer.hh index 1c46981cc9c7..32eca7021f8f 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-buffer.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer.hh @@ -130,9 +130,13 @@ struct hb_buffer_t */ #ifndef HB_NO_BUFFER_MESSAGE + typedef void (*changed_func_t) (hb_buffer_t *buffer, void *user_data); + hb_buffer_message_func_t message_func; void *message_data; hb_destroy_func_t message_destroy; + changed_func_t changed_func; + void *changed_data; unsigned message_depth; /* How deeply are we inside a message callback? */ #else static constexpr unsigned message_depth = 0u; @@ -398,10 +402,42 @@ struct hb_buffer_t { if (end - start < 2) return; + if (!HB_BUFFER_CLUSTER_LEVEL_IS_MONOTONE (cluster_level)) + { + unsafe_to_break (start, end); + return; + } + merge_clusters_impl (start, end); + } + void merge_grapheme_clusters (unsigned int start, unsigned int end) + { + if (end - start < 2) + return; + if (!HB_BUFFER_CLUSTER_LEVEL_IS_GRAPHEMES (cluster_level)) + { + unsafe_to_break (start, end); + return; + } merge_clusters_impl (start, end); } HB_INTERNAL void merge_clusters_impl (unsigned int start, unsigned int end); - HB_INTERNAL void merge_out_clusters (unsigned int start, unsigned int end); + void merge_out_clusters (unsigned int start, unsigned int end) + { + if (end - start < 2) + return; + if (!HB_BUFFER_CLUSTER_LEVEL_IS_MONOTONE (cluster_level)) + return; + merge_out_clusters_impl (start, end); + } + void merge_out_grapheme_clusters (unsigned int start, unsigned int end) + { + if (end - start < 2) + return; + if (!HB_BUFFER_CLUSTER_LEVEL_IS_GRAPHEMES (cluster_level)) + return; + merge_out_clusters_impl (start, end); + } + HB_INTERNAL void merge_out_clusters_impl (unsigned int start, unsigned int end); /* Merge clusters for deleting current glyph, and skip it. */ HB_INTERNAL void delete_glyph (); HB_INTERNAL void delete_glyphs_inplace (bool (*filter) (const hb_glyph_info_t *info)); @@ -605,6 +641,7 @@ struct hb_buffer_t #endif } HB_INTERNAL bool message_impl (hb_font_t *font, const char *fmt, va_list ap) HB_PRINTF_FUNC(3, 0); + HB_INTERNAL void changed (); static void set_cluster (hb_glyph_info_t &inf, unsigned int cluster, unsigned int mask = 0) diff --git a/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-common.hh index 79d7c4c7133b..a053940d0575 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-common.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-common.hh @@ -344,25 +344,25 @@ struct cff_stack_t { ELEM& operator [] (unsigned int i) { - if (unlikely (i >= count)) + if (unlikely (i >= length)) { set_error (); return Crap (ELEM); } - return elements[i]; + return arrayZ[i]; } void push (const ELEM &v) { - if (likely (count < LIMIT)) - elements[count++] = v; + if (likely (length < LIMIT)) + arrayZ[length++] = v; else set_error (); } ELEM &push () { - if (likely (count < LIMIT)) - return elements[count++]; + if (likely (length < LIMIT)) + return arrayZ[length++]; else { set_error (); @@ -372,8 +372,8 @@ struct cff_stack_t ELEM& pop () { - if (likely (count > 0)) - return elements[--count]; + if (likely (length > 0)) + return arrayZ[--length]; else { set_error (); @@ -382,45 +382,44 @@ struct cff_stack_t } void pop (unsigned int n) { - if (likely (count >= n)) - count -= n; + if (likely (length >= n)) + length -= n; else set_error (); } const ELEM& peek () { - if (unlikely (count == 0)) + if (unlikely (length == 0)) { set_error (); return Null (ELEM); } - return elements[count - 1]; + return arrayZ[length - 1]; } void unpop () { - if (likely (count < LIMIT)) - count++; + if (likely (length < LIMIT)) + length++; else set_error (); } - void clear () { count = 0; } + void clear () { length = 0; } bool in_error () const { return (error); } void set_error () { error = true; } - unsigned int get_count () const { return count; } - bool is_empty () const { return !count; } + unsigned int get_count () const { return length; } + bool is_empty () const { return !length; } hb_array_t sub_array (unsigned start, unsigned length) const - { return hb_array_t (elements).sub_array (start, length); } + { return hb_array_t (arrayZ).sub_array (start, length); } - private: bool error = false; - unsigned int count = 0; - ELEM elements[LIMIT]; + unsigned int length = 0; + ELEM arrayZ[LIMIT]; }; /* argument stack */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-cff2-interp-cs.hh b/src/java.desktop/share/native/libharfbuzz/hb-cff2-interp-cs.hh index ed4586dc437f..a4aa005d82c4 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-cff2-interp-cs.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-cff2-interp-cs.hh @@ -55,7 +55,7 @@ struct blend_arg_t : number_t void reset_blends () { numValues = valueIndex = 0; - deltas.shrink (0); + deltas.clear (); } unsigned int numValues; @@ -281,17 +281,18 @@ struct cff2_cs_opset_t : cs_opset_t, PAR k = env.get_region_count (); n = env.argStack.pop_uint (); /* copy the blend values into blend array of the default values */ - unsigned int start = env.argStack.get_count () - ((k+1) * n); - /* let an obvious error case fail, but note CFF2 spec doesn't forbid n==0 */ - if (unlikely (start > env.argStack.get_count ())) + unsigned int count = env.argStack.get_count (); + unsigned int total; + if (unlikely (hb_unsigned_mul_overflows (k + 1, n, &total) || total > count)) { env.set_error (); return; } + unsigned int start = count - total; for (unsigned int i = 0; i < n; i++) { const hb_array_t blends = env.argStack.sub_array (start + n + (i * k), k); - process_arg_blend (env, env.argStack[start + i], blends, n, i); + process_arg_blend (env, env.argStack.arrayZ[start + i], blends, n, i); } /* pop off blend values leaving default values now adorned with blend values */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-config.hh b/src/java.desktop/share/native/libharfbuzz/hb-config.hh index c522eeea2ea8..62e0d2022e37 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-config.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-config.hh @@ -43,6 +43,7 @@ #ifdef HB_TINY #define HB_LEAN #define HB_MINI +#define HB_NO_SVG #define HB_OPTIMIZE_SIZE #define HB_OPTIMIZE_SIZE_MORE #define HB_MINIMIZE_MEMORY_USAGE @@ -60,9 +61,6 @@ #define HB_NO_BUFFER_SERIALIZE #define HB_NO_BUFFER_VERIFY #define HB_NO_BITMAP -#define HB_NO_CFF -#define HB_NO_COLOR -#define HB_NO_DRAW #define HB_NO_ERRNO #define HB_NO_FACE_COLLECT_UNICODES #define HB_NO_GETENV @@ -78,13 +76,17 @@ #define HB_NO_NAME #define HB_NO_OPEN #define HB_NO_OT_FONT_GLYPH_NAMES -#define HB_NO_OT_SHAPE_FRACTIONS -#define HB_NO_PAINT #define HB_NO_SETLOCALE #define HB_NO_STYLE -#define HB_NO_SUBSET_LAYOUT #define HB_NO_VERTICAL #define HB_NO_VAR + +#if !(defined(HB_HAS_CAIRO) || defined(HB_HAS_RASTER) || defined(HB_HAS_VECTOR) || defined(HB_HAS_GPU)) +#define HB_NO_COLOR +#define HB_NO_DRAW +#define HB_NO_PAINT +#endif + #endif #ifdef HB_MINI @@ -92,8 +94,6 @@ #define HB_NO_LEGACY #define HB_NO_BEYOND_64K #define HB_NO_CUBIC_GLYF -#define HB_NO_VAR_COMPOSITES -#define HB_NO_VAR_HVF #endif #ifdef __OPTIMIZE_SIZE__ @@ -135,16 +135,17 @@ #define HB_NO_OT_FONT_BITMAP #endif -#ifdef HB_NO_CFF -#define HB_NO_OT_FONT_CFF -#define HB_NO_SUBSET_CFF -#endif - #ifdef HB_NO_DRAW +#define HB_NO_CFF #define HB_NO_OUTLINE #define HB_NO_PAINT #endif +#ifdef HB_NO_CFF +#define HB_NO_OT_FONT_CFF +#define HB_NO_SUBSET_CFF +#endif + #ifdef HB_NO_LEGACY #define HB_NO_CMAP_LEGACY_SUBTABLES #define HB_NO_FALLBACK_SHAPE diff --git a/src/java.desktop/share/native/libharfbuzz/hb-cplusplus.hh b/src/java.desktop/share/native/libharfbuzz/hb-cplusplus.hh index 82d397415279..d08e21c58e50 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-cplusplus.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-cplusplus.hh @@ -138,52 +138,64 @@ struct vtable_t static constexpr auto get_user_data = _get_user_data; }; -#define HB_DEFINE_VTABLE(name) \ +#define HB_DEFINE_VTABLE(name, empty) \ template<> \ struct vtable \ : vtable_t {} -HB_DEFINE_VTABLE (buffer); -HB_DEFINE_VTABLE (blob); -HB_DEFINE_VTABLE (face); -HB_DEFINE_VTABLE (font); -HB_DEFINE_VTABLE (font_funcs); -HB_DEFINE_VTABLE (map); -HB_DEFINE_VTABLE (set); -HB_DEFINE_VTABLE (shape_plan); -HB_DEFINE_VTABLE (unicode_funcs); -HB_DEFINE_VTABLE (draw_funcs); -HB_DEFINE_VTABLE (paint_funcs); - -#undef HB_DEFINE_VTABLE +HB_DEFINE_VTABLE (buffer, &hb_buffer_get_empty); +HB_DEFINE_VTABLE (blob, &hb_blob_get_empty); +HB_DEFINE_VTABLE (face, &hb_face_get_empty); +HB_DEFINE_VTABLE (font, &hb_font_get_empty); +HB_DEFINE_VTABLE (font_funcs, &hb_font_funcs_get_empty); +HB_DEFINE_VTABLE (map, &hb_map_get_empty); +HB_DEFINE_VTABLE (set, &hb_set_get_empty); +HB_DEFINE_VTABLE (shape_plan, &hb_shape_plan_get_empty); +HB_DEFINE_VTABLE (unicode_funcs, &hb_unicode_funcs_get_empty); +HB_DEFINE_VTABLE (draw_funcs, &hb_draw_funcs_get_empty); +HB_DEFINE_VTABLE (paint_funcs, &hb_paint_funcs_get_empty); #ifdef HB_SUBSET_H -#define HB_DEFINE_VTABLE(name) \ - template<> \ - struct vtable \ - : vtable_t {} +HB_DEFINE_VTABLE (subset_input, nullptr); +HB_DEFINE_VTABLE (subset_plan, nullptr); +#endif -HB_DEFINE_VTABLE (subset_input); -HB_DEFINE_VTABLE (subset_plan); -#undef HB_DEFINE_VTABLE +#ifdef HB_RASTER_H + +HB_DEFINE_VTABLE (raster_image, nullptr); +HB_DEFINE_VTABLE (raster_draw, nullptr); +HB_DEFINE_VTABLE (raster_paint, nullptr); #endif +#ifdef HB_VECTOR_H + +HB_DEFINE_VTABLE (vector_draw, nullptr); +HB_DEFINE_VTABLE (vector_paint, nullptr); + +#endif + + +#ifdef HB_GPU_H + +HB_DEFINE_VTABLE (gpu_draw, nullptr); + +#endif + +/* HB_DEFINE_VTABLE stays available for subsystem headers' paired tail + * blocks (see hb-raster.h, hb-vector.h, hb-gpu.h, hb-subset.h). */ + + } // namespace hb /* Workaround for GCC < 7, see: diff --git a/src/java.desktop/share/native/libharfbuzz/hb-draw.cc b/src/java.desktop/share/native/libharfbuzz/hb-draw.cc index c243d12f7aef..a9d00f695ce2 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-draw.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-draw.cc @@ -32,6 +32,8 @@ #include "hb-machinery.hh" +#include + /** * SECTION:hb-draw @@ -116,25 +118,25 @@ _hb_draw_funcs_set_middle (hb_draw_funcs_t *dfuncs, void *user_data, hb_destroy_func_t destroy) { + auto destroy_guard = hb_make_scope_guard ([&]() { + if (destroy) destroy (user_data); + }); + if (user_data && !dfuncs->user_data) { dfuncs->user_data = (decltype (dfuncs->user_data)) hb_calloc (1, sizeof (*dfuncs->user_data)); if (unlikely (!dfuncs->user_data)) - goto fail; + return false; } if (destroy && !dfuncs->destroy) { dfuncs->destroy = (decltype (dfuncs->destroy)) hb_calloc (1, sizeof (*dfuncs->destroy)); if (unlikely (!dfuncs->destroy)) - goto fail; + return false; } + destroy_guard.release (); return true; - -fail: - if (destroy) - (destroy) (user_data); - return false; } #define HB_DRAW_FUNC_IMPLEMENT(name) \ @@ -460,6 +462,268 @@ hb_draw_close_path (hb_draw_funcs_t *dfuncs, void *draw_data, } +/** + * hb_draw_line: + * @dfuncs: draw functions + * @draw_data: associated draw data passed by the caller + * @st: current draw state + * @x0: start X coordinate + * @y0: start Y coordinate + * @w0: stroke width at the start + * @x1: end X coordinate + * @y1: end Y coordinate + * @w1: stroke width at the end + * @cap: end-cap shape (butt or square) + * + * Emits a tapered line segment as a filled trapezoid. @w0 and + * @w1 are the full stroke widths at the start and end points + * respectively; they may differ for a tapered stroke or match + * for a uniform one. Pass `NaN` for @w1 to use @w0 (uniform + * stroke) without repeating the value. + * + * With #HB_DRAW_LINE_CAP_SQUARE each endpoint is extended along + * the line direction by half its local stroke width, so four + * `hb_draw_line()` calls form a closed rectangle without gaps + * at the corners. + * + * Since: 14.2.0 + **/ +void +hb_draw_line (hb_draw_funcs_t *dfuncs, void *draw_data, + hb_draw_state_t *st, + float x0, float y0, float w0, + float x1, float y1, float w1, + hb_draw_line_cap_t cap) +{ + if (std::isnan (w1)) w1 = w0; + float dx = x1 - x0, dy = y1 - y0; + float len = sqrtf (dx * dx + dy * dy); + if (len <= 0.f) + return; + /* Unit tangent and normal to the line direction. */ + float tx = dx / len; + float ty = dy / len; + float nx = -ty; + float ny = tx; + float h0 = 0.5f * w0; + float h1 = 0.5f * w1; + /* Square caps: extend each endpoint outward along the line + * tangent by half its local stroke width. */ + if (cap == HB_DRAW_LINE_CAP_SQUARE) + { + x0 -= tx * h0; y0 -= ty * h0; + x1 += tx * h1; y1 += ty * h1; + } + /* Trapezoid corners (counter-clockwise). */ + float ax = x0 + nx * h0, ay = y0 + ny * h0; + float bx = x1 + nx * h1, by = y1 + ny * h1; + float cx = x1 - nx * h1, cy = y1 - ny * h1; + float dx_ = x0 - nx * h0, dy_ = y0 - ny * h0; + + hb_draw_move_to (dfuncs, draw_data, st, ax, ay); + hb_draw_line_to (dfuncs, draw_data, st, bx, by); + hb_draw_line_to (dfuncs, draw_data, st, cx, cy); + hb_draw_line_to (dfuncs, draw_data, st, dx_, dy_); + hb_draw_close_path (dfuncs, draw_data, st); +} + +/* Emit an axis-aligned rectangle as a single closed contour. + * @ccw picks the winding direction (useful for cutting a hole + * out of another rectangle in a stroked rect). */ +static void +_hb_draw_rect_contour (hb_draw_funcs_t *dfuncs, void *draw_data, + hb_draw_state_t *st, + float x, float y, float w, float h, + bool ccw) +{ + hb_draw_move_to (dfuncs, draw_data, st, x, y); + if (ccw) + { + hb_draw_line_to (dfuncs, draw_data, st, x + w, y); + hb_draw_line_to (dfuncs, draw_data, st, x + w, y + h); + hb_draw_line_to (dfuncs, draw_data, st, x, y + h); + } + else + { + hb_draw_line_to (dfuncs, draw_data, st, x, y + h); + hb_draw_line_to (dfuncs, draw_data, st, x + w, y + h); + hb_draw_line_to (dfuncs, draw_data, st, x + w, y); + } + hb_draw_close_path (dfuncs, draw_data, st); +} + +/** + * hb_draw_rectangle: + * @dfuncs: draw functions + * @draw_data: associated draw data passed by the caller + * @st: current draw state + * @x: top-left X coordinate + * @y: top-left Y coordinate + * @w: width (may be negative) + * @h: height (may be negative) + * @stroke_width: stroke width, or `NaN` for a filled rectangle + * + * Emits an axis-aligned rectangle. If @stroke_width is a finite + * positive value, the rectangle is rendered as an outlined ring + * of that thickness centered on the edges; if @stroke_width is + * `NaN`, the rectangle is rendered filled. + * + * Note: stroked rectangles produce a bounding box covering the + * full outer rectangle, so if the pen is a GPU fragment-shader + * backend, the shader runs for every interior pixel even though + * only the outline contributes coverage. For very thin + * outlines where the interior is much larger than the stroke, + * emitting four hb_draw_line() segments (one per edge) is + * considerably cheaper per frame. + * + * Since: 14.2.0 + **/ +void +hb_draw_rectangle (hb_draw_funcs_t *dfuncs, void *draw_data, + hb_draw_state_t *st, + float x, float y, + float w, float h, + float stroke_width) +{ + if (std::isnan (stroke_width)) + { + /* Filled rectangle with zero area is nothing to draw. */ + if (w == 0.f || h == 0.f) + return; + _hb_draw_rect_contour (dfuncs, draw_data, st, x, y, w, h, /*ccw*/ true); + return; + } + + if (stroke_width <= 0.f || !std::isfinite (stroke_width)) + return; + + /* Normalize to non-negative width/height so the stroke math + * below (outer grows by sw, inner shrinks by sw) produces the + * expected outer-contains-inner ring regardless of w/h signs. */ + if (w < 0.f) { x += w; w = -w; } + if (h < 0.f) { y += h; h = -h; } + /* w or h == 0 is still meaningful when stroking: a stroked + * zero-height rect is a horizontal line of length w; zero + * width is a vertical line. Both degenerate to a single + * outer contour because the inner hole collapses. */ + + /* Stroke is centered on the edge: outer contour grows by + * stroke_width/2, inner contour shrinks by the same. */ + float s = 0.5f * stroke_width; + /* Outer rectangle (CCW = adds coverage). */ + _hb_draw_rect_contour (dfuncs, draw_data, st, + x - s, y - s, + w + stroke_width, h + stroke_width, + /*ccw*/ true); + /* Inner rectangle (CW = removes coverage for the hole). */ + float iw = w - stroke_width; + float ih = h - stroke_width; + if (iw > 0.f && ih > 0.f) + _hb_draw_rect_contour (dfuncs, draw_data, st, + x + s, y + s, iw, ih, + /*ccw*/ false); +} + +/* Circle approximated by 4 cubic Beziers, one per quadrant. + * The magic constant 0.5522847498307936 is + * (4/3) * (sqrt(2) - 1) + * and minimizes the max radial error to ~2.7e-4 of r. */ +static void +_hb_draw_circle_contour (hb_draw_funcs_t *dfuncs, void *draw_data, + hb_draw_state_t *st, + float cx, float cy, float r, + bool ccw) +{ + static const float k = 0.5522847498307936f; + float ck = r * k; + + hb_draw_move_to (dfuncs, draw_data, st, cx + r, cy); + if (ccw) + { + hb_draw_cubic_to (dfuncs, draw_data, st, + cx + r, cy + ck, + cx + ck, cy + r, + cx, cy + r); + hb_draw_cubic_to (dfuncs, draw_data, st, + cx - ck, cy + r, + cx - r, cy + ck, + cx - r, cy); + hb_draw_cubic_to (dfuncs, draw_data, st, + cx - r, cy - ck, + cx - ck, cy - r, + cx, cy - r); + hb_draw_cubic_to (dfuncs, draw_data, st, + cx + ck, cy - r, + cx + r, cy - ck, + cx + r, cy); + } + else + { + hb_draw_cubic_to (dfuncs, draw_data, st, + cx + r, cy - ck, + cx + ck, cy - r, + cx, cy - r); + hb_draw_cubic_to (dfuncs, draw_data, st, + cx - ck, cy - r, + cx - r, cy - ck, + cx - r, cy); + hb_draw_cubic_to (dfuncs, draw_data, st, + cx - r, cy + ck, + cx - ck, cy + r, + cx, cy + r); + hb_draw_cubic_to (dfuncs, draw_data, st, + cx + ck, cy + r, + cx + r, cy + ck, + cx + r, cy); + } + hb_draw_close_path (dfuncs, draw_data, st); +} + +/** + * hb_draw_circle: + * @dfuncs: draw functions + * @draw_data: associated draw data passed by the caller + * @st: current draw state + * @cx: center X coordinate + * @cy: center Y coordinate + * @r: radius + * @stroke_width: stroke width, or `NaN` for a filled disc + * + * Emits a circle approximated by four cubic Bezier curves. If + * @stroke_width is a finite positive value, the circle is + * rendered as an outlined ring of that thickness centered on + * the nominal radius; if @stroke_width is `NaN`, the circle is + * rendered as a filled disc. + * + * Since: 14.2.0 + **/ +void +hb_draw_circle (hb_draw_funcs_t *dfuncs, void *draw_data, + hb_draw_state_t *st, + float cx, float cy, + float r, + float stroke_width) +{ + if (r <= 0.f) + return; + + if (std::isnan (stroke_width)) + { + _hb_draw_circle_contour (dfuncs, draw_data, st, cx, cy, r, /*ccw*/ true); + return; + } + + if (stroke_width <= 0.f || !std::isfinite (stroke_width)) + return; + + float s = 0.5f * stroke_width; + _hb_draw_circle_contour (dfuncs, draw_data, st, cx, cy, r + s, /*ccw*/ true); + float ir = r - s; + if (ir > 0.f) + _hb_draw_circle_contour (dfuncs, draw_data, st, cx, cy, ir, /*ccw*/ false); +} + + static void hb_draw_extents_move_to (hb_draw_funcs_t *dfuncs HB_UNUSED, void *data, diff --git a/src/java.desktop/share/native/libharfbuzz/hb-draw.h b/src/java.desktop/share/native/libharfbuzz/hb-draw.h index 06299e17a785..7c3358beed8f 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-draw.h +++ b/src/java.desktop/share/native/libharfbuzz/hb-draw.h @@ -335,6 +335,58 @@ hb_draw_close_path (hb_draw_funcs_t *dfuncs, void *draw_data, hb_draw_state_t *st); +/* Shape helpers. + * + * Emit common primitives (tapered line, rectangle, circle) into + * any pen. The helpers are thin wrappers over the individual + * move_to / line_to / cubic_to / close_path calls: callers can + * always hand-roll the same shapes if they need a variation. + * + * For rect / circle the @stroke_width parameter selects between + * filled and stroked: a positive finite value is the stroke + * width of the outline; NaN means "filled" (no stroke). + */ + +/** + * hb_draw_line_cap_t: + * @HB_DRAW_LINE_CAP_BUTT: No cap; the line ends exactly at + * its endpoint. + * @HB_DRAW_LINE_CAP_SQUARE: Square cap; the line is extended + * past its endpoint by half the local stroke width. Useful + * for composing closed shapes from line segments (e.g. a + * rectangle made from four lines). + * + * End-cap shape for hb_draw_line(). + * + * Since: 14.2.0 + **/ +typedef enum { + HB_DRAW_LINE_CAP_BUTT = 0, + HB_DRAW_LINE_CAP_SQUARE = 1, +} hb_draw_line_cap_t; + +HB_EXTERN void +hb_draw_line (hb_draw_funcs_t *dfuncs, void *draw_data, + hb_draw_state_t *st, + float x0, float y0, float w0, + float x1, float y1, float w1, + hb_draw_line_cap_t cap); + +HB_EXTERN void +hb_draw_rectangle (hb_draw_funcs_t *dfuncs, void *draw_data, + hb_draw_state_t *st, + float x, float y, + float w, float h, + float stroke_width); + +HB_EXTERN void +hb_draw_circle (hb_draw_funcs_t *dfuncs, void *draw_data, + hb_draw_state_t *st, + float cx, float cy, + float r, + float stroke_width); + + HB_END_DECLS #endif /* HB_DRAW_H */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-face-builder.cc b/src/java.desktop/share/native/libharfbuzz/hb-face-builder.cc index c1feaac62804..d660063716f8 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-face-builder.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-face-builder.cc @@ -180,10 +180,8 @@ _hb_face_builder_get_table_tags (const hb_face_t *face HB_UNUSED, { // Not much to do... } - sorted_tags.qsort ([] (const void* a, const void* b) { - return * (hb_tag_t *) a < * (hb_tag_t *) b ? -1 : - * (hb_tag_t *) a == * (hb_tag_t *) b ? 0 : - +1; + sorted_tags.qsort ([] (const hb_tag_t &a, const hb_tag_t &b) { + return a < b; }); auto array = sorted_tags.as_array ().sub_array (start_offset, table_count); diff --git a/src/java.desktop/share/native/libharfbuzz/hb-font.cc b/src/java.desktop/share/native/libharfbuzz/hb-font.cc index 6c636e235678..c8ddbd007656 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-font.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-font.cc @@ -406,14 +406,15 @@ hb_font_get_glyph_h_origins_default (hb_font_t *font HB_UNUSED, { if (font->has_glyph_h_origin_func_set ()) { + hb_bool_t ret = true; for (unsigned int i = 0; i < count; i++) { - font->get_glyph_h_origin (*first_glyph, first_x, first_y, false); + ret &= font->get_glyph_h_origin (*first_glyph, first_x, first_y, false); first_glyph = &StructAtOffsetUnaligned (first_glyph, glyph_stride); first_x = &StructAtOffsetUnaligned (first_x, x_stride); first_y = &StructAtOffsetUnaligned (first_y, y_stride); } - return true; + return ret; } hb_bool_t ret = font->parent->get_glyph_h_origins (count, @@ -448,14 +449,15 @@ hb_font_get_glyph_v_origins_default (hb_font_t *font HB_UNUSED, { if (font->has_glyph_v_origin_func_set ()) { + hb_bool_t ret = true; for (unsigned int i = 0; i < count; i++) { - font->get_glyph_v_origin (*first_glyph, first_x, first_y, false); + ret &= font->get_glyph_v_origin (*first_glyph, first_x, first_y, false); first_glyph = &StructAtOffsetUnaligned (first_glyph, glyph_stride); first_x = &StructAtOffsetUnaligned (first_x, x_stride); first_y = &StructAtOffsetUnaligned (first_y, y_stride); } - return true; + return ret; } hb_bool_t ret = font->parent->get_glyph_v_origins (count, @@ -1001,25 +1003,25 @@ _hb_font_funcs_set_middle (hb_font_funcs_t *ffuncs, void *user_data, hb_destroy_func_t destroy) { + auto destroy_guard = hb_make_scope_guard ([&]() { + if (destroy) destroy (user_data); + }); + if (user_data && !ffuncs->user_data) { ffuncs->user_data = (decltype (ffuncs->user_data)) hb_calloc (1, sizeof (*ffuncs->user_data)); if (unlikely (!ffuncs->user_data)) - goto fail; + return false; } if (destroy && !ffuncs->destroy) { ffuncs->destroy = (decltype (ffuncs->destroy)) hb_calloc (1, sizeof (*ffuncs->destroy)); if (unlikely (!ffuncs->destroy)) - goto fail; + return false; } + destroy_guard.release (); return true; - -fail: - if (destroy) - (destroy) (user_data); - return false; } #define HB_FONT_FUNC_IMPLEMENT(get_,name) \ @@ -1625,11 +1627,12 @@ hb_font_draw_glyph_or_fail (hb_font_t *font, * * Paints a color glyph. * - * This function is similar to, but lower-level than, - * hb_font_paint_glyph(). It is suitable for clients that - * need more control. If there are no color glyphs available, - * it will return `false`. The client can then fall back to - * hb_font_draw_glyph_or_fail() for the monochrome outline glyph. + * Succeeds if @glyph has color paint layers (COLRv0), + * a color paint graph (COLRv1), or a bitmap image that the + * font's callbacks render successfully. Returns `false` if + * the font has no color data for @glyph; the client can then + * fall back to hb_font_draw_glyph_or_fail() for the monochrome + * outline. * * The painting instructions are returned by way of calls to * the callbacks of the @funcs object, with @paint_data passed @@ -2414,6 +2417,10 @@ hb_font_set_parent (hb_font_t *font, if (!parent) parent = hb_font_get_empty (); + for (hb_font_t *p = parent; p && p != hb_font_get_empty(); p = p->parent) + if (p == font) + return; /* Would create a cycle - reject */ + hb_font_t *old = font->parent; font->parent = hb_font_reference (parent); @@ -3183,7 +3190,7 @@ hb_font_set_var_coords_design (hb_font_t *font, for (unsigned int i = input_coords_length; i < coords_length; i++) design_coords[i] = axes[i].get_default (); - hb_ot_var_normalize_coords (font->face, coords_length, coords, normalized); + hb_ot_var_normalize_coords (font->face, coords_length, design_coords, normalized); _hb_font_adopt_var_coords (font, normalized, design_coords, coords_length); } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-font.hh b/src/java.desktop/share/native/libharfbuzz/hb-font.hh index 9dd54466d7f8..a89b5db8cbcb 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-font.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-font.hh @@ -172,13 +172,13 @@ struct hb_font_t /* Convert from parent-font user-space to our user-space */ hb_position_t parent_scale_x_distance (hb_position_t v) { - if (unlikely (parent && parent->x_scale != x_scale)) + if (unlikely (parent && parent->x_scale && parent->x_scale != x_scale)) return (hb_position_t) (v * (int64_t) this->x_scale / this->parent->x_scale); return v; } hb_position_t parent_scale_y_distance (hb_position_t v) { - if (unlikely (parent && parent->y_scale != y_scale)) + if (unlikely (parent && parent->y_scale && parent->y_scale != y_scale)) return (hb_position_t) (v * (int64_t) this->y_scale / this->parent->y_scale); return v; } @@ -903,15 +903,11 @@ struct hb_font_t } else { - for (unsigned j = 0; j < n; j++) - { - origins[j].x = 0; - origins[j].y = 0; - } + mult = 0; /* Indicates all origins[].x and origins[].y values are 0, therefore we can skip adjusting offsets below */ } } - assert (mult == -1 || mult == +1); + assert (mult == -1 || mult == +1 || mult == 0); if (mult == +1) for (unsigned j = 0; j < n; j++) { @@ -919,13 +915,14 @@ struct hb_font_t add_offset (&pos->x_offset, &pos->y_offset, origins[j].x, origins[j].y); } - else /* mult == -1 */ + else if (mult == -1) for (unsigned j = 0; j < n; j++) { hb_glyph_position_t *pos = &buf->pos[offset + j]; subtract_offset (&pos->x_offset, &pos->y_offset, origins[j].x, origins[j].y); } + /* else if (mult == 0) --> Do nothing */ offset += n; } @@ -970,15 +967,11 @@ struct hb_font_t } else { - for (unsigned j = 0; j < n; j++) - { - origins[j].x = 0; - origins[j].y = 0; - } + mult = 0; /* Indicates all origins[].x and origins[].y values are 0, therefore we can skip adjusting offsets below */ } } - assert (mult == -1 || mult == +1); + assert (mult == -1 || mult == +1 || mult == 0); if (mult == +1) for (unsigned j = 0; j < n; j++) { @@ -986,13 +979,14 @@ struct hb_font_t add_offset (&pos->x_offset, &pos->y_offset, origins[j].x, origins[j].y); } - else /* mult == -1 */ + else if (mult == -1) for (unsigned j = 0; j < n; j++) { hb_glyph_position_t *pos = &buf->pos[offset + j]; subtract_offset (&pos->x_offset, &pos->y_offset, origins[j].x, origins[j].y); } + /* else if (mult == 0) --> Do nothing */ offset += n; } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ft.cc b/src/java.desktop/share/native/libharfbuzz/hb-ft.cc index b90f966c57c2..f02069f0c0c5 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ft.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ft.cc @@ -766,6 +766,12 @@ hb_ft_get_glyph_name (hb_font_t *font HB_UNUSED, hb_lock_t lock (ft_font->lock); FT_Face ft_face = ft_font->ft_face; + if (!size) + { + char buf[128]; + return !FT_Get_Glyph_Name (ft_face, glyph, buf, sizeof (buf)) && *buf; + } + hb_bool_t ret = !FT_Get_Glyph_Name (ft_face, glyph, name, size); if (ret && (size && !*name)) ret = false; @@ -1117,14 +1123,13 @@ _hb_ft_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data buffer = (FT_Byte *) hb_malloc (length); if (!buffer) return nullptr; + auto buffer_guard = hb_make_scope_guard ([&]() { hb_free (buffer); }); error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length); if (error) - { - hb_free (buffer); return nullptr; - } + buffer_guard.release (); return hb_blob_create ((const char *) buffer, length, HB_MEMORY_MODE_WRITABLE, buffer, hb_free); @@ -1693,6 +1698,13 @@ _release_blob (void *arg) void hb_ft_font_set_funcs (hb_font_t *font) { + int load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING; + if (font->destroy == (hb_destroy_func_t) _hb_ft_font_destroy && font->user_data) + { + const hb_ft_font_t *existing_ft_font = (const hb_ft_font_t *) font->user_data; + load_flags = existing_ft_font->load_flags; + } + // In case of failure... hb_font_set_funcs (font, hb_font_funcs_get_empty (), @@ -1740,7 +1752,7 @@ hb_ft_font_set_funcs (hb_font_t *font) } _hb_ft_font_set_funcs (font, ft_face, true); - hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING); + hb_ft_font_set_load_flags (font, load_flags); _hb_ft_hb_font_changed (font, ft_face); } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-geometry.hh b/src/java.desktop/share/native/libharfbuzz/hb-geometry.hh index 0de062df68ea..548561b0e2cd 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-geometry.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-geometry.hh @@ -28,16 +28,25 @@ #include "hb-algs.hh" +#include + template struct hb_extents_t { hb_extents_t () {} - hb_extents_t (const hb_glyph_extents_t &extents) : - xmin (hb_min (extents.x_bearing, extents.x_bearing + extents.width)), - ymin (hb_min (extents.y_bearing, extents.y_bearing + extents.height)), - xmax (hb_max (extents.x_bearing, extents.x_bearing + extents.width)), - ymax (hb_max (extents.y_bearing, extents.y_bearing + extents.height)) {} + hb_extents_t (const hb_glyph_extents_t &extents) + { + double x0 = (double) extents.x_bearing; + double y0 = (double) extents.y_bearing; + double x1 = x0 + (double) extents.width; + double y1 = y0 + (double) extents.height; + + xmin = (Float) hb_min (x0, x1); + ymin = (Float) hb_min (y0, y1); + xmax = (Float) hb_max (x0, x1); + ymax = (Float) hb_max (y0, y1); + } hb_extents_t (Float xmin, Float ymin, Float xmax, Float ymax) : xmin (xmin), ymin (ymin), xmax (xmax), ymax (ymax) {} @@ -90,20 +99,37 @@ struct hb_extents_t hb_glyph_extents_t to_glyph_extents (bool xneg = false, bool yneg = false) const { - hb_position_t x0 = (hb_position_t) roundf (xmin); - hb_position_t y0 = (hb_position_t) roundf (ymin); - hb_position_t x1 = (hb_position_t) roundf (xmax); - hb_position_t y1 = (hb_position_t) roundf (ymax); - return hb_glyph_extents_t {xneg ? x1 : x0, - yneg ? y0 : y1, - xneg ? x0 - x1 : x1 - x0, - yneg ? y1 - y0 : y0 - y1}; + double x0 = round ((double) xmin); + double y0 = round ((double) ymin); + double x1 = round ((double) xmax); + double y1 = round ((double) ymax); + + if (unlikely (!std::isfinite (x0) || + !std::isfinite (y0) || + !std::isfinite (x1) || + !std::isfinite (y1))) + return hb_glyph_extents_t {0, 0, 0, 0}; + + return hb_glyph_extents_t { + clamp_to_hb_position (xneg ? x1 : x0), + clamp_to_hb_position (yneg ? y0 : y1), + clamp_to_hb_position (xneg ? x0 - x1 : x1 - x0), + clamp_to_hb_position (yneg ? y1 - y0 : y0 - y1) + }; } Float xmin = 0; Float ymin = 0; Float xmax = -1; Float ymax = -1; + + static hb_position_t + clamp_to_hb_position (double v) + { + return (hb_position_t) hb_clamp (v, + (double) hb_int_min (hb_position_t), + (double) hb_int_max (hb_position_t)); + } }; template diff --git a/src/java.desktop/share/native/libharfbuzz/hb-limits.hh b/src/java.desktop/share/native/libharfbuzz/hb-limits.hh index 857e183737fa..9d6c7ec68221 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-limits.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-limits.hh @@ -108,5 +108,34 @@ #define HB_MAX_COMPOSITE_OPERATIONS_PER_GLYPH 64 #endif +#ifndef HB_SVG_MAX_PATH_SEGMENTS +#define HB_SVG_MAX_PATH_SEGMENTS 262144 +#endif + +#ifndef HB_GPU_DRAW_MAX_CURVES +#define HB_GPU_DRAW_MAX_CURVES 65536 +#endif + +#ifndef HB_SVG_MAX_DOCUMENT_SIZE +#define HB_SVG_MAX_DOCUMENT_SIZE ((size_t) 16 << 20) +#endif + +#ifndef HB_RASTER_MAX_BUFFER_SIZE +#define HB_RASTER_MAX_BUFFER_SIZE ((size_t) 1 << 30) +#endif + + +#ifndef HB_REPACKER_MAX_ITERATIONS +#define HB_REPACKER_MAX_ITERATIONS 500 +#endif + +#ifndef HB_REPACKER_MAX_VERTICES +#define HB_REPACKER_MAX_VERTICES 100000 +#endif + +#ifndef HB_REPACKER_MAX_SPACES +#define HB_REPACKER_MAX_SPACES 1024 +#endif + #endif /* HB_LIMITS_HH */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-machinery.hh b/src/java.desktop/share/native/libharfbuzz/hb-machinery.hh index 8fa32ea8eaa4..8685ac29306c 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-machinery.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-machinery.hh @@ -110,7 +110,7 @@ static inline auto StructAfter(TObject &X, Ts... args) HB_AUTO_RETURN(( #define DEFINE_SIZE_STATIC(size) \ DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)) \ - unsigned int get_size () const { return (size); } \ + size_t get_size () const { return (size); } \ static constexpr unsigned null_size = (size); \ static constexpr unsigned min_size = (size); \ static constexpr unsigned static_size = (size) @@ -137,7 +137,7 @@ static inline auto StructAfter(TObject &X, Ts... args) HB_AUTO_RETURN(( static constexpr unsigned min_size = (size) #define DEFINE_SIZE_ARRAY_SIZED(size, array) \ - unsigned int get_size () const { return (size - (array).min_size + (array).get_size ()); } \ + size_t get_size () const { return (size - (array).min_size + (array).get_size ()); } \ DEFINE_SIZE_ARRAY(size, array) diff --git a/src/java.desktop/share/native/libharfbuzz/hb-map.hh b/src/java.desktop/share/native/libharfbuzz/hb-map.hh index 4c76622df7aa..ae35e715d54e 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-map.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-map.hh @@ -379,7 +379,11 @@ struct hb_hashmap_t void clear () { - if (unlikely (!successful)) return; + /* Early-out on already-empty. Protects the Null singleton + * (zero-initialized) from any writes. Any non-empty hashmap + * is a real heap instance with writable items, so clearing + * under !successful is safe. */ + if (!population && !occupancy) return; for (auto &_ : hb_iter (items, size ())) { diff --git a/src/java.desktop/share/native/libharfbuzz/hb-number.cc b/src/java.desktop/share/native/libharfbuzz/hb-number.cc index 37bc8b873997..f09366760fa6 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-number.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-number.cc @@ -23,6 +23,10 @@ * */ +#ifndef HB_NUMBER_CC +#define HB_NUMBER_CC +#ifdef HB_NUMBER_CC /* Pacify -Wunused-macros. */ + #include "hb.hh" #include "hb-number.hh" #include "hb-number-parser.hh" @@ -77,3 +81,6 @@ hb_parse_double (const char **pp, const char *end, double *pv, bool whole_buffer *pp = pend; return !whole_buffer || end == pend; } + +#endif /* HB_NUMBER_CC pacify */ +#endif /* HB_NUMBER_CC guard */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-object.hh b/src/java.desktop/share/native/libharfbuzz/hb-object.hh index fa9a249b2e23..76de679c8c7a 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-object.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-object.hh @@ -272,6 +272,8 @@ static inline void hb_object_make_immutable (const Type *obj) obj->header.writable = false; } template +static inline void hb_object_fini (Type *obj); +template static inline Type *hb_object_reference (Type *obj) { hb_object_trace (obj, HB_FUNC); @@ -282,7 +284,7 @@ static inline Type *hb_object_reference (Type *obj) return obj; } template -static inline bool hb_object_destroy (Type *obj) +static inline bool hb_object_should_destroy (Type *obj) { hb_object_trace (obj, HB_FUNC); if (unlikely (!obj || obj->header.is_inert ())) @@ -290,12 +292,25 @@ static inline bool hb_object_destroy (Type *obj) assert (hb_object_is_valid (obj)); if (obj->header.ref_count.dec () != 1) return false; + return true; +} +template +static inline void hb_object_actually_destroy (Type *obj) +{ hb_object_fini (obj); if (!std::is_trivially_destructible::value) obj->~Type (); +} + +template +static inline bool hb_object_destroy (Type *obj) +{ + if (!hb_object_should_destroy (obj)) + return false; + hb_object_actually_destroy (obj); return true; } template diff --git a/src/java.desktop/share/native/libharfbuzz/hb-open-type.hh b/src/java.desktop/share/native/libharfbuzz/hb-open-type.hh index ad831b66d565..29fc201ba041 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-open-type.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-open-type.hh @@ -148,7 +148,7 @@ struct HBUINT15 : HBUINT16 /* 32-bit unsigned integer with variable encoding. */ struct HBUINT32VAR { - unsigned get_size () const + size_t get_size () const { unsigned b0 = v[0]; if (b0 < 0x80) @@ -163,7 +163,7 @@ struct HBUINT32VAR return 5; } - static unsigned get_size (uint32_t v) + static size_t get_size (uint32_t v) { if (v < 0x80) return 1; @@ -563,7 +563,7 @@ struct UnsizedArrayOf return arrayZ[i]; } - static unsigned int get_size (unsigned int len) + static size_t get_size (unsigned int len) { return len * Type::static_size; } template operator T * () { return arrayZ; } @@ -725,7 +725,7 @@ struct ArrayOf return arrayZ[i]; } - unsigned int get_size () const + size_t get_size () const { return len.static_size + len * Type::static_size; } explicit operator bool () const { return len; } @@ -909,7 +909,7 @@ struct HeadlessArrayOf hb_barrier (); return arrayZ[i-1]; } - unsigned int get_size () const + size_t get_size () const { return lenP1.static_size + get_length () * Type::static_size; } unsigned get_length () const { return lenP1 ? lenP1 - 1 : 0; } @@ -1003,7 +1003,7 @@ struct ArrayOfM1 hb_barrier (); return arrayZ[i]; } - unsigned int get_size () const + size_t get_size () const { return lenM1.static_size + (lenM1 + 1) * Type::static_size; } template @@ -1197,7 +1197,7 @@ struct VarSizedBinSearchArrayOf } unsigned int get_length () const { return header.nUnits - last_is_terminator (); } - unsigned int get_size () const + size_t get_size () const { return header.static_size + header.nUnits * header.unitSize; } template @@ -1275,11 +1275,22 @@ struct CFFIndex if (unlikely (!serialize_header (c, +it, data_size, min_off_size))) return_trace (false); unsigned char *ret = c->allocate_size (data_size, false); if (unlikely (!ret)) return_trace (false); + unsigned remaining = data_size; for (const auto &_ : +it) { unsigned len = _.length; + if (!len) continue; + + if (unlikely (len > remaining)) { + // We have more bytes to write then the computed data size, so the size calculation + // must have encountered overflow. + return_trace (c->check_success (false, HB_SERIALIZE_ERROR_INT_OVERFLOW)); + } + + remaining -= len; + if (len <= 1) { *ret++ = *_.arrayZ; @@ -1450,7 +1461,7 @@ struct CFFIndex return hb_ubytes_t (data_base () + offset0, offset1 - offset0); } - unsigned int get_size () const + size_t get_size () const { if (count) return min_size + offSize.static_size + offset_array_size () + (offset_at (count) - 1); @@ -1948,6 +1959,7 @@ struct TupleValues return true; } + public: void skip (unsigned n) { while (n) @@ -1961,6 +1973,7 @@ struct TupleValues } } + private: template void _add_to (hb_array_t out, float scale = 1.0f) { @@ -2035,14 +2048,6 @@ struct TupleValues public: void add_to (hb_array_t out, float scale = 1.0f) { - unsigned n = out.length; - - if (scale == 0.0f) - { - skip (n); - return; - } - #ifndef HB_OPTIMIZE_SIZE // The following branch is supposed to speed things up by avoiding // the multiplication in _add_to<> if scale is 1.0f. @@ -2077,7 +2082,7 @@ struct TupleList : CFF2Index template struct Align { - unsigned get_size (const void *base) const + size_t get_size (const void *base) const { unsigned offset = (const char *) this - (const char *) base; return (alignment - offset) & (alignment - 1); diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh index ec018efe6458..8db85e4f08c9 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh @@ -201,7 +201,7 @@ struct FDSelect0 { hb_pair_t get_fd_range (hb_codepoint_t glyph) const { return {fds[glyph], glyph + 1}; } - unsigned int get_size (unsigned int num_glyphs) const + size_t get_size (unsigned int num_glyphs) const { return HBUINT8::static_size * num_glyphs; } HBUINT8 fds[HB_VAR_ARRAY]; @@ -229,7 +229,7 @@ struct FDSelect3_4_Range template struct FDSelect3_4 { - unsigned int get_size () const + size_t get_size () const { return GID_TYPE::static_size * 2 + ranges.get_size (); } bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const @@ -304,7 +304,7 @@ struct FDSelect return_trace (true); } - unsigned int get_size (unsigned int num_glyphs) const + size_t get_size (unsigned int num_glyphs) const { switch (format) { diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc index b06936f94c89..d0e078bffdbc 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc @@ -24,6 +24,10 @@ * Adobe Author(s): Michiharu Ariza */ +#ifndef HB_OT_CFF1_TABLE_CC +#define HB_OT_CFF1_TABLE_CC +#ifdef HB_OT_CFF1_TABLE_CC /* Pacify -Wunused-macros. */ + #include "hb.hh" #ifndef HB_NO_CFF @@ -609,3 +613,6 @@ bool OT::cff1::accelerator_subset_t::get_seac_components (hb_codepoint_t glyph, #endif + +#endif /* HB_OT_CFF1_TABLE_CC pacify */ +#endif /* HB_OT_CFF1_TABLE_CC guard */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.hh index 778167eeb23c..92163ac8bd37 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.hh @@ -234,7 +234,7 @@ struct Encoding return_trace (true); } - unsigned int get_size () const + size_t get_size () const { unsigned int size = min_size; switch (table_format ()) @@ -262,7 +262,7 @@ struct Encoding void get_supplement_codes (hb_codepoint_t sid, hb_vector_t &codes) const { - codes.resize (0); + codes.clear (); if (has_supplement ()) suppEncData().get_codes (sid, codes); } @@ -344,7 +344,7 @@ struct Charset0 return 0; } - static unsigned int get_size (unsigned int num_glyphs) + static size_t get_size (unsigned int num_glyphs) { assert (num_glyphs > 0); return UnsizedArrayOf::get_size (num_glyphs - 1); @@ -459,7 +459,7 @@ struct Charset1_2 { return 0; } - unsigned int get_size (unsigned int num_glyphs) const + size_t get_size (unsigned int num_glyphs) const { int glyph = (int) num_glyphs; unsigned num_ranges = 0; @@ -475,7 +475,7 @@ struct Charset1_2 { return get_size_for_ranges (num_ranges); } - static unsigned int get_size_for_ranges (unsigned int num_ranges) + static size_t get_size_for_ranges (unsigned int num_ranges) { return UnsizedArrayOf >::get_size (num_ranges); } @@ -563,7 +563,7 @@ struct Charset return_trace (true); } - unsigned int get_size (unsigned int num_glyphs) const + size_t get_size (unsigned int num_glyphs) const { switch (format) { diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc index 499bd942cde6..94d768a03084 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc @@ -24,6 +24,10 @@ * Adobe Author(s): Michiharu Ariza */ +#ifndef HB_OT_CFF2_TABLE_CC +#define HB_OT_CFF2_TABLE_CC +#ifdef HB_OT_CFF2_TABLE_CC /* Pacify -Wunused-macros. */ + #include "hb.hh" #ifndef HB_NO_OT_FONT_CFF @@ -228,3 +232,6 @@ bool OT::cff2::accelerator_t::get_path_at (hb_font_t *font, hb_codepoint_t glyph } #endif + +#endif /* HB_OT_CFF2_TABLE_CC pacify */ +#endif /* HB_OT_CFF2_TABLE_CC guard */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.hh index 7e94e38e115c..84c593362cfd 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.hh @@ -58,7 +58,7 @@ struct CFF2FDSelect return_trace (true); } - unsigned int get_size (unsigned int num_glyphs) const + size_t get_size (unsigned int num_glyphs) const { switch (format) { @@ -130,7 +130,7 @@ struct CFF2ItemVariationStore return_trace (true); } - unsigned int get_size () const { return HBUINT16::static_size + size; } + size_t get_size () const { return HBUINT16::static_size + size; } HBUINT16 size; ItemVariationStore varStore; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh index 93e9c0a26978..a3e75abef1db 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh @@ -237,8 +237,6 @@ struct CmapSubtableFormat0 struct CmapSubtableFormat4 { - - template @@ -521,9 +519,10 @@ struct CmapSubtableFormat4 struct accelerator_t { accelerator_t () {} - accelerator_t (const CmapSubtableFormat4 *subtable) { init (subtable); } + accelerator_t (const CmapSubtableFormat4 *subtable) = delete; - void init (const CmapSubtableFormat4 *subtable) + void init (const CmapSubtableFormat4 *subtable, + unsigned int subtable_data_size) { segCount = subtable->segCountX2 / 2; endCount = subtable->values.arrayZ; @@ -531,7 +530,11 @@ struct CmapSubtableFormat4 idDelta = startCount + segCount; idRangeOffset = idDelta + segCount; glyphIdArray = idRangeOffset + segCount; - glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2; + + unsigned int values_offset = 16 + 8 * segCount; + glyphIdArrayLength = subtable_data_size > values_offset + ? (subtable_data_size - values_offset) / 2 + : 0; } bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const @@ -671,23 +674,36 @@ struct CmapSubtableFormat4 unsigned int glyphIdArrayLength; }; - bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const + bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph, + unsigned int subtable_data_size) const { - accelerator_t accel (this); + accelerator_t accel; + accel.init (this, subtable_data_size); return accel.get_glyph_func (&accel, codepoint, glyph); } - void collect_unicodes (hb_set_t *out) const + bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const + { return false; } + + void collect_unicodes (hb_set_t *out, unsigned int subtable_data_size) const { - accelerator_t accel (this); + accelerator_t accel; + accel.init (this, subtable_data_size); accel.collect_unicodes (out); } + void collect_unicodes (hb_set_t *out) const + { collect_unicodes (out, length); } void collect_mapping (hb_set_t *unicodes, /* OUT */ - hb_map_t *mapping /* OUT */) const + hb_map_t *mapping, /* OUT */ + unsigned int subtable_data_size) const { - accelerator_t accel (this); + accelerator_t accel; + accel.init (this, subtable_data_size); accel.collect_mapping (unicodes, mapping); } + void collect_mapping (hb_set_t *unicodes, /* OUT */ + hb_map_t *mapping /* OUT */) const + { collect_mapping (unicodes, mapping, length); } bool sanitize (hb_sanitize_context_t *c) const { @@ -696,14 +712,9 @@ struct CmapSubtableFormat4 return_trace (false); hb_barrier (); - if (unlikely (!c->check_range (this, length))) - return_trace (false); - - return_trace (16 + 4 * (unsigned int) segCountX2 <= length); + return_trace (c->check_range (values, 2 + 4 * segCountX2)); } - - protected: HBUINT16 format; /* Format number is set to 4. */ HBUINT16 length; /* This is the length in bytes of the @@ -1485,11 +1496,14 @@ struct CmapSubtable /* Note: We intentionally do NOT implement subtable formats 2 and 8. */ bool get_glyph (hb_codepoint_t codepoint, - hb_codepoint_t *glyph) const + hb_codepoint_t *glyph, + unsigned int subtable_data_size = 0) const { switch (u.format.v) { case 0: hb_barrier (); return u.format0 .get_glyph (codepoint, glyph); - case 4: hb_barrier (); return u.format4 .get_glyph (codepoint, glyph); + case 4: hb_barrier (); return subtable_data_size + ? u.format4.get_glyph (codepoint, glyph, subtable_data_size) + : false; case 6: hb_barrier (); return u.format6 .get_glyph (codepoint, glyph); case 10: hb_barrier (); return u.format10.get_glyph (codepoint, glyph); case 12: hb_barrier (); return u.format12.get_glyph (codepoint, glyph); @@ -1498,11 +1512,17 @@ struct CmapSubtable default: return false; } } - void collect_unicodes (hb_set_t *out, unsigned int num_glyphs = UINT_MAX) const + void collect_unicodes (hb_set_t *out, + unsigned int num_glyphs = UINT_MAX, + unsigned int subtable_data_size = 0) const { switch (u.format.v) { case 0: hb_barrier (); u.format0 .collect_unicodes (out); return; - case 4: hb_barrier (); u.format4 .collect_unicodes (out); return; + case 4: hb_barrier (); if (subtable_data_size) + u.format4.collect_unicodes (out, subtable_data_size); + else + u.format4.collect_unicodes (out); + return; case 6: hb_barrier (); u.format6 .collect_unicodes (out); return; case 10: hb_barrier (); u.format10.collect_unicodes (out); return; case 12: hb_barrier (); u.format12.collect_unicodes (out, num_glyphs); return; @@ -1514,11 +1534,16 @@ struct CmapSubtable void collect_mapping (hb_set_t *unicodes, /* OUT */ hb_map_t *mapping, /* OUT */ - unsigned num_glyphs = UINT_MAX) const + unsigned num_glyphs = UINT_MAX, + unsigned int subtable_data_size = 0) const { switch (u.format.v) { case 0: hb_barrier (); u.format0 .collect_mapping (unicodes, mapping); return; - case 4: hb_barrier (); u.format4 .collect_mapping (unicodes, mapping); return; + case 4: hb_barrier (); if (subtable_data_size) + u.format4.collect_mapping (unicodes, mapping, subtable_data_size); + else + u.format4.collect_mapping (unicodes, mapping); + return; case 6: hb_barrier (); u.format6 .collect_mapping (unicodes, mapping); return; case 10: hb_barrier (); u.format10.collect_mapping (unicodes, mapping); return; case 12: hb_barrier (); u.format12.collect_mapping (unicodes, mapping, num_glyphs); return; @@ -1633,7 +1658,7 @@ struct EncodingRecord CmapSubtable *cmapsubtable = c->push (); unsigned origin_length = c->length (); cmapsubtable->serialize (c, it, format, plan, &(base+subtable)); - if (c->length () - origin_length > 0 && !c->in_error()) *objidx = c->pop_pack (); + if (c->length () > origin_length && !c->in_error()) *objidx = c->pop_pack (); else c->pop_discard (); } @@ -1662,6 +1687,7 @@ struct SubtableUnicodesCache { private: hb_blob_ptr_t base_blob; const char* base; + unsigned int table_length; hb_hashmap_t> cached_unicodes; public: @@ -1686,15 +1712,18 @@ struct SubtableUnicodesCache { hb_free (cache); } - SubtableUnicodesCache(const void* cmap_base) + SubtableUnicodesCache(const void* cmap_base, + unsigned int table_length_ = 0) : base_blob(), base ((const char*) cmap_base), + table_length (table_length_), cached_unicodes () {} SubtableUnicodesCache(hb_blob_ptr_t base_blob_) : base_blob(base_blob_), base ((const char *) base_blob.get()), + table_length (base_blob.get_length ()), cached_unicodes () {} @@ -1725,7 +1754,10 @@ struct SubtableUnicodesCache { if (unlikely (s->in_error ())) return hb_set_get_empty (); - (base+record->subtable).collect_unicodes (s); + unsigned int subtable_data_size = record->subtable < table_length + ? table_length - (unsigned int) record->subtable + : 0; + (base+record->subtable).collect_unicodes (s, UINT_MAX, subtable_data_size); if (unlikely (!cached_unicodes.set ((unsigned) ((const char *) record - base), hb::unique_ptr {s}))) return hb_set_get_empty (); @@ -1737,7 +1769,7 @@ struct SubtableUnicodesCache { }; -static inline uint_fast16_t +static inline uint16_t _hb_symbol_pua_map (unsigned codepoint) { if (codepoint <= 0x00FFu) @@ -1784,7 +1816,8 @@ struct cmap EncodingRecIter encodingrec_iter, const void *base, hb_subset_plan_t *plan, - bool drop_format_4 = false) + bool drop_format_4 = false, + unsigned int source_table_length = 0) { if (unlikely (!c->extend_min ((*this)))) return false; this->version = 0; @@ -1792,7 +1825,7 @@ struct cmap unsigned format4objidx = 0, format12objidx = 0, format14objidx = 0; auto snap = c->snapshot (); - SubtableUnicodesCache local_unicodes_cache (base); + SubtableUnicodesCache local_unicodes_cache (base, source_table_length); const SubtableUnicodesCache* unicodes_cache = &local_unicodes_cache; if (plan->accelerator && @@ -1821,7 +1854,8 @@ struct cmap encodingrec_iter, base, plan, - true); + true, + source_table_length); } } @@ -1838,9 +1872,11 @@ struct cmap } else if (format == 14) c->copy (_, it, 14u, base, plan, &format14objidx); } - c->check_assign(this->encodingRecord.len, - (c->length () - cmap::min_size)/EncodingRecord::static_size, - HB_SERIALIZE_ERROR_INT_OVERFLOW); + unsigned length = c->length (); + unsigned available = length > cmap::min_size ? length - cmap::min_size : 0; + c->check_assign(this->encodingRecord.len, + available / EncodingRecord::static_size, + HB_SERIALIZE_ERROR_INT_OVERFLOW); // Fail if format 4 was dropped and there is no cmap12. return !drop_format_4 || format12objidx; @@ -1955,7 +1991,9 @@ struct cmap it, encodingrec_iter, this, - c->plan)); + c->plan, + false, + c->source_blob->length)); } const CmapSubtable *find_best_subtable (bool *symbol = nullptr, @@ -2034,32 +2072,60 @@ struct cmap this->get_glyph_data = subtable; #ifndef HB_NO_CMAP_LEGACY_SUBTABLES + bool is_format4 = subtable->u.format.v == 4; + auto set_format4_getter = [this] (bool (*func) (const void *, + hb_codepoint_t, + hb_codepoint_t *)) + { + this->format4_accel.init (&this->subtable->u.format4, + get_subtable_data_size (this->subtable)); + this->get_glyph_data = &this->format4_accel; + this->get_glyph_funcZ = func; + }; if (unlikely (symbol)) { switch ((unsigned) face->table.OS2->get_font_page ()) { case OS2::font_page_t::FONT_PAGE_NONE: - this->get_glyph_funcZ = get_glyph_from_symbol; + if (is_format4) + set_format4_getter (get_glyph_from_symbol); + else + this->get_glyph_funcZ = get_glyph_from_symbol; break; #ifndef HB_NO_OT_SHAPER_ARABIC_FALLBACK case OS2::font_page_t::FONT_PAGE_SIMP_ARABIC: - this->get_glyph_funcZ = get_glyph_from_symbol; + if (is_format4) + set_format4_getter (get_glyph_from_symbol); + else + this->get_glyph_funcZ = get_glyph_from_symbol; break; case OS2::font_page_t::FONT_PAGE_TRAD_ARABIC: - this->get_glyph_funcZ = get_glyph_from_symbol; + if (is_format4) + set_format4_getter (get_glyph_from_symbol); + else + this->get_glyph_funcZ = get_glyph_from_symbol; break; #endif default: - this->get_glyph_funcZ = get_glyph_from; + if (is_format4) + set_format4_getter (get_glyph_from); + else + this->get_glyph_funcZ = get_glyph_from; break; } } else if (unlikely (macroman)) { - this->get_glyph_funcZ = get_glyph_from_macroman; + if (is_format4) + set_format4_getter (get_glyph_from_macroman); + else + this->get_glyph_funcZ = get_glyph_from_macroman; } else if (unlikely (mac)) { - this->get_glyph_funcZ = get_glyph_from_ascii; + if (is_format4) + set_format4_getter (get_glyph_from_ascii); + else + this->get_glyph_funcZ = get_glyph_from_ascii; } else #endif @@ -2074,7 +2140,8 @@ struct cmap break; case 4: { - this->format4_accel.init (&subtable->u.format4); + this->format4_accel.init (&subtable->u.format4, + get_subtable_data_size (subtable)); this->get_glyph_data = &this->format4_accel; this->get_glyph_funcZ = this->format4_accel.get_glyph_func; break; @@ -2155,10 +2222,10 @@ struct cmap } void collect_unicodes (hb_set_t *out, unsigned int num_glyphs) const - { subtable->collect_unicodes (out, num_glyphs); } + { subtable->collect_unicodes (out, num_glyphs, get_subtable_data_size (subtable)); } void collect_mapping (hb_set_t *unicodes, hb_map_t *mapping, unsigned num_glyphs = UINT_MAX) const - { subtable->collect_mapping (unicodes, mapping, num_glyphs); } + { subtable->collect_mapping (unicodes, mapping, num_glyphs, get_subtable_data_size (subtable)); } void collect_variation_selectors (hb_set_t *out) const { subtable_uvs->collect_variation_selectors (out); } void collect_variation_unicodes (hb_codepoint_t variation_selector, @@ -2169,7 +2236,7 @@ struct cmap typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph); - typedef uint_fast16_t (*hb_pua_remap_func_t) (unsigned); + typedef uint16_t (*hb_pua_remap_func_t) (unsigned); template HB_INTERNAL static bool get_glyph_from (const void *obj, @@ -2217,6 +2284,21 @@ struct cmap return c && typed_obj->get_glyph (c, glyph); } + unsigned int get_subtable_data_size (const CmapSubtable *subtable) const + { + unsigned int table_length = this->table.get_length (); + uintptr_t table_start = (uintptr_t) (const void *) this->table.get (); + uintptr_t subtable_addr = (uintptr_t) (const void *) subtable; + if (unlikely (subtable_addr < table_start)) + return 0; + + uintptr_t subtable_offset = subtable_addr - table_start; + if (unlikely (subtable_offset >= table_length)) + return 0; + + return table_length - (unsigned int) subtable_offset; + } + private: hb_nonnull_ptr_t subtable; hb_nonnull_ptr_t subtable_uvs; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-color.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-color.cc index 2d9b8e7cad2d..29f038a472d6 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-color.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-color.cc @@ -35,7 +35,9 @@ #include "OT/Color/COLR/COLR.hh" #include "OT/Color/CPAL/CPAL.hh" #include "OT/Color/sbix/sbix.hh" +#ifndef HB_NO_SVG #include "OT/Color/svg/svg.hh" +#endif /** @@ -274,6 +276,7 @@ hb_ot_color_glyph_get_layers (hb_face_t *face, * SVG */ +#ifndef HB_NO_SVG /** * hb_ot_color_has_svg: * @face: #hb_face_t to work upon. @@ -290,6 +293,70 @@ hb_ot_color_has_svg (hb_face_t *face) return face->table.SVG->has_data (); } +/** + * hb_ot_color_get_svg_document_count: + * @face: #hb_face_t to work upon. + * + * Gets the number of SVG documents in the face `SVG` table. + * + * Return value: number of SVG documents in the face. + * + * Since: 12.1.0 + */ +unsigned int +hb_ot_color_get_svg_document_count (hb_face_t *face) +{ + return face->table.SVG->get_document_count (); +} + +/** + * hb_ot_color_glyph_get_svg_document_index: + * @face: #hb_face_t to work upon. + * @glyph: glyph ID to query. + * @svg_document_index: (out) (nullable): output SVG document index. + * + * Gets the `SVG`-table document index associated with a glyph. + * + * Return value: `true` if @glyph maps to an SVG document, `false` otherwise. + * + * Since: 12.1.0 + */ +hb_bool_t +hb_ot_color_glyph_get_svg_document_index (hb_face_t *face, + hb_codepoint_t glyph, + unsigned int *svg_document_index) +{ + unsigned doc_index = 0; + hb_bool_t ret = face->table.SVG->get_glyph_document_index (glyph, &doc_index); + if (ret && svg_document_index) + *svg_document_index = doc_index; + return ret; +} + +/** + * hb_ot_color_get_svg_document_glyph_range: + * @face: #hb_face_t to work upon. + * @svg_document_index: SVG document index. + * @start_glyph_id: (out) (nullable): output start glyph ID. + * @end_glyph_id: (out) (nullable): output end glyph ID. + * + * Gets the glyph range covered by an `SVG`-table document index. + * + * Return value: `true` if @svg_document_index is valid, `false` otherwise. + * + * Since: 13.0.0 + */ +hb_bool_t +hb_ot_color_get_svg_document_glyph_range (hb_face_t *face, + unsigned int svg_document_index, + hb_codepoint_t *start_glyph_id, + hb_codepoint_t *end_glyph_id) +{ + return face->table.SVG->get_document_glyph_range (svg_document_index, + start_glyph_id, + end_glyph_id); +} + /** * hb_ot_color_glyph_reference_svg: * @face: #hb_face_t to work upon @@ -308,6 +375,7 @@ hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph) { return face->table.SVG->reference_blob_for_glyph (glyph); } +#endif /* diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-color.h b/src/java.desktop/share/native/libharfbuzz/hb-ot-color.h index 7fa810bd96f2..ed898eb44df6 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-color.h +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-color.h @@ -136,6 +136,20 @@ hb_ot_color_glyph_has_paint (hb_face_t *face, HB_EXTERN hb_bool_t hb_ot_color_has_svg (hb_face_t *face); +HB_EXTERN unsigned int +hb_ot_color_get_svg_document_count (hb_face_t *face); + +HB_EXTERN hb_bool_t +hb_ot_color_glyph_get_svg_document_index (hb_face_t *face, + hb_codepoint_t glyph, + unsigned int *svg_document_index /* OUT */); + +HB_EXTERN hb_bool_t +hb_ot_color_get_svg_document_glyph_range (hb_face_t *face, + unsigned int svg_document_index, + hb_codepoint_t *start_glyph_id, /* OUT */ + hb_codepoint_t *end_glyph_id /* OUT */); + HB_EXTERN hb_blob_t * hb_ot_color_glyph_reference_svg (hb_face_t *face, hb_codepoint_t glyph); diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-face-table-list.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-face-table-list.hh index afc8aa476e29..9047b2880ab1 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-face-table-list.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-face-table-list.hh @@ -140,8 +140,10 @@ HB_OT_ACCELERATOR (OT, COLR) HB_OT_CORE_TABLE (OT, CPAL) HB_OT_ACCELERATOR (OT, CBDT) HB_OT_ACCELERATOR (OT, sbix) +#ifndef HB_NO_SVG HB_OT_ACCELERATOR (OT, SVG) #endif +#endif /* OpenType math. */ #ifndef HB_NO_MATH diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc index 8add9209f376..997fbe5be04a 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc @@ -897,31 +897,29 @@ hb_ot_draw_glyph_or_fail (hb_font_t *font, { const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; hb_draw_session_t draw_session {draw_funcs, draw_data}; - bool ret = false; OT::hb_scalar_cache_t *gvar_cache = nullptr; +#ifndef HB_NO_VAR if (font->num_coords) { ot_font->check_serial (font); gvar_cache = ot_font->draw.acquire_gvar_cache (*ot_font->ot_face->gvar); } +#endif + HB_SCOPE_GUARD (ot_font->draw.release_gvar_cache (gvar_cache)); #ifndef HB_NO_VAR_COMPOSITES - if (font->face->table.VARC->get_path (font, glyph, draw_session)) { ret = true; goto done; } + if (font->face->table.VARC->get_path (font, glyph, draw_session)) return true; #endif // Keep the following in synch with VARC::get_path_at() - if (font->face->table.glyf->get_path (font, glyph, draw_session, gvar_cache)) { ret = true; goto done; } + if (font->face->table.glyf->get_path (font, glyph, draw_session, gvar_cache)) return true; #ifndef HB_NO_CFF - if (font->face->table.cff2->get_path (font, glyph, draw_session)) { ret = true; goto done; } - if (font->face->table.cff1->get_path (font, glyph, draw_session)) { ret = true; goto done; } + if (font->face->table.cff2->get_path (font, glyph, draw_session)) return true; + if (font->face->table.cff1->get_path (font, glyph, draw_session)) return true; #endif -done: - - ot_font->draw.release_gvar_cache (gvar_cache); - - return ret; + return false; } #endif @@ -937,7 +935,9 @@ hb_ot_paint_glyph_or_fail (hb_font_t *font, { #ifndef HB_NO_COLOR if (font->face->table.COLR->paint_glyph (font, glyph, paint_funcs, paint_data, palette, foreground)) return true; +#ifndef HB_NO_SVG if (font->face->table.SVG->paint_glyph (font, glyph, paint_funcs, paint_data)) return true; +#endif #ifndef HB_NO_OT_FONT_BITMAP if (font->face->table.CBDT->paint_glyph (font, glyph, paint_funcs, paint_data)) return true; if (font->face->table.sbix->paint_glyph (font, glyph, paint_funcs, paint_data)) return true; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-hdmx-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-hdmx-table.hh index 918cf32dcb5f..77c2894bbc83 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-hdmx-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-hdmx-table.hh @@ -41,7 +41,7 @@ namespace OT { struct DeviceRecord { - static unsigned int get_size (unsigned count) + static size_t get_size (unsigned count) { return hb_ceil_to_4 (min_size + count * HBUINT8::static_size); } template struct KernSubTable { - unsigned int get_size () const { return u.header.length; } + size_t get_size () const { return u.header.length; } unsigned int get_type () const { return u.header.format; } int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh index dcacc9cb86c3..17971e770c17 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh @@ -637,7 +637,7 @@ struct FeatureParamsCharacterVariants return characters.len; } - unsigned get_size () const + size_t get_size () const { return min_size + characters.len * HBUINT24::static_size; } void collect_name_ids (hb_set_t *nameids_to_retain /* OUT */) const @@ -1272,7 +1272,7 @@ struct Lookup TSubTable& get_subtable (unsigned int i) { return this+get_subtables ()[i]; } - unsigned int get_size () const + size_t get_size () const { const HBUINT16 &markFilteringSet = StructAfter (subTable); if (lookupFlag & LookupFlag::UseMarkFilteringSet) @@ -2543,13 +2543,13 @@ struct SparseVarRegionAxis struct hb_scalar_cache_t { private: - static constexpr unsigned STATIC_LENGTH = 16; + static constexpr unsigned STATIC_LENGTH = 128; static constexpr int INVALID = INT_MIN; static constexpr float MULTIPLIER = 1 << ((sizeof (int) * 8) - 2); static constexpr float DIVISOR = 1.f / MULTIPLIER; public: - hb_scalar_cache_t () : length (STATIC_LENGTH) { clear (); } + hb_scalar_cache_t () {} hb_scalar_cache_t (const hb_scalar_cache_t&) = delete; hb_scalar_cache_t (hb_scalar_cache_t&&) = delete; @@ -2561,8 +2561,9 @@ struct hb_scalar_cache_t { if (!count) return (hb_scalar_cache_t *) &Null(hb_scalar_cache_t); - if (scratch_cache && count <= scratch_cache->length) + if (scratch_cache && count <= STATIC_LENGTH) { + scratch_cache->length = count; scratch_cache->clear (); return scratch_cache; } @@ -2790,7 +2791,7 @@ struct VarRegionList return !regions.in_error (); } - unsigned int get_size () const { return min_size + VarRegionAxis::static_size * axisCount * regionCount; } + size_t get_size () const { return min_size + VarRegionAxis::static_size * axisCount * regionCount; } public: HBUINT16 axisCount; @@ -2870,7 +2871,7 @@ struct VarData unsigned int get_row_size () const { return (wordCount () + regionIndices.len) * (longWords () ? 2 : 1); } - unsigned int get_size () const + size_t get_size () const { return min_size - regionIndices.min_size + regionIndices.get_size () + itemCount * get_row_size (); @@ -2970,7 +2971,9 @@ struct VarData } if (unlikely (!c->extend_min (this))) return_trace (false); - itemCount = row_count; + if (unlikely (!c->check_assign (itemCount, row_count, + HB_SERIALIZE_ERROR_INT_OVERFLOW))) + return_trace (false); int min_threshold = has_long ? -65536 : -128; int max_threshold = has_long ? +65535 : +127; @@ -3240,7 +3243,7 @@ struct VarData struct MultiVarData { - unsigned int get_size () const + size_t get_size () const { return min_size - regionIndices.min_size + regionIndices.get_size () + StructAfter (regionIndices).get_size (); @@ -3256,12 +3259,24 @@ struct MultiVarData auto values_iter = deltaSets.fetcher (inner); unsigned regionCount = regionIndices.len; + unsigned skip = 0; for (unsigned regionIndex = 0; regionIndex < regionCount; regionIndex++) { float scalar = regions.evaluate (regionIndices.arrayZ[regionIndex], coords, coord_count, cache); - values_iter.add_to (out, scalar); + // We skip lazily. Helps with the tail end. + if (scalar == 0.0f) + skip += out.length; + else + { + if (skip) + { + values_iter.skip (skip); + skip = 0; + } + values_iter.add_to (out, scalar); + } } } @@ -3623,7 +3638,7 @@ struct DeltaSetIndexMapFormat01 { friend struct DeltaSetIndexMap; - unsigned get_size () const + size_t get_size () const { return min_size + mapCount * get_width (); } private: @@ -4041,7 +4056,7 @@ struct ConditionValue bool evaluate (const int *coords, unsigned int coord_len, Instancer *instancer) const { - signed value = defaultValue; + float value = defaultValue; value += (*instancer)[varIdx]; return value > 0; } @@ -4789,7 +4804,7 @@ struct HintingDevice public: - unsigned int get_size () const + size_t get_size () const { unsigned int f = deltaFormat; if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * HBUINT16::static_size; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh index 05bbf3395bfd..a2a45af9e760 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh @@ -743,6 +743,10 @@ struct hb_ot_apply_context_t : hb_vector_t match_positions; uint32_t stack_match_positions[8]; +#ifndef HB_NO_BUFFER_MESSAGE + hb_buffer_t::changed_func_t orig_changed_func = nullptr; + void *orig_changed_data = nullptr; +#endif hb_ot_apply_context_t (unsigned int table_index_, hb_font_t *font_, @@ -773,6 +777,30 @@ struct hb_ot_apply_context_t : { init_iters (); match_positions.set_storage (stack_match_positions); + +#ifndef HB_NO_BUFFER_MESSAGE + if (buffer->messaging ()) + { + assert (buffer->changed_func == nullptr || + buffer->changed_func == buffer_changed_trampoline); + orig_changed_func = buffer->changed_func; + orig_changed_data = buffer->changed_data; + buffer->changed_func = buffer_changed_trampoline; + buffer->changed_data = this; + } +#endif + } + ~hb_ot_apply_context_t () + { +#ifndef HB_NO_BUFFER_MESSAGE + if (buffer->messaging ()) + { + assert (buffer->changed_func == buffer_changed_trampoline); + assert (buffer->changed_data == this); + buffer->changed_func = orig_changed_func; + buffer->changed_data = orig_changed_data; + } +#endif } void init_iters () @@ -801,6 +829,18 @@ struct hb_ot_apply_context_t : return buffer->random_state; } + static void buffer_changed_trampoline (hb_buffer_t *buffer HB_UNUSED, void *user_data) + { + ((hb_ot_apply_context_t *) user_data)->buffer_changed (); + } + void buffer_changed () + { + buffer->update_digest (); + if (likely (has_glyph_classes)) + for (unsigned i = 0; i < buffer->len; i++) + _set_glyph_class_props (buffer->info[i]); + } + HB_ALWAYS_INLINE HB_HOT bool match_properties_mark (const hb_glyph_info_t *info, @@ -870,8 +910,7 @@ struct hb_ot_apply_context_t : props |= HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED; if (likely (has_glyph_classes)) { - props &= HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE; - _hb_glyph_info_set_glyph_props (&buffer->cur(), props | gdef_accel.get_glyph_props (glyph_index)); + _set_glyph_class_props (buffer->cur(), props, glyph_index); } else if (class_guess) { @@ -881,6 +920,19 @@ struct hb_ot_apply_context_t : else _hb_glyph_info_set_glyph_props (&buffer->cur(), props); } + void _set_glyph_class_props (hb_glyph_info_t &info, + unsigned int props, + hb_codepoint_t glyph_index) + { + props &= HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE; + _hb_glyph_info_set_glyph_props (&info, props | gdef_accel.get_glyph_props (glyph_index)); + } + void _set_glyph_class_props (hb_glyph_info_t &info) + { + _set_glyph_class_props (info, + _hb_glyph_info_get_glyph_props (&info), + info.codepoint); + } void replace_glyph (hb_codepoint_t glyph_index) { @@ -1813,23 +1865,25 @@ static inline void apply_lookup (hb_ot_apply_context_t *c, if (buffer->have_output) c->buffer->sync_so_far (); c->buffer->message (c->font, - "recursing to lookup %u at %u", + "start recursing to lookup %u at %u", (unsigned) lookupRecord[i].lookupListIndex, buffer->idx); } - if (!c->recurse (lookupRecord[i].lookupListIndex)) - continue; + bool ret = c->recurse (lookupRecord[i].lookupListIndex); if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ()) { if (buffer->have_output) c->buffer->sync_so_far (); c->buffer->message (c->font, - "recursed to lookup %u", + "end recursing to lookup %u", (unsigned) lookupRecord[i].lookupListIndex); } + if (!ret) + continue; + unsigned int new_len = buffer->backtrack_len () + buffer->lookahead_len (); int delta = new_len - orig_len; @@ -4590,7 +4644,7 @@ struct GSUBGPOSVersion1_2 public: DEFINE_SIZE_MIN (4 + 3 * Types::size); - unsigned int get_size () const + size_t get_size () const { return min_size + (version.to_int () >= 0x00010001u ? featureVars.static_size : 0); @@ -4672,7 +4726,7 @@ struct GSUBGPOSVersion1_2 struct GSUBGPOS { - unsigned int get_size () const + size_t get_size () const { switch (u.version.major) { case 1: hb_barrier (); return u.version1.get_size (); diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc index c73e4dc4b6d7..5f0bd1bce848 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc @@ -2072,21 +2072,25 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const { GSUBProxy proxy (font->face); + char tag[5] = {0}; + hb_tag_to_string (chosen_script[0], tag); if (buffer->messaging () && - !buffer->message (font, "start table GSUB script tag '%c%c%c%c'", HB_UNTAG (chosen_script[0]))) return; + !buffer->message (font, "start table GSUB script tag '%s'", tag)) return; apply (proxy, plan, font, buffer); if (buffer->messaging ()) - (void) buffer->message (font, "end table GSUB script tag '%c%c%c%c'", HB_UNTAG (chosen_script[0])); + (void) buffer->message (font, "end table GSUB script tag '%s'", tag); } void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const { GPOSProxy proxy (font->face); + char tag[5] = {0}; + hb_tag_to_string (chosen_script[0], tag); if (buffer->messaging () && - !buffer->message (font, "start table GPOS script tag '%c%c%c%c'", HB_UNTAG (chosen_script[1]))) return; + !buffer->message (font, "start table GPOS script tag '%s'", tag)) return; apply (proxy, plan, font, buffer); if (buffer->messaging ()) - (void) buffer->message (font, "end table GPOS script tag '%c%c%c%c'", HB_UNTAG (chosen_script[1])); + (void) buffer->message (font, "end table GPOS script tag '%s'", tag); } void diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh index 24e9c9703531..a044b7f9c0cf 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh @@ -344,7 +344,7 @@ struct OS2 font_page_t get_font_page () const { return (font_page_t) (version == 0 ? fsSelection & 0xFF00 : 0); } - unsigned get_size () const + size_t get_size () const { unsigned result = min_size; if (version >= 1) result += v1X.get_size (); diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh index 2c4c6c046636..1de8864c4889 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh @@ -194,7 +194,11 @@ struct post for (unsigned int i = 0; i < count; i++) gids[i] = i; - hb_qsort (gids, count, sizeof (gids[0]), cmp_gids, (void *) this); + auto thiz = this; + hb_array_t (gids, count) + .qsort ([thiz] (const uint16_t &a, const uint16_t &b) { + return thiz->find_glyph_name (a).cmp (thiz->find_glyph_name (b)) > 0; + }); if (unlikely (!gids_sorted_by_name.cmpexch (nullptr, gids))) { @@ -235,14 +239,6 @@ struct post return 0; } - static int cmp_gids (const void *pa, const void *pb, void *arg) - { - const accelerator_t *thiz = (const accelerator_t *) arg; - uint16_t a = * (const uint16_t *) pa; - uint16_t b = * (const uint16_t *) pb; - return thiz->find_glyph_name (b).cmp (thiz->find_glyph_name (a)); - } - static int cmp_key (const void *pk, const void *po, void *arg) { const accelerator_t *thiz = (const accelerator_t *) arg; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc index 508ed6a50766..e97507480a43 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc @@ -322,6 +322,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, /* First round, decompose */ bool all_simple = true; + if (buffer->message (font, "start decompose")) { buffer->clear_output (); count = buffer->len; @@ -364,6 +365,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, } while (buffer->idx < count && buffer->successful); buffer->sync (); + (void) buffer->message (font, "end decompose"); } @@ -420,7 +422,8 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, if (!all_simple && buffer->successful && (mode == HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS || - mode == HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT)) + mode == HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT) && + buffer->message (font, "start compose")) { /* As noted in the comment earlier, we don't try to combine * ccc=0 chars with their previous Starter. */ @@ -470,6 +473,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan, starter = buffer->out_len - 1; } buffer->sync (); + (void) buffer->message (font, "end compose"); } } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc index 69b188f7aa34..9d792cc7f11f 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc @@ -580,12 +580,8 @@ hb_form_clusters (hb_buffer_t *buffer) if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_CONTINUATIONS)) return; - if (HB_BUFFER_CLUSTER_LEVEL_IS_GRAPHEMES (buffer->cluster_level)) - foreach_grapheme (buffer, start, end) - buffer->merge_clusters (start, end); - else - foreach_grapheme (buffer, start, end) - buffer->unsafe_to_break (start, end); + foreach_grapheme (buffer, start, end) + buffer->merge_grapheme_clusters (start, end); } static void @@ -1332,4 +1328,20 @@ hb_ot_shape_glyphs_closure (hb_font_t *font, } +/** + * hb_ot_shape_get_buffer_format_serial: + * + * Returns the serial number of the current internal buffer format. + * See #HB_OT_SHAPE_BUFFER_FORMAT_SERIAL for more information. + * + * Return value: The current buffer-format serial number. + * + * Since: 13.2.0 + **/ +unsigned int +hb_ot_shape_get_buffer_format_serial (void) +{ + return HB_OT_SHAPE_BUFFER_FORMAT_SERIAL; +} + #endif diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h index 1732831b1325..7aaf5ed5c9c0 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h @@ -54,6 +54,21 @@ hb_ot_shape_plan_get_feature_tags (hb_shape_plan_t *shape_plan, unsigned int *tag_count, /* IN/OUT */ hb_tag_t *tags /* OUT */); +/** + * HB_OT_SHAPE_BUFFER_FORMAT_SERIAL: + * + * The serial number of the current internal buffer format. + * + * The serial number will increase when internal #hb_glyph_info_t and + * #hb_glyph_position_t members change their format. + * + * Since: 13.2.0 + */ +#define HB_OT_SHAPE_BUFFER_FORMAT_SERIAL 1 + +HB_EXTERN unsigned int +hb_ot_shape_get_buffer_format_serial (void); + HB_END_DECLS #endif /* HB_OT_SHAPE_H */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-pua.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-pua.hh index ba86772f849a..7464e5d8a3b7 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-pua.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-pua.hh @@ -9,41 +9,43 @@ #ifndef HB_OT_SHAPER_ARABIC_PUA_HH #define HB_OT_SHAPER_ARABIC_PUA_HH -static const uint8_t -_hb_arabic_u8[464] = +#include "hb.hh" + +#include + +static const uint8_t _hb_arabic_pua_u8[453]= { - 84, 86, 85, 85, 85, 85, 85,213, 16, 34, 34, 34, 34, 34, 35, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 36, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 82, 16, 0, 0, 0, 0, 1, 2, 3, 4, - 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 7, - 0, 0, 8, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 0, 0, 0, 22, 0, 23, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 16, 34, 34, 34, 35, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 66, 16, 50, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68,101, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 71, 68, 68, 68, 68, 68, 68, 68,152,186, 76, 77, 68,254, 16, 50, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 5, 6, - 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 10, 0, - 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, 3, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 0, 7, 0, 0, 8, 0, 0, 0, 9, 0, 0, + 10, 0, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, + 22, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 33, + 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 33, 67, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,101, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0,152, + 186, 12, 13, 0,254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, + 5, 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 8, 9, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, + 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, + 0, 0, 13, 0, 0, 0, 0, 0, 14, 0, 0, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 1, 24, 25, 26, 27, 28, 1, 1, 29, 30, 31, 32, + 33, 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 36, 37, 38, 0, 0, 0, 0, 0, 0, + 0, 39, 0, 0, 40, 41, 42, 0, 43, 44, 0, 0, 45, 46, 0, 47, + 48, 49, 0, 0, 0, 0, 50, 0, 0, 51, 52, 0, 53, 54, 55, 56, + 57, 58, 0, 0, 0, 0, 0, 59, 60, 61, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 13, 0, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 23, 23, 29, 30, 31, 32, 33, 0, 0, 0, 0, - 0, 0, 0, 34, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 36, 37, 38, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 40, - 41, 42, 0, 43, 44, 0, 0, 45, 46, 0, 47, 48, 49, 0, 0, 0, - 0, 50, 0, 0, 51, 52, 0, 53, 54, 55, 56, 57, 58, 0, 0, 0, - 0, 0, 59, 60, 61, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 66, - 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 0, 65, 0, 0, 66, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, }; -static const uint16_t -_hb_arabic_u16[720] = +static const uint16_t _hb_arabic_pua_u16[717]= { 0, 0, 0, 0, 0, 0, 0, 0,61728,61729,61730, 0, 0,61733, 0, 0, 61736,61737,61738,61739,61790,61741,61742,61743,61872,61873,61874,61875,61876,61877,61878,61879, @@ -65,52 +67,46 @@ _hb_arabic_u16[720] = 61808,61813,61813,61811,61812,61816,61816,61814,61815,61818,61818,61817,61817,61820,61820,61819, 61819,61822,61822,61821,61821,61921,61921,61823,61823,61860,61859,61857,61858,61861,61861,61868, 61867,61864,61863,61862,61862,61888,61889,61886,61887,61890,61891,61885,61884, 0, 0, 0, - 0, 0, 0, 0,61984,61985,61986, 0, 0,61989, 0, 0,61992,61993,61994,61995, - 62046,61997,61998,61999, 0, 0,62010,62011, 0,62013, 0,62015, 0, 0, 0,62043, - 0,62045, 0, 0, 0, 0, 0,61987, 0, 0, 0,61988, 0, 0, 0,61990, - 0, 0, 0,61991,61996, 0, 0, 0, 0, 0, 0,62011, 0, 0, 0,62015, - 0,62165,62021,62019,62170,62023,62169,62017,62028,62161,62032,62036,62040,62048,62052,62053, - 62055,62057,62059,62064,62068,62072,62078,62114,62115,62122,62126,61952,61952,61952,61952,61952, - 62047,62130,62134,62138,62142,62146,62150,62154,62155,62164,62160,62183,62184,62187,62180,62181, - 62186,62185,62182,61952,61952,61952,61952, 0,62000,62001,62002,62003,62004,62005,62006,62007, - 62008,62009, 0,62046,62046, 0, 0, 0,61964,61965,61966,61967,62012,62014, 0, 0, - 61954, 0,61981, 0, 0, 0,61955, 0,61982, 0,61956, 0, 0, 0,62111, 0, - 0, 0, 0,61970,61971,61972,61957, 0,61980, 0, 0, 0, 0, 0,61958, 0, - 61983, 0, 0, 0, 0, 0,62191, 0,62188,62189,62192, 0, 0, 0,61973, 0, - 0,62098, 0, 0,61974, 0, 0,62099, 0, 0,62101, 0, 0,61975, 0, 0, - 62100, 0, 0, 0,62080,62081,62082,62102, 0,62083,62084,62085,62103, 0, 0, 0, - 62106, 0,62107, 0,62108, 0, 0, 0,61976, 0, 0, 0, 0,62086,62087,62088, - 62109,61978,62089,62090,62091,62110,62093,62094, 0,62104, 0, 0, 0, 0,62095,62096, - 62097,62105, 0, 0,61977, 0, 0, 0, 0, 0,62075,62077,61968, 0, 0, 0, - 0,62021,62022,62019,62020,62170,62171,62023,62024,62169,62168,62166,62167,62017,62018,62028, - 62027,62025,62026,62161,62162,62032,62031,62029,62030,62036,62035,62033,62034,62040,62039,62037, - 62038,62048,62044,62041,62042,62052,62051,62049,62050,62053,62054,62055,62056,62057,62058,62059, - 62060,62064,62063,62061,62062,62068,62067,62065,62066,62072,62071,62069,62070,62078,62076,62073, - 62074,62114,62113,62079,62193,62118,62117,62115,62116,62122,62121,62119,62120,62126,62125,62123, - 62124,62130,62129,62127,62128,62134,62133,62131,62132,62138,62137,62135,62136,62142,62141,62139, - 62140,62146,62145,62143,62144,62150,62149,62147,62148,62154,62153,62151,62152,62155,62156,62164, - 62163,62160,62159,62157,62158,62176,62177,62174,62175,62178,62179,62172,62173, 0, 0, 0, + 0,61952,61952,61952,61952,61984,61985,61986, 0, 0,61989, 0, 0,61992,61993,61994, + 61995,62046,61997,61998,61999, 0, 0,62010,62011, 0,62013, 0,62015, 0, 0, 0, + 62043, 0,62045, 0, 0, 0, 0, 0,61987, 0, 0, 0,61988, 0, 0, 0, + 61990, 0, 0, 0,61991,61996, 0, 0, 0, 0, 0, 0,62011, 0, 0, 0, + 62015, 0,62165,62021,62019,62170,62023,62169,62017,62028,62161,62032,62036,62040,62048,62052, + 62053,62055,62057,62059,62064,62068,62072,62078,62114,62115,62122,62126,61952,62047,62130,62134, + 62138,62142,62146,62150,62154,62155,62164,62160,62183,62184,62187,62180,62181,62186,62185,62182, + 61952,61952,61952,61952, 0,62000,62001,62002,62003,62004,62005,62006,62007,62008,62009, 0, + 62046,62046, 0, 0, 0,61964,61965,61966,61967,62012,62014, 0, 0,61954, 0,61981, + 0, 0, 0,61955, 0,61982, 0,61956, 0, 0, 0,62111, 0, 0, 0, 0, + 61970,61971,61972,61957, 0,61980, 0, 0, 0, 0, 0,61958, 0,61983, 0, 0, + 0, 0, 0,62191, 0,62188,62189,62192, 0, 0, 0,61973, 0, 0,62098, 0, + 0,61974, 0, 0,62099, 0, 0,62101, 0, 0,61975, 0, 0,62100, 0, 0, + 0,62080,62081,62082,62102, 0,62083,62084,62085,62103, 0, 0, 0,62106, 0,62107, + 0,62108, 0, 0, 0,61976, 0, 0, 0, 0,62086,62087,62088,62109,61978,62089, + 62090,62091,62110,62093,62094, 0,62104, 0, 0, 0, 0,62095,62096,62097,62105, 0, + 0,61977, 0, 0, 0, 0, 0,62075,62077,61968, 0, 0, 0, 0,62021,62022, + 62019,62020,62170,62171,62023,62024,62169,62168,62166,62167,62017,62018,62028,62027,62025,62026, + 62161,62162,62032,62031,62029,62030,62036,62035,62033,62034,62040,62039,62037,62038,62048,62044, + 62041,62042,62052,62051,62049,62050,62053,62054,62055,62056,62057,62058,62059,62060,62064,62063, + 62061,62062,62068,62067,62065,62066,62072,62071,62069,62070,62078,62076,62073,62074,62114,62113, + 62079,62193,62118,62117,62115,62116,62122,62121,62119,62120,62126,62125,62123,62124,62130,62129, + 62127,62128,62134,62133,62131,62132,62138,62137,62135,62136,62142,62141,62139,62140,62146,62145, + 62143,62144,62150,62149,62147,62148,62154,62153,62151,62152,62155,62156,62164,62163,62160,62159, + 62157,62158,62176,62177,62174,62175,62178,62179,62172,62173, 0, 0, 0, }; -static inline unsigned -_hb_arabic_b2 (const uint8_t* a, unsigned i) -{ - return (a[i>>2]>>((i&3u)<<1))&3u; -} -static inline unsigned -_hb_arabic_b4 (const uint8_t* a, unsigned i) +static inline uint8_t _hb_arabic_pua_b4 (const uint8_t* a, unsigned i) { - return (a[i>>1]>>((i&1u)<<2))&15u; + return (a[i>>1]>>((i&1)<<2))&15; } -static inline uint_fast16_t -_hb_arabic_pua_simp_map (unsigned u) +static inline uint16_t _hb_arabic_pua_simp_map (unsigned u) { - return u<65277u?_hb_arabic_u16[((_hb_arabic_u8[40+(((_hb_arabic_b4(8+_hb_arabic_u8,((_hb_arabic_b2(_hb_arabic_u8,u>>3>>4>>4))<<4)+((u>>3>>4)&15u)))<<4)+((u>>3)&15u))])<<3)+((u)&7u)]:0; + /* packtab: [2^2,2^4,2^4,2^3] */ + return u<65277u ? (uint16_t)(_hb_arabic_pua_u16[((_hb_arabic_pua_u8[31u+((_hb_arabic_pua_b4(_hb_arabic_pua_u8,((((13835058055282164225ULL>>((((((((u)>>3))>>4))>>4))<<1))&3))<<4)+((((((u)>>3))>>4))&15)))<<4)+((((u)>>3))&15)])<<3)+((u)&7)]) : 0; } -static inline uint_fast16_t -_hb_arabic_pua_trad_map (unsigned u) +static inline uint16_t _hb_arabic_pua_trad_map (unsigned u) { - return u<65277u?_hb_arabic_u16[320+(((_hb_arabic_u8[208+(((_hb_arabic_b4(168+_hb_arabic_u8,((_hb_arabic_b4(136+_hb_arabic_u8,u>>2>>4>>4))<<4)+((u>>2>>4)&15u)))<<4)+((u>>2)&15u))])<<2)+((u)&3u))]:0; + /* packtab: [2^4,2^4,2^4,2^2] */ + return u<65277u ? (uint16_t)(_hb_arabic_pua_u16[317u+((_hb_arabic_pua_u8[197u+((_hb_arabic_pua_b4(_hb_arabic_pua_u8+159u,((_hb_arabic_pua_b4(_hb_arabic_pua_u8+127u,((((((u)>>2))>>4))>>4)))<<4)+((((((u)>>2))>>4))&15)))<<4)+((((u)>>2))&15)])<<2)+((u)&3)]) : 0; } #endif /* HB_OT_SHAPER_ARABIC_PUA_HH */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-table.hh index 5f87995ea9c0..81c84cf19629 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-table.hh @@ -16,222 +16,77 @@ #ifndef HB_OT_SHAPER_ARABIC_TABLE_HH #define HB_OT_SHAPER_ARABIC_TABLE_HH +#include "hb.hh" -#define A JOINING_GROUP_ALAPH -#define DR JOINING_GROUP_DALATH_RISH -#define C JOINING_TYPE_C -#define D JOINING_TYPE_D -#define L JOINING_TYPE_L -#define R JOINING_TYPE_R -#define T JOINING_TYPE_T -#define U JOINING_TYPE_U -#define X JOINING_TYPE_X +#include -static const uint8_t joining_table[] = +static const uint8_t _hb_arabic_joining_u8[737]= { + 0, 16, 2, 0, 0, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 96,135, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, + 0, 0, 0, 8, 16, 24, 32, 40, 48, 0, 56, 0, 64, 72, 80, 0, + 0, 0, 0, 88, 96,104, 0, 0, 0, 0, 0,112,120, 0, 0, 0, + 0, 0, 0, 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0,136, 0, + 0,144, 0, 0, 0, 0, 0,152, 0, 0, 0, 0, 0, 0,160,168, + 176,184,192, 0, 0,200,208, 0, 0, 0, 0, 0, 0, 0, 0,216, + 224, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, 0, 10, 11, 12, + 1, 1, 13, 0, 0, 0, 14, 15, 1, 1, 2, 2, 4, 1, 1, 1, + 1, 16, 17, 18, 3, 0, 19, 0, 20, 0, 21, 22, 23, 1, 24, 0, + 0, 0, 25, 1, 26, 1, 27, 28, 4, 0, 29, 1, 1, 1, 30, 0, + 31, 32, 5, 33, 34, 35, 36, 2, 2, 37, 38, 6, 0, 1, 39, 40, + 5, 1, 7, 0, 0, 41, 0, 0, 0, 42, 43, 0, 0, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 7, 44, 1, 1, 1, 1, 45, 0, + 0, 0, 46, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 48, 6, 0, + 0, 1, 1, 1, 1, 1, 1, 49, 0, 50, 51, 52, 53, 54, 55, 0, + 0, 56, 57, 58, 0, 0, 59, 0, 0, 60, 1, 1, 1, 61, 0, 0, + 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, + 1, 64, 0, 65, 0, 0, 0, 66, 1, 67, 0, 0, 0, 0, 0, 68, + 69, 70, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0, 3, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 72, 73, 0, 0, 0, 0, 0, 0,119,119,119,119, 51, 51, 51, + 51, 34, 34, 34, 34,119,119, 7,119, 34, 51, 51, 51, 35, 51, 51, + 51, 0,119,119,119,115,119,119,119, 0, 0, 0,119,112, 7,119, + 119, 3, 34, 34, 35, 35, 51, 51, 35, 34, 50, 51, 51, 50,115,119, + 119,119,119,119, 51, 39, 34, 32, 34, 50, 35, 34, 34, 34, 34, 35, + 35, 51, 34, 39,119,119,119,119, 34,119, 51,115, 55,119,119,119, + 103,116, 51, 83, 37, 34, 51, 51, 50, 50, 53, 50, 83,119,119, 39, + 51, 35, 34, 51, 51, 51, 35, 50, 51, 35, 35, 50, 51,119, 51, 51, + 51, 51,115,119,119,119,115,119,119, 50, 51, 51, 34, 51, 51, 50, + 34,114,119,119,119, 3, 51, 51, 32, 35,114,119,119, 34, 50, 51, + 3, 48, 51, 51, 50, 51, 34, 2, 50, 35, 50, 51, 51,119,112,119, + 119,119,119,119, 48,119,115,119,112, 0, 0, 96, 54,115,115,119, + 119,119,119, 48,119,119,119,119, 7,119,119,119, 0, 51, 1,119, + 119, 51, 51, 35, 32, 32, 2, 16, 34, 34, 50, 51, 19, 51, 51, 35, + 51, 35, 0,114,119,119, 55, 51, 35, 35, 35, 34, 51, 35, 51, 50, + 34, 35,119,119,119, 39, 34, 50, 3, 49, 51, 51, 51, 51, 50,119, + 119,119, 50,115, 51, 51, 35, 51, 51, 51, 51, 3,119, 55, 51,114, + 119, 51, 51, 34, 51, 51,119,119,119, 3, 51, 34, 2, 35, 50, 35, + 51, 48, 34, 3, 0, 32, 19,119,119, 51, 51,119,119,119,103,119, + 119, +}; -#define joining_offset_0x0600u 0 - - /* Arabic */ - - /* 0600 */ U,U,U,U,U,U,X,X,U,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 0620 */ D,U,R,R,R,R,D,R,D,R,D,D,D,D,D,R,R,R,R,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 0640 */ C,D,D,D,D,D,D,D,R,D,D,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 0660 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,D,D,X,R,R,R,U,R,R,R,D,D,D,D,D,D,D,D, - /* 0680 */ D,D,D,D,D,D,D,D,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,D,D,D,D,D,D, - /* 06A0 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 06C0 */ R,D,D,R,R,R,R,R,R,R,R,R,D,R,D,R,D,D,R,R,X,R,X,X,X,X,X,X,X,U,X,X, - /* 06E0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,R,R,X,X,X,X,X,X,X,X,X,X,D,D,D,X,X,D, - - /* Syriac */ - - /* 0700 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,T,A,X,D,D,D,DR,DR,R,R,R,D,D,D,D,R,D, - /* 0720 */ D,D,D,D,D,D,D,D,R,D,DR,D,R,D,D,DR,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 0740 */ X,X,X,X,X,X,X,X,X,X,X,X,X,R,D,D, - - /* Arabic Supplement */ - - /* 0740 */ D,D,D,D,D,D,D,D,D,R,R,R,D,D,D,D, - /* 0760 */ D,D,D,D,D,D,D,D,D,D,D,R,R,D,D,D,D,R,D,R,R,D,D,D,R,R,D,D,D,D,D,D, - - /* FILLER */ - - /* 0780 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 07A0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - - /* NKo */ - - /* 07C0 */ X,X,X,X,X,X,X,X,X,X,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 07E0 */ D,D,D,D,D,D,D,D,D,D,D,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,C,X,X,X,X,X, - - /* FILLER */ - - /* 0800 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 0820 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - - /* Mandaic */ - - /* 0840 */ R,D,D,D,D,D,R,R,D,R,D,D,D,D,D,D,D,D,D,D,R,D,R,R,R,X,X,X,X,X,X,X, - - /* Syriac Supplement */ - - /* 0860 */ D,U,D,D,D,D,U,R,D,R,R,X,X,X,X,X, - - /* Arabic Extended-B */ - - /* 0860 */ R,R,R,R,R,R,R,R,R,R,R,R,R,R,R,R, - /* 0880 */ R,R,R,C,C,C,D,U,U,D,D,D,D,D,R,D,U,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - - /* Arabic Extended-A */ - - /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,D,D,D,D,D,D,R,D,D,D,D,D,D, - /* 08C0 */ D,D,D,D,D,D,D,D,D,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 08E0 */ X,X,U, - -#define joining_offset_0x1806u 739 - - /* Mongolian */ - - /* 1800 */ U,D,X,X,C,X,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 1820 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 1840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 1860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,X,X,X,X,X,X,X, - /* 1880 */ U,U,U,U,U,T,T,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 18A0 */ D,D,D,D,D,D,D,D,D,X,D, - -#define joining_offset_0x200cu 904 - - /* General Punctuation */ - - /* 2000 */ U,C,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 2020 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 2040 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 2060 */ X,X,X,X,X,X,U,U,U,U, - -#define joining_offset_0xa840u 998 - - /* Phags-pa */ - - /* A840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* A860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,L,U, - -#define joining_offset_0x10ac0u 1050 - - /* Manichaean */ - - /* 10AC0 */ D,D,D,D,D,R,U,R,U,R,R,U,U,L,R,R,R,R,R,D,D,D,D,L,D,D,D,D,D,R,D,D, - /* 10AE0 */ D,R,U,U,R,X,X,X,X,X,X,D,D,D,D,R, - -#define joining_offset_0x10b80u 1098 - - /* Psalter Pahlavi */ - - /* 10B80 */ D,R,D,R,R,R,D,D,D,R,D,D,R,D,R,R,D,R,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 10BA0 */ X,X,X,X,X,X,X,X,X,R,R,R,R,D,D,U, - -#define joining_offset_0x10d00u 1146 - - /* Hanifi Rohingya */ - - /* 10D00 */ L,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 10D20 */ D,D,R,D, - -#define joining_offset_0x10ec2u 1182 - - /* Arabic Extended-C */ - - /* 10EC0 */ R,D,D,X,D,D, - -#define joining_offset_0x10f30u 1188 - - /* Sogdian */ - - /* 10F20 */ D,D,D,R,D,D,D,D,D,D,D,D,D,D,D,D, - /* 10F40 */ D,D,D,D,D,U,X,X,X,X,X,X,X,X,X,X,X,D,D,D,R,X,X,X,X,X,X,X,X,X,X,X, - /* 10F60 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - - /* Old Uyghur */ - - /* 10F60 */ D,D,D,D,R,R,D,D,D,D,D,D,D,D,D,D, - /* 10F80 */ D,D,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - /* 10FA0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X, - - /* Chorasmian */ - - /* 10FA0 */ D,U,D,D,R,R,R,U,D,R,R,D,D,R,D,D, - /* 10FC0 */ U,D,R,R,D,U,U,U,U,R,D,L, - -#define joining_offset_0x110bdu 1344 - - /* Kaithi */ - - /* 110A0 */ U,X,X, - /* 110C0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,U, - -#define joining_offset_0x1e900u 1361 - - /* Adlam */ - - /* 1E900 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 1E920 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D, - /* 1E940 */ D,D,D,D,X,X,X,X,X,X,X,T, - -}; /* Table items: 1437; occupancy: 58% */ - +static inline uint8_t _hb_arabic_joining_b4 (const uint8_t* a, unsigned i) +{ + return (a[i>>1]>>((i&1)<<2))&15; +} +static inline uint8_t _hb_arabic_joining_joining_type (unsigned u) +{ + /* packtab: [2^4,2^3,2^3,2^3] */ + return u<125260u ? (uint8_t)(_hb_arabic_joining_b4(_hb_arabic_joining_u8+441u,((_hb_arabic_joining_u8[209u+_hb_arabic_joining_u8[123u+((_hb_arabic_joining_b4(_hb_arabic_joining_u8,((((((u)>>3))>>3))>>3)))<<3)+((((((u)>>3))>>3))&7)]+((((u)>>3))&7)])<<3)+((u)&7))) : 7; +} static unsigned int joining_type (hb_codepoint_t u) { - switch (u >> 12) - { - case 0x0u: - if (hb_in_range (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u]; - break; - - case 0x1u: - if (hb_in_range (u, 0x1806u, 0x18AAu)) return joining_table[u - 0x1806u + joining_offset_0x1806u]; - break; - - case 0x2u: - if (hb_in_range (u, 0x200Cu, 0x2069u)) return joining_table[u - 0x200Cu + joining_offset_0x200cu]; - break; - - case 0xAu: - if (hb_in_range (u, 0xA840u, 0xA873u)) return joining_table[u - 0xA840u + joining_offset_0xa840u]; - break; - - case 0x10u: - if (hb_in_range (u, 0x10AC0u, 0x10AEFu)) return joining_table[u - 0x10AC0u + joining_offset_0x10ac0u]; - if (hb_in_range (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u]; - if (hb_in_range (u, 0x10D00u, 0x10D23u)) return joining_table[u - 0x10D00u + joining_offset_0x10d00u]; - if (hb_in_range (u, 0x10EC2u, 0x10EC7u)) return joining_table[u - 0x10EC2u + joining_offset_0x10ec2u]; - if (hb_in_range (u, 0x10F30u, 0x10FCBu)) return joining_table[u - 0x10F30u + joining_offset_0x10f30u]; - break; - - case 0x11u: - if (hb_in_range (u, 0x110BDu, 0x110CDu)) return joining_table[u - 0x110BDu + joining_offset_0x110bdu]; - break; - - case 0x1Eu: - if (hb_in_range (u, 0x1E900u, 0x1E94Bu)) return joining_table[u - 0x1E900u + joining_offset_0x1e900u]; - break; - - default: - break; - } - return X; + return _hb_arabic_joining_joining_type (u); } -#undef A -#undef DR -#undef C -#undef D -#undef L -#undef R -#undef T -#undef U -#undef X - static const uint16_t shaping_table[][4] = { diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic.cc index 981c0f9224b4..611aa262f40f 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic.cc @@ -77,8 +77,8 @@ enum hb_arabic_joining_type_t { JOINING_GROUP_DALATH_RISH = 5, NUM_STATE_MACHINE_COLS = 6, - JOINING_TYPE_T = 7, - JOINING_TYPE_X = 8 /* means: use general-category to choose between U or T. */ + JOINING_TYPE_T = 6, + JOINING_TYPE_X = 7 /* means: use general-category to choose between U or T. */ }; #include "hb-ot-shaper-arabic-table.hh" @@ -561,20 +561,29 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED, DEBUG_MSG (ARABIC, nullptr, "fixed tiles: count=%d width=%" PRId32, n_fixed, w_fixed); DEBUG_MSG (ARABIC, nullptr, "repeating tiles: count=%d width=%" PRId32, n_repeating, w_repeating); + static constexpr unsigned STCH_MAX_GLYPHS = 256; + /* Number of additional times to repeat each repeating tile. */ - int n_copies = 0; + unsigned int n_copies = 0; - hb_position_t w_remaining = w_total - w_fixed; - if (sign * w_remaining > sign * w_repeating && sign * w_repeating > 0) - n_copies = (sign * w_remaining) / (sign * w_repeating) - 1; + int64_t w_remaining_signed = (int64_t) w_total - w_fixed; + int64_t w_repeating_signed = w_repeating; + if (sign < 0) + { + w_remaining_signed = -w_remaining_signed; + w_repeating_signed = -w_repeating_signed; + } + hb_position_t w_remaining = (hb_position_t) (w_total - w_fixed); + if (w_remaining_signed > w_repeating_signed && w_repeating_signed > 0) + n_copies = w_remaining_signed / w_repeating_signed - 1; /* See if we can improve the fit by adding an extra repeat and squeezing them together a bit. */ hb_position_t extra_repeat_overlap = 0; - hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1); + int64_t shortfall = w_remaining_signed - w_repeating_signed * (n_copies + 1); if (shortfall > 0 && n_repeating > 0) { ++n_copies; - hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining; + int64_t excess = (n_copies + 1) * w_repeating_signed - w_remaining_signed; if (excess > 0) { extra_repeat_overlap = excess / (n_copies * n_repeating); @@ -582,10 +591,25 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED, } } + unsigned int max_copies = 0; + if (n_repeating > 0) + { + unsigned int base_glyphs = n_fixed + n_repeating; + if (base_glyphs < STCH_MAX_GLYPHS) + max_copies = (STCH_MAX_GLYPHS - base_glyphs) / n_repeating; + } + n_copies = hb_min (n_copies, max_copies); + if (step == MEASURE) { - extra_glyphs_needed += n_copies * n_repeating; - DEBUG_MSG (ARABIC, nullptr, "will add extra %d copies of repeating tiles", n_copies); + unsigned int added_glyphs = 0; + if (unlikely (hb_unsigned_mul_overflows (n_copies, n_repeating, &added_glyphs) || + hb_unsigned_add_overflows (extra_glyphs_needed, added_glyphs, &extra_glyphs_needed))) + { + extra_glyphs_needed = UINT_MAX; + break; + } + DEBUG_MSG (ARABIC, nullptr, "will add extra %u copies of repeating tiles", n_copies); } else { @@ -629,7 +653,9 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED, if (step == MEASURE) { - if (unlikely (!buffer->ensure (count + extra_glyphs_needed))) + unsigned int total_glyphs = 0; + if (unlikely (hb_unsigned_add_overflows (count, extra_glyphs_needed, &total_glyphs) || + !buffer->ensure (total_glyphs))) break; } else diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-hangul.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-hangul.cc index 5f15aff8b7cb..1430d142d14d 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-hangul.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-hangul.cc @@ -298,7 +298,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED, end = start + 2; if (unlikely (!buffer->successful)) break; - buffer->merge_out_clusters (start, end); + buffer->merge_out_grapheme_clusters (start, end); continue; } } @@ -371,7 +371,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED, if (i < end) info[i++].hangul_shaping_feature() = TJMO; - buffer->merge_out_clusters (start, end); + buffer->merge_out_grapheme_clusters (start, end); continue; } else if ((!tindex && buffer->idx + 1 < count && isT (buffer->cur(+1).codepoint))) diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-table.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-table.cc index bf27efee21bb..74fe5efa3b7b 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-table.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-table.cc @@ -77,9 +77,9 @@ static_assert (OT_VPst == M_Cat(VPst), ""); #define _OT_A OT_A /* 53 chars; A */ #define _OT_As OT_As /* 1 chars; As */ -#define _OT_C OT_C /* 478 chars; C */ +#define _OT_C OT_C /* 476 chars; C */ #define _OT_CM OT_CM /* 1 chars; CM */ -#define _OT_CS OT_CS /* 2 chars; CS */ +#define _OT_CS OT_CS /* 4 chars; CS */ #define _OT_DC OT_DOTTEDCIRCLE /* 1 chars; DOTTEDCIRCLE */ #define _OT_H OT_H /* 11 chars; H */ #define _OT_M OT_M /* 142 chars; M */ @@ -130,392 +130,112 @@ static_assert (OT_VPst == M_Cat(VPst), ""); #define _(S,M) INDIC_COMBINE_CATEGORIES (_OT_##S, _POS_##M) -static const uint16_t indic_table[] = { +#include - -#define indic_offset_0x0028u 0 - - - /* Basic Latin */ - - /* 0028 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(GB,C), _(X,X), _(X,X), - /* 0030 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0038 */ _(GB,C), _(GB,C), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - -#define indic_offset_0x00b0u 24 - - - /* Latin-1 Supplement */ - - /* 00B0 */ _(X,X), _(X,X),_(SP,SM),_(SP,SM), _(X,X), _(X,X), _(X,X), _(X,X), - /* 00B8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 00C0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 00C8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 00D0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(GB,C), - -#define indic_offset_0x0900u 64 - - - /* Devanagari */ - - /* 0900 */_(SM,SM),_(SM,SM),_(SM,SM),_(SM,SM), _(V,C), _(V,C), _(V,C), _(V,C), - /* 0908 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), - /* 0910 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(C,C), _(C,C), _(C,C), - /* 0918 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0920 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0928 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0930 */ _(R,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0938 */ _(C,C), _(C,C), _(M,AS), _(M,AS), _(N,X), _(S,SM), _(M,AS), _(M,LM), - /* 0940 */ _(M,AS), _(M,AS), _(M,AS), _(M,AS), _(M,AS), _(M,AS), _(M,AS), _(M,AS), - /* 0948 */ _(M,AS), _(M,AS), _(M,AS), _(M,AS), _(M,AS), _(H,B), _(M,LM), _(M,AS), - /* 0950 */ _(X,X), _(A,SM), _(A,SM),_(SM,SM),_(SM,SM), _(M,AS), _(M,AS), _(M,AS), - /* 0958 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0960 */ _(V,C), _(V,C), _(M,AS), _(M,AS), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 0968 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0970 */ _(X,X), _(X,X), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), - /* 0978 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - - /* Bengali */ - - /* 0980 */ _(GB,C),_(SM,SM),_(SM,SM),_(SM,SM), _(X,X), _(V,C), _(V,C), _(V,C), - /* 0988 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(X,X), _(X,X), _(V,C), - /* 0990 */ _(V,C), _(X,X), _(X,X), _(V,C), _(V,C), _(C,C), _(C,C), _(C,C), - /* 0998 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 09A0 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 09A8 */ _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 09B0 */ _(R,C), _(X,X), _(C,C), _(X,X), _(X,X), _(X,X), _(C,C), _(C,C), - /* 09B8 */ _(C,C), _(C,C), _(X,X), _(X,X), _(N,X), _(S,SM), _(M,AP), _(M,LM), - /* 09C0 */ _(M,AP), _(M,AS), _(M,AS), _(M,AS), _(M,AS), _(X,X), _(X,X), _(M,LM), - /* 09C8 */ _(M,LM), _(X,X), _(X,X), _(M,AP), _(M,AP), _(H,B), _(C,C), _(X,X), - /* 09D0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(M,AP), - /* 09D8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(C,C), _(C,C), _(X,X), _(C,C), - /* 09E0 */ _(V,C), _(V,C), _(M,AS), _(M,AS), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 09E8 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 09F0 */ _(R,C), _(C,C), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 09F8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(GB,C), _(X,X),_(SM,SM), _(X,X), - - /* Gurmukhi */ - - /* 0A00 */ _(X,X),_(SM,SM),_(SM,SM),_(SM,SM), _(X,X), _(V,C), _(V,C), _(V,C), - /* 0A08 */ _(V,C), _(V,C), _(V,C), _(X,X), _(X,X), _(X,X), _(X,X), _(V,C), - /* 0A10 */ _(V,C), _(X,X), _(X,X), _(V,C), _(V,C), _(C,C), _(C,C), _(C,C), - /* 0A18 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0A20 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0A28 */ _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0A30 */ _(R,C), _(X,X), _(C,C), _(C,C), _(X,X), _(C,C), _(C,C), _(X,X), - /* 0A38 */ _(C,C), _(C,C), _(X,X), _(X,X), _(N,X), _(X,X), _(M,AP), _(M,LM), - /* 0A40 */_(MP,AP), _(M,AP), _(M,AP), _(X,X), _(X,X), _(X,X), _(X,X), _(M,AP), - /* 0A48 */ _(M,AP), _(X,X), _(X,X), _(M,AP), _(M,AP), _(H,B), _(X,X), _(X,X), - /* 0A50 */ _(X,X), _(M,B), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0A58 */ _(X,X), _(C,C), _(C,C), _(C,C), _(C,C), _(X,X), _(C,C), _(X,X), - /* 0A60 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 0A68 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0A70 */_(SM,SM),_(SM,SM), _(C,C), _(C,C), _(X,X), _(CM,C), _(X,X), _(X,X), - /* 0A78 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - - /* Gujarati */ - - /* 0A80 */ _(X,X),_(SM,SM),_(SM,SM),_(SM,SM), _(X,X), _(V,C), _(V,C), _(V,C), - /* 0A88 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(X,X), _(V,C), - /* 0A90 */ _(V,C), _(V,C), _(X,X), _(V,C), _(V,C), _(C,C), _(C,C), _(C,C), - /* 0A98 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0AA0 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0AA8 */ _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0AB0 */ _(R,C), _(X,X), _(C,C), _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), - /* 0AB8 */ _(C,C), _(C,C), _(X,X), _(X,X), _(N,X), _(S,SM), _(M,AP), _(M,LM), - /* 0AC0 */ _(M,AP), _(M,AP), _(M,AP), _(M,AP), _(M,AP), _(M,AS), _(X,X), _(M,AS), - /* 0AC8 */ _(M,AS), _(M,AP), _(X,X), _(M,AP), _(M,AP), _(H,B), _(X,X), _(X,X), - /* 0AD0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0AD8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0AE0 */ _(V,C), _(V,C), _(M,AP), _(M,AP), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 0AE8 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0AF0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0AF8 */ _(X,X), _(C,C), _(A,SM), _(N,X), _(A,SM), _(N,X), _(N,X), _(N,X), - - /* Oriya */ - - /* 0B00 */ _(X,X),_(SM,BS),_(SM,SM),_(SM,SM), _(X,X), _(V,C), _(V,C), _(V,C), - /* 0B08 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(X,X), _(X,X), _(V,C), - /* 0B10 */ _(V,C), _(X,X), _(X,X), _(V,C), _(V,C), _(C,C), _(C,C), _(C,C), - /* 0B18 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0B20 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0B28 */ _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0B30 */ _(R,C), _(X,X), _(C,C), _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), - /* 0B38 */ _(C,C), _(C,C), _(X,X), _(X,X), _(N,X), _(S,SM), _(M,AP), _(M,A), - /* 0B40 */ _(M,AP), _(M,AS), _(M,AS), _(M,AS), _(M,AS), _(X,X), _(X,X), _(M,LM), - /* 0B48 */ _(M,A), _(X,X), _(X,X), _(M,AP), _(M,AP), _(H,B), _(X,X), _(X,X), - /* 0B50 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(N,X), _(M,A), _(M,AP), - /* 0B58 */ _(X,X), _(X,X), _(X,X), _(X,X), _(C,C), _(C,C), _(X,X), _(C,C), - /* 0B60 */ _(V,C), _(V,C), _(M,AS), _(M,AS), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 0B68 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0B70 */ _(X,X), _(C,C), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0B78 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - - /* Tamil */ - - /* 0B80 */ _(X,X), _(X,X),_(SM,SM), _(X,X), _(X,X), _(V,C), _(V,C), _(V,C), - /* 0B88 */ _(V,C), _(V,C), _(V,C), _(X,X), _(X,X), _(X,X), _(V,C), _(V,C), - /* 0B90 */ _(V,C), _(X,X), _(V,C), _(V,C), _(V,C), _(C,C), _(X,X), _(X,X), - /* 0B98 */ _(X,X), _(C,C), _(C,C), _(X,X), _(C,C), _(X,X), _(C,C), _(C,C), - /* 0BA0 */ _(X,X), _(X,X), _(X,X), _(C,C), _(C,C), _(X,X), _(X,X), _(X,X), - /* 0BA8 */ _(C,C), _(C,C), _(C,C), _(X,X), _(X,X), _(X,X), _(C,C), _(C,C), - /* 0BB0 */ _(R,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0BB8 */ _(C,C), _(C,C), _(X,X), _(X,X), _(X,X), _(X,X), _(M,AP), _(M,AP), - /* 0BC0 */ _(M,AS), _(M,AP), _(M,AP), _(X,X), _(X,X), _(X,X), _(M,LM), _(M,LM), - /* 0BC8 */ _(M,LM), _(X,X), _(M,AP), _(M,AP), _(M,AP), _(H,T), _(X,X), _(X,X), - /* 0BD0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(M,AP), - /* 0BD8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0BE0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 0BE8 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0BF0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0BF8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - - /* Telugu */ - - /* 0C00 */_(SM,SM),_(SM,SM),_(SM,SM),_(SM,SM),_(SM,SM), _(V,C), _(V,C), _(V,C), - /* 0C08 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(X,X), _(V,C), _(V,C), - /* 0C10 */ _(V,C), _(X,X), _(V,C), _(V,C), _(V,C), _(C,C), _(C,C), _(C,C), - /* 0C18 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0C20 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0C28 */ _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0C30 */ _(R,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0C38 */ _(C,C), _(C,C), _(X,X), _(X,X), _(N,X), _(S,SM), _(M,BS), _(M,BS), - /* 0C40 */ _(M,BS), _(M,BS), _(M,BS), _(M,AS), _(M,AS), _(X,X), _(M,BS), _(M,BS), - /* 0C48 */ _(M,BS), _(X,X), _(M,BS), _(M,BS), _(M,BS), _(H,T), _(X,X), _(X,X), - /* 0C50 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(M,BS), _(M,BS), _(X,X), - /* 0C58 */ _(C,C), _(C,C), _(C,C), _(X,X), _(X,X), _(C,C), _(X,X), _(X,X), - /* 0C60 */ _(V,C), _(V,C), _(M,BS), _(M,BS), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 0C68 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0C70 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0C78 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - - /* Kannada */ - - /* 0C80 */ _(GB,C),_(SM,SM),_(SM,SM),_(SM,SM), _(X,X), _(V,C), _(V,C), _(V,C), - /* 0C88 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(X,X), _(V,C), _(V,C), - /* 0C90 */ _(V,C), _(X,X), _(V,C), _(V,C), _(V,C), _(C,C), _(C,C), _(C,C), - /* 0C98 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0CA0 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0CA8 */ _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0CB0 */ _(R,C), _(C,C), _(C,C), _(C,C), _(X,X), _(C,C), _(C,C), _(C,C), - /* 0CB8 */ _(C,C), _(C,C), _(X,X), _(X,X), _(N,X), _(S,SM), _(M,BS), _(M,BS), - /* 0CC0 */ _(M,BS), _(M,BS), _(M,BS), _(M,AS), _(M,AS), _(X,X), _(M,BS), _(M,AS), - /* 0CC8 */ _(M,AS), _(X,X), _(M,AS), _(M,AS), _(M,BS), _(H,T), _(X,X), _(X,X), - /* 0CD0 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(M,AS), _(M,AS), _(X,X), - /* 0CD8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(C,C), _(C,C), _(X,X), - /* 0CE0 */ _(V,C), _(V,C), _(M,BS), _(M,BS), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 0CE8 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0CF0 */ _(X,X), _(CS,C), _(CS,C),_(SM,SM), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0CF8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - - /* Malayalam */ - - /* 0D00 */_(SM,SM),_(SM,SM),_(SM,SM),_(SM,SM), _(GB,C), _(V,C), _(V,C), _(V,C), - /* 0D08 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(X,X), _(V,C), _(V,C), - /* 0D10 */ _(V,C), _(X,X), _(V,C), _(V,C), _(V,C), _(C,C), _(C,C), _(C,C), - /* 0D18 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0D20 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0D28 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0D30 */ _(R,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 0D38 */ _(C,C), _(C,C), _(C,C), _(M,AS), _(M,AS), _(S,SM), _(M,AP), _(M,AP), - /* 0D40 */ _(M,AP), _(M,AP), _(M,AP), _(M,AP), _(M,AP), _(X,X), _(M,LM), _(M,LM), - /* 0D48 */ _(M,LM), _(X,X), _(M,AP), _(M,AP), _(M,AP), _(H,T), _(Rf,X), _(X,X), - /* 0D50 */ _(X,X), _(X,X), _(X,X), _(X,X), _(C,C), _(C,C), _(C,C), _(M,AP), - /* 0D58 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(V,C), - /* 0D60 */ _(V,C), _(V,C), _(M,AP), _(M,AP), _(X,X), _(X,X), _(GB,C), _(GB,C), - /* 0D68 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 0D70 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 0D78 */ _(X,X), _(X,X), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - -#define indic_offset_0x1000u 1216 - - - /* Myanmar */ - - /* 1000 */ _(C,C), _(C,C), _(C,C), _(C,C), _(R,C), _(C,C), _(C,C), _(C,C), - /* 1008 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 1010 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 1018 */ _(C,C), _(C,C), _(C,C), _(R,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 1020 */ _(C,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), - /* 1028 */ _(V,C), _(V,C), _(V,C), _(VR,R), _(VR,R), _(VA,T), _(VA,T), _(VB,B), - /* 1030 */ _(VB,B), _(VL,L), _(A,SM), _(VA,T), _(VA,T), _(VA,T), _(A,SM), _(N,X), - /* 1038 */_(SM,SM), _(H,X), _(As,X), _(MY,X), _(MR,X), _(MW,X), _(MH,X), _(C,C), - /* 1040 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 1048 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(X,X), _(X,X), _(C,C), _(X,X), - /* 1050 */ _(C,C), _(C,C), _(V,C), _(V,C), _(V,C), _(V,C), _(VR,R), _(VR,R), - /* 1058 */ _(VB,B), _(VB,B), _(R,C), _(C,C), _(C,C), _(C,C), _(MY,X), _(MY,X), - /* 1060 */ _(ML,X), _(C,C), _(VR,R), _(PT,X), _(PT,X), _(C,C), _(C,C), _(VR,R), - /* 1068 */ _(VR,R), _(PT,X), _(PT,X), _(PT,X), _(PT,X), _(PT,X), _(C,C), _(C,C), - /* 1070 */ _(C,C), _(VA,T), _(VA,T), _(VA,T), _(VA,T), _(C,C), _(C,C), _(C,C), - /* 1078 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 1080 */ _(C,C), _(C,C), _(MW,X), _(VR,R), _(VL,L), _(VA,T), _(VA,T),_(SM,SM), - /* 1088 */_(SM,SM),_(SM,SM),_(SM,SM),_(SM,SM),_(SM,SM),_(SM,SM), _(C,C),_(SM,SM), - /* 1090 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 1098 */ _(GB,C), _(GB,C),_(SM,SM),_(SM,SM),_(SM,SM), _(VA,T), _(X,X), _(X,X), - -#define indic_offset_0x1780u 1376 - - - /* Khmer */ - - /* 1780 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 1788 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 1790 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 1798 */ _(C,C), _(C,C), _(R,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* 17A0 */ _(C,C), _(C,C), _(C,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), - /* 17A8 */ _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), _(V,C), - /* 17B0 */ _(V,C), _(V,C), _(V,C), _(V,C), _(X,X), _(X,X), _(VR,R), _(VA,T), - /* 17B8 */ _(VA,T), _(VA,T), _(VA,T), _(VB,B), _(VB,B), _(VB,B), _(VA,T), _(VR,R), - /* 17C0 */ _(VR,R), _(VL,L), _(VL,L), _(VL,L), _(VR,R), _(VR,R), _(Xg,X), _(Yg,X), - /* 17C8 */ _(Yg,X), _(Rt,X), _(Rt,X), _(Xg,X), _(Rt,X), _(Xg,X), _(Xg,X), _(Xg,X), - /* 17D0 */ _(Xg,X), _(Xg,X), _(H,X), _(Yg,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 17D8 */ _(X,X), _(GB,C), _(X,X), _(X,X), _(S,SM), _(Yg,X), _(X,X), _(X,X), - /* 17E0 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 17E8 */ _(GB,C), _(GB,C), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - -#define indic_offset_0x1cd0u 1488 - - - /* Vedic Extensions */ - - /* 1CD0 */ _(A,SM), _(A,SM), _(A,SM), _(X,X), _(A,SM), _(A,SM), _(A,SM), _(A,SM), - /* 1CD8 */ _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), - /* 1CE0 */ _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), - /* 1CE8 */ _(A,SM), _(S,SM), _(S,SM), _(S,SM), _(S,SM), _(A,SM), _(S,SM), _(S,SM), - /* 1CF0 */ _(S,SM), _(S,SM), _(C,C), _(C,C), _(A,SM), _(C,C), _(C,C), _(A,SM), - /* 1CF8 */ _(A,SM), _(A,SM), _(GB,C), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - -#define indic_offset_0x2008u 1536 - - - /* General Punctuation */ - - /* 2008 */ _(X,X), _(X,X), _(X,X), _(X,X),_(ZWNJ,X),_(ZWJ,X), _(X,X), _(X,X), - /* 2010 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(X,X), _(X,X), - /* 2018 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 2020 */ _(X,X), _(X,X), _(GB,C), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - -#define indic_offset_0x2070u 1568 - - - /* Superscripts and Subscripts */ - - /* 2070 */ _(X,X), _(X,X), _(X,X), _(X,X),_(SP,SM), _(X,X), _(X,X), _(X,X), - /* 2078 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), - /* 2080 */ _(X,X), _(X,X),_(SP,SM),_(SP,SM),_(SP,SM), _(X,X), _(X,X), _(X,X), - -#define indic_offset_0x25f8u 1592 - - - /* Geometric Shapes */ - - /* 25F8 */ _(X,X), _(X,X), _(X,X), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(X,X), - -#define indic_offset_0xa8e0u 1600 - - - /* Devanagari Extended */ - - /* A8E0 */ _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), - /* A8E8 */ _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), _(A,SM), - /* A8F0 */ _(A,SM), _(A,SM), _(S,SM), _(S,SM), _(S,SM), _(S,SM), _(S,SM), _(S,SM), - /* A8F8 */ _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(X,X), _(V,C), _(M,AS), - -#define indic_offset_0xa9e0u 1632 - - - /* Myanmar Extended-B */ - - /* A9E0 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(VA,T), _(X,X), _(C,C), - /* A9E8 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* A9F0 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* A9F8 */ _(GB,C), _(GB,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(X,X), - -#define indic_offset_0xaa60u 1664 - - - /* Myanmar Extended-A */ - - /* AA60 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* AA68 */ _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), _(C,C), - /* AA70 */ _(X,X), _(C,C), _(C,C), _(C,C), _(GB,C), _(GB,C), _(GB,C), _(X,X), - /* AA78 */ _(X,X), _(X,X), _(C,C), _(PT,X), _(N,X), _(N,X), _(C,C), _(C,C), - -#define indic_offset_0xfe00u 1696 - - - /* Variation Selectors */ - - /* FE00 */ _(VS,X), _(VS,X), _(VS,X), _(VS,X), _(VS,X), _(VS,X), _(VS,X), _(VS,X), - /* FE08 */ _(VS,X), _(VS,X), _(VS,X), _(VS,X), _(VS,X), _(VS,X), _(VS,X), _(VS,X), - -#define indic_offset_0x11300u 1712 - - - /* Grantha */ - - /* 11300 */ _(X,X),_(SM,SM),_(SM,SM),_(SM,SM), _(X,X), _(X,X), _(X,X), _(X,X), - -#define indic_offset_0x11338u 1720 - - /* 11338 */ _(X,X), _(X,X), _(X,X), _(N,X), _(N,X), _(X,X), _(X,X), _(X,X), - -#define indic_offset_0x116d0u 1728 - - - /* Myanmar Extended-C */ - - /* 116D0 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 116D8 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), - /* 116E0 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(X,X), _(X,X), _(X,X), _(X,X), - -}; /* Table items: 1752; occupancy: 71% */ +static const uint16_t _hb_indic_values[42]= +{ + _(A,SM), _(As,X), _(C,C), _(CM,C), _(CS,C), _(DC,C), _(GB,C), _(H,B), + _(H,T), _(H,X), _(M,A), _(M,AP), _(M,AS), _(M,B), _(M,BS), _(M,LM), + _(MH,X), _(ML,X), _(MP,AP), _(MR,X), _(MW,X), _(MY,X), _(N,X), _(PT,X), + _(R,C), _(Rf,X), _(Rt,X), _(S,SM), _(SM,BS), _(SM,SM), _(SP,SM), _(V,C), + _(VA,T), _(VB,B), _(VL,L), _(VR,R), _(VS,X), _(X,X), _(Xg,X), _(Yg,X), + _(ZWJ,X),_(ZWNJ,X), +}; +static const uint8_t _hb_indic_u8[1220]= +{ + 1, 0, 50, 4, 5, 96, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,186, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,192, + 0, 0, 0, 0,208,224, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, 22, 23, + 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 26, 0, 0, + 0, 27, 0, 0, 0, 0, 28, 29, 30, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 0, 0, 0, 32, 0, 0, 0, 33, 0, 34, + 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 36, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 25, 2, 10, 0, 0, 0, 0, 26, 0, + 27, 0, 0, 0, 28, 0, 0, 0, 0, 0, 29, 11, 30, 1, 1, 1, + 4, 31, 32, 33, 34, 1, 6, 2, 35, 1, 12, 13, 7, 1, 1, 3, + 36, 14, 15, 37, 16, 17, 6, 2, 38, 39, 18, 40, 7, 1, 1, 3, + 41, 42, 43, 44, 45, 46, 19, 2, 47, 0, 18, 48, 49, 1, 1, 3, + 20, 14, 50, 51, 0, 0, 21, 2, 0, 52, 53, 13, 7, 1, 1, 3, + 20, 54, 15, 55, 56, 17, 6, 2, 57, 0, 58, 59, 60, 61, 62, 63, + 4, 64, 65, 66, 16, 0, 19, 2, 0, 0, 67, 8, 9, 1, 1, 3, + 4, 22, 68, 69, 70, 71, 23, 2, 0, 0, 12, 8, 9, 1, 1, 3, + 72, 22, 73, 74, 75, 76, 23, 2, 77, 0, 78, 8, 9, 1, 1, 1, + 4, 79, 80, 81, 82, 83, 21, 2, 0, 84, 85, 1, 1, 86, 87, 88, + 89, 90, 2, 91, 92, 93, 94, 95, 96, 1, 97, 98, 2, 99, 0, 0, + 0, 0, 1, 1, 1,100,101, 11,102,103,104,105,106,107, 2, 10, + 0, 0, 0, 0,108, 5, 5,109,110,111, 0,112,113, 0,114, 0, + 0, 0, 0, 0, 0, 0, 0, 0,115, 0,116, 0, 0, 0, 0, 0, + 0, 0, 0,117, 0, 0, 0, 0, 0,118, 0, 0, 0, 0, 5, 5, + 119,120, 0, 0, 0, 0,121, 1, 2,122, 0, 0, 0, 0, 1, 1, + 123,124, 24, 24, 0, 0, 0, 0, 0, 0,125, 0, 0, 0, 0, 0, + 0,126, 0, 0, 2, 2, 2, 10, 0, 0, 0, 0, 2, 2, 2, 2, + 4, 4, 4, 4, 10, 2, 2, 2, 26, 2, 2, 2, 8, 8, 8, 8, + 6, 18, 0, 4, 20, 14, 24, 2, 6, 6, 20, 6, 20, 6, 24, 2, + 4, 0, 0, 0, 6, 6, 6, 6, 66, 12, 14, 6, 6, 6, 20, 14, + 2, 0, 36, 50, 52, 18, 38, 68, 0, 0, 0, 32, 0, 0, 2, 16, + 56, 12, 14, 6, 0, 0, 0, 4, 44, 2, 16, 2, 6, 22, 0, 4, + 2, 0, 36, 28, 6, 28, 0, 4, 30, 30, 30, 30, 0, 0, 42, 0, + 34, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 42, 12, 12, 6, 6, + 6, 6, 24, 2, 2, 18, 36,112, 18, 18, 18, 18, 18, 18,114,116, + 118,120,122, 18, 0, 6, 6, 6, 44, 10, 0, 2, 54, 32, 46, 10, + 26, 0, 0, 0, 0, 0, 34, 70, 6, 20, 0, 14, 44, 2, 16, 10, + 2, 0, 72, 50,124, 48, 0, 32, 48, 32, 46, 0,126, 0, 0, 0, + 16, 2, 10, 10, 12, 2,128, 0, 6, 6, 6, 14, 6, 14, 24, 2, + 22, 22, 52, 74, 76, 32, 46, 0, 16, 58, 58, 78,130, 12, 14, 6, + 2, 0, 36,132,134, 32, 46, 0, 0, 0, 80,136, 16, 0, 0, 0, + 0, 70, 14, 6, 6, 20, 0, 6, 20, 6, 24, 0, 16, 10, 10, 2, + 0, 16, 10, 0, 2, 10, 0, 2, 2, 0, 0, 22, 76, 48, 0, 82, + 54, 22, 84, 0, 12, 12,138, 6, 28, 60, 38, 28, 86, 28, 88, 0, + 0, 0,140, 86, 2, 10, 16, 0, 26, 2, 16, 2, 28, 60, 38, 60, + 38, 18, 88, 0, 0, 0, 74, 38, 0, 0, 16, 10,142,144, 0, 0, + 12, 12,146, 6, 2,148,150, 22, 22, 22, 48, 82, 54, 22, 84,152, + 0, 0, 2,154, 0, 0, 0, 14, 0, 2, 2, 2, 2, 2, 26, 2, + 2,156, 2, 2, 90, 6, 6, 6, 6,158, 92, 94,160,162, 62, 58, + 164,166,168,170, 4, 4, 0, 10, 2, 6, 6, 96, 98, 26, 2,172, + 174,100,176,178,100,102,102, 2,104, 62,180, 2, 2,182,184,186, + 12, 12, 12,188, 4, 12,190, 0, 2, 26, 2, 2, 2, 90, 6, 6, + 6, 6, 0, 92, 62, 94, 98,192,194,196, 96,198,200,106,106,108, + 108,202, 0, 0, 42, 0,204, 0, 8,206, 8, 8,208, 40,210, 40, + 40, 2,212,214, 8, 34, 0, 0, 0, 0,216, 0, 4, 4, 4, 0, + 0, 34, 0, 0, 0, 0,110, 0, 0, 64,110, 0, 0, 0,218, 0, + 0, 42, 4, 34, 8, 40, 40, 40, 0, 0, 0,220, 2, 2,104, 16, + 4, 2, 2, 10, 16, 2, 4, 34, 0,222, 78, 2, 56, 12, 0, 0, + 0, 80, 72, 0, 37, 37, 2, 2, 6, 6, 31, 31, 0, 0, 2, 37, + 29, 29, 37, 31, 37, 2, 12, 12, 31, 37, 11, 11, 31, 2, 24, 2, + 14, 14, 36, 36, 37, 11, 6, 37, 22, 27, 12, 37, 27, 27, 37, 6, + 24, 37, 11, 7, 11, 37, 11, 15, 11, 12, 15, 37, 37, 29, 0, 22, + 14, 12, 32, 32, 30, 30, 6, 29, 37, 15, 29, 37, 22, 37, 37, 12, + 12, 11, 22, 22, 37, 22, 15, 15, 11, 8, 14, 37, 14, 8, 2, 31, + 35, 32, 32, 33, 35, 35, 33, 33, 35, 23, 23, 23, 2, 32, 26, 38, + 38, 38, 30, 37, 12, 15, 12, 7, 15, 12, 37, 0, 0, 29, 29, 12, + 18, 11, 37, 13, 37, 3, 37, 28, 11, 10, 10, 37, 10, 11, 29, 31, + 37, 14, 37, 4, 4, 29, 6, 31, 2, 12, 12, 27, 25, 37, 2, 11, + 2, 24, 31, 35, 33, 34, 0, 32, 29, 9, 1, 21, 19, 20, 16, 2, + 21, 21, 17, 2, 23, 2, 2, 35, 32, 2, 20, 35, 34, 32, 32, 29, + 2, 29, 29, 32, 32, 35, 35, 34, 34, 34, 38, 39, 39, 26, 9, 39, + 27, 39, 0, 37, 0, 27, 27, 0, 0, 4, 4, 0, 41, 40, 5, 37, + 31, 12, 2, 23, +}; + +static inline uint8_t _hb_indic_b4 (const uint8_t* a, unsigned i) +{ + return (a[i>>1]>>((i&1)<<2))&15; +} +static inline uint8_t _hb_indic_get_categories_index (unsigned u) +{ + /* packtab: [2^4,2^3,2^3,2^2,2^1] */ + return u<71396u ? (uint8_t)(_hb_indic_u8[996u+_hb_indic_u8[488u+((_hb_indic_u8[186u+((_hb_indic_u8[70u+((_hb_indic_b4(_hb_indic_u8,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)])<<3)+((((((u)>>1))>>2))&7)])<<2)+((((u)>>1))&3)]+((u)&1)]) : 37; +} uint16_t hb_indic_get_categories (hb_codepoint_t u) { - switch (u >> 12) - { - case 0x0u: - if (unlikely (u == 0x00A0u)) return _(GB,C); - if (hb_in_range (u, 0x0028u, 0x003Fu)) return indic_table[u - 0x0028u + indic_offset_0x0028u]; - if (hb_in_range (u, 0x00B0u, 0x00D7u)) return indic_table[u - 0x00B0u + indic_offset_0x00b0u]; - if (hb_in_range (u, 0x0900u, 0x0D7Fu)) return indic_table[u - 0x0900u + indic_offset_0x0900u]; - break; - - case 0x1u: - if (hb_in_range (u, 0x1000u, 0x109Fu)) return indic_table[u - 0x1000u + indic_offset_0x1000u]; - if (hb_in_range (u, 0x1780u, 0x17EFu)) return indic_table[u - 0x1780u + indic_offset_0x1780u]; - if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u]; - break; - - case 0x2u: - if (unlikely (u == 0x25CCu)) return _(DC,C); - if (hb_in_range (u, 0x2008u, 0x2027u)) return indic_table[u - 0x2008u + indic_offset_0x2008u]; - if (hb_in_range (u, 0x2070u, 0x2087u)) return indic_table[u - 0x2070u + indic_offset_0x2070u]; - if (hb_in_range (u, 0x25F8u, 0x25FFu)) return indic_table[u - 0x25F8u + indic_offset_0x25f8u]; - break; - - case 0xAu: - if (hb_in_range (u, 0xA8E0u, 0xA8FFu)) return indic_table[u - 0xA8E0u + indic_offset_0xa8e0u]; - if (hb_in_range (u, 0xA9E0u, 0xA9FFu)) return indic_table[u - 0xA9E0u + indic_offset_0xa9e0u]; - if (hb_in_range (u, 0xAA60u, 0xAA7Fu)) return indic_table[u - 0xAA60u + indic_offset_0xaa60u]; - break; - - case 0xFu: - if (hb_in_range (u, 0xFE00u, 0xFE0Fu)) return indic_table[u - 0xFE00u + indic_offset_0xfe00u]; - break; - - case 0x11u: - if (hb_in_range (u, 0x11300u, 0x11307u)) return indic_table[u - 0x11300u + indic_offset_0x11300u]; - if (hb_in_range (u, 0x11338u, 0x1133Fu)) return indic_table[u - 0x11338u + indic_offset_0x11338u]; - if (hb_in_range (u, 0x116D0u, 0x116E7u)) return indic_table[u - 0x116D0u + indic_offset_0x116d0u]; - break; - - default: - break; - } - return _(X,X); + return _hb_indic_values[_hb_indic_get_categories_index (u)]; } #undef _ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-thai.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-thai.cc index 42fc4bbcc441..92fc20e968d0 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-thai.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-thai.cc @@ -356,13 +356,11 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan, sizeof (buffer->out_info[0]) * (end - start - 2)); buffer->out_info[start] = t; } - else - { - /* Since we decomposed, and NIKHAHIT is combining, merge clusters with the - * previous cluster. */ - if (start) - buffer->merge_out_clusters (start - 1, end); - } + + /* Since we decomposed, and NIKHAHIT is combining, merge clusters with the + * previous cluster. */ + if (start) + buffer->merge_out_grapheme_clusters (start - 1, end); } buffer->sync (); diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-table.hh index a69abefdd01a..0b038ba22016 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-table.hh @@ -2,7 +2,7 @@ /* * The following table is generated by running: * - * ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt ArabicShaping.txt DerivedCoreProperties.txt UnicodeData.txt Blocks.txt Scripts.txt IndicSyllabicCategory-Additional.txt IndicPositionalCategory-Additional.txt + * gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt ArabicShaping.txt DerivedCoreProperties.txt UnicodeData.txt Blocks.txt Scripts.txt IndicSyllabicCategory-Additional.txt IndicPositionalCategory-Additional.txt * * on files with these headers: * @@ -105,272 +105,272 @@ static const uint8_t hb_use_u8[3343]= { - 16, 50, 51, 51, 51, 52, 51, 83, 118, 131, 57, 58, 59, 195, 211, 62, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 15, 0, 1, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 4, 2, 2, - 5, 6, 2, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 2, 2, 17, - 18, 19, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 2, 33, 2, 2, 2, - 2, 34, 35, 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, 2, 2, 2, - 37, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 38, 2, 39, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 40, 41, 42, 43, 44, 45, 2, 46, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 47, 48, 2, - 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 50, 51, 2, 2, 2, - 2, 2, 2, 2, 2, 52, 53, 2, 54, 2, 2, 55, 56, 2, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 2, 70, 71, 72, 73, - 2, 74, 2, 75, 76, 77, 78, 79, 2, 80, 81, 82, 83, 2, 84, 85, - 2, 86, 86, 86, 86, 86, 86, 86, 86, 87, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 86, 88, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 89, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 90, 91, 2, 2, 2, 92, 2, 2, 2, 93, - 94, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 95, 95, 95, 96, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 97, 98, 2, 2, 2, 2, 2, - 2, 2, 2, 99, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 33, 3, 0, 0, 0, 4, 0, 80, 118, 128, 9, 10, 11, 192, 208, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, 5, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 7, 0, 0, + 8, 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 20, + 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, 36, 0, 0, 0, + 0, 37, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, + 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 0, 42, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 43, 44, 45, 46, 47, 48, 0, 49, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 51, 0, + 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 53, 54, 0, 0, 0, + 0, 0, 0, 0, 0, 55, 56, 0, 57, 0, 0, 58, 59, 0, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 0, 73, 74, 75, 76, + 0, 77, 0, 78, 79, 80, 81, 82, 0, 83, 84, 85, 86, 0, 87, 88, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 89, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 90, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 92, 93, 0, 0, 0, 94, 0, 0, 0, 95, + 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 97, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 98, 99, 0, 0, 0, 0, 0, + 0, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 101, 0, 0, 102, 0, 0, 0, 103, 0, 104, 0, 0, 0, + 0, 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 106, 107, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 100, 2, 2, 101, 2, 2, 2, 102, 2, 103, 2, 2, 2, - 2, 2, 2, 104, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 105, 105, 106, 107, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, - 0, 5, 0, 0, 0, 0, 0, 6, 0, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 11, - 11, 11, 11, 0, 0, 0, 9, 12, 0, 2, 2, 2, 2, 13, 14, 0, - 0, 11, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 17, - 18, 19, 20, 21, 22, 16, 23, 24, 25, 12, 26, 27, 20, 2, 2, 2, - 2, 2, 20, 0, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 28, 29, 30, 2, 2, 2, 9, 30, 9, 30, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 9, 2, 2, 2, 9, 9, 0, 2, 2, 0, 17, - 18, 19, 20, 31, 32, 33, 32, 34, 0, 0, 0, 0, 35, 0, 0, 2, - 30, 2, 0, 0, 0, 0, 0, 9, 36, 12, 15, 30, 2, 2, 9, 0, - 30, 9, 2, 30, 9, 2, 0, 37, 18, 19, 31, 0, 27, 38, 27, 39, - 0, 40, 0, 0, 0, 30, 2, 9, 9, 0, 0, 0, 2, 2, 2, 2, - 2, 41, 42, 43, 0, 0, 0, 0, 0, 12, 15, 30, 2, 2, 2, 2, - 30, 2, 30, 2, 2, 2, 2, 2, 2, 9, 2, 30, 2, 2, 0, 17, - 18, 19, 20, 21, 27, 22, 35, 24, 0, 0, 0, 0, 0, 30, 41, 41, - 44, 12, 29, 30, 2, 2, 2, 9, 30, 9, 2, 30, 2, 2, 0, 17, - 45, 0, 0, 27, 22, 0, 0, 2, 30, 30, 0, 0, 0, 0, 0, 0, - 0, 0, 46, 30, 2, 2, 9, 0, 2, 9, 2, 2, 0, 30, 9, 9, - 2, 0, 30, 9, 0, 2, 9, 0, 2, 2, 2, 2, 2, 2, 0, 0, - 23, 16, 47, 0, 48, 33, 48, 34, 0, 0, 0, 0, 35, 0, 0, 0, - 0, 15, 29, 49, 2, 2, 2, 9, 2, 9, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 0, 17, 22, 16, 23, 47, 22, 38, 22, 39, - 0, 0, 0, 27, 31, 2, 9, 0, 0, 10, 29, 30, 2, 2, 2, 9, - 2, 2, 2, 30, 2, 2, 0, 17, 45, 0, 0, 35, 47, 0, 0, 0, - 9, 50, 51, 0, 0, 0, 0, 0, 0, 11, 29, 2, 2, 2, 2, 9, - 2, 2, 2, 2, 2, 2, 52, 53, 23, 19, 20, 31, 48, 33, 48, 34, - 54, 0, 0, 0, 35, 0, 0, 0, 30, 12, 29, 30, 2, 2, 2, 2, - 2, 2, 2, 2, 9, 0, 2, 2, 2, 2, 30, 2, 2, 2, 2, 30, - 0, 2, 2, 2, 9, 0, 55, 0, 35, 23, 22, 31, 31, 18, 48, 48, - 25, 0, 23, 0, 0, 0, 0, 0, 0, 2, 0, 2, 9, 0, 0, 0, - 0, 0, 0, 0, 0, 20, 0, 0, 0, 2, 2, 56, 56, 57, 0, 0, - 18, 2, 2, 2, 2, 30, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, - 0, 58, 21, 59, 22, 22, 20, 20, 46, 21, 11, 31, 11, 2, 2, 60, - 61, 61, 61, 61, 61, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 63, 0, 0, 0, 0, 64, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 65, 45, 59, 66, 22, 22, 67, 68, 69, 70, - 71, 2, 2, 2, 2, 2, 1, 0, 5, 2, 2, 2, 23, 20, 2, 2, - 72, 71, 73, 74, 65, 73, 29, 29, 2, 52, 22, 53, 2, 2, 2, 2, - 2, 2, 75, 76, 77, 29, 29, 78, 79, 2, 2, 2, 2, 2, 29, 45, - 0, 2, 59, 80, 0, 0, 0, 0, 30, 2, 59, 47, 0, 0, 0, 0, - 0, 2, 59, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 9, - 2, 9, 59, 0, 0, 0, 0, 0, 0, 2, 2, 81, 45, 22, 59, 20, - 48, 48, 48, 48, 15, 82, 83, 84, 85, 86, 87, 0, 0, 0, 0, 88, - 0, 9, 0, 0, 30, 0, 89, 81, 90, 2, 2, 2, 2, 9, 0, 0, - 0, 42, 42, 91, 92, 2, 2, 2, 2, 2, 2, 2, 2, 13, 9, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 9, 22, 80, 45, 22, 93, 61, 0, - 0, 94, 95, 94, 94, 96, 97, 0, 0, 2, 2, 2, 2, 2, 2, 2, - 0, 2, 2, 9, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, - 0, 2, 2, 2, 2, 29, 0, 0, 0, 2, 2, 2, 2, 2, 9, 0, - 0, 2, 2, 2, 52, 98, 45, 0, 0, 2, 2, 99, 100, 101, 102, 61, - 63, 103, 16, 45, 22, 59, 21, 80, 48, 48, 76, 11, 11, 11, 104, 46, - 40, 11, 105, 74, 2, 2, 2, 2, 2, 2, 2, 106, 22, 20, 20, 22, - 48, 48, 22, 107, 2, 2, 2, 9, 0, 0, 0, 0, 0, 0, 108, 109, - 109, 109, 109, 0, 0, 0, 0, 0, 0, 105, 74, 2, 2, 2, 2, 2, - 2, 60, 61, 59, 25, 22, 110, 61, 2, 2, 2, 2, 106, 22, 23, 45, - 45, 101, 111, 0, 0, 0, 0, 0, 0, 2, 2, 61, 18, 48, 23, 112, - 101, 101, 101, 113, 114, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 30, - 2, 11, 46, 115, 115, 115, 11, 115, 115, 15, 115, 115, 115, 26, 0, 40, - 0, 0, 0, 116, 51, 11, 5, 0, 0, 0, 0, 0, 0, 0, 117, 0, - 0, 0, 0, 0, 0, 0, 6, 118, 119, 42, 42, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 119, 119, 120, 119, 119, 119, 119, 119, 119, 119, - 119, 0, 0, 121, 0, 0, 0, 0, 0, 0, 7, 121, 0, 0, 0, 0, - 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 0, 0, 0, 0, 122, 122, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, - 30, 0, 0, 0, 0, 0, 0, 0, 123, 0, 122, 122, 0, 0, 0, 0, - 0, 2, 53, 2, 107, 2, 10, 2, 2, 2, 65, 19, 16, 0, 0, 31, - 0, 2, 2, 0, 0, 0, 0, 0, 0, 29, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 124, 23, 23, 23, 23, 23, 23, 23, 125, 0, 0, 0, 0, - 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 2, 0, 0, 0, 0, 0, - 52, 2, 2, 2, 22, 22, 126, 115, 0, 2, 2, 2, 127, 20, 59, 20, - 112, 101, 128, 0, 0, 0, 0, 0, 0, 11, 129, 2, 2, 2, 2, 2, - 2, 2, 130, 23, 22, 20, 48, 131, 132, 133, 0, 0, 0, 0, 0, 0, - 0, 2, 2, 52, 30, 2, 2, 2, 2, 2, 2, 2, 2, 10, 22, 59, - 98, 76, 134, 135, 136, 0, 0, 0, 0, 2, 137, 2, 2, 2, 2, 138, - 0, 30, 2, 42, 5, 0, 79, 15, 2, 139, 20, 53, 127, 139, 2, 2, - 140, 10, 9, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 141, 21, - 25, 0, 0, 142, 143, 0, 0, 0, 0, 2, 65, 45, 23, 80, 47, 144, - 0, 81, 81, 81, 81, 81, 81, 81, 81, 0, 0, 0, 0, 0, 0, 0, - 6, 119, 119, 119, 119, 120, 0, 0, 0, 2, 2, 2, 2, 2, 9, 2, - 2, 2, 9, 2, 30, 2, 2, 2, 2, 2, 30, 2, 2, 2, 30, 9, - 0, 127, 20, 27, 31, 0, 0, 145, 146, 2, 2, 30, 2, 30, 2, 2, - 2, 2, 2, 2, 0, 14, 37, 0, 147, 2, 2, 13, 37, 0, 30, 2, - 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 2, 2, - 9, 2, 2, 11, 41, 0, 0, 0, 0, 2, 2, 2, 0, 27, 22, 22, - 30, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 27, 38, - 0, 2, 2, 2, 115, 115, 115, 115, 115, 148, 2, 9, 0, 0, 0, 0, - 0, 2, 14, 14, 0, 0, 0, 0, 0, 9, 2, 2, 9, 2, 2, 2, - 2, 30, 2, 9, 0, 30, 2, 0, 0, 149, 150, 151, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 22, 22, 20, 20, 20, 22, 22, 133, 0, 0, 0, - 0, 0, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 2, 2, 2, 2, - 2, 53, 52, 53, 0, 0, 0, 0, 153, 11, 74, 2, 2, 2, 2, 2, - 2, 18, 19, 21, 16, 24, 37, 0, 0, 0, 31, 0, 0, 0, 0, 0, - 0, 11, 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, 127, 20, 22, 154, - 22, 21, 155, 156, 2, 2, 2, 2, 2, 0, 0, 65, 157, 0, 0, 0, - 0, 2, 13, 0, 0, 0, 0, 0, 0, 2, 65, 25, 20, 20, 20, 22, - 22, 107, 158, 0, 0, 56, 159, 31, 160, 30, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 23, 19, 22, 22, 161, 44, 0, 0, 0, - 49, 127, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 9, 9, 2, 2, - 30, 2, 2, 2, 2, 2, 2, 2, 30, 2, 2, 2, 2, 2, 2, 2, - 10, 18, 19, 21, 22, 162, 31, 0, 0, 11, 11, 30, 2, 2, 2, 9, - 30, 9, 2, 30, 2, 2, 58, 17, 23, 16, 23, 47, 32, 33, 32, 34, - 0, 0, 0, 0, 35, 0, 0, 0, 2, 2, 23, 0, 11, 11, 11, 46, - 0, 11, 11, 46, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 30, 0, - 9, 2, 2, 2, 30, 45, 59, 20, 20, 31, 33, 32, 32, 25, 163, 29, - 164, 165, 37, 0, 0, 0, 0, 0, 0, 12, 26, 0, 0, 0, 0, 0, - 0, 2, 2, 65, 25, 20, 20, 20, 22, 23, 125, 15, 17, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 0, 0, 166, 167, 0, 0, 0, 0, 0, 0, - 0, 18, 19, 20, 20, 66, 98, 25, 160, 11, 168, 9, 0, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 65, 25, 20, 20, 0, 48, 48, 11, - 169, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 20, - 0, 23, 19, 20, 20, 21, 16, 82, 169, 38, 0, 0, 0, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 10, 170, 25, 20, 22, 22, 168, 9, 0, 0, - 0, 2, 2, 2, 2, 2, 9, 43, 135, 23, 22, 20, 76, 21, 22, 0, - 0, 2, 2, 2, 9, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 18, - 19, 20, 21, 22, 104, 169, 37, 0, 0, 2, 2, 2, 9, 30, 0, 2, - 2, 2, 2, 30, 9, 2, 2, 2, 2, 23, 23, 18, 32, 33, 12, 171, - 165, 172, 173, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, - 2, 65, 25, 20, 20, 0, 22, 23, 29, 107, 0, 33, 0, 0, 0, 0, - 0, 52, 20, 22, 22, 22, 139, 2, 2, 2, 174, 140, 11, 15, 175, 61, - 176, 0, 0, 1, 147, 0, 0, 0, 0, 52, 20, 22, 16, 19, 20, 2, - 2, 2, 2, 158, 158, 158, 177, 177, 177, 177, 177, 177, 15, 178, 0, 30, - 0, 16, 20, 16, 16, 0, 0, 0, 0, 22, 20, 20, 31, 22, 22, 11, - 169, 0, 61, 61, 61, 61, 61, 61, 61, 66, 21, 82, 46, 0, 0, 0, - 0, 2, 2, 2, 9, 2, 30, 2, 2, 52, 22, 22, 31, 0, 38, 22, - 27, 11, 159, 179, 180, 0, 0, 0, 0, 2, 2, 2, 30, 9, 2, 2, - 2, 2, 2, 2, 2, 2, 23, 23, 47, 22, 35, 82, 68, 0, 0, 0, - 0, 2, 181, 66, 47, 0, 0, 0, 0, 11, 182, 2, 2, 2, 2, 2, - 2, 2, 2, 23, 22, 20, 31, 0, 48, 16, 143, 0, 0, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 156, 0, 0, 183, 183, 183, 183, 183, 183, 183, - 183, 184, 184, 184, 185, 186, 184, 183, 183, 187, 183, 183, 188, 189, 189, 189, - 189, 189, 189, 189, 0, 0, 0, 0, 0, 183, 183, 183, 183, 183, 190, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 22, 22, 22, 22, 22, 22, 191, 192, - 193, 11, 11, 11, 46, 0, 0, 0, 0, 29, 74, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 65, 47, 0, 2, 2, 2, 2, 2, 9, 0, - 58, 194, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 0, 0, 0, 40, 115, 26, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 30, 2, 2, 2, 2, 2, 0, 58, 37, 0, 6, 119, 119, 119, 120, 0, - 0, 11, 11, 11, 49, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 46, 2, 2, 2, 2, 2, 2, 11, - 11, 2, 2, 2, 2, 2, 2, 22, 22, 2, 2, 2, 2, 2, 2, 2, - 20, 2, 2, 44, 44, 44, 92, 0, 0, O, O, O, GB, B, B, O, - SB, O, SE, GB, O, O, WJ,FMPst,FMPst, O, CGJ, B, O, B,VMAbv,VMAbv, - VMAbv, O,VMAbv, B,CMBlw,CMBlw,CMBlw,VMAbv,VMPst, VAbv, VPst,CMBlw, B, VPst, VPre, VPst, - VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VPst, VPst, VPst, H, VPre, VPst,VMBlw, O, O, - VAbv, GB,VMAbv,VMPst,VMPst, O, B, VBlw, O, O, VPre, VPre, O, VPre, H, O, - VPst,FMAbv, O,CMBlw, O, VAbv, O, VAbv, H, O,VMBlw,VMAbv,CMAbv, GB, GB, O, - MBlw,CMAbv,CMAbv, VPst, VAbv,VMAbv, O, VPst, O, VPre, VPre,VMAbv, B, O, CS, CS, - VMPst, B, VAbv, VAbv, B, R, O, HVM, O, O,FMBlw, O,CMAbv, O,CMBlw, VAbv, - VBlw, B, SUB, SUB, SUB, O, SUB, SUB, O,FMBlw, O, B, VPst, VBlw, VPre,VMAbv, - VMBlw,VMPst, IS, VAbv, MPst, MPre, MBlw, MBlw, B, MBlw, MBlw, VPst,VMPst,VMPst, B, MBlw, - VPst, VPre, VAbv, VAbv,VMPst,VMPst,VMBlw, B,VMPst, VBlw, VPst, CGJ, CGJ, VPst,VMAbv,VMAbv, - FMAbv, FAbv,CMAbv,FMAbv,VMAbv,FMAbv, VAbv, IS,FMAbv, B,FMAbv, B, CGJ, WJ, CGJ, GB, - CMAbv,CMAbv, B, VAbv, SUB, FPst, FPst,VMBlw, FPst, FPst, FBlw,VMAbv,FMBlw, VAbv, VPre, B, - MPre, MBlw, SUB, FAbv, FAbv, MAbv, SUB, Sk, VPst, VAbv,VMAbv,VMAbv, FAbv,CMAbv, VPst, H, - B, O,SMAbv,SMAbv,SMAbv, VPst, IS, RK, RK, VBlw, FAbv,VMPre,VMPre,FMAbv,CMBlw,VMBlw, - VMBlw,VMAbv, CS, O,FMAbv, ZWNJ, CGJ, WJ, WJ, WJ, O,FMPst, O, SB, SE, O, - H, MPst, VPst, H,VMAbv, VAbv,VMBlw, B, VBlw, FPst, VPst, FAbv,VMPst, B,CMAbv, VAbv, - MBlw, MPst, MBlw, H, O, VBlw, MPst, MPre, MAbv, MBlw, O, B, FAbv, FAbv, FPst, VBlw, - B, VBlw,VMAbv, B, VPre, O,VMPst, IS, O,VMPst, VBlw, VPst,VMBlw,VMBlw,VMAbv, O, - IS,VMBlw, B,VMPst,VMAbv,VMPst, CS, CS, B, N, N, O, HN, VPre, VBlw, VAbv, - IS,CMAbv, O, VPst, B, R, R,CMBlw, VAbv, VPre,VMAbv,VMAbv, H, VAbv,CMBlw,VMPst, - O,VMAbv,CMBlw, IS, R,FMAbv, B, CS, CS, H,CMBlw,VMPst, H,VMPst, VAbv,VMAbv, - VPst, MPst, R, MPst,CMBlw, B,FMBlw, CS, SUB, SUB, GB, FBlw, FBlw,CMAbv, IS, VBlw, - IS, R, MBlw, GB, VAbv, R,VMPst, G, G, J, J, J, SB, SE, J, HR, - G, G, HM, HM, HM, G, O, MPre, MPre, MPst,VMAbv, MBlw, VBlw, O, VBlw, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, + 4, 2, 2, 2, 2, 5, 2, 2, 2, 2, 6, 0, 2, 2, 2, 2, + 2, 5, 8, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, + 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, + 0, 2, 2, 2, 2, 5, 0, 0, 0, 2, 2, 2, 2, 2, 5, 0, + 0, 2, 8, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 74, 75, + 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, + 2, 0, 2, 2, 2, 2, 2, 2, 2, 17, 6, 13, 29, 33, 29, 45, + 0, 15, 11, 27, 7, 38, 7, 68, 0, 2, 2, 2, 2, 8, 2, 2, + 2, 10, 10, 10, 10, 80, 10, 10, 10, 2, 2, 2, 2, 2, 2, 2, + 5, 2, 2, 5, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, + 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 5, 2, + 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, + 0, 9, 41, 2, 2, 2, 2, 2, 2, 8, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 23, 6, 6, 6, 6, 6, 6, 6, + 6, 0, 0, 0, 0, 0, 0, 48, 0, 44, 0, 0, 0, 0, 0, 49, + 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 103, 2, 2, 2, 2, 2, 36, 9, + 9, 9, 9, 0, 0, 0, 5, 31, 0, 2, 2, 2, 2, 50, 51, 0, + 0, 9, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, 32, + 19, 17, 6, 18, 7, 15, 11, 67, 22, 31, 52, 25, 6, 2, 2, 2, + 2, 104, 14, 8, 2, 2, 2, 5, 8, 5, 5, 0, 2, 2, 0, 32, + 19, 0, 0, 0, 34, 0, 0, 2, 8, 2, 0, 0, 0, 0, 0, 5, + 105, 31, 24, 8, 2, 2, 5, 0, 8, 5, 2, 8, 5, 2, 0, 35, + 19, 17, 13, 0, 25, 38, 25, 68, 0, 53, 0, 0, 0, 8, 2, 5, + 5, 54, 39, 77, 0, 0, 0, 0, 0, 31, 24, 8, 2, 2, 2, 2, + 8, 5, 2, 8, 2, 2, 0, 32, 19, 17, 6, 18, 25, 7, 34, 67, + 0, 0, 0, 0, 0, 8, 54, 54, 46, 31, 14, 8, 2, 2, 2, 5, + 8, 5, 2, 8, 2, 2, 0, 32, 20, 0, 0, 25, 7, 0, 0, 2, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 26, 8, 2, 2, 5, 0, + 2, 5, 2, 2, 0, 8, 5, 5, 2, 0, 8, 5, 0, 2, 5, 0, + 2, 2, 2, 2, 2, 2, 0, 0, 11, 15, 27, 0, 12, 33, 12, 45, + 0, 0, 0, 0, 34, 0, 0, 0, 0, 24, 14, 55, 2, 2, 2, 5, + 2, 2, 2, 2, 2, 2, 0, 32, 7, 0, 0, 25, 13, 2, 5, 0, + 0, 36, 14, 8, 2, 2, 2, 5, 2, 2, 2, 8, 2, 2, 0, 32, + 20, 0, 0, 34, 27, 0, 0, 0, 5, 106, 78, 0, 0, 0, 0, 0, + 0, 9, 14, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 30, 40, + 11, 17, 6, 13, 12, 33, 12, 45, 107, 0, 0, 0, 34, 0, 0, 0, + 8, 31, 14, 8, 2, 2, 2, 2, 2, 2, 2, 2, 5, 0, 2, 2, + 2, 2, 8, 2, 2, 2, 2, 8, 0, 2, 2, 2, 5, 0, 108, 0, + 34, 11, 7, 13, 13, 19, 12, 12, 22, 0, 11, 0, 0, 0, 0, 0, + 0, 2, 0, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, + 0, 2, 2, 69, 69, 109, 0, 0, 19, 56, 18, 21, 7, 7, 6, 6, + 26, 18, 9, 13, 9, 2, 2, 79, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 81, 0, 0, 0, 0, 110, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 23, 20, 21, 57, 7, 7, 111, 82, 112, 113, + 83, 2, 2, 2, 2, 2, 48, 0, 44, 2, 2, 2, 11, 6, 2, 2, + 114, 83, 84, 41, 23, 84, 14, 14, 2, 30, 7, 40, 2, 2, 2, 2, + 2, 2, 115, 58, 116, 14, 14, 117, 85, 2, 2, 2, 2, 2, 14, 20, + 0, 2, 21, 59, 0, 0, 0, 0, 8, 2, 21, 27, 0, 0, 0, 0, + 0, 2, 21, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 5, + 2, 5, 21, 0, 0, 0, 0, 0, 0, 2, 2, 4, 20, 7, 21, 6, + 12, 12, 12, 12, 24, 60, 118, 119, 120, 121, 122, 0, 0, 0, 0, 123, + 0, 5, 0, 0, 8, 0, 124, 4, 125, 39, 39, 126, 86, 2, 2, 2, + 2, 2, 2, 2, 2, 50, 5, 0, 0, 7, 59, 20, 7, 127, 10, 0, + 0, 70, 128, 70, 70, 129, 130, 0, 0, 2, 2, 2, 2, 2, 2, 2, + 0, 2, 2, 2, 2, 14, 0, 0, 0, 2, 2, 2, 30, 71, 20, 0, + 0, 2, 2, 131, 132, 42, 133, 10, 81, 134, 15, 20, 7, 21, 18, 59, + 12, 12, 58, 9, 9, 9, 87, 26, 53, 9, 88, 41, 2, 2, 2, 2, + 2, 2, 2, 89, 7, 6, 6, 7, 12, 12, 7, 61, 2, 2, 2, 5, + 0, 0, 0, 0, 0, 0, 135, 62, 62, 62, 62, 0, 0, 0, 0, 0, + 0, 88, 41, 2, 2, 2, 2, 2, 2, 79, 10, 21, 22, 7, 136, 10, + 2, 2, 2, 2, 89, 7, 11, 20, 20, 42, 137, 0, 0, 0, 0, 0, + 0, 2, 2, 10, 19, 12, 11, 90, 42, 42, 42, 138, 139, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 0, 8, 2, 9, 26, 16, 16, 16, 9, 16, + 16, 24, 16, 16, 16, 52, 0, 53, 0, 0, 0, 140, 78, 9, 44, 0, + 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 0, 0, 0, 0, 49, 142, + 3, 39, 39, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, + 72, 0, 0, 91, 0, 0, 0, 0, 0, 0, 76, 91, 0, 0, 0, 0, + 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 0, 0, 0, 0, 63, 63, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 143, 0, 63, 63, 0, 0, 0, 0, + 0, 2, 40, 2, 61, 2, 36, 2, 2, 2, 23, 17, 15, 0, 0, 13, + 0, 14, 2, 2, 2, 2, 2, 2, 2, 2, 2, 144, 11, 11, 11, 11, + 11, 11, 11, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 2, 0, 0, 0, 0, 0, 30, 2, 2, 2, 7, 7, 145, 16, + 0, 2, 2, 2, 47, 6, 21, 6, 90, 42, 146, 0, 0, 0, 0, 0, + 0, 9, 147, 2, 2, 2, 2, 2, 2, 2, 148, 11, 7, 6, 12, 149, + 150, 93, 0, 0, 0, 0, 0, 0, 0, 2, 2, 30, 8, 2, 2, 2, + 2, 2, 2, 2, 2, 36, 7, 21, 71, 58, 151, 94, 152, 0, 0, 0, + 0, 2, 153, 2, 2, 2, 2, 154, 0, 8, 2, 39, 44, 0, 85, 24, + 2, 73, 6, 40, 47, 73, 2, 2, 95, 36, 5, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 155, 18, 22, 0, 0, 156, 96, 0, 0, 0, + 0, 2, 23, 20, 11, 59, 27, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 49, 3, 3, 3, 3, 72, 0, 0, 0, 2, 5, 2, 8, 2, 2, 2, + 2, 2, 8, 2, 2, 2, 8, 5, 0, 47, 6, 25, 13, 0, 0, 158, + 159, 2, 2, 8, 2, 8, 2, 2, 2, 2, 2, 2, 0, 51, 35, 0, + 97, 2, 2, 50, 35, 0, 8, 2, 2, 0, 0, 0, 0, 8, 2, 2, + 5, 2, 2, 9, 54, 0, 0, 0, 0, 2, 2, 2, 0, 25, 7, 7, + 8, 2, 2, 2, 2, 2, 25, 38, 0, 2, 2, 2, 16, 16, 16, 16, + 16, 160, 2, 5, 0, 0, 0, 0, 0, 2, 51, 51, 0, 0, 0, 0, + 0, 5, 2, 2, 5, 2, 2, 2, 2, 8, 2, 5, 0, 8, 2, 0, + 0, 161, 162, 163, 2, 2, 2, 2, 2, 2, 2, 2, 2, 7, 7, 6, + 6, 6, 7, 7, 93, 0, 0, 0, 0, 0, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 2, 2, 2, 2, 2, 40, 30, 40, 0, 0, 0, 0, + 164, 19, 17, 18, 15, 67, 35, 0, 0, 0, 13, 0, 0, 0, 0, 0, + 0, 9, 55, 2, 2, 2, 2, 2, 2, 2, 2, 2, 47, 6, 7, 165, + 7, 18, 166, 98, 2, 2, 2, 2, 2, 0, 0, 23, 167, 0, 0, 0, + 0, 2, 50, 0, 0, 0, 0, 0, 0, 2, 23, 22, 6, 6, 6, 7, + 7, 61, 64, 0, 0, 69, 99, 13, 100, 2, 2, 2, 2, 2, 2, 11, + 17, 7, 7, 168, 46, 0, 0, 0, 55, 47, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 5, 5, 2, 2, 8, 2, 2, 2, 2, 2, 2, 2, + 8, 2, 2, 2, 2, 2, 2, 2, 36, 19, 17, 18, 7, 169, 13, 0, + 0, 9, 9, 8, 2, 2, 2, 5, 8, 5, 2, 8, 2, 2, 56, 32, + 11, 15, 11, 27, 29, 33, 29, 45, 0, 0, 0, 0, 34, 0, 0, 0, + 2, 2, 11, 0, 9, 9, 9, 26, 0, 9, 9, 26, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 8, 0, 5, 2, 2, 2, 8, 20, 21, 6, + 6, 13, 33, 29, 29, 22, 170, 14, 171, 101, 35, 0, 0, 0, 0, 0, + 0, 31, 52, 0, 0, 0, 0, 0, 0, 2, 2, 23, 22, 6, 6, 6, + 7, 11, 92, 24, 32, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, + 172, 173, 0, 0, 0, 0, 0, 0, 0, 19, 17, 6, 6, 57, 71, 22, + 100, 9, 102, 5, 0, 0, 0, 0, 0, 22, 6, 6, 0, 12, 12, 9, + 65, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 6, + 0, 11, 17, 6, 6, 18, 15, 60, 65, 38, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 36, 174, 22, 6, 7, 7, 102, 5, 0, 0, + 0, 2, 2, 2, 2, 2, 5, 77, 94, 11, 7, 6, 58, 18, 7, 0, + 0, 2, 2, 2, 5, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 19, + 17, 6, 18, 7, 87, 65, 35, 0, 0, 2, 2, 2, 5, 8, 0, 2, + 2, 2, 2, 8, 5, 2, 2, 2, 2, 11, 11, 19, 29, 33, 31, 175, + 101, 176, 177, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, + 2, 23, 22, 6, 6, 0, 7, 11, 14, 61, 0, 33, 0, 0, 0, 0, + 0, 30, 6, 7, 7, 7, 73, 2, 2, 2, 178, 95, 9, 24, 179, 10, + 180, 0, 0, 48, 97, 0, 0, 0, 0, 30, 6, 7, 15, 17, 6, 2, + 2, 2, 2, 64, 64, 64, 43, 43, 43, 43, 43, 43, 24, 181, 0, 8, + 0, 15, 6, 15, 15, 0, 0, 0, 0, 7, 6, 6, 13, 7, 7, 9, + 65, 0, 10, 10, 10, 10, 10, 10, 10, 57, 18, 60, 26, 0, 0, 0, + 0, 2, 2, 2, 5, 2, 8, 2, 2, 30, 7, 7, 13, 0, 38, 7, + 25, 9, 99, 182, 183, 0, 0, 0, 0, 2, 2, 2, 8, 5, 2, 2, + 2, 2, 2, 2, 2, 2, 11, 11, 27, 7, 34, 60, 82, 0, 0, 0, + 0, 2, 184, 57, 27, 0, 0, 0, 0, 9, 185, 2, 2, 2, 2, 2, + 2, 2, 2, 11, 7, 6, 13, 0, 12, 15, 96, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 98, 0, 0, 66, 66, 66, 186, 187, 66, 1, + 1, 188, 1, 1, 189, 37, 37, 37, 37, 37, 37, 37, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 190, 0, 0, 2, 2, 2, 2, 2, 2, 2, + 7, 7, 7, 7, 7, 7, 191, 192, 193, 9, 9, 9, 26, 0, 0, 0, + 0, 14, 41, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 23, 27, + 0, 2, 2, 2, 2, 2, 5, 0, 56, 194, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 0, 0, 0, 53, 16, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 2, 2, 2, 2, 2, 0, 56, 35, 0, 49, 3, 3, 3, 72, 0, + 0, 9, 9, 9, 55, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 26, 2, 2, 2, 2, 2, 2, 9, + 9, 2, 2, 2, 2, 2, 2, 7, 7, 2, 2, 2, 2, 2, 2, 2, + 6, 2, 2, 46, 46, 46, 86, 0, 0, O, O, G, G, B, B, WJ, + WJ, CGJ, CGJ, B, O, VBlw, VBlw, VAbv, VAbv, O, B,VMAbv,VMAbv, SUB, SUB, VPst, + VPst, VPre, VPre, VBlw, O,VMPst,VMPst, VAbv, VPst,VMBlw,VMBlw, VPst, VBlw, VBlw, VAbv, VPst, + VPre, VPst, VAbv, VAbv, VBlw, VPre, VPst, B, VPst,VMAbv,VMPst, O, VAbv,VMAbv, O, VPst, + O, N, N, O, VPre, B, VAbv, O,VMAbv,CMBlw, B, VPre, O, O, VPst,CMBlw, + O, B,VMAbv, HM, HM, VAbv, O, GB, GB, VAbv, B,VMPst, B, FAbv, FAbv, FBlw, + FBlw, GB, O, VPre, H,CMAbv,CMAbv, B, VBlw, O, GB, O, WJ, B,CMBlw,CMBlw, + CMBlw,VMBlw, O, O,VMBlw,VMAbv,CMAbv,VMAbv, B, O,CMBlw, VBlw, VPre, VPre, VAbv, VBlw, + VPst, VPst,VMAbv, H, B,SMAbv,SMAbv, SB, SE, R, R,VMPst, H, J, J, VPst, + H, VAbv, H, O,FMBlw, FPst, FPst, VAbv, VPre, WJ, O, VBlw, B, O, SB, O, + SE,FMPst,FMPst, O, MBlw, CS,VMPst, B, SUB, O, SUB, SUB, O,VMPst, IS, MBlw, + B, VPst,VMPst, B,VMPst,CMAbv, B, VAbv,VMAbv,VMAbv, FAbv,CMAbv, VPst, VBlw, FAbv,FMPst, + O, H,VMAbv, H, O, MPre, MAbv, VBlw,VMAbv, IS, O, O, IS,CMAbv, O,CMBlw, + VAbv, VPre,VMAbv, IS, R, H,CMBlw, O, CGJ, GB,VMAbv,FMAbv, O, O, CS, R, + O, HVM, O, O,CMAbv,FMBlw, O,VMAbv,VMBlw, VAbv, MPst, MPre, MBlw, MBlw, MBlw, MBlw, + VPst, VAbv,VMPst,VMPst,VMBlw,VMAbv,FMAbv, FAbv,CMAbv,FMAbv,VMAbv,FMAbv, VAbv, IS,FMAbv, B, + FMAbv, B, CGJ, WJ, CGJ, GB,CMAbv, VAbv, SUB,VMBlw, FPst, FPst, FBlw,VMAbv,FMBlw, B, + MPre, MBlw, SUB, MAbv, SUB, Sk, VPst, O,SMAbv, VPst, IS, RK, RK,VMPre,VMPre,FMAbv, + CMBlw,VMAbv, CS, O,FMAbv, ZWNJ, CGJ, O, H, MPst, VPst, VAbv,VMBlw, FPst, VPst, FAbv, + VMPst, B,CMAbv, VAbv, MBlw, MPst, MBlw, VBlw, MPst, MBlw, O, B, FAbv, FAbv, FPst, B, + VPre, O,VMPst,VMPst, VBlw, VPst,VMBlw,VMBlw,VMAbv,VMBlw, B,VMPst,VMAbv,VMPst, CS, CS, + B, O, HN, VPre, VBlw, VAbv, IS, VPst, B,VMAbv, H, VAbv,CMBlw,VMPst, O,VMAbv, + CMBlw,FMAbv, B, CS, CS,VMPst, VAbv,VMAbv, VPst, MPst, R, MPst,CMBlw, B,FMBlw, CS, + SUB, SUB, GB,CMAbv, IS, VBlw, IS, R, MBlw, GB, VAbv, R,VMPst, J, SB, SE, + J, HR, G, G, HM, G, O, MPre, MPre, MPst,VMAbv, MBlw, VBlw, O, VBlw, }; static const uint16_t hb_use_u16[864]= { - 0, 0, 1, 2, 0, 3, 0, 3, 0, 0, 4, 5, 0, 6, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 10, 11, 12, - 0, 0, 0, 0, 10, 13, 0, 0, 14, 10, 10, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 18, 26, 27, 21, 22, 28, 29, 30, 31, 32, - 33, 34, 22, 35, 36, 0, 18, 37, 38, 21, 22, 39, 24, 40, 18, 41, - 42, 43, 44, 45, 46, 47, 31, 0, 48, 49, 22, 50, 51, 52, 18, 0, - 53, 49, 22, 54, 51, 55, 18, 56, 57, 49, 10, 58, 59, 60, 18, 0, - 61, 62, 10, 63, 64, 65, 31, 66, 67, 68, 10, 69, 70, 10, 71, 72, - 73, 74, 75, 76, 77, 0, 0, 0, 10, 10, 78, 79, 80, 81, 82, 83, - 84, 85, 0, 0, 0, 0, 0, 0, 10, 86, 10, 87, 10, 88, 89, 90, - 10, 10, 10, 91, 92, 93, 2, 0, 94, 0, 10, 10, 10, 10, 10, 95, - 96, 10, 97, 0, 0, 0, 0, 0, 10, 98, 99,100, 31, 10,101,102, - 10, 10,103, 10,104,105, 0, 0, 10,106, 10, 10, 10,107,108,109, - 2, 2, 0, 0, 0, 0, 0, 0,110, 10, 10,111,112, 2,113,114, - 115, 10,116, 10, 10, 10,117,118, 10, 10,119,120,121, 0, 0, 0, - 0, 0, 0, 0, 0,122,123,124, 0, 0, 0, 0, 0, 0, 0,125, - 126,127,128, 0, 0, 0,129,130,131, 0, 0, 0, 0, 0, 0,132, - 0, 0, 0, 0,133, 0, 0, 0, 0, 0, 0, 0, 0, 0,134, 0, - 0, 0, 0, 10, 10, 10,135,136, 0, 0,137, 0, 0, 0, 0, 0, - 138, 10,139, 0, 10, 10, 10,140,141, 10, 10,142,143, 2,144,145, - 10, 10,146, 10,147,148, 0, 0,149, 10, 10,150,151, 2,152, 98, - 10, 10,153,154,155, 2, 10,156, 10, 10, 10,157,158, 0,159,160, - 0, 0, 0, 0, 10, 10,161, 2,162, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0,163, 0, 0, 0, 0, 0, 0, 0,164, - 0, 0, 0, 0, 0, 0, 0,165,165,166, 34,167, 0, 0, 0, 0, - 168,169, 10,170, 95, 0, 0, 0, 0, 0, 0, 0, 70, 10,171, 0, - 10,172,173, 0, 0, 0, 0, 0, 10, 10,174, 2, 9, 10,175, 10, - 176, 0, 0, 0, 0, 0, 0, 0, 10, 10,177,172, 0, 0, 0, 0, - 0, 0, 0, 10,178,179, 0, 10,180, 0, 0,181,182, 0, 0, 0, - 183, 10, 10,184,185,186,187,188,189, 10, 10,190,191, 0, 0, 0, - 192, 10,193,194,195, 10, 10,196,189, 10, 10,197,198,105,199,102, - 10, 34,200,201,202, 0, 0, 0,203,204, 95, 10, 10,205,206, 2, - 207, 21, 22,208,209,210,211,212,213, 10, 10,214,215,216,217, 0, - 10, 10, 10,218,219,220,221, 0,199, 10, 10,222,223, 2, 0, 0, - 10, 10,224,225,226,227, 0, 0, 10, 10, 10,228,229, 2, 0, 0, - 10, 10,230,231, 2, 10,140, 0, 10,232,233,103,234, 0, 0, 0, - 10, 10,235,236, 0, 0, 0, 0,237,238, 10,239,240, 2, 0, 0, - 0, 0,241, 10, 10,242,243, 0,244, 10, 10,245,246,247, 10, 10, - 248,249, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,250, 0, - 22, 10,224,251, 8, 10, 71, 19, 10,252, 74,253, 0, 0, 0, 0, - 254, 10, 10,255,256, 2,257, 10,258,259, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 10,260,261, 49, 10,262,263,264, 0, 0, - 265,265,265,265,265,265,265,265,265,265,265,266,267,268,265,265, - 265,265,265,265,265,265,265,269, 10,270,271, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 0, 0, 10, 10, 10,272, 0, 0, 0, 0, - 0, 0, 0, 0,273, 10,274, 2, 10, 10, 10, 10,275,276,277,277, - 278,279, 0, 0, 0, 0,280, 0, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10,176, 0,281, 10, 10, 10, 10, 10, 10,105, 71, - 95,282, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,283, - 10, 10, 71,284,285, 0, 0, 0, 0, 10,286, 0, 10, 10,287, 2, - 0, 0, 0, 0, 0, 10,288, 2, 0, 0, 0, 0, 0, 10,289,105, - 10, 10, 10, 10,290, 2, 0, 0,129,129,129,129,129,129,129,129, - 162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,129, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, + 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, + 0, 0, 272, 32, 0, 120, 0, 120, 0, 0, 280, 288, 0, 296, 0, 0, + 0, 0, 0, 0, 304, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 136, 24, 312, 320, 0, 0, 0, 0, 24, 328, 0, 0, + 336, 24, 24, 344, 352, 360, 56, 144, 368, 64, 48, 376, 152, 384, 56, 392, + 400, 64, 48, 408, 416, 424, 72, 432, 440, 112, 48, 448, 456, 0, 56, 464, + 472, 64, 48, 480, 152, 488, 56, 496, 504, 512, 520, 528, 536, 544, 72, 0, + 552, 80, 48, 560, 160, 568, 56, 0, 576, 80, 48, 584, 160, 592, 56, 600, + 608, 80, 24, 616, 624, 632, 56, 0, 640, 648, 24, 656, 664, 672, 72, 680, + 688, 696, 24, 704, 168, 24, 88, 712, 720, 176, 728, 736, 744, 0, 0, 0, + 24, 24, 752, 760, 768, 776, 784, 792, 800, 808, 0, 0, 0, 0, 0, 0, + 24, 816, 24, 824, 24, 832, 840, 848, 24, 24, 24, 856, 864, 872, 32, 0, + 880, 0, 24, 24, 24, 24, 24, 96, 888, 24, 896, 0, 0, 0, 0, 0, + 24, 184, 904, 912, 72, 24, 920, 192, 24, 24, 200, 24, 928, 104, 0, 0, + 24, 936, 24, 24, 24, 944, 952, 960, 32, 32, 0, 0, 0, 0, 0, 0, + 968, 24, 24, 976, 984, 32, 992,1000,1008, 24,1016, 24, 24, 24,1024,1032, + 24, 24,1040,1048,1056, 0, 0, 0, 0, 0, 0, 0, 0,1064,1072,1080, + 0, 0, 0, 0, 0, 0, 0,1088,1096,1104,1112, 0, 0, 0, 16,1120, + 1128, 0, 0, 0, 0, 0, 0,1136, 0, 0, 0, 0,1144, 0, 0, 0, + 0, 0, 0, 0, 0, 0,1152, 0, 0, 0, 0, 24, 24, 24,1160,1168, + 0, 0,1176, 0, 0, 0, 0, 0,1184, 24,1192, 0, 24, 24, 24, 208, + 1200, 24, 24,1208,1216, 32,1224,1232, 24, 24,1240, 24,1248,1256, 0, 0, + 1264, 24, 24,1272,1280, 32,1288, 184, 24, 24,1296,1304,1312, 32, 24,1320, + 24, 24, 24,1328,1336, 0,1344,1352, 0, 0, 0, 0, 24, 24,1360, 32, + 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1368, + 0, 0, 0, 0, 0, 0, 0,1376, 0, 0, 0, 0, 0, 0, 0, 216, + 216,1384, 112,1392, 0, 0, 0, 0,1400,1408, 24,1416, 96, 0, 0, 0, + 0, 0, 0, 0, 168, 24,1424, 0, 24, 224,1432, 0, 0, 0, 0, 0, + 24, 24,1440, 32, 136, 24,1448, 24, 232, 0, 0, 0, 0, 0, 0, 0, + 24, 24,1456, 224, 0, 0, 0, 0, 0, 0, 0, 24,1464,1472, 0, 24, + 1480, 0, 0,1488,1496, 0, 0, 0,1504, 24, 24,1512,1520,1528,1536,1544, + 240, 24, 24,1552,1560, 0, 0, 0,1568, 24,1576,1584,1592, 24, 24,1600, + 240, 24, 24,1608,1616, 104, 248, 192, 24, 112,1624,1632,1640, 0, 0, 0, + 1648,1656, 96, 24, 24,1664,1672, 32,1680, 64, 48,1688,1696,1704,1712,1720, + 1728, 24, 24,1736,1744,1752,1760, 0, 24, 24, 24,1768,1776,1784,1792, 0, + 248, 24, 24,1800,1808, 32, 0, 0, 24, 24, 256,1816,1824,1832, 0, 0, + 24, 24, 24,1840,1848, 32, 0, 0, 24, 24,1856,1864, 32, 24, 208, 0, + 24,1872,1880, 200,1888, 0, 0, 0, 24, 24,1896,1904, 0, 0, 0, 0, + 1912,1920, 24,1928,1936, 32, 0, 0, 0, 0,1944, 24, 24,1952,1960, 0, + 1968, 24, 24,1976,1984,1992, 24, 24,2000,2008, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,2016, 0, 48, 24, 256,2024, 128, 24, 88, 144, + 24,2032, 176,2040, 0, 0, 0, 0,2048, 24, 24,2056,2064, 32,2072, 24, + 2080,2088, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24,2096, + 2104, 80, 24,2112,2120,2128, 0, 0, 8, 8, 8,2136,2144,2152, 8, 8, + 8, 8, 8, 8, 8, 8, 8,2160, 24,2168,2176, 32, 0, 0, 0, 0, + 0, 0, 0, 0, 32, 0, 0, 0, 24, 24, 24,2184, 0, 0, 0, 0, + 0, 0, 0, 0,2192, 24,2200, 32, 24, 24, 24, 24,2208,2216, 264, 264, + 2224,2232, 0, 0, 0, 0,2240, 0, 24, 24, 24, 24, 24, 232, 0,2248, + 24, 24, 24, 24, 24, 24, 104, 88, 96,2256, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,2264, 24, 24, 88,2272,2280, 0, 0, 0, + 0, 24,2288, 0, 24, 24,2296, 32, 0, 0, 0, 0, 0, 24,2304, 32, + 0, 0, 0, 0, 0, 24,2312, 104, 24, 24, 24, 24,2320, 32, 0, 0, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 16, }; static inline uint8_t hb_use_b4 (const uint8_t* a, unsigned i) @@ -379,7 +379,8 @@ static inline uint8_t hb_use_b4 (const uint8_t* a, unsigned i) } static inline uint8_t hb_use_get_category (unsigned u) { - return u<921600 ? hb_use_u8[2953u+((hb_use_u8[625u+((hb_use_u16[((hb_use_u8[113u+((hb_use_b4(hb_use_u8,((((((((u)>>1))>>3))>>3))>>5)))<<5)+((((((((u)>>1))>>3))>>3))&31)])<<3)+((((((u)>>1))>>3))&7)])<<3)+((((u)>>1))&7)])<<1)+((u)&1)] : O; + /* packtab: [2^4,2^5,2^3,2^3,2^1] */ + return u<921600u ? (uint8_t)(hb_use_u8[2953u+((hb_use_u8[625u+hb_use_u16[((hb_use_u8[113u+((hb_use_b4(hb_use_u8,((((((((u)>>1))>>3))>>3))>>5)))<<5)+((((((((u)>>1))>>3))>>3))&31)])<<3)+((((((u)>>1))>>3))&7)]+((((u)>>1))&7)])<<1)+((u)&1)]) : O; } @@ -389,269 +390,269 @@ static inline uint8_t hb_use_get_category (unsigned u) static const uint8_t hb_use_u8[3663]= { - 16, 50, 51, 51, 51, 52, 51, 83, 118, 131, 57, 58, 59, 195, 211, 62, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 15, 0, 1, 1, 2, 1, 1, 3, 4, 5, 6, 7, 8, 9, 10, 1, - 11, 12, 1, 1, 1, 1, 1, 1, 13, 14, 15, 16, 17, 18, 19, 1, - 1, 20, 1, 1, 1, 1, 21, 1, 22, 1, 1, 1, 1, 1, 23, 24, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 25, 26, 27, 28, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 29, - 30, 1, 1, 1, 1, 1, 31, 1, 1, 1, 1, 32, 33, 1, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 53, 53, 53, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 56, 1, 1, 1, 1, 1, 1, 1, 1, 57, 58, 1, 59, 1, - 60, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 61, 62, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 63, 1, 1, - 1, 1, 64, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 65, 66, 1, 67, 68, 1, 1, 1, 69, 1, 1, 1, 1, 1, - 1, 70, 71, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 0, 1, 2, 2, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 9, 0, 0, 0, 0, - 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 37, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 0, 56, 57, 58, 59, 60, 0, 0, 0, 61, 62, 63, 64, 56, 65, 66, - 67, 68, 56, 56, 69, 70, 71, 0, 0, 72, 73, 74, 75, 56, 76, 77, - 0, 78, 56, 79, 80, 81, 0, 0, 0, 82, 83, 84, 85, 86, 87, 56, - 88, 56, 89, 90, 0, 0, 0, 91, 92, 0, 0, 0, 0, 0, 0, 0, - 93, 94, 95, 0, 96, 97, 0, 0, 98, 0, 0, 0, 0, 0, 0, 99, - 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 101, 56, 102, 0, 0, 0, - 0, 0, 103, 0, 0, 0, 0, 0, 0, 104, 105, 56, 106, 107, 108, 109, - 110, 56, 111, 112, 0, 113, 114, 115, 116, 56, 117, 118, 119, 56, 120, 121, - 122, 0, 0, 0, 0, 0, 0, 56, 123, 124, 0, 0, 0, 0, 0, 0, - 125, 0, 0, 0, 0, 0, 0, 0, 126, 0, 0, 0, 127, 128, 129, 0, - 0, 130, 131, 132, 0, 0, 0, 51, 133, 0, 0, 0, 0, 134, 135, 0, - 0, 56, 136, 7, 137, 138, 0, 0, 0, 0, 0, 0, 0, 56, 139, 0, - 0, 0, 101, 140, 101, 141, 142, 143, 0, 144, 145, 146, 147, 148, 149, 150, - 0, 151, 152, 153, 154, 148, 155, 156, 157, 158, 159, 160, 0, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, 172, 56, 173, 174, 175, 176, 177, 178, - 0, 0, 0, 0, 0, 56, 179, 180, 0, 56, 181, 182, 0, 56, 183, 184, - 185, 186, 187, 188, 0, 0, 0, 0, 0, 56, 189, 0, 0, 0, 0, 0, - 0, 190, 191, 192, 0, 0, 193, 194, 195, 196, 197, 198, 56, 199, 0, 0, - 0, 0, 0, 0, 200, 0, 0, 0, 0, 201, 202, 203, 204, 205, 206, 0, - 0, 207, 208, 209, 210, 211, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 212, 213, 214, 215, 0, 0, 0, 0, 0, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 217, 218, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 219, 220, 221, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, - 0, 56, 222, 0, 0, 0, 0, 0, 0, 0, 0, 223, 224, 0, 0, 0, - 0, 56, 56, 225, 226, 227, 0, 0, 228, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 229, 230, 56, 56, 56, 231, 232, 0, 0, - 0, 0, 0, 0, 233, 0, 0, 0, 0, 56, 234, 235, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 101, 236, 56, 237, 0, 0, 0, 0, 0, 0, 101, - 238, 0, 0, 0, 0, 0, 0, 101, 239, 56, 56, 240, 0, 0, 0, 0, - 0, 241, 241, 241, 241, 241, 241, 241, 241, 242, 242, 242, 242, 242, 242, 242, - 243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, - 0, 5, 0, 0, 0, 0, 0, 6, 0, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 11, - 11, 11, 11, 0, 0, 0, 9, 12, 0, 2, 2, 2, 2, 13, 14, 0, - 0, 11, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 17, - 18, 19, 20, 21, 22, 16, 23, 24, 25, 12, 26, 27, 20, 2, 2, 2, - 2, 2, 20, 0, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, - 2, 28, 29, 30, 2, 2, 2, 9, 30, 9, 30, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 9, 2, 2, 2, 9, 9, 0, 2, 2, 0, 17, - 18, 19, 20, 31, 32, 33, 32, 34, 0, 0, 0, 0, 35, 0, 0, 2, - 30, 2, 0, 0, 0, 0, 0, 9, 36, 12, 15, 30, 2, 2, 9, 0, - 30, 9, 2, 30, 9, 2, 0, 37, 18, 19, 31, 0, 27, 38, 27, 39, - 0, 40, 0, 0, 0, 30, 2, 9, 9, 0, 0, 0, 2, 2, 2, 2, - 2, 41, 42, 43, 0, 0, 0, 0, 0, 12, 15, 30, 2, 2, 2, 2, - 30, 2, 30, 2, 2, 2, 2, 2, 2, 9, 2, 30, 2, 2, 0, 17, - 18, 19, 20, 21, 27, 22, 35, 24, 0, 0, 0, 0, 0, 30, 41, 41, - 44, 12, 29, 30, 2, 2, 2, 9, 30, 9, 2, 30, 2, 2, 0, 17, - 45, 0, 0, 27, 22, 0, 0, 2, 30, 30, 0, 0, 0, 0, 0, 0, - 0, 0, 46, 30, 2, 2, 9, 0, 2, 9, 2, 2, 0, 30, 9, 9, - 2, 0, 30, 9, 0, 2, 9, 0, 2, 2, 2, 2, 2, 2, 0, 0, - 23, 16, 47, 0, 48, 33, 48, 34, 0, 0, 0, 0, 35, 0, 0, 0, - 0, 15, 29, 49, 2, 2, 2, 9, 2, 9, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 0, 17, 22, 16, 23, 47, 22, 38, 22, 39, - 0, 0, 0, 27, 31, 2, 9, 0, 0, 10, 29, 30, 2, 2, 2, 9, - 2, 2, 2, 30, 2, 2, 0, 17, 45, 0, 0, 35, 47, 0, 0, 0, - 9, 50, 51, 0, 0, 0, 0, 0, 0, 11, 29, 2, 2, 2, 2, 9, - 2, 2, 2, 2, 2, 2, 52, 53, 23, 19, 20, 31, 48, 33, 48, 34, - 54, 0, 0, 0, 35, 0, 0, 0, 30, 12, 29, 30, 2, 2, 2, 2, - 2, 2, 2, 2, 9, 0, 2, 2, 2, 2, 30, 2, 2, 2, 2, 30, - 0, 2, 2, 2, 9, 0, 55, 0, 35, 23, 22, 31, 31, 18, 48, 48, - 25, 0, 23, 0, 0, 0, 0, 0, 0, 2, 0, 2, 9, 0, 0, 0, - 0, 0, 0, 0, 0, 20, 0, 0, 0, 2, 2, 56, 56, 57, 0, 0, - 18, 2, 2, 2, 2, 30, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9, - 0, 58, 21, 59, 22, 22, 20, 20, 46, 21, 11, 31, 11, 2, 2, 60, - 61, 61, 61, 61, 61, 62, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 63, 0, 0, 0, 0, 64, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 65, 45, 59, 66, 22, 22, 67, 68, 69, 70, - 71, 2, 2, 2, 2, 2, 1, 0, 5, 2, 2, 2, 23, 20, 2, 2, - 72, 71, 73, 74, 65, 73, 29, 29, 2, 52, 22, 53, 2, 2, 2, 2, - 2, 2, 75, 76, 77, 29, 29, 78, 79, 2, 2, 2, 2, 2, 29, 45, - 0, 2, 59, 80, 0, 0, 0, 0, 30, 2, 59, 47, 0, 0, 0, 0, - 0, 2, 59, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 9, - 2, 9, 59, 0, 0, 0, 0, 0, 0, 2, 2, 81, 45, 22, 59, 20, - 48, 48, 48, 48, 15, 82, 83, 84, 85, 86, 87, 0, 0, 0, 0, 88, - 0, 9, 0, 0, 30, 0, 89, 81, 90, 2, 2, 2, 2, 9, 0, 0, - 0, 42, 42, 91, 92, 2, 2, 2, 2, 2, 2, 2, 2, 13, 9, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 9, 22, 80, 45, 22, 93, 61, 0, - 0, 94, 95, 94, 94, 96, 97, 0, 0, 2, 2, 2, 2, 2, 2, 2, - 0, 2, 2, 9, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, - 0, 2, 2, 2, 2, 29, 0, 0, 0, 2, 2, 2, 2, 2, 9, 0, - 0, 2, 2, 2, 52, 98, 45, 0, 0, 2, 2, 99, 100, 101, 102, 61, - 63, 103, 16, 45, 22, 59, 21, 80, 48, 48, 76, 11, 11, 11, 104, 46, - 40, 11, 105, 74, 2, 2, 2, 2, 2, 2, 2, 106, 22, 20, 20, 22, - 48, 48, 22, 107, 2, 2, 2, 9, 0, 0, 0, 0, 0, 0, 108, 109, - 109, 109, 109, 0, 0, 0, 0, 0, 0, 105, 74, 2, 2, 2, 2, 2, - 2, 60, 61, 59, 25, 22, 110, 61, 2, 2, 2, 2, 106, 22, 23, 45, - 45, 101, 111, 0, 0, 0, 0, 0, 0, 2, 2, 61, 18, 48, 23, 112, - 101, 101, 101, 113, 114, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 30, - 2, 11, 46, 115, 115, 115, 11, 115, 115, 15, 115, 115, 115, 26, 0, 40, - 0, 0, 0, 116, 51, 11, 5, 0, 0, 0, 0, 0, 0, 0, 117, 0, - 0, 0, 0, 0, 0, 0, 6, 118, 119, 42, 42, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 119, 119, 120, 119, 119, 119, 119, 119, 119, 119, - 119, 0, 0, 121, 0, 0, 0, 0, 0, 0, 7, 121, 0, 0, 0, 0, - 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 0, 0, 0, 0, 122, 122, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, - 30, 0, 0, 0, 0, 0, 0, 0, 123, 0, 122, 122, 0, 0, 0, 0, - 0, 2, 53, 2, 107, 2, 10, 2, 2, 2, 65, 19, 16, 0, 0, 31, - 0, 2, 2, 0, 0, 0, 0, 0, 0, 29, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 124, 23, 23, 23, 23, 23, 23, 23, 125, 0, 0, 0, 0, - 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, 2, 0, 0, 0, 0, 0, - 52, 2, 2, 2, 22, 22, 126, 115, 0, 2, 2, 2, 127, 20, 59, 20, - 112, 101, 128, 0, 0, 0, 0, 0, 0, 11, 129, 2, 2, 2, 2, 2, - 2, 2, 130, 23, 22, 20, 48, 131, 132, 133, 0, 0, 0, 0, 0, 0, - 0, 2, 2, 52, 30, 2, 2, 2, 2, 2, 2, 2, 2, 10, 22, 59, - 98, 76, 134, 135, 136, 0, 0, 0, 0, 2, 137, 2, 2, 2, 2, 138, - 0, 30, 2, 42, 5, 0, 79, 15, 2, 139, 20, 53, 127, 139, 2, 2, - 140, 10, 9, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 141, 21, - 25, 0, 0, 142, 143, 0, 0, 0, 0, 2, 65, 45, 23, 80, 47, 144, - 0, 81, 81, 81, 81, 81, 81, 81, 81, 0, 0, 0, 0, 0, 0, 0, - 6, 119, 119, 119, 119, 120, 0, 0, 0, 2, 2, 2, 2, 2, 9, 2, - 2, 2, 9, 2, 30, 2, 2, 2, 2, 2, 30, 2, 2, 2, 30, 9, - 0, 127, 20, 27, 31, 0, 0, 145, 146, 2, 2, 30, 2, 30, 2, 2, - 2, 2, 2, 2, 0, 14, 37, 0, 147, 2, 2, 13, 37, 0, 30, 2, - 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 2, 2, - 9, 2, 2, 11, 41, 0, 0, 0, 0, 2, 2, 2, 0, 27, 22, 22, - 30, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 27, 38, - 0, 2, 2, 2, 115, 115, 115, 115, 115, 148, 2, 9, 0, 0, 0, 0, - 0, 2, 14, 14, 0, 0, 0, 0, 0, 9, 2, 2, 9, 2, 2, 2, - 2, 30, 2, 9, 0, 30, 2, 0, 0, 149, 150, 151, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 22, 22, 20, 20, 20, 22, 22, 133, 0, 0, 0, - 0, 0, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 2, 2, 2, 2, - 2, 53, 52, 53, 0, 0, 0, 0, 153, 11, 74, 2, 2, 2, 2, 2, - 2, 18, 19, 21, 16, 24, 37, 0, 0, 0, 31, 0, 0, 0, 0, 0, - 0, 11, 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, 127, 20, 22, 154, - 22, 21, 155, 156, 2, 2, 2, 2, 2, 0, 0, 65, 157, 0, 0, 0, - 0, 2, 13, 0, 0, 0, 0, 0, 0, 2, 65, 25, 20, 20, 20, 22, - 22, 107, 158, 0, 0, 56, 159, 31, 160, 30, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 23, 19, 22, 22, 161, 44, 0, 0, 0, - 49, 127, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 9, 9, 2, 2, - 30, 2, 2, 2, 2, 2, 2, 2, 30, 2, 2, 2, 2, 2, 2, 2, - 10, 18, 19, 21, 22, 162, 31, 0, 0, 11, 11, 30, 2, 2, 2, 9, - 30, 9, 2, 30, 2, 2, 58, 17, 23, 16, 23, 47, 32, 33, 32, 34, - 0, 0, 0, 0, 35, 0, 0, 0, 2, 2, 23, 0, 11, 11, 11, 46, - 0, 11, 11, 46, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 30, 0, - 9, 2, 2, 2, 30, 45, 59, 20, 20, 31, 33, 32, 32, 25, 163, 29, - 164, 165, 37, 0, 0, 0, 0, 0, 0, 12, 26, 0, 0, 0, 0, 0, - 0, 2, 2, 65, 25, 20, 20, 20, 22, 23, 125, 15, 17, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 0, 0, 166, 167, 0, 0, 0, 0, 0, 0, - 0, 18, 19, 20, 20, 66, 98, 25, 160, 11, 168, 9, 0, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 65, 25, 20, 20, 0, 48, 48, 11, - 169, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 20, - 0, 23, 19, 20, 20, 21, 16, 82, 169, 38, 0, 0, 0, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 10, 170, 25, 20, 22, 22, 168, 9, 0, 0, - 0, 2, 2, 2, 2, 2, 9, 43, 135, 23, 22, 20, 76, 21, 22, 0, - 0, 2, 2, 2, 9, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 18, - 19, 20, 21, 22, 104, 169, 37, 0, 0, 2, 2, 2, 9, 30, 0, 2, - 2, 2, 2, 30, 9, 2, 2, 2, 2, 23, 23, 18, 32, 33, 12, 171, - 165, 172, 173, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, - 2, 65, 25, 20, 20, 0, 22, 23, 29, 107, 0, 33, 0, 0, 0, 0, - 0, 52, 20, 22, 22, 22, 139, 2, 2, 2, 174, 140, 11, 15, 175, 61, - 176, 0, 0, 1, 147, 0, 0, 0, 0, 52, 20, 22, 16, 19, 20, 2, - 2, 2, 2, 158, 158, 158, 177, 177, 177, 177, 177, 177, 15, 178, 0, 30, - 0, 16, 20, 16, 16, 0, 0, 0, 0, 22, 20, 20, 31, 22, 22, 11, - 169, 0, 61, 61, 61, 61, 61, 61, 61, 66, 21, 82, 46, 0, 0, 0, - 0, 2, 2, 2, 9, 2, 30, 2, 2, 52, 22, 22, 31, 0, 38, 22, - 27, 11, 159, 179, 180, 0, 0, 0, 0, 2, 2, 2, 30, 9, 2, 2, - 2, 2, 2, 2, 2, 2, 23, 23, 47, 22, 35, 82, 68, 0, 0, 0, - 0, 2, 181, 66, 47, 0, 0, 0, 0, 11, 182, 2, 2, 2, 2, 2, - 2, 2, 2, 23, 22, 20, 31, 0, 48, 16, 143, 0, 0, 0, 0, 0, - 0, 2, 2, 2, 2, 2, 156, 0, 0, 183, 183, 183, 183, 183, 183, 183, - 183, 184, 184, 184, 185, 186, 184, 183, 183, 187, 183, 183, 188, 189, 189, 189, - 189, 189, 189, 189, 0, 0, 0, 0, 0, 183, 183, 183, 183, 183, 190, 0, - 0, 2, 2, 2, 2, 2, 2, 2, 22, 22, 22, 22, 22, 22, 191, 192, - 193, 11, 11, 11, 46, 0, 0, 0, 0, 29, 74, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 65, 47, 0, 2, 2, 2, 2, 2, 9, 0, - 58, 194, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 0, 0, 0, 40, 115, 26, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 30, 2, 2, 2, 2, 2, 0, 58, 37, 0, 6, 119, 119, 119, 120, 0, - 0, 11, 11, 11, 49, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 46, 2, 2, 2, 2, 2, 2, 11, - 11, 2, 2, 2, 2, 2, 2, 22, 22, 2, 2, 2, 2, 2, 2, 2, - 20, 2, 2, 44, 44, 44, 92, 0, 0, O, O, O, GB, B, B, O, - SB, O, SE, GB, O, O, WJ,FMPst,FMPst, O, CGJ, B, O, B,VMAbv,VMAbv, - VMAbv, O,VMAbv, B,CMBlw,CMBlw,CMBlw,VMAbv,VMPst, VAbv, VPst,CMBlw, B, VPst, VPre, VPst, - VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VPst, VPst, VPst, H, VPre, VPst,VMBlw, O, O, - VAbv, GB,VMAbv,VMPst,VMPst, O, B, VBlw, O, O, VPre, VPre, O, VPre, H, O, - VPst,FMAbv, O,CMBlw, O, VAbv, O, VAbv, H, O,VMBlw,VMAbv,CMAbv, GB, GB, O, - MBlw,CMAbv,CMAbv, VPst, VAbv,VMAbv, O, VPst, O, VPre, VPre,VMAbv, B, O, CS, CS, - VMPst, B, VAbv, VAbv, B, R, O, HVM, O, O,FMBlw, O,CMAbv, O,CMBlw, VAbv, - VBlw, B, SUB, SUB, SUB, O, SUB, SUB, O,FMBlw, O, B, VPst, VBlw, VPre,VMAbv, - VMBlw,VMPst, IS, VAbv, MPst, MPre, MBlw, MBlw, B, MBlw, MBlw, VPst,VMPst,VMPst, B, MBlw, - VPst, VPre, VAbv, VAbv,VMPst,VMPst,VMBlw, B,VMPst, VBlw, VPst, CGJ, CGJ, VPst,VMAbv,VMAbv, - FMAbv, FAbv,CMAbv,FMAbv,VMAbv,FMAbv, VAbv, IS,FMAbv, B,FMAbv, B, CGJ, WJ, CGJ, GB, - CMAbv,CMAbv, B, VAbv, SUB, FPst, FPst,VMBlw, FPst, FPst, FBlw,VMAbv,FMBlw, VAbv, VPre, B, - MPre, MBlw, SUB, FAbv, FAbv, MAbv, SUB, Sk, VPst, VAbv,VMAbv,VMAbv, FAbv,CMAbv, VPst, H, - B, O,SMAbv,SMAbv,SMAbv, VPst, IS, RK, RK, VBlw, FAbv,VMPre,VMPre,FMAbv,CMBlw,VMBlw, - VMBlw,VMAbv, CS, O,FMAbv, ZWNJ, CGJ, WJ, WJ, WJ, O,FMPst, O, SB, SE, O, - H, MPst, VPst, H,VMAbv, VAbv,VMBlw, B, VBlw, FPst, VPst, FAbv,VMPst, B,CMAbv, VAbv, - MBlw, MPst, MBlw, H, O, VBlw, MPst, MPre, MAbv, MBlw, O, B, FAbv, FAbv, FPst, VBlw, - B, VBlw,VMAbv, B, VPre, O,VMPst, IS, O,VMPst, VBlw, VPst,VMBlw,VMBlw,VMAbv, O, - IS,VMBlw, B,VMPst,VMAbv,VMPst, CS, CS, B, N, N, O, HN, VPre, VBlw, VAbv, - IS,CMAbv, O, VPst, B, R, R,CMBlw, VAbv, VPre,VMAbv,VMAbv, H, VAbv,CMBlw,VMPst, - O,VMAbv,CMBlw, IS, R,FMAbv, B, CS, CS, H,CMBlw,VMPst, H,VMPst, VAbv,VMAbv, - VPst, MPst, R, MPst,CMBlw, B,FMBlw, CS, SUB, SUB, GB, FBlw, FBlw,CMAbv, IS, VBlw, - IS, R, MBlw, GB, VAbv, R,VMPst, G, G, J, J, J, SB, SE, J, HR, - G, G, HM, HM, HM, G, O, MPre, MPre, MPst,VMAbv, MBlw, VBlw, O, VBlw, + 33, 3, 0, 0, 0, 4, 0, 80, 118, 128, 9, 10, 11, 192, 208, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 4, 0, 0, 5, 6, 7, 8, 9, 10, 11, 12, 0, + 13, 14, 0, 0, 0, 0, 0, 0, 15, 16, 17, 18, 19, 20, 21, 0, + 0, 22, 0, 0, 0, 0, 23, 0, 24, 0, 0, 0, 0, 0, 25, 26, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 28, 29, 30, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 32, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 34, 35, 0, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 1, 1, 1, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 0, 58, 59, 0, 60, 0, + 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, + 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 66, 67, 0, 68, 69, 0, 0, 0, 70, 0, 0, 0, 0, 0, + 0, 2, 71, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 12, 7, 7, 0, 13, 14, + 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 8, 17, 0, 0, 18, 0, 0, 0, 0, + 0, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 9, 46, 47, 48, + 49, 50, 51, 52, 9, 53, 54, 55, 56, 57, 58, 10, 59, 60, 61, 62, + 0, 3, 63, 64, 65, 66, 0, 0, 0, 67, 68, 69, 70, 3, 71, 72, + 6, 73, 3, 3, 74, 75, 76, 0, 0, 77, 78, 79, 80, 3, 81, 82, + 0, 83, 3, 84, 85, 86, 0, 0, 0, 87, 88, 89, 90, 91, 92, 3, + 93, 3, 94, 95, 0, 0, 0, 96, 97, 0, 0, 0, 0, 0, 0, 0, + 98, 99, 100, 0, 101, 102, 0, 0, 103, 0, 0, 0, 0, 0, 0, 104, + 0, 0, 0, 0, 0, 0, 0, 0, 105, 0, 5, 3, 106, 0, 0, 0, + 0, 0, 107, 0, 0, 0, 0, 0, 0, 108, 109, 3, 110, 111, 112, 113, + 114, 3, 115, 116, 0, 117, 118, 119, 120, 3, 121, 122, 123, 3, 124, 125, + 126, 0, 0, 0, 0, 0, 0, 3, 127, 128, 0, 0, 0, 0, 0, 0, + 129, 0, 0, 0, 0, 0, 0, 0, 130, 0, 0, 0, 131, 132, 133, 0, + 0, 134, 135, 136, 0, 0, 0, 10, 137, 0, 0, 0, 0, 138, 139, 0, + 0, 3, 140, 8, 141, 142, 0, 0, 0, 0, 0, 0, 0, 3, 143, 0, + 0, 0, 5, 144, 5, 145, 146, 147, 0, 148, 149, 150, 151, 11, 152, 153, + 0, 154, 155, 156, 157, 11, 158, 159, 160, 161, 162, 163, 0, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 3, 176, 177, 178, 179, 180, 181, + 0, 0, 0, 0, 0, 3, 182, 183, 0, 3, 184, 185, 0, 3, 186, 187, + 188, 189, 190, 191, 0, 0, 0, 0, 0, 3, 192, 0, 0, 0, 0, 0, + 0, 193, 194, 195, 0, 0, 196, 197, 198, 199, 200, 201, 3, 202, 0, 0, + 0, 0, 0, 0, 203, 0, 0, 0, 0, 204, 205, 206, 207, 208, 209, 0, + 0, 210, 211, 212, 213, 214, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 215, 216, 217, 218, 0, 0, 0, 0, 0, 1, 219, 220, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 221, 222, 223, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 6, 0, 3, 224, 0, 0, 0, 0, 0, + 0, 0, 0, 225, 226, 0, 0, 0, 0, 3, 3, 227, 228, 229, 0, 0, + 230, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 231, + 232, 3, 3, 3, 233, 234, 0, 0, 0, 0, 0, 0, 235, 0, 0, 0, + 0, 3, 236, 237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 238, 3, + 239, 0, 0, 0, 0, 0, 0, 5, 240, 0, 0, 0, 0, 0, 0, 5, + 241, 3, 3, 242, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, + 243, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, + 4, 2, 2, 2, 2, 5, 2, 2, 2, 2, 6, 0, 2, 2, 2, 2, + 2, 5, 8, 2, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, + 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, + 0, 2, 2, 2, 2, 5, 0, 0, 0, 2, 2, 2, 2, 2, 5, 0, + 0, 2, 8, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 74, 75, + 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, + 2, 0, 2, 2, 2, 2, 2, 2, 2, 17, 6, 13, 29, 33, 29, 45, + 0, 15, 11, 27, 7, 38, 7, 68, 0, 2, 2, 2, 2, 8, 2, 2, + 2, 10, 10, 10, 10, 80, 10, 10, 10, 2, 2, 2, 2, 2, 2, 2, + 5, 2, 2, 5, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, + 0, 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 5, 2, + 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, 0, + 0, 9, 41, 2, 2, 2, 2, 2, 2, 8, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 23, 6, 6, 6, 6, 6, 6, 6, + 6, 0, 0, 0, 0, 0, 0, 48, 0, 44, 0, 0, 0, 0, 0, 49, + 0, 0, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 103, 2, 2, 2, 2, 2, 36, 9, + 9, 9, 9, 0, 0, 0, 5, 31, 0, 2, 2, 2, 2, 50, 51, 0, + 0, 9, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 15, 32, + 19, 17, 6, 18, 7, 15, 11, 67, 22, 31, 52, 25, 6, 2, 2, 2, + 2, 104, 14, 8, 2, 2, 2, 5, 8, 5, 5, 0, 2, 2, 0, 32, + 19, 0, 0, 0, 34, 0, 0, 2, 8, 2, 0, 0, 0, 0, 0, 5, + 105, 31, 24, 8, 2, 2, 5, 0, 8, 5, 2, 8, 5, 2, 0, 35, + 19, 17, 13, 0, 25, 38, 25, 68, 0, 53, 0, 0, 0, 8, 2, 5, + 5, 54, 39, 77, 0, 0, 0, 0, 0, 31, 24, 8, 2, 2, 2, 2, + 8, 5, 2, 8, 2, 2, 0, 32, 19, 17, 6, 18, 25, 7, 34, 67, + 0, 0, 0, 0, 0, 8, 54, 54, 46, 31, 14, 8, 2, 2, 2, 5, + 8, 5, 2, 8, 2, 2, 0, 32, 20, 0, 0, 25, 7, 0, 0, 2, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 26, 8, 2, 2, 5, 0, + 2, 5, 2, 2, 0, 8, 5, 5, 2, 0, 8, 5, 0, 2, 5, 0, + 2, 2, 2, 2, 2, 2, 0, 0, 11, 15, 27, 0, 12, 33, 12, 45, + 0, 0, 0, 0, 34, 0, 0, 0, 0, 24, 14, 55, 2, 2, 2, 5, + 2, 2, 2, 2, 2, 2, 0, 32, 7, 0, 0, 25, 13, 2, 5, 0, + 0, 36, 14, 8, 2, 2, 2, 5, 2, 2, 2, 8, 2, 2, 0, 32, + 20, 0, 0, 34, 27, 0, 0, 0, 5, 106, 78, 0, 0, 0, 0, 0, + 0, 9, 14, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 30, 40, + 11, 17, 6, 13, 12, 33, 12, 45, 107, 0, 0, 0, 34, 0, 0, 0, + 8, 31, 14, 8, 2, 2, 2, 2, 2, 2, 2, 2, 5, 0, 2, 2, + 2, 2, 8, 2, 2, 2, 2, 8, 0, 2, 2, 2, 5, 0, 108, 0, + 34, 11, 7, 13, 13, 19, 12, 12, 22, 0, 11, 0, 0, 0, 0, 0, + 0, 2, 0, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, + 0, 2, 2, 69, 69, 109, 0, 0, 19, 56, 18, 21, 7, 7, 6, 6, + 26, 18, 9, 13, 9, 2, 2, 79, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 81, 0, 0, 0, 0, 110, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 23, 20, 21, 57, 7, 7, 111, 82, 112, 113, + 83, 2, 2, 2, 2, 2, 48, 0, 44, 2, 2, 2, 11, 6, 2, 2, + 114, 83, 84, 41, 23, 84, 14, 14, 2, 30, 7, 40, 2, 2, 2, 2, + 2, 2, 115, 58, 116, 14, 14, 117, 85, 2, 2, 2, 2, 2, 14, 20, + 0, 2, 21, 59, 0, 0, 0, 0, 8, 2, 21, 27, 0, 0, 0, 0, + 0, 2, 21, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 5, + 2, 5, 21, 0, 0, 0, 0, 0, 0, 2, 2, 4, 20, 7, 21, 6, + 12, 12, 12, 12, 24, 60, 118, 119, 120, 121, 122, 0, 0, 0, 0, 123, + 0, 5, 0, 0, 8, 0, 124, 4, 125, 39, 39, 126, 86, 2, 2, 2, + 2, 2, 2, 2, 2, 50, 5, 0, 0, 7, 59, 20, 7, 127, 10, 0, + 0, 70, 128, 70, 70, 129, 130, 0, 0, 2, 2, 2, 2, 2, 2, 2, + 0, 2, 2, 2, 2, 14, 0, 0, 0, 2, 2, 2, 30, 71, 20, 0, + 0, 2, 2, 131, 132, 42, 133, 10, 81, 134, 15, 20, 7, 21, 18, 59, + 12, 12, 58, 9, 9, 9, 87, 26, 53, 9, 88, 41, 2, 2, 2, 2, + 2, 2, 2, 89, 7, 6, 6, 7, 12, 12, 7, 61, 2, 2, 2, 5, + 0, 0, 0, 0, 0, 0, 135, 62, 62, 62, 62, 0, 0, 0, 0, 0, + 0, 88, 41, 2, 2, 2, 2, 2, 2, 79, 10, 21, 22, 7, 136, 10, + 2, 2, 2, 2, 89, 7, 11, 20, 20, 42, 137, 0, 0, 0, 0, 0, + 0, 2, 2, 10, 19, 12, 11, 90, 42, 42, 42, 138, 139, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 0, 8, 2, 9, 26, 16, 16, 16, 9, 16, + 16, 24, 16, 16, 16, 52, 0, 53, 0, 0, 0, 140, 78, 9, 44, 0, + 0, 0, 0, 0, 0, 0, 141, 0, 0, 0, 0, 0, 0, 0, 49, 142, + 3, 39, 39, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, + 72, 0, 0, 91, 0, 0, 0, 0, 0, 0, 76, 91, 0, 0, 0, 0, + 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 0, 0, 0, 0, 63, 63, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 143, 0, 63, 63, 0, 0, 0, 0, + 0, 2, 40, 2, 61, 2, 36, 2, 2, 2, 23, 17, 15, 0, 0, 13, + 0, 14, 2, 2, 2, 2, 2, 2, 2, 2, 2, 144, 11, 11, 11, 11, + 11, 11, 11, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 2, 0, 0, 0, 0, 0, 30, 2, 2, 2, 7, 7, 145, 16, + 0, 2, 2, 2, 47, 6, 21, 6, 90, 42, 146, 0, 0, 0, 0, 0, + 0, 9, 147, 2, 2, 2, 2, 2, 2, 2, 148, 11, 7, 6, 12, 149, + 150, 93, 0, 0, 0, 0, 0, 0, 0, 2, 2, 30, 8, 2, 2, 2, + 2, 2, 2, 2, 2, 36, 7, 21, 71, 58, 151, 94, 152, 0, 0, 0, + 0, 2, 153, 2, 2, 2, 2, 154, 0, 8, 2, 39, 44, 0, 85, 24, + 2, 73, 6, 40, 47, 73, 2, 2, 95, 36, 5, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 155, 18, 22, 0, 0, 156, 96, 0, 0, 0, + 0, 2, 23, 20, 11, 59, 27, 157, 0, 0, 0, 0, 0, 0, 0, 0, + 49, 3, 3, 3, 3, 72, 0, 0, 0, 2, 5, 2, 8, 2, 2, 2, + 2, 2, 8, 2, 2, 2, 8, 5, 0, 47, 6, 25, 13, 0, 0, 158, + 159, 2, 2, 8, 2, 8, 2, 2, 2, 2, 2, 2, 0, 51, 35, 0, + 97, 2, 2, 50, 35, 0, 8, 2, 2, 0, 0, 0, 0, 8, 2, 2, + 5, 2, 2, 9, 54, 0, 0, 0, 0, 2, 2, 2, 0, 25, 7, 7, + 8, 2, 2, 2, 2, 2, 25, 38, 0, 2, 2, 2, 16, 16, 16, 16, + 16, 160, 2, 5, 0, 0, 0, 0, 0, 2, 51, 51, 0, 0, 0, 0, + 0, 5, 2, 2, 5, 2, 2, 2, 2, 8, 2, 5, 0, 8, 2, 0, + 0, 161, 162, 163, 2, 2, 2, 2, 2, 2, 2, 2, 2, 7, 7, 6, + 6, 6, 7, 7, 93, 0, 0, 0, 0, 0, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 2, 2, 2, 2, 2, 40, 30, 40, 0, 0, 0, 0, + 164, 19, 17, 18, 15, 67, 35, 0, 0, 0, 13, 0, 0, 0, 0, 0, + 0, 9, 55, 2, 2, 2, 2, 2, 2, 2, 2, 2, 47, 6, 7, 165, + 7, 18, 166, 98, 2, 2, 2, 2, 2, 0, 0, 23, 167, 0, 0, 0, + 0, 2, 50, 0, 0, 0, 0, 0, 0, 2, 23, 22, 6, 6, 6, 7, + 7, 61, 64, 0, 0, 69, 99, 13, 100, 2, 2, 2, 2, 2, 2, 11, + 17, 7, 7, 168, 46, 0, 0, 0, 55, 47, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 5, 5, 2, 2, 8, 2, 2, 2, 2, 2, 2, 2, + 8, 2, 2, 2, 2, 2, 2, 2, 36, 19, 17, 18, 7, 169, 13, 0, + 0, 9, 9, 8, 2, 2, 2, 5, 8, 5, 2, 8, 2, 2, 56, 32, + 11, 15, 11, 27, 29, 33, 29, 45, 0, 0, 0, 0, 34, 0, 0, 0, + 2, 2, 11, 0, 9, 9, 9, 26, 0, 9, 9, 26, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 8, 0, 5, 2, 2, 2, 8, 20, 21, 6, + 6, 13, 33, 29, 29, 22, 170, 14, 171, 101, 35, 0, 0, 0, 0, 0, + 0, 31, 52, 0, 0, 0, 0, 0, 0, 2, 2, 23, 22, 6, 6, 6, + 7, 11, 92, 24, 32, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, + 172, 173, 0, 0, 0, 0, 0, 0, 0, 19, 17, 6, 6, 57, 71, 22, + 100, 9, 102, 5, 0, 0, 0, 0, 0, 22, 6, 6, 0, 12, 12, 9, + 65, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 6, + 0, 11, 17, 6, 6, 18, 15, 60, 65, 38, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 36, 174, 22, 6, 7, 7, 102, 5, 0, 0, + 0, 2, 2, 2, 2, 2, 5, 77, 94, 11, 7, 6, 58, 18, 7, 0, + 0, 2, 2, 2, 5, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 19, + 17, 6, 18, 7, 87, 65, 35, 0, 0, 2, 2, 2, 5, 8, 0, 2, + 2, 2, 2, 8, 5, 2, 2, 2, 2, 11, 11, 19, 29, 33, 31, 175, + 101, 176, 177, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 2, 2, + 2, 23, 22, 6, 6, 0, 7, 11, 14, 61, 0, 33, 0, 0, 0, 0, + 0, 30, 6, 7, 7, 7, 73, 2, 2, 2, 178, 95, 9, 24, 179, 10, + 180, 0, 0, 48, 97, 0, 0, 0, 0, 30, 6, 7, 15, 17, 6, 2, + 2, 2, 2, 64, 64, 64, 43, 43, 43, 43, 43, 43, 24, 181, 0, 8, + 0, 15, 6, 15, 15, 0, 0, 0, 0, 7, 6, 6, 13, 7, 7, 9, + 65, 0, 10, 10, 10, 10, 10, 10, 10, 57, 18, 60, 26, 0, 0, 0, + 0, 2, 2, 2, 5, 2, 8, 2, 2, 30, 7, 7, 13, 0, 38, 7, + 25, 9, 99, 182, 183, 0, 0, 0, 0, 2, 2, 2, 8, 5, 2, 2, + 2, 2, 2, 2, 2, 2, 11, 11, 27, 7, 34, 60, 82, 0, 0, 0, + 0, 2, 184, 57, 27, 0, 0, 0, 0, 9, 185, 2, 2, 2, 2, 2, + 2, 2, 2, 11, 7, 6, 13, 0, 12, 15, 96, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 2, 98, 0, 0, 66, 66, 66, 186, 187, 66, 1, + 1, 188, 1, 1, 189, 37, 37, 37, 37, 37, 37, 37, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 190, 0, 0, 2, 2, 2, 2, 2, 2, 2, + 7, 7, 7, 7, 7, 7, 191, 192, 193, 9, 9, 9, 26, 0, 0, 0, + 0, 14, 41, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 23, 27, + 0, 2, 2, 2, 2, 2, 5, 0, 56, 194, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 0, 0, 0, 53, 16, 52, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 2, 2, 2, 2, 2, 0, 56, 35, 0, 49, 3, 3, 3, 72, 0, + 0, 9, 9, 9, 55, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 26, 2, 2, 2, 2, 2, 2, 9, + 9, 2, 2, 2, 2, 2, 2, 7, 7, 2, 2, 2, 2, 2, 2, 2, + 6, 2, 2, 46, 46, 46, 86, 0, 0, O, O, G, G, B, B, WJ, + WJ, CGJ, CGJ, B, O, VBlw, VBlw, VAbv, VAbv, O, B,VMAbv,VMAbv, SUB, SUB, VPst, + VPst, VPre, VPre, VBlw, O,VMPst,VMPst, VAbv, VPst,VMBlw,VMBlw, VPst, VBlw, VBlw, VAbv, VPst, + VPre, VPst, VAbv, VAbv, VBlw, VPre, VPst, B, VPst,VMAbv,VMPst, O, VAbv,VMAbv, O, VPst, + O, N, N, O, VPre, B, VAbv, O,VMAbv,CMBlw, B, VPre, O, O, VPst,CMBlw, + O, B,VMAbv, HM, HM, VAbv, O, GB, GB, VAbv, B,VMPst, B, FAbv, FAbv, FBlw, + FBlw, GB, O, VPre, H,CMAbv,CMAbv, B, VBlw, O, GB, O, WJ, B,CMBlw,CMBlw, + CMBlw,VMBlw, O, O,VMBlw,VMAbv,CMAbv,VMAbv, B, O,CMBlw, VBlw, VPre, VPre, VAbv, VBlw, + VPst, VPst,VMAbv, H, B,SMAbv,SMAbv, SB, SE, R, R,VMPst, H, J, J, VPst, + H, VAbv, H, O,FMBlw, FPst, FPst, VAbv, VPre, WJ, O, VBlw, B, O, SB, O, + SE,FMPst,FMPst, O, MBlw, CS,VMPst, B, SUB, O, SUB, SUB, O,VMPst, IS, MBlw, + B, VPst,VMPst, B,VMPst,CMAbv, B, VAbv,VMAbv,VMAbv, FAbv,CMAbv, VPst, VBlw, FAbv,FMPst, + O, H,VMAbv, H, O, MPre, MAbv, VBlw,VMAbv, IS, O, O, IS,CMAbv, O,CMBlw, + VAbv, VPre,VMAbv, IS, R, H,CMBlw, O, CGJ, GB,VMAbv,FMAbv, O, O, CS, R, + O, HVM, O, O,CMAbv,FMBlw, O,VMAbv,VMBlw, VAbv, MPst, MPre, MBlw, MBlw, MBlw, MBlw, + VPst, VAbv,VMPst,VMPst,VMBlw,VMAbv,FMAbv, FAbv,CMAbv,FMAbv,VMAbv,FMAbv, VAbv, IS,FMAbv, B, + FMAbv, B, CGJ, WJ, CGJ, GB,CMAbv, VAbv, SUB,VMBlw, FPst, FPst, FBlw,VMAbv,FMBlw, B, + MPre, MBlw, SUB, MAbv, SUB, Sk, VPst, O,SMAbv, VPst, IS, RK, RK,VMPre,VMPre,FMAbv, + CMBlw,VMAbv, CS, O,FMAbv, ZWNJ, CGJ, O, H, MPst, VPst, VAbv,VMBlw, FPst, VPst, FAbv, + VMPst, B,CMAbv, VAbv, MBlw, MPst, MBlw, VBlw, MPst, MBlw, O, B, FAbv, FAbv, FPst, B, + VPre, O,VMPst,VMPst, VBlw, VPst,VMBlw,VMBlw,VMAbv,VMBlw, B,VMPst,VMAbv,VMPst, CS, CS, + B, O, HN, VPre, VBlw, VAbv, IS, VPst, B,VMAbv, H, VAbv,CMBlw,VMPst, O,VMAbv, + CMBlw,FMAbv, B, CS, CS,VMPst, VAbv,VMAbv, VPst, MPst, R, MPst,CMBlw, B,FMBlw, CS, + SUB, SUB, GB,CMAbv, IS, VBlw, IS, R, MBlw, GB, VAbv, R,VMPst, J, SB, SE, + J, HR, G, G, HM, G, O, MPre, MPre, MPst,VMAbv, MBlw, VBlw, O, VBlw, }; static const uint16_t hb_use_u16[488]= { - 0, 0, 1, 2, 0, 3, 4, 5, 0, 6, 7, 0, 8, 0, 9, 10, - 11, 12, 10, 13, 14, 10, 10, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 18, 26, 27, 21, 22, 28, 29, 30, 31, 32, 33, 34, 22, 35, - 36, 0, 18, 37, 38, 21, 22, 39, 24, 40, 18, 41, 42, 43, 44, 45, - 46, 47, 31, 0, 48, 49, 22, 50, 51, 52, 18, 0, 53, 49, 22, 54, - 51, 55, 18, 56, 57, 49, 10, 58, 59, 60, 61, 62, 10, 63, 64, 65, - 31, 66, 67, 68, 10, 69, 70, 10, 71, 72, 73, 74, 75, 76, 77, 0, - 10, 10, 78, 79, 80, 81, 82, 83, 84, 85, 10, 86, 10, 87, 10, 88, - 89, 90, 10, 91, 92, 93, 2, 0, 94, 0, 10, 95, 96, 10, 97, 0, - 10, 98, 99,100, 31, 10,101,102,103, 10,104,105, 10,106, 10,107, - 108,109, 2, 2,110, 10, 10,111,112, 2,113,114,115, 10,116, 10, - 117,118,119,120,121, 0, 0,122,123,124, 0,125,126,127,128, 0, - 129,130,131, 0, 0,132,133, 0,134, 0, 0, 10,135,136,137, 0, - 138, 10,139, 0, 10,140,141, 10, 10,142,143, 2,144,145,146, 10, - 147,148,149, 10, 10,150,151, 2,152, 98,153,154,155, 2, 10,156, - 10,157,158, 0,159,160,161, 2,162, 0, 0,163, 0,164, 0,165, - 165,166, 34,167,168,169, 10,170, 95, 0,171, 0, 10,172,173, 0, - 174, 2,175, 10,176, 0,177,172,178,179,180, 0, 0,181,182, 0, - 183, 10, 10,184,185,186,187,188,189, 10, 10,190,191, 0,192, 10, - 193,194,195, 10, 10,196, 10,197,198,105,199,102, 10, 34,200,201, - 202, 0,203,204, 95, 10, 10,205,206, 2,207, 21, 22,208,209,210, - 211,212,213, 10, 10,214,215,216,217, 0, 10,218,219,220,221, 0, - 199, 10, 10,222,223, 2,224,225,226,227, 10,228,229, 2,230,231, - 2, 10,140, 0, 10,232,233,103,234, 0,235,236,237,238, 10,239, - 240, 2,241, 10, 10,242,243, 0,244, 10, 10,245,246,247,248,249, - 250, 0, 22, 10,224,251, 8, 10, 71, 19, 10,252, 74,253,254, 10, - 10,255,256, 2,257, 10,258,259, 10,260,261, 49, 10,262,263,264, - 265,265,265,266,267,268,265,269, 10,270,271, 2, 10,272,273, 10, - 274, 2,275,276,277,277,278,279,280, 0, 10,176, 0,281,105, 71, - 95,282, 0,283, 71,284,285, 0,286, 0,287, 2,288, 2,289,105, - 290, 2,129,129,162,162,162,129, + 0, 0, 8, 8, 16, 16, 24, 24, 40, 40, 0, 24, 32, 0, 0, 120, + 136, 24, 56, 0, 168, 24, 240, 24, 272, 32, 280, 288, 0, 296, 304, 0, + 128, 0, 312, 320, 24, 328, 336, 24, 24, 344, 352, 360, 56, 144, 368, 64, + 48, 376, 152, 384, 56, 392, 400, 64, 48, 408, 416, 424, 72, 432, 440, 112, + 48, 448, 456, 0, 56, 464, 472, 64, 48, 480, 152, 488, 56, 496, 504, 512, + 520, 528, 536, 544, 72, 0, 552, 80, 48, 560, 160, 568, 576, 80, 48, 584, + 160, 592, 56, 600, 608, 80, 24, 616, 624, 632, 640, 648, 24, 656, 664, 672, + 72, 680, 688, 696, 24, 704, 88, 712, 720, 176, 728, 736, 744, 0, 752, 760, + 768, 776, 784, 792, 800, 808, 24, 816, 24, 824, 24, 832, 840, 848, 24, 856, + 864, 872, 880, 0, 24, 96, 888, 24, 896, 0, 24, 184, 904, 912, 72, 24, + 920, 192, 200, 24, 928, 104, 24, 936, 24, 944, 952, 960, 32, 32, 968, 24, + 24, 976, 984, 32, 992,1000,1008, 24,1016, 24,1024,1032,1040,1048,1056, 0, + 0,1064,1072,1080, 0,1088,1096,1104,1112, 0, 16,1120,1128, 0, 0,1136, + 1144, 0,1152, 0,1160,1168,1176, 0,1184, 24,1192, 0, 24, 208,1200, 24, + 24,1208,1216, 32,1224,1232,1240, 24,1248,1256,1264, 24, 24,1272,1280, 32, + 1288, 184,1296,1304,1312, 32, 24,1320, 24,1328,1336, 0,1344,1352,1360, 32, + 40, 0, 0,1368, 0,1376, 0, 216, 216,1384, 112,1392,1400,1408, 24,1416, + 96, 0,1424, 0, 24, 224,1432, 0,1440, 32,1448, 24, 232, 0,1456, 224, + 1464,1472,1480, 0, 0,1488,1496, 0,1504, 24, 24,1512,1520,1528,1536,1544, + 24,1552,1560, 0,1568, 24,1576,1584,1592, 24, 24,1600, 24,1608,1616, 104, + 248, 192, 24, 112,1624,1632,1640, 0,1648,1656, 96, 24, 24,1664,1672, 32, + 1680, 64, 48,1688,1696,1704,1712,1720,1728, 24, 24,1736,1744,1752,1760, 0, + 24,1768,1776,1784,1792, 0, 248, 24, 24,1800,1808, 32, 256,1816,1824,1832, + 24,1840,1848, 32,1856,1864, 32, 24, 208, 0, 24,1872,1880, 200,1888, 0, + 1896,1904,1912,1920, 24,1928,1936, 32,1944, 24, 24,1952,1960, 0,1968, 24, + 24,1976,1984,1992,2000,2008,2016, 0, 48, 24, 256,2024, 128, 24, 88, 144, + 24,2032, 176,2040,2048, 24, 24,2056,2064, 32,2072, 24,2080,2088, 24,2096, + 2104, 80, 24,2112,2120,2128, 8,2136,2144,2152, 8,2160, 24,2168,2176, 32, + 24,2184,2192, 24,2200, 32,2208,2216, 264, 264,2224,2232,2240, 0, 24, 232, + 0,2248, 104, 88, 96,2256, 0,2264, 88,2272,2280, 0,2288, 0,2296, 32, + 2304, 32,2312, 104,2320, 32, 40, 16, }; static inline uint8_t hb_use_b4 (const uint8_t* a, unsigned i) @@ -660,7 +661,8 @@ static inline uint8_t hb_use_b4 (const uint8_t* a, unsigned i) } static inline uint8_t hb_use_get_category (unsigned u) { - return u<921600 ? hb_use_u8[3273u+((hb_use_u8[945u+((hb_use_u16[((hb_use_u8[369u+((hb_use_u8[113u+((hb_use_b4(hb_use_u8,((((((((((u)>>1))>>3))>>1))>>3))>>4)))<<4)+((((((((((u)>>1))>>3))>>1))>>3))&15)])<<3)+((((((((u)>>1))>>3))>>1))&7)])<<1)+((((((u)>>1))>>3))&1)])<<3)+((((u)>>1))&7)])<<1)+((u)&1)] : O; + /* packtab: [2^4,2^4,2^3,2^1,2^3,2^1] */ + return u<921600u ? (uint8_t)(hb_use_u8[3273u+((hb_use_u8[945u+hb_use_u16[((hb_use_u8[369u+((hb_use_u8[113u+((hb_use_b4(hb_use_u8,((((((((((u)>>1))>>3))>>1))>>3))>>4)))<<4)+((((((((((u)>>1))>>3))>>1))>>3))&15)])<<3)+((((((((u)>>1))>>3))>>1))&7)])<<1)+((((((u)>>1))>>3))&1)]+((((u)>>1))&7)])<<1)+((u)&1)]) : O; } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-vowel-constraints.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-vowel-constraints.cc index bb586a68ce50..f834752c51ac 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-vowel-constraints.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-vowel-constraints.cc @@ -2,7 +2,7 @@ /* * The following functions are generated by running: * - * ./gen-vowel-constraints.py ms-use/IndicShapingInvalidCluster.txt Scripts.txt + * gen-vowel-constraints.py ms-use/IndicShapingInvalidCluster.txt Scripts.txt * * on files with these headers: * diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh index 4933e661371e..30e106554d6b 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh @@ -2,7 +2,7 @@ /* * The following table is generated by running: * - * ./gen-tag-table.py languagetags language-subtag-registry + * gen-tag-table.py languagetags language-subtag-registry * * on files with these headers: * @@ -221,55 +221,201 @@ static const LangTag ot_languages2[] = { }; #ifndef HB_NO_LANGUAGE_LONG +static const hb_tag_t ot_languages3_blocked[] = { + HB_TAG('a','b','a',' '), /* Abé != Abaza */ + HB_TAG('a','f','k',' '), /* Nanubae != Afrikaans */ + HB_TAG('a','g','w',' '), /* Kahua != Agaw */ + HB_TAG('a','r','i',' '), /* Arikara != Aari */ + HB_TAG('a','r','k',' '), /* Arikapú != Rakhine */ + HB_TAG('b','a','g',' '), /* Tuki != Baghelkhandi */ + HB_TAG('b','a','u',' '), /* Bada (Nigeria) != Baulé */ + HB_TAG('b','b','r',' '), /* Girawa != Berber */ + HB_TAG('b','c','h',' '), /* Bariai != Bench */ + HB_TAG('b','i','l',' '), /* Bile != Bilen */ + HB_TAG('b','k','f',' '), /* Beeke != Blackfoot */ + HB_TAG('b','l','i',' '), /* Bolia != Baluchi */ + HB_TAG('b','l','t',' '), /* Tai Dam != Balti */ + HB_TAG('b','m','b',' '), /* Bembe != Bambara (Bamanankan) */ + HB_TAG('b','m','l',' '), /* Bomboli != Bamileke */ + HB_TAG('b','r','i',' '), /* Mokpwe != Braj Bhasha */ + HB_TAG('b','r','m',' '), /* Barambu != Burmese */ + HB_TAG('b','s','h',' '), /* Kati != Bashkir */ + HB_TAG('b','t','i',' '), /* Burate != Beti */ + HB_TAG('c','h','g',' '), /* Chagatai != Chaha Gurage */ + HB_TAG('c','h','h',' '), /* Chinook != Chattisgarhi */ + HB_TAG('c','r','r',' '), /* Carolina Algonquian != Carrier */ + HB_TAG('c','r','t',' '), /* Iyojwa'ja Chorote != Crimean Tatar */ + HB_TAG('c','s','l',' '), /* Chinese Sign Language != Church Slavonic */ + HB_TAG('d','h','v',' '), /* Dehu != Divehi (Dhivehi, Maldivian) (deprecated) */ + HB_TAG('d','n','k',' '), /* Dengka != Dinka */ + HB_TAG('d','r','i',' '), /* C'Lela != Dari */ + HB_TAG('d','u','n',' '), /* Dusun Deyah != Dungan */ + HB_TAG('d','z','n',' '), /* Dzando != Dzongkha */ + HB_TAG('e','c','r',' '), /* Eteocretan != Eastern Cree */ + HB_TAG('e','u','q',' '), /* Basque [collection] != Basque */ + HB_TAG('f','a','r',' '), /* Fataleka != Persian */ + HB_TAG('f','o','s',' '), /* Siraya != Faroese */ + HB_TAG('g','a','d',' '), /* Gaddang != Ga */ + HB_TAG('g','a','e',' '), /* Guarequena != Scottish Gaelic */ + HB_TAG('g','a','l',' '), /* Galolen != Galician */ + HB_TAG('g','a','r',' '), /* Galeya != Garshuni */ + HB_TAG('g','a','w',' '), /* Nobonob != Garhwali */ + HB_TAG('g','m','z',' '), /* Mgbolizhia != Gumuz */ + HB_TAG('g','r','o',' '), /* Groma != Garo */ + HB_TAG('g','u','a',' '), /* Shiki != Guarani */ + HB_TAG('h','a','l',' '), /* Halang != Halam (Falam Chin) */ + HB_TAG('h','b','n',' '), /* Heiban != Hammer-Banna */ + HB_TAG('i','r','i',' '), /* Rigwe != Irish */ + HB_TAG('i','s','m',' '), /* Masimasi != Inari Sami */ + HB_TAG('j','a','n',' '), /* Jandai != Japanese */ + HB_TAG('j','i','i',' '), /* Jiiddu != Yiddish */ + HB_TAG('j','u','d',' '), /* Worodougou != Ladino */ + HB_TAG('j','u','l',' '), /* Jirel != Jula */ + HB_TAG('k','a','c',' '), /* Kachin != Kachchi */ + HB_TAG('k','e','b',' '), /* Kélé != Kebena */ + HB_TAG('k','g','e',' '), /* Komering != Khutsuri Georgian */ + HB_TAG('k','h','n',' '), /* Khandesi != Khamti Shan (Microsoft fonts) */ + HB_TAG('k','h','s',' '), /* Kasua != Khanty-Shurishkar */ + HB_TAG('k','h','v',' '), /* Khvarshi != Khanty-Vakhi */ + HB_TAG('k','i','s',' '), /* Kis != Kisii */ + HB_TAG('k','k','n',' '), /* Kon Keu != Kokni */ + HB_TAG('k','l','m',' '), /* Migum != Kalmyk */ + HB_TAG('k','m','n',' '), /* Awtuw != Kumaoni */ + HB_TAG('k','m','o',' '), /* Kwoma != Komo */ + HB_TAG('k','m','s',' '), /* Kamasau != Komso */ + HB_TAG('k','n','r',' '), /* Kaningra != Kanuri */ + HB_TAG('k','o','d',' '), /* Kodi != Kodagu */ + HB_TAG('k','o','h',' '), /* Koyo != Korean Old Hangul */ + HB_TAG('k','o','p',' '), /* Waube != Komi-Permyak */ + HB_TAG('k','o','z',' '), /* Korak != Komi-Zyrian */ + HB_TAG('k','p','l',' '), /* Kpala != Kpelle */ + HB_TAG('k','r','k',' '), /* Kerek != Karakalpak */ + HB_TAG('k','r','m',' '), /* Krim (retired code) != Karaim */ + HB_TAG('k','r','n',' '), /* Sapo != Karen */ + HB_TAG('k','s','i',' '), /* Krisa != Khasi */ + HB_TAG('k','s','m',' '), /* Kumba != Kildin Sami */ + HB_TAG('k','u','i',' '), /* Kuikúro-Kalapálo != Kui */ + HB_TAG('k','u','l',' '), /* Kulere != Kulvi */ + HB_TAG('k','u','y',' '), /* Kuuku-Ya'u != Kuy */ + HB_TAG('k','y','k',' '), /* Kamayo != Koryak */ + HB_TAG('l','a','h',' '), /* Lahnda [macrolanguage] != Lahuli */ + HB_TAG('l','a','k',' '), /* Laka (Nigeria) (retired code) != Lak */ + HB_TAG('l','a','m',' '), /* Lamba != Lambani */ + HB_TAG('l','a','z',' '), /* Aribwatsa != Laz */ + HB_TAG('l','d','k',' '), /* Leelau != Ladakhi */ + HB_TAG('l','m','a',' '), /* East Limba != Low Mari */ + HB_TAG('l','m','b',' '), /* Merei != Limbu */ + HB_TAG('l','m','w',' '), /* Lake Miwok != Lomwe */ + HB_TAG('l','s','b',' '), /* Burundian Sign Language != Lower Sorbian */ + HB_TAG('l','t','h',' '), /* Thur != Lithuanian */ + HB_TAG('l','v','i',' '), /* Lavi != Latvian */ + HB_TAG('m','a','j',' '), /* Jalapa De Díaz Mazatec != Majang */ + HB_TAG('m','a','p',' '), /* Austronesian [collection] != Mapudungun */ + HB_TAG('m','a','w',' '), /* Mampruli != Marwari */ + HB_TAG('m','b','n',' '), /* Macaguán != Mbundu */ + HB_TAG('m','c','h',' '), /* Maquiritari != Manchu */ + HB_TAG('m','c','r',' '), /* Menya != Moose Cree */ + HB_TAG('m','d','e',' '), /* Maba (Chad) != Mende */ + HB_TAG('m','i','z',' '), /* Coatzospan Mixtec != Mizo */ + HB_TAG('m','k','r',' '), /* Malas != Makasar */ + HB_TAG('m','l','e',' '), /* Manambu != Male */ + HB_TAG('m','l','n',' '), /* Malango != Malinke */ + HB_TAG('m','l','r',' '), /* Vame != Malayalam Reformed */ + HB_TAG('m','n','d',' '), /* Mondé != Mandinka */ + HB_TAG('m','n','g',' '), /* Eastern Mnong != Mongolian */ + HB_TAG('m','n','x',' '), /* Manikion != Manx */ + HB_TAG('m','o','k',' '), /* Morori != Moksha */ + HB_TAG('m','o','r',' '), /* Moro != Moroccan */ + HB_TAG('m','t','h',' '), /* Munggui != Maithili */ + HB_TAG('m','t','s',' '), /* Yora != Maltese */ + HB_TAG('m','u','n',' '), /* Munda [collection] != Mundari */ + HB_TAG('n','a','s',' '), /* Naasioi != Naskapi */ + HB_TAG('n','c','r',' '), /* Ncane != N-Cree */ + HB_TAG('n','d','b',' '), /* Kenswei Nsei != Ndebele */ + HB_TAG('n','d','g',' '), /* Ndengereko != Ndonga */ + HB_TAG('n','g','r',' '), /* Engdewu != Nagari */ + HB_TAG('n','i','s',' '), /* Nimi != Nisi */ + HB_TAG('n','k','o',' '), /* Nkonya != N’Ko */ + HB_TAG('n','s','m',' '), /* Sumi Naga != Northern Sami */ + HB_TAG('n','t','o',' '), /* Ntomba != Esperanto */ + HB_TAG('o','r','o',' '), /* Orokolo != Oromo */ + HB_TAG('p','a','a',' '), /* Papuan [collection] != Palestinian Aramaic */ + HB_TAG('p','a','l',' '), /* Pahlavi != Pali */ + HB_TAG('p','a','s',' '), /* Papasena != Pashto */ + HB_TAG('p','i','l',' '), /* Yom != Filipino */ + HB_TAG('p','l','k',' '), /* Kohistani Shina != Polish */ + HB_TAG('r','m','s',' '), /* Romanian Sign Language != Romansh */ + HB_TAG('s','a','d',' '), /* Sandawe != Sadri */ + HB_TAG('s','a','y',' '), /* Saya != Sayisi */ + HB_TAG('s','g','o',' '), /* Songa (retired code) != Sango */ + HB_TAG('s','i','b',' '), /* Sebop != Sibe */ + HB_TAG('s','i','g',' '), /* Paasaal != Silte Gurage */ + HB_TAG('s','k','s',' '), /* Maia != Skolt Sami */ + HB_TAG('s','k','y',' '), /* Sikaiana != Slovak */ + HB_TAG('s','l','a',' '), /* Slavic [collection] != Slavey */ + HB_TAG('s','m','l',' '), /* Central Sama != Somali */ + HB_TAG('s','n','h',' '), /* Shinabo (retired code) != Sinhala (Sinhalese) */ + HB_TAG('s','o','g',' '), /* Sogdian != Sodo Gurage */ + HB_TAG('s','r','b',' '), /* Sora != Serbian */ + HB_TAG('s','r','k',' '), /* Serudung Murut != Saraiki */ + HB_TAG('s','s','l',' '), /* Western Sisaala != South Slavey */ + HB_TAG('s','s','m',' '), /* Semnam != Southern Sami */ + HB_TAG('s','u','r',' '), /* Mwaghavul != Suri */ + HB_TAG('s','v','e',' '), /* Serili != Swedish */ + HB_TAG('s','w','k',' '), /* Malawi Sena != Swahili */ + HB_TAG('t','a','j',' '), /* Eastern Tamang != Tajiki */ + HB_TAG('t','g','n',' '), /* Tandaganon != Tongan */ + HB_TAG('t','g','r',' '), /* Tareng != Tigre */ + HB_TAG('t','g','y',' '), /* Togoyo != Tigrinya */ + HB_TAG('t','k','m',' '), /* Takelma != Turkmen */ + HB_TAG('t','m','n',' '), /* Taman (Indonesia) != Temne */ + HB_TAG('t','n','a',' '), /* Tacana != Tswana */ + HB_TAG('t','n','e',' '), /* Tinoc Kallahan (retired code) != Tundra Enets */ + HB_TAG('t','n','g',' '), /* Tobanga != Tonga */ + HB_TAG('t','r','k',' '), /* Turkic [collection] != Turkish */ + HB_TAG('t','s','g',' '), /* Tausug != Tsonga */ + HB_TAG('t','u','a',' '), /* Wiarumus != Turoyo Aramaic */ + HB_TAG('t','u','l',' '), /* Tula != Tulu */ + HB_TAG('t','u','v',' '), /* Turkana != Tuvin */ + HB_TAG('v','i','t',' '), /* Viti != Vietnamese */ + HB_TAG('w','a','g',' '), /* Wa'ema != Wagdi */ + HB_TAG('x','b','d',' '), /* Bindal != Lü */ + HB_TAG('y','a','k',' '), /* Yakama != Sakha */ + HB_TAG('y','b','a',' '), /* Yala != Yoruba */ + HB_TAG('y','i','m',' '), /* Yimchungru Naga != Yi Modern */ + HB_TAG('z','n','d',' '), /* Zande [collection] != Zande */ +}; + static const LangTag ot_languages3[] = { {HB_TAG('a','a','e',' '), HB_TAG('S','Q','I',' ')}, /* Arbëreshë Albanian -> Albanian */ {HB_TAG('a','a','o',' '), HB_TAG('A','R','A',' ')}, /* Algerian Saharan Arabic -> Arabic */ -/*{HB_TAG('a','a','q',' '), HB_TAG('A','A','Q',' ')},*/ /* Eastern Abnaki -> Eastern Abenaki */ {HB_TAG('a','a','t',' '), HB_TAG('S','Q','I',' ')}, /* Arvanitika Albanian -> Albanian */ - {HB_TAG('a','b','a',' '), HB_TAG_NONE }, /* Abé != Abaza */ {HB_TAG('a','b','h',' '), HB_TAG('A','R','A',' ')}, /* Tajiki Arabic -> Arabic */ {HB_TAG('a','b','q',' '), HB_TAG('A','B','A',' ')}, /* Abaza */ {HB_TAG('a','b','s',' '), HB_TAG('C','P','P',' ')}, /* Ambonese Malay -> Creoles */ {HB_TAG('a','b','v',' '), HB_TAG('A','R','A',' ')}, /* Baharna Arabic -> Arabic */ - {HB_TAG('a','c','f',' '), HB_TAG('F','A','N',' ')}, /* Saint Lucian Creole French -> French Antillean */ - {HB_TAG('a','c','f',' '), HB_TAG('C','P','P',' ')}, /* Saint Lucian Creole French -> Creoles */ -/*{HB_TAG('a','c','h',' '), HB_TAG('A','C','H',' ')},*/ /* Acoli -> Acholi */ {HB_TAG('a','c','m',' '), HB_TAG('A','R','A',' ')}, /* Mesopotamian Arabic -> Arabic */ {HB_TAG('a','c','q',' '), HB_TAG('A','R','A',' ')}, /* Ta'izzi-Adeni Arabic -> Arabic */ - {HB_TAG('a','c','r',' '), HB_TAG('A','C','R',' ')}, /* Achi */ - {HB_TAG('a','c','r',' '), HB_TAG('M','Y','N',' ')}, /* Achi -> Mayan */ {HB_TAG('a','c','w',' '), HB_TAG('A','R','A',' ')}, /* Hijazi Arabic -> Arabic */ {HB_TAG('a','c','x',' '), HB_TAG('A','R','A',' ')}, /* Omani Arabic -> Arabic */ - {HB_TAG('a','c','y',' '), HB_TAG('A','C','Y',' ')}, /* Cypriot Arabic */ - {HB_TAG('a','c','y',' '), HB_TAG('A','R','A',' ')}, /* Cypriot Arabic -> Arabic */ {HB_TAG('a','d','a',' '), HB_TAG('D','N','G',' ')}, /* Adangme -> Dangme */ {HB_TAG('a','d','f',' '), HB_TAG('A','R','A',' ')}, /* Dhofari Arabic -> Arabic */ {HB_TAG('a','d','p',' '), HB_TAG('D','Z','N',' ')}, /* Adap (retired code) -> Dzongkha */ -/*{HB_TAG('a','d','y',' '), HB_TAG('A','D','Y',' ')},*/ /* Adyghe */ {HB_TAG('a','e','b',' '), HB_TAG('A','R','A',' ')}, /* Tunisian Arabic -> Arabic */ {HB_TAG('a','e','c',' '), HB_TAG('A','R','A',' ')}, /* Saidi Arabic -> Arabic */ {HB_TAG('a','f','b',' '), HB_TAG('A','R','A',' ')}, /* Gulf Arabic -> Arabic */ - {HB_TAG('a','f','k',' '), HB_TAG_NONE }, /* Nanubae != Afrikaans */ {HB_TAG('a','f','s',' '), HB_TAG('C','P','P',' ')}, /* Afro-Seminole Creole -> Creoles */ {HB_TAG('a','g','u',' '), HB_TAG('M','Y','N',' ')}, /* Aguacateco -> Mayan */ - {HB_TAG('a','g','w',' '), HB_TAG_NONE }, /* Kahua != Agaw */ {HB_TAG('a','h','g',' '), HB_TAG('A','G','W',' ')}, /* Qimant -> Agaw */ {HB_TAG('a','h','t',' '), HB_TAG('A','T','H',' ')}, /* Ahtena -> Athapaskan */ {HB_TAG('a','i','g',' '), HB_TAG('C','P','P',' ')}, /* Antigua and Barbuda Creole English -> Creoles */ - {HB_TAG('a','i','i',' '), HB_TAG('S','W','A',' ')}, /* Assyrian Neo-Aramaic -> Swadaya Aramaic */ - {HB_TAG('a','i','i',' '), HB_TAG('S','Y','R',' ')}, /* Assyrian Neo-Aramaic -> Syriac */ -/*{HB_TAG('a','i','o',' '), HB_TAG('A','I','O',' ')},*/ /* Aiton */ {HB_TAG('a','i','w',' '), HB_TAG('A','R','I',' ')}, /* Aari */ {HB_TAG('a','j','p',' '), HB_TAG('A','R','A',' ')}, /* South Levantine Arabic (retired code) -> Arabic */ {HB_TAG('a','j','t',' '), HB_TAG('A','R','A',' ')}, /* Judeo-Tunisian Arabic (retired code) -> Arabic */ - {HB_TAG('a','k','b',' '), HB_TAG('A','K','B',' ')}, /* Batak Angkola */ - {HB_TAG('a','k','b',' '), HB_TAG('B','T','K',' ')}, /* Batak Angkola -> Batak */ {HB_TAG('a','l','n',' '), HB_TAG('S','Q','I',' ')}, /* Gheg Albanian -> Albanian */ {HB_TAG('a','l','s',' '), HB_TAG('S','Q','I',' ')}, /* Tosk Albanian -> Albanian */ -/*{HB_TAG('a','l','t',' '), HB_TAG('A','L','T',' ')},*/ /* Southern Altai -> Altai */ {HB_TAG('a','m','f',' '), HB_TAG('H','B','N',' ')}, /* Hamer-Banna -> Hammer-Banna */ {HB_TAG('a','m','w',' '), HB_TAG('S','Y','R',' ')}, /* Western Neo-Aramaic -> Syriac */ -/*{HB_TAG('a','n','g',' '), HB_TAG('A','N','G',' ')},*/ /* Old English (ca. 450-1100) -> Anglo-Saxon */ {HB_TAG('a','o','a',' '), HB_TAG('C','P','P',' ')}, /* Angolar -> Creoles */ {HB_TAG('a','p','a',' '), HB_TAG('A','T','H',' ')}, /* Apache [collection] -> Athapaskan */ {HB_TAG('a','p','c',' '), HB_TAG('A','R','A',' ')}, /* Levantine Arabic -> Arabic */ @@ -280,61 +426,39 @@ static const LangTag ot_languages3[] = { {HB_TAG('a','p','m',' '), HB_TAG('A','T','H',' ')}, /* Mescalero-Chiricahua Apache -> Athapaskan */ {HB_TAG('a','p','w',' '), HB_TAG('A','T','H',' ')}, /* Western Apache -> Athapaskan */ {HB_TAG('a','r','b',' '), HB_TAG('A','R','A',' ')}, /* Standard Arabic -> Arabic */ - {HB_TAG('a','r','i',' '), HB_TAG_NONE }, /* Arikara != Aari */ - {HB_TAG('a','r','k',' '), HB_TAG_NONE }, /* Arikapú != Rakhine */ {HB_TAG('a','r','n',' '), HB_TAG('M','A','P',' ')}, /* Mapudungun */ {HB_TAG('a','r','q',' '), HB_TAG('A','R','A',' ')}, /* Algerian Arabic -> Arabic */ {HB_TAG('a','r','s',' '), HB_TAG('A','R','A',' ')}, /* Najdi Arabic -> Arabic */ - {HB_TAG('a','r','y',' '), HB_TAG('M','O','R',' ')}, /* Moroccan Arabic -> Moroccan */ - {HB_TAG('a','r','y',' '), HB_TAG('A','R','A',' ')}, /* Moroccan Arabic -> Arabic */ {HB_TAG('a','r','z',' '), HB_TAG('A','R','A',' ')}, /* Egyptian Arabic -> Arabic */ -/*{HB_TAG('a','s','t',' '), HB_TAG('A','S','T',' ')},*/ /* Asturian */ -/*{HB_TAG('a','t','h',' '), HB_TAG('A','T','H',' ')},*/ /* Athapascan [collection] -> Athapaskan */ {HB_TAG('a','t','j',' '), HB_TAG('R','C','R',' ')}, /* Atikamekw -> R-Cree */ -/*{HB_TAG('a','t','s',' '), HB_TAG('A','T','S',' ')},*/ /* Gros Ventre (Atsina) */ {HB_TAG('a','t','v',' '), HB_TAG('A','L','T',' ')}, /* Northern Altai -> Altai */ {HB_TAG('a','u','j',' '), HB_TAG('B','B','R',' ')}, /* Awjilah -> Berber */ {HB_TAG('a','u','z',' '), HB_TAG('A','R','A',' ')}, /* Uzbeki Arabic -> Arabic */ {HB_TAG('a','v','l',' '), HB_TAG('A','R','A',' ')}, /* Eastern Egyptian Bedawi Arabic -> Arabic */ -/*{HB_TAG('a','v','n',' '), HB_TAG('A','V','N',' ')},*/ /* Avatime */ -/*{HB_TAG('a','w','a',' '), HB_TAG('A','W','A',' ')},*/ /* Awadhi */ {HB_TAG('a','y','c',' '), HB_TAG('A','Y','M',' ')}, /* Southern Aymara -> Aymara */ {HB_TAG('a','y','h',' '), HB_TAG('A','R','A',' ')}, /* Hadrami Arabic -> Arabic */ {HB_TAG('a','y','l',' '), HB_TAG('A','R','A',' ')}, /* Libyan Arabic -> Arabic */ {HB_TAG('a','y','n',' '), HB_TAG('A','R','A',' ')}, /* Sanaani Arabic -> Arabic */ {HB_TAG('a','y','p',' '), HB_TAG('A','R','A',' ')}, /* North Mesopotamian Arabic -> Arabic */ {HB_TAG('a','y','r',' '), HB_TAG('A','Y','M',' ')}, /* Central Aymara -> Aymara */ - {HB_TAG('a','z','b',' '), HB_TAG('A','Z','B',' ')}, /* South Azerbaijani -> Torki */ - {HB_TAG('a','z','b',' '), HB_TAG('A','Z','E',' ')}, /* South Azerbaijani -> Azerbaijani */ {HB_TAG('a','z','d',' '), HB_TAG('N','A','H',' ')}, /* Eastern Durango Nahuatl -> Nahuatl */ {HB_TAG('a','z','j',' '), HB_TAG('A','Z','E',' ')}, /* North Azerbaijani -> Azerbaijani */ {HB_TAG('a','z','n',' '), HB_TAG('N','A','H',' ')}, /* Western Durango Nahuatl -> Nahuatl */ {HB_TAG('a','z','z',' '), HB_TAG('N','A','H',' ')}, /* Highland Puebla Nahuatl -> Nahuatl */ {HB_TAG('b','a','d',' '), HB_TAG('B','A','D','0')}, /* Banda [collection] */ - {HB_TAG('b','a','g',' '), HB_TAG_NONE }, /* Tuki != Baghelkhandi */ {HB_TAG('b','a','h',' '), HB_TAG('C','P','P',' ')}, /* Bahamas Creole English -> Creoles */ {HB_TAG('b','a','i',' '), HB_TAG('B','M','L',' ')}, /* Bamileke [collection] */ {HB_TAG('b','a','l',' '), HB_TAG('B','L','I',' ')}, /* Baluchi [macrolanguage] */ -/*{HB_TAG('b','a','n',' '), HB_TAG('B','A','N',' ')},*/ /* Balinese */ -/*{HB_TAG('b','a','r',' '), HB_TAG('B','A','R',' ')},*/ /* Bavarian */ - {HB_TAG('b','a','u',' '), HB_TAG_NONE }, /* Bada (Nigeria) != Baulé */ - {HB_TAG('b','b','c',' '), HB_TAG('B','B','C',' ')}, /* Batak Toba */ - {HB_TAG('b','b','c',' '), HB_TAG('B','T','K',' ')}, /* Batak Toba -> Batak */ {HB_TAG('b','b','j',' '), HB_TAG('B','M','L',' ')}, /* Ghomálá' -> Bamileke */ {HB_TAG('b','b','p',' '), HB_TAG('B','A','D','0')}, /* West Central Banda -> Banda */ - {HB_TAG('b','b','r',' '), HB_TAG_NONE }, /* Girawa != Berber */ {HB_TAG('b','b','z',' '), HB_TAG('A','R','A',' ')}, /* Babalia Creole Arabic (retired code) -> Arabic */ {HB_TAG('b','c','c',' '), HB_TAG('B','L','I',' ')}, /* Southern Balochi -> Baluchi */ - {HB_TAG('b','c','h',' '), HB_TAG_NONE }, /* Bariai != Bench */ {HB_TAG('b','c','i',' '), HB_TAG('B','A','U',' ')}, /* Baoulé -> Baulé */ {HB_TAG('b','c','l',' '), HB_TAG('B','I','K',' ')}, /* Central Bikol -> Bikol */ {HB_TAG('b','c','q',' '), HB_TAG('B','C','H',' ')}, /* Bench */ {HB_TAG('b','c','r',' '), HB_TAG('A','T','H',' ')}, /* Babine -> Athapaskan */ -/*{HB_TAG('b','d','c',' '), HB_TAG('B','D','C',' ')},*/ /* Emberá-Baudó */ -/*{HB_TAG('b','d','y',' '), HB_TAG('B','D','Y',' ')},*/ /* Bandjalang */ {HB_TAG('b','e','a',' '), HB_TAG('A','T','H',' ')}, /* Beaver -> Athapaskan */ {HB_TAG('b','e','b',' '), HB_TAG('B','T','I',' ')}, /* Bebele -> Beti */ -/*{HB_TAG('b','e','m',' '), HB_TAG('B','E','M',' ')},*/ /* Bemba (Zambia) */ {HB_TAG('b','e','r',' '), HB_TAG('B','B','R',' ')}, /* Berber [collection] */ {HB_TAG('b','e','w',' '), HB_TAG('C','P','P',' ')}, /* Betawi -> Creoles */ {HB_TAG('b','f','l',' '), HB_TAG('B','A','D','0')}, /* Banda-Ndélé -> Banda */ @@ -342,70 +466,35 @@ static const LangTag ot_languages3[] = { {HB_TAG('b','f','t',' '), HB_TAG('B','L','T',' ')}, /* Balti */ {HB_TAG('b','f','u',' '), HB_TAG('L','A','H',' ')}, /* Gahri -> Lahuli */ {HB_TAG('b','f','y',' '), HB_TAG('B','A','G',' ')}, /* Bagheli -> Baghelkhandi */ -/*{HB_TAG('b','g','c',' '), HB_TAG('B','G','C',' ')},*/ /* Haryanvi */ {HB_TAG('b','g','n',' '), HB_TAG('B','L','I',' ')}, /* Western Balochi -> Baluchi */ {HB_TAG('b','g','p',' '), HB_TAG('B','L','I',' ')}, /* Eastern Balochi -> Baluchi */ - {HB_TAG('b','g','q',' '), HB_TAG('B','G','Q',' ')}, /* Bagri */ - {HB_TAG('b','g','q',' '), HB_TAG('R','A','J',' ')}, /* Bagri -> Rajasthani */ {HB_TAG('b','g','r',' '), HB_TAG('Q','I','N',' ')}, /* Bawm Chin -> Chin */ {HB_TAG('b','h','b',' '), HB_TAG('B','H','I',' ')}, /* Bhili */ -/*{HB_TAG('b','h','i',' '), HB_TAG('B','H','I',' ')},*/ /* Bhilali -> Bhili */ {HB_TAG('b','h','k',' '), HB_TAG('B','I','K',' ')}, /* Albay Bicolano (retired code) -> Bikol */ -/*{HB_TAG('b','h','o',' '), HB_TAG('B','H','O',' ')},*/ /* Bhojpuri */ {HB_TAG('b','h','r',' '), HB_TAG('M','L','G',' ')}, /* Bara Malagasy -> Malagasy */ -/*{HB_TAG('b','i','k',' '), HB_TAG('B','I','K',' ')},*/ /* Bikol [macrolanguage] */ - {HB_TAG('b','i','l',' '), HB_TAG_NONE }, /* Bile != Bilen */ {HB_TAG('b','i','n',' '), HB_TAG('E','D','O',' ')}, /* Edo */ {HB_TAG('b','i','u',' '), HB_TAG('Q','I','N',' ')}, /* Biete -> Chin */ -/*{HB_TAG('b','j','j',' '), HB_TAG('B','J','J',' ')},*/ /* Kanauji */ {HB_TAG('b','j','n',' '), HB_TAG('M','L','Y',' ')}, /* Banjar -> Malay */ {HB_TAG('b','j','o',' '), HB_TAG('B','A','D','0')}, /* Mid-Southern Banda -> Banda */ {HB_TAG('b','j','q',' '), HB_TAG('M','L','G',' ')}, /* Southern Betsimisaraka Malagasy (retired code) -> Malagasy */ {HB_TAG('b','j','s',' '), HB_TAG('C','P','P',' ')}, /* Bajan -> Creoles */ {HB_TAG('b','j','t',' '), HB_TAG('B','L','N',' ')}, /* Balanta-Ganja -> Balante */ - {HB_TAG('b','k','f',' '), HB_TAG_NONE }, /* Beeke != Blackfoot */ {HB_TAG('b','k','o',' '), HB_TAG('B','M','L',' ')}, /* Kwa' -> Bamileke */ {HB_TAG('b','l','a',' '), HB_TAG('B','K','F',' ')}, /* Siksika -> Blackfoot */ {HB_TAG('b','l','e',' '), HB_TAG('B','L','N',' ')}, /* Balanta-Kentohe -> Balante */ {HB_TAG('b','l','g',' '), HB_TAG('I','B','A',' ')}, /* Balau (retired code) -> Iban */ - {HB_TAG('b','l','i',' '), HB_TAG_NONE }, /* Bolia != Baluchi */ - {HB_TAG('b','l','k',' '), HB_TAG('B','L','K',' ')}, /* Pa’o Karen */ - {HB_TAG('b','l','k',' '), HB_TAG('K','R','N',' ')}, /* Pa'o Karen -> Karen */ {HB_TAG('b','l','n',' '), HB_TAG('B','I','K',' ')}, /* Southern Catanduanes Bikol -> Bikol */ - {HB_TAG('b','l','t',' '), HB_TAG_NONE }, /* Tai Dam != Balti */ - {HB_TAG('b','m','b',' '), HB_TAG_NONE }, /* Bembe != Bambara (Bamanankan) */ - {HB_TAG('b','m','l',' '), HB_TAG_NONE }, /* Bomboli != Bamileke */ {HB_TAG('b','m','m',' '), HB_TAG('M','L','G',' ')}, /* Northern Betsimisaraka Malagasy -> Malagasy */ {HB_TAG('b','p','d',' '), HB_TAG('B','A','D','0')}, /* Banda-Banda -> Banda */ {HB_TAG('b','p','l',' '), HB_TAG('C','P','P',' ')}, /* Broome Pearling Lugger Pidgin -> Creoles */ {HB_TAG('b','p','q',' '), HB_TAG('C','P','P',' ')}, /* Banda Malay -> Creoles */ -/*{HB_TAG('b','p','y',' '), HB_TAG('B','P','Y',' ')},*/ /* Bishnupriya -> Bishnupriya Manipuri */ {HB_TAG('b','q','i',' '), HB_TAG('L','R','C',' ')}, /* Bakhtiari -> Luri */ {HB_TAG('b','q','k',' '), HB_TAG('B','A','D','0')}, /* Banda-Mbrès -> Banda */ {HB_TAG('b','r','a',' '), HB_TAG('B','R','I',' ')}, /* Braj -> Braj Bhasha */ {HB_TAG('b','r','c',' '), HB_TAG('C','P','P',' ')}, /* Berbice Creole Dutch -> Creoles */ -/*{HB_TAG('b','r','h',' '), HB_TAG('B','R','H',' ')},*/ /* Brahui */ - {HB_TAG('b','r','i',' '), HB_TAG_NONE }, /* Mokpwe != Braj Bhasha */ - {HB_TAG('b','r','m',' '), HB_TAG_NONE }, /* Barambu != Burmese */ -/*{HB_TAG('b','r','x',' '), HB_TAG('B','R','X',' ')},*/ /* Bodo (India) */ - {HB_TAG('b','s','h',' '), HB_TAG_NONE }, /* Kati != Bashkir */ -/*{HB_TAG('b','s','k',' '), HB_TAG('B','S','K',' ')},*/ /* Burushaski */ {HB_TAG('b','t','b',' '), HB_TAG('B','T','I',' ')}, /* Beti (Cameroon) (retired code) */ - {HB_TAG('b','t','d',' '), HB_TAG('B','T','D',' ')}, /* Batak Dairi (Pakpak) */ - {HB_TAG('b','t','d',' '), HB_TAG('B','T','K',' ')}, /* Batak Dairi -> Batak */ - {HB_TAG('b','t','i',' '), HB_TAG_NONE }, /* Burate != Beti */ {HB_TAG('b','t','j',' '), HB_TAG('M','L','Y',' ')}, /* Bacanese Malay -> Malay */ -/*{HB_TAG('b','t','k',' '), HB_TAG('B','T','K',' ')},*/ /* Batak [collection] */ - {HB_TAG('b','t','m',' '), HB_TAG('B','T','M',' ')}, /* Batak Mandailing */ - {HB_TAG('b','t','m',' '), HB_TAG('B','T','K',' ')}, /* Batak Mandailing -> Batak */ {HB_TAG('b','t','o',' '), HB_TAG('B','I','K',' ')}, /* Rinconada Bikol -> Bikol */ - {HB_TAG('b','t','s',' '), HB_TAG('B','T','S',' ')}, /* Batak Simalungun */ - {HB_TAG('b','t','s',' '), HB_TAG('B','T','K',' ')}, /* Batak Simalungun -> Batak */ - {HB_TAG('b','t','x',' '), HB_TAG('B','T','X',' ')}, /* Batak Karo */ - {HB_TAG('b','t','x',' '), HB_TAG('B','T','K',' ')}, /* Batak Karo -> Batak */ - {HB_TAG('b','t','z',' '), HB_TAG('B','T','Z',' ')}, /* Batak Alas-Kluet */ - {HB_TAG('b','t','z',' '), HB_TAG('B','T','K',' ')}, /* Batak Alas-Kluet -> Batak */ -/*{HB_TAG('b','u','g',' '), HB_TAG('B','U','G',' ')},*/ /* Buginese -> Bugis */ {HB_TAG('b','u','m',' '), HB_TAG('B','T','I',' ')}, /* Bulu (Cameroon) -> Beti */ {HB_TAG('b','v','e',' '), HB_TAG('M','L','Y',' ')}, /* Berau Malay -> Malay */ {HB_TAG('b','v','u',' '), HB_TAG('M','L','Y',' ')}, /* Bukit Malay -> Malay */ @@ -415,52 +504,26 @@ static const LangTag ot_languages3[] = { {HB_TAG('b','x','p',' '), HB_TAG('B','T','I',' ')}, /* Bebil -> Beti */ {HB_TAG('b','x','r',' '), HB_TAG('R','B','U',' ')}, /* Russia Buriat -> Russian Buriat */ {HB_TAG('b','y','n',' '), HB_TAG('B','I','L',' ')}, /* Bilin -> Bilen */ - {HB_TAG('b','y','v',' '), HB_TAG('B','Y','V',' ')}, /* Medumba */ - {HB_TAG('b','y','v',' '), HB_TAG('B','M','L',' ')}, /* Medumba -> Bamileke */ {HB_TAG('b','z','c',' '), HB_TAG('M','L','G',' ')}, /* Southern Betsimisaraka Malagasy -> Malagasy */ {HB_TAG('b','z','j',' '), HB_TAG('C','P','P',' ')}, /* Belize Kriol English -> Creoles */ {HB_TAG('b','z','k',' '), HB_TAG('C','P','P',' ')}, /* Nicaragua Creole English -> Creoles */ {HB_TAG('c','a','a',' '), HB_TAG('M','Y','N',' ')}, /* Chortí -> Mayan */ {HB_TAG('c','a','c',' '), HB_TAG('M','Y','N',' ')}, /* Chuj -> Mayan */ - {HB_TAG('c','a','f',' '), HB_TAG('C','R','R',' ')}, /* Southern Carrier -> Carrier */ - {HB_TAG('c','a','f',' '), HB_TAG('A','T','H',' ')}, /* Southern Carrier -> Athapaskan */ - {HB_TAG('c','a','k',' '), HB_TAG('C','A','K',' ')}, /* Kaqchikel */ - {HB_TAG('c','a','k',' '), HB_TAG('M','Y','N',' ')}, /* Kaqchikel -> Mayan */ -/*{HB_TAG('c','a','y',' '), HB_TAG('C','A','Y',' ')},*/ /* Cayuga */ -/*{HB_TAG('c','b','g',' '), HB_TAG('C','B','G',' ')},*/ /* Chimila */ - {HB_TAG('c','b','k',' '), HB_TAG('C','B','K',' ')}, /* Chavacano -> Zamboanga Chavacano */ - {HB_TAG('c','b','k',' '), HB_TAG('C','P','P',' ')}, /* Chavacano -> Creoles */ {HB_TAG('c','b','l',' '), HB_TAG('Q','I','N',' ')}, /* Bualkhaw Chin -> Chin */ {HB_TAG('c','c','l',' '), HB_TAG('C','P','P',' ')}, /* Cutchi-Swahili -> Creoles */ {HB_TAG('c','c','m',' '), HB_TAG('C','P','P',' ')}, /* Malaccan Creole Malay -> Creoles */ {HB_TAG('c','c','o',' '), HB_TAG('C','C','H','N')}, /* Comaltepec Chinantec -> Chinantec */ {HB_TAG('c','c','q',' '), HB_TAG('A','R','K',' ')}, /* Chaungtha (retired code) -> Rakhine */ {HB_TAG('c','d','o',' '), HB_TAG('Z','H','S',' ')}, /* Min Dong Chinese -> Chinese, Simplified */ -/*{HB_TAG('c','e','b',' '), HB_TAG('C','E','B',' ')},*/ /* Cebuano */ {HB_TAG('c','e','k',' '), HB_TAG('Q','I','N',' ')}, /* Eastern Khumi Chin -> Chin */ {HB_TAG('c','e','y',' '), HB_TAG('Q','I','N',' ')}, /* Ekai Chin -> Chin */ - {HB_TAG('c','f','m',' '), HB_TAG('H','A','L',' ')}, /* Halam (Falam Chin) */ - {HB_TAG('c','f','m',' '), HB_TAG('Q','I','N',' ')}, /* Falam Chin -> Chin */ -/*{HB_TAG('c','g','g',' '), HB_TAG('C','G','G',' ')},*/ /* Chiga */ {HB_TAG('c','h','f',' '), HB_TAG('M','Y','N',' ')}, /* Tabasco Chontal -> Mayan */ - {HB_TAG('c','h','g',' '), HB_TAG_NONE }, /* Chagatai != Chaha Gurage */ - {HB_TAG('c','h','h',' '), HB_TAG_NONE }, /* Chinook != Chattisgarhi */ {HB_TAG('c','h','j',' '), HB_TAG('C','C','H','N')}, /* Ojitlán Chinantec -> Chinantec */ {HB_TAG('c','h','k',' '), HB_TAG('C','H','K','0')}, /* Chuukese */ - {HB_TAG('c','h','m',' '), HB_TAG('H','M','A',' ')}, /* Mari (Russia) [macrolanguage] -> High Mari */ - {HB_TAG('c','h','m',' '), HB_TAG('L','M','A',' ')}, /* Mari (Russia) [macrolanguage] -> Low Mari */ {HB_TAG('c','h','n',' '), HB_TAG('C','P','P',' ')}, /* Chinook jargon -> Creoles */ -/*{HB_TAG('c','h','o',' '), HB_TAG('C','H','O',' ')},*/ /* Choctaw */ - {HB_TAG('c','h','p',' '), HB_TAG('C','H','P',' ')}, /* Chipewyan */ - {HB_TAG('c','h','p',' '), HB_TAG('S','A','Y',' ')}, /* Chipewyan -> Sayisi */ - {HB_TAG('c','h','p',' '), HB_TAG('A','T','H',' ')}, /* Chipewyan -> Athapaskan */ {HB_TAG('c','h','q',' '), HB_TAG('C','C','H','N')}, /* Quiotepec Chinantec -> Chinantec */ -/*{HB_TAG('c','h','r',' '), HB_TAG('C','H','R',' ')},*/ /* Cherokee */ -/*{HB_TAG('c','h','y',' '), HB_TAG('C','H','Y',' ')},*/ /* Cheyenne */ {HB_TAG('c','h','z',' '), HB_TAG('C','C','H','N')}, /* Ozumacín Chinantec -> Chinantec */ {HB_TAG('c','i','w',' '), HB_TAG('O','J','B',' ')}, /* Chippewa -> Ojibway */ -/*{HB_TAG('c','j','a',' '), HB_TAG('C','J','A',' ')},*/ /* Western Cham */ -/*{HB_TAG('c','j','m',' '), HB_TAG('C','J','M',' ')},*/ /* Eastern Cham */ {HB_TAG('c','j','y',' '), HB_TAG('Z','H','S',' ')}, /* Jinyu Chinese -> Chinese, Simplified */ {HB_TAG('c','k','a',' '), HB_TAG('Q','I','N',' ')}, /* Khumi Awa Chin (retired code) -> Chin */ {HB_TAG('c','k','b',' '), HB_TAG('K','U','R',' ')}, /* Central Kurdish -> Kurdish */ @@ -474,7 +537,6 @@ static const LangTag ot_languages3[] = { {HB_TAG('c','l','j',' '), HB_TAG('Q','I','N',' ')}, /* Laitu Chin -> Chin */ {HB_TAG('c','l','s',' '), HB_TAG('S','A','N',' ')}, /* Classical Sanskrit -> Sanskrit */ {HB_TAG('c','l','t',' '), HB_TAG('Q','I','N',' ')}, /* Lautu Chin -> Chin */ -/*{HB_TAG('c','m','i',' '), HB_TAG('C','M','I',' ')},*/ /* Emberá-Chamí */ {HB_TAG('c','m','n',' '), HB_TAG('Z','H','S',' ')}, /* Mandarin Chinese -> Chinese, Simplified */ {HB_TAG('c','m','r',' '), HB_TAG('Q','I','N',' ')}, /* Mro-Khimi Chin -> Chin */ {HB_TAG('c','n','b',' '), HB_TAG('Q','I','N',' ')}, /* Chinbon Chin -> Chin */ @@ -488,120 +550,63 @@ static const LangTag ot_languages3[] = { {HB_TAG('c','n','w',' '), HB_TAG('Q','I','N',' ')}, /* Ngawn Chin -> Chin */ {HB_TAG('c','o','a',' '), HB_TAG('M','L','Y',' ')}, /* Cocos Islands Malay -> Malay */ {HB_TAG('c','o','b',' '), HB_TAG('M','Y','N',' ')}, /* Chicomuceltec -> Mayan */ -/*{HB_TAG('c','o','o',' '), HB_TAG('C','O','O',' ')},*/ /* Comox */ -/*{HB_TAG('c','o','p',' '), HB_TAG('C','O','P',' ')},*/ /* Coptic */ {HB_TAG('c','o','q',' '), HB_TAG('A','T','H',' ')}, /* Coquille -> Athapaskan */ {HB_TAG('c','p','a',' '), HB_TAG('C','C','H','N')}, /* Palantla Chinantec -> Chinantec */ {HB_TAG('c','p','e',' '), HB_TAG('C','P','P',' ')}, /* English-based creoles and pidgins [collection] -> Creoles */ {HB_TAG('c','p','f',' '), HB_TAG('C','P','P',' ')}, /* French-based creoles and pidgins [collection] -> Creoles */ {HB_TAG('c','p','i',' '), HB_TAG('C','P','P',' ')}, /* Chinese Pidgin English -> Creoles */ -/*{HB_TAG('c','p','p',' '), HB_TAG('C','P','P',' ')},*/ /* Portuguese-based creoles and pidgins [collection] -> Creoles */ {HB_TAG('c','p','x',' '), HB_TAG('Z','H','S',' ')}, /* Pu-Xian Chinese -> Chinese, Simplified */ {HB_TAG('c','q','d',' '), HB_TAG('H','M','N',' ')}, /* Chuanqiandian Cluster Miao -> Hmong */ - {HB_TAG('c','q','u',' '), HB_TAG('Q','U','H',' ')}, /* Chilean Quechua (retired code) -> Quechua (Bolivia) */ - {HB_TAG('c','q','u',' '), HB_TAG('Q','U','Z',' ')}, /* Chilean Quechua (retired code) -> Quechua */ {HB_TAG('c','r','h',' '), HB_TAG('C','R','T',' ')}, /* Crimean Tatar */ {HB_TAG('c','r','i',' '), HB_TAG('C','P','P',' ')}, /* Sãotomense -> Creoles */ - {HB_TAG('c','r','j',' '), HB_TAG('E','C','R',' ')}, /* Southern East Cree -> Eastern Cree */ - {HB_TAG('c','r','j',' '), HB_TAG('Y','C','R',' ')}, /* Southern East Cree -> Y-Cree */ - {HB_TAG('c','r','j',' '), HB_TAG('C','R','E',' ')}, /* Southern East Cree -> Cree */ - {HB_TAG('c','r','k',' '), HB_TAG('W','C','R',' ')}, /* Plains Cree -> West-Cree */ - {HB_TAG('c','r','k',' '), HB_TAG('Y','C','R',' ')}, /* Plains Cree -> Y-Cree */ - {HB_TAG('c','r','k',' '), HB_TAG('C','R','E',' ')}, /* Plains Cree -> Cree */ - {HB_TAG('c','r','l',' '), HB_TAG('E','C','R',' ')}, /* Northern East Cree -> Eastern Cree */ - {HB_TAG('c','r','l',' '), HB_TAG('Y','C','R',' ')}, /* Northern East Cree -> Y-Cree */ - {HB_TAG('c','r','l',' '), HB_TAG('C','R','E',' ')}, /* Northern East Cree -> Cree */ - {HB_TAG('c','r','m',' '), HB_TAG('M','C','R',' ')}, /* Moose Cree */ - {HB_TAG('c','r','m',' '), HB_TAG('L','C','R',' ')}, /* Moose Cree -> L-Cree */ - {HB_TAG('c','r','m',' '), HB_TAG('C','R','E',' ')}, /* Moose Cree -> Cree */ {HB_TAG('c','r','p',' '), HB_TAG('C','P','P',' ')}, /* Creoles and pidgins [collection] -> Creoles */ - {HB_TAG('c','r','r',' '), HB_TAG_NONE }, /* Carolina Algonquian != Carrier */ {HB_TAG('c','r','s',' '), HB_TAG('C','P','P',' ')}, /* Seselwa Creole French -> Creoles */ - {HB_TAG('c','r','t',' '), HB_TAG_NONE }, /* Iyojwa'ja Chorote != Crimean Tatar */ - {HB_TAG('c','r','x',' '), HB_TAG('C','R','R',' ')}, /* Carrier */ - {HB_TAG('c','r','x',' '), HB_TAG('A','T','H',' ')}, /* Carrier -> Athapaskan */ {HB_TAG('c','s','a',' '), HB_TAG('C','C','H','N')}, /* Chiltepec Chinantec -> Chinantec */ -/*{HB_TAG('c','s','b',' '), HB_TAG('C','S','B',' ')},*/ /* Kashubian */ {HB_TAG('c','s','h',' '), HB_TAG('Q','I','N',' ')}, /* Asho Chin -> Chin */ {HB_TAG('c','s','j',' '), HB_TAG('Q','I','N',' ')}, /* Songlai Chin -> Chin */ - {HB_TAG('c','s','l',' '), HB_TAG_NONE }, /* Chinese Sign Language != Church Slavonic */ {HB_TAG('c','s','o',' '), HB_TAG('C','C','H','N')}, /* Sochiapam Chinantec -> Chinantec */ {HB_TAG('c','s','p',' '), HB_TAG('Z','H','S',' ')}, /* Southern Ping Chinese -> Chinese, Simplified */ {HB_TAG('c','s','v',' '), HB_TAG('Q','I','N',' ')}, /* Sumtu Chin -> Chin */ - {HB_TAG('c','s','w',' '), HB_TAG('N','C','R',' ')}, /* Swampy Cree -> N-Cree */ - {HB_TAG('c','s','w',' '), HB_TAG('N','H','C',' ')}, /* Swampy Cree -> Norway House Cree */ - {HB_TAG('c','s','w',' '), HB_TAG('C','R','E',' ')}, /* Swampy Cree -> Cree */ {HB_TAG('c','s','y',' '), HB_TAG('Q','I','N',' ')}, /* Siyin Chin -> Chin */ {HB_TAG('c','t','c',' '), HB_TAG('A','T','H',' ')}, /* Chetco -> Athapaskan */ {HB_TAG('c','t','d',' '), HB_TAG('Q','I','N',' ')}, /* Tedim Chin -> Chin */ {HB_TAG('c','t','e',' '), HB_TAG('C','C','H','N')}, /* Tepinapa Chinantec -> Chinantec */ -/*{HB_TAG('c','t','g',' '), HB_TAG('C','T','G',' ')},*/ /* Chittagonian */ {HB_TAG('c','t','h',' '), HB_TAG('Q','I','N',' ')}, /* Thaiphum Chin -> Chin */ {HB_TAG('c','t','l',' '), HB_TAG('C','C','H','N')}, /* Tlacoatzintepec Chinantec -> Chinantec */ -/*{HB_TAG('c','t','o',' '), HB_TAG('C','T','O',' ')},*/ /* Emberá-Catío */ {HB_TAG('c','t','s',' '), HB_TAG('B','I','K',' ')}, /* Northern Catanduanes Bikol -> Bikol */ -/*{HB_TAG('c','t','t',' '), HB_TAG('C','T','T',' ')},*/ /* Wayanad Chetti */ {HB_TAG('c','t','u',' '), HB_TAG('M','Y','N',' ')}, /* Chol -> Mayan */ {HB_TAG('c','u','c',' '), HB_TAG('C','C','H','N')}, /* Usila Chinantec -> Chinantec */ -/*{HB_TAG('c','u','k',' '), HB_TAG('C','U','K',' ')},*/ /* San Blas Kuna */ {HB_TAG('c','v','n',' '), HB_TAG('C','C','H','N')}, /* Valle Nacional Chinantec -> Chinantec */ - {HB_TAG('c','w','d',' '), HB_TAG('D','C','R',' ')}, /* Woods Cree */ - {HB_TAG('c','w','d',' '), HB_TAG('T','C','R',' ')}, /* Woods Cree -> TH-Cree */ - {HB_TAG('c','w','d',' '), HB_TAG('C','R','E',' ')}, /* Woods Cree -> Cree */ {HB_TAG('c','z','h',' '), HB_TAG('Z','H','S',' ')}, /* Huizhou Chinese -> Chinese, Simplified */ {HB_TAG('c','z','o',' '), HB_TAG('Z','H','S',' ')}, /* Min Zhong Chinese -> Chinese, Simplified */ {HB_TAG('c','z','t',' '), HB_TAG('Q','I','N',' ')}, /* Zotung Chin -> Chin */ -/*{HB_TAG('d','a','g',' '), HB_TAG('D','A','G',' ')},*/ /* Dagbani */ {HB_TAG('d','a','o',' '), HB_TAG('Q','I','N',' ')}, /* Daai Chin -> Chin */ {HB_TAG('d','a','p',' '), HB_TAG('N','I','S',' ')}, /* Nisi (India) (retired code) */ -/*{HB_TAG('d','a','r',' '), HB_TAG('D','A','R',' ')},*/ /* Dargwa */ -/*{HB_TAG('d','a','x',' '), HB_TAG('D','A','X',' ')},*/ /* Dayi */ {HB_TAG('d','c','r',' '), HB_TAG('C','P','P',' ')}, /* Negerhollands -> Creoles */ - {HB_TAG('d','e','n',' '), HB_TAG('S','L','A',' ')}, /* Slave (Athapascan) [macrolanguage] -> Slavey */ - {HB_TAG('d','e','n',' '), HB_TAG('A','T','H',' ')}, /* Slave (Athapascan) [macrolanguage] -> Athapaskan */ {HB_TAG('d','e','p',' '), HB_TAG('C','P','P',' ')}, /* Pidgin Delaware -> Creoles */ - {HB_TAG('d','g','o',' '), HB_TAG('D','G','O',' ')}, /* Dogri (individual language) */ - {HB_TAG('d','g','o',' '), HB_TAG('D','G','R',' ')}, /* Dogri (macrolanguage) */ {HB_TAG('d','g','r',' '), HB_TAG('A','T','H',' ')}, /* Tlicho -> Athapaskan */ {HB_TAG('d','h','d',' '), HB_TAG('M','A','W',' ')}, /* Dhundari -> Marwari */ -/*{HB_TAG('d','h','g',' '), HB_TAG('D','H','G',' ')},*/ /* Dhangu */ - {HB_TAG('d','h','v',' '), HB_TAG_NONE }, /* Dehu != Divehi (Dhivehi, Maldivian) (deprecated) */ {HB_TAG('d','i','b',' '), HB_TAG('D','N','K',' ')}, /* South Central Dinka -> Dinka */ {HB_TAG('d','i','k',' '), HB_TAG('D','N','K',' ')}, /* Southwestern Dinka -> Dinka */ {HB_TAG('d','i','n',' '), HB_TAG('D','N','K',' ')}, /* Dinka [macrolanguage] */ {HB_TAG('d','i','p',' '), HB_TAG('D','N','K',' ')}, /* Northeastern Dinka -> Dinka */ - {HB_TAG('d','i','q',' '), HB_TAG('D','I','Q',' ')}, /* Dimli */ - {HB_TAG('d','i','q',' '), HB_TAG('Z','Z','A',' ')}, /* Dimli -> Zazaki */ {HB_TAG('d','i','w',' '), HB_TAG('D','N','K',' ')}, /* Northwestern Dinka -> Dinka */ {HB_TAG('d','j','e',' '), HB_TAG('D','J','R',' ')}, /* Zarma */ {HB_TAG('d','j','k',' '), HB_TAG('C','P','P',' ')}, /* Eastern Maroon Creole -> Creoles */ {HB_TAG('d','j','r',' '), HB_TAG('D','J','R','0')}, /* Djambarrpuyngu */ {HB_TAG('d','k','s',' '), HB_TAG('D','N','K',' ')}, /* Southeastern Dinka -> Dinka */ {HB_TAG('d','n','g',' '), HB_TAG('D','U','N',' ')}, /* Dungan */ -/*{HB_TAG('d','n','j',' '), HB_TAG('D','N','J',' ')},*/ /* Dan */ - {HB_TAG('d','n','k',' '), HB_TAG_NONE }, /* Dengka != Dinka */ {HB_TAG('d','o','i',' '), HB_TAG('D','G','R',' ')}, /* Dogri (macrolanguage) [macrolanguage] */ {HB_TAG('d','r','h',' '), HB_TAG('M','N','G',' ')}, /* Darkhat (retired code) -> Mongolian */ - {HB_TAG('d','r','i',' '), HB_TAG_NONE }, /* C'Lela != Dari */ - {HB_TAG('d','r','w',' '), HB_TAG('D','R','I',' ')}, /* Darwazi (retired code) -> Dari */ - {HB_TAG('d','r','w',' '), HB_TAG('F','A','R',' ')}, /* Darwazi (retired code) -> Persian */ {HB_TAG('d','s','b',' '), HB_TAG('L','S','B',' ')}, /* Lower Sorbian */ {HB_TAG('d','t','y',' '), HB_TAG('N','E','P',' ')}, /* Dotyali -> Nepali */ -/*{HB_TAG('d','u','j',' '), HB_TAG('D','U','J',' ')},*/ /* Dhuwal (retired code) */ - {HB_TAG('d','u','n',' '), HB_TAG_NONE }, /* Dusun Deyah != Dungan */ {HB_TAG('d','u','p',' '), HB_TAG('M','L','Y',' ')}, /* Duano -> Malay */ {HB_TAG('d','w','k',' '), HB_TAG('K','U','I',' ')}, /* Dawik Kui -> Kui */ {HB_TAG('d','w','u',' '), HB_TAG('D','U','J',' ')}, /* Dhuwal */ {HB_TAG('d','w','y',' '), HB_TAG('D','U','J',' ')}, /* Dhuwaya -> Dhuwal */ {HB_TAG('d','y','u',' '), HB_TAG('J','U','L',' ')}, /* Dyula -> Jula */ - {HB_TAG('d','z','n',' '), HB_TAG_NONE }, /* Dzando != Dzongkha */ - {HB_TAG('e','c','r',' '), HB_TAG_NONE }, /* Eteocretan != Eastern Cree */ -/*{HB_TAG('e','f','i',' '), HB_TAG('E','F','I',' ')},*/ /* Efik */ {HB_TAG('e','k','k',' '), HB_TAG('E','T','I',' ')}, /* Standard Estonian -> Estonian */ {HB_TAG('e','k','y',' '), HB_TAG('K','R','N',' ')}, /* Eastern Kayah -> Karen */ - {HB_TAG('e','m','k',' '), HB_TAG('E','M','K',' ')}, /* Eastern Maninkakan */ - {HB_TAG('e','m','k',' '), HB_TAG('M','N','K',' ')}, /* Eastern Maninkakan -> Maninka */ -/*{HB_TAG('e','m','p',' '), HB_TAG('E','M','P',' ')},*/ /* Northern Emberá */ {HB_TAG('e','m','y',' '), HB_TAG('M','Y','N',' ')}, /* Epigraphic Mayan -> Mayan */ {HB_TAG('e','n','b',' '), HB_TAG('K','A','L',' ')}, /* Markweeta -> Kalenjin */ {HB_TAG('e','n','f',' '), HB_TAG('F','N','E',' ')}, /* Forest Enets */ @@ -609,52 +614,27 @@ static const LangTag ot_languages3[] = { {HB_TAG('e','s','g',' '), HB_TAG('G','O','N',' ')}, /* Aheri Gondi -> Gondi */ {HB_TAG('e','s','i',' '), HB_TAG('I','P','K',' ')}, /* North Alaskan Inupiatun -> Inupiat */ {HB_TAG('e','s','k',' '), HB_TAG('I','P','K',' ')}, /* Northwest Alaska Inupiatun -> Inupiat */ -/*{HB_TAG('e','s','u',' '), HB_TAG('E','S','U',' ')},*/ /* Central Yupik */ {HB_TAG('e','t','o',' '), HB_TAG('B','T','I',' ')}, /* Eton (Cameroon) -> Beti */ - {HB_TAG('e','u','q',' '), HB_TAG_NONE }, /* Basque [collection] != Basque */ {HB_TAG('e','v','e',' '), HB_TAG('E','V','N',' ')}, /* Even */ {HB_TAG('e','v','n',' '), HB_TAG('E','V','K',' ')}, /* Evenki */ {HB_TAG('e','w','o',' '), HB_TAG('B','T','I',' ')}, /* Ewondo -> Beti */ {HB_TAG('e','y','o',' '), HB_TAG('K','A','L',' ')}, /* Keiyo -> Kalenjin */ {HB_TAG('f','a','b',' '), HB_TAG('C','P','P',' ')}, /* Fa d'Ambu -> Creoles */ - {HB_TAG('f','a','n',' '), HB_TAG('F','A','N','0')}, /* Fang (Equatorial Guinea) */ - {HB_TAG('f','a','n',' '), HB_TAG('B','T','I',' ')}, /* Fang (Equatorial Guinea) -> Beti */ - {HB_TAG('f','a','r',' '), HB_TAG_NONE }, /* Fataleka != Persian */ - {HB_TAG('f','a','t',' '), HB_TAG('F','A','T',' ')}, /* Fanti */ - {HB_TAG('f','a','t',' '), HB_TAG('A','K','A',' ')}, /* Fanti -> Akan */ {HB_TAG('f','b','l',' '), HB_TAG('B','I','K',' ')}, /* West Albay Bikol -> Bikol */ {HB_TAG('f','f','m',' '), HB_TAG('F','U','L',' ')}, /* Maasina Fulfulde -> Fulah */ {HB_TAG('f','i','l',' '), HB_TAG('P','I','L',' ')}, /* Filipino */ - {HB_TAG('f','l','m',' '), HB_TAG('H','A','L',' ')}, /* Halam (Falam Chin) (retired code) */ - {HB_TAG('f','l','m',' '), HB_TAG('Q','I','N',' ')}, /* Falam Chin (retired code) -> Chin */ - {HB_TAG('f','m','p',' '), HB_TAG('F','M','P',' ')}, /* Fe’fe’ */ - {HB_TAG('f','m','p',' '), HB_TAG('B','M','L',' ')}, /* Fe'fe' -> Bamileke */ {HB_TAG('f','n','g',' '), HB_TAG('C','P','P',' ')}, /* Fanagalo -> Creoles */ -/*{HB_TAG('f','o','n',' '), HB_TAG('F','O','N',' ')},*/ /* Fon */ - {HB_TAG('f','o','s',' '), HB_TAG_NONE }, /* Siraya != Faroese */ {HB_TAG('f','p','e',' '), HB_TAG('C','P','P',' ')}, /* Fernando Po Creole English -> Creoles */ -/*{HB_TAG('f','r','c',' '), HB_TAG('F','R','C',' ')},*/ /* Cajun French */ -/*{HB_TAG('f','r','p',' '), HB_TAG('F','R','P',' ')},*/ /* Arpitan */ {HB_TAG('f','u','b',' '), HB_TAG('F','U','L',' ')}, /* Adamawa Fulfulde -> Fulah */ {HB_TAG('f','u','c',' '), HB_TAG('F','U','L',' ')}, /* Pulaar -> Fulah */ {HB_TAG('f','u','e',' '), HB_TAG('F','U','L',' ')}, /* Borgu Fulfulde -> Fulah */ - {HB_TAG('f','u','f',' '), HB_TAG('F','T','A',' ')}, /* Pular -> Futa */ - {HB_TAG('f','u','f',' '), HB_TAG('F','U','L',' ')}, /* Pular -> Fulah */ {HB_TAG('f','u','h',' '), HB_TAG('F','U','L',' ')}, /* Western Niger Fulfulde -> Fulah */ {HB_TAG('f','u','i',' '), HB_TAG('F','U','L',' ')}, /* Bagirmi Fulfulde -> Fulah */ {HB_TAG('f','u','q',' '), HB_TAG('F','U','L',' ')}, /* Central-Eastern Niger Fulfulde -> Fulah */ {HB_TAG('f','u','r',' '), HB_TAG('F','R','L',' ')}, /* Friulian */ - {HB_TAG('f','u','v',' '), HB_TAG('F','U','V',' ')}, /* Nigerian Fulfulde */ - {HB_TAG('f','u','v',' '), HB_TAG('F','U','L',' ')}, /* Nigerian Fulfulde -> Fulah */ {HB_TAG('g','a','a',' '), HB_TAG('G','A','D',' ')}, /* Ga */ {HB_TAG('g','a','c',' '), HB_TAG('C','P','P',' ')}, /* Mixed Great Andamanese -> Creoles */ - {HB_TAG('g','a','d',' '), HB_TAG_NONE }, /* Gaddang != Ga */ - {HB_TAG('g','a','e',' '), HB_TAG_NONE }, /* Guarequena != Scottish Gaelic */ -/*{HB_TAG('g','a','g',' '), HB_TAG('G','A','G',' ')},*/ /* Gagauz */ - {HB_TAG('g','a','l',' '), HB_TAG_NONE }, /* Galolen != Galician */ {HB_TAG('g','a','n',' '), HB_TAG('Z','H','S',' ')}, /* Gan Chinese -> Chinese, Simplified */ - {HB_TAG('g','a','r',' '), HB_TAG_NONE }, /* Galeya != Garshuni */ - {HB_TAG('g','a','w',' '), HB_TAG_NONE }, /* Nobonob != Garhwali */ {HB_TAG('g','a','x',' '), HB_TAG('O','R','O',' ')}, /* Borana-Arsi-Guji Oromo -> Oromo */ {HB_TAG('g','a','z',' '), HB_TAG('O','R','O',' ')}, /* West Central Oromo -> Oromo */ {HB_TAG('g','b','m',' '), HB_TAG('G','A','W',' ')}, /* Garhwali */ @@ -663,69 +643,46 @@ static const LangTag ot_languages3[] = { {HB_TAG('g','c','l',' '), HB_TAG('C','P','P',' ')}, /* Grenadian Creole English -> Creoles */ {HB_TAG('g','c','r',' '), HB_TAG('C','P','P',' ')}, /* Guianese Creole French -> Creoles */ {HB_TAG('g','d','a',' '), HB_TAG('R','A','J',' ')}, /* Gade Lohar -> Rajasthani */ -/*{HB_TAG('g','e','z',' '), HB_TAG('G','E','Z',' ')},*/ /* Geez */ {HB_TAG('g','g','o',' '), HB_TAG('G','O','N',' ')}, /* Southern Gondi (retired code) -> Gondi */ {HB_TAG('g','h','a',' '), HB_TAG('B','B','R',' ')}, /* Ghadamès -> Berber */ {HB_TAG('g','h','c',' '), HB_TAG('I','R','T',' ')}, /* Hiberno-Scottish Gaelic -> Irish Traditional */ {HB_TAG('g','h','k',' '), HB_TAG('K','R','N',' ')}, /* Geko Karen -> Karen */ {HB_TAG('g','h','o',' '), HB_TAG('B','B','R',' ')}, /* Ghomara -> Berber */ {HB_TAG('g','i','b',' '), HB_TAG('C','P','P',' ')}, /* Gibanawa -> Creoles */ -/*{HB_TAG('g','i','h',' '), HB_TAG('G','I','H',' ')},*/ /* Githabul */ {HB_TAG('g','i','l',' '), HB_TAG('G','I','L','0')}, /* Kiribati (Gilbertese) */ {HB_TAG('g','j','u',' '), HB_TAG('R','A','J',' ')}, /* Gujari -> Rajasthani */ - {HB_TAG('g','k','p',' '), HB_TAG('G','K','P',' ')}, /* Guinea Kpelle -> Kpelle (Guinea) */ - {HB_TAG('g','k','p',' '), HB_TAG('K','P','L',' ')}, /* Guinea Kpelle -> Kpelle */ {HB_TAG('g','l','d',' '), HB_TAG('N','A','N',' ')}, /* Nanai */ -/*{HB_TAG('g','l','k',' '), HB_TAG('G','L','K',' ')},*/ /* Gilaki */ - {HB_TAG('g','m','z',' '), HB_TAG_NONE }, /* Mgbolizhia != Gumuz */ {HB_TAG('g','n','b',' '), HB_TAG('Q','I','N',' ')}, /* Gangte -> Chin */ -/*{HB_TAG('g','n','n',' '), HB_TAG('G','N','N',' ')},*/ /* Gumatj */ {HB_TAG('g','n','o',' '), HB_TAG('G','O','N',' ')}, /* Northern Gondi -> Gondi */ {HB_TAG('g','n','w',' '), HB_TAG('G','U','A',' ')}, /* Western Bolivian Guaraní -> Guarani */ -/*{HB_TAG('g','o','g',' '), HB_TAG('G','O','G',' ')},*/ /* Gogo */ {HB_TAG('g','o','m',' '), HB_TAG('K','O','K',' ')}, /* Goan Konkani -> Konkani */ -/*{HB_TAG('g','o','n',' '), HB_TAG('G','O','N',' ')},*/ /* Gondi [macrolanguage] */ {HB_TAG('g','o','q',' '), HB_TAG('C','P','P',' ')}, /* Gorap -> Creoles */ {HB_TAG('g','o','x',' '), HB_TAG('B','A','D','0')}, /* Gobu -> Banda */ {HB_TAG('g','p','e',' '), HB_TAG('C','P','P',' ')}, /* Ghanaian Pidgin English -> Creoles */ - {HB_TAG('g','r','o',' '), HB_TAG_NONE }, /* Groma != Garo */ {HB_TAG('g','r','r',' '), HB_TAG('B','B','R',' ')}, /* Taznatit -> Berber */ {HB_TAG('g','r','t',' '), HB_TAG('G','R','O',' ')}, /* Garo */ {HB_TAG('g','r','u',' '), HB_TAG('S','O','G',' ')}, /* Kistane -> Sodo Gurage */ {HB_TAG('g','s','w',' '), HB_TAG('A','L','S',' ')}, /* Alsatian */ - {HB_TAG('g','u','a',' '), HB_TAG_NONE }, /* Shiki != Guarani */ -/*{HB_TAG('g','u','c',' '), HB_TAG('G','U','C',' ')},*/ /* Wayuu */ -/*{HB_TAG('g','u','f',' '), HB_TAG('G','U','F',' ')},*/ /* Gupapuyngu */ {HB_TAG('g','u','g',' '), HB_TAG('G','U','A',' ')}, /* Paraguayan Guaraní -> Guarani */ {HB_TAG('g','u','i',' '), HB_TAG('G','U','A',' ')}, /* Eastern Bolivian Guaraní -> Guarani */ {HB_TAG('g','u','k',' '), HB_TAG('G','M','Z',' ')}, /* Gumuz */ {HB_TAG('g','u','l',' '), HB_TAG('C','P','P',' ')}, /* Sea Island Creole English -> Creoles */ {HB_TAG('g','u','n',' '), HB_TAG('G','U','A',' ')}, /* Mbyá Guaraní -> Guarani */ -/*{HB_TAG('g','u','z',' '), HB_TAG('G','U','Z',' ')},*/ /* Gusii */ {HB_TAG('g','w','i',' '), HB_TAG('A','T','H',' ')}, /* Gwichʼin -> Athapaskan */ {HB_TAG('g','y','n',' '), HB_TAG('C','P','P',' ')}, /* Guyanese Creole English -> Creoles */ {HB_TAG('h','a','a',' '), HB_TAG('A','T','H',' ')}, /* Hän -> Athapaskan */ {HB_TAG('h','a','e',' '), HB_TAG('O','R','O',' ')}, /* Eastern Oromo -> Oromo */ {HB_TAG('h','a','i',' '), HB_TAG('H','A','I','0')}, /* Haida [macrolanguage] */ {HB_TAG('h','a','k',' '), HB_TAG('Z','H','S',' ')}, /* Hakka Chinese -> Chinese, Simplified */ - {HB_TAG('h','a','l',' '), HB_TAG_NONE }, /* Halang != Halam (Falam Chin) */ {HB_TAG('h','a','r',' '), HB_TAG('H','R','I',' ')}, /* Harari */ -/*{HB_TAG('h','a','w',' '), HB_TAG('H','A','W',' ')},*/ /* Hawaiian */ {HB_TAG('h','a','x',' '), HB_TAG('H','A','I','0')}, /* Southern Haida -> Haida */ -/*{HB_TAG('h','a','y',' '), HB_TAG('H','A','Y',' ')},*/ /* Haya */ -/*{HB_TAG('h','a','z',' '), HB_TAG('H','A','Z',' ')},*/ /* Hazaragi */ - {HB_TAG('h','b','n',' '), HB_TAG_NONE }, /* Heiban != Hammer-Banna */ {HB_TAG('h','c','a',' '), HB_TAG('C','P','P',' ')}, /* Andaman Creole Hindi -> Creoles */ {HB_TAG('h','d','n',' '), HB_TAG('H','A','I','0')}, /* Northern Haida -> Haida */ {HB_TAG('h','e','a',' '), HB_TAG('H','M','N',' ')}, /* Northern Qiandong Miao -> Hmong */ -/*{HB_TAG('h','e','i',' '), HB_TAG('H','E','I',' ')},*/ /* Heiltsuk */ -/*{HB_TAG('h','i','l',' '), HB_TAG('H','I','L',' ')},*/ /* Hiligaynon */ {HB_TAG('h','j','i',' '), HB_TAG('M','L','Y',' ')}, /* Haji -> Malay */ {HB_TAG('h','l','t',' '), HB_TAG('Q','I','N',' ')}, /* Matu Chin -> Chin */ {HB_TAG('h','m','a',' '), HB_TAG('H','M','N',' ')}, /* Southern Mashan Hmong -> Hmong */ {HB_TAG('h','m','c',' '), HB_TAG('H','M','N',' ')}, /* Central Huishui Hmong -> Hmong */ - {HB_TAG('h','m','d',' '), HB_TAG('H','M','D',' ')}, /* Large Flowery Miao -> A-Hmao */ - {HB_TAG('h','m','d',' '), HB_TAG('H','M','N',' ')}, /* Large Flowery Miao -> Hmong */ {HB_TAG('h','m','e',' '), HB_TAG('H','M','N',' ')}, /* Eastern Huishui Hmong -> Hmong */ {HB_TAG('h','m','g',' '), HB_TAG('H','M','N',' ')}, /* Southwestern Guiyang Hmong -> Hmong */ {HB_TAG('h','m','h',' '), HB_TAG('H','M','N',' ')}, /* Southwestern Huishui Hmong -> Hmong */ @@ -733,36 +690,27 @@ static const LangTag ot_languages3[] = { {HB_TAG('h','m','j',' '), HB_TAG('H','M','N',' ')}, /* Ge -> Hmong */ {HB_TAG('h','m','l',' '), HB_TAG('H','M','N',' ')}, /* Luopohe Hmong -> Hmong */ {HB_TAG('h','m','m',' '), HB_TAG('H','M','N',' ')}, /* Central Mashan Hmong -> Hmong */ -/*{HB_TAG('h','m','n',' '), HB_TAG('H','M','N',' ')},*/ /* Hmong [macrolanguage] */ {HB_TAG('h','m','p',' '), HB_TAG('H','M','N',' ')}, /* Northern Mashan Hmong -> Hmong */ {HB_TAG('h','m','q',' '), HB_TAG('H','M','N',' ')}, /* Eastern Qiandong Miao -> Hmong */ {HB_TAG('h','m','r',' '), HB_TAG('Q','I','N',' ')}, /* Hmar -> Chin */ {HB_TAG('h','m','s',' '), HB_TAG('H','M','N',' ')}, /* Southern Qiandong Miao -> Hmong */ {HB_TAG('h','m','w',' '), HB_TAG('H','M','N',' ')}, /* Western Mashan Hmong -> Hmong */ {HB_TAG('h','m','y',' '), HB_TAG('H','M','N',' ')}, /* Southern Guiyang Hmong -> Hmong */ - {HB_TAG('h','m','z',' '), HB_TAG('H','M','Z',' ')}, /* Hmong Shua -> Hmong Shuat */ - {HB_TAG('h','m','z',' '), HB_TAG('H','M','N',' ')}, /* Hmong Shua -> Hmong */ -/*{HB_TAG('h','n','d',' '), HB_TAG('H','N','D',' ')},*/ /* Southern Hindko -> Hindko */ {HB_TAG('h','n','e',' '), HB_TAG('C','H','H',' ')}, /* Chhattisgarhi -> Chattisgarhi */ {HB_TAG('h','n','j',' '), HB_TAG('H','M','N',' ')}, /* Hmong Njua -> Hmong */ {HB_TAG('h','n','m',' '), HB_TAG('Z','H','S',' ')}, /* Hainanese -> Chinese, Simplified */ {HB_TAG('h','n','o',' '), HB_TAG('H','N','D',' ')}, /* Northern Hindko -> Hindko */ {HB_TAG('h','o','c',' '), HB_TAG('H','O',' ',' ')}, /* Ho */ {HB_TAG('h','o','i',' '), HB_TAG('A','T','H',' ')}, /* Holikachuk -> Athapaskan */ - {HB_TAG('h','o','j',' '), HB_TAG('H','A','R',' ')}, /* Hadothi -> Harauti */ - {HB_TAG('h','o','j',' '), HB_TAG('R','A','J',' ')}, /* Hadothi -> Rajasthani */ {HB_TAG('h','r','a',' '), HB_TAG('Q','I','N',' ')}, /* Hrangkhol -> Chin */ {HB_TAG('h','r','m',' '), HB_TAG('H','M','N',' ')}, /* Horned Miao -> Hmong */ {HB_TAG('h','s','b',' '), HB_TAG('U','S','B',' ')}, /* Upper Sorbian */ {HB_TAG('h','s','n',' '), HB_TAG('Z','H','S',' ')}, /* Xiang Chinese -> Chinese, Simplified */ {HB_TAG('h','u','j',' '), HB_TAG('H','M','N',' ')}, /* Northern Guiyang Hmong -> Hmong */ {HB_TAG('h','u','p',' '), HB_TAG('A','T','H',' ')}, /* Hupa -> Athapaskan */ -/*{HB_TAG('h','u','r',' '), HB_TAG('H','U','R',' ')},*/ /* Halkomelem */ {HB_TAG('h','u','s',' '), HB_TAG('M','Y','N',' ')}, /* Huastec -> Mayan */ {HB_TAG('h','w','c',' '), HB_TAG('C','P','P',' ')}, /* Hawai'i Creole English -> Creoles */ {HB_TAG('h','y','w',' '), HB_TAG('H','Y','E',' ')}, /* Western Armenian -> Armenian */ -/*{HB_TAG('i','b','a',' '), HB_TAG('I','B','A',' ')},*/ /* Iban */ -/*{HB_TAG('i','b','b',' '), HB_TAG('I','B','B',' ')},*/ /* Ibibio */ {HB_TAG('i','b','y',' '), HB_TAG('I','J','O',' ')}, /* Ibani -> Ijo */ {HB_TAG('i','c','r',' '), HB_TAG('C','P','P',' ')}, /* Islander Creole English -> Creoles */ {HB_TAG('i','d','a',' '), HB_TAG('L','U','H',' ')}, /* Idakho-Isukha-Tiriki -> Luyia */ @@ -772,156 +720,71 @@ static const LangTag ot_languages3[] = { {HB_TAG('i','j','c',' '), HB_TAG('I','J','O',' ')}, /* Izon -> Ijo */ {HB_TAG('i','j','e',' '), HB_TAG('I','J','O',' ')}, /* Biseni -> Ijo */ {HB_TAG('i','j','n',' '), HB_TAG('I','J','O',' ')}, /* Kalabari -> Ijo */ -/*{HB_TAG('i','j','o',' '), HB_TAG('I','J','O',' ')},*/ /* Ijo [collection] */ {HB_TAG('i','j','s',' '), HB_TAG('I','J','O',' ')}, /* Southeast Ijo -> Ijo */ - {HB_TAG('i','k','e',' '), HB_TAG('I','N','U',' ')}, /* Eastern Canadian Inuktitut -> Inuktitut */ - {HB_TAG('i','k','e',' '), HB_TAG('I','N','U','K')}, /* Eastern Canadian Inuktitut -> Nunavik Inuktitut */ {HB_TAG('i','k','t',' '), HB_TAG('I','N','U',' ')}, /* Inuinnaqtun -> Inuktitut */ -/*{HB_TAG('i','l','o',' '), HB_TAG('I','L','O',' ')},*/ /* Iloko -> Ilokano */ {HB_TAG('i','n','g',' '), HB_TAG('A','T','H',' ')}, /* Degexit'an -> Athapaskan */ {HB_TAG('i','n','h',' '), HB_TAG('I','N','G',' ')}, /* Ingush */ - {HB_TAG('i','r','i',' '), HB_TAG_NONE }, /* Rigwe != Irish */ -/*{HB_TAG('i','r','u',' '), HB_TAG('I','R','U',' ')},*/ /* Irula */ - {HB_TAG('i','s','m',' '), HB_TAG_NONE }, /* Masimasi != Inari Sami */ {HB_TAG('i','t','z',' '), HB_TAG('M','Y','N',' ')}, /* Itzá -> Mayan */ {HB_TAG('i','x','l',' '), HB_TAG('M','Y','N',' ')}, /* Ixil -> Mayan */ {HB_TAG('j','a','c',' '), HB_TAG('M','Y','N',' ')}, /* Popti' -> Mayan */ {HB_TAG('j','a','k',' '), HB_TAG('M','L','Y',' ')}, /* Jakun -> Malay */ - {HB_TAG('j','a','m',' '), HB_TAG('J','A','M',' ')}, /* Jamaican Creole English -> Jamaican Creole */ - {HB_TAG('j','a','m',' '), HB_TAG('C','P','P',' ')}, /* Jamaican Creole English -> Creoles */ - {HB_TAG('j','a','n',' '), HB_TAG_NONE }, /* Jandai != Japanese */ {HB_TAG('j','a','x',' '), HB_TAG('M','L','Y',' ')}, /* Jambi Malay -> Malay */ {HB_TAG('j','b','e',' '), HB_TAG('B','B','R',' ')}, /* Judeo-Berber -> Berber */ {HB_TAG('j','b','n',' '), HB_TAG('B','B','R',' ')}, /* Nafusi -> Berber */ -/*{HB_TAG('j','b','o',' '), HB_TAG('J','B','O',' ')},*/ /* Lojban */ -/*{HB_TAG('j','c','t',' '), HB_TAG('J','C','T',' ')},*/ /* Krymchak */ -/*{HB_TAG('j','d','t',' '), HB_TAG('J','D','T',' ')},*/ /* Judeo-Tat */ {HB_TAG('j','g','o',' '), HB_TAG('B','M','L',' ')}, /* Ngomba -> Bamileke */ - {HB_TAG('j','i','i',' '), HB_TAG_NONE }, /* Jiiddu != Yiddish */ {HB_TAG('j','k','m',' '), HB_TAG('K','R','N',' ')}, /* Mobwa Karen -> Karen */ {HB_TAG('j','k','p',' '), HB_TAG('K','R','N',' ')}, /* Paku Karen -> Karen */ - {HB_TAG('j','u','d',' '), HB_TAG_NONE }, /* Worodougou != Ladino */ - {HB_TAG('j','u','l',' '), HB_TAG_NONE }, /* Jirel != Jula */ {HB_TAG('j','v','d',' '), HB_TAG('C','P','P',' ')}, /* Javindo -> Creoles */ {HB_TAG('k','a','a',' '), HB_TAG('K','R','K',' ')}, /* Karakalpak */ - {HB_TAG('k','a','b',' '), HB_TAG('K','A','B','0')}, /* Kabyle */ - {HB_TAG('k','a','b',' '), HB_TAG('B','B','R',' ')}, /* Kabyle -> Berber */ - {HB_TAG('k','a','c',' '), HB_TAG_NONE }, /* Kachin != Kachchi */ {HB_TAG('k','a','m',' '), HB_TAG('K','M','B',' ')}, /* Kamba (Kenya) */ {HB_TAG('k','a','r',' '), HB_TAG('K','R','N',' ')}, /* Karen [collection] */ -/*{HB_TAG('k','a','w',' '), HB_TAG('K','A','W',' ')},*/ /* Kawi (Old Javanese) */ -/*{HB_TAG('k','b','c',' '), HB_TAG('K','B','C',' ')},*/ /* Kadiwéu */ {HB_TAG('k','b','d',' '), HB_TAG('K','A','B',' ')}, /* Kabardian */ {HB_TAG('k','b','y',' '), HB_TAG('K','N','R',' ')}, /* Manga Kanuri -> Kanuri */ - {HB_TAG('k','c','a',' '), HB_TAG('K','H','K',' ')}, /* Khanty -> Khanty-Kazim */ - {HB_TAG('k','c','a',' '), HB_TAG('K','H','S',' ')}, /* Khanty -> Khanty-Shurishkar */ - {HB_TAG('k','c','a',' '), HB_TAG('K','H','V',' ')}, /* Khanty -> Khanty-Vakhi */ {HB_TAG('k','c','n',' '), HB_TAG('C','P','P',' ')}, /* Nubi -> Creoles */ -/*{HB_TAG('k','d','e',' '), HB_TAG('K','D','E',' ')},*/ /* Makonde */ {HB_TAG('k','d','r',' '), HB_TAG('K','R','M',' ')}, /* Karaim */ {HB_TAG('k','d','t',' '), HB_TAG('K','U','Y',' ')}, /* Kuy */ - {HB_TAG('k','e','a',' '), HB_TAG('K','E','A',' ')}, /* Kabuverdianu (Crioulo) */ - {HB_TAG('k','e','a',' '), HB_TAG('C','P','P',' ')}, /* Kabuverdianu -> Creoles */ - {HB_TAG('k','e','b',' '), HB_TAG_NONE }, /* Kélé != Kebena */ - {HB_TAG('k','e','k',' '), HB_TAG('K','E','K',' ')}, /* Kekchi */ - {HB_TAG('k','e','k',' '), HB_TAG('M','Y','N',' ')}, /* Kekchí -> Mayan */ {HB_TAG('k','e','x',' '), HB_TAG('K','K','N',' ')}, /* Kukna -> Kokni */ {HB_TAG('k','f','a',' '), HB_TAG('K','O','D',' ')}, /* Kodava -> Kodagu */ {HB_TAG('k','f','r',' '), HB_TAG('K','A','C',' ')}, /* Kachhi -> Kachchi */ {HB_TAG('k','f','x',' '), HB_TAG('K','U','L',' ')}, /* Kullu Pahari -> Kulvi */ {HB_TAG('k','f','y',' '), HB_TAG('K','M','N',' ')}, /* Kumaoni */ - {HB_TAG('k','g','e',' '), HB_TAG_NONE }, /* Komering != Khutsuri Georgian */ -/*{HB_TAG('k','g','f',' '), HB_TAG('K','G','F',' ')},*/ /* Kube */ {HB_TAG('k','h','a',' '), HB_TAG('K','S','I',' ')}, /* Khasi */ {HB_TAG('k','h','b',' '), HB_TAG('X','B','D',' ')}, /* Lü */ {HB_TAG('k','h','k',' '), HB_TAG('M','N','G',' ')}, /* Halh Mongolian -> Mongolian */ - {HB_TAG('k','h','n',' '), HB_TAG_NONE }, /* Khandesi != Khamti Shan (Microsoft fonts) */ - {HB_TAG('k','h','s',' '), HB_TAG_NONE }, /* Kasua != Khanty-Shurishkar */ - {HB_TAG('k','h','t',' '), HB_TAG('K','H','T',' ')}, /* Khamti -> Khamti Shan */ - {HB_TAG('k','h','t',' '), HB_TAG('K','H','N',' ')}, /* Khamti -> Khamti Shan (Microsoft fonts) */ - {HB_TAG('k','h','v',' '), HB_TAG_NONE }, /* Khvarshi != Khanty-Vakhi */ -/*{HB_TAG('k','h','w',' '), HB_TAG('K','H','W',' ')},*/ /* Khowar */ - {HB_TAG('k','i','s',' '), HB_TAG_NONE }, /* Kis != Kisii */ - {HB_TAG('k','i','u',' '), HB_TAG('K','I','U',' ')}, /* Kirmanjki */ - {HB_TAG('k','i','u',' '), HB_TAG('Z','Z','A',' ')}, /* Kirmanjki -> Zazaki */ {HB_TAG('k','j','b',' '), HB_TAG('M','Y','N',' ')}, /* Q'anjob'al -> Mayan */ -/*{HB_TAG('k','j','d',' '), HB_TAG('K','J','D',' ')},*/ /* Southern Kiwai */ {HB_TAG('k','j','h',' '), HB_TAG('K','H','A',' ')}, /* Khakas -> Khakass */ -/*{HB_TAG('k','j','j',' '), HB_TAG('K','J','J',' ')},*/ /* Khinalugh -> Khinalug */ - {HB_TAG('k','j','p',' '), HB_TAG('K','J','P',' ')}, /* Pwo Eastern Karen -> Eastern Pwo Karen */ - {HB_TAG('k','j','p',' '), HB_TAG('K','R','N',' ')}, /* Pwo Eastern Karen -> Karen */ {HB_TAG('k','j','t',' '), HB_TAG('K','R','N',' ')}, /* Phrae Pwo Karen -> Karen */ -/*{HB_TAG('k','j','z',' '), HB_TAG('K','J','Z',' ')},*/ /* Bumthangkha */ - {HB_TAG('k','k','n',' '), HB_TAG_NONE }, /* Kon Keu != Kokni */ {HB_TAG('k','k','z',' '), HB_TAG('A','T','H',' ')}, /* Kaska -> Athapaskan */ - {HB_TAG('k','l','m',' '), HB_TAG_NONE }, /* Migum != Kalmyk */ {HB_TAG('k','l','n',' '), HB_TAG('K','A','L',' ')}, /* Kalenjin [macrolanguage] */ {HB_TAG('k','m','b',' '), HB_TAG('M','B','N',' ')}, /* Kimbundu -> Mbundu */ -/*{HB_TAG('k','m','g',' '), HB_TAG('K','M','G',' ')},*/ /* Kâte */ - {HB_TAG('k','m','n',' '), HB_TAG_NONE }, /* Awtuw != Kumaoni */ - {HB_TAG('k','m','o',' '), HB_TAG_NONE }, /* Kwoma != Komo */ {HB_TAG('k','m','r',' '), HB_TAG('K','U','R',' ')}, /* Northern Kurdish -> Kurdish */ - {HB_TAG('k','m','s',' '), HB_TAG_NONE }, /* Kamasau != Komso */ {HB_TAG('k','m','v',' '), HB_TAG('C','P','P',' ')}, /* Karipúna Creole French -> Creoles */ {HB_TAG('k','m','w',' '), HB_TAG('K','M','O',' ')}, /* Komo (Democratic Republic of Congo) */ -/*{HB_TAG('k','m','z',' '), HB_TAG('K','M','Z',' ')},*/ /* Khorasani Turkish -> Khorasani Turkic */ {HB_TAG('k','n','c',' '), HB_TAG('K','N','R',' ')}, /* Central Kanuri -> Kanuri */ {HB_TAG('k','n','g',' '), HB_TAG('K','O','N','0')}, /* Koongo -> Kongo */ {HB_TAG('k','n','j',' '), HB_TAG('M','Y','N',' ')}, /* Western Kanjobal -> Mayan */ {HB_TAG('k','n','n',' '), HB_TAG('K','O','K',' ')}, /* Konkani */ - {HB_TAG('k','n','r',' '), HB_TAG_NONE }, /* Kaningra != Kanuri */ - {HB_TAG('k','o','d',' '), HB_TAG_NONE }, /* Kodi != Kodagu */ - {HB_TAG('k','o','h',' '), HB_TAG_NONE }, /* Koyo != Korean Old Hangul */ - {HB_TAG('k','o','i',' '), HB_TAG('K','O','P',' ')}, /* Komi-Permyak */ - {HB_TAG('k','o','i',' '), HB_TAG('K','O','M',' ')}, /* Komi-Permyak -> Komi */ -/*{HB_TAG('k','o','k',' '), HB_TAG('K','O','K',' ')},*/ /* Konkani [macrolanguage] */ - {HB_TAG('k','o','p',' '), HB_TAG_NONE }, /* Waube != Komi-Permyak */ -/*{HB_TAG('k','o','s',' '), HB_TAG('K','O','S',' ')},*/ /* Kosraean */ {HB_TAG('k','o','y',' '), HB_TAG('A','T','H',' ')}, /* Koyukon -> Athapaskan */ - {HB_TAG('k','o','z',' '), HB_TAG_NONE }, /* Korak != Komi-Zyrian */ {HB_TAG('k','p','e',' '), HB_TAG('K','P','L',' ')}, /* Kpelle [macrolanguage] */ - {HB_TAG('k','p','l',' '), HB_TAG_NONE }, /* Kpala != Kpelle */ {HB_TAG('k','p','p',' '), HB_TAG('K','R','N',' ')}, /* Paku Karen (retired code) -> Karen */ - {HB_TAG('k','p','v',' '), HB_TAG('K','O','Z',' ')}, /* Komi-Zyrian */ - {HB_TAG('k','p','v',' '), HB_TAG('K','O','M',' ')}, /* Komi-Zyrian -> Komi */ {HB_TAG('k','p','y',' '), HB_TAG('K','Y','K',' ')}, /* Koryak */ {HB_TAG('k','q','s',' '), HB_TAG('K','I','S',' ')}, /* Northern Kissi -> Kisii */ {HB_TAG('k','q','y',' '), HB_TAG('K','R','T',' ')}, /* Koorete */ - {HB_TAG('k','r','c',' '), HB_TAG('K','A','R',' ')}, /* Karachay-Balkar -> Karachay */ - {HB_TAG('k','r','c',' '), HB_TAG('B','A','L',' ')}, /* Karachay-Balkar -> Balkar */ - {HB_TAG('k','r','i',' '), HB_TAG('K','R','I',' ')}, /* Krio */ - {HB_TAG('k','r','i',' '), HB_TAG('C','P','P',' ')}, /* Krio -> Creoles */ - {HB_TAG('k','r','k',' '), HB_TAG_NONE }, /* Kerek != Karakalpak */ -/*{HB_TAG('k','r','l',' '), HB_TAG('K','R','L',' ')},*/ /* Karelian */ - {HB_TAG('k','r','m',' '), HB_TAG_NONE }, /* Krim (retired code) != Karaim */ - {HB_TAG('k','r','n',' '), HB_TAG_NONE }, /* Sapo != Karen */ {HB_TAG('k','r','t',' '), HB_TAG('K','N','R',' ')}, /* Tumari Kanuri -> Kanuri */ {HB_TAG('k','r','u',' '), HB_TAG('K','U','U',' ')}, /* Kurukh */ {HB_TAG('k','s','h',' '), HB_TAG('K','S','H','0')}, /* Kölsch -> Ripuarian */ - {HB_TAG('k','s','i',' '), HB_TAG_NONE }, /* Krisa != Khasi */ - {HB_TAG('k','s','m',' '), HB_TAG_NONE }, /* Kumba != Kildin Sami */ {HB_TAG('k','s','s',' '), HB_TAG('K','I','S',' ')}, /* Southern Kisi -> Kisii */ -/*{HB_TAG('k','s','u',' '), HB_TAG('K','S','U',' ')},*/ /* Khamyang */ - {HB_TAG('k','s','w',' '), HB_TAG('K','S','W',' ')}, /* S’gaw Karen */ - {HB_TAG('k','s','w',' '), HB_TAG('K','R','N',' ')}, /* S'gaw Karen -> Karen */ {HB_TAG('k','t','b',' '), HB_TAG('K','E','B',' ')}, /* Kambaata -> Kebena */ {HB_TAG('k','t','u',' '), HB_TAG('K','O','N',' ')}, /* Kituba (Democratic Republic of Congo) -> Kikongo */ {HB_TAG('k','t','w',' '), HB_TAG('A','T','H',' ')}, /* Kato -> Athapaskan */ - {HB_TAG('k','u','i',' '), HB_TAG_NONE }, /* Kuikúro-Kalapálo != Kui */ - {HB_TAG('k','u','l',' '), HB_TAG_NONE }, /* Kulere != Kulvi */ -/*{HB_TAG('k','u','m',' '), HB_TAG('K','U','M',' ')},*/ /* Kumyk */ {HB_TAG('k','u','u',' '), HB_TAG('A','T','H',' ')}, /* Upper Kuskokwim -> Athapaskan */ {HB_TAG('k','u','w',' '), HB_TAG('B','A','D','0')}, /* Kpagua -> Banda */ - {HB_TAG('k','u','y',' '), HB_TAG_NONE }, /* Kuuku-Ya'u != Kuy */ {HB_TAG('k','v','b',' '), HB_TAG('M','L','Y',' ')}, /* Kubu -> Malay */ {HB_TAG('k','v','l',' '), HB_TAG('K','R','N',' ')}, /* Kayaw -> Karen */ - {HB_TAG('k','v','q',' '), HB_TAG('K','V','Q',' ')}, /* Geba Karen */ - {HB_TAG('k','v','q',' '), HB_TAG('K','R','N',' ')}, /* Geba Karen -> Karen */ {HB_TAG('k','v','r',' '), HB_TAG('M','L','Y',' ')}, /* Kerinci -> Malay */ {HB_TAG('k','v','t',' '), HB_TAG('K','R','N',' ')}, /* Lahta Karen -> Karen */ {HB_TAG('k','v','u',' '), HB_TAG('K','R','N',' ')}, /* Yinbaw Karen -> Karen */ {HB_TAG('k','v','y',' '), HB_TAG('K','R','N',' ')}, /* Yintale Karen -> Karen */ -/*{HB_TAG('k','w','k',' '), HB_TAG('K','W','K',' ')},*/ /* Kwakʼwala */ {HB_TAG('k','w','w',' '), HB_TAG('C','P','P',' ')}, /* Kwinti -> Creoles */ {HB_TAG('k','w','y',' '), HB_TAG('K','O','N','0')}, /* San Salvador Kongo -> Kongo */ {HB_TAG('k','x','c',' '), HB_TAG('K','M','S',' ')}, /* Konso -> Komso */ @@ -930,195 +793,98 @@ static const LangTag ot_languages3[] = { {HB_TAG('k','x','k',' '), HB_TAG('K','R','N',' ')}, /* Zayein Karen -> Karen */ {HB_TAG('k','x','l',' '), HB_TAG('K','U','U',' ')}, /* Nepali Kurux (retired code) -> Kurukh */ {HB_TAG('k','x','u',' '), HB_TAG('K','U','I',' ')}, /* Kui (India) (retired code) */ - {HB_TAG('k','y','k',' '), HB_TAG_NONE }, /* Kamayo != Koryak */ - {HB_TAG('k','y','u',' '), HB_TAG('K','Y','U',' ')}, /* Western Kayah */ - {HB_TAG('k','y','u',' '), HB_TAG('K','R','N',' ')}, /* Western Kayah -> Karen */ {HB_TAG('l','a','c',' '), HB_TAG('M','Y','N',' ')}, /* Lacandon -> Mayan */ {HB_TAG('l','a','d',' '), HB_TAG('J','U','D',' ')}, /* Ladino */ - {HB_TAG('l','a','h',' '), HB_TAG_NONE }, /* Lahnda [macrolanguage] != Lahuli */ - {HB_TAG('l','a','k',' '), HB_TAG_NONE }, /* Laka (Nigeria) (retired code) != Lak */ - {HB_TAG('l','a','m',' '), HB_TAG_NONE }, /* Lamba != Lambani */ - {HB_TAG('l','a','z',' '), HB_TAG_NONE }, /* Aribwatsa != Laz */ {HB_TAG('l','b','e',' '), HB_TAG('L','A','K',' ')}, /* Lak */ {HB_TAG('l','b','j',' '), HB_TAG('L','D','K',' ')}, /* Ladakhi */ {HB_TAG('l','b','l',' '), HB_TAG('B','I','K',' ')}, /* Libon Bikol -> Bikol */ {HB_TAG('l','c','e',' '), HB_TAG('M','L','Y',' ')}, /* Loncong -> Malay */ {HB_TAG('l','c','f',' '), HB_TAG('M','L','Y',' ')}, /* Lubu -> Malay */ {HB_TAG('l','d','i',' '), HB_TAG('K','O','N','0')}, /* Laari -> Kongo */ - {HB_TAG('l','d','k',' '), HB_TAG_NONE }, /* Leelau != Ladakhi */ -/*{HB_TAG('l','e','f',' '), HB_TAG('L','E','F',' ')},*/ /* Lelemi */ -/*{HB_TAG('l','e','z',' '), HB_TAG('L','E','Z',' ')},*/ /* Lezghian -> Lezgi */ {HB_TAG('l','i','f',' '), HB_TAG('L','M','B',' ')}, /* Limbu */ -/*{HB_TAG('l','i','j',' '), HB_TAG('L','I','J',' ')},*/ /* Ligurian */ {HB_TAG('l','i','r',' '), HB_TAG('C','P','P',' ')}, /* Liberian English -> Creoles */ -/*{HB_TAG('l','i','s',' '), HB_TAG('L','I','S',' ')},*/ /* Lisu */ -/*{HB_TAG('l','i','v',' '), HB_TAG('L','I','V',' ')},*/ /* Liv */ {HB_TAG('l','i','w',' '), HB_TAG('M','L','Y',' ')}, /* Col -> Malay */ {HB_TAG('l','i','y',' '), HB_TAG('B','A','D','0')}, /* Banda-Bambari -> Banda */ -/*{HB_TAG('l','j','p',' '), HB_TAG('L','J','P',' ')},*/ /* Lampung Api -> Lampung */ {HB_TAG('l','k','b',' '), HB_TAG('L','U','H',' ')}, /* Kabras -> Luyia */ -/*{HB_TAG('l','k','i',' '), HB_TAG('L','K','I',' ')},*/ /* Laki */ {HB_TAG('l','k','o',' '), HB_TAG('L','U','H',' ')}, /* Khayo -> Luyia */ {HB_TAG('l','k','s',' '), HB_TAG('L','U','H',' ')}, /* Kisa -> Luyia */ {HB_TAG('l','l','d',' '), HB_TAG('L','A','D',' ')}, /* Ladin */ - {HB_TAG('l','m','a',' '), HB_TAG_NONE }, /* East Limba != Low Mari */ - {HB_TAG('l','m','b',' '), HB_TAG_NONE }, /* Merei != Limbu */ {HB_TAG('l','m','n',' '), HB_TAG('L','A','M',' ')}, /* Lambadi -> Lambani */ -/*{HB_TAG('l','m','o',' '), HB_TAG('L','M','O',' ')},*/ /* Lombard */ - {HB_TAG('l','m','w',' '), HB_TAG_NONE }, /* Lake Miwok != Lomwe */ {HB_TAG('l','n','a',' '), HB_TAG('B','A','D','0')}, /* Langbashe -> Banda */ {HB_TAG('l','n','l',' '), HB_TAG('B','A','D','0')}, /* South Central Banda -> Banda */ -/*{HB_TAG('l','o','m',' '), HB_TAG('L','O','M',' ')},*/ /* Loma (Liberia) */ {HB_TAG('l','o','u',' '), HB_TAG('C','P','P',' ')}, /* Louisiana Creole -> Creoles */ -/*{HB_TAG('l','p','o',' '), HB_TAG('L','P','O',' ')},*/ /* Lipo */ -/*{HB_TAG('l','r','c',' '), HB_TAG('L','R','C',' ')},*/ /* Northern Luri -> Luri */ {HB_TAG('l','r','i',' '), HB_TAG('L','U','H',' ')}, /* Marachi -> Luyia */ {HB_TAG('l','r','m',' '), HB_TAG('L','U','H',' ')}, /* Marama -> Luyia */ {HB_TAG('l','r','t',' '), HB_TAG('C','P','P',' ')}, /* Larantuka Malay -> Creoles */ - {HB_TAG('l','s','b',' '), HB_TAG_NONE }, /* Burundian Sign Language != Lower Sorbian */ {HB_TAG('l','s','m',' '), HB_TAG('L','U','H',' ')}, /* Saamia -> Luyia */ {HB_TAG('l','t','g',' '), HB_TAG('L','V','I',' ')}, /* Latgalian -> Latvian */ - {HB_TAG('l','t','h',' '), HB_TAG_NONE }, /* Thur != Lithuanian */ {HB_TAG('l','t','o',' '), HB_TAG('L','U','H',' ')}, /* Tsotso -> Luyia */ {HB_TAG('l','t','s',' '), HB_TAG('L','U','H',' ')}, /* Tachoni -> Luyia */ -/*{HB_TAG('l','u','a',' '), HB_TAG('L','U','A',' ')},*/ /* Luba-Lulua */ {HB_TAG('l','u','h',' '), HB_TAG('Z','H','S',' ')}, /* Leizhou Chinese -> Chinese, Simplified */ -/*{HB_TAG('l','u','o',' '), HB_TAG('L','U','O',' ')},*/ /* Luo (Kenya and Tanzania) */ - {HB_TAG('l','u','s',' '), HB_TAG('M','I','Z',' ')}, /* Lushai -> Mizo */ - {HB_TAG('l','u','s',' '), HB_TAG('Q','I','N',' ')}, /* Lushai -> Chin */ -/*{HB_TAG('l','u','t',' '), HB_TAG('L','U','T',' ')},*/ /* Lushootseed */ {HB_TAG('l','u','y',' '), HB_TAG('L','U','H',' ')}, /* Luyia [macrolanguage] */ {HB_TAG('l','u','z',' '), HB_TAG('L','R','C',' ')}, /* Southern Luri -> Luri */ - {HB_TAG('l','v','i',' '), HB_TAG_NONE }, /* Lavi != Latvian */ {HB_TAG('l','v','s',' '), HB_TAG('L','V','I',' ')}, /* Standard Latvian -> Latvian */ {HB_TAG('l','w','g',' '), HB_TAG('L','U','H',' ')}, /* Wanga -> Luyia */ {HB_TAG('l','z','h',' '), HB_TAG('Z','H','T',' ')}, /* Literary Chinese -> Chinese, Traditional */ {HB_TAG('l','z','z',' '), HB_TAG('L','A','Z',' ')}, /* Laz */ -/*{HB_TAG('m','a','d',' '), HB_TAG('M','A','D',' ')},*/ /* Madurese -> Madura */ -/*{HB_TAG('m','a','g',' '), HB_TAG('M','A','G',' ')},*/ /* Magahi */ {HB_TAG('m','a','i',' '), HB_TAG('M','T','H',' ')}, /* Maithili */ - {HB_TAG('m','a','j',' '), HB_TAG_NONE }, /* Jalapa De Díaz Mazatec != Majang */ {HB_TAG('m','a','k',' '), HB_TAG('M','K','R',' ')}, /* Makasar */ - {HB_TAG('m','a','m',' '), HB_TAG('M','A','M',' ')}, /* Mam */ - {HB_TAG('m','a','m',' '), HB_TAG('M','Y','N',' ')}, /* Mam -> Mayan */ {HB_TAG('m','a','n',' '), HB_TAG('M','N','K',' ')}, /* Mandingo [macrolanguage] -> Maninka */ - {HB_TAG('m','a','p',' '), HB_TAG_NONE }, /* Austronesian [collection] != Mapudungun */ - {HB_TAG('m','a','w',' '), HB_TAG_NONE }, /* Mampruli != Marwari */ - {HB_TAG('m','a','x',' '), HB_TAG('M','L','Y',' ')}, /* North Moluccan Malay -> Malay */ - {HB_TAG('m','a','x',' '), HB_TAG('C','P','P',' ')}, /* North Moluccan Malay -> Creoles */ {HB_TAG('m','b','f',' '), HB_TAG('C','P','P',' ')}, /* Baba Malay -> Creoles */ - {HB_TAG('m','b','n',' '), HB_TAG_NONE }, /* Macaguán != Mbundu */ -/*{HB_TAG('m','b','o',' '), HB_TAG('M','B','O',' ')},*/ /* Mbo (Cameroon) */ - {HB_TAG('m','c','h',' '), HB_TAG_NONE }, /* Maquiritari != Manchu */ {HB_TAG('m','c','m',' '), HB_TAG('C','P','P',' ')}, /* Malaccan Creole Portuguese -> Creoles */ - {HB_TAG('m','c','r',' '), HB_TAG_NONE }, /* Menya != Moose Cree */ {HB_TAG('m','c','t',' '), HB_TAG('B','T','I',' ')}, /* Mengisa -> Beti */ - {HB_TAG('m','d','e',' '), HB_TAG_NONE }, /* Maba (Chad) != Mende */ {HB_TAG('m','d','f',' '), HB_TAG('M','O','K',' ')}, /* Moksha */ -/*{HB_TAG('m','d','r',' '), HB_TAG('M','D','R',' ')},*/ /* Mandar */ {HB_TAG('m','d','y',' '), HB_TAG('M','L','E',' ')}, /* Male (Ethiopia) */ {HB_TAG('m','e','n',' '), HB_TAG('M','D','E',' ')}, /* Mende (Sierra Leone) */ {HB_TAG('m','e','o',' '), HB_TAG('M','L','Y',' ')}, /* Kedah Malay -> Malay */ -/*{HB_TAG('m','e','r',' '), HB_TAG('M','E','R',' ')},*/ /* Meru */ -/*{HB_TAG('m','e','v',' '), HB_TAG('M','E','V',' ')},*/ /* Mano */ - {HB_TAG('m','f','a',' '), HB_TAG('M','F','A',' ')}, /* Pattani Malay */ - {HB_TAG('m','f','a',' '), HB_TAG('M','L','Y',' ')}, /* Pattani Malay -> Malay */ {HB_TAG('m','f','b',' '), HB_TAG('M','L','Y',' ')}, /* Bangka -> Malay */ - {HB_TAG('m','f','e',' '), HB_TAG('M','F','E',' ')}, /* Morisyen */ - {HB_TAG('m','f','e',' '), HB_TAG('C','P','P',' ')}, /* Morisyen -> Creoles */ {HB_TAG('m','f','p',' '), HB_TAG('C','P','P',' ')}, /* Makassar Malay -> Creoles */ {HB_TAG('m','g','a',' '), HB_TAG('S','G','A',' ')}, /* Middle Irish (900-1200) -> Old Irish */ {HB_TAG('m','h','c',' '), HB_TAG('M','Y','N',' ')}, /* Mocho -> Mayan */ {HB_TAG('m','h','r',' '), HB_TAG('L','M','A',' ')}, /* Eastern Mari -> Low Mari */ {HB_TAG('m','h','v',' '), HB_TAG('A','R','K',' ')}, /* Arakanese (retired code) -> Rakhine */ - {HB_TAG('m','i','n',' '), HB_TAG('M','I','N',' ')}, /* Minangkabau */ - {HB_TAG('m','i','n',' '), HB_TAG('M','L','Y',' ')}, /* Minangkabau -> Malay */ - {HB_TAG('m','i','z',' '), HB_TAG_NONE }, /* Coatzospan Mixtec != Mizo */ {HB_TAG('m','k','n',' '), HB_TAG('C','P','P',' ')}, /* Kupang Malay -> Creoles */ - {HB_TAG('m','k','r',' '), HB_TAG_NONE }, /* Malas != Makasar */ {HB_TAG('m','k','u',' '), HB_TAG('M','N','K',' ')}, /* Konyanka Maninka -> Maninka */ -/*{HB_TAG('m','k','w',' '), HB_TAG('M','K','W',' ')},*/ /* Kituba (Congo) */ - {HB_TAG('m','l','e',' '), HB_TAG_NONE }, /* Manambu != Male */ - {HB_TAG('m','l','n',' '), HB_TAG_NONE }, /* Malango != Malinke */ - {HB_TAG('m','l','q',' '), HB_TAG('M','L','N',' ')}, /* Western Maninkakan -> Malinke */ - {HB_TAG('m','l','q',' '), HB_TAG('M','N','K',' ')}, /* Western Maninkakan -> Maninka */ - {HB_TAG('m','l','r',' '), HB_TAG_NONE }, /* Vame != Malayalam Reformed */ {HB_TAG('m','m','r',' '), HB_TAG('H','M','N',' ')}, /* Western Xiangxi Miao -> Hmong */ {HB_TAG('m','n','c',' '), HB_TAG('M','C','H',' ')}, /* Manchu */ - {HB_TAG('m','n','d',' '), HB_TAG_NONE }, /* Mondé != Mandinka */ - {HB_TAG('m','n','g',' '), HB_TAG_NONE }, /* Eastern Mnong != Mongolian */ {HB_TAG('m','n','h',' '), HB_TAG('B','A','D','0')}, /* Mono (Democratic Republic of Congo) -> Banda */ -/*{HB_TAG('m','n','i',' '), HB_TAG('M','N','I',' ')},*/ /* Manipuri */ - {HB_TAG('m','n','k',' '), HB_TAG('M','N','D',' ')}, /* Mandinka */ - {HB_TAG('m','n','k',' '), HB_TAG('M','N','K',' ')}, /* Mandinka -> Maninka */ {HB_TAG('m','n','p',' '), HB_TAG('Z','H','S',' ')}, /* Min Bei Chinese -> Chinese, Simplified */ {HB_TAG('m','n','s',' '), HB_TAG('M','A','N',' ')}, /* Mansi */ - {HB_TAG('m','n','w',' '), HB_TAG('M','O','N',' ')}, /* Mon */ - {HB_TAG('m','n','w',' '), HB_TAG('M','O','N','T')}, /* Mon -> Thailand Mon */ - {HB_TAG('m','n','x',' '), HB_TAG_NONE }, /* Manikion != Manx */ {HB_TAG('m','o','d',' '), HB_TAG('C','P','P',' ')}, /* Mobilian -> Creoles */ -/*{HB_TAG('m','o','h',' '), HB_TAG('M','O','H',' ')},*/ /* Mohawk */ - {HB_TAG('m','o','k',' '), HB_TAG_NONE }, /* Morori != Moksha */ {HB_TAG('m','o','p',' '), HB_TAG('M','Y','N',' ')}, /* Mopán Maya -> Mayan */ - {HB_TAG('m','o','r',' '), HB_TAG_NONE }, /* Moro != Moroccan */ -/*{HB_TAG('m','o','s',' '), HB_TAG('M','O','S',' ')},*/ /* Mossi */ {HB_TAG('m','p','e',' '), HB_TAG('M','A','J',' ')}, /* Majang */ {HB_TAG('m','q','g',' '), HB_TAG('M','L','Y',' ')}, /* Kota Bangun Kutai Malay -> Malay */ {HB_TAG('m','r','h',' '), HB_TAG('Q','I','N',' ')}, /* Mara Chin -> Chin */ {HB_TAG('m','r','j',' '), HB_TAG('H','M','A',' ')}, /* Western Mari -> High Mari */ {HB_TAG('m','s','c',' '), HB_TAG('M','N','K',' ')}, /* Sankaran Maninka -> Maninka */ {HB_TAG('m','s','h',' '), HB_TAG('M','L','G',' ')}, /* Masikoro Malagasy -> Malagasy */ - {HB_TAG('m','s','i',' '), HB_TAG('M','L','Y',' ')}, /* Sabah Malay -> Malay */ - {HB_TAG('m','s','i',' '), HB_TAG('C','P','P',' ')}, /* Sabah Malay -> Creoles */ - {HB_TAG('m','t','h',' '), HB_TAG_NONE }, /* Munggui != Maithili */ {HB_TAG('m','t','r',' '), HB_TAG('M','A','W',' ')}, /* Mewari -> Marwari */ - {HB_TAG('m','t','s',' '), HB_TAG_NONE }, /* Yora != Maltese */ {HB_TAG('m','u','d',' '), HB_TAG('C','P','P',' ')}, /* Mednyj Aleut -> Creoles */ {HB_TAG('m','u','i',' '), HB_TAG('M','L','Y',' ')}, /* Musi -> Malay */ - {HB_TAG('m','u','n',' '), HB_TAG_NONE }, /* Munda [collection] != Mundari */ {HB_TAG('m','u','p',' '), HB_TAG('R','A','J',' ')}, /* Malvi -> Rajasthani */ {HB_TAG('m','u','q',' '), HB_TAG('H','M','N',' ')}, /* Eastern Xiangxi Miao -> Hmong */ -/*{HB_TAG('m','u','s',' '), HB_TAG('M','U','S',' ')},*/ /* Creek -> Muscogee */ {HB_TAG('m','v','b',' '), HB_TAG('A','T','H',' ')}, /* Mattole -> Athapaskan */ {HB_TAG('m','v','e',' '), HB_TAG('M','A','W',' ')}, /* Marwari (Pakistan) */ {HB_TAG('m','v','f',' '), HB_TAG('M','N','G',' ')}, /* Peripheral Mongolian -> Mongolian */ {HB_TAG('m','w','k',' '), HB_TAG('M','N','K',' ')}, /* Kita Maninkakan -> Maninka */ -/*{HB_TAG('m','w','l',' '), HB_TAG('M','W','L',' ')},*/ /* Mirandese */ {HB_TAG('m','w','q',' '), HB_TAG('Q','I','N',' ')}, /* Mün Chin -> Chin */ {HB_TAG('m','w','r',' '), HB_TAG('M','A','W',' ')}, /* Marwari [macrolanguage] */ - {HB_TAG('m','w','w',' '), HB_TAG('M','W','W',' ')}, /* Hmong Daw */ - {HB_TAG('m','w','w',' '), HB_TAG('H','M','N',' ')}, /* Hmong Daw -> Hmong */ {HB_TAG('m','y','m',' '), HB_TAG('M','E','N',' ')}, /* Me’en */ -/*{HB_TAG('m','y','n',' '), HB_TAG('M','Y','N',' ')},*/ /* Mayan [collection] */ {HB_TAG('m','y','q',' '), HB_TAG('M','N','K',' ')}, /* Forest Maninka (retired code) -> Maninka */ {HB_TAG('m','y','v',' '), HB_TAG('E','R','Z',' ')}, /* Erzya */ {HB_TAG('m','z','b',' '), HB_TAG('B','B','R',' ')}, /* Tumzabt -> Berber */ -/*{HB_TAG('m','z','n',' '), HB_TAG('M','Z','N',' ')},*/ /* Mazanderani */ {HB_TAG('m','z','s',' '), HB_TAG('C','P','P',' ')}, /* Macanese -> Creoles */ - {HB_TAG('n','a','g',' '), HB_TAG('N','A','G',' ')}, /* Naga Pidgin -> Naga-Assamese */ - {HB_TAG('n','a','g',' '), HB_TAG('C','P','P',' ')}, /* Naga Pidgin -> Creoles */ -/*{HB_TAG('n','a','h',' '), HB_TAG('N','A','H',' ')},*/ /* Nahuatl [collection] */ {HB_TAG('n','a','n',' '), HB_TAG('Z','H','S',' ')}, /* Min Nan Chinese -> Chinese, Simplified */ -/*{HB_TAG('n','a','p',' '), HB_TAG('N','A','P',' ')},*/ /* Neapolitan */ - {HB_TAG('n','a','s',' '), HB_TAG_NONE }, /* Naasioi != Naskapi */ {HB_TAG('n','a','z',' '), HB_TAG('N','A','H',' ')}, /* Coatepec Nahuatl -> Nahuatl */ {HB_TAG('n','c','h',' '), HB_TAG('N','A','H',' ')}, /* Central Huasteca Nahuatl -> Nahuatl */ {HB_TAG('n','c','i',' '), HB_TAG('N','A','H',' ')}, /* Classical Nahuatl -> Nahuatl */ {HB_TAG('n','c','j',' '), HB_TAG('N','A','H',' ')}, /* Northern Puebla Nahuatl -> Nahuatl */ {HB_TAG('n','c','l',' '), HB_TAG('N','A','H',' ')}, /* Michoacán Nahuatl -> Nahuatl */ - {HB_TAG('n','c','r',' '), HB_TAG_NONE }, /* Ncane != N-Cree */ {HB_TAG('n','c','x',' '), HB_TAG('N','A','H',' ')}, /* Central Puebla Nahuatl -> Nahuatl */ - {HB_TAG('n','d','b',' '), HB_TAG_NONE }, /* Kenswei Nsei != Ndebele */ -/*{HB_TAG('n','d','c',' '), HB_TAG('N','D','C',' ')},*/ /* Ndau */ - {HB_TAG('n','d','g',' '), HB_TAG_NONE }, /* Ndengereko != Ndonga */ -/*{HB_TAG('n','d','s',' '), HB_TAG('N','D','S',' ')},*/ /* Low Saxon */ {HB_TAG('n','e','f',' '), HB_TAG('C','P','P',' ')}, /* Nefamese -> Creoles */ -/*{HB_TAG('n','e','w',' '), HB_TAG('N','E','W',' ')},*/ /* Newari */ -/*{HB_TAG('n','g','a',' '), HB_TAG('N','G','A',' ')},*/ /* Ngbaka */ {HB_TAG('n','g','l',' '), HB_TAG('L','M','W',' ')}, /* Lomwe */ {HB_TAG('n','g','m',' '), HB_TAG('C','P','P',' ')}, /* Ngatik Men's Creole -> Creoles */ {HB_TAG('n','g','o',' '), HB_TAG('S','X','T',' ')}, /* Ngoni (retired code) -> Sutu */ - {HB_TAG('n','g','r',' '), HB_TAG_NONE }, /* Engdewu != Nagari */ {HB_TAG('n','g','u',' '), HB_TAG('N','A','H',' ')}, /* Guerrero Nahuatl -> Nahuatl */ {HB_TAG('n','h','c',' '), HB_TAG('N','A','H',' ')}, /* Tabasco Nahuatl -> Nahuatl */ {HB_TAG('n','h','d',' '), HB_TAG('G','U','A',' ')}, /* Chiripá -> Guarani */ @@ -1137,12 +903,9 @@ static const LangTag ot_languages3[] = { {HB_TAG('n','h','y',' '), HB_TAG('N','A','H',' ')}, /* Northern Oaxaca Nahuatl -> Nahuatl */ {HB_TAG('n','h','z',' '), HB_TAG('N','A','H',' ')}, /* Santa María La Alta Nahuatl -> Nahuatl */ {HB_TAG('n','i','q',' '), HB_TAG('K','A','L',' ')}, /* Nandi -> Kalenjin */ - {HB_TAG('n','i','s',' '), HB_TAG_NONE }, /* Nimi != Nisi */ -/*{HB_TAG('n','i','u',' '), HB_TAG('N','I','U',' ')},*/ /* Niuean */ {HB_TAG('n','i','v',' '), HB_TAG('G','I','L',' ')}, /* Gilyak */ {HB_TAG('n','j','t',' '), HB_TAG('C','P','P',' ')}, /* Ndyuka-Trio Pidgin -> Creoles */ {HB_TAG('n','j','z',' '), HB_TAG('N','I','S',' ')}, /* Nyishi -> Nisi */ - {HB_TAG('n','k','o',' '), HB_TAG_NONE }, /* Nkonya != N’Ko */ {HB_TAG('n','k','x',' '), HB_TAG('I','J','O',' ')}, /* Nkoroo -> Ijo */ {HB_TAG('n','l','a',' '), HB_TAG('B','M','L',' ')}, /* Ngombale -> Bamileke */ {HB_TAG('n','l','e',' '), HB_TAG('L','U','H',' ')}, /* East Nyala -> Luyia */ @@ -1151,329 +914,147 @@ static const LangTag ot_languages3[] = { {HB_TAG('n','n','h',' '), HB_TAG('B','M','L',' ')}, /* Ngiemboon -> Bamileke */ {HB_TAG('n','n','z',' '), HB_TAG('B','M','L',' ')}, /* Nda'nda' -> Bamileke */ {HB_TAG('n','o','d',' '), HB_TAG('N','T','A',' ')}, /* Northern Thai -> Northern Tai */ -/*{HB_TAG('n','o','e',' '), HB_TAG('N','O','E',' ')},*/ /* Nimadi */ -/*{HB_TAG('n','o','g',' '), HB_TAG('N','O','G',' ')},*/ /* Nogai */ -/*{HB_TAG('n','o','p',' '), HB_TAG('N','O','P',' ')},*/ /* Numanggang */ -/*{HB_TAG('n','o','v',' '), HB_TAG('N','O','V',' ')},*/ /* Novial */ {HB_TAG('n','p','i',' '), HB_TAG('N','E','P',' ')}, /* Nepali */ {HB_TAG('n','p','l',' '), HB_TAG('N','A','H',' ')}, /* Southeastern Puebla Nahuatl -> Nahuatl */ {HB_TAG('n','q','o',' '), HB_TAG('N','K','O',' ')}, /* N’Ko */ {HB_TAG('n','s','k',' '), HB_TAG('N','A','S',' ')}, /* Naskapi */ - {HB_TAG('n','s','m',' '), HB_TAG_NONE }, /* Sumi Naga != Northern Sami */ -/*{HB_TAG('n','s','o',' '), HB_TAG('N','S','O',' ')},*/ /* Northern Sotho */ {HB_TAG('n','s','u',' '), HB_TAG('N','A','H',' ')}, /* Sierra Negra Nahuatl -> Nahuatl */ - {HB_TAG('n','t','o',' '), HB_TAG_NONE }, /* Ntomba != Esperanto */ {HB_TAG('n','u','e',' '), HB_TAG('B','A','D','0')}, /* Ngundu -> Banda */ -/*{HB_TAG('n','u','k',' '), HB_TAG('N','U','K',' ')},*/ /* Nuu-chah-nulth */ {HB_TAG('n','u','u',' '), HB_TAG('B','A','D','0')}, /* Ngbundu -> Banda */ {HB_TAG('n','u','z',' '), HB_TAG('N','A','H',' ')}, /* Tlamacazapa Nahuatl -> Nahuatl */ {HB_TAG('n','w','e',' '), HB_TAG('B','M','L',' ')}, /* Ngwe -> Bamileke */ {HB_TAG('n','y','d',' '), HB_TAG('L','U','H',' ')}, /* Nyore -> Luyia */ -/*{HB_TAG('n','y','m',' '), HB_TAG('N','Y','M',' ')},*/ /* Nyamwezi */ {HB_TAG('n','y','n',' '), HB_TAG('N','K','L',' ')}, /* Nyankole */ -/*{HB_TAG('n','z','a',' '), HB_TAG('N','Z','A',' ')},*/ /* Tigon Mbembe -> Mbembe Tigon */ -/*{HB_TAG('o','j','b',' '), HB_TAG('O','J','B',' ')},*/ /* Northwestern Ojibwa -> Ojibway */ {HB_TAG('o','j','c',' '), HB_TAG('O','J','B',' ')}, /* Central Ojibwa -> Ojibway */ {HB_TAG('o','j','g',' '), HB_TAG('O','J','B',' ')}, /* Eastern Ojibwa -> Ojibway */ - {HB_TAG('o','j','s',' '), HB_TAG('O','C','R',' ')}, /* Severn Ojibwa -> Oji-Cree */ - {HB_TAG('o','j','s',' '), HB_TAG('O','J','B',' ')}, /* Severn Ojibwa -> Ojibway */ {HB_TAG('o','j','w',' '), HB_TAG('O','J','B',' ')}, /* Western Ojibwa -> Ojibway */ {HB_TAG('o','k','d',' '), HB_TAG('I','J','O',' ')}, /* Okodia -> Ijo */ {HB_TAG('o','k','i',' '), HB_TAG('K','A','L',' ')}, /* Okiek -> Kalenjin */ {HB_TAG('o','k','m',' '), HB_TAG('K','O','H',' ')}, /* Middle Korean (10th-16th cent.) -> Korean Old Hangul */ {HB_TAG('o','k','r',' '), HB_TAG('I','J','O',' ')}, /* Kirike -> Ijo */ -/*{HB_TAG('o','n','e',' '), HB_TAG('O','N','E',' ')},*/ /* Oneida */ -/*{HB_TAG('o','n','o',' '), HB_TAG('O','N','O',' ')},*/ /* Onondaga */ {HB_TAG('o','n','x',' '), HB_TAG('C','P','P',' ')}, /* Onin Based Pidgin -> Creoles */ {HB_TAG('o','o','r',' '), HB_TAG('C','P','P',' ')}, /* Oorlams -> Creoles */ {HB_TAG('o','r','c',' '), HB_TAG('O','R','O',' ')}, /* Orma -> Oromo */ {HB_TAG('o','r','n',' '), HB_TAG('M','L','Y',' ')}, /* Orang Kanaq -> Malay */ - {HB_TAG('o','r','o',' '), HB_TAG_NONE }, /* Orokolo != Oromo */ {HB_TAG('o','r','r',' '), HB_TAG('I','J','O',' ')}, /* Oruma -> Ijo */ {HB_TAG('o','r','s',' '), HB_TAG('M','L','Y',' ')}, /* Orang Seletar -> Malay */ {HB_TAG('o','r','y',' '), HB_TAG('O','R','I',' ')}, /* Odia */ {HB_TAG('o','t','w',' '), HB_TAG('O','J','B',' ')}, /* Ottawa -> Ojibway */ {HB_TAG('o','u','a',' '), HB_TAG('B','B','R',' ')}, /* Tagargrent -> Berber */ - {HB_TAG('p','a','a',' '), HB_TAG_NONE }, /* Papuan [collection] != Palestinian Aramaic */ -/*{HB_TAG('p','a','g',' '), HB_TAG('P','A','G',' ')},*/ /* Pangasinan */ - {HB_TAG('p','a','l',' '), HB_TAG_NONE }, /* Pahlavi != Pali */ -/*{HB_TAG('p','a','m',' '), HB_TAG('P','A','M',' ')},*/ /* Pampanga -> Pampangan */ - {HB_TAG('p','a','p',' '), HB_TAG('P','A','P','0')}, /* Papiamento -> Papiamentu */ - {HB_TAG('p','a','p',' '), HB_TAG('C','P','P',' ')}, /* Papiamento -> Creoles */ - {HB_TAG('p','a','s',' '), HB_TAG_NONE }, /* Papasena != Pashto */ -/*{HB_TAG('p','a','u',' '), HB_TAG('P','A','U',' ')},*/ /* Palauan */ {HB_TAG('p','b','t',' '), HB_TAG('P','A','S',' ')}, /* Southern Pashto -> Pashto */ {HB_TAG('p','b','u',' '), HB_TAG('P','A','S',' ')}, /* Northern Pashto -> Pashto */ -/*{HB_TAG('p','c','c',' '), HB_TAG('P','C','C',' ')},*/ /* Bouyei */ -/*{HB_TAG('p','c','d',' '), HB_TAG('P','C','D',' ')},*/ /* Picard */ {HB_TAG('p','c','e',' '), HB_TAG('P','L','G',' ')}, /* Ruching Palaung -> Palaung */ {HB_TAG('p','c','k',' '), HB_TAG('Q','I','N',' ')}, /* Paite Chin -> Chin */ {HB_TAG('p','c','m',' '), HB_TAG('C','P','P',' ')}, /* Nigerian Pidgin -> Creoles */ -/*{HB_TAG('p','d','c',' '), HB_TAG('P','D','C',' ')},*/ /* Pennsylvania German */ {HB_TAG('p','d','u',' '), HB_TAG('K','R','N',' ')}, /* Kayan -> Karen */ {HB_TAG('p','e','a',' '), HB_TAG('C','P','P',' ')}, /* Peranakan Indonesian -> Creoles */ {HB_TAG('p','e','l',' '), HB_TAG('M','L','Y',' ')}, /* Pekal -> Malay */ {HB_TAG('p','e','s',' '), HB_TAG('F','A','R',' ')}, /* Iranian Persian -> Persian */ {HB_TAG('p','e','y',' '), HB_TAG('C','P','P',' ')}, /* Petjo -> Creoles */ - {HB_TAG('p','g','a',' '), HB_TAG('A','R','A',' ')}, /* Sudanese Creole Arabic -> Arabic */ - {HB_TAG('p','g','a',' '), HB_TAG('C','P','P',' ')}, /* Sudanese Creole Arabic -> Creoles */ -/*{HB_TAG('p','h','k',' '), HB_TAG('P','H','K',' ')},*/ /* Phake */ - {HB_TAG('p','i','h',' '), HB_TAG('P','I','H',' ')}, /* Pitcairn-Norfolk -> Norfolk */ - {HB_TAG('p','i','h',' '), HB_TAG('C','P','P',' ')}, /* Pitcairn-Norfolk -> Creoles */ - {HB_TAG('p','i','l',' '), HB_TAG_NONE }, /* Yom != Filipino */ {HB_TAG('p','i','s',' '), HB_TAG('C','P','P',' ')}, /* Pijin -> Creoles */ {HB_TAG('p','k','h',' '), HB_TAG('Q','I','N',' ')}, /* Pankhu -> Chin */ {HB_TAG('p','k','o',' '), HB_TAG('K','A','L',' ')}, /* Pökoot -> Kalenjin */ {HB_TAG('p','l','g',' '), HB_TAG('P','L','G','0')}, /* Pilagá */ - {HB_TAG('p','l','k',' '), HB_TAG_NONE }, /* Kohistani Shina != Polish */ {HB_TAG('p','l','l',' '), HB_TAG('P','L','G',' ')}, /* Shwe Palaung -> Palaung */ {HB_TAG('p','l','n',' '), HB_TAG('C','P','P',' ')}, /* Palenquero -> Creoles */ {HB_TAG('p','l','p',' '), HB_TAG('P','A','P',' ')}, /* Palpa (retired code) */ {HB_TAG('p','l','t',' '), HB_TAG('M','L','G',' ')}, /* Plateau Malagasy -> Malagasy */ {HB_TAG('p','m','l',' '), HB_TAG('C','P','P',' ')}, /* Lingua Franca -> Creoles */ -/*{HB_TAG('p','m','s',' '), HB_TAG('P','M','S',' ')},*/ /* Piemontese */ {HB_TAG('p','m','y',' '), HB_TAG('C','P','P',' ')}, /* Papuan Malay -> Creoles */ -/*{HB_TAG('p','n','b',' '), HB_TAG('P','N','B',' ')},*/ /* Western Panjabi */ {HB_TAG('p','o','c',' '), HB_TAG('M','Y','N',' ')}, /* Poqomam -> Mayan */ - {HB_TAG('p','o','h',' '), HB_TAG('P','O','H',' ')}, /* Poqomchi' -> Pocomchi */ - {HB_TAG('p','o','h',' '), HB_TAG('M','Y','N',' ')}, /* Poqomchi' -> Mayan */ -/*{HB_TAG('p','o','n',' '), HB_TAG('P','O','N',' ')},*/ /* Pohnpeian */ {HB_TAG('p','o','v',' '), HB_TAG('C','P','P',' ')}, /* Upper Guinea Crioulo -> Creoles */ {HB_TAG('p','p','a',' '), HB_TAG('B','A','G',' ')}, /* Pao (retired code) -> Baghelkhandi */ {HB_TAG('p','r','e',' '), HB_TAG('C','P','P',' ')}, /* Principense -> Creoles */ -/*{HB_TAG('p','r','o',' '), HB_TAG('P','R','O',' ')},*/ /* Old Provençal (to 1500) -> Provençal / Old Provençal */ {HB_TAG('p','r','p',' '), HB_TAG('G','U','J',' ')}, /* Parsi (retired code) -> Gujarati */ - {HB_TAG('p','r','s',' '), HB_TAG('D','R','I',' ')}, /* Dari */ - {HB_TAG('p','r','s',' '), HB_TAG('F','A','R',' ')}, /* Dari -> Persian */ {HB_TAG('p','s','e',' '), HB_TAG('M','L','Y',' ')}, /* Central Malay -> Malay */ {HB_TAG('p','s','t',' '), HB_TAG('P','A','S',' ')}, /* Central Pashto -> Pashto */ {HB_TAG('p','u','b',' '), HB_TAG('Q','I','N',' ')}, /* Purum -> Chin */ {HB_TAG('p','u','z',' '), HB_TAG('Q','I','N',' ')}, /* Purum Naga (retired code) -> Chin */ - {HB_TAG('p','w','o',' '), HB_TAG('P','W','O',' ')}, /* Pwo Western Karen -> Western Pwo Karen */ - {HB_TAG('p','w','o',' '), HB_TAG('K','R','N',' ')}, /* Pwo Western Karen -> Karen */ {HB_TAG('p','w','w',' '), HB_TAG('K','R','N',' ')}, /* Pwo Northern Karen -> Karen */ - {HB_TAG('q','u','b',' '), HB_TAG('Q','W','H',' ')}, /* Huallaga Huánuco Quechua -> Quechua (Peru) */ - {HB_TAG('q','u','b',' '), HB_TAG('Q','U','Z',' ')}, /* Huallaga Huánuco Quechua -> Quechua */ - {HB_TAG('q','u','c',' '), HB_TAG('Q','U','C',' ')}, /* K’iche’ */ - {HB_TAG('q','u','c',' '), HB_TAG('M','Y','N',' ')}, /* K'iche' -> Mayan */ - {HB_TAG('q','u','d',' '), HB_TAG('Q','V','I',' ')}, /* Calderón Highland Quichua -> Quechua (Ecuador) */ - {HB_TAG('q','u','d',' '), HB_TAG('Q','U','Z',' ')}, /* Calderón Highland Quichua -> Quechua */ {HB_TAG('q','u','f',' '), HB_TAG('Q','U','Z',' ')}, /* Lambayeque Quechua -> Quechua */ - {HB_TAG('q','u','g',' '), HB_TAG('Q','V','I',' ')}, /* Chimborazo Highland Quichua -> Quechua (Ecuador) */ - {HB_TAG('q','u','g',' '), HB_TAG('Q','U','Z',' ')}, /* Chimborazo Highland Quichua -> Quechua */ - {HB_TAG('q','u','h',' '), HB_TAG('Q','U','H',' ')}, /* South Bolivian Quechua -> Quechua (Bolivia) */ - {HB_TAG('q','u','h',' '), HB_TAG('Q','U','Z',' ')}, /* South Bolivian Quechua -> Quechua */ {HB_TAG('q','u','k',' '), HB_TAG('Q','U','Z',' ')}, /* Chachapoyas Quechua -> Quechua */ - {HB_TAG('q','u','l',' '), HB_TAG('Q','U','H',' ')}, /* North Bolivian Quechua -> Quechua (Bolivia) */ - {HB_TAG('q','u','l',' '), HB_TAG('Q','U','Z',' ')}, /* North Bolivian Quechua -> Quechua */ {HB_TAG('q','u','m',' '), HB_TAG('M','Y','N',' ')}, /* Sipacapense -> Mayan */ - {HB_TAG('q','u','p',' '), HB_TAG('Q','V','I',' ')}, /* Southern Pastaza Quechua -> Quechua (Ecuador) */ - {HB_TAG('q','u','p',' '), HB_TAG('Q','U','Z',' ')}, /* Southern Pastaza Quechua -> Quechua */ - {HB_TAG('q','u','r',' '), HB_TAG('Q','W','H',' ')}, /* Yanahuanca Pasco Quechua -> Quechua (Peru) */ - {HB_TAG('q','u','r',' '), HB_TAG('Q','U','Z',' ')}, /* Yanahuanca Pasco Quechua -> Quechua */ - {HB_TAG('q','u','s',' '), HB_TAG('Q','U','H',' ')}, /* Santiago del Estero Quichua -> Quechua (Bolivia) */ - {HB_TAG('q','u','s',' '), HB_TAG('Q','U','Z',' ')}, /* Santiago del Estero Quichua -> Quechua */ {HB_TAG('q','u','v',' '), HB_TAG('M','Y','N',' ')}, /* Sacapulteco -> Mayan */ - {HB_TAG('q','u','w',' '), HB_TAG('Q','V','I',' ')}, /* Tena Lowland Quichua -> Quechua (Ecuador) */ - {HB_TAG('q','u','w',' '), HB_TAG('Q','U','Z',' ')}, /* Tena Lowland Quichua -> Quechua */ - {HB_TAG('q','u','x',' '), HB_TAG('Q','W','H',' ')}, /* Yauyos Quechua -> Quechua (Peru) */ - {HB_TAG('q','u','x',' '), HB_TAG('Q','U','Z',' ')}, /* Yauyos Quechua -> Quechua */ {HB_TAG('q','u','y',' '), HB_TAG('Q','U','Z',' ')}, /* Ayacucho Quechua -> Quechua */ -/*{HB_TAG('q','u','z',' '), HB_TAG('Q','U','Z',' ')},*/ /* Cusco Quechua -> Quechua */ - {HB_TAG('q','v','a',' '), HB_TAG('Q','W','H',' ')}, /* Ambo-Pasco Quechua -> Quechua (Peru) */ - {HB_TAG('q','v','a',' '), HB_TAG('Q','U','Z',' ')}, /* Ambo-Pasco Quechua -> Quechua */ {HB_TAG('q','v','c',' '), HB_TAG('Q','U','Z',' ')}, /* Cajamarca Quechua -> Quechua */ {HB_TAG('q','v','e',' '), HB_TAG('Q','U','Z',' ')}, /* Eastern Apurímac Quechua -> Quechua */ - {HB_TAG('q','v','h',' '), HB_TAG('Q','W','H',' ')}, /* Huamalíes-Dos de Mayo Huánuco Quechua -> Quechua (Peru) */ - {HB_TAG('q','v','h',' '), HB_TAG('Q','U','Z',' ')}, /* Huamalíes-Dos de Mayo Huánuco Quechua -> Quechua */ - {HB_TAG('q','v','i',' '), HB_TAG('Q','V','I',' ')}, /* Imbabura Highland Quichua -> Quechua (Ecuador) */ - {HB_TAG('q','v','i',' '), HB_TAG('Q','U','Z',' ')}, /* Imbabura Highland Quichua -> Quechua */ - {HB_TAG('q','v','j',' '), HB_TAG('Q','V','I',' ')}, /* Loja Highland Quichua -> Quechua (Ecuador) */ - {HB_TAG('q','v','j',' '), HB_TAG('Q','U','Z',' ')}, /* Loja Highland Quichua -> Quechua */ - {HB_TAG('q','v','l',' '), HB_TAG('Q','W','H',' ')}, /* Cajatambo North Lima Quechua -> Quechua (Peru) */ - {HB_TAG('q','v','l',' '), HB_TAG('Q','U','Z',' ')}, /* Cajatambo North Lima Quechua -> Quechua */ - {HB_TAG('q','v','m',' '), HB_TAG('Q','W','H',' ')}, /* Margos-Yarowilca-Lauricocha Quechua -> Quechua (Peru) */ - {HB_TAG('q','v','m',' '), HB_TAG('Q','U','Z',' ')}, /* Margos-Yarowilca-Lauricocha Quechua -> Quechua */ - {HB_TAG('q','v','n',' '), HB_TAG('Q','W','H',' ')}, /* North Junín Quechua -> Quechua (Peru) */ - {HB_TAG('q','v','n',' '), HB_TAG('Q','U','Z',' ')}, /* North Junín Quechua -> Quechua */ - {HB_TAG('q','v','o',' '), HB_TAG('Q','V','I',' ')}, /* Napo Lowland Quechua -> Quechua (Ecuador) */ - {HB_TAG('q','v','o',' '), HB_TAG('Q','U','Z',' ')}, /* Napo Lowland Quechua -> Quechua */ - {HB_TAG('q','v','p',' '), HB_TAG('Q','W','H',' ')}, /* Pacaraos Quechua -> Quechua (Peru) */ - {HB_TAG('q','v','p',' '), HB_TAG('Q','U','Z',' ')}, /* Pacaraos Quechua -> Quechua */ {HB_TAG('q','v','s',' '), HB_TAG('Q','U','Z',' ')}, /* San Martín Quechua -> Quechua */ - {HB_TAG('q','v','w',' '), HB_TAG('Q','W','H',' ')}, /* Huaylla Wanca Quechua -> Quechua (Peru) */ - {HB_TAG('q','v','w',' '), HB_TAG('Q','U','Z',' ')}, /* Huaylla Wanca Quechua -> Quechua */ - {HB_TAG('q','v','z',' '), HB_TAG('Q','V','I',' ')}, /* Northern Pastaza Quichua -> Quechua (Ecuador) */ - {HB_TAG('q','v','z',' '), HB_TAG('Q','U','Z',' ')}, /* Northern Pastaza Quichua -> Quechua */ - {HB_TAG('q','w','a',' '), HB_TAG('Q','W','H',' ')}, /* Corongo Ancash Quechua -> Quechua (Peru) */ - {HB_TAG('q','w','a',' '), HB_TAG('Q','U','Z',' ')}, /* Corongo Ancash Quechua -> Quechua */ {HB_TAG('q','w','c',' '), HB_TAG('Q','U','Z',' ')}, /* Classical Quechua -> Quechua */ - {HB_TAG('q','w','h',' '), HB_TAG('Q','W','H',' ')}, /* Huaylas Ancash Quechua -> Quechua (Peru) */ - {HB_TAG('q','w','h',' '), HB_TAG('Q','U','Z',' ')}, /* Huaylas Ancash Quechua -> Quechua */ - {HB_TAG('q','w','s',' '), HB_TAG('Q','W','H',' ')}, /* Sihuas Ancash Quechua -> Quechua (Peru) */ - {HB_TAG('q','w','s',' '), HB_TAG('Q','U','Z',' ')}, /* Sihuas Ancash Quechua -> Quechua */ {HB_TAG('q','w','t',' '), HB_TAG('A','T','H',' ')}, /* Kwalhioqua-Tlatskanai -> Athapaskan */ - {HB_TAG('q','x','a',' '), HB_TAG('Q','W','H',' ')}, /* Chiquián Ancash Quechua -> Quechua (Peru) */ - {HB_TAG('q','x','a',' '), HB_TAG('Q','U','Z',' ')}, /* Chiquián Ancash Quechua -> Quechua */ - {HB_TAG('q','x','c',' '), HB_TAG('Q','W','H',' ')}, /* Chincha Quechua -> Quechua (Peru) */ - {HB_TAG('q','x','c',' '), HB_TAG('Q','U','Z',' ')}, /* Chincha Quechua -> Quechua */ - {HB_TAG('q','x','h',' '), HB_TAG('Q','W','H',' ')}, /* Panao Huánuco Quechua -> Quechua (Peru) */ - {HB_TAG('q','x','h',' '), HB_TAG('Q','U','Z',' ')}, /* Panao Huánuco Quechua -> Quechua */ - {HB_TAG('q','x','l',' '), HB_TAG('Q','V','I',' ')}, /* Salasaca Highland Quichua -> Quechua (Ecuador) */ - {HB_TAG('q','x','l',' '), HB_TAG('Q','U','Z',' ')}, /* Salasaca Highland Quichua -> Quechua */ - {HB_TAG('q','x','n',' '), HB_TAG('Q','W','H',' ')}, /* Northern Conchucos Ancash Quechua -> Quechua (Peru) */ - {HB_TAG('q','x','n',' '), HB_TAG('Q','U','Z',' ')}, /* Northern Conchucos Ancash Quechua -> Quechua */ - {HB_TAG('q','x','o',' '), HB_TAG('Q','W','H',' ')}, /* Southern Conchucos Ancash Quechua -> Quechua (Peru) */ - {HB_TAG('q','x','o',' '), HB_TAG('Q','U','Z',' ')}, /* Southern Conchucos Ancash Quechua -> Quechua */ {HB_TAG('q','x','p',' '), HB_TAG('Q','U','Z',' ')}, /* Puno Quechua -> Quechua */ - {HB_TAG('q','x','r',' '), HB_TAG('Q','V','I',' ')}, /* Cañar Highland Quichua -> Quechua (Ecuador) */ - {HB_TAG('q','x','r',' '), HB_TAG('Q','U','Z',' ')}, /* Cañar Highland Quichua -> Quechua */ - {HB_TAG('q','x','t',' '), HB_TAG('Q','W','H',' ')}, /* Santa Ana de Tusi Pasco Quechua -> Quechua (Peru) */ - {HB_TAG('q','x','t',' '), HB_TAG('Q','U','Z',' ')}, /* Santa Ana de Tusi Pasco Quechua -> Quechua */ {HB_TAG('q','x','u',' '), HB_TAG('Q','U','Z',' ')}, /* Arequipa-La Unión Quechua -> Quechua */ - {HB_TAG('q','x','w',' '), HB_TAG('Q','W','H',' ')}, /* Jauja Wanca Quechua -> Quechua (Peru) */ - {HB_TAG('q','x','w',' '), HB_TAG('Q','U','Z',' ')}, /* Jauja Wanca Quechua -> Quechua */ {HB_TAG('r','a','g',' '), HB_TAG('L','U','H',' ')}, /* Logooli -> Luyia */ -/*{HB_TAG('r','a','j',' '), HB_TAG('R','A','J',' ')},*/ /* Rajasthani [macrolanguage] */ {HB_TAG('r','a','l',' '), HB_TAG('Q','I','N',' ')}, /* Ralte -> Chin */ -/*{HB_TAG('r','a','r',' '), HB_TAG('R','A','R',' ')},*/ /* Rarotongan */ {HB_TAG('r','b','b',' '), HB_TAG('P','L','G',' ')}, /* Rumai Palaung -> Palaung */ {HB_TAG('r','b','l',' '), HB_TAG('B','I','K',' ')}, /* Miraya Bikol -> Bikol */ {HB_TAG('r','c','f',' '), HB_TAG('C','P','P',' ')}, /* Réunion Creole French -> Creoles */ -/*{HB_TAG('r','e','j',' '), HB_TAG('R','E','J',' ')},*/ /* Rejang */ -/*{HB_TAG('r','h','g',' '), HB_TAG('R','H','G',' ')},*/ /* Rohingya */ -/*{HB_TAG('r','i','a',' '), HB_TAG('R','I','A',' ')},*/ /* Riang (India) */ - {HB_TAG('r','i','f',' '), HB_TAG('R','I','F',' ')}, /* Tarifit */ - {HB_TAG('r','i','f',' '), HB_TAG('B','B','R',' ')}, /* Tarifit -> Berber */ -/*{HB_TAG('r','i','t',' '), HB_TAG('R','I','T',' ')},*/ /* Ritharrngu -> Ritarungo */ {HB_TAG('r','k','i',' '), HB_TAG('A','R','K',' ')}, /* Rakhine */ -/*{HB_TAG('r','k','w',' '), HB_TAG('R','K','W',' ')},*/ /* Arakwal */ {HB_TAG('r','m','c',' '), HB_TAG('R','O','Y',' ')}, /* Carpathian Romani -> Romany */ {HB_TAG('r','m','f',' '), HB_TAG('R','O','Y',' ')}, /* Kalo Finnish Romani -> Romany */ {HB_TAG('r','m','l',' '), HB_TAG('R','O','Y',' ')}, /* Baltic Romani -> Romany */ {HB_TAG('r','m','n',' '), HB_TAG('R','O','Y',' ')}, /* Balkan Romani -> Romany */ {HB_TAG('r','m','o',' '), HB_TAG('R','O','Y',' ')}, /* Sinte Romani -> Romany */ - {HB_TAG('r','m','s',' '), HB_TAG_NONE }, /* Romanian Sign Language != Romansh */ {HB_TAG('r','m','w',' '), HB_TAG('R','O','Y',' ')}, /* Welsh Romani -> Romany */ - {HB_TAG('r','m','y',' '), HB_TAG('R','M','Y',' ')}, /* Vlax Romani */ - {HB_TAG('r','m','y',' '), HB_TAG('R','O','Y',' ')}, /* Vlax Romani -> Romany */ {HB_TAG('r','m','z',' '), HB_TAG('A','R','K',' ')}, /* Marma -> Rakhine */ {HB_TAG('r','o','m',' '), HB_TAG('R','O','Y',' ')}, /* Romany [macrolanguage] */ {HB_TAG('r','o','p',' '), HB_TAG('C','P','P',' ')}, /* Kriol -> Creoles */ {HB_TAG('r','t','c',' '), HB_TAG('Q','I','N',' ')}, /* Rungtu Chin -> Chin */ -/*{HB_TAG('r','t','m',' '), HB_TAG('R','T','M',' ')},*/ /* Rotuman */ {HB_TAG('r','u','e',' '), HB_TAG('R','S','Y',' ')}, /* Rusyn */ -/*{HB_TAG('r','u','p',' '), HB_TAG('R','U','P',' ')},*/ /* Aromanian */ {HB_TAG('r','w','r',' '), HB_TAG('M','A','W',' ')}, /* Marwari (India) */ - {HB_TAG('s','a','d',' '), HB_TAG_NONE }, /* Sandawe != Sadri */ {HB_TAG('s','a','h',' '), HB_TAG('Y','A','K',' ')}, /* Yakut -> Sakha */ {HB_TAG('s','a','m',' '), HB_TAG('P','A','A',' ')}, /* Samaritan Aramaic -> Palestinian Aramaic */ -/*{HB_TAG('s','a','s',' '), HB_TAG('S','A','S',' ')},*/ /* Sasak */ -/*{HB_TAG('s','a','t',' '), HB_TAG('S','A','T',' ')},*/ /* Santali */ - {HB_TAG('s','a','y',' '), HB_TAG_NONE }, /* Saya != Sayisi */ {HB_TAG('s','c','f',' '), HB_TAG('C','P','P',' ')}, /* San Miguel Creole French -> Creoles */ {HB_TAG('s','c','h',' '), HB_TAG('Q','I','N',' ')}, /* Sakachep -> Chin */ {HB_TAG('s','c','i',' '), HB_TAG('C','P','P',' ')}, /* Sri Lankan Creole Malay -> Creoles */ {HB_TAG('s','c','k',' '), HB_TAG('S','A','D',' ')}, /* Sadri */ -/*{HB_TAG('s','c','n',' '), HB_TAG('S','C','N',' ')},*/ /* Sicilian */ -/*{HB_TAG('s','c','o',' '), HB_TAG('S','C','O',' ')},*/ /* Scots */ - {HB_TAG('s','c','s',' '), HB_TAG('S','C','S',' ')}, /* North Slavey */ - {HB_TAG('s','c','s',' '), HB_TAG('S','L','A',' ')}, /* North Slavey -> Slavey */ - {HB_TAG('s','c','s',' '), HB_TAG('A','T','H',' ')}, /* North Slavey -> Athapaskan */ {HB_TAG('s','d','c',' '), HB_TAG('S','R','D',' ')}, /* Sassarese Sardinian -> Sardinian */ {HB_TAG('s','d','h',' '), HB_TAG('K','U','R',' ')}, /* Southern Kurdish -> Kurdish */ {HB_TAG('s','d','n',' '), HB_TAG('S','R','D',' ')}, /* Gallurese Sardinian -> Sardinian */ {HB_TAG('s','d','s',' '), HB_TAG('B','B','R',' ')}, /* Sened -> Berber */ -/*{HB_TAG('s','e','e',' '), HB_TAG('S','E','E',' ')},*/ /* Seneca */ {HB_TAG('s','e','h',' '), HB_TAG('S','N','A',' ')}, /* Sena */ {HB_TAG('s','e','k',' '), HB_TAG('A','T','H',' ')}, /* Sekani -> Athapaskan */ -/*{HB_TAG('s','e','l',' '), HB_TAG('S','E','L',' ')},*/ /* Selkup */ {HB_TAG('s','e','z',' '), HB_TAG('Q','I','N',' ')}, /* Senthang Chin -> Chin */ - {HB_TAG('s','f','m',' '), HB_TAG('S','F','M',' ')}, /* Small Flowery Miao */ - {HB_TAG('s','f','m',' '), HB_TAG('H','M','N',' ')}, /* Small Flowery Miao -> Hmong */ -/*{HB_TAG('s','g','a',' '), HB_TAG('S','G','A',' ')},*/ /* Old Irish (to 900) */ {HB_TAG('s','g','c',' '), HB_TAG('K','A','L',' ')}, /* Kipsigis -> Kalenjin */ - {HB_TAG('s','g','o',' '), HB_TAG_NONE }, /* Songa (retired code) != Sango */ -/*{HB_TAG('s','g','s',' '), HB_TAG('S','G','S',' ')},*/ /* Samogitian */ {HB_TAG('s','g','w',' '), HB_TAG('C','H','G',' ')}, /* Sebat Bet Gurage -> Chaha Gurage */ - {HB_TAG('s','h','i',' '), HB_TAG('S','H','I',' ')}, /* Tachelhit */ - {HB_TAG('s','h','i',' '), HB_TAG('B','B','R',' ')}, /* Tachelhit -> Berber */ {HB_TAG('s','h','l',' '), HB_TAG('Q','I','N',' ')}, /* Shendu -> Chin */ -/*{HB_TAG('s','h','n',' '), HB_TAG('S','H','N',' ')},*/ /* Shan */ {HB_TAG('s','h','u',' '), HB_TAG('A','R','A',' ')}, /* Chadian Arabic -> Arabic */ {HB_TAG('s','h','y',' '), HB_TAG('B','B','R',' ')}, /* Tachawit -> Berber */ - {HB_TAG('s','i','b',' '), HB_TAG_NONE }, /* Sebop != Sibe */ -/*{HB_TAG('s','i','d',' '), HB_TAG('S','I','D',' ')},*/ /* Sidamo */ - {HB_TAG('s','i','g',' '), HB_TAG_NONE }, /* Paasaal != Silte Gurage */ {HB_TAG('s','i','z',' '), HB_TAG('B','B','R',' ')}, /* Siwi -> Berber */ -/*{HB_TAG('s','j','a',' '), HB_TAG('S','J','A',' ')},*/ /* Epena */ {HB_TAG('s','j','c',' '), HB_TAG('Z','H','S',' ')}, /* Shaojiang Chinese -> Chinese, Simplified */ {HB_TAG('s','j','d',' '), HB_TAG('K','S','M',' ')}, /* Kildin Sami */ -/*{HB_TAG('s','j','e',' '), HB_TAG('S','J','E',' ')},*/ /* Pite Sami */ {HB_TAG('s','j','o',' '), HB_TAG('S','I','B',' ')}, /* Xibe -> Sibe */ {HB_TAG('s','j','s',' '), HB_TAG('B','B','R',' ')}, /* Senhaja De Srair -> Berber */ -/*{HB_TAG('s','j','u',' '), HB_TAG('S','J','U',' ')},*/ /* Ume Sami */ {HB_TAG('s','k','g',' '), HB_TAG('M','L','G',' ')}, /* Sakalava Malagasy -> Malagasy */ {HB_TAG('s','k','r',' '), HB_TAG('S','R','K',' ')}, /* Saraiki */ - {HB_TAG('s','k','s',' '), HB_TAG_NONE }, /* Maia != Skolt Sami */ {HB_TAG('s','k','w',' '), HB_TAG('C','P','P',' ')}, /* Skepi Creole Dutch -> Creoles */ - {HB_TAG('s','k','y',' '), HB_TAG_NONE }, /* Sikaiana != Slovak */ - {HB_TAG('s','l','a',' '), HB_TAG_NONE }, /* Slavic [collection] != Slavey */ {HB_TAG('s','m','a',' '), HB_TAG('S','S','M',' ')}, /* Southern Sami */ {HB_TAG('s','m','d',' '), HB_TAG('M','B','N',' ')}, /* Sama (retired code) -> Mbundu */ {HB_TAG('s','m','j',' '), HB_TAG('L','S','M',' ')}, /* Lule Sami */ - {HB_TAG('s','m','l',' '), HB_TAG_NONE }, /* Central Sama != Somali */ {HB_TAG('s','m','n',' '), HB_TAG('I','S','M',' ')}, /* Inari Sami */ {HB_TAG('s','m','s',' '), HB_TAG('S','K','S',' ')}, /* Skolt Sami */ {HB_TAG('s','m','t',' '), HB_TAG('Q','I','N',' ')}, /* Simte -> Chin */ {HB_TAG('s','n','b',' '), HB_TAG('I','B','A',' ')}, /* Sebuyau (retired code) -> Iban */ - {HB_TAG('s','n','h',' '), HB_TAG_NONE }, /* Shinabo (retired code) != Sinhala (Sinhalese) */ -/*{HB_TAG('s','n','k',' '), HB_TAG('S','N','K',' ')},*/ /* Soninke */ - {HB_TAG('s','o','g',' '), HB_TAG_NONE }, /* Sogdian != Sodo Gurage */ -/*{HB_TAG('s','o','p',' '), HB_TAG('S','O','P',' ')},*/ /* Songe */ {HB_TAG('s','p','v',' '), HB_TAG('O','R','I',' ')}, /* Sambalpuri -> Odia */ {HB_TAG('s','p','y',' '), HB_TAG('K','A','L',' ')}, /* Sabaot -> Kalenjin */ - {HB_TAG('s','r','b',' '), HB_TAG_NONE }, /* Sora != Serbian */ {HB_TAG('s','r','c',' '), HB_TAG('S','R','D',' ')}, /* Logudorese Sardinian -> Sardinian */ - {HB_TAG('s','r','k',' '), HB_TAG_NONE }, /* Serudung Murut != Saraiki */ {HB_TAG('s','r','m',' '), HB_TAG('C','P','P',' ')}, /* Saramaccan -> Creoles */ {HB_TAG('s','r','n',' '), HB_TAG('C','P','P',' ')}, /* Sranan Tongo -> Creoles */ {HB_TAG('s','r','o',' '), HB_TAG('S','R','D',' ')}, /* Campidanese Sardinian -> Sardinian */ -/*{HB_TAG('s','r','r',' '), HB_TAG('S','R','R',' ')},*/ /* Serer */ {HB_TAG('s','r','s',' '), HB_TAG('A','T','H',' ')}, /* Sarsi -> Athapaskan */ {HB_TAG('s','s','h',' '), HB_TAG('A','R','A',' ')}, /* Shihhi Arabic -> Arabic */ - {HB_TAG('s','s','l',' '), HB_TAG_NONE }, /* Western Sisaala != South Slavey */ - {HB_TAG('s','s','m',' '), HB_TAG_NONE }, /* Semnam != Southern Sami */ {HB_TAG('s','t','a',' '), HB_TAG('C','P','P',' ')}, /* Settla -> Creoles */ -/*{HB_TAG('s','t','q',' '), HB_TAG('S','T','Q',' ')},*/ /* Saterfriesisch -> Saterland Frisian */ -/*{HB_TAG('s','t','r',' '), HB_TAG('S','T','R',' ')},*/ /* Straits Salish */ {HB_TAG('s','t','v',' '), HB_TAG('S','I','G',' ')}, /* Silt'e -> Silte Gurage */ -/*{HB_TAG('s','u','k',' '), HB_TAG('S','U','K',' ')},*/ /* Sukuma */ {HB_TAG('s','u','q',' '), HB_TAG('S','U','R',' ')}, /* Suri */ - {HB_TAG('s','u','r',' '), HB_TAG_NONE }, /* Mwaghavul != Suri */ -/*{HB_TAG('s','v','a',' '), HB_TAG('S','V','A',' ')},*/ /* Svan */ {HB_TAG('s','v','c',' '), HB_TAG('C','P','P',' ')}, /* Vincentian Creole English -> Creoles */ - {HB_TAG('s','v','e',' '), HB_TAG_NONE }, /* Serili != Swedish */ {HB_TAG('s','w','b',' '), HB_TAG('C','M','R',' ')}, /* Maore Comorian -> Comorian */ {HB_TAG('s','w','c',' '), HB_TAG('S','W','K',' ')}, /* Congo Swahili -> Swahili */ {HB_TAG('s','w','h',' '), HB_TAG('S','W','K',' ')}, /* Swahili */ - {HB_TAG('s','w','k',' '), HB_TAG_NONE }, /* Malawi Sena != Swahili */ {HB_TAG('s','w','n',' '), HB_TAG('B','B','R',' ')}, /* Sawknah -> Berber */ {HB_TAG('s','w','v',' '), HB_TAG('M','A','W',' ')}, /* Shekhawati -> Marwari */ -/*{HB_TAG('s','x','u',' '), HB_TAG('S','X','U',' ')},*/ /* Upper Saxon */ {HB_TAG('s','y','c',' '), HB_TAG('S','Y','R',' ')}, /* Classical Syriac -> Syriac */ -/*{HB_TAG('s','y','l',' '), HB_TAG('S','Y','L',' ')},*/ /* Sylheti */ -/*{HB_TAG('s','y','r',' '), HB_TAG('S','Y','R',' ')},*/ /* Syriac [macrolanguage] */ -/*{HB_TAG('s','z','l',' '), HB_TAG('S','Z','L',' ')},*/ /* Silesian */ {HB_TAG('t','a','a',' '), HB_TAG('A','T','H',' ')}, /* Lower Tanana -> Athapaskan */ -/*{HB_TAG('t','a','b',' '), HB_TAG('T','A','B',' ')},*/ /* Tabassaran -> Tabasaran */ - {HB_TAG('t','a','j',' '), HB_TAG_NONE }, /* Eastern Tamang != Tajiki */ - {HB_TAG('t','a','q',' '), HB_TAG('T','A','Q',' ')}, /* Tamasheq */ - {HB_TAG('t','a','q',' '), HB_TAG('T','M','H',' ')}, /* Tamasheq -> Tamashek */ - {HB_TAG('t','a','q',' '), HB_TAG('B','B','R',' ')}, /* Tamasheq -> Berber */ {HB_TAG('t','a','s',' '), HB_TAG('C','P','P',' ')}, /* Tay Boi -> Creoles */ {HB_TAG('t','a','u',' '), HB_TAG('A','T','H',' ')}, /* Upper Tanana -> Athapaskan */ -/*{HB_TAG('t','b','v',' '), HB_TAG('T','B','V',' ')},*/ /* Tobo */ {HB_TAG('t','c','b',' '), HB_TAG('A','T','H',' ')}, /* Tanacross -> Athapaskan */ {HB_TAG('t','c','e',' '), HB_TAG('A','T','H',' ')}, /* Southern Tutchone -> Athapaskan */ {HB_TAG('t','c','h',' '), HB_TAG('C','P','P',' ')}, /* Turks And Caicos Creole English -> Creoles */ @@ -1481,115 +1062,54 @@ static const LangTag ot_languages3[] = { {HB_TAG('t','c','s',' '), HB_TAG('C','P','P',' ')}, /* Torres Strait Creole -> Creoles */ {HB_TAG('t','c','y',' '), HB_TAG('T','U','L',' ')}, /* Tulu */ {HB_TAG('t','c','z',' '), HB_TAG('Q','I','N',' ')}, /* Thado Chin -> Chin */ -/*{HB_TAG('t','d','c',' '), HB_TAG('T','D','C',' ')},*/ /* Emberá-Tadó */ -/*{HB_TAG('t','d','d',' '), HB_TAG('T','D','D',' ')},*/ /* Tai Nüa -> Dehong Dai */ {HB_TAG('t','d','x',' '), HB_TAG('M','L','G',' ')}, /* Tandroy-Mahafaly Malagasy -> Malagasy */ {HB_TAG('t','e','c',' '), HB_TAG('K','A','L',' ')}, /* Terik -> Kalenjin */ {HB_TAG('t','e','m',' '), HB_TAG('T','M','N',' ')}, /* Timne -> Temne */ -/*{HB_TAG('t','e','t',' '), HB_TAG('T','E','T',' ')},*/ /* Tetum */ {HB_TAG('t','e','z',' '), HB_TAG('B','B','R',' ')}, /* Tetserret -> Berber */ {HB_TAG('t','f','n',' '), HB_TAG('A','T','H',' ')}, /* Tanaina -> Athapaskan */ {HB_TAG('t','g','h',' '), HB_TAG('C','P','P',' ')}, /* Tobagonian Creole English -> Creoles */ {HB_TAG('t','g','j',' '), HB_TAG('N','I','S',' ')}, /* Tagin -> Nisi */ - {HB_TAG('t','g','n',' '), HB_TAG_NONE }, /* Tandaganon != Tongan */ - {HB_TAG('t','g','r',' '), HB_TAG_NONE }, /* Tareng != Tigre */ {HB_TAG('t','g','x',' '), HB_TAG('A','T','H',' ')}, /* Tagish -> Athapaskan */ - {HB_TAG('t','g','y',' '), HB_TAG_NONE }, /* Togoyo != Tigrinya */ -/*{HB_TAG('t','h','p',' '), HB_TAG('T','H','P',' ')},*/ /* Thompson */ {HB_TAG('t','h','t',' '), HB_TAG('A','T','H',' ')}, /* Tahltan -> Athapaskan */ - {HB_TAG('t','h','v',' '), HB_TAG('T','H','V',' ')}, /* Tahaggart Tamahaq */ - {HB_TAG('t','h','v',' '), HB_TAG('T','M','H',' ')}, /* Tahaggart Tamahaq -> Tamashek */ - {HB_TAG('t','h','v',' '), HB_TAG('B','B','R',' ')}, /* Tahaggart Tamahaq -> Berber */ - {HB_TAG('t','h','z',' '), HB_TAG('T','H','Z',' ')}, /* Tayart Tamajeq */ - {HB_TAG('t','h','z',' '), HB_TAG('T','M','H',' ')}, /* Tayart Tamajeq -> Tamashek */ - {HB_TAG('t','h','z',' '), HB_TAG('B','B','R',' ')}, /* Tayart Tamajeq -> Berber */ {HB_TAG('t','i','a',' '), HB_TAG('B','B','R',' ')}, /* Tidikelt Tamazight -> Berber */ {HB_TAG('t','i','g',' '), HB_TAG('T','G','R',' ')}, /* Tigre */ -/*{HB_TAG('t','i','v',' '), HB_TAG('T','I','V',' ')},*/ /* Tiv */ -/*{HB_TAG('t','j','l',' '), HB_TAG('T','J','L',' ')},*/ /* Tai Laing */ {HB_TAG('t','j','o',' '), HB_TAG('B','B','R',' ')}, /* Temacine Tamazight -> Berber */ {HB_TAG('t','k','g',' '), HB_TAG('M','L','G',' ')}, /* Tesaka Malagasy -> Malagasy */ - {HB_TAG('t','k','m',' '), HB_TAG_NONE }, /* Takelma != Turkmen */ -/*{HB_TAG('t','l','i',' '), HB_TAG('T','L','I',' ')},*/ /* Tlingit */ -/*{HB_TAG('t','l','y',' '), HB_TAG('T','L','Y',' ')},*/ /* Talysh */ {HB_TAG('t','m','g',' '), HB_TAG('C','P','P',' ')}, /* Ternateño -> Creoles */ - {HB_TAG('t','m','h',' '), HB_TAG('T','M','H',' ')}, /* Tamashek [macrolanguage] */ - {HB_TAG('t','m','h',' '), HB_TAG('B','B','R',' ')}, /* Tamashek [macrolanguage] -> Berber */ - {HB_TAG('t','m','n',' '), HB_TAG_NONE }, /* Taman (Indonesia) != Temne */ {HB_TAG('t','m','w',' '), HB_TAG('M','L','Y',' ')}, /* Temuan -> Malay */ - {HB_TAG('t','n','a',' '), HB_TAG_NONE }, /* Tacana != Tswana */ - {HB_TAG('t','n','e',' '), HB_TAG_NONE }, /* Tinoc Kallahan (retired code) != Tundra Enets */ - {HB_TAG('t','n','f',' '), HB_TAG('D','R','I',' ')}, /* Tangshewi (retired code) -> Dari */ - {HB_TAG('t','n','f',' '), HB_TAG('F','A','R',' ')}, /* Tangshewi (retired code) -> Persian */ - {HB_TAG('t','n','g',' '), HB_TAG_NONE }, /* Tobanga != Tonga */ {HB_TAG('t','o','d',' '), HB_TAG('T','O','D','0')}, /* Toma */ {HB_TAG('t','o','i',' '), HB_TAG('T','N','G',' ')}, /* Tonga (Zambia) */ {HB_TAG('t','o','j',' '), HB_TAG('M','Y','N',' ')}, /* Tojolabal -> Mayan */ {HB_TAG('t','o','l',' '), HB_TAG('A','T','H',' ')}, /* Tolowa -> Athapaskan */ {HB_TAG('t','o','r',' '), HB_TAG('B','A','D','0')}, /* Togbo-Vara Banda -> Banda */ - {HB_TAG('t','p','i',' '), HB_TAG('T','P','I',' ')}, /* Tok Pisin */ - {HB_TAG('t','p','i',' '), HB_TAG('C','P','P',' ')}, /* Tok Pisin -> Creoles */ {HB_TAG('t','r','f',' '), HB_TAG('C','P','P',' ')}, /* Trinidadian Creole English -> Creoles */ - {HB_TAG('t','r','k',' '), HB_TAG_NONE }, /* Turkic [collection] != Turkish */ - {HB_TAG('t','r','u',' '), HB_TAG('T','U','A',' ')}, /* Turoyo -> Turoyo Aramaic */ - {HB_TAG('t','r','u',' '), HB_TAG('S','Y','R',' ')}, /* Turoyo -> Syriac */ - {HB_TAG('t','s','g',' '), HB_TAG_NONE }, /* Tausug != Tsonga */ -/*{HB_TAG('t','s','j',' '), HB_TAG('T','S','J',' ')},*/ /* Tshangla */ {HB_TAG('t','t','c',' '), HB_TAG('M','Y','N',' ')}, /* Tektiteko -> Mayan */ {HB_TAG('t','t','m',' '), HB_TAG('A','T','H',' ')}, /* Northern Tutchone -> Athapaskan */ - {HB_TAG('t','t','q',' '), HB_TAG('T','T','Q',' ')}, /* Tawallammat Tamajaq */ - {HB_TAG('t','t','q',' '), HB_TAG('T','M','H',' ')}, /* Tawallammat Tamajaq -> Tamashek */ - {HB_TAG('t','t','q',' '), HB_TAG('B','B','R',' ')}, /* Tawallammat Tamajaq -> Berber */ - {HB_TAG('t','u','a',' '), HB_TAG_NONE }, /* Wiarumus != Turoyo Aramaic */ - {HB_TAG('t','u','l',' '), HB_TAG_NONE }, /* Tula != Tulu */ -/*{HB_TAG('t','u','m',' '), HB_TAG('T','U','M',' ')},*/ /* Tumbuka */ -/*{HB_TAG('t','u','s',' '), HB_TAG('T','U','S',' ')},*/ /* Tuscarora */ {HB_TAG('t','u','u',' '), HB_TAG('A','T','H',' ')}, /* Tututni -> Athapaskan */ - {HB_TAG('t','u','v',' '), HB_TAG_NONE }, /* Turkana != Tuvin */ {HB_TAG('t','u','y',' '), HB_TAG('K','A','L',' ')}, /* Tugen -> Kalenjin */ -/*{HB_TAG('t','v','l',' '), HB_TAG('T','V','L',' ')},*/ /* Tuvalu */ {HB_TAG('t','v','y',' '), HB_TAG('C','P','P',' ')}, /* Timor Pidgin -> Creoles */ {HB_TAG('t','x','c',' '), HB_TAG('A','T','H',' ')}, /* Tsetsaut -> Athapaskan */ {HB_TAG('t','x','y',' '), HB_TAG('M','L','G',' ')}, /* Tanosy Malagasy -> Malagasy */ {HB_TAG('t','y','v',' '), HB_TAG('T','U','V',' ')}, /* Tuvinian -> Tuvin */ -/*{HB_TAG('t','y','z',' '), HB_TAG('T','Y','Z',' ')},*/ /* Tày */ {HB_TAG('t','z','h',' '), HB_TAG('M','Y','N',' ')}, /* Tzeltal -> Mayan */ {HB_TAG('t','z','j',' '), HB_TAG('M','Y','N',' ')}, /* Tz'utujil -> Mayan */ - {HB_TAG('t','z','m',' '), HB_TAG('T','Z','M',' ')}, /* Central Atlas Tamazight -> Tamazight */ - {HB_TAG('t','z','m',' '), HB_TAG('B','B','R',' ')}, /* Central Atlas Tamazight -> Berber */ - {HB_TAG('t','z','o',' '), HB_TAG('T','Z','O',' ')}, /* Tzotzil */ - {HB_TAG('t','z','o',' '), HB_TAG('M','Y','N',' ')}, /* Tzotzil -> Mayan */ {HB_TAG('u','b','l',' '), HB_TAG('B','I','K',' ')}, /* Buhi'non Bikol -> Bikol */ -/*{HB_TAG('u','d','i',' '), HB_TAG('U','D','I',' ')},*/ /* Udi */ -/*{HB_TAG('u','d','m',' '), HB_TAG('U','D','M',' ')},*/ /* Udmurt */ {HB_TAG('u','k','i',' '), HB_TAG('K','U','I',' ')}, /* Kui (India) */ {HB_TAG('u','l','n',' '), HB_TAG('C','P','P',' ')}, /* Unserdeutsch -> Creoles */ -/*{HB_TAG('u','m','b',' '), HB_TAG('U','M','B',' ')},*/ /* Umbundu */ {HB_TAG('u','n','r',' '), HB_TAG('M','U','N',' ')}, /* Mundari */ {HB_TAG('u','r','k',' '), HB_TAG('M','L','Y',' ')}, /* Urak Lawoi' -> Malay */ {HB_TAG('u','s','p',' '), HB_TAG('M','Y','N',' ')}, /* Uspanteco -> Mayan */ {HB_TAG('u','z','n',' '), HB_TAG('U','Z','B',' ')}, /* Northern Uzbek -> Uzbek */ {HB_TAG('u','z','s',' '), HB_TAG('U','Z','B',' ')}, /* Southern Uzbek -> Uzbek */ {HB_TAG('v','a','p',' '), HB_TAG('Q','I','N',' ')}, /* Vaiphei -> Chin */ -/*{HB_TAG('v','e','c',' '), HB_TAG('V','E','C',' ')},*/ /* Venetian */ {HB_TAG('v','i','c',' '), HB_TAG('C','P','P',' ')}, /* Virgin Islands Creole English -> Creoles */ - {HB_TAG('v','i','t',' '), HB_TAG_NONE }, /* Viti != Vietnamese */ {HB_TAG('v','k','k',' '), HB_TAG('M','L','Y',' ')}, /* Kaur -> Malay */ {HB_TAG('v','k','p',' '), HB_TAG('C','P','P',' ')}, /* Korlai Creole Portuguese -> Creoles */ {HB_TAG('v','k','t',' '), HB_TAG('M','L','Y',' ')}, /* Tenggarong Kutai Malay -> Malay */ {HB_TAG('v','l','s',' '), HB_TAG('F','L','E',' ')}, /* Vlaams -> Dutch (Flemish) */ {HB_TAG('v','m','w',' '), HB_TAG('M','A','K',' ')}, /* Makhuwa */ - {HB_TAG('v','r','o',' '), HB_TAG('V','R','O',' ')}, /* Võro */ - {HB_TAG('v','r','o',' '), HB_TAG('E','T','I',' ')}, /* Võro -> Estonian */ {HB_TAG('v','s','n',' '), HB_TAG('S','A','N',' ')}, /* Vedic Sanskrit -> Sanskrit */ - {HB_TAG('w','a','g',' '), HB_TAG_NONE }, /* Wa'ema != Wagdi */ -/*{HB_TAG('w','a','r',' '), HB_TAG('W','A','R',' ')},*/ /* Waray (Philippines) -> Waray-Waray */ -/*{HB_TAG('w','b','l',' '), HB_TAG('W','B','L',' ')},*/ /* Wakhi */ {HB_TAG('w','b','m',' '), HB_TAG('W','A',' ',' ')}, /* Wa */ - {HB_TAG('w','b','r',' '), HB_TAG('W','A','G',' ')}, /* Wagdi */ - {HB_TAG('w','b','r',' '), HB_TAG('R','A','J',' ')}, /* Wagdi -> Rajasthani */ -/*{HB_TAG('w','c','i',' '), HB_TAG('W','C','I',' ')},*/ /* Waci Gbe */ -/*{HB_TAG('w','d','t',' '), HB_TAG('W','D','T',' ')},*/ /* Wendat */ {HB_TAG('w','e','a',' '), HB_TAG('K','R','N',' ')}, /* Wewaw -> Karen */ {HB_TAG('w','e','s',' '), HB_TAG('C','P','P',' ')}, /* Cameroon Pidgin -> Creoles */ {HB_TAG('w','e','u',' '), HB_TAG('Q','I','N',' ')}, /* Rawngtu Chin -> Chin */ @@ -1599,62 +1119,31 @@ static const LangTag ot_languages3[] = { {HB_TAG('w','n','i',' '), HB_TAG('C','M','R',' ')}, /* Ndzwani Comorian -> Comorian */ {HB_TAG('w','r','y',' '), HB_TAG('M','A','W',' ')}, /* Merwari -> Marwari */ {HB_TAG('w','s','g',' '), HB_TAG('G','O','N',' ')}, /* Adilabad Gondi -> Gondi */ -/*{HB_TAG('w','t','m',' '), HB_TAG('W','T','M',' ')},*/ /* Mewati */ {HB_TAG('w','u','u',' '), HB_TAG('Z','H','S',' ')}, /* Wu Chinese -> Chinese, Simplified */ - {HB_TAG('w','y','a',' '), HB_TAG('W','D','T',' ')}, /* Wyandot (retired code) -> Wendat */ - {HB_TAG('w','y','a',' '), HB_TAG('W','Y','N',' ')}, /* Wyandot (retired code) */ -/*{HB_TAG('w','y','n',' '), HB_TAG('W','Y','N',' ')},*/ /* Wyandot */ - {HB_TAG('x','a','l',' '), HB_TAG('K','L','M',' ')}, /* Kalmyk */ - {HB_TAG('x','a','l',' '), HB_TAG('T','O','D',' ')}, /* Kalmyk -> Todo */ {HB_TAG('x','a','n',' '), HB_TAG('S','E','K',' ')}, /* Xamtanga -> Sekota */ - {HB_TAG('x','b','d',' '), HB_TAG_NONE }, /* Bindal != Lü */ -/*{HB_TAG('x','j','b',' '), HB_TAG('X','J','B',' ')},*/ /* Minjungbal -> Minjangbal */ -/*{HB_TAG('x','k','f',' '), HB_TAG('X','K','F',' ')},*/ /* Khengkha */ {HB_TAG('x','m','g',' '), HB_TAG('B','M','L',' ')}, /* Mengaka -> Bamileke */ - {HB_TAG('x','m','m',' '), HB_TAG('M','L','Y',' ')}, /* Manado Malay -> Malay */ - {HB_TAG('x','m','m',' '), HB_TAG('C','P','P',' ')}, /* Manado Malay -> Creoles */ {HB_TAG('x','m','v',' '), HB_TAG('M','L','G',' ')}, /* Antankarana Malagasy -> Malagasy */ {HB_TAG('x','m','w',' '), HB_TAG('M','L','G',' ')}, /* Tsimihety Malagasy -> Malagasy */ {HB_TAG('x','n','j',' '), HB_TAG('S','X','T',' ')}, /* Ngoni (Tanzania) -> Sutu */ {HB_TAG('x','n','q',' '), HB_TAG('S','X','T',' ')}, /* Ngoni (Mozambique) -> Sutu */ {HB_TAG('x','n','r',' '), HB_TAG('D','G','R',' ')}, /* Kangri -> Dogri (macrolanguage) */ -/*{HB_TAG('x','o','g',' '), HB_TAG('X','O','G',' ')},*/ /* Soga */ - {HB_TAG('x','p','e',' '), HB_TAG('X','P','E',' ')}, /* Liberia Kpelle -> Kpelle (Liberia) */ - {HB_TAG('x','p','e',' '), HB_TAG('K','P','L',' ')}, /* Liberia Kpelle -> Kpelle */ - {HB_TAG('x','s','l',' '), HB_TAG('S','S','L',' ')}, /* South Slavey */ - {HB_TAG('x','s','l',' '), HB_TAG('S','L','A',' ')}, /* South Slavey -> Slavey */ - {HB_TAG('x','s','l',' '), HB_TAG('A','T','H',' ')}, /* South Slavey -> Athapaskan */ {HB_TAG('x','s','t',' '), HB_TAG('S','I','G',' ')}, /* Silt'e (retired code) -> Silte Gurage */ -/*{HB_TAG('x','u','b',' '), HB_TAG('X','U','B',' ')},*/ /* Betta Kurumba -> Bette Kuruma */ -/*{HB_TAG('x','u','j',' '), HB_TAG('X','U','J',' ')},*/ /* Jennu Kurumba -> Jennu Kuruma */ {HB_TAG('x','u','p',' '), HB_TAG('A','T','H',' ')}, /* Upper Umpqua -> Athapaskan */ {HB_TAG('x','w','o',' '), HB_TAG('T','O','D',' ')}, /* Written Oirat -> Todo */ {HB_TAG('y','a','j',' '), HB_TAG('B','A','D','0')}, /* Banda-Yangere -> Banda */ - {HB_TAG('y','a','k',' '), HB_TAG_NONE }, /* Yakama != Sakha */ -/*{HB_TAG('y','a','o',' '), HB_TAG('Y','A','O',' ')},*/ /* Yao */ -/*{HB_TAG('y','a','p',' '), HB_TAG('Y','A','P',' ')},*/ /* Yapese */ - {HB_TAG('y','b','a',' '), HB_TAG_NONE }, /* Yala != Yoruba */ {HB_TAG('y','b','b',' '), HB_TAG('B','M','L',' ')}, /* Yemba -> Bamileke */ {HB_TAG('y','b','d',' '), HB_TAG('A','R','K',' ')}, /* Yangbye (retired code) -> Rakhine */ {HB_TAG('y','c','r',' '), HB_TAG('C','P','P',' ')}, /* Yilan Creole -> Creoles */ {HB_TAG('y','d','d',' '), HB_TAG('J','I','I',' ')}, /* Eastern Yiddish -> Yiddish */ -/*{HB_TAG('y','g','p',' '), HB_TAG('Y','G','P',' ')},*/ /* Gepo */ {HB_TAG('y','i','h',' '), HB_TAG('J','I','I',' ')}, /* Western Yiddish -> Yiddish */ - {HB_TAG('y','i','m',' '), HB_TAG_NONE }, /* Yimchungru Naga != Yi Modern */ -/*{HB_TAG('y','n','a',' '), HB_TAG('Y','N','A',' ')},*/ /* Aluo */ {HB_TAG('y','o','s',' '), HB_TAG('Q','I','N',' ')}, /* Yos (retired code) -> Chin */ {HB_TAG('y','u','a',' '), HB_TAG('M','Y','N',' ')}, /* Yucateco -> Mayan */ {HB_TAG('y','u','e',' '), HB_TAG('Z','H','H',' ')}, /* Yue Chinese -> Chinese, Traditional, Hong Kong SAR */ -/*{HB_TAG('y','u','f',' '), HB_TAG('Y','U','F',' ')},*/ /* Havasupai-Walapai-Yavapai */ -/*{HB_TAG('y','w','q',' '), HB_TAG('Y','W','Q',' ')},*/ /* Wuding-Luquan Yi */ {HB_TAG('z','c','h',' '), HB_TAG('Z','H','A',' ')}, /* Central Hongshuihe Zhuang -> Zhuang */ {HB_TAG('z','d','j',' '), HB_TAG('C','M','R',' ')}, /* Ngazidja Comorian -> Comorian */ -/*{HB_TAG('z','e','a',' '), HB_TAG('Z','E','A',' ')},*/ /* Zeeuws -> Zealandic */ {HB_TAG('z','e','h',' '), HB_TAG('Z','H','A',' ')}, /* Eastern Hongshuihe Zhuang -> Zhuang */ {HB_TAG('z','e','n',' '), HB_TAG('B','B','R',' ')}, /* Zenaga -> Berber */ {HB_TAG('z','g','b',' '), HB_TAG('Z','H','A',' ')}, /* Guibei Zhuang -> Zhuang */ - {HB_TAG('z','g','h',' '), HB_TAG('Z','G','H',' ')}, /* Standard Moroccan Tamazight */ - {HB_TAG('z','g','h',' '), HB_TAG('B','B','R',' ')}, /* Standard Moroccan Tamazight -> Berber */ {HB_TAG('z','g','m',' '), HB_TAG('Z','H','A',' ')}, /* Minz Zhuang -> Zhuang */ {HB_TAG('z','g','n',' '), HB_TAG('Z','H','A',' ')}, /* Guibian Zhuang -> Zhuang */ {HB_TAG('z','h','d',' '), HB_TAG('Z','H','A',' ')}, /* Dai Zhuang -> Zhuang */ @@ -1666,7 +1155,6 @@ static const LangTag ot_languages3[] = { {HB_TAG('z','l','q',' '), HB_TAG('Z','H','A',' ')}, /* Liuqian Zhuang -> Zhuang */ {HB_TAG('z','m','i',' '), HB_TAG('M','L','Y',' ')}, /* Negeri Sembilan Malay -> Malay */ {HB_TAG('z','m','z',' '), HB_TAG('B','A','D','0')}, /* Mbandja -> Banda */ - {HB_TAG('z','n','d',' '), HB_TAG_NONE }, /* Zande [collection] != Zande */ {HB_TAG('z','n','e',' '), HB_TAG('Z','N','D',' ')}, /* Zande */ {HB_TAG('z','o','m',' '), HB_TAG('Q','I','N',' ')}, /* Zou -> Chin */ {HB_TAG('z','q','e',' '), HB_TAG('Z','H','A',' ')}, /* Qiubei Zhuang -> Zhuang */ @@ -1677,9 +1165,439 @@ static const LangTag ot_languages3[] = { {HB_TAG('z','y','j',' '), HB_TAG('Z','H','A',' ')}, /* Youjiang Zhuang -> Zhuang */ {HB_TAG('z','y','n',' '), HB_TAG('Z','H','A',' ')}, /* Yongnan Zhuang -> Zhuang */ {HB_TAG('z','y','p',' '), HB_TAG('Q','I','N',' ')}, /* Zyphe Chin -> Chin */ -/*{HB_TAG('z','z','a',' '), HB_TAG('Z','Z','A',' ')},*/ /* Zazaki [macrolanguage] */ {HB_TAG('z','z','j',' '), HB_TAG('Z','H','A',' ')}, /* Zuojiang Zhuang -> Zhuang */ }; + +static const hb_tag_t ot_languages3_multi_values[] = { + HB_TAG('F','A','N',' '), /* Saint Lucian Creole French -> French Antillean */ + HB_TAG('C','P','P',' '), /* Saint Lucian Creole French -> Creoles */ + HB_TAG('A','C','R',' '), /* Achi */ + HB_TAG('M','Y','N',' '), /* Achi -> Mayan */ + HB_TAG('A','C','Y',' '), /* Cypriot Arabic */ + HB_TAG('A','R','A',' '), /* Cypriot Arabic -> Arabic */ + HB_TAG('S','W','A',' '), /* Assyrian Neo-Aramaic -> Swadaya Aramaic */ + HB_TAG('S','Y','R',' '), /* Assyrian Neo-Aramaic -> Syriac */ + HB_TAG('A','K','B',' '), /* Batak Angkola */ + HB_TAG('B','T','K',' '), /* Batak Angkola -> Batak */ + HB_TAG('M','O','R',' '), /* Moroccan Arabic -> Moroccan */ + HB_TAG('A','R','A',' '), /* Moroccan Arabic -> Arabic */ + HB_TAG('A','Z','B',' '), /* South Azerbaijani -> Torki */ + HB_TAG('A','Z','E',' '), /* South Azerbaijani -> Azerbaijani */ + HB_TAG('B','B','C',' '), /* Batak Toba */ + HB_TAG('B','T','K',' '), /* Batak Toba -> Batak */ + HB_TAG('B','G','Q',' '), /* Bagri */ + HB_TAG('R','A','J',' '), /* Bagri -> Rajasthani */ + HB_TAG('B','L','K',' '), /* Pa’o Karen */ + HB_TAG('K','R','N',' '), /* Pa'o Karen -> Karen */ + HB_TAG('B','T','D',' '), /* Batak Dairi (Pakpak) */ + HB_TAG('B','T','K',' '), /* Batak Dairi -> Batak */ + HB_TAG('B','T','M',' '), /* Batak Mandailing */ + HB_TAG('B','T','K',' '), /* Batak Mandailing -> Batak */ + HB_TAG('B','T','S',' '), /* Batak Simalungun */ + HB_TAG('B','T','K',' '), /* Batak Simalungun -> Batak */ + HB_TAG('B','T','X',' '), /* Batak Karo */ + HB_TAG('B','T','K',' '), /* Batak Karo -> Batak */ + HB_TAG('B','T','Z',' '), /* Batak Alas-Kluet */ + HB_TAG('B','T','K',' '), /* Batak Alas-Kluet -> Batak */ + HB_TAG('B','Y','V',' '), /* Medumba */ + HB_TAG('B','M','L',' '), /* Medumba -> Bamileke */ + HB_TAG('C','R','R',' '), /* Southern Carrier -> Carrier */ + HB_TAG('A','T','H',' '), /* Southern Carrier -> Athapaskan */ + HB_TAG('C','A','K',' '), /* Kaqchikel */ + HB_TAG('M','Y','N',' '), /* Kaqchikel -> Mayan */ + HB_TAG('C','B','K',' '), /* Chavacano -> Zamboanga Chavacano */ + HB_TAG('C','P','P',' '), /* Chavacano -> Creoles */ + HB_TAG('H','A','L',' '), /* Halam (Falam Chin) */ + HB_TAG('Q','I','N',' '), /* Falam Chin -> Chin */ + HB_TAG('H','M','A',' '), /* Mari (Russia) [macrolanguage] -> High Mari */ + HB_TAG('L','M','A',' '), /* Mari (Russia) [macrolanguage] -> Low Mari */ + HB_TAG('C','H','P',' '), /* Chipewyan */ + HB_TAG('S','A','Y',' '), /* Chipewyan -> Sayisi */ + HB_TAG('A','T','H',' '), /* Chipewyan -> Athapaskan */ + HB_TAG('Q','U','H',' '), /* Chilean Quechua (retired code) -> Quechua (Bolivia) */ + HB_TAG('Q','U','Z',' '), /* Chilean Quechua (retired code) -> Quechua */ + HB_TAG('E','C','R',' '), /* Southern East Cree -> Eastern Cree */ + HB_TAG('Y','C','R',' '), /* Southern East Cree -> Y-Cree */ + HB_TAG('C','R','E',' '), /* Southern East Cree -> Cree */ + HB_TAG('W','C','R',' '), /* Plains Cree -> West-Cree */ + HB_TAG('Y','C','R',' '), /* Plains Cree -> Y-Cree */ + HB_TAG('C','R','E',' '), /* Plains Cree -> Cree */ + HB_TAG('E','C','R',' '), /* Northern East Cree -> Eastern Cree */ + HB_TAG('Y','C','R',' '), /* Northern East Cree -> Y-Cree */ + HB_TAG('C','R','E',' '), /* Northern East Cree -> Cree */ + HB_TAG('M','C','R',' '), /* Moose Cree */ + HB_TAG('L','C','R',' '), /* Moose Cree -> L-Cree */ + HB_TAG('C','R','E',' '), /* Moose Cree -> Cree */ + HB_TAG('C','R','R',' '), /* Carrier */ + HB_TAG('A','T','H',' '), /* Carrier -> Athapaskan */ + HB_TAG('N','C','R',' '), /* Swampy Cree -> N-Cree */ + HB_TAG('N','H','C',' '), /* Swampy Cree -> Norway House Cree */ + HB_TAG('C','R','E',' '), /* Swampy Cree -> Cree */ + HB_TAG('D','C','R',' '), /* Woods Cree */ + HB_TAG('T','C','R',' '), /* Woods Cree -> TH-Cree */ + HB_TAG('C','R','E',' '), /* Woods Cree -> Cree */ + HB_TAG('S','L','A',' '), /* Slave (Athapascan) [macrolanguage] -> Slavey */ + HB_TAG('A','T','H',' '), /* Slave (Athapascan) [macrolanguage] -> Athapaskan */ + HB_TAG('D','G','O',' '), /* Dogri (individual language) */ + HB_TAG('D','G','R',' '), /* Dogri (macrolanguage) */ + HB_TAG('D','I','Q',' '), /* Dimli */ + HB_TAG('Z','Z','A',' '), /* Dimli -> Zazaki */ + HB_TAG('D','R','I',' '), /* Darwazi (retired code) -> Dari */ + HB_TAG('F','A','R',' '), /* Darwazi (retired code) -> Persian */ + HB_TAG('E','M','K',' '), /* Eastern Maninkakan */ + HB_TAG('M','N','K',' '), /* Eastern Maninkakan -> Maninka */ + HB_TAG('F','A','N','0'), /* Fang (Equatorial Guinea) */ + HB_TAG('B','T','I',' '), /* Fang (Equatorial Guinea) -> Beti */ + HB_TAG('F','A','T',' '), /* Fanti */ + HB_TAG('A','K','A',' '), /* Fanti -> Akan */ + HB_TAG('H','A','L',' '), /* Halam (Falam Chin) (retired code) */ + HB_TAG('Q','I','N',' '), /* Falam Chin (retired code) -> Chin */ + HB_TAG('F','M','P',' '), /* Fe’fe’ */ + HB_TAG('B','M','L',' '), /* Fe'fe' -> Bamileke */ + HB_TAG('F','T','A',' '), /* Pular -> Futa */ + HB_TAG('F','U','L',' '), /* Pular -> Fulah */ + HB_TAG('F','U','V',' '), /* Nigerian Fulfulde */ + HB_TAG('F','U','L',' '), /* Nigerian Fulfulde -> Fulah */ + HB_TAG('G','K','P',' '), /* Guinea Kpelle -> Kpelle (Guinea) */ + HB_TAG('K','P','L',' '), /* Guinea Kpelle -> Kpelle */ + HB_TAG('H','M','D',' '), /* Large Flowery Miao -> A-Hmao */ + HB_TAG('H','M','N',' '), /* Large Flowery Miao -> Hmong */ + HB_TAG('H','M','Z',' '), /* Hmong Shua -> Hmong Shuat */ + HB_TAG('H','M','N',' '), /* Hmong Shua -> Hmong */ + HB_TAG('H','A','R',' '), /* Hadothi -> Harauti */ + HB_TAG('R','A','J',' '), /* Hadothi -> Rajasthani */ + HB_TAG('I','N','U',' '), /* Eastern Canadian Inuktitut -> Inuktitut */ + HB_TAG('I','N','U','K'), /* Eastern Canadian Inuktitut -> Nunavik Inuktitut */ + HB_TAG('J','A','M',' '), /* Jamaican Creole English -> Jamaican Creole */ + HB_TAG('C','P','P',' '), /* Jamaican Creole English -> Creoles */ + HB_TAG('K','A','B','0'), /* Kabyle */ + HB_TAG('B','B','R',' '), /* Kabyle -> Berber */ + HB_TAG('K','H','K',' '), /* Khanty -> Khanty-Kazim */ + HB_TAG('K','H','S',' '), /* Khanty -> Khanty-Shurishkar */ + HB_TAG('K','H','V',' '), /* Khanty -> Khanty-Vakhi */ + HB_TAG('K','E','A',' '), /* Kabuverdianu (Crioulo) */ + HB_TAG('C','P','P',' '), /* Kabuverdianu -> Creoles */ + HB_TAG('K','E','K',' '), /* Kekchi */ + HB_TAG('M','Y','N',' '), /* Kekchí -> Mayan */ + HB_TAG('K','H','T',' '), /* Khamti -> Khamti Shan */ + HB_TAG('K','H','N',' '), /* Khamti -> Khamti Shan (Microsoft fonts) */ + HB_TAG('K','I','U',' '), /* Kirmanjki */ + HB_TAG('Z','Z','A',' '), /* Kirmanjki -> Zazaki */ + HB_TAG('K','J','P',' '), /* Pwo Eastern Karen -> Eastern Pwo Karen */ + HB_TAG('K','R','N',' '), /* Pwo Eastern Karen -> Karen */ + HB_TAG('K','O','P',' '), /* Komi-Permyak */ + HB_TAG('K','O','M',' '), /* Komi-Permyak -> Komi */ + HB_TAG('K','O','Z',' '), /* Komi-Zyrian */ + HB_TAG('K','O','M',' '), /* Komi-Zyrian -> Komi */ + HB_TAG('K','A','R',' '), /* Karachay-Balkar -> Karachay */ + HB_TAG('B','A','L',' '), /* Karachay-Balkar -> Balkar */ + HB_TAG('K','R','I',' '), /* Krio */ + HB_TAG('C','P','P',' '), /* Krio -> Creoles */ + HB_TAG('K','S','W',' '), /* S’gaw Karen */ + HB_TAG('K','R','N',' '), /* S'gaw Karen -> Karen */ + HB_TAG('K','V','Q',' '), /* Geba Karen */ + HB_TAG('K','R','N',' '), /* Geba Karen -> Karen */ + HB_TAG('K','Y','U',' '), /* Western Kayah */ + HB_TAG('K','R','N',' '), /* Western Kayah -> Karen */ + HB_TAG('M','I','Z',' '), /* Lushai -> Mizo */ + HB_TAG('Q','I','N',' '), /* Lushai -> Chin */ + HB_TAG('M','A','M',' '), /* Mam */ + HB_TAG('M','Y','N',' '), /* Mam -> Mayan */ + HB_TAG('M','L','Y',' '), /* North Moluccan Malay -> Malay */ + HB_TAG('C','P','P',' '), /* North Moluccan Malay -> Creoles */ + HB_TAG('M','F','A',' '), /* Pattani Malay */ + HB_TAG('M','L','Y',' '), /* Pattani Malay -> Malay */ + HB_TAG('M','F','E',' '), /* Morisyen */ + HB_TAG('C','P','P',' '), /* Morisyen -> Creoles */ + HB_TAG('M','I','N',' '), /* Minangkabau */ + HB_TAG('M','L','Y',' '), /* Minangkabau -> Malay */ + HB_TAG('M','L','N',' '), /* Western Maninkakan -> Malinke */ + HB_TAG('M','N','K',' '), /* Western Maninkakan -> Maninka */ + HB_TAG('M','N','D',' '), /* Mandinka */ + HB_TAG('M','N','K',' '), /* Mandinka -> Maninka */ + HB_TAG('M','O','N',' '), /* Mon */ + HB_TAG('M','O','N','T'), /* Mon -> Thailand Mon */ + HB_TAG('M','L','Y',' '), /* Sabah Malay -> Malay */ + HB_TAG('C','P','P',' '), /* Sabah Malay -> Creoles */ + HB_TAG('M','W','W',' '), /* Hmong Daw */ + HB_TAG('H','M','N',' '), /* Hmong Daw -> Hmong */ + HB_TAG('N','A','G',' '), /* Naga Pidgin -> Naga-Assamese */ + HB_TAG('C','P','P',' '), /* Naga Pidgin -> Creoles */ + HB_TAG('O','C','R',' '), /* Severn Ojibwa -> Oji-Cree */ + HB_TAG('O','J','B',' '), /* Severn Ojibwa -> Ojibway */ + HB_TAG('P','A','P','0'), /* Papiamento -> Papiamentu */ + HB_TAG('C','P','P',' '), /* Papiamento -> Creoles */ + HB_TAG('A','R','A',' '), /* Sudanese Creole Arabic -> Arabic */ + HB_TAG('C','P','P',' '), /* Sudanese Creole Arabic -> Creoles */ + HB_TAG('P','I','H',' '), /* Pitcairn-Norfolk -> Norfolk */ + HB_TAG('C','P','P',' '), /* Pitcairn-Norfolk -> Creoles */ + HB_TAG('P','O','H',' '), /* Poqomchi' -> Pocomchi */ + HB_TAG('M','Y','N',' '), /* Poqomchi' -> Mayan */ + HB_TAG('D','R','I',' '), /* Dari */ + HB_TAG('F','A','R',' '), /* Dari -> Persian */ + HB_TAG('P','W','O',' '), /* Pwo Western Karen -> Western Pwo Karen */ + HB_TAG('K','R','N',' '), /* Pwo Western Karen -> Karen */ + HB_TAG('Q','W','H',' '), /* Huallaga Huánuco Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Huallaga Huánuco Quechua -> Quechua */ + HB_TAG('Q','U','C',' '), /* K’iche’ */ + HB_TAG('M','Y','N',' '), /* K'iche' -> Mayan */ + HB_TAG('Q','V','I',' '), /* Calderón Highland Quichua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Calderón Highland Quichua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Chimborazo Highland Quichua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Chimborazo Highland Quichua -> Quechua */ + HB_TAG('Q','U','H',' '), /* South Bolivian Quechua -> Quechua (Bolivia) */ + HB_TAG('Q','U','Z',' '), /* South Bolivian Quechua -> Quechua */ + HB_TAG('Q','U','H',' '), /* North Bolivian Quechua -> Quechua (Bolivia) */ + HB_TAG('Q','U','Z',' '), /* North Bolivian Quechua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Southern Pastaza Quechua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Southern Pastaza Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Yanahuanca Pasco Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Yanahuanca Pasco Quechua -> Quechua */ + HB_TAG('Q','U','H',' '), /* Santiago del Estero Quichua -> Quechua (Bolivia) */ + HB_TAG('Q','U','Z',' '), /* Santiago del Estero Quichua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Tena Lowland Quichua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Tena Lowland Quichua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Yauyos Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Yauyos Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Ambo-Pasco Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Ambo-Pasco Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Huamalíes-Dos de Mayo Huánuco Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Huamalíes-Dos de Mayo Huánuco Quechua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Imbabura Highland Quichua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Imbabura Highland Quichua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Loja Highland Quichua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Loja Highland Quichua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Cajatambo North Lima Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Cajatambo North Lima Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Margos-Yarowilca-Lauricocha Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Margos-Yarowilca-Lauricocha Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* North Junín Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* North Junín Quechua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Napo Lowland Quechua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Napo Lowland Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Pacaraos Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Pacaraos Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Huaylla Wanca Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Huaylla Wanca Quechua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Northern Pastaza Quichua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Northern Pastaza Quichua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Corongo Ancash Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Corongo Ancash Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Huaylas Ancash Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Huaylas Ancash Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Sihuas Ancash Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Sihuas Ancash Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Chiquián Ancash Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Chiquián Ancash Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Chincha Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Chincha Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Panao Huánuco Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Panao Huánuco Quechua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Salasaca Highland Quichua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Salasaca Highland Quichua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Northern Conchucos Ancash Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Northern Conchucos Ancash Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Southern Conchucos Ancash Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Southern Conchucos Ancash Quechua -> Quechua */ + HB_TAG('Q','V','I',' '), /* Cañar Highland Quichua -> Quechua (Ecuador) */ + HB_TAG('Q','U','Z',' '), /* Cañar Highland Quichua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Santa Ana de Tusi Pasco Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Santa Ana de Tusi Pasco Quechua -> Quechua */ + HB_TAG('Q','W','H',' '), /* Jauja Wanca Quechua -> Quechua (Peru) */ + HB_TAG('Q','U','Z',' '), /* Jauja Wanca Quechua -> Quechua */ + HB_TAG('R','I','F',' '), /* Tarifit */ + HB_TAG('B','B','R',' '), /* Tarifit -> Berber */ + HB_TAG('R','M','Y',' '), /* Vlax Romani */ + HB_TAG('R','O','Y',' '), /* Vlax Romani -> Romany */ + HB_TAG('S','C','S',' '), /* North Slavey */ + HB_TAG('S','L','A',' '), /* North Slavey -> Slavey */ + HB_TAG('A','T','H',' '), /* North Slavey -> Athapaskan */ + HB_TAG('S','F','M',' '), /* Small Flowery Miao */ + HB_TAG('H','M','N',' '), /* Small Flowery Miao -> Hmong */ + HB_TAG('S','H','I',' '), /* Tachelhit */ + HB_TAG('B','B','R',' '), /* Tachelhit -> Berber */ + HB_TAG('T','A','Q',' '), /* Tamasheq */ + HB_TAG('T','M','H',' '), /* Tamasheq -> Tamashek */ + HB_TAG('B','B','R',' '), /* Tamasheq -> Berber */ + HB_TAG('T','H','V',' '), /* Tahaggart Tamahaq */ + HB_TAG('T','M','H',' '), /* Tahaggart Tamahaq -> Tamashek */ + HB_TAG('B','B','R',' '), /* Tahaggart Tamahaq -> Berber */ + HB_TAG('T','H','Z',' '), /* Tayart Tamajeq */ + HB_TAG('T','M','H',' '), /* Tayart Tamajeq -> Tamashek */ + HB_TAG('B','B','R',' '), /* Tayart Tamajeq -> Berber */ + HB_TAG('T','M','H',' '), /* Tamashek [macrolanguage] */ + HB_TAG('B','B','R',' '), /* Tamashek [macrolanguage] -> Berber */ + HB_TAG('D','R','I',' '), /* Tangshewi (retired code) -> Dari */ + HB_TAG('F','A','R',' '), /* Tangshewi (retired code) -> Persian */ + HB_TAG('T','P','I',' '), /* Tok Pisin */ + HB_TAG('C','P','P',' '), /* Tok Pisin -> Creoles */ + HB_TAG('T','U','A',' '), /* Turoyo -> Turoyo Aramaic */ + HB_TAG('S','Y','R',' '), /* Turoyo -> Syriac */ + HB_TAG('T','T','Q',' '), /* Tawallammat Tamajaq */ + HB_TAG('T','M','H',' '), /* Tawallammat Tamajaq -> Tamashek */ + HB_TAG('B','B','R',' '), /* Tawallammat Tamajaq -> Berber */ + HB_TAG('T','Z','M',' '), /* Central Atlas Tamazight -> Tamazight */ + HB_TAG('B','B','R',' '), /* Central Atlas Tamazight -> Berber */ + HB_TAG('T','Z','O',' '), /* Tzotzil */ + HB_TAG('M','Y','N',' '), /* Tzotzil -> Mayan */ + HB_TAG('V','R','O',' '), /* Võro */ + HB_TAG('E','T','I',' '), /* Võro -> Estonian */ + HB_TAG('W','A','G',' '), /* Wagdi */ + HB_TAG('R','A','J',' '), /* Wagdi -> Rajasthani */ + HB_TAG('W','D','T',' '), /* Wyandot (retired code) -> Wendat */ + HB_TAG('W','Y','N',' '), /* Wyandot (retired code) */ + HB_TAG('K','L','M',' '), /* Kalmyk */ + HB_TAG('T','O','D',' '), /* Kalmyk -> Todo */ + HB_TAG('M','L','Y',' '), /* Manado Malay -> Malay */ + HB_TAG('C','P','P',' '), /* Manado Malay -> Creoles */ + HB_TAG('X','P','E',' '), /* Liberia Kpelle -> Kpelle (Liberia) */ + HB_TAG('K','P','L',' '), /* Liberia Kpelle -> Kpelle */ + HB_TAG('S','S','L',' '), /* South Slavey */ + HB_TAG('S','L','A',' '), /* South Slavey -> Slavey */ + HB_TAG('A','T','H',' '), /* South Slavey -> Athapaskan */ + HB_TAG('Z','G','H',' '), /* Standard Moroccan Tamazight */ + HB_TAG('B','B','R',' '), /* Standard Moroccan Tamazight -> Berber */ +}; + +static const LangTagRange ot_languages3_multi[] = { + {HB_TAG('a','c','f',' '), 0, 2}, /* Saint Lucian Creole French -> French Antillean */ + {HB_TAG('a','c','r',' '), 2, 2}, /* Achi */ + {HB_TAG('a','c','y',' '), 4, 2}, /* Cypriot Arabic */ + {HB_TAG('a','i','i',' '), 6, 2}, /* Assyrian Neo-Aramaic -> Swadaya Aramaic */ + {HB_TAG('a','k','b',' '), 8, 2}, /* Batak Angkola */ + {HB_TAG('a','r','y',' '), 10, 2}, /* Moroccan Arabic -> Moroccan */ + {HB_TAG('a','z','b',' '), 12, 2}, /* South Azerbaijani -> Torki */ + {HB_TAG('b','b','c',' '), 14, 2}, /* Batak Toba */ + {HB_TAG('b','g','q',' '), 16, 2}, /* Bagri */ + {HB_TAG('b','l','k',' '), 18, 2}, /* Pa’o Karen */ + {HB_TAG('b','t','d',' '), 20, 2}, /* Batak Dairi (Pakpak) */ + {HB_TAG('b','t','m',' '), 22, 2}, /* Batak Mandailing */ + {HB_TAG('b','t','s',' '), 24, 2}, /* Batak Simalungun */ + {HB_TAG('b','t','x',' '), 26, 2}, /* Batak Karo */ + {HB_TAG('b','t','z',' '), 28, 2}, /* Batak Alas-Kluet */ + {HB_TAG('b','y','v',' '), 30, 2}, /* Medumba */ + {HB_TAG('c','a','f',' '), 32, 2}, /* Southern Carrier -> Carrier */ + {HB_TAG('c','a','k',' '), 34, 2}, /* Kaqchikel */ + {HB_TAG('c','b','k',' '), 36, 2}, /* Chavacano -> Zamboanga Chavacano */ + {HB_TAG('c','f','m',' '), 38, 2}, /* Halam (Falam Chin) */ + {HB_TAG('c','h','m',' '), 40, 2}, /* Mari (Russia) [macrolanguage] -> High Mari */ + {HB_TAG('c','h','p',' '), 42, 3}, /* Chipewyan */ + {HB_TAG('c','q','u',' '), 45, 2}, /* Chilean Quechua (retired code) -> Quechua (Bolivia) */ + {HB_TAG('c','r','j',' '), 47, 3}, /* Southern East Cree -> Eastern Cree */ + {HB_TAG('c','r','k',' '), 50, 3}, /* Plains Cree -> West-Cree */ + {HB_TAG('c','r','l',' '), 53, 3}, /* Northern East Cree -> Eastern Cree */ + {HB_TAG('c','r','m',' '), 56, 3}, /* Moose Cree */ + {HB_TAG('c','r','x',' '), 59, 2}, /* Carrier */ + {HB_TAG('c','s','w',' '), 61, 3}, /* Swampy Cree -> N-Cree */ + {HB_TAG('c','w','d',' '), 64, 3}, /* Woods Cree */ + {HB_TAG('d','e','n',' '), 67, 2}, /* Slave (Athapascan) [macrolanguage] -> Slavey */ + {HB_TAG('d','g','o',' '), 69, 2}, /* Dogri (individual language) */ + {HB_TAG('d','i','q',' '), 71, 2}, /* Dimli */ + {HB_TAG('d','r','w',' '), 73, 2}, /* Darwazi (retired code) -> Dari */ + {HB_TAG('e','m','k',' '), 75, 2}, /* Eastern Maninkakan */ + {HB_TAG('f','a','n',' '), 77, 2}, /* Fang (Equatorial Guinea) */ + {HB_TAG('f','a','t',' '), 79, 2}, /* Fanti */ + {HB_TAG('f','l','m',' '), 81, 2}, /* Halam (Falam Chin) (retired code) */ + {HB_TAG('f','m','p',' '), 83, 2}, /* Fe’fe’ */ + {HB_TAG('f','u','f',' '), 85, 2}, /* Pular -> Futa */ + {HB_TAG('f','u','v',' '), 87, 2}, /* Nigerian Fulfulde */ + {HB_TAG('g','k','p',' '), 89, 2}, /* Guinea Kpelle -> Kpelle (Guinea) */ + {HB_TAG('h','m','d',' '), 91, 2}, /* Large Flowery Miao -> A-Hmao */ + {HB_TAG('h','m','z',' '), 93, 2}, /* Hmong Shua -> Hmong Shuat */ + {HB_TAG('h','o','j',' '), 95, 2}, /* Hadothi -> Harauti */ + {HB_TAG('i','k','e',' '), 97, 2}, /* Eastern Canadian Inuktitut -> Inuktitut */ + {HB_TAG('j','a','m',' '), 99, 2}, /* Jamaican Creole English -> Jamaican Creole */ + {HB_TAG('k','a','b',' '), 101, 2}, /* Kabyle */ + {HB_TAG('k','c','a',' '), 103, 3}, /* Khanty -> Khanty-Kazim */ + {HB_TAG('k','e','a',' '), 106, 2}, /* Kabuverdianu (Crioulo) */ + {HB_TAG('k','e','k',' '), 108, 2}, /* Kekchi */ + {HB_TAG('k','h','t',' '), 110, 2}, /* Khamti -> Khamti Shan */ + {HB_TAG('k','i','u',' '), 112, 2}, /* Kirmanjki */ + {HB_TAG('k','j','p',' '), 114, 2}, /* Pwo Eastern Karen -> Eastern Pwo Karen */ + {HB_TAG('k','o','i',' '), 116, 2}, /* Komi-Permyak */ + {HB_TAG('k','p','v',' '), 118, 2}, /* Komi-Zyrian */ + {HB_TAG('k','r','c',' '), 120, 2}, /* Karachay-Balkar -> Karachay */ + {HB_TAG('k','r','i',' '), 122, 2}, /* Krio */ + {HB_TAG('k','s','w',' '), 124, 2}, /* S’gaw Karen */ + {HB_TAG('k','v','q',' '), 126, 2}, /* Geba Karen */ + {HB_TAG('k','y','u',' '), 128, 2}, /* Western Kayah */ + {HB_TAG('l','u','s',' '), 130, 2}, /* Lushai -> Mizo */ + {HB_TAG('m','a','m',' '), 132, 2}, /* Mam */ + {HB_TAG('m','a','x',' '), 134, 2}, /* North Moluccan Malay -> Malay */ + {HB_TAG('m','f','a',' '), 136, 2}, /* Pattani Malay */ + {HB_TAG('m','f','e',' '), 138, 2}, /* Morisyen */ + {HB_TAG('m','i','n',' '), 140, 2}, /* Minangkabau */ + {HB_TAG('m','l','q',' '), 142, 2}, /* Western Maninkakan -> Malinke */ + {HB_TAG('m','n','k',' '), 144, 2}, /* Mandinka */ + {HB_TAG('m','n','w',' '), 146, 2}, /* Mon */ + {HB_TAG('m','s','i',' '), 148, 2}, /* Sabah Malay -> Malay */ + {HB_TAG('m','w','w',' '), 150, 2}, /* Hmong Daw */ + {HB_TAG('n','a','g',' '), 152, 2}, /* Naga Pidgin -> Naga-Assamese */ + {HB_TAG('o','j','s',' '), 154, 2}, /* Severn Ojibwa -> Oji-Cree */ + {HB_TAG('p','a','p',' '), 156, 2}, /* Papiamento -> Papiamentu */ + {HB_TAG('p','g','a',' '), 158, 2}, /* Sudanese Creole Arabic -> Arabic */ + {HB_TAG('p','i','h',' '), 160, 2}, /* Pitcairn-Norfolk -> Norfolk */ + {HB_TAG('p','o','h',' '), 162, 2}, /* Poqomchi' -> Pocomchi */ + {HB_TAG('p','r','s',' '), 164, 2}, /* Dari */ + {HB_TAG('p','w','o',' '), 166, 2}, /* Pwo Western Karen -> Western Pwo Karen */ + {HB_TAG('q','u','b',' '), 168, 2}, /* Huallaga Huánuco Quechua -> Quechua (Peru) */ + {HB_TAG('q','u','c',' '), 170, 2}, /* K’iche’ */ + {HB_TAG('q','u','d',' '), 172, 2}, /* Calderón Highland Quichua -> Quechua (Ecuador) */ + {HB_TAG('q','u','g',' '), 174, 2}, /* Chimborazo Highland Quichua -> Quechua (Ecuador) */ + {HB_TAG('q','u','h',' '), 176, 2}, /* South Bolivian Quechua -> Quechua (Bolivia) */ + {HB_TAG('q','u','l',' '), 178, 2}, /* North Bolivian Quechua -> Quechua (Bolivia) */ + {HB_TAG('q','u','p',' '), 180, 2}, /* Southern Pastaza Quechua -> Quechua (Ecuador) */ + {HB_TAG('q','u','r',' '), 182, 2}, /* Yanahuanca Pasco Quechua -> Quechua (Peru) */ + {HB_TAG('q','u','s',' '), 184, 2}, /* Santiago del Estero Quichua -> Quechua (Bolivia) */ + {HB_TAG('q','u','w',' '), 186, 2}, /* Tena Lowland Quichua -> Quechua (Ecuador) */ + {HB_TAG('q','u','x',' '), 188, 2}, /* Yauyos Quechua -> Quechua (Peru) */ + {HB_TAG('q','v','a',' '), 190, 2}, /* Ambo-Pasco Quechua -> Quechua (Peru) */ + {HB_TAG('q','v','h',' '), 192, 2}, /* Huamalíes-Dos de Mayo Huánuco Quechua -> Quechua (Peru) */ + {HB_TAG('q','v','i',' '), 194, 2}, /* Imbabura Highland Quichua -> Quechua (Ecuador) */ + {HB_TAG('q','v','j',' '), 196, 2}, /* Loja Highland Quichua -> Quechua (Ecuador) */ + {HB_TAG('q','v','l',' '), 198, 2}, /* Cajatambo North Lima Quechua -> Quechua (Peru) */ + {HB_TAG('q','v','m',' '), 200, 2}, /* Margos-Yarowilca-Lauricocha Quechua -> Quechua (Peru) */ + {HB_TAG('q','v','n',' '), 202, 2}, /* North Junín Quechua -> Quechua (Peru) */ + {HB_TAG('q','v','o',' '), 204, 2}, /* Napo Lowland Quechua -> Quechua (Ecuador) */ + {HB_TAG('q','v','p',' '), 206, 2}, /* Pacaraos Quechua -> Quechua (Peru) */ + {HB_TAG('q','v','w',' '), 208, 2}, /* Huaylla Wanca Quechua -> Quechua (Peru) */ + {HB_TAG('q','v','z',' '), 210, 2}, /* Northern Pastaza Quichua -> Quechua (Ecuador) */ + {HB_TAG('q','w','a',' '), 212, 2}, /* Corongo Ancash Quechua -> Quechua (Peru) */ + {HB_TAG('q','w','h',' '), 214, 2}, /* Huaylas Ancash Quechua -> Quechua (Peru) */ + {HB_TAG('q','w','s',' '), 216, 2}, /* Sihuas Ancash Quechua -> Quechua (Peru) */ + {HB_TAG('q','x','a',' '), 218, 2}, /* Chiquián Ancash Quechua -> Quechua (Peru) */ + {HB_TAG('q','x','c',' '), 220, 2}, /* Chincha Quechua -> Quechua (Peru) */ + {HB_TAG('q','x','h',' '), 222, 2}, /* Panao Huánuco Quechua -> Quechua (Peru) */ + {HB_TAG('q','x','l',' '), 224, 2}, /* Salasaca Highland Quichua -> Quechua (Ecuador) */ + {HB_TAG('q','x','n',' '), 226, 2}, /* Northern Conchucos Ancash Quechua -> Quechua (Peru) */ + {HB_TAG('q','x','o',' '), 228, 2}, /* Southern Conchucos Ancash Quechua -> Quechua (Peru) */ + {HB_TAG('q','x','r',' '), 230, 2}, /* Cañar Highland Quichua -> Quechua (Ecuador) */ + {HB_TAG('q','x','t',' '), 232, 2}, /* Santa Ana de Tusi Pasco Quechua -> Quechua (Peru) */ + {HB_TAG('q','x','w',' '), 234, 2}, /* Jauja Wanca Quechua -> Quechua (Peru) */ + {HB_TAG('r','i','f',' '), 236, 2}, /* Tarifit */ + {HB_TAG('r','m','y',' '), 238, 2}, /* Vlax Romani */ + {HB_TAG('s','c','s',' '), 240, 3}, /* North Slavey */ + {HB_TAG('s','f','m',' '), 243, 2}, /* Small Flowery Miao */ + {HB_TAG('s','h','i',' '), 245, 2}, /* Tachelhit */ + {HB_TAG('t','a','q',' '), 247, 3}, /* Tamasheq */ + {HB_TAG('t','h','v',' '), 250, 3}, /* Tahaggart Tamahaq */ + {HB_TAG('t','h','z',' '), 253, 3}, /* Tayart Tamajeq */ + {HB_TAG('t','m','h',' '), 256, 2}, /* Tamashek [macrolanguage] */ + {HB_TAG('t','n','f',' '), 258, 2}, /* Tangshewi (retired code) -> Dari */ + {HB_TAG('t','p','i',' '), 260, 2}, /* Tok Pisin */ + {HB_TAG('t','r','u',' '), 262, 2}, /* Turoyo -> Turoyo Aramaic */ + {HB_TAG('t','t','q',' '), 264, 3}, /* Tawallammat Tamajaq */ + {HB_TAG('t','z','m',' '), 267, 2}, /* Central Atlas Tamazight -> Tamazight */ + {HB_TAG('t','z','o',' '), 269, 2}, /* Tzotzil */ + {HB_TAG('v','r','o',' '), 271, 2}, /* Võro */ + {HB_TAG('w','b','r',' '), 273, 2}, /* Wagdi */ + {HB_TAG('w','y','a',' '), 275, 2}, /* Wyandot (retired code) -> Wendat */ + {HB_TAG('x','a','l',' '), 277, 2}, /* Kalmyk */ + {HB_TAG('x','m','m',' '), 279, 2}, /* Manado Malay -> Malay */ + {HB_TAG('x','p','e',' '), 281, 2}, /* Liberia Kpelle -> Kpelle (Liberia) */ + {HB_TAG('x','s','l',' '), 283, 3}, /* South Slavey */ + {HB_TAG('z','g','h',' '), 286, 2}, /* Standard Moroccan Tamazight */ +}; #endif /** @@ -3205,7 +3123,7 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag) case HB_TAG('Z','H','T','M'): /* Chinese, Traditional, Macao SAR */ return hb_language_from_string ("zh-MO", -1); /* Chinese [macrolanguage]; Macao */ case HB_TAG('Z','Z','A',' '): /* Zazaki */ - return hb_language_from_string ("zza", -1); /* Zazaki [macrolanguage] */ + return hb_language_from_string ("zza", -1); /* Zaza [macrolanguage] */ default: return HB_LANGUAGE_INVALID; } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc index 786a220b6ecf..79407dd6661d 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc @@ -234,6 +234,29 @@ lang_matches (const char *lang_str, (lang_str[spec_len] == '\0' || lang_str[spec_len] == '-'); } +static bool +bfind_tag (const hb_tag_t *array, + unsigned len, + hb_tag_t key) +{ + unsigned min = 0; + unsigned max = len; + + while (min < max) + { + unsigned mid = min + (max - min) / 2; + hb_tag_t val = array[mid]; + if (key < val) + max = mid; + else if (key > val) + min = mid + 1; + else + return true; + } + + return false; +} + struct LangTag { hb_tag_t language; @@ -247,6 +270,20 @@ struct LangTag { return cmp (that->language); } }; +struct LangTagRange +{ + hb_tag_t language; + uint16_t offset; + uint8_t count; + + int cmp (hb_tag_t a) const + { + return a < this->language ? -1 : a > this->language ? +1 : 0; + } + int cmp (const LangTagRange *that) const + { return cmp (that->language); } +}; + #include "hb-ot-tag-table.hh" /* The corresponding languages IDs for the following IDs are unclear, @@ -307,46 +344,84 @@ hb_ot_tags_from_language (const char *lang_str, lang_str = s + 1; } #endif - const LangTag *ot_languages = nullptr; - unsigned ot_languages_len = 0; const char *dash = strchr (lang_str, '-'); unsigned first_len = dash ? dash - lang_str : limit - lang_str; + hb_tag_t lang_tag = hb_tag_from_string (lang_str, first_len); + if (first_len == 2) { - ot_languages = ot_languages2; - ot_languages_len = ARRAY_LENGTH (ot_languages2); + static hb_atomic_t last_tag_idx_2 = 0; /* Poor man's cache. */ + unsigned tag_idx = last_tag_idx_2; + + if (likely (tag_idx < ARRAY_LENGTH (ot_languages2) && + ot_languages2[tag_idx].language == lang_tag) || + hb_sorted_array (ot_languages2).bfind (lang_tag, &tag_idx)) + { + last_tag_idx_2 = tag_idx; + unsigned int i; + while (tag_idx != 0 && + ot_languages2[tag_idx].language == ot_languages2[tag_idx - 1].language) + tag_idx--; + for (i = 0; + i < *count && + tag_idx + i < ARRAY_LENGTH (ot_languages2) && + ot_languages2[tag_idx + i].tag != HB_TAG_NONE && + ot_languages2[tag_idx + i].language == ot_languages2[tag_idx].language; + i++) + tags[i] = ot_languages2[tag_idx + i].tag; + *count = i; + return; + } } #ifndef HB_NO_LANGUAGE_LONG else if (first_len == 3) { - ot_languages = ot_languages3; - ot_languages_len = ARRAY_LENGTH (ot_languages3); - } -#endif + static hb_atomic_t last_tag_idx_3 = 0; /* Poor man's cache. */ + unsigned tag_idx = last_tag_idx_3; - hb_tag_t lang_tag = hb_tag_from_string (lang_str, first_len); + if (likely (tag_idx < ARRAY_LENGTH (ot_languages3) && + ot_languages3[tag_idx].language == lang_tag) || + hb_sorted_array (ot_languages3).bfind (lang_tag, &tag_idx)) + { + last_tag_idx_3 = tag_idx; + if (*count) + { + tags[0] = ot_languages3[tag_idx].tag; + *count = 1; + } + else + *count = 0; + return; + } - static hb_atomic_t last_tag_idx = 0; /* Poor man's cache. */ - unsigned tag_idx = last_tag_idx; + static hb_atomic_t last_tag_idx_3_multi = 0; /* Poor man's cache. */ + unsigned multi_tag_idx = last_tag_idx_3_multi; - if (likely (tag_idx < ot_languages_len && ot_languages[tag_idx].language == lang_tag) || - hb_sorted_array (ot_languages, ot_languages_len).bfind (lang_tag, &tag_idx)) - { - last_tag_idx = tag_idx; - unsigned int i; - while (tag_idx != 0 && - ot_languages[tag_idx].language == ot_languages[tag_idx - 1].language) - tag_idx--; - for (i = 0; - i < *count && - tag_idx + i < ot_languages_len && - ot_languages[tag_idx + i].tag != HB_TAG_NONE && - ot_languages[tag_idx + i].language == ot_languages[tag_idx].language; - i++) - tags[i] = ot_languages[tag_idx + i].tag; - *count = i; + if (likely (multi_tag_idx < ARRAY_LENGTH (ot_languages3_multi) && + ot_languages3_multi[multi_tag_idx].language == lang_tag) || + hb_sorted_array (ot_languages3_multi).bfind (lang_tag, &multi_tag_idx)) + { + last_tag_idx_3_multi = multi_tag_idx; + const LangTagRange &range = ot_languages3_multi[multi_tag_idx]; + unsigned int i; + for (i = 0; i < *count && i < range.count; i++) + tags[i] = ot_languages3_multi_values[range.offset + i]; + *count = i; + return; + } + + if (bfind_tag (ot_languages3_blocked, ARRAY_LENGTH (ot_languages3_blocked), lang_tag)) + { + *count = 0; + return; + } + + /* Assume it's ISO-639-3 and upper-case and use it. */ + tags[0] = lang_tag & ~0x20202000u; + *count = 1; return; } +#endif } #ifndef HB_NO_LANGUAGE_LONG @@ -525,6 +600,13 @@ hb_ot_tag_to_language (hb_tag_t tag) hb_tag_to_string (ot_languages3[i].language, buf); return hb_language_from_string (buf, 3); } + for (i = 0; i < ARRAY_LENGTH (ot_languages3_multi); i++) + for (unsigned int j = 0; j < ot_languages3_multi[i].count; j++) + if (ot_languages3_multi_values[ot_languages3_multi[i].offset + j] == tag) + { + hb_tag_to_string (ot_languages3_multi[i].language, buf); + return hb_language_from_string (buf, 3); + } #endif /* Return a custom language in the form of "x-hbot-AABBCCDD". @@ -642,6 +724,23 @@ test_langs_sorted () abort(); } } + for (unsigned int i = 1; i < ARRAY_LENGTH (ot_languages3_multi); i++) + { + int c = ot_languages3_multi[i].cmp (&ot_languages3_multi[i - 1]); + if (c > 0) + { + fprintf (stderr, "ot_languages3_multi not sorted at index %u: %08x %d %08x\n", + i, ot_languages3_multi[i-1].language, c, ot_languages3_multi[i].language); + abort(); + } + } + for (unsigned int i = 1; i < ARRAY_LENGTH (ot_languages3_blocked); i++) + if (ot_languages3_blocked[i] < ot_languages3_blocked[i - 1]) + { + fprintf (stderr, "ot_languages3_blocked not sorted at index %u: %08x < %08x\n", + i, ot_languages3_blocked[i], ot_languages3_blocked[i - 1]); + abort(); + } #endif } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-common.hh index d0a4224c9b03..26c4d6cfec99 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-common.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-common.hh @@ -40,7 +40,7 @@ using rebase_tent_result_scratch_t = hb_pair_tcheck_struct (this)); } - unsigned get_size (unsigned axis_count_times_2) const + size_t get_size (unsigned axis_count_times_2) const { unsigned total_size = min_size; unsigned count = tupleVarCount.get_count (); @@ -1700,6 +1707,16 @@ struct item_variations_t const hb_map_t& get_varidx_map () const { return varidx_map; } + bool add_vardata_encoding_for_testing (hb_vector_t*> &&rows, + unsigned num_cols) + { + encodings.push (delta_row_encoding_t (std::move (rows), num_cols)); + return !encodings.in_error (); + } + + bool compile_varidx_map_for_testing (const hb_hashmap_t*>& front_mapping) + { return compile_varidx_map (front_mapping); } + bool instantiate (const ItemVariationStore& varStore, const hb_subset_plan_t *plan, bool optimize=true, @@ -2046,27 +2063,46 @@ struct item_variations_t { /* full encoding_row -> new VarIdxes mapping */ hb_hashmap_t*, unsigned> back_mapping; + hb_vector_t split_encodings; - for (unsigned major = 0; major < encodings.length; major++) + for (unsigned i = 0; i < encodings.length; i++) { - delta_row_encoding_t& encoding = encodings[major]; + delta_row_encoding_t& encoding = encodings[i]; /* just sanity check, this shouldn't happen */ if (encoding.is_empty ()) return false; unsigned num_rows = encoding.items.length; + unsigned num_cols = encoding.chars.length; /* sort rows, make result deterministic */ encoding.items.qsort (_cmp_row); - /* compile old to new var_idxes mapping */ - for (unsigned minor = 0; minor < num_rows; minor++) + for (unsigned start = 0; start < num_rows; start += 0xFFFFu) { - unsigned new_varidx = (major << 16) + minor; - back_mapping.set (encoding.items.arrayZ[minor], new_varidx); + unsigned chunk_len = hb_min (num_rows - start, 0xFFFFu); + hb_vector_t*> rows; + + if (!rows.alloc (chunk_len)) + return false; + + unsigned major = split_encodings.length; + for (unsigned minor = 0; minor < chunk_len; minor++) + { + const hb_vector_t *row = encoding.items.arrayZ[start + minor]; + rows.push (row); + if (!back_mapping.set (row, (major << 16) + minor)) + return false; + } + + split_encodings.push (delta_row_encoding_t (std::move (rows), num_cols)); } } + encodings = std::move (split_encodings); + if (encodings.in_error () || back_mapping.in_error ()) + return false; + for (auto _ : front_mapping.iter ()) { unsigned old_varidx = _.first; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh index 7c42f548456f..ec24253b429b 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh @@ -447,7 +447,7 @@ struct gvar_GVAR auto it = hb_iter (c->plan->new_to_old_gid_list); if (it->first == 0 && !(c->plan->flags & HB_SUBSET_FLAGS_NOTDEF_OUTLINE)) it++; - unsigned int subset_data_size = 0; + size_t subset_data_size = 0; unsigned padding_size = 0; for (auto &_ : it) { @@ -634,6 +634,83 @@ struct gvar_GVAR static unsigned int next_index (unsigned int i, unsigned int start, unsigned int end) { return (i >= end) ? start : (i + 1); } +#ifndef HB_OPTIMIZE_SIZE + template +#endif + static bool decompile_deltas_add_to_points (const HBUINT8 *&p /* IN/OUT */, + hb_array_t points, + float scalar, + const HBUINT8 *end, + unsigned start +#ifdef HB_OPTIMIZE_SIZE + , bool is_x +#endif + ) + { + unsigned i = 0; + unsigned count = points.length; + while (i < count) + { + if (unlikely (p + 1 > end)) return false; + unsigned control = *p++; + unsigned run_count = (control & TupleValues::VALUE_RUN_COUNT_MASK) + 1; + unsigned stop = i + run_count; + if (unlikely (stop > count)) return false; + + unsigned skip = i < start ? hb_min (start - i, run_count) : 0; + i += skip; + + switch (control & TupleValues::VALUES_SIZE_MASK) + { + case TupleValues::VALUES_ARE_ZEROS: + i = stop; + break; + case TupleValues::VALUES_ARE_WORDS: + { + if (unlikely (p + run_count * HBINT16::static_size > end)) return false; + p += skip * HBINT16::static_size; + const auto *pp = (const HBINT16 *) p; + for (; i < stop; i++) + { + float v = *pp++ * scalar; + if (is_x) points.arrayZ[i].x += v; + else points.arrayZ[i].y += v; + } + p = (const HBUINT8 *) pp; + } + break; + case TupleValues::VALUES_ARE_LONGS: + { + if (unlikely (p + run_count * HBINT32::static_size > end)) return false; + p += skip * HBINT32::static_size; + const auto *pp = (const HBINT32 *) p; + for (; i < stop; i++) + { + float v = *pp++ * scalar; + if (is_x) points.arrayZ[i].x += v; + else points.arrayZ[i].y += v; + } + p = (const HBUINT8 *) pp; + } + break; + case TupleValues::VALUES_ARE_BYTES: + { + if (unlikely (p + run_count > end)) return false; + p += skip * HBINT8::static_size; + const auto *pp = (const HBINT8 *) p; + for (; i < stop; i++) + { + float v = *pp++ * scalar; + if (is_x) points.arrayZ[i].x += v; + else points.arrayZ[i].y += v; + } + p = (const HBUINT8 *) pp; + } + break; + } + } + return true; + } public: bool apply_deltas_to_points (hb_codepoint_t glyph, hb_array_t coords, @@ -656,6 +733,9 @@ struct gvar_GVAR shared_indices, &iterator)) return true; /* so isn't applied at all */ + bool any_private_points = false; + bool private_points_checked = false; + /* Save original points for inferred delta calculation */ auto &orig_points_vec = scratch.orig_points; orig_points_vec.clear (); // Populated lazily @@ -682,6 +762,20 @@ struct gvar_GVAR gvar_cache); if (scalar == 0.f) continue; + + if (!private_points_checked) + { + auto scan = iterator; + do + { + if (scan.current_tuple->has_private_points ()) + { + any_private_points = true; + break; + } + } while (scan.move_to_next ()); + private_points_checked = true; + } const HBUINT8 *p = iterator.get_serialized_data (); unsigned int length = iterator.current_tuple->get_data_size (); if (unlikely (!iterator.var_data_bytes.check_range (p, length))) @@ -706,6 +800,19 @@ struct gvar_GVAR bool apply_to_all = (indices.length == 0); unsigned num_deltas = apply_to_all ? points.length : indices.length; unsigned start_deltas = (apply_to_all && phantom_only && num_deltas >= 4 ? num_deltas - 4 : 0); + + if (apply_to_all && !any_private_points) + { +#ifdef HB_OPTIMIZE_SIZE + if (unlikely (!decompile_deltas_add_to_points (p, points, scalar, end, start_deltas, true))) return false; + if (unlikely (!decompile_deltas_add_to_points (p, points, scalar, end, start_deltas, false))) return false; +#else + if (unlikely (!decompile_deltas_add_to_points (p, points, scalar, end, start_deltas))) return false; + if (unlikely (!decompile_deltas_add_to_points (p, points, scalar, end, start_deltas))) return false; +#endif + continue; + } + if (unlikely (!x_deltas.resize_dirty (num_deltas))) return false; if (unlikely (!GlyphVariationData::decompile_deltas (p, x_deltas, end, false, start_deltas))) return false; if (unlikely (!y_deltas.resize_dirty (num_deltas))) return false; @@ -724,8 +831,6 @@ struct gvar_GVAR { for (unsigned int i = phantom_only ? count - 4 : 0; i < count; i++) points.arrayZ[i].translate (deltas.arrayZ[i]); - flush = false; - } hb_memset (deltas.arrayZ + (phantom_only ? count - 4 : 0), 0, (phantom_only ? 4 : count) * sizeof (deltas[0])); diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-hvar-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-hvar-table.hh index 652d738e7b5e..5c0b415f4aa5 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-hvar-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-hvar-table.hh @@ -180,7 +180,7 @@ struct index_map_subset_plan_t unsigned int get_width () const { return ((outer_bit_count + inner_bit_count + 7) / 8); } unsigned int get_map_count () const { return map_count; } - unsigned int get_size () const + size_t get_size () const { return (map_count? (DeltaSetIndexMap::min_size + get_width () * map_count): 0); } bool is_identity () const { return get_output_map ().length == 0; } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-outline.hh b/src/java.desktop/share/native/libharfbuzz/hb-outline.hh index 9e394a68d9cc..e23f5afa0a84 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-outline.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-outline.hh @@ -65,7 +65,7 @@ struct hb_outline_vector_t struct hb_outline_t { - void reset () { points.shrink (0, false); contours.resize (0); } + void reset () { points.clear (); contours.clear (); } HB_INTERNAL void replay (hb_draw_funcs_t *pen, void *pen_data) const; HB_INTERNAL float control_area () const; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-paint.cc b/src/java.desktop/share/native/libharfbuzz/hb-paint.cc index 094597d6457d..56e9c0901f11 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-paint.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-paint.cc @@ -71,6 +71,15 @@ hb_paint_push_clip_rectangle_nil (hb_paint_funcs_t *funcs, void *paint_data, float xmin, float ymin, float xmax, float ymax, void *user_data) {} +static hb_draw_funcs_t * +hb_paint_push_clip_path_start_nil (hb_paint_funcs_t *funcs, void *paint_data, + void **draw_data, + void *user_data) { if (draw_data) *draw_data = nullptr; return nullptr; } + +static void +hb_paint_push_clip_path_end_nil (hb_paint_funcs_t *funcs, void *paint_data, + void *user_data) {} + static void hb_paint_pop_clip_nil (hb_paint_funcs_t *funcs, void *paint_data, void *user_data) {} @@ -118,6 +127,14 @@ static void hb_paint_push_group_nil (hb_paint_funcs_t *funcs, void *paint_data, void *user_data) {} +static void +hb_paint_push_group_for_nil (hb_paint_funcs_t *funcs, void *paint_data, + hb_paint_composite_mode_t mode, + void *user_data) +{ + hb_paint_push_group (funcs, paint_data); +} + static void hb_paint_pop_group_nil (hb_paint_funcs_t *funcs, void *paint_data, hb_paint_composite_mode_t mode, @@ -158,25 +175,25 @@ _hb_paint_funcs_set_middle (hb_paint_funcs_t *funcs, void *user_data, hb_destroy_func_t destroy) { + auto destroy_guard = hb_make_scope_guard ([&]() { + if (destroy) destroy (user_data); + }); + if (user_data && !funcs->user_data) { funcs->user_data = (decltype (funcs->user_data)) hb_calloc (1, sizeof (*funcs->user_data)); if (unlikely (!funcs->user_data)) - goto fail; + return false; } if (destroy && !funcs->destroy) { funcs->destroy = (decltype (funcs->destroy)) hb_calloc (1, sizeof (*funcs->destroy)); if (unlikely (!funcs->destroy)) - goto fail; + return false; } + destroy_guard.release (); return true; - -fail: - if (destroy) - (destroy) (user_data); - return false; } #define HB_PAINT_FUNC_IMPLEMENT(name) \ @@ -573,6 +590,71 @@ hb_paint_push_clip_rectangle (hb_paint_funcs_t *funcs, void *paint_data, funcs->push_clip_rectangle (paint_data, xmin, ymin, xmax, ymax); } +/** + * hb_paint_push_clip_path_start: + * @funcs: paint functions + * @paint_data: associated data passed by the caller + * @draw_data: (out) (nullable): location to receive the draw data + * the caller should pass alongside the returned draw funcs. + * + * Begin clipping to an arbitrary path. Returns an + * #hb_draw_funcs_t owned by the backend (the caller must not + * free it) that the caller uses to emit the clip outline via + * hb_draw_*() calls, using the returned @draw_data as the + * draw data. The returned draw funcs and draw data are only + * valid until the matching hb_paint_push_clip_path_end() call; + * no other paint calls should be made between start and end + * except hb_draw_*() on the returned funcs. Finish the path + * with hb_paint_push_clip_path_end(); pop the clip later + * with hb_paint_pop_clip(). + * + * Usage: + * + * |[ + * hb_draw_funcs_t *df = hb_paint_push_clip_path_start (pf, pd, &dd); + * hb_draw_move_to (df, dd, NULL, ...); + * hb_draw_line_to (df, dd, NULL, ...); + * ... + * hb_draw_close_path (df, dd, NULL); + * hb_paint_push_clip_path_end (pf, pd); + * /* paint ops here are clipped to the emitted path */ + * hb_paint_pop_clip (pf, pd); + * ]| + * + * Return value: (transfer none): draw funcs that accumulate + * the clip path, or `NULL` if the backend does not implement + * arbitrary-path clipping. + * + * Since: 14.2.0 + */ +hb_draw_funcs_t * +hb_paint_push_clip_path_start (hb_paint_funcs_t *funcs, + void *paint_data, + void **draw_data) +{ + void *scratch = nullptr; + if (!draw_data) draw_data = &scratch; + return funcs->push_clip_path_start (paint_data, draw_data); +} + +/** + * hb_paint_push_clip_path_end: + * @funcs: paint functions + * @paint_data: associated data passed by the caller + * + * Signal that the arbitrary-clip path started by + * hb_paint_push_clip_path_start() is fully drawn. The + * accumulated path now acts as a clip on the paint context + * until a matching hb_paint_pop_clip() call. + * + * Since: 14.2.0 + */ +void +hb_paint_push_clip_path_end (hb_paint_funcs_t *funcs, void *paint_data) +{ + funcs->push_clip_path_end (paint_data); +} + /** * hb_paint_pop_clip: * @funcs: paint functions @@ -723,6 +805,25 @@ hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data) funcs->push_group (paint_data); } +/** + * hb_paint_push_group_for: + * @funcs: paint functions + * @paint_data: associated data passed by the caller + * @mode: the compositing mode that will be used when the group is popped + * + * Perform a "push-group" paint operation, with the compositing + * mode known in advance. By default, this calls + * hb_paint_push_group(). + * + * Since: 14.2.0 + */ +void +hb_paint_push_group_for (hb_paint_funcs_t *funcs, void *paint_data, + hb_paint_composite_mode_t mode) +{ + funcs->push_group_for (paint_data, mode); +} + /** * hb_paint_pop_group: * @funcs: paint functions @@ -742,14 +843,14 @@ hb_paint_pop_group (hb_paint_funcs_t *funcs, void *paint_data, /** * hb_paint_custom_palette_color: - * @funcs: paint functions - * @paint_data: associated data passed by the caller - * @color_index: color index - * @color: (out): fetched color + * @funcs: paint functions. + * @paint_data: associated data passed by the caller. + * @color_index: color index to fetch. + * @color: (out): fetched color. * - * Gets the custom palette color for @color_index. + * Gets the custom palette override color for @color_index. * - * Return value: `true` if found, `false` otherwise + * Return value: `true` if a custom color is provided, `false` otherwise. * * Since: 7.0.0 */ @@ -761,4 +862,297 @@ hb_paint_custom_palette_color (hb_paint_funcs_t *funcs, void *paint_data, return funcs->custom_palette_color (paint_data, color_index, color); } + +/** + * hb_paint_reduce_linear_anchors: + * @x0: x coordinate of P0 (color stop 0). + * @y0: y coordinate of P0 (color stop 0). + * @x1: x coordinate of P1 (color stop 1). + * @y1: y coordinate of P1 (color stop 1). + * @x2: x coordinate of P2 (rotation reference). + * @y2: y coordinate of P2 (rotation reference). + * @xx0: (out): x coordinate of the resulting axis start. + * @yy0: (out): y coordinate of the resulting axis start. + * @xx1: (out): x coordinate of the resulting axis end. + * @yy1: (out): y coordinate of the resulting axis end. + * + * Reduces a COLRv1 linear gradient's 3-anchor spec (P0=color + * stop 0, P1=color stop 1, P2=rotation reference) to the + * 2-point axis (P0, P1') used by SVG / cairo / most software + * renderers. P1' is the foot of P1 on the line through P0 + * perpendicular to (P2 - P0); the resulting axis is the + * gradient's actual direction (perpendicular to the rotation + * line). Degenerate (P0 == P2) passes through unchanged. + * + * Since: 14.2.0 + **/ +void +hb_paint_reduce_linear_anchors (float x0, float y0, + float x1, float y1, + float x2, float y2, + float *xx0, float *yy0, + float *xx1, float *yy1) +{ + float q2x = x2 - x0, q2y = y2 - y0; + float s = q2x * q2x + q2y * q2y; + if (s < 1e-6f) + { + *xx0 = x0; *yy0 = y0; + *xx1 = x1; *yy1 = y1; + return; + } + float q1x = x1 - x0, q1y = y1 - y0; + float k = (q2x * q1x + q2y * q1y) / s; + *xx0 = x0; + *yy0 = y0; + *xx1 = x1 - k * q2x; + *yy1 = y1 - k * q2y; +} + +/** + * hb_paint_normalize_color_line: + * @stops: (array length=len) (inout): color stops. + * @len: number of stops. + * @min: (out): original minimum offset. + * @max: (out): original maximum offset. + * + * Sorts @stops by offset and rescales offsets into [0, 1] in + * place. Writes the original (min, max) to @min / @max so the + * caller can shift the gradient geometry (axis endpoints for + * linear, centers+radii for radial, start+end angles for sweep) + * to keep the rendered gradient visually unchanged after the + * rescale. Empty input is safe: both out-parameters set to 0. + * + * Since: 14.2.0 + **/ +void +hb_paint_normalize_color_line (hb_color_stop_t *stops, + unsigned int len, + float *min, + float *max) +{ + if (unlikely (!len)) + { + *min = *max = 0.f; + return; + } + + hb_array_t (stops, len) + .qsort ([] (const hb_color_stop_t &a, const hb_color_stop_t &b) { + return a.offset < b.offset; + }); + + float mn = stops[0].offset, mx = stops[0].offset; + for (unsigned i = 1; i < len; i++) + { + mn = hb_min (mn, stops[i].offset); + mx = hb_max (mx, stops[i].offset); + } + if (mn != mx) + for (unsigned i = 0; i < len; i++) + stops[i].offset = (stops[i].offset - mn) / (mx - mn); + + *min = mn; + *max = mx; +} + +/** + * hb_paint_sweep_gradient_tiles: + * @stops: (array length=n_stops) (inout): color stops (sorted, offsets in [0,1]). + * @n_stops: number of stops. + * @extend: extend mode. + * @start_angle: sweep start angle, in radians. + * @end_angle: sweep end angle, in radians. + * @emit_patch: (scope call): callback invoked once per tile. + * @user_data: data passed to @emit_patch. + * + * Iterates the full 0..2π sweep produced by a color-stop list, + * invoking @emit_patch once per (start, end) angular segment. + * Handles #HB_PAINT_EXTEND_PAD, #HB_PAINT_EXTEND_REPEAT, and + * #HB_PAINT_EXTEND_REFLECT. Stops must be pre-sorted by + * offset; use hb_paint_normalize_color_line() first if they + * aren't. + * + * Since: 14.2.0 + **/ +void +hb_paint_sweep_gradient_tiles (hb_color_stop_t *stops, + unsigned int n_stops, + hb_paint_extend_t extend, + float start_angle, + float end_angle, + hb_paint_sweep_gradient_tile_func_t emit_patch, + void *user_data) +{ + if (!n_stops) return; + + if (start_angle == end_angle) + { + if (extend == HB_PAINT_EXTEND_PAD) + { + if (start_angle > 0.f) + emit_patch (0.f, stops[0].color, start_angle, stops[0].color, user_data); + if (end_angle < HB_2_PI) + emit_patch (end_angle, stops[n_stops - 1].color, HB_2_PI, stops[n_stops - 1].color, user_data); + } + return; + } + + if (end_angle < start_angle) + { + float tmp = start_angle; start_angle = end_angle; end_angle = tmp; + for (unsigned i = 0; i < n_stops - 1 - i; i++) + { + hb_color_stop_t t = stops[i]; + stops[i] = stops[n_stops - 1 - i]; + stops[n_stops - 1 - i] = t; + } + for (unsigned i = 0; i < n_stops; i++) + stops[i].offset = 1.f - stops[i].offset; + } + + /* Map stop offsets to angles. */ + float angles_buf[16]; + hb_color_t colors_buf[16]; + float *angles = angles_buf; + hb_color_t *colors = colors_buf; + bool dynamic = false; + + if (n_stops > 16) + { + angles = (float *) hb_malloc (sizeof (float) * n_stops); + colors = (hb_color_t *) hb_malloc (sizeof (hb_color_t) * n_stops); + if (!angles || !colors) + { + hb_free (angles); + hb_free (colors); + return; + } + dynamic = true; + } + + for (unsigned i = 0; i < n_stops; i++) + { + angles[i] = start_angle + stops[i].offset * (end_angle - start_angle); + colors[i] = stops[i].color; + } + + if (extend == HB_PAINT_EXTEND_PAD) + { + unsigned pos; + hb_color_t color0 = colors[0]; + for (pos = 0; pos < n_stops; pos++) + { + if (angles[pos] >= 0) + { + if (pos > 0) + { + float f = (0.f - angles[pos - 1]) / (angles[pos] - angles[pos - 1]); + color0 = hb_color_lerp (colors[pos - 1], colors[pos], f); + } + break; + } + } + if (pos == n_stops) + { + color0 = colors[n_stops - 1]; + emit_patch (0.f, color0, HB_2_PI, color0, user_data); + goto done; + } + emit_patch (0.f, color0, angles[pos], colors[pos], user_data); + for (pos++; pos < n_stops; pos++) + { + if (angles[pos] <= HB_2_PI) + emit_patch (angles[pos - 1], colors[pos - 1], angles[pos], colors[pos], user_data); + else + { + float f = (HB_2_PI - angles[pos - 1]) / (angles[pos] - angles[pos - 1]); + hb_color_t color1 = hb_color_lerp (colors[pos - 1], colors[pos], f); + emit_patch (angles[pos - 1], colors[pos - 1], HB_2_PI, color1, user_data); + break; + } + } + if (pos == n_stops) + { + color0 = colors[n_stops - 1]; + emit_patch (angles[n_stops - 1], color0, HB_2_PI, color0, user_data); + goto done; + } + } + else + { + float span = angles[n_stops - 1] - angles[0]; + if (fabsf (span) < 1e-6f) + goto done; + + int k = 0; + if (angles[0] >= 0) + { + float ss = angles[0]; + while (ss > 0) + { + if (span > 0) { ss -= span; k--; } + else { ss += span; k++; } + } + } + else + { + float ee = angles[n_stops - 1]; + while (ee < 0) + { + if (span > 0) { ee += span; k++; } + else { ee -= span; k--; } + } + } + + span = fabsf (span); + for (int l = k; l < 1000; l++) + { + for (unsigned i = 1; i < n_stops; i++) + { + float a0_l, a1_l; + hb_color_t col0, col1; + if ((l % 2 != 0) && (extend == HB_PAINT_EXTEND_REFLECT)) + { + a0_l = angles[0] + angles[n_stops - 1] - angles[n_stops - i] + l * span; + a1_l = angles[0] + angles[n_stops - 1] - angles[n_stops - 1 - i] + l * span; + col0 = colors[n_stops - i]; + col1 = colors[n_stops - 1 - i]; + } + else + { + a0_l = angles[i - 1] + l * span; + a1_l = angles[i] + l * span; + col0 = colors[i - 1]; + col1 = colors[i]; + } + + if (a1_l < 0.f) continue; + if (a0_l < 0.f) + { + float f = (0.f - a0_l) / (a1_l - a0_l); + hb_color_t c = hb_color_lerp (col0, col1, f); + emit_patch (0.f, c, a1_l, col1, user_data); + } + else if (a1_l >= HB_2_PI) + { + float f = (HB_2_PI - a0_l) / (a1_l - a0_l); + hb_color_t c = hb_color_lerp (col0, col1, f); + emit_patch (a0_l, col0, HB_2_PI, c, user_data); + goto done; + } + else + emit_patch (a0_l, col0, a1_l, col1, user_data); + } + } + } + +done: + if (dynamic) + { + hb_free (angles); + hb_free (colors); + } +} + #endif diff --git a/src/java.desktop/share/native/libharfbuzz/hb-paint.h b/src/java.desktop/share/native/libharfbuzz/hb-paint.h index 9827a02887b2..e00d9b187328 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-paint.h +++ b/src/java.desktop/share/native/libharfbuzz/hb-paint.h @@ -30,6 +30,7 @@ #define HB_PAINT_H #include "hb-common.h" +#include "hb-draw.h" HB_BEGIN_DECLS @@ -212,6 +213,53 @@ typedef void (*hb_paint_push_clip_rectangle_func_t) (hb_paint_funcs_t *funcs, float xmax, float ymax, void *user_data); +/** + * hb_paint_push_clip_path_start_func_t: + * @funcs: paint functions object + * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() + * @draw_data: (out): location to store the draw data the caller should + * pass alongside the returned draw funcs. + * @user_data: User data pointer passed to hb_paint_funcs_set_push_clip_path_start_func() + * + * A virtual method for the #hb_paint_funcs_t to begin clipping + * to an arbitrary path. The backend returns an + * #hb_draw_funcs_t it owns (the caller must not free it) + * that the caller feeds the clip outline to via hb_draw_*() + * calls, plus a @draw_data value to pass alongside those + * calls. Both are only valid until the matching + * #hb_paint_push_clip_path_end_func_t call; no other paint + * calls should be made in between. The clip remains + * in effect until a later #hb_paint_pop_clip_func_t call. + * + * Return value: (transfer none): draw funcs that accumulate + * the clip path, or `NULL` if arbitrary-path clipping is not + * supported. + * + * Since: 14.2.0 + */ +typedef hb_draw_funcs_t * (*hb_paint_push_clip_path_start_func_t) (hb_paint_funcs_t *funcs, + void *paint_data, + void **draw_data, + void *user_data); + +/** + * hb_paint_push_clip_path_end_func_t: + * @funcs: paint functions object + * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() + * @user_data: User data pointer passed to hb_paint_funcs_set_push_clip_path_end_func() + * + * A virtual method for the #hb_paint_funcs_t to close the + * clip path started by the #hb_paint_push_clip_path_start_func_t + * vfunc. The emitted path is now active as a clip; subsequent + * paint ops are masked by it until a matching + * #hb_paint_pop_clip_func_t call. + * + * Since: 14.2.0 + */ +typedef void (*hb_paint_push_clip_path_end_func_t) (hb_paint_funcs_t *funcs, + void *paint_data, + void *user_data); + /** * hb_paint_pop_clip_func_t: * @funcs: paint functions object @@ -219,8 +267,9 @@ typedef void (*hb_paint_push_clip_rectangle_func_t) (hb_paint_funcs_t *funcs, * @user_data: User data pointer passed to hb_paint_funcs_set_pop_clip_func() * * A virtual method for the #hb_paint_funcs_t to undo - * the effect of a prior call to the #hb_paint_funcs_push_clip_glyph_func_t - * or #hb_paint_funcs_push_clip_rectangle_func_t vfuncs. + * the effect of a prior call to the #hb_paint_funcs_push_clip_glyph_func_t, + * #hb_paint_funcs_push_clip_rectangle_func_t, or + * #hb_paint_funcs_push_clip_path_end_func_t vfuncs. * * Since: 7.0.0 */ @@ -239,6 +288,23 @@ typedef void (*hb_paint_pop_clip_func_t) (hb_paint_funcs_t *funcs, * A virtual method for the #hb_paint_funcs_t to paint a * color everywhere within the current clip. * + * When @is_foreground is true, this color originates from the + * foreground-color sentinel in the font's color data. The + * @color parameter still carries a fully resolved RGBA value + * (with any paint-tree alpha already applied), so backends + * that do not need to distinguish the foreground can simply + * use @color directly. + * + * Backends that defer foreground resolution (e.g. to honor a + * CSS `currentColor` or a runtime uniform) should substitute + * their own foreground RGB when @is_foreground is true, but + * must combine the alpha from @color with their foreground + * alpha, since it encodes additional modulation from the + * paint tree. For this mode to work correctly, the caller + * should pass a fully-opaque foreground color to + * hb_font_paint_glyph(), so that the alpha in @color + * reflects only the paint-tree contribution. + * * Since: 7.0.0 */ typedef void (*hb_paint_color_func_t) (hb_paint_funcs_t *funcs, @@ -322,6 +388,9 @@ typedef hb_bool_t (*hb_paint_image_func_t) (hb_paint_funcs_t *funcs, * Color lines typically have offsets ranging between 0 and 1, * but that is not required. * + * The @is_foreground and @color fields have the same semantics + * as in #hb_paint_color_func_t. + * * Note: despite @color being unpremultiplied here, interpolation in * gradients shall happen in premultiplied space. See the OpenType spec * [COLR](https://learn.microsoft.com/en-us/typography/opentype/spec/colr) @@ -660,6 +729,28 @@ typedef void (*hb_paint_push_group_func_t) (hb_paint_funcs_t *funcs, void *paint_data, void *user_data); +/** + * hb_paint_push_group_for_func_t: + * @funcs: paint functions object + * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() + * @mode: the compositing mode that will be used when the group is popped + * @user_data: User data pointer passed to hb_paint_funcs_set_push_group_for_func() + * + * A virtual method for the #hb_paint_funcs_t to use + * an intermediate surface for subsequent paint calls, + * with the compositing mode known in advance. + * + * This is like #hb_paint_push_group_func_t, but the + * compositing mode is provided at push time. By default + * this calls #hb_paint_push_group_func_t. + * + * Since: 14.2.0 + */ +typedef void (*hb_paint_push_group_for_func_t) (hb_paint_funcs_t *funcs, + void *paint_data, + hb_paint_composite_mode_t mode, + void *user_data); + /** * hb_paint_pop_group_func_t: * @funcs: paint functions object @@ -684,23 +775,24 @@ typedef void (*hb_paint_pop_group_func_t) (hb_paint_funcs_t *funcs, /** * hb_paint_custom_palette_color_func_t: - * @funcs: paint functions object - * @paint_data: The data accompanying the paint functions in hb_font_paint_glyph() - * @color_index: the color index - * @color: (out): fetched color - * @user_data: User data pointer passed to hb_paint_funcs_set_pop_group_func() + * @funcs: paint functions object. + * @paint_data: data accompanying the paint functions in hb_font_paint_glyph(). + * @color_index: color index to fetch. + * @color: (out): fetched color. + * @user_data: user data pointer passed to hb_paint_funcs_set_custom_palette_color_func(). * - * A virtual method for the #hb_paint_funcs_t to fetch a color from the custom - * color palette. + * A virtual method for #hb_paint_funcs_t to fetch a custom palette override + * color for @color_index. * - * Custom palette colors override the colors from the fonts selected color - * palette. It is not necessary to override all palette entries; for entries - * that should be taken from the font palette, return `false`. + * Custom palette colors override colors from the font's selected color palette. + * It is not necessary to override all palette entries; return `false` for + * entries that should be taken from the font palette. * - * This function might get called multiple times, but the custom palette is - * expected to remain unchanged for duration of a hb_font_paint_glyph() call. + * This function might be called multiple times, but the custom palette is + * expected to remain unchanged for the duration of one + * hb_font_paint_glyph() call. * - * Return value: `true` if found, `false` otherwise + * Return value: `true` if a custom color is provided, `false` otherwise. * * Since: 7.0.0 */ @@ -796,6 +888,40 @@ hb_paint_funcs_set_push_clip_rectangle_func (hb_paint_funcs_t void *user_data, hb_destroy_func_t destroy); +/** + * hb_paint_funcs_set_push_clip_path_start_func: + * @funcs: A paint functions struct + * @func: (closure user_data) (destroy destroy) (scope notified): The push-clip-path-start callback + * @user_data: Data to pass to @func + * @destroy: (nullable): Function to call when @user_data is no longer needed + * + * Sets the push-clip-path-start callback on the paint functions struct. + * + * Since: 14.2.0 + */ +HB_EXTERN void +hb_paint_funcs_set_push_clip_path_start_func (hb_paint_funcs_t *funcs, + hb_paint_push_clip_path_start_func_t func, + void *user_data, + hb_destroy_func_t destroy); + +/** + * hb_paint_funcs_set_push_clip_path_end_func: + * @funcs: A paint functions struct + * @func: (closure user_data) (destroy destroy) (scope notified): The push-clip-path-end callback + * @user_data: Data to pass to @func + * @destroy: (nullable): Function to call when @user_data is no longer needed + * + * Sets the push-clip-path-end callback on the paint functions struct. + * + * Since: 14.2.0 + */ +HB_EXTERN void +hb_paint_funcs_set_push_clip_path_end_func (hb_paint_funcs_t *funcs, + hb_paint_push_clip_path_end_func_t func, + void *user_data, + hb_destroy_func_t destroy); + /** * hb_paint_funcs_set_pop_clip_func: * @funcs: A paint functions struct @@ -915,6 +1041,23 @@ hb_paint_funcs_set_push_group_func (hb_paint_funcs_t *funcs, void *user_data, hb_destroy_func_t destroy); +/** + * hb_paint_funcs_set_push_group_for_func: + * @funcs: A paint functions struct + * @func: (closure user_data) (destroy destroy) (scope notified): The push-group-for callback + * @user_data: Data to pass to @func + * @destroy: (nullable): Function to call when @user_data is no longer needed + * + * Sets the push-group-for callback on the paint functions struct. + * + * Since: 14.2.0 + */ +HB_EXTERN void +hb_paint_funcs_set_push_group_for_func (hb_paint_funcs_t *funcs, + hb_paint_push_group_for_func_t func, + void *user_data, + hb_destroy_func_t destroy); + /** * hb_paint_funcs_set_pop_group_func: * @funcs: A paint functions struct @@ -934,12 +1077,12 @@ hb_paint_funcs_set_pop_group_func (hb_paint_funcs_t *funcs, /** * hb_paint_funcs_set_custom_palette_color_func: - * @funcs: A paint functions struct - * @func: (closure user_data) (destroy destroy) (scope notified): The custom-palette-color callback - * @user_data: Data to pass to @func - * @destroy: (nullable): Function to call when @user_data is no longer needed + * @funcs: a paint functions struct. + * @func: (closure user_data) (destroy destroy) (scope notified): custom-palette-color callback. + * @user_data: data to pass to @func. + * @destroy: (nullable): function to call when @user_data is no longer needed. * - * Sets the custom-palette-color callback on the paint functions struct. + * Sets the custom-palette-color callback on @funcs. * * Since: 7.0.0 */ @@ -984,6 +1127,15 @@ hb_paint_push_clip_rectangle (hb_paint_funcs_t *funcs, void *paint_data, float xmin, float ymin, float xmax, float ymax); +HB_EXTERN hb_draw_funcs_t * +hb_paint_push_clip_path_start (hb_paint_funcs_t *funcs, + void *paint_data, + void **draw_data); + +HB_EXTERN void +hb_paint_push_clip_path_end (hb_paint_funcs_t *funcs, + void *paint_data); + HB_EXTERN void hb_paint_pop_clip (hb_paint_funcs_t *funcs, void *paint_data); @@ -1025,6 +1177,10 @@ hb_paint_sweep_gradient (hb_paint_funcs_t *funcs, void *paint_data, HB_EXTERN void hb_paint_push_group (hb_paint_funcs_t *funcs, void *paint_data); +HB_EXTERN void +hb_paint_push_group_for (hb_paint_funcs_t *funcs, void *paint_data, + hb_paint_composite_mode_t mode); + HB_EXTERN void hb_paint_pop_group (hb_paint_funcs_t *funcs, void *paint_data, hb_paint_composite_mode_t mode); @@ -1034,6 +1190,58 @@ hb_paint_custom_palette_color (hb_paint_funcs_t *funcs, void *paint_data, unsigned int color_index, hb_color_t *color); + +/* + * Gradient helpers for paint backends. + * + * These are small, self-contained utilities that every COLRv1 + * renderer ends up reinventing. Exposed here so third-party + * paint backends can consume a single canonical implementation + * instead of forking one per project. + */ + +HB_EXTERN void +hb_paint_reduce_linear_anchors (float x0, float y0, + float x1, float y1, + float x2, float y2, + float *xx0, float *yy0, + float *xx1, float *yy1); + +HB_EXTERN void +hb_paint_normalize_color_line (hb_color_stop_t *stops, + unsigned int len, + float *min, + float *max); + +/** + * hb_paint_sweep_gradient_tile_func_t: + * @a0: segment start angle, in radians. + * @c0: segment start color. + * @a1: segment end angle, in radians. + * @c1: segment end color. + * @user_data: user data passed to hb_paint_sweep_gradient_tiles(). + * + * Callback invoked once per (a0, a1) sector of a sweep + * gradient tiling. See hb_paint_sweep_gradient_tiles(). + * + * Since: 14.2.0 + **/ +typedef void (*hb_paint_sweep_gradient_tile_func_t) (float a0, + hb_color_t c0, + float a1, + hb_color_t c1, + void *user_data); + +HB_EXTERN void +hb_paint_sweep_gradient_tiles (hb_color_stop_t *stops, + unsigned int n_stops, + hb_paint_extend_t extend, + float start_angle, + float end_angle, + hb_paint_sweep_gradient_tile_func_t emit_patch, + void *user_data); + + HB_END_DECLS #endif /* HB_PAINT_H */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-paint.hh b/src/java.desktop/share/native/libharfbuzz/hb-paint.hh index aedbcbdcbe22..df37e8bf6e98 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-paint.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-paint.hh @@ -36,6 +36,8 @@ HB_PAINT_FUNC_IMPLEMENT (color_glyph) \ HB_PAINT_FUNC_IMPLEMENT (push_clip_glyph) \ HB_PAINT_FUNC_IMPLEMENT (push_clip_rectangle) \ + HB_PAINT_FUNC_IMPLEMENT (push_clip_path_start) \ + HB_PAINT_FUNC_IMPLEMENT (push_clip_path_end) \ HB_PAINT_FUNC_IMPLEMENT (pop_clip) \ HB_PAINT_FUNC_IMPLEMENT (color) \ HB_PAINT_FUNC_IMPLEMENT (image) \ @@ -43,6 +45,7 @@ HB_PAINT_FUNC_IMPLEMENT (radial_gradient) \ HB_PAINT_FUNC_IMPLEMENT (sweep_gradient) \ HB_PAINT_FUNC_IMPLEMENT (push_group) \ + HB_PAINT_FUNC_IMPLEMENT (push_group_for) \ HB_PAINT_FUNC_IMPLEMENT (pop_group) \ HB_PAINT_FUNC_IMPLEMENT (custom_palette_color) \ /* ^--- Add new callbacks here */ @@ -102,6 +105,13 @@ struct hb_paint_funcs_t { func.push_clip_rectangle (this, paint_data, xmin, ymin, xmax, ymax, !user_data ? nullptr : user_data->push_clip_rectangle); } + hb_draw_funcs_t *push_clip_path_start (void *paint_data, + void **draw_data) + { return func.push_clip_path_start (this, paint_data, draw_data, + !user_data ? nullptr : user_data->push_clip_path_start); } + void push_clip_path_end (void *paint_data) + { func.push_clip_path_end (this, paint_data, + !user_data ? nullptr : user_data->push_clip_path_end); } void pop_clip (void *paint_data) { func.pop_clip (this, paint_data, !user_data ? nullptr : user_data->pop_clip); } @@ -146,6 +156,11 @@ struct hb_paint_funcs_t void push_group (void *paint_data) { func.push_group (this, paint_data, !user_data ? nullptr : user_data->push_group); } + void push_group_for (void *paint_data, + hb_paint_composite_mode_t mode) + { func.push_group_for (this, paint_data, + mode, + !user_data ? nullptr : user_data->push_group_for); } void pop_group (void *paint_data, hb_paint_composite_mode_t mode) { func.pop_group (this, paint_data, @@ -245,4 +260,17 @@ struct hb_paint_funcs_t DECLARE_NULL_INSTANCE (hb_paint_funcs_t); +/* Linearly interpolate between two hb_color_t values, component-wise, + * in byte-channel space with rounding. */ +static inline hb_color_t +hb_color_lerp (hb_color_t c0, hb_color_t c1, float t) +{ + auto lerp = [&] (unsigned shift) -> unsigned { + unsigned v0 = (c0 >> shift) & 0xFF; + unsigned v1 = (c1 >> shift) & 0xFF; + return (unsigned) (v0 + t * ((float) v1 - (float) v0) + 0.5f); + }; + return HB_COLOR (lerp (0), lerp (8), lerp (16), lerp (24)); +} + #endif /* HB_PAINT_HH */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-priority-queue.hh b/src/java.desktop/share/native/libharfbuzz/hb-priority-queue.hh index 753e86b8ca65..8c32dabdd283 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-priority-queue.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-priority-queue.hh @@ -61,7 +61,7 @@ struct hb_priority_queue_t bubble_down (i); } - void reset () { heap.resize (0); } + void reset () { heap.clear (); } bool in_error () const { return heap.in_error (); } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-repacker.hh b/src/java.desktop/share/native/libharfbuzz/hb-repacker.hh index 7d118b521698..b5dfae19960c 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-repacker.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-repacker.hh @@ -389,20 +389,21 @@ hb_resolve_graph_overflows (hb_tag_t table_tag, } unsigned round = 0; + unsigned total_iterations = 0; hb_vector_t overflows; // TODO(garretrieger): select a good limit for max rounds. while (!sorted_graph.in_error () && graph::will_overflow (sorted_graph, &overflows) - && round < max_rounds) { + && round < max_rounds + && total_iterations < HB_REPACKER_MAX_ITERATIONS) { DEBUG_MSG (SUBSET_REPACK, nullptr, "=== Overflow resolution round %u ===", round); print_overflows (sorted_graph, overflows); + total_iterations++; hb_set_t priority_bumped_parents; if (!_try_isolating_subgraphs (overflows, sorted_graph)) { - // Don't count space isolation towards round limit. Only increment - // round counter if space isolation made no changes. round++; if (!_process_overflows (overflows, priority_bumped_parents, sorted_graph)) { diff --git a/src/java.desktop/share/native/libharfbuzz/hb-static.cc b/src/java.desktop/share/native/libharfbuzz/hb-static.cc index 06cc80b5f383..78713b220490 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-static.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-static.cc @@ -24,6 +24,10 @@ * Google Author(s): Behdad Esfahbod */ +#ifndef HB_STATIC_CC +#define HB_STATIC_CC +#ifdef HB_STATIC_CC /* Pacify -Wunused-macros. */ + #include "hb.hh" #include "hb-open-type.hh" @@ -114,3 +118,6 @@ hb_face_t::load_upem () const } #endif + +#endif /* HB_STATIC_CC pacify */ +#endif /* HB_STATIC_CC guard */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.cc index 41b123609a99..e6d3ecccdbe5 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.cc @@ -68,7 +68,6 @@ hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan, /* use hb_set to determine the subset of font dicts */ hb_set_t set; hb_codepoint_t prev_fd = CFF_UNDEF_CODE; - hb_pair_t last_range {0, 0}; auto it = hb_iter (plan->new_to_old_gid_list); auto _ = *it; for (hb_codepoint_t gid = 0; gid < subset_num_glyphs; gid++) @@ -84,9 +83,8 @@ hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan, /* fonttools retains FDSelect & font dicts for missing glyphs. do the same */ old_glyph = gid; } - if (old_glyph >= last_range.second) - last_range = src.get_fd_range (old_glyph); - unsigned fd = last_range.first; + auto fd_range = src.get_fd_range (old_glyph); + unsigned fd = fd_range.first; if (fd != prev_fd) { @@ -96,7 +94,7 @@ hb_plan_subset_cff_fdselect (const hb_subset_plan_t *plan, fdselect_ranges.push (code_pair_t { fd, gid }); if (gid == old_glyph) - gid = hb_min (_.first - 1, last_range.second - 1); + gid = hb_min (_.first - 1, fd_range.second - 1); } } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.hh index 843ad69f2f91..518b35466fff 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.hh @@ -321,11 +321,31 @@ struct cff_font_dict_op_serializer_t : op_serializer_t } }; +/* CharString command for specialization */ +struct cs_command_t +{ + hb_vector_t args; + hb_vector_t mask_bytes; /* For hintmask/cntrmask payload bytes. */ + op_code_t op; + + cs_command_t () : op (OpCode_Invalid) {} + cs_command_t (op_code_t op_) : op (op_) {} +}; + +typedef hb_vector_t *cs_command_vec_t; + struct flatten_param_t { + flatten_param_t (str_buff_t &flatStr_, + bool drop_hints_, + const hb_subset_plan_t *plan_, + cs_command_vec_t commands_ = nullptr) + : flatStr (flatStr_), drop_hints (drop_hints_), plan (plan_), commands (commands_) {} + str_buff_t &flatStr; bool drop_hints; const hb_subset_plan_t *plan; + cs_command_vec_t commands; /* Optional: capture parsed commands for specialization */ }; template @@ -335,7 +355,8 @@ struct subr_flattener_t const hb_subset_plan_t *plan_) : acc (acc_), plan (plan_) {} - bool flatten (str_buff_vec_t &flat_charstrings) + bool flatten (str_buff_vec_t &flat_charstrings, + hb_vector_t> *command_capture = nullptr) { unsigned count = plan->num_output_glyphs (); if (!flat_charstrings.resize_exact (count)) @@ -361,7 +382,8 @@ struct subr_flattener_t flatten_param_t param = { flat_charstrings.arrayZ[i], (bool) (plan->flags & HB_SUBSET_FLAGS_NO_HINTING), - plan + plan, + command_capture ? &(*command_capture)[i] : nullptr }; if (unlikely (!interp.interpret (param))) return false; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff1.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff1.cc index 4938c048d6d4..558b61121a78 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff1.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff1.cc @@ -431,7 +431,8 @@ struct cff1_subset_plan unsigned code, last_code = CFF_UNDEF_CODE - 1; hb_vector_t supp_codes; - if (unlikely (!subset_enc_code_ranges.resize (0))) + subset_enc_code_ranges.clear (); + if (unlikely (subset_enc_code_ranges.in_error ())) { plan->check_success (false); return; @@ -496,7 +497,8 @@ struct cff1_subset_plan unsigned int size0, size_ranges; unsigned last_sid = CFF_UNDEF_CODE - 1; - if (unlikely (!subset_charset_ranges.resize (0))) + subset_charset_ranges.clear (); + if (unlikely (subset_charset_ranges.in_error ())) { plan->check_success (false); return false; diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff2.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff2.cc index 1074d2403865..cce15bafe90e 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff2.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff2.cc @@ -34,6 +34,7 @@ #include "hb-subset-plan.hh" #include "hb-subset-cff-common.hh" #include "hb-cff2-interp-cs.hh" +#include "hb-subset-cff2-to-cff1.hh" using namespace CFF; @@ -73,6 +74,56 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t &env, flatten_param_t& param) { + /* Optionally capture command for specialization (before flushing, to preserve args) */ + if (param.commands) + { + bool skip_command = false; + + switch (op) + { + case OpCode_return: + case OpCode_endchar: + skip_command = true; + break; + + case OpCode_hstem: + case OpCode_hstemhm: + case OpCode_vstem: + case OpCode_vstemhm: + case OpCode_hintmask: + case OpCode_cntrmask: + if (param.drop_hints) + skip_command = true; + break; + + default: + break; + } + + if (!skip_command) + { + cs_command_t cmd (op); + /* Capture resolved blend values */ + for (unsigned int i = 0; i < env.argStack.get_count ();) + { + const blend_arg_t &arg = env.argStack[i]; + if (arg.blending ()) + { + /* For blend args, capture only the resolved default value */ + cmd.args.push (arg); + /* Skip over the multiple blend values */ + i += arg.numValues; + } + else + { + cmd.args.push (arg); + i++; + } + } + param.commands->push (cmd); + } + } + switch (op) { case OpCode_return: @@ -167,6 +218,22 @@ struct cff2_cs_opset_flatten_t : cff2_cs_opset_t &env, flatten_param_t& param) { SUPER::flush_hintmask (op, env, param); + /* Preserve hintmask payload in captured commands for specializer re-encoding. */ + if (param.commands && !param.drop_hints && param.commands->length > 0) + { + auto &cmd = param.commands->tail (); + if (cmd.op == op) + { + cmd.mask_bytes.resize (env.hintmask_size); + if (unlikely (cmd.mask_bytes.in_error ())) + { + env.set_error (); + return; + } + for (unsigned int i = 0; i < env.hintmask_size; i++) + cmd.mask_bytes[i] = env.str_ref[i]; + } + } if (!param.drop_hints) { str_encoder_t encoder (param.flatStr); @@ -436,9 +503,15 @@ struct cff2_subset_plan drop_hints = plan->flags & HB_SUBSET_FLAGS_NO_HINTING; pinned = (bool) plan->normalized_coords; + normalized_coords = plan->normalized_coords; + head_maxp_info = plan->head_maxp_info; + hmtx_map = &plan->hmtx_map; desubroutinize = plan->flags & HB_SUBSET_FLAGS_DESUBROUTINIZE || pinned; // For instancing we need this path + /* Enable command capture for CFF2→CFF1 conversion (for specialization) */ + capture_commands = pinned; + #ifdef HB_EXPERIMENTAL_API min_charstrings_off_size = (plan->flags & HB_SUBSET_FLAGS_IFTB_REQUIREMENTS) ? 4 : 0; #else @@ -450,8 +523,21 @@ struct cff2_subset_plan /* Flatten global & local subrs */ subr_flattener_t, cff2_cs_opset_flatten_t> flattener(acc, plan); - if (!flattener.flatten (subset_charstrings)) - return false; + + /* Enable command capture if requested (for specialization) */ + if (capture_commands) + { + if (!charstring_commands.resize_exact (num_glyphs)) + return false; + + if (!flattener.flatten (subset_charstrings, &charstring_commands)) + return false; + } + else + { + if (!flattener.flatten (subset_charstrings)) + return false; + } } else { @@ -518,9 +604,483 @@ struct cff2_subset_plan bool desubroutinize = false; unsigned min_charstrings_off_size = 0; + + hb_array_t normalized_coords; // For instantiation + head_maxp_info_t head_maxp_info; // For FontBBox + const hb_hashmap_t> *hmtx_map; // For widths + + // Width optimization results (for CFF1 conversion) + unsigned default_width = 0; + unsigned nominal_width = 0; + + // Command capture for specialization (CFF2→CFF1 conversion) + bool capture_commands = false; + hb_vector_t> charstring_commands; }; } // namespace OT +/* + * CFF2 to CFF1 Converter Implementation + */ + +#include "hb-cff-width-optimizer.hh" +#include "hb-cff-specializer.hh" + +/* Serialize charstrings using CFF1 format with widths */ +static bool +_serialize_cff1_charstrings (hb_serialize_context_t *c, + OT::cff2_subset_plan &plan, + unsigned default_width, + unsigned nominal_width) +{ + c->push (); + + // CFF1 requires: + // 1. Width at the beginning (if != defaultWidthX) + // 2. endchar at the end + str_buff_vec_t cff1_charstrings; + if (unlikely (!cff1_charstrings.resize (plan.subset_charstrings.length))) + { + c->pop_discard (); + return false; + } + + for (unsigned i = 0; i < plan.subset_charstrings.length; i++) + { + // Get width for this glyph from hmtx_map + unsigned width = 0; + if (plan.hmtx_map->has (i)) + width = plan.hmtx_map->get (i).first; + + // Encode width if different from default + str_encoder_t encoder (cff1_charstrings[i]); + if (width != default_width) + { + int delta = (int) width - (int) nominal_width; + encoder.encode_int (delta); + } + + // Use specialized commands if available, otherwise use binary + if (plan.capture_commands && i < plan.charstring_commands.length && + plan.charstring_commands[i].length > 0) + { + // Specialize and encode commands + auto &commands = plan.charstring_commands[i]; + CFF::specialize_commands (commands, 48); /* maxstack=48 for CFF1 */ + if (unlikely (!CFF::encode_commands (commands, cff1_charstrings[i]))) + { + c->pop_discard (); + return false; + } + } + else + { + // Use binary CharString + const str_buff_t &cs = plan.subset_charstrings[i]; + for (unsigned j = 0; j < cs.length; j++) + cff1_charstrings[i].push (cs[j]); + } + + // Check if it already ends with endchar (0x0e) or return (0x0b) + if (cff1_charstrings[i].length == 0 || + (cff1_charstrings[i].tail () != 0x0e && cff1_charstrings[i].tail () != 0x0b)) + { + // Append endchar operator + if (unlikely (!cff1_charstrings[i].push_or_fail (0x0e))) + { + c->pop_discard (); + return false; + } + } + } + + unsigned data_size = 0; + unsigned total_size = CFF1CharStrings::total_size (cff1_charstrings, &data_size); + if (unlikely (!c->start_zerocopy (total_size))) + { + c->pop_discard (); + return false; + } + + auto *cs = c->start_embed (); + if (unlikely (!cs->serialize (c, cff1_charstrings))) + { + c->pop_discard (); + return false; + } + + plan.info.char_strings_link = c->pop_pack (false); + return true; +} + +/* Serialize CID Charset (format 2 range: gid 0-N -> cid 0-N) */ +static bool +_serialize_cff1_charset (hb_serialize_context_t *c, + unsigned int num_glyphs, + objidx_t &charset_link) +{ + // For CID fonts, create a simple identity charset + // Format 2: one range covering all glyphs (except .notdef) + c->push (); + + auto *charset = c->start_embed (); + if (unlikely (!charset)) + { + c->pop_discard (); + return false; + } + + // Create a single range for CID 1 to num_glyphs-1 + hb_vector_t ranges; + if (num_glyphs > 1) + { + code_pair_t range; + range.code = 1; // first CID + range.glyph = num_glyphs - 2; // nLeft (covers glyphs 1 to num_glyphs-1) + ranges.push (range); + } + + if (unlikely (!charset->serialize (c, 2, num_glyphs, ranges))) + { + c->pop_discard (); + return false; + } + + charset_link = c->pop_pack (); + return true; +} + +/* CFF2 to CFF1 serialization */ +namespace CFF { + +bool +serialize_cff2_to_cff1 (hb_serialize_context_t *c, + OT::cff2_subset_plan &plan, + const cff2_top_dict_values_t &cff2_topDict, + const OT::cff2::accelerator_subset_t &acc) +{ + TRACE_SERIALIZE (this); + + /* + * CFF1 Serialization Order (reverse, as HarfBuzz packs from end): + * 1. CharStrings + * 2. Private DICs & Local Subrs + * 3. FDArray + * 4. FDSelect + * 5. Charset + * 6. Global Subrs + * 7. String INDEX + * 8. Top DICT INDEX + * 9. Name INDEX + * 10. Header + */ + + // 0. Optimize width encoding (for all FDs) + { + // Collect widths from hmtx_map + hb_vector_t widths; + widths.alloc (plan.num_glyphs); + + for (unsigned gid = 0; gid < plan.num_glyphs; gid++) + { + unsigned width = 0; + if (plan.hmtx_map->has (gid)) + width = plan.hmtx_map->get (gid).first; + widths.push (width); + } + + // Optimize defaultWidthX and nominalWidthX + CFF::optimize_widths (widths, plan.default_width, plan.nominal_width); + } + + // 1. CharStrings (with widths prepended) + if (!_serialize_cff1_charstrings (c, plan, plan.default_width, plan.nominal_width)) + return_trace (false); + + // 2. Private DICs & Local Subrs (same as CFF2) + hb_vector_t private_dict_infos; + if (unlikely (!private_dict_infos.resize (plan.subset_fdcount))) + return_trace (false); + + for (int i = (int)acc.privateDicts.length; --i >= 0;) + { + if (plan.fdmap.has (i)) + { + objidx_t subrs_link = 0; + + if (plan.subset_localsubrs[i].length > 0) + { + auto *dest = c->push (); + if (likely (dest->serialize (c, plan.subset_localsubrs[i]))) + subrs_link = c->pop_pack (false); + else + { + c->pop_discard (); + return_trace (false); + } + } + + auto *pd = c->push (); + // Use the CFF2 Private DICT serializer which instantiates blends when pinned=true + cff2_private_dict_op_serializer_t privSzr (plan.desubroutinize, plan.drop_hints, plan.pinned, + acc.varStore, plan.normalized_coords); + if (likely (pd->serialize (c, acc.privateDicts[i], privSzr, subrs_link))) + { + // Add defaultWidthX and nominalWidthX for CFF1 + str_buff_t width_ops; + str_encoder_t encoder (width_ops); + encoder.encode_int (plan.default_width); + encoder.encode_op (OpCode_defaultWidthX); + encoder.encode_int (plan.nominal_width); + encoder.encode_op (OpCode_nominalWidthX); + + if (!encoder.in_error () && c->embed (width_ops.as_bytes ().arrayZ, width_ops.length)) + { + unsigned fd = plan.fdmap[i]; + private_dict_infos[fd].size = c->length (); + private_dict_infos[fd].link = c->pop_pack (); + } + else + { + c->pop_discard (); + return_trace (false); + } + } + else + { + c->pop_discard (); + return_trace (false); + } + } + } + + // 3. FDArray - serialize CFF2 font dicts as CFF1 + { + auto *fda = c->push> (); + cff_font_dict_op_serializer_t fontSzr; + auto it = + + hb_zip (+ hb_iter (acc.fontDicts) + | hb_filter ([&] (const cff2_font_dict_values_t &_) + { return plan.fdmap.has (&_ - &acc.fontDicts[0]); }), + hb_iter (private_dict_infos)) + ; + // Explicitly specify template parameters: DICTVAL, INFO + bool success = fda->serialize (c, it, fontSzr); + if (success) + plan.info.fd_array_link = c->pop_pack (false); + else + { + c->pop_discard (); + return_trace (false); + } + } + + // 4. FDSelect (required in CFF1 CID-keyed fonts) + // CFF1 requires FDSelect for all CID-keyed fonts, even with just one FD + // CFF2 makes it optional when there's only one FD + if (acc.fdSelect != &Null (CFF2FDSelect)) + { + c->push (); + if (likely (hb_serialize_cff_fdselect (c, plan.num_glyphs, + *(const FDSelect *)acc.fdSelect, + plan.orig_fdcount, + plan.subset_fdselect_format, + plan.subset_fdselect_size, + plan.subset_fdselect_ranges))) + plan.info.fd_select.link = c->pop_pack (); + else + { + c->pop_discard (); + return_trace (false); + } + } + else + { + // Create a range-based FDSelect3 mapping all glyphs to FD 0 + // Format: format(1) + nRanges(2) + range(3) + sentinel(2) = 8 bytes + c->push (); + + // Format byte + HBUINT8 format; + format = 3; + if (unlikely (!c->embed (format))) + { + c->pop_discard (); + return_trace (false); + } + + // nRanges + HBUINT16 nRanges; + nRanges = 1; + if (unlikely (!c->embed (nRanges))) + { + c->pop_discard (); + return_trace (false); + } + + // Single range: {first: 0, fd: 0} + FDSelect3_Range range; + range.first = 0; + range.fd = 0; + if (unlikely (!c->embed (range))) + { + c->pop_discard (); + return_trace (false); + } + + // Sentinel (number of glyphs) + HBUINT16 sentinel; + sentinel = plan.num_glyphs; + if (unlikely (!c->embed (sentinel))) + { + c->pop_discard (); + return_trace (false); + } + + plan.info.fd_select.link = c->pop_pack (); + } + + // 5. Charset (CID charset for identity mapping) + objidx_t charset_link; + if (!_serialize_cff1_charset (c, plan.num_glyphs, charset_link)) + return_trace (false); + + // 6. Global Subrs + { + auto *dest = c->push (); + if (likely (dest->serialize (c, plan.subset_globalsubrs))) + c->pop_pack (false); + else + { + c->pop_discard (); + return_trace (false); + } + } + + // 7. String INDEX - Add "Adobe" and "Identity" for ROS operator + { + const char *adobe_str = "Adobe"; + const char *identity_str = "Identity"; + unsigned adobe_len = 5; // strlen("Adobe") + unsigned identity_len = 8; // strlen("Identity") + + // Build strings array + hb_vector_t strings; + strings.alloc (2); + strings.push (hb_ubytes_t ((const unsigned char *) adobe_str, adobe_len)); + strings.push (hb_ubytes_t ((const unsigned char *) identity_str, identity_len)); + + // Serialize as CFF INDEX + auto *dest = c->push (); + if (likely (dest->serialize (c, strings))) + c->pop_pack (false); + else + { + c->pop_discard (); + return_trace (false); + } + } + + // 8. CFF Header + OT::cff1 *cff = c->allocate_min (); + if (unlikely (!cff)) return_trace (false); + + /* header */ + cff->version.major = 0x01; + cff->version.minor = 0x00; + cff->nameIndex = cff->min_size; + cff->offSize = 4; /* unused? */ + + // 9. Name INDEX (single entry) + { + unsigned name_len = strlen (CFF1_DEFAULT_FONT_NAME); + + CFF1Index *idx = c->start_embed (); + if (unlikely (!idx)) return_trace (false); + + if (unlikely (!idx->serialize_header (c, hb_iter (&name_len, 1), name_len))) + return_trace (false); + + if (unlikely (!c->embed (CFF1_DEFAULT_FONT_NAME, name_len))) + return_trace (false); + } + + // 10. Top DICT INDEX + { + // Serialize the Top DICT data first + c->push (); + cff1_from_cff2_top_dict_op_serializer_t topSzr; + + // Serialize ROS first + if (unlikely (!topSzr.serialize_ros (c))) + { + c->pop_discard (); + return_trace (false); + } + + // Serialize FontBBox from head table + { + str_buff_t bbox_buff; + str_encoder_t encoder (bbox_buff); + + encoder.encode_int (plan.head_maxp_info.xMin); + encoder.encode_int (plan.head_maxp_info.yMin); + encoder.encode_int (plan.head_maxp_info.xMax); + encoder.encode_int (plan.head_maxp_info.yMax); + encoder.encode_op (OpCode_FontBBox); + + if (encoder.in_error () || !c->embed (bbox_buff.as_bytes ().arrayZ, bbox_buff.length)) + { + c->pop_discard (); + return_trace (false); + } + } + + // Serialize charset operator + if (charset_link && unlikely (!FontDict::serialize_link4_op (c, OpCode_charset, charset_link, whence_t::Absolute))) + { + c->pop_discard (); + return_trace (false); + } + + // Serialize FDSelect operator (required for CID-keyed CFF1 fonts) + if (plan.info.fd_select.link && unlikely (!FontDict::serialize_link4_op (c, OpCode_FDSelect, plan.info.fd_select.link, whence_t::Absolute))) + { + c->pop_discard (); + return_trace (false); + } + + // Serialize FDArray operator (required for CID-keyed CFF1 fonts) + if (plan.info.fd_array_link && unlikely (!FontDict::serialize_link4_op (c, OpCode_FDArray, plan.info.fd_array_link, whence_t::Absolute))) + { + c->pop_discard (); + return_trace (false); + } + + // Serialize other operators from CFF2 TopDict + for (const auto &opstr : cff2_topDict.values) + { + if (unlikely (!topSzr.serialize (c, opstr, plan.info))) + { + c->pop_discard (); + return_trace (false); + } + } + + unsigned top_size = c->length (); + c->pop_pack (false); + + // Serialize INDEX header + auto *dest = c->start_embed (); + if (unlikely (!dest->serialize_header (c, hb_iter (&top_size, 1), top_size))) + return_trace (false); + } + + return_trace (true); +} + +} /* namespace CFF */ + static bool _serialize_cff2_charstrings (hb_serialize_context_t *c, cff2_subset_plan &plan, const OT::cff2::accelerator_subset_t &acc) @@ -669,6 +1229,38 @@ OT::cff2::accelerator_subset_t::subset (hb_subset_context_t *c) const cff2_subset_plan cff2_plan; if (unlikely (!cff2_plan.create (*this, c->plan))) return false; + + // If instantiating (pinned) and downgrade flag is set, convert to CFF1 + if (cff2_plan.pinned && (c->plan->flags & HB_SUBSET_FLAGS_DOWNGRADE_CFF2)) + { + // Serialize CFF1 to the subsetter's serializer + // If we run out of room, returning true will cause subsetter to retry with larger buffer + bool result = CFF::serialize_cff2_to_cff1 (c->serializer, cff2_plan, topDict, *this); + + if (c->serializer->ran_out_of_room ()) + return true; // Subsetter will retry with larger buffer + + if (result && !c->serializer->in_error ()) + { + // Success - end serialization to resolve links + c->serializer->end_serialize (); + + // Copy the serialized CFF1 data and add as CFF table + hb_blob_t *cff_blob = c->serializer->copy_blob (); + if (cff_blob) + { + c->plan->add_table (HB_TAG('C','F','F',' '), cff_blob); + hb_blob_destroy (cff_blob); + + // Return false to signal CFF2 table is not needed + return false; + } + } + + // Conversion failed - don't fall back, fail hard for debugging + return false; + } + return serialize (c->serializer, cff2_plan, c->plan->normalized_coords.as_array ()); } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.cc index 15227bdab48d..78aab09c6514 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.cc @@ -370,7 +370,8 @@ double renormalizeValue (double v, const Triple &triple, const TripleDistances &triple_distances, bool extrapolate) { double lower = triple.minimum, def = triple.middle, upper = triple.maximum; - assert (lower <= def && def <= upper); + if (unlikely (!(lower <= def && def <= upper))) + return hb_clamp (v, -1.0, +1.0); if (!extrapolate) v = hb_clamp (v, lower, upper); @@ -384,14 +385,26 @@ double renormalizeValue (double v, const Triple &triple, /* default >= 0 and v != default */ if (v > def) - return (v - def) / (upper - def); + { + double positive_range = upper - def; + if (unlikely (!positive_range)) + return +1.0; + return (v - def) / positive_range; + } /* v < def */ if (lower >= 0.0) - return (v - def) / (def - lower); + { + double negative_range = def - lower; + if (unlikely (!negative_range)) + return -1.0; + return (v - def) / negative_range; + } /* lower < 0 and v < default */ double total_distance = triple_distances.negative * (-lower) + triple_distances.positive * def; + if (unlikely (!total_distance)) + return 0.0; double v_distance; if (v >= 0.0) @@ -407,9 +420,19 @@ rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distance rebase_tent_result_t &out, rebase_tent_result_t &scratch) { - assert (-1.0 <= axisLimit.minimum && axisLimit.minimum <= axisLimit.middle && axisLimit.middle <= axisLimit.maximum && axisLimit.maximum <= +1.0); - assert (-2.0 <= tent.minimum && tent.minimum <= tent.middle && tent.middle <= tent.maximum && tent.maximum <= +2.0); - assert (tent.middle != 0.0); + if (unlikely (!(-1.0 <= axisLimit.minimum && + axisLimit.minimum <= axisLimit.middle && + axisLimit.middle <= axisLimit.maximum && + axisLimit.maximum <= +1.0) || + !(-2.0 <= tent.minimum && + tent.minimum <= tent.middle && + tent.middle <= tent.maximum && + tent.maximum <= +2.0) || + tent.middle == 0.0)) + { + out.reset (); + return; + } rebase_tent_result_t &sols = scratch; _solve (tent, axisLimit, sols); diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset.h b/src/java.desktop/share/native/libharfbuzz/hb-subset.h index fd2908e83084..edc13121825b 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-subset.h +++ b/src/java.desktop/share/native/libharfbuzz/hb-subset.h @@ -84,6 +84,9 @@ typedef struct hb_subset_plan_t hb_subset_plan_t; * HB_SUBSET_FLAGS_RETAIN_GIDS then the number of glyphs in the font won't * be reduced as a result of subsetting. If necessary empty glyphs will be * included at the end of the font to keep the number of glyphs unchanged. + * @HB_SUBSET_FLAGS_DOWNGRADE_CFF2: If set and instantiating a variable font, + * convert the output CFF2 table to CFF1. This enables compatibility with older + * renderers that don't support CFF2. Since: 13.0.0 * * List of boolean properties that can be configured on the subset input. * @@ -107,6 +110,7 @@ typedef enum { /*< flags >*/ HB_SUBSET_FLAGS_IFTB_REQUIREMENTS = 0x00001000u, HB_SUBSET_FLAGS_RETAIN_NUM_GLYPHS = 0x00002000u, #endif + HB_SUBSET_FLAGS_DOWNGRADE_CFF2 = 0x00004000u, } hb_subset_flags_t; /** @@ -239,13 +243,13 @@ hb_subset_input_override_name_table (hb_subset_input_t *input, */ HB_EXTERN hb_blob_t* -hb_subset_cff_get_charstring_data (hb_face_t* face, hb_codepoint_t glyph_index); +hb_subset_cff_get_charstring_data (hb_face_t* face, hb_codepoint_t glyph); HB_EXTERN hb_blob_t* hb_subset_cff_get_charstrings_index (hb_face_t* face); HB_EXTERN hb_blob_t* -hb_subset_cff2_get_charstring_data (hb_face_t* face, hb_codepoint_t glyph_index); +hb_subset_cff2_get_charstring_data (hb_face_t* face, hb_codepoint_t glyph); HB_EXTERN hb_blob_t* hb_subset_cff2_get_charstrings_index (hb_face_t* face); @@ -294,4 +298,12 @@ hb_subset_plan_get_user_data (const hb_subset_plan_t *plan, HB_END_DECLS + +#if defined(__cplusplus) && defined(HB_CPLUSPLUS_HH) +namespace hb { +HB_DEFINE_VTABLE (subset_input, nullptr); +HB_DEFINE_VTABLE (subset_plan, nullptr); +} // namespace hb +#endif + #endif /* HB_SUBSET_H */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ucd-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ucd-table.hh index 868428ab1e76..d2d23cf59b83 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-ucd-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-ucd-table.hh @@ -763,1716 +763,1712 @@ static const uint64_t _hb_ucd_dm2_u64_map[408]= #include -static const uint8_t _hb_ucd_u8[19868]= +static const uint8_t _hb_ucd_u8[19845]= { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 27, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 28, 26, 29, 30, 31, 32, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 33, 34, 34, 34, 34, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 26, 56, 57, 58, 58, 58, 58, 59, 26, 26, 60, 26, 26, 26, 26, 26, - 26, 61, 26, 62, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 63, 58, 58, 58, 26, 64, 65, 66, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 67, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 68, 69, 70, 58, 58, 58, 58, 71, 58, - 58, 58, 58, 58, 58, 58, 72, 73, 74, 75, 76, 77, 78, 79, 58, 80, - 81, 82, 83, 84, 85, 58, 86, 87, 88, 89, 78, 90, 91, 92, 58, 58, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 93, 26, 26, 26, 26, 26, 26, 26, 26, 94, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 95, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 96, 26, 97, 58, 58, 58, 58, 26, 98, 58, 58, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 99, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,100, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 101, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,102, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,103, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 2, 4, 5, 6, 2, - 7, 7, 7, 7, 7, 2, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 17, 18, 19, 1, 20, 20, 21, 22, 23, 24, 25, - 26, 27, 15, 2, 28, 29, 27, 30, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 31, 11, 11, 11, 32, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 33, 16, 16, 16, 16, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 34, 34, 34, 34, 34, 34, 34, 34, 16, 32, 32, 32, - 32, 32, 32, 32, 11, 34, 34, 16, 34, 32, 32, 11, 34, 11, 16, 11, - 11, 34, 32, 11, 32, 16, 11, 34, 32, 32, 32, 11, 34, 16, 32, 11, - 34, 11, 34, 34, 32, 35, 32, 16, 36, 36, 37, 34, 38, 37, 34, 34, - 34, 34, 34, 34, 34, 34, 16, 32, 34, 38, 32, 11, 32, 32, 32, 32, - 32, 32, 16, 16, 16, 11, 34, 32, 34, 34, 11, 32, 32, 32, 32, 32, - 16, 16, 36, 16, 16, 16, 16, 16, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 40, 40, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, - 39, 39, 41, 40, 40, 40, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, - 42, 42, 42, 42, 42, 42, 42, 42, 32, 32, 41, 32, 43, 44, 16, 10, - 43, 43, 40, 45, 11, 46, 46, 11, 34, 11, 11, 11, 11, 11, 11, 11, - 11, 47, 11, 11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 34, - 16, 11, 32, 16, 32, 32, 32, 32, 16, 16, 32, 48, 34, 32, 34, 11, - 32, 49, 42, 42, 50, 32, 32, 32, 11, 34, 34, 34, 34, 34, 34, 16, - 47, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 46, 51, 2, 2, 2, - 16, 16, 16, 16, 52, 53, 54, 55, 56, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 57, 58, 59, 42, 58, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 60, 43, 61, - 36, 62, 63, 43, 43, 43, 43, 43, 64, 64, 64, 8, 9, 65, 2, 66, - 42, 42, 42, 42, 42, 59, 67, 2, 68, 36, 36, 36, 36, 69, 42, 42, - 7, 7, 7, 7, 7, 2, 2, 36, 70, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 71, 42, 42, 42, 72, 49, 42, 42, 73, 74, 75, 42, 42, 36, - 7, 7, 7, 7, 7, 36, 76, 77, 2, 2, 2, 2, 2, 2, 2, 78, - 69, 36, 36, 36, 36, 36, 36, 36, 42, 42, 42, 42, 42, 79, 61, 36, - 36, 36, 36, 42, 42, 42, 42, 42, 70, 43, 43, 43, 43, 43, 43, 43, - 7, 7, 7, 7, 7, 36, 36, 36, 36, 36, 36, 36, 36, 69, 42, 42, - 42, 42, 39, 21, 2, 80, 56, 20, 36, 36, 36, 42, 42, 74, 42, 42, - 42, 42, 74, 42, 74, 42, 42, 43, 2, 2, 2, 2, 2, 2, 2, 63, - 36, 36, 36, 36, 69, 42, 43, 63, 36, 36, 36, 36, 36, 60, 43, 43, - 36, 36, 36, 36, 81, 36, 36, 36, 64, 43, 43, 56, 42, 42, 42, 42, - 36, 36, 36, 36, 82, 42, 42, 42, 42, 83, 42, 42, 42, 42, 42, 42, - 42, 84, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 84, 70, 85, - 86, 42, 42, 42, 84, 85, 86, 85, 69, 42, 42, 42, 36, 36, 36, 36, - 36, 42, 2, 7, 7, 7, 7, 7, 87, 36, 36, 36, 36, 36, 36, 36, - 69, 85, 61, 36, 36, 36, 60, 61, 60, 61, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 60, 36, 36, 36, 60, 60, 43, 36, 36, 43, 70, 85, - 86, 42, 79, 88, 89, 88, 86, 60, 43, 43, 43, 88, 43, 43, 36, 61, - 36, 42, 43, 7, 7, 7, 7, 7, 36, 20, 27, 27, 27, 55, 62, 79, - 56, 84, 61, 36, 36, 60, 43, 61, 60, 36, 61, 60, 36, 43, 79, 85, - 86, 79, 43, 56, 79, 56, 42, 43, 56, 43, 43, 43, 61, 36, 60, 60, - 43, 43, 43, 7, 7, 7, 7, 7, 42, 36, 69, 63, 43, 43, 43, 43, - 56, 84, 61, 36, 36, 36, 36, 61, 36, 61, 36, 36, 36, 36, 36, 36, - 60, 36, 61, 36, 36, 43, 70, 85, 86, 42, 42, 56, 84, 88, 86, 43, - 60, 43, 43, 43, 43, 43, 43, 43, 65, 43, 43, 43, 61, 42, 42, 42, - 56, 85, 61, 36, 36, 36, 60, 61, 60, 36, 61, 36, 36, 43, 70, 86, - 86, 42, 79, 88, 89, 88, 86, 43, 43, 43, 56, 84, 43, 43, 36, 61, - 77, 27, 27, 27, 43, 43, 43, 43, 43, 70, 61, 36, 36, 60, 43, 36, - 60, 36, 36, 43, 61, 60, 60, 36, 43, 61, 60, 43, 36, 60, 43, 36, - 36, 36, 36, 36, 36, 43, 43, 85, 84, 89, 43, 85, 89, 85, 86, 43, - 60, 43, 43, 88, 43, 43, 43, 43, 27, 90, 66, 66, 55, 91, 43, 43, - 84, 85, 70, 36, 36, 36, 60, 36, 60, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 43, 70, 42, 84, 85, 89, 42, 79, 42, 42, 43, - 43, 43, 56, 79, 36, 60, 36, 43, 43, 43, 43, 92, 27, 27, 27, 90, - 69, 85, 71, 36, 36, 36, 60, 36, 36, 36, 61, 36, 36, 43, 70, 86, - 85, 85, 89, 84, 89, 85, 42, 43, 43, 43, 88, 89, 43, 43, 36, 60, - 61, 93, 43, 43, 43, 43, 43, 43, 42, 85, 36, 36, 36, 36, 60, 36, - 36, 36, 36, 36, 36, 69, 70, 85, 86, 42, 79, 85, 89, 85, 86, 76, - 43, 43, 36, 93, 27, 27, 27, 94, 27, 27, 27, 27, 90, 36, 36, 36, - 56, 85, 61, 36, 36, 36, 36, 36, 36, 36, 36, 60, 43, 36, 36, 36, - 36, 61, 36, 36, 36, 36, 61, 43, 36, 36, 36, 60, 43, 79, 43, 88, - 85, 42, 79, 79, 85, 85, 85, 85, 43, 85, 63, 43, 43, 43, 43, 43, - 61, 36, 36, 36, 36, 36, 36, 36, 69, 36, 42, 42, 42, 79, 43, 95, - 36, 36, 36, 74, 42, 42, 42, 59, 7, 7, 7, 7, 7, 2, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 61, 60, 60, 36, 36, 60, 36, 36, - 36, 36, 61, 61, 36, 36, 36, 36, 69, 36, 42, 42, 42, 42, 70, 43, - 36, 36, 60, 80, 42, 42, 42, 79, 7, 7, 7, 7, 7, 43, 36, 36, - 76, 66, 2, 2, 2, 2, 2, 2, 2, 96, 96, 66, 42, 66, 66, 66, - 7, 7, 7, 7, 7, 27, 27, 27, 27, 27, 49, 49, 49, 4, 4, 85, - 36, 36, 36, 36, 61, 36, 36, 36, 36, 36, 36, 36, 36, 36, 60, 43, - 56, 42, 42, 42, 42, 42, 42, 84, 42, 42, 59, 42, 36, 36, 69, 42, - 42, 42, 42, 42, 56, 42, 42, 42, 42, 42, 42, 42, 42, 42, 79, 66, - 66, 66, 66, 75, 66, 66, 91, 66, 2, 2, 96, 66, 21, 63, 43, 43, - 36, 36, 36, 36, 36, 93, 86, 42, 84, 42, 42, 42, 86, 84, 86, 70, - 7, 7, 7, 7, 7, 2, 2, 2, 36, 36, 36, 85, 42, 36, 36, 42, - 70, 85, 97, 93, 85, 85, 85, 36, 69, 42, 70, 36, 36, 36, 36, 36, - 36, 84, 86, 84, 85, 85, 86, 93, 7, 7, 7, 7, 7, 85, 86, 66, - 11, 11, 11, 47, 43, 43, 47, 43, 16, 16, 16, 16, 16, 52, 44, 16, - 36, 36, 36, 36, 60, 36, 36, 43, 36, 36, 36, 60, 60, 36, 36, 43, - 60, 36, 36, 43, 36, 36, 36, 60, 60, 36, 36, 43, 36, 36, 36, 36, - 36, 36, 36, 60, 36, 36, 36, 36, 36, 36, 36, 36, 36, 60, 56, 42, - 2, 2, 2, 2, 98, 27, 27, 27, 27, 27, 27, 27, 27, 27, 99, 43, - 66, 66, 66, 66, 66, 43, 43, 43, 11, 11, 11, 43, 16, 16, 16, 43, - 100, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 76, 71, - 101, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,102,103, 43, - 36, 36, 36, 36, 36, 62, 2,104,105, 36, 36, 36, 60, 43, 43, 43, - 36, 42, 84, 43, 43, 43, 43, 61, 36, 42,106, 63, 43, 43, 43, 43, - 36, 42, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 36, 36, 60, 36, - 60, 42, 43, 43, 43, 43, 43, 43, 36, 36, 42, 86, 42, 42, 42, 85, - 85, 85, 85, 84, 86, 42, 42, 42, 42, 42, 2, 87, 2, 65, 69, 43, - 7, 7, 7, 7, 7, 43, 43, 43, 27, 27, 27, 27, 27, 43, 43, 43, - 2, 2, 2,107, 2, 58, 42, 83, 36, 82, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 60, 43, 43, 43, 36, 36, 69, 70, 36, 36, 36, 36, - 36, 36, 36, 36, 69, 60, 43, 43, 36, 36, 36, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 60, 42, 84, 85, 86, 84, 85, 43, 43, - 85, 84, 85, 85, 86, 42, 43, 43, 91, 43, 2, 7, 7, 7, 7, 7, - 36, 36, 36, 36, 36, 36, 36, 43, 36, 36, 60, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 43, 43, 36, 36, 36, 36, 36, 43, 43, 43, - 7, 7, 7, 7, 7, 99, 43, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 36, 36, 36, 69, 84, 86, 43, 2, 36, 36, 93, 84, 42, 42, 42, 79, - 84, 84, 86, 42, 42, 42, 84, 85, 85, 86, 42, 42, 42, 42, 79, 56, - 2, 2, 2, 87, 2, 2, 2, 43, 42, 42, 42, 42, 42, 42, 42,108, - 42, 42, 42, 42, 42, 42, 42, 43, 42, 42, 42, 42, 42, 42, 43, 43, - 42, 42, 97, 36, 36, 36, 36, 36, 36, 36, 84, 42, 42, 84, 84, 85, - 85, 84, 97, 36, 36, 36, 60, 2, 96, 66, 66, 66, 66, 49, 42, 42, - 42, 42, 66, 66, 66, 66, 21, 2, 42, 97, 36, 36, 36, 36, 36, 36, - 93, 42, 42, 85, 42, 86, 42, 36, 36, 36, 36, 84, 42, 85, 86, 86, - 42, 85, 43, 43, 43, 43, 2, 2, 36, 36, 85, 85, 85, 85, 42, 42, - 42, 42, 85, 42, 43, 92, 2, 2, 7, 7, 7, 7, 7, 43, 61, 36, - 36, 36, 36, 36, 39, 39, 39, 2, 16, 16, 16, 16, 34,109, 43, 43, - 11, 11, 11, 11, 11, 46, 47, 11, 2, 2, 2, 2, 43, 43, 43, 43, - 42, 59, 42, 42, 42, 42, 42, 42, 84, 42, 42, 42, 70, 36, 69, 36, - 36, 36, 70, 93, 42, 60, 43, 43, 16, 16, 16, 16, 16, 16, 39, 39, - 39, 39, 39, 39, 39, 44, 16, 16, 16, 16, 16, 16, 44, 16, 16, 16, - 16, 16, 16, 16, 16,110, 39, 39, 32, 32, 32, 16, 16, 16, 16, 32, - 16, 16, 16, 16, 11, 11, 11, 11, 16, 16, 16, 43, 11, 11, 11, 43, - 16, 16, 16, 16, 47, 47, 47, 47, 16, 16, 16, 16, 16, 16, 16, 43, - 16, 16, 16, 16,111,111,111,111, 16, 16,109, 16, 11, 11,112,113, - 40, 16,109, 16, 11, 11,112, 40, 16, 16, 43, 16, 11, 11,114, 40, - 16, 16, 16, 16, 11, 11,115, 40, 43, 16,109, 16, 11, 11,112,116, - 117,117,117,117,117,118, 64, 64,119,119,119, 2,120,121,120,121, - 2, 2, 2, 2,122, 64, 64,123, 2, 2, 2, 2,124,125, 2,126, - 127, 2,128,129, 2, 2, 2, 2, 2, 9,127, 2, 2, 2, 2,130, - 64, 64,131, 64, 64, 64, 64, 64,132, 43, 27, 27, 27, 8,128,133, - 27, 27, 27, 27, 27, 8,128,103, 39, 39, 39, 39, 39, 39, 80, 43, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 43, 43, 43, 43, 43, 43, 43, - 42, 42, 42, 42, 42, 42,134, 50,108, 50,108, 42, 42, 42, 42, 42, - 79, 43, 43, 43, 43, 43, 43, 43, 66,135, 66,136, 66, 34, 11, 16, - 11, 32,136, 66, 48, 11, 11, 66, 66, 66,135,135,135, 11, 11,137, - 11, 11, 35, 36,138, 66, 16, 11, 8, 8, 48, 16, 16, 26, 66,139, - 27, 27, 27, 27, 27, 27, 27, 27,104,104,104,104,104,104,104,104, - 104,140,141,104,142, 66, 43, 43, 8, 8,143, 66, 66, 8, 66, 66, - 143, 26, 66,143, 66, 66, 66,143, 66, 66, 66, 66, 66, 66, 66, 8, - 66,143,143, 66, 66, 66, 66, 66, 66, 66, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 66, 66, 66, 66, 4, 4, 66, 66, - 8, 66, 66, 66,144,145, 66, 66, 66, 66, 66, 66, 66, 66,143, 66, - 66, 66, 66, 66, 66, 26, 8, 8, 8, 8, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 8, 8, 8, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 91, 43, 43, 27, 27, 27, 27, 27, 27, 66, 66, - 66, 66, 66, 66, 66, 27, 27, 27, 66, 66, 66, 26, 66, 66, 66, 66, - 26, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 8, 8, 8, 8, - 66, 66, 66, 66, 66, 66, 66, 26, 66, 66, 66, 66, 4, 4, 4, 4, - 4, 4, 4, 27, 27, 27, 27, 27, 27, 27, 66, 66, 66, 66, 66, 66, - 8, 8,128,146, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, - 8,128,147,147,147,147,147,147,147,147,147,147,146, 8, 8, 8, - 8, 8, 8, 8, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 4, 8, - 8, 8,143, 26, 8, 8,143, 66, 66, 66, 43, 66, 66, 66, 66, 66, - 32, 11, 32, 34, 34, 34, 34, 11, 32, 32, 34, 16, 16, 16, 39, 11, - 32, 32,139, 66, 66,136, 34,148, 42, 32, 43, 43, 92, 2, 98, 2, - 16, 16, 16,149, 43, 43,149, 43, 36, 36, 36, 36, 43, 43, 43, 51, - 63, 43, 43, 43, 43, 43, 43, 56, 36, 36, 36, 60, 43, 43, 43, 43, - 36, 36, 36, 60, 36, 36, 36, 60, 2,120,120, 2,124,125,120, 2, - 2, 2, 2, 6, 2,107,120, 2,120, 4, 4, 4, 4, 2, 2, 87, - 2, 2, 2, 2, 2,119, 2, 2,107,150, 2, 2, 2, 2, 2, 2, - 66, 2,151,147,147,147,152, 43, 66, 66, 66, 66, 66, 54, 66, 66, - 66, 66, 43, 43, 43, 43, 43, 43, 66, 66, 66, 43, 43, 43, 43, 43, - 1, 2,153,154, 4, 4, 4, 4, 4, 66, 4, 4, 4, 4,155,156, - 157,104,104,104,104, 42, 42, 85,158, 39, 39, 66,104,159, 62, 66, - 36, 36, 36, 60, 56,160,161, 68, 36, 36, 36, 36, 36, 62, 39, 68, - 43, 43, 61, 36, 36, 36, 36, 36, 66, 27, 27, 66, 66, 66, 66, 66, - 66, 66, 66, 43, 43, 43, 43, 54, 66, 66, 66, 66, 66, 66, 66, 91, - 27, 27, 27, 27, 27, 66, 66, 66, 66, 66, 66, 66, 27, 27, 27, 27, - 162, 27, 27, 27, 27, 27, 27, 27, 36, 36, 82, 36, 36, 36, 36, 36, - 66, 66, 66, 91, 43, 43, 43, 43, 36, 36, 36, 36, 36, 36,163, 2, - 7, 7, 7, 7, 7, 36, 43, 43, 32, 32, 32, 32, 32, 32, 32, 69, - 50,164, 42, 42, 42, 42, 42, 87, 32, 32, 32, 32, 32, 32, 39, 42, - 36, 36, 36,104,104,104,104,104, 42, 2, 2, 2, 43, 43, 43, 43, - 40, 40, 40,161, 39, 39, 39, 39, 40, 32, 32, 32, 32, 32, 32, 32, - 16, 32, 32, 32, 32, 32, 32, 32, 44, 16, 16, 16, 34, 34, 34, 32, - 32, 32, 32, 32, 41,165, 34, 35, 32, 32, 16, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 11, 11, 32, 11, 11, 32, 32, 32, 32, 32, 32, - 32, 32, 11, 11, 34, 34, 32, 32, 32, 32, 32, 32, 32, 32, 46, 43, - 51, 39,166, 35, 39, 35, 36, 36, 36, 70, 36, 70, 36, 69, 36, 36, - 36, 93, 86, 84, 66, 66, 79, 43, 27, 27, 27, 66,167, 43, 43, 43, - 36, 36, 2, 2, 43, 43, 43, 43, 85, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 85, 85, 85, 85, 85, 85, 85, 85, 42, 43, 43, 43, 43, 2, - 42, 36, 36, 36, 2, 71, 71, 69, 36, 36, 36, 42, 42, 42, 42, 2, - 36, 36, 36, 69, 42, 42, 42, 42, 42, 85, 43, 43, 43, 43, 43, 92, - 36, 69, 85, 42, 42, 85, 42, 85,106, 2, 2, 2, 2, 2, 2, 51, - 7, 7, 7, 7, 7, 43, 43, 2, 36, 36, 69, 68, 36, 36, 36, 36, - 7, 7, 7, 7, 7, 36, 36, 60, 36, 36, 36, 36, 69, 42, 42, 84, - 86, 84, 86, 79, 43, 43, 43, 43, 36, 69, 36, 36, 36, 36, 84, 43, - 7, 7, 7, 7, 7, 43, 2, 2, 68, 36, 36, 76, 66, 93, 84, 36, - 70, 42, 70, 69, 70, 36, 36, 42, 69, 60, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 61, 82, 2, 36, 36, 36, 36, 36, 93, 42, 85, - 2, 82,168, 79, 43, 43, 43, 43, 61, 36, 36, 60, 61, 36, 36, 60, - 61, 36, 36, 60, 43, 43, 43, 43, 16, 16, 16, 16, 16,113, 39, 39, - 16, 16, 16, 16,110, 40, 43, 43, 36, 93, 86, 85, 84,106, 86, 43, - 36, 36, 43, 43, 43, 43, 43, 43, 36, 36, 36, 60, 43, 61, 36, 36, - 169,169,169,169,169,169,169,169,170,170,170,170,170,170,170,170, - 16, 16, 16,109, 43, 43, 43, 43, 43,149, 16, 16, 43, 43, 61, 70, - 36, 36, 36, 36,171, 36, 36, 36, 36, 36, 36, 60, 36, 36, 60, 60, - 36, 61, 60, 36, 36, 36, 36, 36, 36, 40, 40, 40, 40, 40, 40, 40, - 40, 22, 66, 66, 66, 66, 66, 66, 66, 77, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36,147, 66, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 66, 66, 66, 66, 36, 36, 36, 36, 36, 36,167, 66, - 2, 2, 2,151,129, 43, 43, 43, 6,172,173,147,147,147,147,147, - 147,147,129,151,129, 2,126,174, 2, 63, 2, 2,155,147,147,129, - 2,175, 8,176, 65, 2, 43, 43, 36, 36, 60, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 60, 78, 92, 2, 3, 2, 4, 5, 6, 2, - 16, 16, 16, 16, 16, 17, 18,128,129, 4, 2, 36, 36, 36, 36, 36, - 68, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 39, - 43, 36, 36, 36, 43, 36, 36, 36, 43, 36, 36, 36, 43, 36, 60, 43, - 20,177, 55,178, 26, 8,143, 91, 43, 43, 43, 43, 78, 64, 66, 43, - 36, 36, 36, 36, 36, 36, 61, 36, 36, 36, 36, 36, 36, 60, 36, 61, - 2, 63, 43,179, 27, 27, 27, 27, 27, 27, 43, 54, 66, 66, 66, 66, - 104,104,142, 27, 90, 66, 66, 66, 66, 66, 66, 66, 66, 27, 66, 91, - 66, 66, 66, 66, 66, 66, 91, 43, 91, 43, 43, 43, 43, 43, 43, 43, - 66, 66, 66, 66, 66, 66, 49, 43,180, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 43, 43, 27, 27, 43, 43, 43, 43, 61, 36, - 154, 36, 36, 36, 36,181, 43, 43, 36, 36, 36, 42, 42, 79, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 92, 36, 36, 43, 43, 36, 36, 36, 36, - 182,104,104, 43, 43, 43, 43, 43, 11, 11, 11, 11, 16, 16, 16, 16, - 11, 11, 43, 43, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 43, 43, - 36, 36, 36, 36, 43, 43, 43, 43, 36, 36, 43, 43, 43, 43, 43, 92, - 11, 11, 11, 11, 11, 46, 11, 11, 11, 46, 11,149, 16, 16, 16, 16, - 16,149, 16, 16, 16, 16, 16, 16, 16,149, 16, 16, 16,149,109, 43, - 39, 39, 39, 51, 39, 39, 39, 39, 80, 39, 39, 39, 39, 80, 43, 43, - 36, 36, 36, 43, 60, 36, 36, 36, 36, 36, 36, 61, 60, 43, 60, 61, - 36, 36, 36, 92, 27, 27, 27, 27, 36, 36, 36, 76,162, 27, 27, 27, - 43, 43, 43,179, 27, 27, 27, 27, 36, 60, 36, 43, 43,179, 27, 27, - 36, 36, 36, 27, 27, 27, 43, 92, 36, 36, 36, 36, 36, 43, 43, 92, - 36, 36, 36, 36, 43, 43, 27, 36, 43, 27, 27, 27, 27, 27, 27, 27, - 69, 42, 56, 79, 43, 43, 42, 42, 36, 36, 61, 36, 61, 36, 36, 36, - 36, 36, 36, 43, 42, 79, 43, 56, 27, 27, 27, 27, 99, 43, 43, 43, - 2, 2, 2, 2, 63, 43, 43, 43, 36, 36, 36, 36, 36, 36,183, 30, - 36, 36, 36, 36, 36, 36,183, 27, 36, 36, 36, 36, 77, 36, 36, 36, - 36, 36, 69, 79, 43,179, 27, 27, 2, 2, 2, 63, 43, 43, 43, 43, - 36, 36, 36, 43, 92, 2, 2, 2, 36, 36, 36, 43, 27, 27, 27, 27, - 36, 60, 43, 43, 27, 27, 27, 27, 36, 43, 43, 43, 92, 2, 63, 43, - 43, 43, 43, 43,179, 27, 27, 27, 11, 46, 43, 43, 43, 43, 43, 43, - 16,109, 43, 43, 43, 27, 27, 27, 36, 36, 42, 42, 43, 43, 43, 43, - 7, 7, 7, 7, 7, 36, 36, 68, 11, 11, 11, 43, 56, 42, 42,158, - 16, 16, 16, 43, 43, 43, 43, 8, 27, 27, 27, 27, 27, 27, 27, 99, - 36, 36, 36, 36, 36, 56,184, 43, 36, 43, 43, 43, 43, 43, 43, 43, - 43, 36, 82, 36, 43, 43, 43, 43, 96, 66, 66, 66, 91, 43, 43, 43, - 43, 43, 43, 43, 43, 42, 42, 42, 27, 27, 27, 94, 43, 43, 43, 43, - 180, 27, 30, 2, 2, 43, 43, 43, 36, 42, 42, 2, 2, 43, 43, 43, - 36, 36,183, 27, 27, 27, 43, 43, 86, 97, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 42, 42, 42, 42, 42, 42, 42, 59, 2, 2, 2, 43, - 27, 27, 27, 7, 7, 7, 7, 7, 70, 69, 70, 43, 43, 43, 43, 56, - 85, 86, 42, 84, 86, 59,185, 2, 2, 79, 43, 43, 43, 43, 78, 43, - 42, 70, 36, 36, 36, 36, 36, 36, 36, 36, 36, 69, 42, 42, 86, 42, - 42, 42, 79, 7, 7, 7, 7, 7, 2, 2, 93, 97, 43, 43, 43, 43, - 36, 69, 2, 60, 43, 43, 43, 43, 36, 93, 85, 42, 42, 42, 42, 84, - 97, 36, 62, 2, 58, 42, 59, 86, 7, 7, 7, 7, 7, 62, 62, 2, - 179, 27, 27, 27, 27, 27, 27, 27, 27, 27, 99, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 85, 86, 42, 85, 84, 42, 2, 2, 2, 70, - 69, 43, 43, 43, 43, 43, 43, 43, 36, 36, 36, 60, 60, 36, 36, 61, - 36, 36, 36, 36, 36, 36, 36, 61, 36, 36, 36, 36, 62, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 69, 85, 86, 42, 42, 42, 79, 43, 43, - 42, 85, 61, 36, 36, 36, 60, 61, 60, 36, 61, 36, 36, 56, 70, 85, - 84, 85, 89, 88, 89, 88, 85, 43, 60, 43, 43, 88, 43, 43, 61, 36, - 36, 85, 43, 42, 42, 42, 79, 43, 42, 42, 79, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 61, 43, 60, 36, 36, 36, 61, 85, 86, 42, 42, - 79, 89, 88, 88, 85, 89, 85, 84, 70, 70, 2, 92, 63, 43, 43, 43, - 56, 79, 43, 43, 43, 43, 43, 43, 36, 36, 93, 85, 42, 42, 42, 42, - 85, 42, 84, 70, 36, 62, 2, 2, 7, 7, 7, 7, 7, 2, 92, 70, - 85, 86, 42, 42, 84, 84, 85, 86, 84, 42, 36, 71, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 93, 85, 42, 42, 43, 85, 85, 42, 86, - 59, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, 36, 42, 43, - 85, 86, 42, 42, 42, 84, 86, 86, 59, 2, 60, 43, 43, 43, 43, 43, - 2, 2, 2, 2, 2, 2, 63, 43, 36, 36, 36, 36, 36, 69, 86, 85, - 42, 42, 42, 86, 62, 43, 43, 43, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 36, 60, 56, 86, - 85, 42, 42, 86, 42, 42, 43, 43, 7, 7, 7, 7, 7, 27, 2, 96, - 42, 42, 42, 42, 86, 59, 43, 43, 27, 99, 43, 43, 43, 43, 43, 61, - 36, 36, 36, 60, 61, 43, 36, 36, 36, 36, 61, 60, 36, 36, 36, 36, - 85, 85, 85, 88, 89, 56, 84, 70, 97, 86, 2, 63, 43, 43, 43, 43, - 36, 36, 36, 36, 43, 36, 36, 36, 93, 85, 42, 42, 43, 42, 85, 85, - 70, 71, 89, 43, 43, 43, 43, 43, 69, 42, 42, 42, 42, 70, 36, 36, - 36, 69, 42, 42, 84, 69, 42, 59, 2, 2, 2, 58, 43, 43, 43, 43, - 69, 42, 42, 84, 86, 42, 36, 36, 36, 36, 36, 36, 36, 42, 42, 42, - 42, 42, 42, 84, 42, 2, 71, 2, 2, 63, 43, 43, 43, 43, 43, 43, - 2, 2, 2, 2, 2, 43, 43, 43, 84, 42, 84, 84, 43, 43, 43, 43, - 62, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 79, 42, 42, 42, 86, - 62, 2, 2, 43, 43, 43, 43, 43, 2, 36, 36, 36, 36, 36, 36, 36, - 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 88, 42, 42, 42, - 84, 42, 86, 79, 43, 43, 43, 43, 36, 36, 36, 60, 36, 61, 36, 36, - 69, 42, 42, 79, 43, 79, 42, 56, 42, 42, 42, 69, 43, 43, 43, 43, - 36, 36, 36, 61, 60, 36, 36, 36, 36, 36, 36, 36, 36, 85, 85, 89, - 42, 88, 86, 86, 60, 43, 43, 43, 36, 36, 36, 36, 82, 36, 43, 43, - 36, 69, 84,106, 63, 43, 43, 43, 42, 93, 36, 36, 36, 36, 36, 36, - 36, 36, 85, 42, 42, 79, 43, 85, 84, 59, 2, 2, 2, 2, 2, 2, - 7, 7, 7, 7, 7, 79, 43, 43, 27, 27, 90, 66, 66, 66, 55, 20, - 167, 66, 66, 66, 66, 66, 66, 66, 66, 43, 43, 43, 43, 43, 43, 92, - 104,104,104,104,104,104,104,181, 2, 2, 63, 43, 43, 43, 43, 43, - 62, 63, 43, 43, 43, 43, 43, 43, 64, 64, 64, 64, 64, 64, 64, 64, - 70, 36, 36, 69, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 42, 42, 42, 42, 42, 42, 85, 86, 42, - 42, 42, 59, 43, 43, 43, 43, 43, 42, 42, 42, 59, 2, 2, 66, 66, - 39, 39, 96, 43, 43, 43, 43, 43, 7, 7, 7, 7, 7,179, 27, 27, - 27, 61, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 43, 43, 61, 36, - 39, 68, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 82,163, 2, - 27, 27, 27, 30, 2, 63, 43, 43, 11, 11, 11, 11, 46,149, 16, 16, - 16, 16, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 36, 60, 43, 56, - 93, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 43, 43, 43, 56, 42, 73, 39, 39, 39, 39, 39, 39, - 39, 87, 79, 43, 43, 43, 43, 43, 85, 39,104,181, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 61, 36, 60, 43, 43, 43, 43, 43, 43, - 39, 39, 51, 39, 39, 39, 51, 80, 43, 60, 43, 43, 43, 43, 43, 43, - 36, 60, 61, 43, 43, 43, 43, 43, 43, 43, 36, 36, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 43, 49, 59, 64, 64, 43, 43, 43, 43, 43, 43, - 7, 7, 7, 7, 7, 66, 91, 43, 66, 66, 43, 43, 43, 66, 66, 66, - 176, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 79, 43, 43, 43, 43, - 66, 66, 66, 91, 54, 66, 66, 66, 66, 66,186, 86, 42, 66,186, 85, - 85,187, 64, 64, 64, 83, 42, 42, 42, 75, 49, 42, 42, 42, 66, 66, - 66, 66, 66, 66, 66, 42, 42, 66, 66, 42, 75, 43, 43, 43, 43, 43, - 27, 27, 43, 43, 43, 43, 43, 43, 11, 11, 11, 11, 11, 16, 16, 16, - 16, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16, - 16, 16,109, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 46, 11, 43, 46, 47, 46, 47, 11, 46, 11, - 11, 11, 11, 16, 16,149,149, 16, 16, 16,149, 16, 16, 16, 16, 16, - 16, 16, 11, 47, 11, 46, 47, 11, 11, 11, 46, 11, 11, 11, 46, 16, - 16, 16, 16, 16, 11, 47, 11, 46, 11, 11, 46, 46, 43, 11, 11, 11, - 46, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11, 11, - 11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 43, 11, 11, 11, 11, - 31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33, 16, 16, - 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31, 16, 16, - 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, - 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 32, 43, 7, - 42, 42, 42, 75, 66, 49, 42, 42, 42, 42, 42, 42, 42, 42, 75, 66, - 66, 66, 49, 66, 66, 66, 66, 66, 66, 66, 75, 21, 2, 2, 43, 43, - 43, 43, 43, 43, 43, 56, 42, 42, 16, 16, 16, 16, 16,138, 16, 16, - 16, 16, 16, 16, 16, 16, 16,109, 43, 43,149, 16, 16,109, 43, 43, - 42, 42, 42, 79, 42, 42, 42, 42, 42, 42, 42, 42, 79, 56, 42, 42, - 42, 56, 79, 42, 42, 79, 43, 43, 39, 39, 39, 39, 39, 39, 39, 43, - 43, 43, 43, 43, 43, 43, 43, 56, 42, 42, 42, 73, 39, 39, 39, 43, - 7, 7, 7, 7, 7, 43, 43, 76, 36, 36, 36, 36, 36, 36, 36, 79, - 36, 36, 36, 36, 36, 36, 42, 42, 7, 7, 7, 7, 7, 43, 43, 95, - 36, 36, 36, 36, 36, 82, 42, 42,188, 7, 7, 7, 7,189, 43, 92, - 36, 69, 36, 70, 36, 36, 36, 42, 36, 36, 69, 43, 43, 43, 43, 82, - 36, 36, 36, 60, 36, 36, 61, 60, 36, 36, 60,179, 27, 27, 27, 27, - 16, 16, 42, 42, 42, 73, 43, 43, 27, 27, 27, 27, 27, 27,162, 27, - 190, 27, 99, 43, 43, 43, 43, 43, 27, 27, 27, 27, 27, 27, 27,162, - 27, 27, 27, 27, 27, 27, 27, 43, 36, 36, 61, 36, 36, 36, 36, 36, - 61, 60, 60, 61, 61, 36, 36, 36, 36, 60, 36, 36, 61, 61, 43, 43, - 43, 60, 43, 61, 61, 61, 61, 36, 61, 60, 60, 61, 61, 61, 61, 61, - 61, 60, 60, 61, 36, 60, 36, 36, 36, 60, 36, 36, 61, 36, 60, 60, - 36, 36, 36, 36, 36, 61, 36, 36, 61, 36, 61, 36, 36, 61, 36, 36, - 8, 43, 43, 43, 43, 43, 43, 43, 66, 66, 66, 66, 66, 66, 43, 43, - 54, 66, 66, 66, 66, 66, 66, 66, 27, 27, 27, 27, 27, 27, 90, 66, - 66, 66, 66, 66, 66, 66, 66, 43, 43, 43, 43, 66, 66, 66, 66, 66, - 66, 91, 43, 43, 43, 43, 43, 43, 66, 66, 66, 66, 91, 43, 43, 43, - 66, 43, 43, 43, 43, 43, 43, 43, 66, 66, 66, 66, 66, 25, 40, 40, - 66, 66, 66, 66, 91, 43, 66, 66, 66, 66, 66, 66, 43, 43, 43, 43, - 8, 8, 8, 8,176, 43, 43, 43, 66, 66, 66, 66, 66, 91, 43, 66, - 66, 66, 66, 91, 91, 43, 54, 66, 66, 66, 66, 66, 66, 66, 91, 54, - 66, 66, 66, 66, 66, 91, 43, 54, 66, 91, 66, 66, 66, 66, 66, 66, - 7, 7, 7, 7, 7, 91, 43, 43, 78, 43, 43, 43, 43, 43, 43, 43, - 170,170,170,170,170,170,170, 43,170,170,170,170,170,170,170, 0, - 0, 0, 29, 21, 21, 21, 23, 21, 22, 18, 21, 25, 21, 17, 13, 13, - 25, 25, 25, 21, 21, 9, 9, 9, 9, 22, 21, 18, 24, 16, 24, 5, - 5, 5, 5, 22, 25, 18, 25, 0, 23, 23, 26, 21, 24, 26, 7, 20, - 25, 1, 26, 24, 26, 25, 15, 15, 24, 15, 7, 19, 15, 21, 9, 25, - 9, 5, 5, 25, 5, 9, 5, 7, 7, 7, 9, 8, 8, 5, 6, 6, - 24, 24, 6, 24, 12, 12, 2, 2, 6, 5, 9, 21, 9, 2, 2, 9, - 25, 9, 26, 12, 11, 11, 2, 6, 5, 21, 17, 2, 2, 26, 26, 23, - 2, 12, 17, 12, 21, 12, 12, 21, 7, 2, 2, 7, 7, 21, 21, 2, - 1, 1, 21, 23, 26, 26, 1, 21, 6, 7, 7, 12, 12, 7, 21, 7, - 12, 1, 12, 6, 6, 12, 12, 26, 7, 26, 26, 7, 2, 1, 12, 2, - 6, 2, 24, 7, 7, 6, 1, 12, 12, 10, 10, 10, 10, 12, 21, 6, - 2, 10, 10, 2, 15, 26, 26, 2, 2, 21, 7, 10, 15, 7, 2, 23, - 21, 26, 10, 7, 21, 15, 15, 2, 17, 7, 29, 7, 7, 22, 18, 2, - 14, 14, 14, 7, 10, 21, 17, 21, 11, 12, 5, 2, 5, 6, 8, 8, - 8, 24, 5, 24, 2, 24, 9, 24, 24, 2, 29, 29, 29, 1, 17, 17, - 20, 19, 22, 20, 27, 28, 1, 29, 21, 20, 19, 21, 21, 16, 16, 21, - 25, 22, 18, 21, 21, 29, 1, 2, 15, 6, 18, 6, 12, 11, 9, 26, - 26, 9, 26, 5, 7, 5, 5, 26, 14, 9, 5, 14, 14, 15, 25, 26, - 26, 22, 18, 26, 18, 25, 18, 22, 5, 12, 2, 5, 22, 21, 21, 22, - 18, 17, 26, 6, 7, 14, 17, 22, 18, 18, 26, 14, 17, 6, 14, 6, - 12, 24, 24, 6, 26, 15, 6, 21, 11, 21, 24, 9, 6, 9, 23, 26, - 6, 10, 4, 4, 3, 3, 7, 25, 17, 16, 16, 22, 16, 16, 25, 17, - 25, 2, 25, 24, 23, 2, 2, 15, 12, 15, 14, 2, 21, 14, 7, 15, - 12, 17, 21, 1, 26, 10, 10, 1, 7, 13, 13, 2, 23, 15, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 0, 14, 0, - 0, 0, 0, 0, 15, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 21, 22, 23, - 0, 0, 0, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, - 0, 0, 0, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 39, 40, 0, 0, 0, 0, 0, 0, 41, 42, - 43, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, - 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, - 6, 7, 8, 0, 9, 0, 10, 11, 0, 0, 12, 13, 14, 15, 16, 0, - 0, 0, 0, 17, 18, 19, 20, 0, 21, 0, 22, 23, 0, 24, 25, 0, - 0, 24, 26, 27, 0, 24, 26, 0, 0, 24, 26, 0, 0, 24, 26, 0, - 0, 0, 26, 0, 0, 24, 28, 0, 0, 24, 26, 0, 0, 29, 26, 0, - 0, 0, 30, 0, 0, 31, 32, 0, 0, 33, 34, 0, 35, 36, 0, 37, - 38, 0, 39, 0, 0, 40, 0, 0, 41, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 44, 0, 0, - 0, 0, 45, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 47, 0, 0, - 0, 0, 0, 0, 48, 0, 0, 49, 0, 50, 51, 52, 0, 53, 54, 55, - 0, 56, 0, 57, 0, 58, 0, 0, 0, 0, 59, 60, 0, 0, 0, 0, - 0, 0, 61, 62, 0, 0, 0, 0, 0, 0, 63, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 66, - 0, 0, 0, 67, 0, 68, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 70, 71, 0, 0, 72, 0, 0, 0, 0, - 0, 0, 0, 0, 73, 74, 0, 0, 0, 0, 54, 75, 0, 76, 77, 0, - 0, 78, 79, 0, 0, 0, 0, 0, 0, 80, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 83, 0, 0, 0, - 0, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 86, 0, 0, 0, 87, - 0, 0, 0, 0, 88, 89, 0, 0, 0, 0, 0, 90, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 0, 92, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 0, 94, 0, 0, 95, 0, - 96, 0, 0, 0, 0, 0, 73, 97, 0, 98, 0, 0, 99,100, 0, 78, - 0, 0,101, 0, 0,102, 0, 0, 0, 0, 0,103, 0,104, 26,105, - 0, 0,106, 0, 0, 0,107, 0, 0, 0,108, 0, 0, 0, 0, 0, - 0, 66,109, 0, 0, 66, 0, 0, 0,110, 0, 0, 0,111, 0, 0, - 0, 0, 0, 0, 0, 98, 0, 0, 0, 0, 0, 0, 0,112,113, 0, - 0, 0, 0, 79, 0, 44,114, 0,115, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0,116, 0, - 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,118, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,119, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,120, 0,121, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,122, 0, 0, 0, 0,123, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,124, - 125,126, 0, 0, 0, 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,128,129, 0, 0,130, 0, 0, 0, 0,121, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,131, 0,132, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,133, 0, 0, 0, 0, - 0, 0, 0,134, 0, 0, 0, 0, 0, 0, 0,135, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,136, 0, 0, 0,137, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 2, 3, 4, 5, 6, 7, 4, 4, 8, 9, 10, 1, 11, 12, 13, - 14, 15, 16, 17, 18, 1, 1, 1, 0, 0, 0, 0, 19, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 1, 23, 4, 21, 24, - 25, 26, 27, 28, 29, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 31, 0, 0, 0, 32, 33, 34, 35, 1, 36, 0, 0, 0, 0, - 37, 0, 0, 0, 0, 0, 0, 0, 0, 38, 1, 39, 14, 39, 40, 41, - 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, - 43, 36, 44, 45, 21, 45, 46, 0, 0, 0, 0, 0, 0, 0, 19, 1, - 21, 0, 0, 47, 0, 0, 0, 0, 0, 38, 48, 1, 1, 49, 49, 50, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, - 0, 19, 52, 1, 0, 0, 38, 14, 4, 1, 1, 1, 53, 21, 43, 52, - 54, 21, 35, 1, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 56, - 57, 58, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 59, 0, 0, 0, 56, 0, 60, 0, 0, 0, 0, 0, 0, - 0, 0, 61, 62, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 64, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 66, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 0, 0, 0, 0, 0, 0, 69, 70, 0, 0, 0, 0, 0, - 71, 72, 73, 74, 75, 76, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 79, 0, 0, 0, 0, 47, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, - 0, 80, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, - 63, 0, 0, 81, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 83, 0, 0, 0, 0, 0, 0, 19, 84, 0, 62, 0, 0, 0, - 0, 49, 1, 85, 0, 0, 0, 0, 1, 52, 15, 86, 36, 10, 21, 1, - 1, 1, 1, 41, 1, 21, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 55, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 19, 10, - 1, 0, 0, 0, 0, 0, 88, 0, 0, 0, 0, 0, 0, 89, 0, 0, - 88, 0, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 0, - 90, 9, 12, 4, 91, 8, 92, 47, 0, 58, 50, 0, 21, 1, 21, 93, - 94, 1, 1, 1, 1, 1, 1, 1, 1, 95, 96, 97, 0, 0, 0, 0, - 98, 1, 99, 58, 81,100,101, 4, 58, 0, 0, 0, 0, 0, 0, 19, - 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0,102,103, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,104, 0, 0, 0, 0, 19, 0, 1, 1, 50, 0, 0, 0, 0, - 0, 0, 0, 38, 0, 0, 0, 0, 50, 0, 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 1, 1, 1, 1, - 50, 0, 0, 0, 0, 0,105, 68, 0, 0, 0, 0, 0, 0, 0, 0, - 61, 0, 0, 0, 0, 0, 0, 0, 78, 0, 0, 0, 62, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0,106,107, 58, 38, 81, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 0,108, 1, 14, 4, 12, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 47, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 38, 90, 0, 0, 0, 0,109, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,110, 61, 0,111, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, 0, 0, 0, 19, 58, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,112, 51, 0,112, 14, 52, - 84, 0, 0, 0,113, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 62, 0, 0, 61, 0, 0, 0, 0, 0, 0,114, 0, 90, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 61, 62, 0, 0, 62, 0, 89, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,114, 0, 0, 0, 0,115, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 55, 0, 38, 1, 58, - 1, 58, 0, 0, 0, 0, 0, 88, 62, 0, 0, 0, 63, 89, 0, 0, - 0, 0, 0, 59,116, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,116, 0, 0, 0, 0, 61, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 78, 0, 0, 0, - 0, 0, 0, 0, 0, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 56, 0, 89, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 61, 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, - 0, 0, 0, 0, 0, 0, 0, 0, 8, 92, 0, 0, 0, 0, 0, 0, - 1, 90, 0, 0, 0, 0, 0, 0,117, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,118, 0,119,120,121,122, 0,105, 4,123, 49, 23, 0, - 0, 0, 0, 0, 0, 0, 38, 50, 0, 0, 0, 0, 38, 58, 0, 0, - 0, 0, 0, 0, 1, 90, 1, 1, 1, 1, 39, 1, 48,106, 90, 0, - 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 59, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,124, - 0, 0, 0, 0, 0, 0, 0,113, 0, 0, 0, 0, 19, 59, 0, 38, - 0, 81, 0, 0, 0, 0, 0, 0, 4,123, 0, 0, 0, 1,125, 0, - 0, 0, 0, 0, 0, 0, 0, 0,230,230,230,230,230,232,220,220, - 220,220,232,216,220,220,220,220,220,202,202,220,220,220,220,202, - 202,220,220,220, 1, 1, 1, 1, 1,220,220,220,220,230,230,230, - 230,240,230,220,220,220,230,230,230,220,220, 0,230,230,230,220, - 220,220,220,230,232,220,220,230,233,234,234,233,234,234,233,230, - 0, 0, 0,230, 0,220,230,230,230,230,220,230,230,230,222,220, - 230,230,220,220,230,222,228,230, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 19, 20, 21, 22, 0, 23, 0, 24, 25, 0,230,220, 0, 18, - 30, 31, 32, 0, 0, 0, 0, 27, 28, 29, 30, 31, 32, 33, 34,230, - 230,220,220,230,220,230,230,220, 35, 0, 0, 0, 0, 0,230,230, - 230, 0, 0,230,230, 0,220,230,230,220, 0, 0, 0, 36, 0, 0, - 230,220,230,230,220,220,230,220,220,230,220,230,220,230,230, 0, - 0,220, 0, 0,230,230, 0,230, 0,230,230,230,230,230, 0, 0, - 0,220,220,220,230,220,220,220,230,230, 0,220, 27, 28, 29,230, - 7, 0, 0, 0, 0, 9, 0, 0, 0,230,220,230,230, 0, 0, 0, - 0, 0,230, 0, 0, 84, 91, 0, 0, 0, 0, 9, 9, 0, 0, 0, - 0, 0, 9, 0,103,103, 9, 0,107,107,107,107,118,118, 9, 0, - 122,122,122,122,220,220, 0, 0, 0,220, 0,220, 0,216, 0, 0, - 0,129,130, 0,132, 0, 0, 0, 0, 0,130,130,130,130, 0, 0, - 130, 0,230,230, 9, 0,230,230, 0, 0,220, 0, 0, 0, 0, 7, - 0, 9, 9, 0, 9, 9, 0, 0, 0,230, 0, 0, 0,228, 0, 0, - 0,222,230,220,220, 0, 0, 0,230, 0, 0,220,230,220, 0,220, - 230,230,230,234, 0, 0, 9, 9, 0, 0, 7, 0,230,230,230, 0, - 230, 0, 1, 1, 1, 0, 0, 0,230,234,214,220,202,230,230,230, - 230,230,232,228,228,220,218,230,233,220,230,220,230,230, 1, 1, - 1, 1, 1,230, 0, 1, 1,230,220,230, 1, 1, 0, 0,218,228, - 232,222,224,224, 0, 8, 8, 0, 0, 0, 0,220,230, 0,230,230, - 220, 0, 0,230, 0, 0, 26, 0, 0,220, 0,230,230, 1,220, 0, - 0,230,220, 0, 0, 0,220,220, 0, 0,230,220, 0, 9, 7, 0, - 0, 7, 9, 0, 0, 0, 9, 7, 6, 6, 0, 0, 0, 0, 1, 0, - 0,216,216, 1, 1, 1, 0, 0, 0,226,216,216,216,216,216, 0, - 220,220,220, 0,232,232,220,230,230,230, 7, 0, 16, 17, 17, 17, - 17, 17, 17, 33, 17, 17, 17, 19, 17, 17, 17, 17, 20,101, 17,113, - 129,169, 17, 27, 28, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,237, 0, 1, 2, 2, - 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 6, 7, 8, - 9, 0, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 21, 22, 0, 0, 0, 0, - 23, 24, 25, 26, 0, 27, 0, 28, 29, 30, 31, 32, 0, 0, 0, 0, - 0, 0, 0, 33, 34, 35, 36, 0, 0, 0, 0, 0, 37, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 38, 39, 0, 0, 0, 0, 1, 2, 40, 41, - 0, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 5, 0, - 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, - 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, 10, 0, 0, 10, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 10, - 0, 0, 0, 0, 0, 0, 11, 12, 0, 13, 0, 14, 15, 16, 0, 0, - 0, 0, 0, 1, 17, 18, 0, 19, 7, 1, 0, 0, 0, 20, 20, 7, - 20, 20, 20, 20, 20, 20, 20, 8, 21, 0, 22, 0, 7, 23, 24, 0, - 20, 20, 25, 0, 0, 0, 26, 27, 1, 7, 20, 20, 20, 20, 20, 1, - 28, 29, 30, 31, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 10, 0, - 0, 0, 0, 0, 0, 0, 20, 20, 20, 1, 0, 0, 8, 21, 32, 4, - 0, 10, 0, 33, 7, 20, 20, 20, 0, 0, 0, 0, 8, 34, 34, 35, - 36, 34, 37, 0, 38, 1, 20, 20, 0, 0, 39, 0, 1, 1, 0, 8, - 21, 1, 20, 0, 0, 0, 1, 0, 0, 40, 1, 1, 0, 0, 8, 21, - 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 26, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 21, 7, 20, 41, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 21, 0, 42, 43, 44, 0, 45, 0, 8, 21, 0, 0, 0, 0, 0, - 0, 0, 0, 46, 7, 1, 10, 1, 0, 0, 0, 1, 20, 20, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 34, 9, 0, 0, 20, 20, - 1, 20, 20, 0, 0, 0, 0, 0, 0, 0, 26, 21, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 47, 48, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 9, 10, 11, 11, 11, 11, 12, 13, - 13, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 13, 13, 13, - 24, 25, 26, 26, 26, 27, 13, 13, 13, 28, 29, 30, 13, 31, 32, 33, - 34, 35, 36, 37, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 38, 7, 7, 39, 7, 40, 7, 7, - 7, 41, 13, 42, 7, 7, 43, 7, 7, 7, 44, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 45, 0, 0, 1, 2, 2, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 37, - 37, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 2, 2, 53, 54, 55, 56, 57, 58, 59, 59, 59, 59, 60, 59, - 59, 59, 59, 59, 59, 59, 61, 61, 59, 59, 59, 59, 62, 59, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 59, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 78, 69, 69, 69, 69, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, - 81, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 69, 69, 96, 97, 98, 99, 99, 99, - 100,101,102,103,104,105,106,107,108,109, 95,110,111,112,113,114, - 115,116,117,117,118,119,120,121,122,123,124,125,126,127,128,129, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 31, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 32, 2, 33, 34, 35, 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 37, 3, 3, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 2, 58, 59, 0, 0, 0, 0, 60, 2, 2, 61, 2, 2, 2, 2, 2, + 2, 62, 2, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 2, 65, 66, 67, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 69, 70, 71, 0, 0, 0, 0, 72, 0, + 0, 0, 0, 0, 0, 0, 73, 74, 75, 76, 77, 78, 4, 79, 0, 80, + 81, 82, 83, 84, 85, 0, 86, 87, 88, 89, 4, 90, 91, 92, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 93, 2, 2, 2, 2, 2, 2, 2, 2, 94, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 95, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 96, 2, 97, 0, 0, 0, 0, 2, 98, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 99, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,100, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,102, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, + 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, + 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, + 11, 11, 11, 11, 11, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, + 13, 13, 13, 13, 13, 13, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, + 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 14, + 1, 1, 1, 1, 14, 1, 1, 1, 18, 18, 18, 18, 18, 18, 18, 18, + 1, 5, 0, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 14, 0, + 1, 1, 1, 1, 14, 0, 0, 0, 6, 6, 6, 6, 7, 7, 7, 7, + 1, 1, 1, 1, 1, 14, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 14, 0, 0, 0, 0, + 1, 1, 1, 14, 1, 1, 1, 14, 3, 3, 3, 3, 3, 3, 0, 0, + 28, 28, 28, 28, 28, 28, 28, 28, 11, 11, 11, 11, 11, 1, 1, 1, + 14, 17, 1, 1, 1, 1, 1, 1, 14, 0, 0, 0, 0, 0, 0, 0, + 14, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 0, 0, 0, + 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 29, 0, + 11, 11, 11, 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 6, 6, 6, + 0, 0, 0, 11, 11, 11, 11, 11, 17, 1, 1, 1, 1, 1, 1, 1, + 11, 11, 11, 11, 11, 10, 10, 10, 1, 1, 1, 0, 0, 0, 0, 0, + 5, 46, 1, 1, 1, 1, 1, 1, 6, 6, 6, 6, 41, 41, 41, 41, + 3, 3, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 11, 0, 0, 12, + 1, 1, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, + 49, 10, 10, 10, 10, 10, 10, 10, 7, 6, 6, 6, 6, 6, 6, 6, + 44, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, + 3, 3, 3, 3, 0, 0, 0, 0, 11, 11, 11, 11, 11, 12, 9, 77, + 88, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,102,103,104, + 89, 6, 6, 6, 6, 6, 6, 6, 22, 22, 22, 22, 22, 22, 22, 22, + 26, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 5, 5, 5, 5, 5, + 5, 20, 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 1, 1, + 11, 11, 11, 11, 11, 12, 12, 12, 1, 1, 1, 1, 14, 1, 1, 0, + 14, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 14, 1, 1, 1, 1, + 10, 10, 10, 10, 10, 10, 51, 0,115, 1, 1, 1, 1, 1, 1, 1, + 5, 5, 5, 5, 5, 5, 5, 0, 1, 1, 1, 1, 13, 13, 13, 12, + 6, 6, 6, 0, 7, 7, 7, 0, 30, 30, 30, 30, 30, 30, 30, 30, + 3, 3, 3, 3, 3, 29, 0, 0, 3, 3, 3, 3, 3, 3, 3, 29, + 10, 10, 10, 10, 10, 3, 3, 3, 75, 10, 10, 10, 10, 10, 10, 10, + 3, 3, 3, 29, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, + 7, 7, 7, 7, 7, 32, 7, 7, 0, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 51, 0, 0, 0, 1, 1, 1, 1, 1, 1, 86, 10, + 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 15, 19, + 1, 1, 1, 1, 1, 1, 1, 34, 1, 1, 1, 1, 1, 1, 1, 5, + 15, 15, 15, 15, 15, 15, 15, 15, 1, 14, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 23, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, + 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, + 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, + 3, 3, 3, 3, 29, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, + 87, 12,100, 12, 27,101, 76, 12, 6, 6, 6, 6, 6,105,106,135, + 87, 30, 30, 66,107,136,137,108, 50, 10, 89, 12,138,139, 10, 78, + 7, 7, 7, 59, 7, 7, 7, 8, 6, 6, 6, 60, 6, 6, 6, 6, + 8, 8, 8, 8, 21, 21, 21, 21, 21, 21, 21, 21, 6, 8, 8, 8, + 8, 8, 8, 8, 7, 21, 21, 6, 21, 8, 8, 7, 21, 7, 6, 7, + 7, 21, 8, 7, 8, 6, 7, 21, 8, 8, 8, 7, 21, 6, 8, 7, + 21, 7, 21, 21, 8, 67, 8, 6, 1, 1,109, 21,110,109, 21, 21, + 21, 21, 21, 21, 21, 21, 6, 8, 21,110, 8, 7, 8, 8, 8, 8, + 8, 8, 6, 6, 6, 7, 21, 8, 21, 21, 7, 8, 8, 8, 8, 8, + 6, 6, 1, 6, 6, 6, 6, 6, 13, 22, 22, 13, 13, 13, 13, 13, + 13, 22, 22, 22, 22, 22, 22, 22, 13, 13, 68, 22, 22, 22, 68, 68, + 8, 8, 68, 8, 0, 69, 6, 88, 0, 0, 22,140, 7, 32, 32, 7, + 21, 7, 7, 7, 7, 7, 7, 7, 7, 39, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 21, 6, 7, 8, 6, 8, 8, 8, 8, + 6, 6, 8, 90, 21, 8, 21, 7, 8, 43, 5, 5, 79, 8, 8, 8, + 7, 21, 21, 21, 21, 21, 21, 6, 39, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 32, 54, 12, 12, 12, 6, 6, 6, 6,111,141, 44, 70, + 5, 5, 5, 5, 5, 5, 5,142, 71, 36, 5, 71, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 14, 0, 17, 1, 40, 33, 0, 0, 0, 0, 0, + 18, 18, 18, 9, 77, 80, 12, 3, 5, 5, 5, 5, 5, 36,143, 12, + 52, 1, 1, 1, 1, 24, 5, 5, 11, 11, 11, 11, 11, 12, 12, 1, + 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 53, 5, 5, 5,144, 43, + 5, 5, 81, 72, 55, 5, 5, 1, 11, 11, 11, 11, 11, 1, 56, 82, + 12, 12, 12, 12, 12, 12, 12, 73, 24, 1, 1, 1, 1, 1, 1, 1, + 5, 5, 5, 5, 5, 23, 17, 1, 25, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 24, 5, 5, 5, 5, 13, 66, 12, 61, 26, 30, + 1, 1, 1, 5, 5, 72, 5, 5, 5, 5, 72, 5, 72, 5, 5, 0, + 12, 12, 12, 12, 12, 12, 12, 33, 1, 1, 1, 1, 24, 5, 0, 33, + 1, 1, 1, 1,145, 1, 1, 1, 18, 0, 0, 26, 5, 5, 5, 5, + 1, 1, 1, 1, 45, 5, 5, 5, 5, 91, 5, 5, 5, 5, 5, 5, + 1, 1, 1, 1, 1, 20, 25, 15, 19, 5, 5, 5, 20, 15, 19, 15, + 24, 5, 5, 5, 1, 1, 1, 1, 1, 5, 12, 11, 11, 11, 11, 11, + 62, 1, 1, 1, 1, 1, 1, 1, 24, 15, 17, 1, 1, 1, 14, 17, + 14, 14, 0, 1, 1, 0, 25, 15, 19, 5, 23, 35, 37, 35, 19, 14, + 0, 0, 0, 35, 0, 0, 1, 17, 1, 30, 10, 10, 10, 70, 40, 23, + 26, 20, 17, 1, 1, 14, 0, 17, 14, 1, 17, 14, 1, 0, 23, 15, + 19, 23, 0, 26, 23, 26, 5, 0, 26, 0, 0, 0, 17, 1, 14, 14, + 5, 1, 24, 33, 0, 0, 0, 0, 26, 20, 17, 1, 1, 1, 1, 17, + 14, 1, 17, 1, 1, 0, 25, 15, 19, 5, 5, 26, 20, 35, 19, 0, + 80, 0, 0, 0, 17, 5, 5, 5, 26, 15, 17, 1, 1, 1, 14, 17, + 14, 1, 17, 1, 1, 0, 25, 19, 19, 5, 23, 35, 37, 35, 19, 0, + 0, 0, 26, 20, 0, 0, 1, 17, 82, 10, 10, 10, 0, 0, 0, 0, + 0, 25, 17, 1, 1, 14, 0, 1, 14, 1, 1, 0, 17, 14, 14, 1, + 0, 17, 14, 0, 1, 14, 0, 1, 1, 1, 1, 1, 1, 0, 0, 15, + 20, 37, 0, 15, 37, 15, 19, 0, 14, 0, 0, 35, 0, 0, 0, 0, + 10, 63, 3, 3, 70, 29, 0, 0, 20, 15, 25, 1, 1, 1, 14, 1, + 1, 1, 1, 1, 1, 0, 25, 5, 20, 15, 37, 5, 23, 5, 5, 0, + 0, 0, 26, 23, 1, 14, 1, 0, 0, 0, 0, 38, 10, 10, 10, 63, + 24, 15, 53, 1, 1, 1, 14, 1, 1, 1, 17, 1, 1, 0, 25, 19, + 15, 15, 37, 20, 37, 15, 5, 0, 0, 0, 35, 37, 0, 0, 1, 14, + 17, 34, 0, 0, 0, 0, 0, 0, 5, 15, 1, 1, 1, 1, 14, 1, + 1, 1, 1, 1, 1, 24, 25, 15, 19, 5, 23, 15, 37, 15, 19, 56, + 0, 0, 1, 34, 10, 10, 10,112, 10, 10, 10, 10, 63, 1, 1, 1, + 26, 15, 17, 1, 1, 1, 1, 1, 1, 1, 1, 14, 0, 1, 1, 1, + 1, 17, 1, 1, 1, 1, 17, 0, 1, 1, 1, 14, 0, 23, 0, 35, + 15, 5, 23, 23, 15, 15, 15, 15, 0, 15, 33, 0, 0, 0, 0, 0, + 24, 1, 5, 5, 5, 23, 0,113, 1, 1, 1, 72, 5, 5, 5, 36, + 11, 11, 11, 11, 11, 12, 0, 0, 17, 14, 14, 1, 1, 14, 1, 1, + 1, 1, 17, 17, 1, 1, 1, 1, 24, 1, 5, 5, 5, 5, 25, 0, + 1, 1, 14, 61, 5, 5, 5, 23, 11, 11, 11, 11, 11, 0, 1, 1, + 56, 3, 12, 12, 12, 12, 12, 12, 12, 57, 57, 3, 5, 3, 3, 3, + 10, 10, 43, 43, 43, 27, 27, 15, 1, 1, 1, 1, 17, 1, 1, 1, + 26, 5, 5, 5, 5, 5, 5, 20, 5, 5, 36, 5, 1, 1, 24, 5, + 5, 5, 5, 5, 26, 5, 5, 5, 5, 5, 5, 5, 5, 5, 23, 3, + 3, 3, 3, 55, 3, 3, 29, 3, 12, 12, 57, 3, 66, 33, 0, 0, + 1, 1, 1, 1, 1, 34, 19, 5, 20, 5, 5, 5, 19, 20, 19, 25, + 1, 1, 1, 15, 5, 1, 1, 5, 25, 15, 46, 34, 15, 15, 15, 1, + 24, 5, 25, 1, 1, 1, 1, 1, 1, 20, 19, 20, 15, 15, 19, 34, + 11, 11, 11, 11, 11, 15, 19, 3, 7, 7, 7, 39, 0, 0, 39, 0, + 6, 6, 6, 6, 6,111, 69, 6, 1, 1, 1, 14, 14, 1, 1, 0, + 14, 1, 1, 0, 1, 1, 1, 14, 1, 1, 1, 1, 1, 14, 26, 5, + 12, 12, 12, 12,114, 10, 10, 10, 7, 7, 7, 0, 6, 6, 6, 0, + 1, 1, 1, 1, 1, 1, 56, 53,146, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1,147,116, 0, 1, 1, 1, 1, 1, 40, 12, 16, + 148, 1, 1, 1, 14, 0, 0, 0, 1, 5, 20, 0, 0, 0, 0, 17, + 1, 5, 83, 33, 0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 14, 1, 14, 5, 0, 0, 0, 0, 0, 0, + 1, 1, 5, 19, 5, 5, 5, 15, 15, 15, 15, 20, 19, 5, 5, 5, + 5, 5, 12, 62, 12, 80, 24, 0, 10, 10, 10, 10, 10, 0, 0, 0, + 12, 12, 12, 92, 12, 71, 5, 91, 1, 45, 1, 1, 1, 1, 1, 1, + 1, 1, 24, 25, 1, 1, 1, 1, 1, 1, 1, 1, 24, 14, 0, 0, + 5, 20, 15, 19, 20, 15, 0, 0, 15, 20, 15, 15, 19, 5, 0, 0, + 29, 0, 12, 11, 11, 11, 11, 11, 1, 1, 14, 0, 0, 0, 0, 0, + 11, 11, 11, 11, 11, 51, 0, 3, 1, 1, 1, 24, 20, 19, 0, 12, + 1, 1, 34, 20, 5, 5, 5, 23, 20, 20, 19, 5, 5, 5, 20, 15, + 15, 19, 5, 5, 5, 5, 23, 26, 12, 12, 12, 62, 12, 12, 12, 0, + 5, 5, 5, 5, 5, 5, 5, 93, 5, 5, 5, 5, 5, 5, 0, 0, + 5, 5, 46, 1, 1, 1, 1, 1, 1, 1, 20, 5, 5, 20, 20, 15, + 15, 20, 46, 1, 1, 1, 14, 12, 57, 3, 3, 3, 3, 43, 5, 5, + 5, 5, 3, 3, 3, 3, 66, 12, 34, 5, 5, 15, 5, 19, 5, 1, + 1, 1, 1, 20, 5, 15, 19, 19, 5, 15, 0, 0, 0, 0, 12, 12, + 1, 1, 15, 15, 15, 15, 5, 5, 5, 5, 15, 5, 0, 38, 12, 12, + 11, 11, 11, 11, 11, 0, 17, 1, 6, 6, 6, 6, 21, 47, 0, 0, + 7, 7, 7, 7, 7, 32, 39, 7, 12, 12, 12, 12, 0, 0, 0, 0, + 5, 36, 5, 5, 5, 5, 5, 5, 20, 5, 5, 5, 25, 1, 24, 1, + 1, 1, 25, 34, 5, 14, 0, 0, 6, 6, 6, 6, 6, 6, 13, 13, + 13, 13, 13, 13, 13, 69, 6, 6, 6, 6, 6, 6, 69, 6, 6, 6, + 6, 6, 6, 6, 6,117, 13, 13, 8, 8, 8, 6, 6, 6, 6, 8, + 6, 6, 6, 6, 39, 39, 39, 39, 6, 6, 6, 6, 6, 6, 6, 0, + 6, 6, 47, 6, 7, 7, 94,118, 22, 6, 47, 6, 7, 7, 94, 22, + 6, 6, 0, 6, 7, 7,149, 22, 6, 6, 6, 6, 7, 7,150, 22, + 0, 6, 47, 6, 7, 7, 94,151, 74, 74, 74, 74, 74,152, 18, 18, + 84, 84, 84, 12, 58,119, 58,119, 12, 12, 12, 12,153, 18, 18,154, + 12, 12, 12, 12,120,121, 12,122,123, 12, 64, 65, 12, 12, 12, 12, + 12, 77,123, 12, 12, 12, 12,155, 18, 18,156, 18, 18, 18, 18, 18, + 157, 0, 10, 10, 10, 9, 64,158, 10, 10, 10, 10, 10, 9, 64,116, + 13, 13, 13, 13, 13, 13, 61, 0, 30, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 5,159, 79, 93, 79, 93, 5, 5, 5, 5, 5, + 23, 0, 0, 0, 0, 0, 0, 0, 3, 85, 3, 95, 3, 21, 7, 6, + 7, 8, 95, 3, 90, 7, 7, 3, 3, 3, 85, 85, 85, 7, 7,160, + 7, 7, 67, 1,124, 3, 6, 7, 9, 9, 90, 6, 6, 50, 3,125, + 16,161,162, 16,126, 3, 0, 0, 9, 9, 48, 3, 3, 9, 3, 3, + 48, 50, 3, 48, 3, 3, 3, 48, 3, 3, 3, 3, 3, 3, 3, 9, + 3, 48, 48, 3, 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, + 3, 3, 3, 3, 27, 27, 3, 3, 9, 3, 3, 3,163,164, 3, 3, + 3, 3, 3, 3, 3, 3, 48, 3, 3, 3, 3, 3, 3, 50, 9, 9, + 9, 9, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 9, 9, + 9, 3, 3, 3, 3, 3, 3, 3, 10, 10, 10, 10, 10, 10, 3, 3, + 3, 3, 3, 3, 3, 10, 10, 10, 3, 3, 3, 50, 3, 3, 3, 3, + 50, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, + 3, 3, 3, 3, 3, 3, 3, 50, 3, 3, 3, 3, 27, 27, 27, 27, + 27, 27, 27, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, + 9, 9, 64,127, 9, 9, 9, 9, 9, 9, 9, 27, 27, 27, 27, 27, + 9, 64, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,127, 9, 9, 9, + 9, 9, 9, 9, 27, 27, 9, 9, 9, 9, 9, 9, 9, 9, 27, 9, + 9, 9, 48, 50, 9, 9, 48, 3, 3, 3, 0, 3, 3, 3, 3, 3, + 8, 7, 8, 21, 21, 21, 21, 7, 8, 8, 21, 6, 6, 6, 13, 7, + 8, 8,125, 3, 3, 95, 21,165, 5, 8, 0, 0, 38, 12,114, 12, + 6, 6, 6, 42, 0, 0, 42, 0, 1, 1, 1, 1, 0, 0, 0, 54, + 33, 0, 0, 0, 0, 0, 0, 26, 12, 58, 58, 12,120,121, 58, 12, + 12, 12, 12, 76, 12, 92, 58, 12, 58, 27, 27, 27, 27, 12, 12, 62, + 12, 12, 12, 12, 12, 84, 12, 12, 92,166, 12, 12, 12, 12, 12, 12, + 3, 12, 96, 31, 31, 31,167, 0, 3, 3, 3, 3, 3, 44, 3, 3, + 87, 12,168,128, 27, 27, 27, 27, 27, 3, 27, 27, 27, 27,129,169, + 170, 16, 16, 16, 16, 5, 5, 15,130, 13, 13, 3, 16,171, 40, 3, + 1, 1, 1, 14, 26,172,131, 52, 1, 1, 1, 1, 1, 40, 13, 52, + 0, 0, 17, 1, 1, 1, 1, 1, 3, 10, 10, 3, 3, 3, 3, 3, + 3, 3, 3, 0, 0, 0, 0, 44, 3, 3, 3, 3, 10, 10, 10, 10, + 1, 1, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,132, 12, + 11, 11, 11, 11, 11, 1, 0, 0, 8, 8, 8, 8, 8, 8, 8, 24, + 79,173, 5, 5, 5, 5, 5, 62, 8, 8, 8, 8, 8, 8, 13, 5, + 1, 1, 1, 16, 16, 16, 16, 16, 5, 12, 12, 12, 0, 0, 0, 0, + 22, 22, 22,131, 13, 13, 13, 13, 22, 8, 8, 8, 8, 8, 8, 8, + 6, 8, 8, 8, 8, 8, 8, 8, 69, 6, 6, 6, 21, 21, 21, 8, + 8, 8, 8, 8, 68,174, 21, 67, 8, 8, 6, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 7, 7, 8, 7, 7, 8, 8, 8, 8, 8, 8, + 8, 8, 7, 7, 21, 21, 8, 8, 8, 8, 8, 8, 8, 8, 32, 0, + 54, 13,175, 67, 13, 67, 1, 1, 1, 25, 1, 25, 1, 24, 1, 1, + 1, 34, 19, 20, 3, 3, 23, 0, 10, 10, 10, 3, 97, 0, 0, 0, + 1, 1, 12, 12, 0, 0, 0, 0, 15, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 15, 15, 15, 15, 15, 15, 15, 15, 5, 0, 0, 0, 0, 12, + 5, 1, 1, 1, 12, 53, 53, 24, 1, 1, 1, 5, 5, 5, 5, 12, + 1, 1, 1, 24, 5, 5, 5, 5, 5, 15, 0, 0, 0, 0, 0, 38, + 1, 24, 15, 5, 5, 15, 5, 15, 83, 12, 12, 12, 12, 12, 12, 54, + 1, 1, 24, 52, 1, 1, 1, 1, 11, 11, 11, 11, 11, 1, 1, 14, + 1, 1, 1, 1, 24, 5, 5, 20, 19, 20, 19, 23, 0, 0, 0, 0, + 1, 24, 1, 1, 1, 1, 20, 0, 11, 11, 11, 11, 11, 0, 12, 12, + 52, 1, 1, 56, 3, 34, 20, 1, 25, 5, 25, 24, 25, 1, 1, 5, + 24, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 45, 12, + 1, 1, 1, 1, 1, 34, 5, 15, 12, 45,176, 23, 0, 0, 0, 0, + 17, 1, 1, 14, 17, 1, 1, 14, 17, 1, 1, 14, 0, 0, 0, 0, + 6, 6, 6, 6, 6,118, 13, 13, 6, 6, 6, 6,117, 22, 0, 0, + 1, 34, 19, 15, 20, 83, 19, 0, 1, 1, 1, 14, 0, 17, 1, 1, + 6, 6, 6, 47, 0, 0, 0, 0, 0, 42, 6, 6, 0, 0, 17, 25, + 1, 1, 1, 1,177, 1, 1, 1, 1, 1, 1, 14, 1, 1, 14, 14, + 1, 17, 14, 1, 1, 1, 1, 1, 1, 22, 22, 22, 22, 22, 22, 22, + 22,107, 3, 3, 3, 3, 3, 3, 3, 82, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 31, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 97, 3, + 12, 12, 12, 96, 65, 0, 0, 0, 76,178,179, 31, 31, 31, 31, 31, + 31, 31, 65, 96, 65, 12,122,180, 12, 33, 12, 12,129, 31, 31, 65, + 12,181, 9, 98, 80, 12, 0, 0, 1, 1, 14, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 14, 73, 38, 12,100, 12, 27,101, 76, 12, + 6, 6, 6, 6, 6,105,106, 64, 65, 27, 12, 1, 1, 1, 1, 1, + 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, + 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 14, 0, + 30,182, 70,183, 50, 9, 48, 29, 0, 0, 0, 0, 73, 18, 3, 0, + 1, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 1, 1, 14, 1, 17, + 12, 33, 0, 49, 10, 10, 10, 10, 10, 10, 0, 44, 3, 3, 3, 3, + 16, 16,126, 10, 63, 3, 3, 3, 3, 3, 3, 3, 3, 10, 3, 29, + 3, 3, 3, 3, 3, 3, 43, 0,133, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 0, 0, 10, 10, 0, 0, 0, 0, 17, 1, + 128, 1, 1, 1, 1, 99, 0, 0, 1, 1, 1, 5, 5, 23, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 38, 1, 1, 0, 0, 1, 1, 1, 1, + 184, 16, 16, 0, 0, 0, 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, + 7, 7, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, + 1, 1, 0, 0, 0, 0, 0, 38, 7, 32, 7, 42, 6, 6, 6, 6, + 6, 42, 6, 6, 6, 6, 6, 6, 6, 42, 6, 6, 6, 42, 47, 0, + 13, 13, 13, 54, 13, 13, 13, 13, 61, 13, 13, 13, 13, 61, 0, 0, + 1, 1, 1, 0, 14, 1, 1, 1, 1, 1, 1, 17, 14, 0, 14, 17, + 1, 1, 1, 38, 10, 10, 10, 10, 1, 1, 1, 56, 75, 10, 10, 10, + 0, 0, 0, 49, 10, 10, 10, 10, 1, 14, 1, 0, 0, 49, 10, 10, + 1, 1, 1, 10, 10, 10, 0, 38, 1, 1, 1, 1, 1, 0, 0, 38, + 1, 1, 1, 1, 0, 0, 10, 1, 24, 5, 26, 23, 0, 0, 5, 5, + 1, 1, 17, 1, 17, 1, 1, 1, 1, 1, 1, 0, 5, 23, 0, 26, + 12, 12, 12, 12, 33, 0, 0, 0, 1, 1, 1, 1, 1, 1, 86, 78, + 1, 1, 1, 1, 82, 1, 1, 1, 1, 1, 24, 23, 0, 49, 10, 10, + 12, 12, 12, 33, 0, 0, 0, 0, 1, 1, 1, 0, 38, 12, 12, 12, + 1, 1, 1, 0, 10, 10, 10, 10, 1, 14, 0, 0, 10, 10, 10, 10, + 1, 0, 0, 0, 38, 12, 33, 0, 0, 0, 0, 0, 49, 10, 10, 10, + 7, 32, 0, 0, 0, 0, 0, 0, 6, 47, 0, 0, 0, 10, 10, 10, + 1, 1, 5, 5, 0, 0, 0, 0, 11, 11, 11, 11, 11, 1, 1, 52, + 7, 7, 7, 0, 26, 5, 5,130, 6, 6, 6, 0, 0, 0, 0, 9, + 10, 10, 10, 10, 10, 10, 10, 51, 1, 1, 1, 1, 1, 26,185, 0, + 0, 1, 45, 1, 0, 0, 0, 0, 57, 3, 3, 3, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 5, 5, 10, 10, 10,112, 0, 0, 0, 0, + 133, 10, 78, 12, 12, 0, 0, 0, 1, 5, 5, 12, 12, 0, 0, 0, + 1, 1, 86, 10, 10, 10, 0, 0, 19, 46, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 36, 12, 12, 12, 0, + 10, 10, 10, 11, 11, 11, 11, 11, 25, 24, 25, 0, 0, 0, 0, 26, + 15, 19, 5, 20, 19, 36,186, 12, 12, 23, 0, 0, 0, 0, 73, 0, + 5, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 24, 5, 5, 19, 5, + 5, 5, 23, 11, 11, 11, 11, 11, 12, 12, 34, 46, 0, 0, 0, 0, + 1, 24, 12, 14, 0, 0, 0, 0, 1, 34, 15, 5, 5, 5, 5, 20, + 46, 1, 40, 12, 71, 5, 36, 19, 11, 11, 11, 11, 11, 40, 40, 12, + 10, 10, 51, 0, 0, 0, 0, 0, 5, 15, 20, 5, 12, 12, 12, 25, + 24, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 14, 14, 1, 1, 17, + 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 40, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 24, 15, 19, 5, 5, 5, 23, 0, 0, + 5, 15, 17, 1, 1, 1, 14, 17, 14, 1, 17, 1, 1, 26, 25, 15, + 20, 15, 37, 35, 37, 35, 15, 0, 14, 0, 0, 35, 0, 0, 17, 1, + 1, 15, 0, 5, 5, 5, 23, 0, 5, 5, 23, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 17, 0, 14, 1, 1, 1, 17, 15, 19, 5, 5, + 23, 37, 35, 35, 15, 37, 15, 20, 25, 25, 12, 38, 33, 0, 0, 0, + 26, 23, 0, 0, 0, 0, 0, 0, 1, 1, 34, 15, 5, 5, 5, 5, + 15, 5, 20, 25, 1, 40, 12, 12, 11, 11, 11, 11, 11, 12, 38, 25, + 15, 19, 5, 5, 20, 20, 15, 19, 20, 5, 1, 53, 0, 0, 0, 0, + 15, 5, 5, 0, 15, 15, 5, 19, 36, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 1, 1, 5, 0, 15, 19, 5, 5, 5, 20, 19, 19, + 36, 12, 14, 0, 0, 0, 0, 0, 12, 12, 12, 12, 12, 12, 33, 0, + 1, 1, 1, 1, 1, 24, 19, 15, 5, 5, 5, 19, 40, 0, 0, 0, + 11, 11, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 14, 26, 19, + 15, 5, 5, 19, 5, 5, 0, 0, 11, 11, 11, 11, 11, 10, 12, 57, + 5, 5, 5, 5, 19, 36, 0, 0, 10, 51, 0, 0, 0, 0, 0, 17, + 1, 1, 1, 14, 17, 0, 1, 1, 1, 1, 17, 14, 1, 1, 1, 1, + 15, 15, 15, 35, 37, 26, 20, 25, 46, 19, 12, 33, 0, 0, 0, 0, + 1, 1, 1, 1, 0, 1, 1, 1, 34, 15, 5, 5, 0, 5, 15, 15, + 25, 53, 37, 0, 0, 0, 0, 0, 24, 5, 5, 5, 5, 25, 1, 1, + 1, 24, 5, 5, 20, 24, 5, 36, 12, 12, 12, 71, 0, 0, 0, 0, + 24, 5, 5, 20, 19, 5, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, + 5, 5, 5, 20, 5, 12, 53, 12, 12, 33, 0, 0, 0, 0, 0, 0, + 12, 12, 12, 12, 12, 0, 0, 0, 20, 5, 20, 20, 0, 0, 0, 0, + 40, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 23, 5, 5, 5, 19, + 40, 12, 12, 0, 0, 0, 0, 0, 12, 1, 1, 1, 1, 1, 1, 1, + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 35, 5, 5, 5, + 20, 5, 19, 23, 0, 0, 0, 0, 1, 1, 1, 14, 1, 17, 1, 1, + 24, 5, 5, 23, 0, 23, 5, 26, 5, 5, 5, 24, 0, 0, 0, 0, + 1, 1, 1, 17, 14, 1, 1, 1, 1, 1, 1, 1, 1, 15, 15, 37, + 5, 35, 19, 19, 14, 0, 0, 0, 1, 1, 1, 1, 45, 1, 0, 0, + 1, 24, 20, 83, 33, 0, 0, 0, 5, 34, 1, 1, 1, 1, 1, 1, + 1, 1, 15, 5, 5, 23, 0, 15, 20, 36, 12, 12, 12, 12, 12, 12, + 11, 11, 11, 11, 11, 23, 0, 0, 10, 10, 63, 3, 3, 3, 70, 30, + 97, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 38, + 16, 16, 16, 16, 16, 16, 16, 99, 12, 12, 33, 0, 0, 0, 0, 0, + 40, 33, 0, 0, 0, 0, 0, 0, 25, 1, 1, 24, 5, 5, 5, 5, + 5, 5, 5, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 15, 19, 5, + 5, 5, 36, 0, 0, 0, 0, 0, 5, 5, 5, 36, 12, 12, 3, 3, + 13, 13, 57, 0, 0, 0, 0, 0, 11, 11, 11, 11, 11, 49, 10, 10, + 10, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 17, 1, + 13, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45,132, 12, + 10, 10, 10, 78, 12, 33, 0, 0, 7, 7, 7, 7, 32, 42, 6, 6, + 6, 6, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 14, 0, 26, + 34, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 26, + 5, 81, 13, 13, 13, 13, 13, 13, 13, 62, 23, 0, 0, 0, 0, 0, + 15, 13, 16, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, + 13, 13, 54, 13, 13, 13, 54, 61, 0, 14, 0, 0, 0, 0, 0, 0, + 1, 14, 17, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 0, 43, 36, 18, 18, 0, 0, 0, 0, 0, 0, + 11, 11, 11, 11, 11, 3, 29, 0, 3, 3, 0, 0, 0, 3, 3, 3, + 98, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 29, 44, 3, 3, 3, + 3, 3,134, 19, 5, 3,134, 15, 15,187, 18, 18, 18, 91, 5, 5, + 5, 55, 43, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, + 3, 5, 55, 0, 0, 0, 0, 0, 6, 6, 47, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 32, 7, 0, 32, 39, 32, 39, 7, 32, 7, + 7, 7, 7, 6, 6, 42, 42, 6, 6, 6, 42, 6, 6, 6, 6, 6, + 6, 6, 7, 39, 7, 32, 39, 7, 7, 7, 32, 7, 7, 7, 32, 6, + 6, 6, 6, 6, 7, 39, 7, 32, 7, 7, 32, 32, 0, 7, 7, 7, + 32, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 7, 7, 7, 7, + 59, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 60, 6, 6, + 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 59, 6, 6, + 6, 6, 60, 6, 6, 6, 7, 7, 7, 7, 59, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 60, 6, 6, 6, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 59, 6, 6, 6, 6, 60, 6, 6, 6, + 7, 7, 7, 7, 59, 6, 6, 6, 6, 60, 6, 6, 6, 8, 0, 11, + 5, 5, 5, 55, 3, 43, 5, 5, 5, 5, 5, 5, 5, 5, 55, 3, + 3, 3, 43, 3, 3, 3, 3, 3, 3, 3, 55, 66, 12, 12, 0, 0, + 0, 0, 0, 0, 0, 26, 5, 5, 6, 6, 6, 6, 6,124, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 47, 0, 0, 42, 6, 6, 47, 0, 0, + 5, 5, 5, 23, 5, 5, 5, 5, 5, 5, 5, 5, 23, 26, 5, 5, + 5, 26, 23, 5, 5, 23, 0, 0, 13, 13, 13, 13, 13, 13, 13, 0, + 0, 0, 0, 0, 0, 0, 0, 26, 5, 5, 5, 81, 13, 13, 13, 0, + 11, 11, 11, 11, 11, 0, 0, 56, 1, 1, 1, 1, 1, 1, 1, 23, + 1, 1, 1, 1, 1, 1, 5, 5, 11, 11, 11, 11, 11, 0, 0,113, + 1, 1, 1, 1, 1, 45, 5, 5,188, 11, 11, 11, 11,189, 0, 38, + 1, 24, 1, 25, 1, 1, 1, 5, 1, 1, 24, 0, 0, 0, 0, 45, + 1, 1, 1, 14, 1, 1, 17, 14, 1, 1, 14, 49, 10, 10, 10, 10, + 6, 6, 5, 5, 5, 81, 0, 0, 10, 10, 10, 10, 10, 10, 75, 10, + 190, 10, 51, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 75, + 10, 10, 10, 10, 10, 10, 10, 0, 1, 1, 17, 1, 1, 1, 1, 1, + 17, 14, 14, 17, 17, 1, 1, 1, 1, 14, 1, 1, 17, 17, 0, 0, + 0, 14, 0, 17, 17, 17, 17, 1, 17, 14, 14, 17, 17, 17, 17, 17, + 17, 14, 14, 17, 1, 14, 1, 1, 1, 14, 1, 1, 17, 1, 14, 14, + 1, 1, 1, 1, 1, 17, 1, 1, 17, 1, 17, 1, 1, 17, 1, 1, + 9, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 63, 3, + 0, 0, 0, 3, 3, 3, 3, 3, 3, 29, 0, 0, 0, 0, 0, 0, + 3, 3, 3, 3, 3,108, 22, 22, 3, 3, 3, 3, 29, 0, 3, 3, + 9, 9, 9, 9, 98, 0, 0, 0, 3, 3, 3, 3, 3, 29, 0, 3, + 3, 3, 3, 29, 29, 0, 44, 3, 3, 3, 3, 3, 3, 3, 29, 44, + 3, 3, 3, 3, 3, 29, 0, 44, 3, 29, 3, 3, 3, 3, 3, 3, + 11, 11, 11, 11, 11, 29, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 7, 7, 3, 3, 26, 26, + 4, 4, 12, 12, 5, 5, 9, 9, 9, 5, 25, 25, 15, 15, 13, 13, + 21, 21, 6, 6, 7, 2, 10, 10, 14, 14, 2, 7, 1, 1, 10, 12, + 12, 10, 5, 9, 24, 24, 12, 2, 7, 12, 12, 7, 2, 12, 22, 18, + 0, 0, 26, 2, 23, 23, 18, 22, 9, 2, 21, 2, 7, 10, 2, 10, + 12, 21, 10, 2, 2, 21, 2, 9, 7, 21, 8, 8, 2, 5, 26, 12, + 2, 26, 7, 6, 10, 7, 5, 2, 25, 26, 2, 15, 26, 25, 15, 2, + 6, 7, 21, 7, 2, 6, 12, 26, 7, 26, 21, 26, 20, 19, 9, 25, + 5, 25, 6, 2, 21, 6, 15, 26, 25, 22, 18, 21, 26, 21, 5, 7, + 6, 24, 6, 5, 26, 23, 21, 12, 6, 12, 2, 1, 29, 29, 26, 15, + 21, 17, 25, 21, 15, 21, 11, 11, 21, 23, 12, 6, 26, 7, 10, 21, + 17, 17, 9, 26, 7, 15, 29, 21, 21, 9, 24, 5, 25, 9, 1, 12, + 17, 21, 11, 12, 8, 24, 26, 9, 21, 22, 23, 26, 25, 2, 14, 2, + 23, 21, 21, 25, 9, 22, 21, 18, 24, 16, 5, 22, 25, 18, 24, 26, + 26, 24, 9, 8, 8, 5, 5, 21, 15, 7, 2, 23, 21, 15, 17, 7, + 18, 2, 5, 6, 5, 24, 22, 20, 21, 20, 19, 21, 21, 16, 16, 21, + 7, 5, 5, 26, 14, 15, 18, 25, 7, 14, 17, 22, 17, 6, 24, 6, + 6, 21, 12, 15, 26, 10, 25, 0, 7, 20, 25, 1, 24, 15, 7, 19, + 9, 21, 17, 2, 17, 12, 1, 21, 12, 1, 24, 7, 29, 7, 7, 22, + 14, 7, 2, 24, 9, 24, 24, 2, 29, 1, 27, 28, 1, 29, 21, 29, + 1, 2, 15, 6, 18, 6, 12, 11, 26, 5, 14, 9, 5, 14, 26, 22, + 18, 26, 5, 12, 22, 21, 18, 17, 26, 6, 18, 18, 26, 14, 14, 6, + 12, 24, 11, 21, 24, 9, 6, 9, 6, 10, 7, 25, 17, 16, 16, 22, + 16, 16, 25, 17, 25, 24, 23, 2, 21, 14, 12, 17, 21, 1, 10, 1, + 7, 13, 13, 2, 23, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 10, 11, 12, 13, 0, 14, 0, 0, 0, 0, 0, 15, 0, 16, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 20, 0, 21, 22, 23, 0, 0, 0, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 36, 0, 37, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, + 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, 45, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 11, 12, 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, 15, + 0, 0, 0, 0, 0, 0, 0, 16, 17, 18, 0, 19, 0, 20, 21, 0, + 0, 22, 23, 24, 25, 26, 0, 0, 0, 0, 27, 28, 29, 30, 0, 31, + 0, 32, 33, 0, 2, 34, 0, 0, 2, 1, 35, 0, 2, 1, 0, 0, + 2, 1, 0, 0, 2, 1, 0, 0, 0, 1, 0, 0, 2, 36, 0, 0, + 2, 1, 0, 0, 37, 1, 0, 0, 0, 38, 0, 0, 39, 40, 0, 0, + 41, 42, 0, 43, 44, 0, 45, 46, 0, 47, 0, 0, 48, 0, 0, 49, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 51, 4, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 0, + 53, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 55, 0, 0, 56, 0, + 57, 58, 59, 0, 60, 5, 61, 0, 62, 0, 63, 0, 64, 0, 0, 0, + 0, 65, 66, 0, 0, 0, 0, 0, 0, 67, 68, 0, 0, 0, 0, 0, + 0, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 71, 0, 0, 0, 3, 0, 0, 0, 72, 0, 73, 0, 0, 74, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 76, + 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 6, 78, 0, 0, 0, + 0, 5, 79, 0, 80, 81, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, + 82, 83, 84, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 86, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 0, 0, + 0, 0, 88, 0, 0, 0, 89, 0, 0, 0, 0, 90, 91, 0, 0, 0, + 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 93, 0, 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 95, 0, 96, 0, 0, 97, 0, 98, 0, 0, 0, 0, 0, 6, 99, 0, + 9, 0, 0,100,101, 0, 7, 0, 0,102, 0, 0,103, 0, 0, 0, + 0, 0,104, 0,105, 1,106, 0, 0,107, 0, 0, 0,108, 0, 0, + 0,109, 0, 0, 0, 0, 0, 0, 3,110, 0, 0, 3, 0, 0, 0, + 111, 0, 0, 0,112, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, + 0, 0, 0, 0,113,114, 0, 0, 0, 0, 8, 0, 4,115, 0,116, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 0,117, 0,118, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,121, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,122, 0, 0, 0, 0,123, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,124,125,126, 0, 0, 0, 0,127, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,129, 0, 0,130, + 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 131, 0,132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,133, 0, 0, 0, 0, 0, 0, 0,134, 0, 0, 0, 0, 0, + 0, 0,135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0,136, 0, 0, 0,137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, + 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 3, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 15, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 1, 12, 0, 0, 1, 1, + 1, 1, 1, 49, 50, 5, 51, 52, 53, 5, 5, 22, 32, 23, 1, 54, + 24, 55, 16, 33, 56, 57, 58, 1, 1, 1, 0, 0, 0, 0, 6, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59, 7, 60, 1, 34, 5, + 7, 61, 62, 63, 64, 65, 66, 67, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 68, 0, 0, 0, 69, 70, 71, 35, 1, 25, 0, 0, + 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 8, 1, 26, 16, 26, + 73, 27, 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, + 0, 0, 36, 25, 75, 37, 7, 37, 76, 0, 0, 0, 0, 0, 0, 0, + 6, 1, 7, 0, 0, 17, 0, 0, 0, 0, 0, 8, 38, 1, 1, 13, + 13, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, + 0, 0, 0, 6, 18, 1, 0, 0, 8, 16, 5, 1, 1, 1, 77, 7, + 36, 18, 78, 7, 35, 1, 0, 0, 0, 4, 79, 10, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 19, 0, 0, 0, 4, 0, 80, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 3, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 83, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 85, 86, 0, 0, 0, + 0, 0, 87, 88, 89, 90, 91, 92, 0, 0, 0, 0, 0, 0, 0, 93, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 28, 0, 0, 0, + 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, + 0, 0, 0, 41, 0, 0, 0, 0, 0, 0, 14, 0, 0, 20, 0, 0, + 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, 0, + 0, 0, 0, 6, 29, 0, 3, 0, 0, 0, 0, 13, 1, 96, 0, 0, + 0, 0, 1, 18, 33, 97, 25, 23, 7, 1, 1, 1, 1, 27, 1, 7, + 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, + 6, 23, 1, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 21, + 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, + 0, 0, 12, 32, 24, 5, 99, 22, 42, 17, 0, 10, 11, 0, 7, 1, + 7,100,101, 1, 1, 1, 1, 1, 1, 1, 1,102,103,104, 0, 0, + 0, 0,105, 1,106, 10, 20,107,108, 5, 10, 0, 0, 0, 0, 0, + 0, 6, 11, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, + 109,110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,111, 0, 0, 0, + 0, 6, 0, 1, 1, 11, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, + 0, 0, 11, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 1, 1, + 1, 1, 11, 0, 0, 0, 0, 0, 43, 40, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 44,112, 10, 8, 20, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, + 0, 0, 0, 0, 0,113, 1, 16, 5, 24, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 17, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 8, 12, 0, 0, 0, 0,114, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,115, 2, 0,116, 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 13, 11, 0, 0, 0, 0, 0, 0, + 6, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 39, 0, 45, + 16, 18, 29, 0, 0, 0, 46, 27, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 2, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 3, 0, 0, 3, 0, 21, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 0, 0, 0, 0,117, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 9, 0, 8, 1, 10, 1, 10, 0, 0, 0, 0, + 0, 30, 3, 0, 0, 0, 14, 21, 0, 0, 0, 0, 0, 19, 47, 0, + 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 47, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 28, 15, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 21, 41, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 28, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, + 0, 0, 22, 42, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,119, 0,120,121,122,123, 0, 43, 5, 48, 13, + 34, 0, 0, 0, 0, 0, 0, 0, 8, 11, 0, 0, 0, 0, 8, 10, + 0, 0, 0, 0, 0, 0, 1, 12, 1, 1, 1, 1, 26, 1, 38, 44, + 12, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, + 0, 19, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 0,124, 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, 6, 19, + 0, 8, 0, 20, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 1, + 125, 0, 0, 0, 0, 0,230,230,230,230, 0, 0, 0, 9, 9, 0, + 0, 0, 0, 9, 0, 0,220,220,220,220, 0, 0, 0,230,230,230, + 220,230, 0, 0,230,230, 7, 0, 0, 0,230, 0, 0, 0,230,230, + 0, 0,230,230,230, 0, 0,230,230,230, 0, 0, 9, 0, 0, 0, + 0, 7,230,230,230,220, 0,220, 0, 0,230,220,220,220, 0, 0, + 230, 0, 0,230, 0, 0, 0, 0, 7, 0, 1, 1, 1, 1,220,230, + 230,230,220,220,230,230,220,230,230,220,230, 0, 0,230,230,220, + 0, 0, 0, 9, 9, 0,220, 0, 0, 0, 0, 0, 9, 9, 0, 9, + 7, 0, 1,220,220,220,220,220,220,230,230,230,220,220,230,220, + 220,230,230,220,230,230,220,230,220,230,230,230, 0,230, 0,220, + 220,220,220,220, 0, 0, 9, 9, 0, 0, 1, 0, 0, 0, 0, 0, + 0,220,230, 0,230,230, 0, 0,220,220, 0, 0,230,220, 0, 0, + 9, 7,220,220,220, 0,230,232,220,220,220,220,232,216,220,202, + 202,220,220,220,220,202,202,220,220,220,230,240,230,220,230,220, + 220, 0,232,220,220,230,233,234,234,233,234,234,233,230, 0,220, + 230,230,230,230,222,220,230,222,228,230, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 19, 20, 21, 22, 0, 23, 0, 24, 25, 0,230,220, + 0, 18, 30, 31, 32, 0, 0, 0, 0, 27, 28, 29, 30, 31, 32, 33, + 34,230, 35, 0, 0, 0,230, 0,220,230, 0, 36, 0, 0,220,220, + 230,220,220,230,230, 0,230,230, 0,220, 27, 28, 29,230, 0,230, + 220,230, 0, 84, 91, 0,103,103, 9, 0,107,107,107,107,118,118, + 9, 0,122,122,122,122, 0,220, 0,220, 0,216, 0, 0, 0,129, + 130, 0,132, 0, 0, 0, 0, 0,130,130,130,130, 0, 0,130, 0, + 230,230, 9, 0,230,230, 0, 0,220, 0, 0,228, 0, 0, 0,222, + 230,220,230, 0, 0,220,230,220, 0,220,230,230,230,234,230, 0, + 1, 1,230,234,214,220,202,230,230,230,230,230,232,228,228,220, + 218,230,233,220,230,220,230,230, 1, 1, 1, 1, 1,230, 0, 1, + 1,230,220,230, 1, 1, 0, 0,218,228,232,222,224,224, 0, 8, + 8, 0,220, 0, 0,230, 0, 0, 26, 0, 0,220, 0,230,230, 1, + 220, 0, 0,230,220, 0, 0, 7, 9, 0, 6, 6, 0, 0, 0, 0, + 1, 0, 0,216,216, 1, 1, 1, 0, 0, 0,226,216,216,216,216, + 216, 0,232,232,220,230,230,230, 7, 0, 1, 0, 0, 0, 0, 0, + 0, 32, 0, 0, 0, 3, 0, 0, 0, 0, 4,101, 0,112,128,169, + 0, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,237, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 1, 1, 0, 3, 0, 0, 0, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 6, 7, 8, 9, 0, + 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 20, 0, 0, 21, 22, 0, 0, 0, 0, 23, 24, + 25, 26, 0, 27, 0, 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, + 0, 33, 34, 35, 36, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 38, 39, 0, 0, 0, 0, 2, 1, 40, 41, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 36, 0, 0, + 8, 0, 0, 0, 0, 44, 0, 0, 52, 0, 0, 0, 56, 0, 0, 0, + 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0, 24, 48, 0, 0, + 0, 0, 0, 0, 28, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 28, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, + 60, 64, 0, 68, 0, 72, 76, 80, 0, 0, 0, 0, 0, 8, 84, 88, + 0, 92, 16, 8, 0, 0, 0, 4, 4, 16, 4, 4, 4, 4, 4, 4, + 4, 24, 20, 0, 96, 0, 16,100,104, 0, 4, 4,108, 0, 0, 0, + 40,112, 8, 16, 4, 4, 4, 4, 4, 8,116,120,124,128, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 8, 0, 0, 24, 20,132, 36, 0, 28, 0,136, 16, 4, + 4, 4, 0, 0, 0, 0, 24, 12, 12,140,144, 12,148, 0,152, 8, + 4, 4, 0, 0,156, 0, 8, 8, 0, 24, 20, 8, 4, 0, 0, 0, + 8, 0, 0,160, 8, 8, 0, 0, 24, 20, 0, 8, 0, 8, 0, 8, + 0, 0, 0, 0, 40, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 16, + 4,164, 12, 12, 12, 12, 12, 12, 12, 12, 12, 20, 0,168,172,176, + 0,180, 0, 24, 20, 0, 0, 0, 0, 0, 0, 0, 0,184, 16, 8, + 28, 8, 0, 0, 0, 8, 4, 4, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 40, 12, 48, 0, 0, 4, 4, 8, 4, 4, 0, 0, 0, + 0, 0, 0, 0, 40, 20, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 32,188,192, 0, 0, 0, 0, 0, 0, 0, 4, 5, + 6, 7, 8, 9, 10, 1, 1, 11, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 12, 13, 2, 2, 2, 2, 14, 0, 0, 0, 0, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 0, 0, 0, 25, 26, 3, 3, 3, 27, + 0, 0, 0, 28, 29, 30, 0, 31, 32, 33, 34, 35, 36, 37, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 38, 1, 1, 39, 1, 40, 1, 1, 1, 41, 0, 42, 1, 1, + 43, 1, 1, 1, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 20, + 21, 8, 8, 8, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 2, 2, 51, 52, 53, 54, 9, 9, 9, 9, 9, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 8, 8, 70, 71, 72, + 73, 74, 75, 5, 5, 5, 5, 76, 5, 5, 5, 5, 5, 5, 5, 15, + 15, 5, 5, 5, 5, 77, 5, 78, 79, 80, 81, 82, 83, 1, 84, 85, + 86, 87, 88, 89, 90, 91, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 92, 1, 1, 1, 1, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 93, 16, 16, 94, 95, 96, 97, 98, + 99,100,101,102,103,104,105, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,106, 0, + 0, 1, 1,107,108,109, 13, 13, 13,110,111,112,113,114,115,116, + 117,118,119, 0,120,121,122,123,124,125,126, 17, 17,127,128,129, 130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145, - 95,146,147,148,149, 95,150,151,152,153,154,155,156,157,158,159, - 160,161, 95,162,163,164,165,165,165,165,165,165,165,166,167,165, - 168, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95,169,170,170,170,170,170,170,170,170,171,170, - 170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170, - 170,170,170,170,170,170,170,170,170,170,170,170,170,172,173,173, - 173,173,174, 95, 95, 95, 95, 95,175, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95,176,176,176,176,177,178,179,180, 95, 95, - 181, 95,182,183,184,185,186,186,186,186,186,186,186,186,186,186, - 186,186,186,186,186,186,186,186,186,186,186,186,187,187,187,188, - 189,190, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95,191,192,193,194,195,195,196, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,197,198, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 59,199, - 59, 59, 59,200,201,202, 59,203,204,205,206,207,208, 95,209,210, - 211, 59, 59,212, 59,213,214,214,214,214,214,215, 95, 95, 95, 95, - 95, 95, 95, 95,216, 95,217,218,219, 95, 95,220, 95, 95, 95,221, - 95,222, 95,223, 95,224,225,226,227, 95, 95, 95, 95, 95,228,229, - 230, 95,231,232, 95, 95,233,234, 59,235,236, 95, 59, 59, 59, 59, - 59, 59, 59,237, 59,238,239,240, 59, 59,241,242, 59,243, 95, 95, - 95, 95, 95, 95, 95, 95, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69,244, 69, 69,245, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69,246, 69, 69, 69, 69, 69, 69, 69, 69, 69,247, 69, 69, - 69, 69,248, 95, 95, 95, 69, 69, 69, 69,249, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 69, 69, 69, 69, 69, 69,250, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,251, 95, - 95, 95, 95, 95, 95, 95,252, 95,253,254, 0, 1, 2, 2, 0, 1, - 2, 2, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 19, 19, - 19, 19, 19, 19, 19, 0, 19, 0, 0, 0, 0, 0, 0, 0, 19, 19, - 19, 19, 19, 0, 0, 0, 0, 0, 26, 26, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 0, 9, 9, 9, 2, 2, - 9, 9, 9, 9, 0, 9, 2, 2, 2, 2, 9, 0, 9, 0, 9, 9, - 9, 2, 9, 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 2, 9, 9, 9, 9, 9, 9, 9, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 1, 1, 6, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 4, 4, - 4, 2, 2, 4, 4, 4, 2, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 2, 2, 2, 2, 2, 2, 2, 2, 14, 14, - 14, 2, 2, 2, 2, 14, 14, 14, 14, 14, 14, 2, 2, 2, 3, 3, - 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 0, 0, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 2, 37, 37, 37, - 37, 2, 2, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, - 2, 2, 2, 2, 2, 2, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 2, 2, 64, 64, 64, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, - 90, 90, 90, 90, 2, 2, 90, 90, 90, 90, 90, 90, 90, 2, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 2, 2, 95, 2, 37, 37, - 37, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 3, 3, 3, - 0, 3, 3, 3, 3, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, - 1, 1, 1, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 5, 5, - 5, 5, 2, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 5, 5, 2, - 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, - 5, 5, 5, 5, 5, 5, 5, 2, 5, 2, 2, 2, 5, 5, 5, 5, - 2, 2, 5, 5, 5, 5, 5, 2, 2, 5, 5, 5, 5, 2, 2, 2, - 2, 2, 2, 2, 2, 5, 2, 2, 2, 2, 5, 5, 2, 5, 5, 5, - 5, 5, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 11, - 11, 11, 2, 11, 11, 11, 11, 11, 11, 2, 2, 2, 2, 11, 11, 2, - 2, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 2, - 11, 11, 11, 11, 11, 11, 11, 2, 11, 11, 2, 11, 11, 2, 11, 11, - 2, 2, 11, 2, 11, 11, 11, 2, 2, 11, 11, 11, 2, 2, 2, 11, - 2, 2, 2, 2, 2, 2, 2, 11, 11, 11, 11, 2, 11, 2, 2, 2, - 2, 2, 2, 2, 11, 11, 11, 11, 11, 11, 11, 11, 11, 2, 2, 10, - 10, 10, 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 2, 10, 10, 10, - 2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 2, - 10, 10, 10, 10, 10, 10, 10, 2, 10, 10, 2, 10, 10, 10, 10, 10, - 2, 2, 10, 10, 10, 10, 10, 10, 2, 10, 10, 10, 2, 2, 10, 2, - 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 2, 2, 10, 10, 10, 10, - 2, 2, 2, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 10, 2, 21, - 21, 21, 2, 21, 21, 21, 21, 21, 21, 21, 21, 2, 2, 21, 21, 2, - 2, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 2, - 21, 21, 21, 21, 21, 21, 21, 2, 21, 21, 2, 21, 21, 21, 21, 21, - 2, 2, 21, 21, 21, 21, 21, 2, 2, 21, 21, 21, 2, 2, 2, 2, - 2, 2, 2, 21, 21, 21, 2, 2, 2, 2, 21, 21, 2, 21, 21, 21, - 21, 21, 2, 2, 21, 21, 2, 2, 22, 22, 2, 22, 22, 22, 22, 22, - 22, 2, 2, 2, 22, 22, 22, 2, 22, 22, 22, 22, 2, 2, 2, 22, - 22, 2, 22, 2, 22, 22, 2, 2, 2, 22, 22, 2, 2, 2, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 2, 2, 2, 2, 22, 22, 22, 2, - 2, 2, 2, 2, 2, 22, 2, 2, 2, 2, 2, 2, 22, 22, 22, 22, - 22, 2, 2, 2, 2, 2, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 2, 23, 23, 23, 2, 23, 23, 23, 23, 23, 23, 23, 23, - 2, 2, 23, 23, 23, 23, 23, 2, 23, 23, 23, 23, 2, 2, 2, 2, - 2, 2, 2, 23, 23, 2, 23, 23, 23, 2, 23, 23, 2, 2, 23, 23, - 23, 23, 2, 2, 23, 23, 2, 2, 2, 2, 2, 2, 2, 23, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, 16, 16, 2, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 2, 16, 16, 16, 16, 16, - 2, 2, 16, 16, 16, 16, 16, 2, 16, 16, 16, 16, 2, 2, 2, 2, - 2, 2, 2, 16, 16, 2, 2, 2, 2, 2, 16, 16, 16, 2, 16, 16, - 16, 16, 2, 2, 16, 16, 2, 16, 16, 16, 2, 2, 2, 2, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 2, 20, 20, 20, 2, - 20, 20, 20, 20, 20, 20, 2, 2, 2, 2, 20, 20, 20, 20, 20, 20, - 20, 20, 2, 2, 20, 20, 2, 36, 36, 36, 2, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 2, 2, 2, - 36, 36, 36, 36, 36, 36, 36, 36, 2, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 2, 36, 2, 2, 2, 2, 36, 2, 2, 2, 2, 36, 36, 36, - 36, 36, 36, 2, 36, 2, 2, 2, 2, 2, 2, 2, 36, 36, 2, 2, - 36, 36, 36, 2, 2, 2, 2, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 2, 2, 2, 2, 0, 24, 24, - 24, 24, 2, 2, 2, 2, 2, 18, 18, 2, 18, 2, 18, 18, 18, 18, - 18, 2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 2, 18, 2, 18, 18, 18, 18, 18, 18, 18, 2, 2, 18, 18, - 18, 18, 18, 2, 18, 2, 18, 18, 18, 18, 18, 18, 18, 2, 18, 18, - 2, 2, 18, 18, 18, 18, 25, 25, 25, 25, 25, 25, 25, 25, 2, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 2, 2, 2, 25, 25, - 25, 25, 25, 2, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 25, - 25, 2, 2, 2, 2, 2, 33, 33, 33, 33, 33, 33, 33, 33, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 8, 2, 2, - 2, 2, 2, 8, 2, 2, 8, 8, 8, 0, 8, 8, 8, 8, 12, 12, - 12, 12, 12, 12, 12, 12, 30, 30, 30, 30, 30, 30, 30, 30, 30, 2, - 30, 30, 30, 30, 2, 2, 30, 30, 30, 30, 30, 30, 30, 2, 30, 30, - 30, 2, 2, 30, 30, 30, 30, 30, 30, 30, 30, 2, 2, 2, 30, 30, - 2, 2, 2, 2, 2, 2, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, - 29, 29, 29, 29, 2, 2, 28, 28, 28, 28, 28, 28, 28, 28, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 2, 2, 2, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 0, 0, 0, 35, 35, 35, 2, - 2, 2, 2, 2, 2, 2, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 2, 2, 2, 2, 2, 2, 2, 2, 2, 45, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 0, 0, 2, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 2, 2, 2, 2, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 2, 46, 46, 46, 2, - 46, 46, 2, 2, 2, 2, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 2, 2, 31, 31, 2, 2, 2, 2, 2, 2, 32, 32, - 0, 0, 32, 0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 2, 2, 2, 2, 2, 2, 32, 2, 2, 2, 2, 2, 2, 2, 32, 32, - 32, 2, 2, 2, 2, 2, 28, 28, 28, 28, 28, 28, 2, 2, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 2, 48, 48, - 48, 48, 2, 2, 2, 2, 48, 2, 2, 2, 48, 48, 48, 48, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 2, 2, 52, 52, - 52, 52, 52, 2, 2, 2, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 58, 2, 2, 2, 2, 58, 58, 2, 2, 2, 2, 2, 2, 58, 58, - 58, 2, 2, 2, 58, 58, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 2, 2, 54, 54, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, - 91, 91, 91, 91, 91, 2, 91, 91, 91, 91, 91, 2, 2, 91, 91, 91, - 2, 2, 2, 2, 2, 2, 91, 91, 91, 91, 91, 91, 2, 2, 1, 1, - 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 2, 62, 62, 76, 76, - 76, 76, 76, 76, 76, 76, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 2, 2, 2, 2, 2, 2, 2, 2, 93, 93, 93, 93, 70, 70, - 70, 70, 70, 70, 70, 70, 2, 2, 2, 70, 70, 70, 70, 70, 70, 70, - 2, 2, 2, 70, 70, 70, 73, 73, 73, 73, 73, 73, 73, 73, 6, 6, - 6, 2, 2, 2, 2, 2, 8, 8, 8, 2, 2, 8, 8, 8, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, - 0, 2, 2, 2, 2, 2, 19, 19, 19, 19, 19, 19, 9, 9, 9, 9, - 9, 6, 19, 19, 19, 19, 19, 19, 19, 19, 19, 9, 9, 9, 9, 9, - 19, 19, 19, 19, 9, 9, 9, 9, 9, 19, 19, 19, 19, 19, 6, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 9, 9, 9, - 9, 9, 9, 9, 2, 2, 2, 9, 2, 9, 2, 9, 2, 9, 9, 9, - 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, 2, 2, 9, 9, 9, 9, - 9, 9, 2, 9, 9, 9, 2, 2, 9, 9, 9, 2, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 2, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 2, 0, 0, 0, 19, 2, 2, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 2, 19, 19, - 19, 19, 19, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 1, 2, - 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, - 19, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 19, 0, - 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 27, 27, - 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 2, 2, 0, 0, 56, 56, - 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 2, 2, 2, 2, 2, 55, - 55, 55, 55, 55, 55, 55, 61, 61, 61, 61, 61, 61, 61, 61, 2, 2, - 2, 2, 2, 2, 2, 61, 61, 2, 2, 2, 2, 2, 2, 2, 0, 0, - 0, 0, 0, 0, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 2, 13, 13, 13, 13, 13, 13, 13, 13, 13, 2, 2, 2, 2, 13, 13, - 13, 13, 13, 13, 2, 2, 0, 0, 0, 0, 0, 13, 0, 13, 0, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, 1, 12, 12, 13, 13, - 13, 13, 0, 0, 0, 0, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 1, - 1, 0, 0, 15, 15, 15, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 17, 17, 17, 2, 2, - 2, 2, 2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 2, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 2, 2, - 2, 2, 2, 2, 2, 0, 12, 12, 12, 12, 12, 12, 12, 0, 17, 17, - 17, 17, 17, 17, 17, 0, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 2, 2, 2, 39, 39, 39, 39, 39, 39, 39, 2, 86, 86, - 86, 86, 86, 86, 86, 86, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 2, 2, 2, 2, 79, 79, 79, 79, 79, 79, 79, 79, 0, 0, - 19, 19, 19, 19, 19, 19, 0, 0, 0, 19, 19, 19, 19, 19, 2, 19, - 19, 19, 19, 19, 19, 19, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 2, 2, 2, 65, 65, 65, 65, 65, 65, 65, 65, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 2, 2, 2, 2, - 2, 2, 2, 2, 75, 75, 75, 75, 2, 2, 2, 2, 2, 2, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 0, 69, 74, 74, - 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 74, 12, 12, 12, 12, 12, 2, 2, 2, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 2, 0, 84, 84, - 2, 2, 2, 2, 84, 84, 33, 33, 33, 33, 33, 33, 33, 2, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 2, 68, 68, - 68, 68, 68, 68, 2, 2, 68, 68, 2, 2, 68, 68, 68, 68, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 2, 2, 2, 2, 2, 2, 2, - 2, 92, 92, 92, 92, 92, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 2, 2, 30, 30, 30, 30, 30, 30, 2, 19, 19, - 19, 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 9, 19, 19, 19, 19, - 0, 0, 2, 2, 2, 2, 87, 87, 87, 87, 87, 87, 2, 2, 87, 87, - 2, 2, 2, 2, 2, 2, 12, 12, 12, 12, 2, 2, 2, 2, 2, 2, - 2, 12, 12, 12, 12, 12, 13, 13, 2, 2, 2, 2, 2, 2, 19, 19, - 19, 19, 19, 19, 19, 2, 2, 2, 2, 4, 4, 4, 4, 4, 2, 2, - 2, 2, 2, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 2, 14, 14, - 14, 14, 14, 2, 14, 2, 14, 14, 2, 14, 14, 2, 14, 14, 3, 3, - 3, 3, 3, 3, 0, 0, 1, 1, 1, 1, 1, 1, 6, 6, 0, 0, - 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 3, 3, - 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, - 17, 17, 17, 17, 0, 0, 2, 2, 12, 12, 12, 12, 12, 12, 2, 2, - 12, 12, 12, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 2, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 2, 49, 49, 49, 2, 49, 49, 2, 49, 49, 49, - 49, 49, 49, 49, 2, 2, 49, 49, 49, 2, 2, 2, 2, 2, 0, 0, - 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, - 0, 0, 0, 2, 2, 2, 9, 2, 2, 2, 2, 2, 2, 2, 0, 0, - 0, 0, 0, 1, 2, 2, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 2, 2, 2, 67, 67, 67, 67, 67, 67, 67, 67, 67, 2, - 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, - 41, 2, 2, 2, 2, 2,118,118,118,118,118,118,118,118,118,118, - 118, 2, 2, 2, 2, 2, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 2, 53, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, - 59, 59, 2, 2, 2, 2, 59, 59, 59, 59, 59, 59, 2, 2, 40, 40, - 40, 40, 40, 40, 40, 40, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 2, 2, 50, 50, - 2, 2, 2, 2, 2, 2,135,135,135,135,135,135,135,135,135,135, - 135,135, 2, 2, 2, 2,106,106,106,106,106,106,106,106,104,104, - 104,104,104,104,104,104,104,104,104,104, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2,104,161,161,161,161,161,161,161,161,161,161, - 161, 2,161,161,161,161,161,161,161, 2,161,161, 2,161,161,161, - 2,161,161,161,161,161,161,161, 2,161,161, 2, 2, 2,170,170, - 170,170,170,170,170,170,170,170,170,170, 2, 2, 2, 2,110,110, - 110,110,110,110,110,110,110,110,110,110,110,110,110, 2,110,110, - 110,110,110,110, 2, 2, 19, 19, 19, 19, 19, 19, 2, 19, 19, 2, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 2, 2, 2, 2, 2, 47, 47, - 47, 47, 47, 47, 2, 2, 47, 2, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 2, 47, 47, 2, - 2, 2, 47, 2, 2, 47, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 2, 81,120,120,120,120,120,120,120,120,116,116, - 116,116,116,116,116,116,116,116,116,116,116,116,116, 2, 2, 2, - 2, 2, 2, 2, 2,116,128,128,128,128,128,128,128,128,128,128, - 128, 2,128,128, 2, 2, 2, 2, 2,128,128,128,128,128, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 2, 2, 2, 66, 72, 72, - 72, 72, 72, 72, 72, 72, 72, 72, 2, 2, 2, 2, 2, 72,173,173, - 173,173,173,173,173,173,173,173, 2, 2, 2, 2, 2, 2, 98, 98, - 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 2, 2, - 2, 2, 97, 97, 97, 97, 2, 2, 97, 97, 97, 97, 97, 97, 57, 57, - 57, 57, 2, 57, 57, 2, 2, 2, 2, 2, 57, 57, 57, 57, 57, 57, - 57, 57, 2, 57, 57, 57, 2, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 2, 2, 57, 57, - 57, 2, 2, 2, 2, 57, 57, 2, 2, 2, 2, 2, 2, 2, 88, 88, - 88, 88, 88, 88, 88, 88,117,117,117,117,117,117,117,117,112,112, - 112,112,112,112,112,112,112,112,112,112,112,112,112, 2, 2, 2, - 2,112,112,112,112,112, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 2, 2, 2, 78, 78, 78, 78, 78, 78, 78, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 2, 2, 82, 82, - 82, 82, 82, 82, 82, 82, 82, 82, 82, 2, 2, 2, 2, 2,122,122, - 122,122,122,122,122,122,122,122, 2, 2, 2, 2, 2, 2, 2,122, - 122,122,122, 2, 2, 2, 2,122,122,122,122,122,122,122, 89, 89, - 89, 89, 89, 89, 89, 89, 89, 2, 2, 2, 2, 2, 2, 2,130,130, - 130,130,130,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, - 130,130,130,130,130,130,144,144,144,144,144,144,144,144,144,144, - 2, 2, 2, 2, 2, 2,165,165,165,165,165,165,165,165,165,165, - 165,165,165,165, 2, 2, 2,165,165,165,165,165,165,165, 2, 2, - 2, 2, 2, 2,165,165, 3, 3, 3, 3, 3, 3, 3, 2,156,156, - 156,156,156,156,156,156,156,156, 2,156,156,156, 2, 2,156,156, - 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, - 2, 2, 2, 2, 2, 2,147,147,147,147,147,147,147,147,148,148, - 148,148,148,148,148,148,148,148, 2, 2, 2, 2, 2, 2,158,158, - 158,158,158,158,158,158,158,158, 2, 2, 2, 2, 2, 2,153,153, - 153,153,153,153,153,153,153,153,153,153, 2, 2, 2, 2,149,149, - 149,149,149,149,149,149,149,149,149,149,149,149,149, 2, 94, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 2, 2, 2, 2, - 94, 94, 94, 94, 94, 94, 2, 2, 2, 2, 2, 2, 2, 94, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 85, 2, 2,101,101,101,101,101,101,101,101,101, 2, - 2, 2, 2, 2, 2, 2,101,101, 2, 2, 2, 2, 2, 2, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 2, 96, 96,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111, 2,100,100, - 100,100,100,100,100,100, 2, 36, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 2, 2, 2,108,108,108,108,108,108,108,108,108,108, - 2,108,108,108,108,108,108,108, 2, 2, 2, 2, 2, 2,129,129, - 129,129,129,129,129, 2,129, 2,129,129,129,129, 2,129,129,129, - 129,129,129,129,129,129,129,129,129,129,129,129, 2,129,129,129, - 2, 2, 2, 2, 2, 2,109,109,109,109,109,109,109,109,109,109, - 109, 2, 2, 2, 2, 2,109,109, 2, 2, 2, 2, 2, 2,107,107, - 107,107, 2,107,107,107,107,107,107,107,107, 2, 2,107,107, 2, - 2,107,107,107,107,107,107,107,107,107,107,107,107,107,107, 2, - 107,107,107,107,107,107,107, 2,107,107, 2,107,107,107,107,107, - 2, 1,107,107,107,107,107, 2, 2,107,107,107, 2, 2,107, 2, - 2, 2, 2, 2, 2,107, 2, 2, 2, 2, 2,107,107,107,107,107, - 107,107, 2, 2,107,107,107,107,107,107,107, 2, 2, 2,171,171, - 171,171,171,171,171,171,171,171, 2,171, 2, 2,171, 2,171,171, - 171,171,171,171, 2,171,171, 2,171, 2, 2,171, 2,171,171,171, - 171, 2,171,171,171,171,171, 2, 2, 2, 2, 2, 2, 2, 2,171, - 171, 2, 2, 2, 2, 2,137,137,137,137,137,137,137,137,137,137, - 137,137, 2,137,137,137,137,137, 2, 2, 2, 2, 2, 2,124,124, - 124,124,124,124,124,124,124,124, 2, 2, 2, 2, 2, 2,123,123, - 123,123,123,123,123,123,123,123,123,123,123,123, 2, 2,114,114, - 114,114,114,114,114,114,114,114,114,114,114, 2, 2, 2,114,114, - 2, 2, 2, 2, 2, 2, 32, 32, 32, 32, 32, 2, 2, 2,102,102, - 102,102,102,102,102,102,102,102, 2, 2, 2, 2, 2, 2, 33, 33, - 33, 33, 2, 2, 2, 2,126,126,126,126,126,126,126,126,126,126, - 126, 2, 2,126,126,126,126,126,126,126, 2, 2, 2, 2,126,126, - 126,126,126,126,126, 2,142,142,142,142,142,142,142,142,142,142, - 142,142, 2, 2, 2, 2,125,125,125,125,125,125,125,125,125,125, - 125, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,125,154,154, - 154,154,154,154,154, 2, 2,154, 2, 2,154,154,154,154,154,154, - 154,154, 2,154,154, 2,154,154,154,154,154,154,154,154,154,154, - 154,154,154,154, 2,154,154, 2, 2,154,154,154,154,154,154,154, - 2, 2, 2, 2, 2, 2,150,150,150,150,150,150,150,150, 2, 2, - 150,150,150,150,150,150,150,150,150,150,150, 2, 2, 2,141,141, - 141,141,141,141,141,141,140,140,140,140,140,140,140,140,140,140, - 140, 2, 2, 2, 2, 2,121,121,121,121,121,121,121,121,121, 2, - 2, 2, 2, 2, 2, 2, 7, 7, 2, 2, 2, 2, 2, 2,169,169, - 169,169,169,169,169,169,169,169, 2, 2, 2, 2, 2, 2,133,133, - 133,133,133,133,133,133,133, 2,133,133,133,133,133,133,133,133, - 133,133,133,133,133, 2,133,133,133,133,133,133, 2, 2,133,133, - 133,133,133, 2, 2, 2,134,134,134,134,134,134,134,134, 2, 2, - 134,134,134,134,134,134, 2,134,134,134,134,134,134,134,134,134, - 134,134,134,134,134, 2,138,138,138,138,138,138,138, 2,138,138, - 2,138,138,138,138,138,138,138,138,138,138,138,138,138, 2, 2, - 138, 2,138,138, 2,138,138,138, 2, 2, 2, 2, 2, 2,143,143, - 143,143,143,143, 2,143,143, 2,143,143,143,143,143,143,143,143, - 143,143,143,143,143,143,143,143,143,143,143,143,143, 2,143,143, - 2,143,143,143,143,143,143, 2, 2, 2, 2, 2, 2, 2,143,143, - 2, 2, 2, 2, 2, 2,175,175,175,175,175,175,175,175,175,175, - 175,175, 2, 2, 2, 2,175,175, 2, 2, 2, 2, 2, 2,145,145, - 145,145,145,145,145,145,145, 2, 2, 2, 2, 2, 2, 2,163,163, - 163,163,163,163,163,163,163, 2,163,163,163,163,163,163,163,163, - 163, 2, 2, 2,163,163,163,163,163, 2, 2, 2, 2, 2, 86, 2, - 2, 2, 2, 2, 2, 2, 22, 22, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 22, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 2, 2, 2, 2, 2, 2, 63, 63, 63, 63, 63, 63, 63, 2, 63, 63, - 63, 63, 63, 2, 2, 2, 63, 63, 63, 63, 2, 2, 2, 2,157,157, - 157,157,157,157,157,157,157,157,157, 2, 2, 2, 2, 2, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 2, 2, 80, 80, - 80, 2, 2, 2, 2, 2,127,127,127,127,127,127,127,127,127,127, - 127,127,127,127,127, 2,166,166,166,166,166,166,166,166,166,166, - 2, 2, 2, 2, 2, 2, 79, 2, 2, 2, 2, 2, 2, 2,115,115, - 115,115,115,115,115,115,115,115,115,115,115,115,115, 2,115,115, - 2, 2, 2, 2,115,115,159,159,159,159,159,159,159,159,159,159, - 159,159,159,159,159, 2,159,159, 2, 2, 2, 2, 2, 2,103,103, - 103,103,103,103,103,103,103,103,103,103,103,103, 2, 2,119,119, - 119,119,119,119,119,119,119,119,119,119,119,119, 2, 2,119,119, - 2,119,119,119,119,119, 2, 2, 2, 2, 2,119,119,119,167,167, - 167,167,167,167,167,167,167,167, 2, 2, 2, 2, 2, 2,146,146, - 146,146,146,146,146,146,146,146,146, 2, 2, 2, 2, 2,172,172, - 172,172,172,172,172,172,172, 2, 2,172,172,172,172,172,172,172, - 172,172, 2, 2, 2, 2, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 2, 2, 2, 2, 99, 2, 2, 2, 2, 2, 2, 2, 99,136,139, - 13, 13,155, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 2,136,136, - 136,136,136,136,136,136,155,155,155,155,155,155,155,155,155,155, - 155,155,155,155, 2, 2, 2, 2, 2, 2, 2, 2, 2,155,136,136, - 136,136,136,136,136, 2,136,136,136, 2, 2, 2, 2, 2, 17, 17, - 17, 17, 2, 17, 17, 17, 17, 17, 17, 17, 2, 17, 17, 2, 17, 15, - 15, 15, 15, 15, 15, 15, 17, 17, 17, 2, 2, 2, 2, 2, 2, 2, - 15, 2, 2, 2, 2, 2, 15, 15, 15, 2, 2, 17, 2, 2, 2, 2, - 2, 2, 17, 17, 17, 17,139,139,139,139,139,139,139,139,139,139, - 139,139, 2, 2, 2, 2,105,105,105,105,105,105,105,105,105,105, - 105, 2, 2, 2, 2, 2,105,105,105,105,105, 2, 2, 2,105, 2, - 2, 2, 2, 2, 2, 2,105,105, 2, 2,105,105,105,105, 2, 2, - 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 1, 1, - 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 0, 0, 2, 2, 0, 2, 2, 0, 0, 2, 2, 0, - 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, - 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, - 0, 0, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0,131,131, - 131,131,131,131,131,131,131,131,131,131, 2, 2, 2, 2, 2, 2, - 2,131,131,131,131,131, 2,131,131,131,131,131,131,131, 2, 2, - 2, 2, 2, 19, 19, 19, 56, 56, 56, 56, 56, 56, 56, 2, 56, 2, - 2, 56, 56, 56, 56, 56, 56, 56, 2, 56, 56, 2, 56, 56, 56, 56, - 56, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 6,151,151,151,151,151,151,151,151,151,151, - 151,151,151, 2, 2, 2,151,151,151,151,151,151, 2, 2,151,151, - 2, 2, 2, 2,151,151,160,160,160,160,160,160,160,160,160,160, - 160,160,160,160,160, 2,152,152,152,152,152,152,152,152,152,152, - 2, 2, 2, 2, 2,152,164,164,164,164,164,164,164,164,164,164, - 2, 2, 2, 2, 2, 2,168,168,168,168,168,168,168,168,168,168, - 168, 2, 2, 2, 2,168,174,174,174,174,174,174,174,174,174,174, - 174,174,174,174,174, 2,174,174,174,174,174,174, 2, 2, 2, 2, - 2, 2, 2, 2,174,174, 30, 30, 30, 30, 2, 30, 30, 2,113,113, - 113,113,113,113,113,113,113,113,113,113,113, 2, 2,113,113,113, - 113,113,113,113,113, 2,132,132,132,132,132,132,132,132,132,132, - 132,132, 2, 2, 2, 2,132,132, 2, 2, 2, 2,132,132, 3, 3, - 3, 3, 2, 3, 3, 3, 2, 3, 3, 2, 3, 2, 2, 3, 2, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, 3, - 2, 3, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 3, 2, 3, - 2, 3, 2, 3, 3, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, - 3, 3, 3, 2, 3, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 2, 2, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 15, 0, - 0, 2, 2, 2, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0, - 0, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 2, 0, 13, 2, 2, 2, 2, 2, 2, 2, 13, 13, - 13, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9, 10, 9, 11, 12, 13, - 9, 9, 9, 14, 9, 9, 15, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 16, 17, 9, 9, 9, 9, - 18, 9, 9, 9, 9, 9, 19, 20, 21, 9, 22, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 23, 9, - 9, 9, 9, 9, 24, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 25, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 26, 27, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 23, 0, 0, 24, 25, 26, 27, 28, 29, 30, 0, 0, 31, 32, 0, 33, - 0, 34, 0, 35, 0, 0, 0, 0, 36, 37, 38, 39, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 44, - 0, 45, 0, 0, 0, 0, 0, 0, 46, 47, 0, 0, 0, 0, 0, 48, - 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 50, 51, 0, 0, 0, 52, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, - 54, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, - 56, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 58, 59, 60, 61, 62, 63, 64, 65, 0, 0, 0, 0, 0, 0, 66, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 68, 0, 69, - 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,104, 0, - 0, 0, 0, 0, 0,105,106, 0,107, 0, 0, 0,108, 0,109, 0, - 110, 0,111,112,113, 0,114, 0, 0, 0,115, 0, 0, 0,116, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,117, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 118,119,120,121, 0,122,123,124,125,126, 0,127, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,129,130,131, - 132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147, - 148,149,150,151,152,153,154,155,156,157, 0, 0, 0,158,159,160, - 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0,162, 0,163, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0,164,165, 0, 0, 0, 0, 0, 0, 0,166, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 167, 0, 0, 0,168,169, 0, 0,170, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0,171, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0,172, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,173, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,174, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,176,177, 0, 0, 0, 0,178,179, 0, 0, 0,180,181,182,183, - 184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199, - 200,201,202,203,204,205,206,207,208,209,210,211,212,213, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, + 146,147,148,149,150,151,152,153,154, 0,155,156,157,158, 0,159, + 160,161,162,163,164,165,166,167,168,169,170, 0,171,172,173, 7, + 7, 7, 7, 7, 7, 7,174,175, 7,176, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,177, 4, + 4, 4, 4, 4, 4, 4, 4,178, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4,179, 11, 11, 11, 11,180, 0, 0, 0, 0, + 0,181, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, + 12, 12, 12,182,183,184,185, 0, 0,186, 0,187,188,189,190, 3, + 3, 3, 3, 3, 3, 14, 14, 14,191,192,193, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,194,195, + 196,197, 18, 18,198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,199,200, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5,201, 5, 5, 5,202,203,204, 5, + 205,206,207,208,209,210, 0,211,212,213, 5, 5,214, 5,215, 10, + 10, 10, 10, 10,216, 0, 0, 0, 0, 0, 0, 0, 0,217, 0,218, + 219,220, 0, 0,221, 0, 0, 0,222, 0,223, 0,224, 0,225,226, + 227,228, 0, 0, 0, 0, 0,229,230,231, 0,232,233, 0, 0,234, + 235, 5,236,237, 0, 5, 5, 5, 5, 5, 5, 5,238, 5,239,240, + 241, 5, 5,242,243, 5,244, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,245, 1, 1,246, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,247, 1, 1, 1, + 1, 1, 1, 1, 1, 1,248, 1, 1, 1, 1,249, 0, 0, 0, 1, + 1, 1, 1,250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 1, 1, 1, 1, 1,251, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1,252, 0, 0, 0, 0, 0, 0, 0,253, + 0, 19, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, + 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13, 12, + 12, 12, 12, 12, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0,136, + 136,136,136,136,136,136,136, 80, 80, 80, 80, 80, 80, 80, 80, 19, + 19, 19, 19, 19, 19, 19, 19, 3, 3, 3, 3, 3, 3, 3, 3, 63, + 63, 63, 63, 63, 63, 63, 63, 39, 39, 39, 39, 39, 39, 39, 39, 28, + 28, 28, 28, 28, 28, 28, 28, 79, 79, 79, 79, 79, 79, 79, 79,131, + 131,131,131,131,131,131,131, 1, 1, 1, 1, 1, 1, 1, 1,127, + 127,127,127,127,127,127,127, 6, 6, 6, 6, 6, 6, 6, 6,155, + 155,155,155,155,155,155,155,139,139,139,139,139,139,139,139, 9, + 9, 9, 9, 9, 9, 9, 9, 15, 15, 15, 15, 15, 15, 15, 15, 30, + 30, 30, 30, 30, 30, 30, 30,110,110,110,110,110,110,110,110, 77, + 77, 77, 77, 77, 77, 77, 77, 17, 17, 17, 17, 17, 17, 17, 17, 27, + 27, 27, 27, 27, 27, 27, 27, 33, 33, 33, 33, 33, 33, 33, 33,113, + 113,113,113,113,113,113,113, 49, 49, 49, 49, 49, 49, 49, 49, 25, + 25, 25, 25, 25, 25, 25, 25, 29, 29, 29, 29, 29, 29, 29, 29, 7, + 7, 7, 7, 7, 7, 7, 7, 32, 32, 32, 32, 32, 32, 32, 32, 8, + 8, 8, 8, 8, 8, 8, 8, 99, 99, 99, 99, 99, 99, 99, 99, 31, + 31, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30, 2,105, + 105,105,105,105,105,105,105, 55, 55, 55, 55, 55, 55, 55, 55, 62, + 62, 62, 62, 62, 62, 62, 62, 56, 56, 56, 56, 56, 56, 56, 56, 91, + 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 0, 2, 2, 2, 2,100, + 100,100,100,100,100,100,100,119,119,119,119,119,119,119,119, 14, + 14, 14, 14, 14, 14, 14, 14,130,130,130,130,130,130,130,130, 94, + 94, 94, 94, 94, 94, 94, 94,157,157,157,157,157,157,157,157,137, + 137,137,137,137,137,137,137,146,146,146,146,146,146,146,146, 20, + 20, 20, 20, 20, 20, 20, 20, 35, 35, 35, 35, 35, 35, 35, 35, 0, + 0, 0, 0, 0, 0, 2, 2, 84, 84, 84, 84, 84, 84, 84, 84, 40, + 40, 40, 40, 40, 40, 40, 40, 97, 97, 97, 97, 97, 97, 97, 97,124, + 124,124,124,124,124,124,124,123,123,123,123,123,123,123,123,125, + 125,125,125,125,125,125,125,140,140,140,140,140,140,140,140,159, + 159,159,159,159,159,159,159,132,132,132,132,132,132,132,132, 37, + 37, 37, 37, 37, 37, 37, 37, 22, 22, 22, 22, 22, 22, 22, 22, 24, + 24, 24, 24, 24, 24, 24, 24, 58, 58, 58, 58, 58, 58, 58, 58, 76, + 76, 76, 76, 76, 76, 76, 76, 26, 26, 26, 26, 26, 26, 26, 26, 75, + 75, 75, 75, 75, 75, 75, 75, 89, 89, 89, 89, 89, 89, 89, 89,114, + 114,114,114,114,114,114,114,141,141,141,141,141,141,141,141,133, + 133,133,133,133,133,133,133,163,163,163,163,163,163,163,163, 4, + 4, 4, 4, 4, 4, 4, 4, 70, 70, 70, 70, 70, 70, 70, 70, 0, + 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 2, 2, 2, 2, 2, 68, + 68, 68, 68, 68, 68, 68, 68, 92, 92, 92, 92, 92, 92, 92, 92, 87, + 87, 87, 87, 87, 87, 87, 87,135,135,135,135,135,135,135,135, 85, + 85, 85, 85, 85, 85, 85, 85, 96, 96, 96, 96, 96, 96, 96, 96,109, + 109,109,109,109,109,109,109,102,102,102,102,102,102,102,102, 64, + 64, 64, 64, 64, 64, 64, 64, 61, 61, 61, 61, 61, 61, 61, 61, 65, + 65, 65, 65, 65, 65, 65, 65, 2, 0, 0, 0, 0, 0, 0, 0,108, + 108,108,108,108,108,108,108,142,142,142,142,142,142,142,142,121, + 121,121,121,121,121,121,121,166,166,166,166,166,166,166,166,167, + 167,167,167,167,167,167,167, 0, 2, 2, 2, 2, 2, 2, 2,151, + 151,151,151,151,151,151,151,152,152,152,152,152,152,152,152, 38, + 38, 38, 38, 38, 38, 38, 38, 90, 90, 90, 90, 90, 90, 90, 90, 23, + 23, 23, 23, 23, 23, 23, 23, 36, 36, 36, 36, 36, 36, 36, 36, 30, + 2, 30, 30, 30, 30, 2, 2, 48, 48, 48, 48, 48, 48, 48, 48, 93, + 93, 93, 93, 93, 93, 93, 93, 73, 73, 73, 73, 73, 73, 73, 73, 9, + 9, 9, 9, 9, 9, 2, 2, 13, 13, 13, 13, 13, 13, 2, 2, 86, + 86, 86, 86, 86, 86, 86, 86, 0, 0, 0, 0, 0, 2, 2, 2, 67, + 67, 67, 67, 67, 67, 67, 67, 51, 51, 51, 51, 51, 51, 51, 51,104, + 104,104,104,104,104,104,104,170,170,170,170,170,170,170,170, 78, + 78, 78, 78, 78, 78, 78, 78,144,144,144,144,144,144,144,144,165, + 165,165,165,165,165,165,165,171,171,171,171,171,171,171,171,126, + 126,126,126,126,126,126,126,150,150,150,150,150,150,150,150,134, + 134,134,134,134,134,134,134,138,138,138,138,138,138,138,138,175, + 175,175,175,175,175,175,175, 18, 18, 18, 18, 18, 18, 18, 18, 0, + 0, 0, 0, 0, 2, 0, 0, 60, 60, 60, 60, 60, 60, 60, 60, 69, + 69, 69, 69, 69, 69, 69, 69,118,118,118,118,118,118,118,118, 59, + 59, 59, 59, 59, 59, 59, 59,106,106,106,106,106,106,106,106,156, + 156,156,156,156,156,156,156,147,147,147,147,147,147,147,147,148, + 148,148,148,148,148,148,148,169,169,169,169,169,169,169,169,172, + 172,172,172,172,172,172,172,164,164,164,164,164,164,164,164,168, + 168,168,168,168,168,168,168,174,174,174,174,174,174,174,174, 0, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 0, 0, 0, 0, 0, 5, + 5, 5, 5, 5, 5, 5, 5, 21, 21, 21, 21, 21, 21, 21, 21, 16, + 16, 16, 16, 16, 16, 16, 16, 12, 12, 12, 12, 12, 12, 12, 2, 74, + 74, 74, 74, 74, 74, 74, 74, 42, 42, 42, 42, 42, 42, 42, 42, 50, + 50, 50, 50, 50, 50, 50, 50,161,161,161,161,161,161,161,161, 47, + 47, 47, 47, 47, 47, 47, 47,120,120,120,120,120,120,120,120,116, + 116,116,116,116,116,116,116, 98, 98, 98, 98, 98, 98, 98, 98, 57, + 57, 57, 57, 57, 57, 57, 57, 88, 88, 88, 88, 88, 88, 88, 88,117, + 117,117,117,117,117,117,117,112,112,112,112,112,112,112,112,101, + 101,101,101,101,101,101,101,111,111,111,111,111,111,111,111,154, + 154,154,154,154,154,154,154,143,143,143,143,143,143,143,143,115, + 115,115,115,115,115,115,115, 0, 0, 19, 0, 0, 0, 0, 0, 95, + 95, 95, 95, 95, 95, 95, 95, 11, 11, 11, 11, 11, 11, 11, 11, 10, + 10, 10, 10, 10, 10, 10, 10, 22, 22, 22, 2, 2, 2, 22, 22, 2, + 25, 25, 25, 25, 25, 25, 25, 34, 34, 34, 34, 34, 34, 34, 34, 52, + 52, 52, 52, 52, 52, 52, 52, 54, 54, 54, 54, 54, 54, 54, 54, 0, + 0, 0, 2, 2, 2, 2, 2, 2, 30, 30, 30, 30, 30, 30, 2, 2, + 2, 12, 12, 12, 12, 12, 12, 71, 71, 71, 71, 71, 71, 71, 71, 41, + 41, 41, 41, 41, 41, 41, 41, 53, 53, 53, 53, 53, 53, 53, 53, 81, + 81, 81, 81, 81, 81, 81, 81, 66, 66, 66, 66, 66, 66, 66, 66, 72, + 72, 72, 72, 72, 72, 72, 72,173,173,173,173,173,173,173,173, 83, + 83, 83, 83, 83, 83, 83, 83, 82, 82, 82, 82, 82, 82, 82, 82,158, + 158,158,158,158,158,158,158,153,153,153,153,153,153,153,153,145, + 145,145,145,145,145,145,145,103,103,103,103,103,103,103,103,160, + 160,160,160,160,160,160,160, 2, 3, 3, 2, 3, 2, 2, 3, 3, + 3, 3, 2, 3, 3, 3, 3, 19, 19, 19, 19, 19, 19, 19, 0, 2, + 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 0, 3, 3, 5, + 5, 5, 5, 5, 2, 2, 5, 11, 11, 11, 2, 2, 2, 2, 11, 10, + 10, 10, 10, 10, 10, 2, 10, 21, 21, 21, 21, 21, 2, 2, 21, 22, + 2, 22, 22, 22, 22, 2, 2, 23, 23, 23, 23, 23, 2, 23, 23, 23, + 2, 23, 23, 23, 23, 23, 23, 16, 16, 16, 16, 16, 2, 16, 16, 16, + 2, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 20, 2, 20, 20, 20, + 2, 20, 20, 20, 20, 20, 20, 36, 36, 36, 36, 36, 36, 36, 2, 25, + 25, 25, 25, 25, 2, 25, 25, 8, 8, 8, 8, 8, 8, 2, 8, 2, + 2, 2, 2, 2, 8, 2, 2, 29, 29, 29, 29, 29, 29, 2, 2, 45, + 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 43, + 43, 43, 43, 43, 43, 43, 43, 31, 31, 2, 2, 2, 2, 2, 2, 48, + 48, 48, 48, 2, 2, 2, 2, 91, 91, 2, 2, 2, 2, 2, 2, 1, + 1, 1, 1, 1, 1, 2, 2, 9, 9, 9, 9, 9, 2, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 2, 19, 19, 19, 19, 19, 2, 2, 2, 0, + 0, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 61, 0, + 17, 17, 17, 17, 17, 17, 17, 12, 12, 12, 12, 2, 2, 2, 2, 13, + 13, 2, 2, 2, 2, 2, 2, 19, 19, 19, 19, 19, 19, 19, 2, 0, + 0, 0, 2, 0, 0, 0, 0, 49, 49, 49, 49, 49, 49, 2, 2, 0, + 0, 0, 2, 2, 2, 2, 0,135,135,135,135, 2, 2, 2, 2,161, + 161,161, 2,161,161,161,161,161,161, 2,161,161,161,161,161, 19, + 19, 19, 2, 2, 2, 2, 2,128,128,128,128,128,128,128,128, 57, + 2, 2, 2, 2, 2, 2, 2,112,112,112,112,112,112,112, 2,122, + 122,122,122,122,122,122,122,130,130,130, 2, 2, 2, 2, 2,165, + 165,165,165,165,165, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3,149, + 149,149,149,149,149,149,149, 94, 94, 94, 94, 94, 94, 2, 2,129, + 129,129,129,129,129,129,129,107,107,107,107,107, 2, 2,107,107, + 107,107,107,107,107,107,107,107,107,107,107,107, 2, 2, 2,171, + 171,171,171,171,171, 2,171,123,123,123,123,123,123, 2, 2,102, + 102, 2, 2, 2, 2, 2, 2,154,154,154,154,154,154,154, 2, 2, + 2,150,150,150,150,150,150,169,169, 2, 2, 2, 2, 2, 2,138, + 138,138,138,138,138,138, 2,103,103,103,103,103,103, 2, 2,119, + 119, 2,119,119,119,119,119, 2, 2, 0, 0, 0, 0, 0, 0, 3, + 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 19, + 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, 19, 0, 0, 0, 0, + 0, 26, 26, 0, 0, 0, 0, 9, 9, 9, 9, 0, 9, 9, 9, 2, + 2, 9, 9, 9, 9, 0, 9, 2, 2, 2, 2, 9, 0, 9, 0, 9, + 9, 9, 2, 9, 2, 9, 9, 9, 9, 2, 9, 9, 9, 9, 9, 9, + 9, 55, 55, 55, 55, 55, 55, 6, 6, 6, 6, 6, 1, 1, 6, 4, + 4, 4, 4, 4, 4, 4, 2, 4, 4, 4, 2, 2, 4, 4, 4, 2, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 2, 2, 2, 2, 14, 14, + 14, 14, 14, 14, 2, 2, 2, 3, 3, 3, 3, 0, 3, 3, 3, 3, + 3, 3, 0, 3, 3, 3, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, + 3, 3, 3, 3, 3, 3, 3, 37, 37, 37, 37, 37, 37, 2, 37, 37, + 37, 37, 2, 2, 37, 37, 37, 38, 38, 2, 2, 2, 2, 2, 2, 64, + 64, 64, 2, 2, 64, 64, 64, 90, 90, 90, 90, 90, 90, 2, 2, 90, + 90, 90, 90, 90, 90, 90, 2, 95, 95, 95, 95, 2, 2, 95, 2, 37, + 37, 37, 2, 2, 2, 2, 2, 3, 3, 2, 2, 2, 2, 2, 3, 3, + 3, 0, 3, 3, 3, 3, 3, 7, 1, 1, 1, 1, 7, 7, 7, 7, + 7, 7, 7, 0, 0, 7, 7, 5, 5, 5, 5, 2, 5, 5, 5, 5, + 2, 2, 5, 5, 5, 5, 5, 5, 2, 5, 5, 5, 5, 5, 5, 5, + 2, 5, 2, 2, 2, 5, 5, 5, 5, 2, 2, 5, 5, 5, 5, 5, + 2, 2, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 5, 2, + 2, 2, 2, 5, 5, 2, 5, 5, 5, 5, 5, 2, 2, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 2, 2, 11, 11, 11, 2, 11, 11, 11, 11, + 2, 2, 11, 11, 11, 11, 11, 11, 2, 11, 11, 11, 11, 11, 11, 11, + 2, 11, 11, 2, 11, 11, 2, 11, 11, 2, 2, 11, 2, 11, 11, 11, + 2, 2, 11, 11, 11, 2, 2, 2, 11, 2, 2, 2, 2, 2, 2, 2, + 11, 11, 11, 11, 2, 11, 2, 2, 2, 2, 2, 2, 2, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 2, 2, 10, 10, 10, 2, 10, 10, 10, 10, + 10, 2, 10, 10, 10, 10, 10, 10, 2, 10, 10, 10, 10, 10, 10, 10, + 2, 10, 10, 2, 10, 10, 10, 10, 10, 2, 2, 10, 10, 10, 10, 10, + 10, 2, 10, 10, 10, 2, 2, 10, 2, 2, 2, 2, 2, 2, 2, 10, + 10, 10, 10, 2, 2, 10, 10, 10, 10, 2, 2, 2, 2, 2, 2, 2, + 10, 10, 10, 10, 10, 10, 10, 2, 21, 21, 21, 2, 21, 21, 21, 21, + 2, 2, 21, 21, 21, 21, 21, 21, 2, 21, 21, 21, 21, 21, 21, 21, + 2, 21, 21, 2, 21, 21, 21, 21, 21, 2, 2, 21, 21, 21, 21, 21, + 2, 2, 21, 21, 21, 2, 2, 2, 2, 2, 2, 2, 21, 21, 21, 2, + 2, 2, 2, 21, 21, 2, 21, 21, 21, 21, 21, 2, 2, 21, 21, 2, + 2, 22, 22, 2, 22, 22, 22, 2, 22, 22, 2, 22, 2, 22, 22, 2, + 2, 2, 22, 22, 2, 2, 2, 22, 22, 2, 2, 2, 2, 22, 22, 22, + 2, 2, 2, 2, 2, 2, 22, 2, 2, 2, 2, 2, 2, 22, 22, 22, + 22, 22, 2, 2, 2, 2, 2, 23, 23, 2, 2, 23, 23, 23, 23, 23, + 2, 23, 23, 23, 23, 2, 2, 2, 2, 2, 2, 2, 23, 23, 2, 23, + 23, 23, 2, 23, 23, 2, 2, 23, 23, 23, 23, 2, 2, 23, 23, 2, + 2, 2, 2, 2, 2, 2, 23, 16, 16, 16, 16, 2, 16, 16, 16, 16, + 16, 2, 2, 16, 16, 16, 16, 16, 2, 16, 16, 16, 16, 2, 2, 2, + 2, 2, 2, 2, 16, 16, 2, 2, 2, 2, 2, 16, 16, 16, 2, 16, + 16, 16, 16, 2, 2, 16, 16, 2, 16, 16, 16, 2, 2, 2, 2, 2, + 2, 2, 2, 20, 20, 20, 20, 20, 20, 20, 20, 2, 2, 20, 20, 2, + 36, 36, 36, 2, 36, 36, 36, 2, 2, 36, 36, 36, 36, 36, 36, 36, + 36, 2, 36, 36, 36, 36, 36, 36, 36, 36, 36, 2, 36, 2, 2, 2, + 2, 36, 2, 2, 2, 2, 36, 36, 36, 36, 36, 36, 2, 36, 2, 2, + 2, 2, 2, 2, 2, 36, 36, 2, 2, 36, 36, 36, 2, 2, 2, 2, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 2, 2, 2, 2, 0, 24, + 24, 24, 24, 2, 2, 2, 2, 2, 18, 18, 2, 18, 2, 18, 18, 18, + 18, 18, 2, 18, 18, 18, 18, 18, 18, 18, 18, 2, 18, 2, 18, 18, + 18, 18, 18, 18, 18, 2, 2, 18, 18, 18, 18, 18, 2, 18, 2, 18, + 18, 18, 18, 18, 18, 18, 2, 18, 18, 2, 2, 18, 18, 18, 18, 25, + 25, 25, 25, 25, 2, 2, 2, 25, 25, 25, 25, 25, 0, 0, 0, 0, + 25, 25, 2, 2, 2, 2, 2, 8, 8, 8, 0, 8, 8, 8, 8, 30, + 30, 30, 2, 2, 30, 30, 30, 30, 30, 30, 30, 30, 2, 2, 2, 30, + 30, 2, 2, 2, 2, 2, 2, 34, 34, 34, 34, 34, 2, 2, 2, 35, + 35, 35, 0, 0, 0, 35, 35, 35, 2, 2, 2, 2, 2, 2, 2, 45, + 45, 45, 45, 45, 45, 2, 2, 2, 2, 2, 2, 2, 2, 2, 45, 44, + 44, 44, 44, 44, 0, 0, 2, 43, 43, 43, 43, 2, 2, 2, 2, 46, + 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 2, 46, 46, 46, + 2, 46, 46, 2, 2, 2, 2, 31, 31, 31, 31, 31, 31, 2, 2, 32, + 32, 0, 0, 32, 0, 32, 32, 32, 32, 2, 2, 2, 2, 2, 2, 32, + 2, 2, 2, 2, 2, 2, 2, 32, 32, 32, 2, 2, 2, 2, 2, 28, + 28, 28, 28, 28, 28, 2, 2, 48, 48, 48, 48, 48, 48, 48, 2, 48, + 2, 2, 2, 48, 48, 48, 48, 52, 52, 52, 52, 52, 52, 2, 2, 52, + 52, 52, 52, 52, 2, 2, 2, 58, 58, 58, 58, 2, 2, 2, 2, 58, + 58, 2, 2, 2, 2, 2, 2, 58, 58, 58, 2, 2, 2, 58, 58, 54, + 54, 54, 54, 2, 2, 54, 54, 91, 91, 91, 91, 91, 91, 91, 2, 91, + 91, 91, 91, 91, 2, 2, 91, 91, 91, 91, 91, 91, 91, 2, 2, 1, + 1, 1, 1, 2, 2, 2, 2, 62, 62, 62, 62, 62, 2, 62, 62, 93, + 93, 93, 93, 2, 2, 2, 2, 2, 2, 2, 2, 93, 93, 93, 93, 2, + 2, 2, 70, 70, 70, 70, 70, 70, 70, 2, 2, 2, 70, 70, 70, 6, + 6, 6, 2, 2, 2, 2, 2, 8, 8, 8, 2, 2, 8, 8, 8, 1, + 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, + 1, 0, 2, 2, 2, 2, 2, 19, 19, 19, 19, 19, 19, 9, 9, 9, + 9, 9, 6, 19, 19, 19, 19, 19, 19, 19, 19, 19, 9, 9, 9, 9, + 9, 19, 19, 19, 19, 9, 9, 9, 9, 9, 19, 19, 19, 19, 19, 6, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 9, 2, + 9, 2, 9, 2, 9, 2, 9, 9, 9, 9, 9, 2, 2, 9, 9, 9, + 9, 9, 9, 2, 9, 9, 9, 2, 2, 9, 9, 9, 2, 9, 9, 0, + 0, 0, 0, 1, 1, 0, 0, 0, 19, 2, 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 19, 1, 2, 2, 2, 2, 2, 2, 2, 0, + 0, 0, 0, 0, 0, 9, 0, 0, 0, 19, 19, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 19, 0, 19, 0, 0, 0, 2, 2, 2, 2, 55, + 55, 55, 55, 2, 2, 2, 2, 2, 55, 55, 55, 55, 55, 55, 55, 61, + 2, 2, 2, 2, 2, 2, 2, 13, 13, 2, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 2, 2, 2, 2, 0, 0, 0, 0, 0, 13, 0, 13, 0, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, 1, 12, 12, 13, + 13, 13, 13, 0, 0, 0, 0, 2, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 2, 2, 1, 1, 0, 0, 15, 15, 15, 17, + 17, 17, 0, 0, 17, 17, 17, 2, 2, 2, 2, 2, 26, 26, 26, 2, + 12, 12, 12, 12, 12, 12, 12, 2, 2, 2, 2, 2, 2, 2, 0, 12, + 12, 12, 12, 12, 12, 12, 0, 17, 17, 17, 17, 17, 17, 17, 0, 39, + 39, 39, 39, 39, 2, 2, 2, 39, 39, 39, 39, 39, 39, 39, 2, 77, + 77, 77, 77, 2, 2, 2, 2, 0, 0, 19, 19, 19, 19, 19, 19, 0, + 0, 0, 19, 19, 19, 19, 19, 2, 19, 19, 19, 19, 19, 19, 19, 60, + 60, 60, 60, 60, 2, 2, 2, 75, 75, 75, 75, 75, 75, 2, 2, 2, + 2, 2, 2, 2, 2, 75, 75, 75, 75, 2, 2, 2, 2, 2, 2, 69, + 69, 69, 69, 69, 69, 0, 69, 74, 74, 74, 74, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 74, 12, 12, 12, 12, 12, 2, 2, 2, 84, + 84, 84, 84, 84, 84, 2, 0, 84, 84, 2, 2, 2, 2, 84, 84, 33, + 33, 33, 33, 33, 33, 33, 2, 68, 68, 68, 68, 68, 68, 68, 2, 68, + 68, 68, 68, 68, 68, 2, 2, 68, 68, 2, 2, 68, 68, 68, 68, 92, + 92, 92, 2, 2, 2, 2, 2, 2, 2, 2, 92, 92, 92, 92, 92, 87, + 87, 87, 87, 87, 87, 87, 2, 19, 19, 19, 0, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 9, 19, 19, 19, 19, 0, 0, 2, 2, 2, 2, 87, + 87, 87, 87, 87, 87, 2, 2, 87, 87, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 12, 12, 12, 12, 12, 2, 2, 2, 4, 4, 4, 4, 4, 2, + 2, 2, 2, 2, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 2, 14, + 14, 14, 14, 14, 2, 14, 2, 14, 14, 2, 14, 14, 2, 14, 14, 3, + 3, 3, 3, 3, 3, 0, 0, 1, 1, 1, 1, 1, 1, 6, 6, 3, + 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 0, 0, + 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 2, + 2, 12, 12, 12, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2, 2, 49, + 49, 49, 49, 2, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 2, 49, + 49, 49, 2, 49, 49, 2, 49, 49, 49, 49, 2, 2, 2, 2, 2, 0, + 0, 0, 0, 2, 2, 2, 0, 9, 2, 2, 2, 2, 2, 2, 2, 0, + 0, 0, 0, 0, 1, 2, 2, 71, 71, 71, 71, 71, 2, 2, 2, 67, + 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 42, + 42, 42, 42, 2, 2, 2, 2, 2, 2, 2, 2, 2, 42, 42, 42, 41, + 41, 41, 2, 2, 2, 2, 2,118,118,118, 2, 2, 2, 2, 2, 53, + 53, 53, 53, 53, 53, 2, 53, 59, 59, 59, 59, 2, 2, 2, 2, 59, + 59, 59, 59, 59, 59, 2, 2, 50, 50, 50, 50, 50, 50, 2, 2, 50, + 50, 2, 2, 2, 2, 2, 2,104,104,104,104, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2,104,161,161,161, 2,161,161, 2,161,161, + 161, 2,161,161, 2, 2, 2,170,170,170,170, 2, 2, 2, 2,110, + 110,110,110,110,110,110, 2,110,110,110,110,110,110, 2, 2, 19, + 19, 19, 19, 19, 19, 2, 19, 19, 2, 19, 19, 19, 19, 19, 19, 47, + 47, 47, 47, 47, 47, 2, 2, 47, 2, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 2, 47, 47, 2, 2, 2, 47, 2, 2, 47, 81, + 81, 81, 81, 81, 81, 2, 81,116,116,116,116,116,116,116, 2, 2, + 2, 2, 2, 2, 2, 2,116,128,128,128, 2,128,128, 2, 2, 2, + 2, 2,128,128,128,128,128, 66, 66, 66, 66, 2, 2, 2, 66, 72, + 72, 2, 2, 2, 2, 2, 72,173,173, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 97, 97, 97, 97, 2, 2, 97, 97, 97, 97, 97, 97, 57, + 57, 57, 57, 2, 57, 57, 2, 2, 2, 2, 2, 57, 57, 57, 57, 57, + 57, 57, 57, 2, 57, 57, 57, 2, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 2, 2, 57, 57, 57, 2, 2, 2, 2, 57, 2, + 2, 2,112,112,112,112,112, 78, 78, 78, 78, 78, 78, 2, 2, 2, + 78, 78, 78, 78, 78, 78, 78, 83, 83, 83, 83, 83, 83, 2, 2, 82, + 82, 82, 2, 2, 2, 2, 2,122,122, 2, 2, 2, 2, 2, 2, 2, + 122,122,122,122, 2, 2, 2, 2,122,122,122,122,122,122,122, 89, + 2, 2, 2, 2, 2, 2, 2, 2, 2,130,130,130,130,130,130,144, + 144, 2, 2, 2, 2, 2, 2, 2,165,165,165,165,165,165,165, 2, + 2, 2, 2, 2, 2,165,165, 3, 3, 3, 3, 3, 3, 3, 2,156, + 156, 2,156,156,156, 2, 2,156,156, 2, 2, 2, 2, 2, 2, 3, + 2, 2, 2, 2, 2, 2, 2,148,148, 2, 2, 2, 2, 2, 2,158, + 158, 2, 2, 2, 2, 2, 2,153,153,153,153, 2, 2, 2, 2,149, + 149,149,149,149,149,149, 2, 2, 2, 94, 94, 94, 94, 94, 94, 2, + 2, 2, 2, 2, 2, 2, 94, 85, 85, 85, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 85, 2, 2,101, 2, 2, 2, 2, 2, 2, 2,101, + 101, 2, 2, 2, 2, 2, 2, 96, 96, 96, 96, 96, 2, 96, 96,111, + 111,111,111,111,111,111, 2, 2, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 2, 2, 2,108,108, 2,108,108,108,108,108,108, + 108, 2, 2, 2, 2, 2, 2,129,129,129,129,129,129,129, 2,129, + 2,129,129,129,129, 2,129,129,129,129,129,129,129, 2,129,129, + 129, 2, 2, 2, 2, 2, 2,109,109,109, 2, 2, 2, 2, 2,109, + 109, 2, 2, 2, 2, 2, 2,107,107,107,107, 2,107,107,107,107, + 2, 2,107,107,107,107,107,107, 2,107,107,107,107,107,107,107, + 2,107,107, 2,107,107,107,107,107, 2, 1,107,107,107,107,107, + 2, 2,107,107,107, 2, 2,107, 2, 2, 2, 2, 2, 2,107, 2, + 2, 2, 2, 2,107,107,107,107,107,107,107, 2, 2,107,107,171, + 171, 2,171, 2, 2,171, 2,171, 2,171, 2, 2,171, 2,171,171, + 171,171, 2,171,171,171,171,171, 2, 2, 2, 2, 2, 2, 2, 2, + 171,171, 2, 2, 2, 2, 2,137,137,137,137, 2,137,137,137,137, + 137, 2, 2, 2, 2, 2, 2,124,124, 2, 2, 2, 2, 2, 2,114, + 114,114,114,114, 2, 2, 2,114,114, 2, 2, 2, 2, 2, 2, 32, + 32, 32, 32, 32, 2, 2, 2, 33, 33, 33, 33, 2, 2, 2, 2,126, + 126,126, 2, 2,126,126,126,126,126,126,126, 2, 2, 2, 2,126, + 126,126,126,126,126,126, 2,142,142,142,142, 2, 2, 2, 2,125, + 125,125, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,125, 2, + 154, 2, 2,154,154,154,154,154,154,154,154, 2,154,154, 2,154, + 154,154,154,154,154, 2,154,154, 2, 2,154,154,154,154,154,154, + 154, 2, 2, 2, 2, 2, 2,150,150,150,150,150, 2, 2, 2,140, + 140,140, 2, 2, 2, 2, 2,121, 2, 2, 2, 2, 2, 2, 2, 7, + 7, 2, 2, 2, 2, 2, 2,133, 2,133,133,133,133,133,133,133, + 133,133,133,133,133,133, 2,133,133,133,133,133,133, 2, 2,133, + 133,133,133,133, 2, 2, 2, 2, 2,134,134,134,134,134,134, 2, + 134,134,134,134,134,134,134,134,134,134,134,134,134,134, 2,138, + 138, 2,138,138,138,138,138, 2, 2,138, 2,138,138, 2,138,138, + 138, 2, 2, 2, 2, 2, 2,143,143,143,143,143,143, 2,143,143, + 2,143,143,143,143,143,143,143,143,143,143,143,143,143, 2,143, + 143, 2,143,143,143,143,143,143, 2, 2, 2, 2, 2, 2, 2,143, + 143, 2, 2, 2, 2, 2, 2,175,175,175,175, 2, 2, 2, 2,175, + 175, 2, 2, 2, 2, 2, 2,145, 2, 2, 2, 2, 2, 2, 2,163, + 2,163,163,163,163,163,163,163,163,163, 2, 2, 2,163,163,163, + 163,163, 2, 2, 2, 2, 2, 86, 2, 2, 2, 2, 2, 2, 2, 22, + 22, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 22, 63, + 63, 2, 2, 2, 2, 2, 2, 63, 63, 63, 63, 63, 63, 63, 2, 63, + 63, 63, 63, 63, 2, 2, 2, 63, 63, 63, 63, 2, 2, 2, 2,157, + 157,157, 2, 2, 2, 2, 2, 80, 80, 80, 80, 80, 80, 2, 2, 80, + 80, 80, 2, 2, 2, 2, 2,127,127,127,127,127,127,127, 2,166, + 166, 2, 2, 2, 2, 2, 2, 79, 2, 2, 2, 2, 2, 2, 2,115, + 115,115,115,115,115,115, 2,115,115, 2, 2, 2, 2,115,115,159, + 159,159,159,159,159,159, 2,159,159, 2, 2, 2, 2, 2, 2,119, + 119,119,119,119,119, 2, 2, 2, 2, 2, 2, 2,119,119,119,167, + 167, 2, 2, 2, 2, 2, 2,146,146,146, 2, 2, 2, 2, 2,172, + 2, 2,172,172,172,172,172,172,172,172,172, 2, 2, 2, 2, 99, + 99, 99, 2, 2, 2, 2, 99, 2, 2, 2, 2, 2, 2, 2, 99,136, + 139, 13, 13,155, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 2,155, + 155,155,155,155,155, 2, 2, 2, 2, 2, 2, 2, 2, 2,155,136, + 136,136,136,136,136,136, 2,136,136,136, 2, 2, 2, 2, 2, 17, + 17, 17, 17, 2, 17, 17, 17, 17, 17, 17, 17, 2, 17, 17, 2, 17, + 15, 15, 15, 15, 15, 15, 15, 17, 17, 17, 2, 2, 2, 2, 2, 2, + 2, 15, 2, 2, 2, 2, 2, 15, 15, 15, 2, 2, 17, 2, 2, 2, + 2, 2, 2, 17, 17, 17, 17,139,139,139,139, 2, 2, 2, 2,105, + 105,105, 2, 2, 2, 2, 2,105,105,105,105,105, 2, 2, 2,105, + 2, 2, 2, 2, 2, 2, 2,105,105, 2, 2,105,105,105,105, 1, + 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 0, 0, 2, 2, 0, 2, 2, 0, 0, 2, 2, + 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, + 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0,131, + 131,131,131, 2, 2, 2, 2, 2, 2, 2,131,131,131,131,131, 2, + 131,131,131,131,131,131,131, 2, 2, 2, 2, 2, 19, 19, 19, 56, + 56, 56, 56, 56, 56, 56, 2, 56, 2, 2, 56, 56, 56, 56, 56, 56, + 56, 2, 56, 56, 2, 56, 56, 56, 56, 56, 2, 2, 2, 2, 2, 6, + 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6,151, + 151,151,151,151, 2, 2, 2,151,151,151,151,151,151, 2, 2,151, + 151, 2, 2, 2, 2,151,151,160,160,160,160,160,160,160, 2,152, + 152, 2, 2, 2, 2, 2,152,164,164, 2, 2, 2, 2, 2, 2,168, + 168,168, 2, 2, 2, 2,168,174,174,174,174,174,174,174, 2,174, + 174,174,174,174,174, 2, 2, 2, 2, 2, 2, 2, 2,174,174, 30, + 30, 30, 30, 2, 30, 30, 2,113,113,113,113,113, 2, 2,113,113, + 113,113,113,113,113,113, 2,132,132,132,132, 2, 2, 2, 2,132, + 132, 2, 2, 2, 2,132,132, 3, 3, 3, 3, 2, 3, 3, 3, 2, + 3, 3, 3, 3, 3, 3, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, + 2, 3, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 2, + 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 2, 3, 2, 2, + 3, 3, 3, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 0, 0, 15, 0, 0, 2, 2, 2, 2, 2, 0, + 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 0, 0, 0, + 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 13, + 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 2, 2, 2, 2, 2, 2, + 0, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 0, 0, 0, 10, 0, 11, 12, 13, 0, 0, 0, 14, 0, 0, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 17, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 19, + 20, 21, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 24, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 26, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 24, 25, 26, 27, + 28, 29, 30, 0, 0, 31, 32, 0, 33, 0, 34, 0, 35, 0, 0, 0, + 0, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 41, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 43, 44, 0, 45, 0, 0, 0, 0, 0, + 0, 46, 47, 0, 0, 0, 0, 0, 48, 0, 49, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 51, 0, 0, 0, 52, 0, + 0, 53, 0, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, + 0, 55, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, + 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 59, 60, 61, 62, 63, 64, + 65, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 67, 68, 0, 69, 70, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99,100,101,102,103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,104, 0, 0, 0, 0, 0, 0,105,106, + 0,107, 0, 0, 0,108, 0,109, 0,110, 0,111,112,113, 0,114, + 0, 0, 0,115, 0, 0, 0,116, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,118,119,120,121, 0,122,123, + 124,125,126, 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,128,129,130,131,132,133,134,135,136,137,138, + 139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154, + 155,156,157, 0, 0, 0,158,159,160,161, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0,162, 0,163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,164,165, + 0, 0, 0, 0, 0, 0, 0,166, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,167, 0, 0, 0,168,169, 0, + 0,170, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,173, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,174, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,175, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,176,177, 0, 0, 0, 0, + 178,179, 0, 0, 0,180,181,182,183,184,185,186,187,188,189,190, + 191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206, + 207,208,209,210,211,212,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, }; -static const uint16_t _hb_ucd_u16[10832]= +static const uint16_t _hb_ucd_u16[10784]= { - 0, 0, 1, 2, 3, 4, 5, 6, 0, 0, 7, 8, 9, 10, 11, 12, - 13, 13, 13, 14, 15, 13, 13, 16, 17, 18, 19, 20, 21, 22, 13, 23, - 13, 13, 13, 24, 25, 11, 11, 11, 11, 26, 11, 27, 28, 29, 30, 31, - 32, 32, 32, 32, 32, 32, 32, 33, 34, 35, 36, 11, 37, 38, 13, 39, - 9, 9, 9, 11, 11, 11, 13, 13, 40, 13, 13, 13, 41, 13, 13, 13, - 13, 13, 13, 42, 9, 43, 11, 11, 44, 45, 32, 46, 47, 48, 49, 50, - 51, 52, 48, 48, 53, 32, 54, 55, 48, 48, 48, 48, 48, 56, 57, 58, - 59, 60, 48, 32, 61, 48, 48, 48, 48, 48, 62, 63, 64, 48, 65, 66, - 48, 67, 68, 69, 48, 70, 71, 48, 72, 73, 48, 48, 74, 32, 75, 32, - 76, 48, 48, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 83, 84, 91, 92, 93, 94, 95, 96, 97, 84, 98, 99, 100, 88, 101, - 102, 83, 84, 103, 104, 105, 88, 106, 107, 108, 109, 110, 111, 112, 94, 113, - 114, 115, 84, 116, 117, 118, 88, 119, 120, 115, 84, 121, 122, 123, 88, 124, - 125, 115, 48, 126, 127, 128, 88, 129, 130, 131, 48, 132, 133, 134, 94, 135, - 136, 48, 48, 137, 138, 139, 140, 140, 141, 48, 142, 143, 144, 145, 140, 140, - 146, 147, 148, 149, 150, 48, 151, 152, 153, 154, 32, 155, 156, 157, 140, 140, - 48, 48, 158, 159, 160, 161, 162, 163, 164, 165, 9, 9, 166, 11, 11, 167, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 168, 169, 48, 48, 168, 48, 48, 170, 171, 172, 48, 48, - 48, 171, 48, 48, 48, 173, 174, 175, 48, 176, 9, 9, 9, 9, 9, 177, - 178, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 179, 48, 180, 181, 48, 48, 48, 48, 182, 183, - 48, 184, 48, 185, 48, 186, 187, 188, 48, 48, 48, 189, 190, 191, 192, 193, - 194, 192, 48, 48, 195, 48, 48, 196, 197, 48, 198, 48, 48, 48, 48, 199, - 48, 200, 201, 202, 203, 48, 204, 205, 48, 48, 206, 48, 207, 208, 209, 209, - 48, 210, 48, 48, 48, 211, 212, 213, 192, 192, 214, 215, 32, 216, 217, 140, - 218, 48, 48, 219, 220, 160, 221, 222, 223, 48, 224, 64, 48, 48, 225, 226, - 48, 48, 227, 228, 229, 64, 48, 230, 231, 9, 9, 232, 233, 234, 235, 236, - 11, 11, 237, 27, 27, 27, 238, 239, 11, 240, 27, 27, 32, 32, 32, 32, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 241, 13, 13, 13, 13, 13, 13, - 242, 243, 242, 242, 243, 244, 242, 245, 246, 246, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 273, 274, 275, 276, 209, 277, 278, 209, 279, - 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - 281, 209, 282, 209, 209, 209, 209, 283, 209, 284, 280, 285, 209, 286, 287, 209, - 209, 209, 176, 140, 288, 140, 272, 272, 272, 289, 209, 209, 209, 209, 290, 272, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 291, 292, 209, 209, 293, - 209, 209, 209, 209, 209, 209, 294, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 209, 209, 295, 296, 272, 297, 209, 209, 298, 280, 299, 280, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 280, 280, 280, 280, 280, 280, 280, 280, 300, 301, 280, 280, 280, 302, 280, 303, - 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - 209, 209, 209, 280, 304, 209, 209, 305, 209, 209, 209, 209, 209, 209, 209, 209, - 9, 9, 9, 11, 11, 11, 306, 307, 13, 13, 13, 13, 13, 13, 308, 309, - 11, 11, 310, 48, 48, 48, 311, 312, 48, 313, 314, 314, 314, 314, 32, 32, - 315, 316, 317, 318, 319, 320, 140, 140, 209, 321, 209, 209, 209, 209, 209, 322, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 323, 140, 209, - 324, 325, 326, 327, 136, 48, 48, 48, 48, 328, 178, 48, 48, 48, 48, 329, - 330, 48, 48, 136, 48, 48, 48, 48, 200, 331, 48, 48, 209, 209, 332, 48, - 209, 333, 334, 209, 335, 336, 209, 209, 334, 209, 209, 336, 209, 209, 209, 209, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 209, 209, 209, 209, - 48, 337, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 151, 209, 209, 209, 338, 48, 48, 230, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 339, 48, 340, 140, 13, 13, 341, 342, 13, 343, 48, 48, 48, 48, 344, 345, - 31, 346, 347, 348, 13, 13, 13, 349, 350, 351, 352, 353, 354, 355, 140, 356, - 357, 48, 358, 359, 48, 48, 48, 360, 361, 48, 48, 362, 363, 192, 32, 364, - 64, 48, 365, 48, 366, 367, 48, 151, 76, 48, 48, 368, 369, 370, 371, 372, - 48, 48, 373, 374, 375, 376, 48, 377, 48, 48, 48, 378, 379, 380, 381, 382, - 383, 384, 314, 11, 11, 385, 386, 11, 11, 11, 11, 11, 48, 48, 387, 192, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 388, 48, 389, 48, 48, 206, - 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, - 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 204, 48, 48, 48, 48, 48, 48, 207, 140, 140, - 392, 393, 394, 395, 396, 48, 48, 48, 48, 48, 48, 397, 398, 399, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 400, 209, 48, 48, 48, 48, 401, 48, 48, 402, 140, 140, 403, - 32, 404, 32, 405, 406, 407, 408, 409, 48, 48, 48, 48, 48, 48, 48, 410, - 411, 2, 3, 4, 5, 412, 413, 414, 48, 415, 48, 200, 416, 417, 418, 419, - 420, 48, 172, 421, 204, 204, 140, 140, 48, 48, 48, 48, 48, 48, 48, 71, - 422, 272, 272, 423, 273, 273, 273, 424, 425, 426, 427, 140, 140, 209, 209, 428, - 140, 140, 140, 140, 140, 140, 140, 140, 48, 151, 48, 48, 48, 100, 429, 430, - 48, 48, 431, 48, 432, 48, 48, 433, 48, 434, 48, 48, 435, 436, 140, 140, - 9, 9, 437, 11, 11, 48, 48, 48, 48, 204, 192, 9, 9, 438, 11, 439, - 48, 48, 440, 48, 48, 48, 441, 442, 442, 443, 444, 445, 48, 48, 48, 388, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 313, 48, 199, 440, 140, 446, 27, 27, 447, 140, 140, 140, 140, - 448, 48, 48, 449, 48, 450, 48, 451, 48, 200, 452, 140, 140, 140, 48, 453, - 48, 454, 48, 455, 48, 207, 140, 140, 48, 48, 48, 456, 272, 457, 272, 272, - 458, 459, 48, 460, 461, 462, 48, 463, 48, 464, 140, 140, 465, 48, 466, 467, - 48, 48, 48, 468, 48, 469, 48, 470, 48, 471, 472, 140, 140, 140, 140, 140, - 48, 48, 48, 48, 196, 140, 140, 140, 9, 9, 9, 473, 11, 11, 11, 474, - 48, 48, 475, 192, 476, 9, 477, 11, 478, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 272, 479, 48, 48, 480, 481, 482, 483, 140, 484, - 48, 464, 485, 48, 62, 486, 140, 48, 487, 140, 140, 48, 488, 140, 48, 313, - 489, 48, 48, 490, 491, 457, 492, 493, 223, 48, 48, 494, 495, 48, 196, 192, - 496, 48, 497, 498, 499, 48, 48, 500, 223, 48, 48, 501, 502, 503, 504, 505, - 48, 97, 506, 507, 508, 140, 140, 140, 509, 510, 511, 48, 48, 512, 513, 192, - 514, 83, 84, 515, 516, 517, 518, 519, 520, 48, 48, 521, 522, 523, 524, 140, - 48, 48, 48, 525, 526, 527, 481, 140, 48, 48, 48, 528, 529, 192, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 48, 48, 530, 531, 532, 533, 140, 140, - 48, 48, 48, 534, 535, 192, 536, 140, 48, 48, 537, 538, 192, 539, 540, 140, - 48, 541, 542, 543, 313, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 506, 544, 140, 140, 140, 140, 140, 140, 9, 9, 11, 11, 148, 545, - 546, 547, 48, 548, 549, 192, 140, 140, 140, 140, 550, 48, 48, 551, 552, 140, - 553, 48, 48, 554, 555, 556, 48, 48, 557, 558, 559, 48, 48, 48, 48, 196, - 560, 140, 140, 140, 140, 140, 561, 140, 140, 140, 140, 140, 48, 48, 562, 192, - 84, 48, 530, 563, 564, 148, 175, 565, 48, 566, 567, 568, 140, 140, 140, 140, - 569, 48, 48, 570, 571, 192, 572, 48, 573, 574, 192, 48, 48, 575, 192, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 576, - 577, 115, 48, 578, 579, 580, 140, 140, 140, 140, 140, 100, 272, 581, 582, 583, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 207, 140, 140, 140, 140, 140, 140, - 273, 273, 273, 273, 273, 273, 584, 585, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 388, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 48, 48, 48, 48, 48, 586, - 48, 48, 48, 587, 588, 589, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 71, - 48, 48, 48, 48, 313, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 590, 591, 192, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 48, 196, 48, 200, 370, 48, 48, 48, 48, 200, 192, 48, 204, 592, - 48, 48, 48, 593, 594, 595, 596, 597, 48, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 598, 48, 599, 192, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 9, 9, 11, 11, 272, 600, 9, 601, 11, 602, 140, 140, - 48, 48, 48, 48, 603, 604, 605, 605, 606, 607, 140, 140, 140, 140, 608, 609, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 199, 140, 610, - 48, 200, 140, 140, 140, 140, 140, 140, 48, 48, 48, 48, 48, 48, 48, 611, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 612, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 611, 613, 140, 614, 615, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 206, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 48, 48, 48, 48, 71, 151, 196, 616, 617, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 618, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 619, 209, 427, 209, 620, - 32, 32, 216, 32, 621, 209, 209, 209, 209, 209, 209, 209, 322, 140, 140, 140, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 323, - 209, 209, 622, 209, 209, 209, 623, 624, 625, 209, 626, 209, 209, 209, 288, 140, - 209, 209, 209, 209, 627, 140, 140, 140, 140, 140, 140, 140, 272, 628, 272, 628, - 209, 209, 209, 209, 209, 338, 272, 461, 140, 140, 140, 140, 140, 140, 140, 140, - 9, 629, 11, 630, 631, 632, 242, 9, 633, 634, 635, 636, 637, 9, 629, 11, - 638, 639, 11, 640, 641, 642, 643, 9, 644, 11, 9, 629, 11, 630, 631, 11, - 242, 9, 633, 643, 9, 644, 11, 9, 629, 11, 645, 9, 646, 647, 648, 649, - 11, 650, 9, 651, 652, 653, 654, 11, 655, 9, 656, 11, 657, 539, 539, 539, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 32, 32, 32, 658, 32, 32, 659, 660, 661, 662, 45, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 663, 664, 665, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 666, 667, 668, 27, 27, 27, 669, 140, 670, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 151, 671, 672, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 673, 140, 48, 48, 674, 675, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 676, 192, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 590, 677, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 200, 678, 679, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 680, 200, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 681, 621, 140, 140, - 9, 9, 633, 11, 682, 370, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 504, 272, 272, 683, 684, 140, 140, 140, 140, - 504, 272, 685, 686, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 687, 48, 688, 689, 690, 691, 692, 693, 694, 206, 695, 206, 140, 140, 140, 696, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 209, 209, 697, 209, 209, 209, 209, 209, 209, 322, 333, 698, 698, 698, 209, 323, - 699, 209, 209, 209, 209, 209, 209, 209, 209, 209, 700, 140, 140, 140, 701, 209, - 702, 209, 209, 697, 703, 704, 323, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 705, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 706, 426, 426, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 176, 697, 427, - 697, 209, 209, 209, 707, 176, 209, 209, 707, 209, 700, 697, 704, 708, 140, 140, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 209, 707, 700, 426, 709, 209, 209, 209, 710, 711, 712, 703, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 713, 209, 209, 209, 209, 209, 714, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 140, 140, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 204, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 204, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 100, 48, - 48, 48, 48, 48, 48, 204, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 204, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 71, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 207, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 715, 140, 587, 587, 587, 587, 587, 587, 140, 140, 140, 140, 140, 140, 140, 140, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 140, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 716, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 717, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 3, 1, 2, 2, 3, - 0, 0, 0, 0, 0, 4, 0, 4, 2, 2, 5, 2, 2, 2, 5, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 6, 0, 0, 0, 0, 7, 8, 0, 0, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 11, - 12, 13, 14, 14, 15, 14, 14, 14, 14, 14, 14, 14, 16, 17, 14, 14, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 20, 21, 21, 21, 22, 20, 21, 21, 21, 21, - 21, 23, 24, 25, 25, 25, 25, 25, 25, 26, 25, 25, 25, 27, 28, 26, - 29, 30, 31, 32, 31, 31, 31, 31, 33, 34, 35, 31, 31, 31, 36, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 29, 31, 31, 31, 31, - 37, 38, 37, 37, 37, 37, 37, 37, 37, 39, 31, 31, 31, 31, 31, 31, - 40, 40, 40, 40, 40, 40, 41, 26, 42, 42, 42, 42, 42, 42, 42, 43, - 44, 44, 44, 44, 44, 45, 44, 46, 47, 47, 47, 48, 37, 49, 31, 31, - 31, 31, 50, 31, 31, 31, 31, 31, 31, 31, 31, 31, 51, 31, 31, 31, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 52, 54, 52, 52, 52, - 55, 56, 57, 58, 58, 59, 60, 61, 56, 62, 63, 64, 65, 58, 58, 66, - 67, 68, 69, 70, 70, 71, 72, 73, 68, 74, 75, 76, 77, 70, 78, 26, - 79, 80, 81, 82, 82, 83, 84, 85, 80, 86, 87, 26, 88, 82, 89, 90, - 91, 92, 93, 94, 94, 95, 96, 97, 92, 98, 99, 100, 101, 94, 94, 26, - 102, 103, 104, 105, 106, 103, 107, 108, 103, 104, 109, 26, 110, 107, 107, 111, - 112, 113, 114, 112, 112, 114, 112, 115, 113, 116, 117, 118, 119, 112, 120, 112, - 121, 122, 123, 121, 121, 123, 124, 125, 122, 126, 127, 128, 129, 121, 130, 26, - 131, 132, 133, 131, 131, 131, 131, 131, 132, 133, 134, 131, 135, 131, 131, 131, - 136, 137, 138, 139, 137, 137, 140, 141, 138, 142, 143, 137, 144, 137, 145, 26, - 146, 147, 147, 147, 147, 147, 147, 148, 147, 147, 147, 149, 26, 26, 26, 26, - 150, 151, 152, 152, 153, 152, 152, 154, 155, 156, 152, 157, 26, 26, 26, 26, - 158, 158, 158, 158, 158, 158, 158, 158, 158, 159, 158, 158, 158, 160, 159, 158, - 158, 158, 158, 159, 158, 158, 158, 161, 158, 161, 162, 163, 26, 26, 26, 26, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 165, 165, 165, 165, 166, 167, 165, 165, 165, 165, 165, 168, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 171, 172, 171, 170, 170, 170, 170, - 170, 171, 170, 170, 170, 170, 171, 172, 171, 170, 172, 170, 170, 170, 170, 170, - 170, 170, 171, 170, 170, 170, 170, 170, 170, 170, 170, 173, 170, 170, 170, 174, - 170, 170, 170, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, 177, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 179, 179, 179, 180, 181, 181, 181, 181, 181, 181, 181, 181, 181, 182, 181, 183, - 184, 184, 185, 186, 187, 187, 188, 26, 189, 189, 190, 26, 191, 192, 193, 26, - 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 195, 194, 196, 194, 196, - 197, 198, 198, 199, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, 200, - 198, 198, 198, 198, 198, 201, 178, 178, 178, 178, 178, 178, 178, 178, 202, 26, - 203, 203, 203, 204, 203, 205, 203, 205, 206, 203, 207, 207, 207, 208, 209, 26, - 210, 210, 210, 210, 210, 211, 210, 210, 210, 212, 210, 213, 194, 194, 194, 194, - 214, 214, 214, 215, 216, 216, 216, 216, 216, 216, 216, 217, 216, 216, 216, 218, - 216, 219, 216, 219, 216, 220, 9, 9, 9, 9, 9, 221, 9, 222, 26, 26, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 224, 223, 223, 223, 223, 223, 223, - 225, 225, 225, 225, 225, 225, 225, 225, 226, 226, 226, 226, 226, 226, 227, 228, - 229, 229, 229, 229, 229, 229, 229, 230, 229, 231, 232, 232, 232, 232, 232, 232, - 18, 233, 165, 165, 165, 165, 165, 234, 225, 26, 235, 9, 236, 237, 238, 239, - 2, 2, 2, 2, 240, 241, 2, 2, 2, 2, 2, 242, 243, 244, 2, 245, - 2, 2, 2, 2, 2, 2, 2, 246, 9, 9, 9, 9, 9, 9, 9, 9, - 14, 14, 247, 247, 14, 14, 14, 14, 247, 247, 14, 248, 14, 14, 14, 247, - 14, 14, 14, 14, 14, 14, 249, 14, 249, 14, 250, 251, 14, 14, 252, 253, - 0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 256, 257, - 0, 258, 2, 259, 0, 0, 0, 0, 260, 26, 9, 9, 9, 9, 261, 26, - 0, 0, 0, 0, 262, 263, 4, 0, 0, 264, 0, 0, 2, 2, 2, 2, - 2, 265, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 260, 26, 26, 0, 266, 26, 26, 0, 0, 0, 0, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 268, 0, - 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 269, 2, 2, 2, 2, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 270, 271, - 165, 165, 165, 165, 166, 167, 272, 272, 272, 272, 272, 272, 272, 273, 274, 273, - 170, 170, 172, 26, 172, 172, 172, 172, 172, 172, 172, 172, 18, 18, 18, 18, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 275, 26, 26, 26, 26, - 276, 276, 276, 277, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 278, 26, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 279, 26, 26, 26, 0, 0, - 280, 0, 0, 0, 281, 282, 0, 283, 284, 285, 285, 285, 285, 285, 285, 285, - 285, 285, 286, 287, 288, 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, 290, - 291, 292, 292, 292, 292, 292, 293, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 294, 0, 0, 292, 292, 292, 292, 0, 0, 0, 0, 275, 295, 289, 289, - 169, 169, 169, 294, 0, 0, 0, 0, 0, 0, 0, 0, 169, 169, 169, 296, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 289, 289, 289, 289, 297, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, 0, 0, 0, 0, 0, - 276, 276, 276, 276, 276, 276, 276, 276, 0, 0, 0, 0, 0, 0, 0, 0, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 299, 298, 298, 298, 298, 298, 298, 300, 26, 301, 301, 301, 301, 301, 301, - 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, 302, - 302, 302, 302, 302, 302, 303, 26, 26, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 26, - 0, 0, 0, 0, 305, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 306, 2, 2, 2, 2, 2, 2, 2, 2, 2, 259, 26, 26, 307, 2, - 308, 308, 308, 308, 308, 309, 0, 260, 310, 310, 310, 310, 310, 310, 310, 26, - 311, 311, 311, 311, 311, 311, 311, 311, 312, 313, 311, 314, 52, 52, 52, 52, - 315, 315, 315, 315, 315, 316, 317, 317, 317, 317, 318, 319, 169, 169, 169, 320, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 322, 321, 323, 164, 164, 164, 324, - 325, 325, 325, 325, 325, 325, 326, 26, 325, 327, 325, 328, 164, 164, 164, 164, - 329, 329, 329, 329, 329, 329, 329, 329, 330, 26, 26, 331, 332, 332, 333, 26, - 334, 334, 334, 26, 172, 172, 2, 2, 2, 2, 2, 335, 336, 337, 176, 176, - 176, 176, 176, 176, 176, 176, 176, 176, 332, 332, 332, 332, 332, 338, 332, 339, - 169, 169, 169, 169, 340, 26, 169, 169, 294, 341, 169, 169, 169, 169, 169, 340, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 279, 276, 276, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 342, 26, 26, 26, 26, - 343, 26, 344, 345, 25, 25, 346, 347, 348, 25, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 349, 31, 31, 31, 31, 31, 31, 31, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 26, 26, 26, 26, 31, 31, - 9, 9, 0, 260, 9, 350, 0, 0, 0, 0, 351, 0, 258, 352, 353, 31, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 354, - 355, 0, 0, 0, 1, 2, 2, 3, 1, 2, 2, 3, 356, 289, 288, 289, - 289, 289, 289, 357, 169, 169, 169, 294, 358, 358, 358, 359, 258, 258, 26, 360, - 361, 362, 361, 361, 363, 361, 361, 364, 361, 365, 361, 365, 26, 26, 26, 26, - 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 366, - 367, 0, 0, 0, 0, 0, 368, 0, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 253, 0, 369, 370, 26, 26, 26, 26, 26, 0, 0, 0, 0, 0, 371, - 372, 372, 372, 373, 374, 374, 374, 374, 374, 374, 375, 26, 376, 0, 0, 352, - 377, 377, 377, 377, 378, 379, 380, 380, 380, 381, 382, 382, 382, 382, 382, 383, - 384, 384, 384, 385, 386, 386, 386, 386, 387, 386, 388, 26, 26, 26, 26, 26, - 389, 389, 389, 389, 389, 389, 389, 389, 389, 389, 390, 390, 390, 390, 390, 390, - 391, 391, 391, 392, 391, 393, 394, 394, 394, 394, 395, 394, 394, 394, 394, 395, - 396, 396, 396, 396, 396, 26, 397, 397, 397, 397, 397, 397, 398, 399, 400, 401, - 400, 401, 402, 400, 403, 400, 403, 404, 405, 405, 405, 405, 405, 405, 406, 26, - 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, 407, - 407, 407, 407, 407, 407, 407, 408, 26, 407, 407, 409, 26, 407, 26, 26, 26, - 410, 2, 2, 2, 2, 2, 411, 412, 26, 26, 26, 26, 26, 26, 26, 26, - 413, 414, 415, 415, 415, 415, 416, 417, 418, 418, 419, 418, 420, 420, 420, 420, - 421, 421, 421, 422, 423, 421, 26, 26, 26, 26, 26, 26, 424, 424, 425, 426, - 427, 427, 427, 428, 429, 429, 429, 430, 431, 431, 431, 432, 26, 26, 26, 26, - 433, 433, 433, 433, 434, 434, 434, 435, 434, 434, 436, 434, 434, 434, 434, 434, - 437, 438, 439, 440, 441, 441, 442, 443, 441, 444, 441, 444, 445, 445, 445, 445, - 446, 446, 446, 446, 26, 26, 26, 26, 447, 447, 447, 447, 448, 449, 448, 26, - 450, 450, 450, 450, 450, 450, 451, 452, 453, 453, 454, 453, 455, 455, 456, 455, - 457, 457, 458, 459, 26, 460, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 461, 461, 461, 461, 461, 461, 461, 461, 461, 462, 26, 26, 26, 26, 26, 26, - 463, 463, 463, 463, 463, 463, 464, 26, 463, 463, 463, 463, 463, 463, 464, 465, - 466, 466, 466, 466, 466, 26, 466, 467, 468, 468, 468, 468, 469, 470, 468, 468, - 469, 471, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 31, 31, 31, 472, - 473, 473, 473, 473, 473, 474, 475, 26, 476, 26, 31, 477, 26, 26, 26, 476, - 478, 478, 478, 478, 478, 26, 479, 479, 479, 479, 479, 480, 26, 26, 481, 481, - 481, 482, 26, 26, 26, 26, 483, 483, 483, 484, 26, 26, 485, 485, 486, 26, - 487, 487, 487, 487, 487, 487, 487, 487, 487, 488, 489, 487, 487, 487, 488, 490, - 491, 491, 491, 491, 491, 491, 491, 491, 492, 493, 494, 494, 494, 495, 494, 496, - 497, 497, 497, 497, 497, 497, 498, 497, 497, 26, 499, 499, 499, 499, 500, 26, - 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 501, 502, 137, 503, 26, - 504, 504, 505, 504, 504, 504, 504, 504, 506, 26, 26, 26, 26, 26, 26, 26, - 507, 508, 509, 510, 509, 511, 512, 512, 512, 512, 512, 512, 512, 513, 512, 514, - 515, 516, 517, 518, 518, 519, 520, 521, 516, 522, 523, 524, 525, 526, 526, 26, - 527, 528, 527, 527, 527, 527, 529, 527, 530, 531, 529, 532, 533, 26, 26, 26, - 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 534, 535, 536, 26, 26, 26, - 537, 537, 537, 537, 537, 537, 537, 537, 537, 26, 537, 538, 26, 26, 26, 26, - 539, 539, 539, 539, 539, 539, 540, 539, 539, 539, 539, 540, 26, 26, 26, 26, - 541, 541, 541, 541, 541, 541, 541, 541, 542, 26, 541, 543, 198, 544, 26, 26, - 545, 545, 545, 545, 545, 545, 545, 546, 545, 546, 164, 164, 547, 26, 26, 26, - 548, 548, 548, 549, 548, 550, 548, 548, 551, 26, 26, 26, 26, 26, 26, 26, - 552, 552, 552, 552, 552, 552, 552, 553, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 554, 554, 554, 554, 554, 554, 554, 554, 554, 554, 555, 556, - 557, 558, 559, 560, 560, 560, 561, 562, 557, 26, 560, 563, 26, 26, 26, 26, - 26, 26, 26, 26, 564, 565, 564, 564, 564, 564, 564, 565, 566, 26, 26, 26, - 567, 567, 567, 567, 567, 567, 567, 567, 567, 26, 568, 568, 568, 568, 568, 568, - 568, 568, 568, 568, 569, 26, 178, 178, 570, 570, 570, 570, 570, 570, 570, 571, - 52, 572, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 501, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 573, 573, 573, 573, 574, 26, 573, 574, - 575, 576, 575, 575, 575, 575, 577, 575, 578, 26, 575, 575, 575, 579, 580, 580, - 580, 580, 581, 580, 580, 582, 583, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 584, 585, 586, 586, 586, 586, 584, 587, 586, 26, 586, 588, 589, 590, 591, 591, - 591, 592, 593, 594, 591, 595, 596, 596, 596, 596, 596, 597, 596, 598, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 599, 599, 599, 600, - 601, 601, 602, 601, 601, 601, 601, 603, 601, 601, 601, 604, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 605, 26, 107, 107, 107, 107, 107, 107, 606, 607, - 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, - 608, 608, 608, 609, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 610, 611, 26, - 608, 608, 608, 608, 608, 608, 608, 608, 612, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, 613, 614, 26, - 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, - 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 616, 26, 615, 615, 615, 615, - 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 617, - 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, - 618, 618, 618, 618, 618, 618, 618, 618, 619, 26, 26, 26, 26, 26, 26, 26, - 620, 620, 620, 620, 620, 620, 620, 621, 26, 26, 26, 26, 26, 26, 26, 26, - 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - 304, 304, 304, 304, 304, 304, 304, 622, 623, 623, 623, 624, 623, 625, 626, 626, - 626, 626, 626, 626, 626, 626, 626, 627, 626, 628, 629, 629, 629, 630, 630, 26, - 631, 631, 631, 631, 631, 631, 631, 631, 632, 26, 631, 633, 633, 631, 631, 634, - 631, 631, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 635, 635, 635, 635, 635, 635, 635, 636, - 26, 26, 26, 26, 26, 26, 26, 26, 637, 637, 637, 637, 637, 637, 637, 637, - 637, 637, 637, 638, 639, 639, 639, 640, 639, 639, 641, 26, 26, 26, 26, 26, - 642, 642, 642, 642, 642, 642, 642, 642, 642, 643, 642, 642, 642, 642, 642, 642, - 642, 644, 642, 642, 26, 26, 26, 26, 26, 26, 26, 26, 645, 26, 646, 26, - 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, - 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, - 648, 648, 648, 648, 648, 648, 648, 648, 648, 648, 649, 26, 26, 26, 26, 650, - 647, 647, 647, 651, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 647, 652, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 653, 654, - 655, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, - 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, 285, - 285, 285, 285, 285, 656, 26, 657, 26, 26, 26, 658, 26, 659, 26, 660, 660, - 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, - 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 660, 661, - 662, 662, 662, 662, 662, 662, 662, 662, 662, 662, 662, 662, 662, 663, 662, 664, - 662, 665, 662, 666, 352, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 369, - 0, 0, 0, 0, 0, 0, 352, 667, 0, 0, 668, 26, 0, 0, 668, 26, - 9, 9, 9, 9, 9, 221, 9, 9, 669, 26, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 352, 26, 26, 26, 26, 26, 26, 26, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 275, 26, - 0, 0, 0, 0, 258, 355, 0, 0, 0, 0, 0, 0, 670, 671, 0, 672, - 673, 674, 0, 0, 0, 675, 0, 0, 0, 0, 0, 0, 0, 266, 26, 26, - 14, 14, 14, 14, 14, 14, 14, 14, 247, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 0, 0, 352, 26, 0, 0, 352, 26, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 258, 26, 0, 0, 0, 668, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 676, 677, 0, 678, 679, 0, 0, 0, 0, 0, 0, 0, - 680, 681, 255, 255, 0, 0, 0, 682, 683, 667, 684, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 275, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 268, 0, 0, 0, 0, 0, 0, - 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, - 685, 686, 26, 687, 688, 685, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 2, 2, 2, 343, 689, 412, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 690, 269, 269, 691, 692, 693, 18, 18, 18, 18, 18, 18, 18, 694, 26, 26, - 26, 695, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 696, 696, 696, 696, 696, 697, 696, 698, 696, 699, 26, 26, 26, 26, 26, 26, - 26, 26, 700, 700, 700, 701, 26, 26, 702, 702, 702, 702, 702, 702, 702, 703, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 704, 704, 704, 704, 704, 705, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 706, 706, 706, 706, 706, 707, - 26, 26, 26, 26, 26, 26, 26, 26, 708, 708, 708, 709, 708, 708, 710, 711, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 172, 712, 170, 172, - 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, - 713, 713, 713, 713, 713, 713, 713, 713, 714, 713, 715, 26, 26, 26, 26, 26, - 716, 716, 716, 716, 716, 716, 716, 716, 716, 717, 716, 718, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 355, 0, - 0, 0, 0, 0, 0, 0, 369, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 355, 0, 0, 0, 0, 0, 0, 275, 26, 26, 26, 26, 26, 26, 26, 26, - 719, 31, 31, 31, 720, 721, 722, 723, 724, 725, 720, 726, 720, 722, 722, 727, - 31, 728, 31, 729, 730, 728, 31, 729, 26, 26, 26, 26, 26, 26, 731, 26, - 0, 0, 0, 0, 0, 352, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 352, 26, 0, 258, 355, 0, 355, 0, 355, 0, 0, 0, 275, 26, - 0, 0, 0, 0, 0, 275, 26, 26, 26, 26, 26, 26, 732, 0, 0, 0, - 733, 26, 0, 0, 0, 0, 0, 352, 0, 668, 260, 26, 275, 26, 26, 26, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 734, 0, 369, 0, 369, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 260, 0, 352, 668, 26, - 0, 352, 0, 0, 0, 0, 0, 0, 0, 26, 0, 260, 0, 0, 0, 0, - 0, 26, 0, 0, 0, 275, 0, 352, 260, 26, 0, 668, 26, 26, 26, 26, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 275, 0, 369, - 0, 735, 0, 0, 0, 0, 0, 0, 258, 736, 0, 737, 0, 367, 0, 668, - 0, 0, 351, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 266, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 26, 26, 26, 26, - 276, 276, 276, 279, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, - 276, 276, 276, 276, 276, 279, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 738, 26, 276, 276, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 279, 26, 26, 26, 26, - 276, 276, 276, 279, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 739, 276, 276, 276, 276, 276, 276, - 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, 342, - 740, 26, 26, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 224, 224, 768, 424, 432, 440, 448, 776, 224, 224, 784, 792, 72, 800, 40, 808, + 48, 48, 48, 816, 824, 48, 48, 832, 840, 848, 856, 864, 872, 880, 48, 888, + 48, 48, 48, 896, 904, 40, 40, 40, 40, 912, 40, 96, 920, 928, 936, 456, + 64, 64, 64, 64, 64, 64, 64, 944, 952, 960, 968, 40, 976, 984, 48, 992, + 72, 72, 72, 40, 40, 40, 48, 48,1000, 48, 48, 48,1008, 48, 48, 48, + 48, 48, 48,1016, 72,1024, 40, 40,1032, 464, 64,1040,1048, 8,1056,1064, + 1072,1080, 8, 8,1088, 64,1096,1104, 8, 8, 8, 8, 8,1112,1120,1128, + 1136,1144, 8, 64,1152, 8, 8, 8, 8, 8, 472,1160, 232, 8,1168,1176, + 8,1184,1192,1200, 8,1208, 176, 8,1216,1224, 8, 8,1232, 64,1240, 64, + 480, 8, 8,1248,1256,1264,1272,1280,1288, 240, 128,1296,1304,1312, 144,1320, + 1328, 240, 128,1336,1344,1352, 304,1360,1368, 488, 128,1376,1384, 248, 144,1392, + 1400, 240, 128,1408,1416,1424, 144,1432,1440,1448,1456,1464,1472,1480, 304,1488, + 1496, 256, 128,1504,1512,1520, 144,1528,1536, 256, 128,1544,1552,1560, 144,1568, + 1576, 256, 8,1584,1592,1600, 144,1608,1616,1624, 8,1632,1640,1648, 304,1656, + 312, 8, 8,1664,1672,1680, 0, 0,1688, 8,1696,1704,1712,1720, 0, 0, + 1728,1736, 320,1744,1752, 8, 152,1760,1768,1776, 64,1784,1792,1800, 0, 0, + 8, 8,1808,1816, 496,1824,1832,1840,1848,1856, 72, 72,1864, 40, 40,1872, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 504,1880, 8, 8, 504, 8, 8,1888, 512, 520, 8, 8, + 8, 512, 8, 8, 8,1896,1904, 528, 8, 264, 72, 72, 72, 72, 72,1912, + 536, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8,1920, 8,1928,1936, 8, 8, 8, 8,1944,1952, + 8,1960, 8,1968, 8,1976,1984,1992, 8, 8, 8,2000,2008,2016, 80,2024, + 2032, 80, 8, 8,2040, 8, 8, 160,2048, 8,2056, 8, 8, 8, 8, 328, + 8, 120,2064,2072,2080, 8, 112,2088, 8, 8, 184, 8, 192,2096, 24, 24, + 8,2104, 8, 8, 8,2112,2120,2128, 80, 80,2136,2144, 64, 544,2152, 0, + 2160, 8, 8,2168,2176, 496,2184,2192, 336, 8,2200, 232, 8, 8,2208,2216, + 8, 8,2224,2232,2240, 232, 8, 552,2248, 72, 72,2256,2264,2272,2280,2288, + 40, 40,2296, 96, 96, 96,2304,2312, 40,2320, 96, 96, 64, 64, 64, 64, + 48, 48, 48, 48, 48, 48, 48, 48, 48,2328, 48, 48, 48, 48, 48, 48, + 168, 560, 168, 168, 560,2336, 168,2344, 344, 344, 344,2352,2360,2368,2376,2384, + 2392,2400,2408,2416,2424,2432,2440,2448,2456,2464, 568, 568,2472,2480,2488,2496, + 2504,2512,2520,2528,2536, 88, 104, 104,2544,2552,2560, 24,2568,2576, 24,2584, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 2592, 24,2600, 24, 24, 24, 24,2608, 24,2616, 56,2624, 24,2632,2640, 24, + 24, 24, 264, 0, 576, 0, 88, 88, 88,2648, 24, 24, 24, 24,2656, 88, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,2664,2672, 24, 24,2680, + 24, 24, 24, 24, 24, 24,2688, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24,2696,2704, 88,2712, 24, 24,2720, 56,2728, 56, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 56, 56, 56, 56, 56, 56, 56, 56,2736,2744, 56, 56, 56,2752, 56,2760, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 24, 24, 24, 56,2768, 24, 24,2776, 24, 24, 24, 24, 24, 24, 24, 24, + 72, 72, 72, 40, 40, 40,2784,2792, 48, 48, 48, 48, 48, 48,2800,2808, + 40, 40,2816, 8, 8, 8,2824,2832, 8, 200, 208, 208, 208, 208, 64, 64, + 2840,2848,2856,2864,2872,2880, 0, 0, 24,2888, 24, 24, 24, 24, 24, 352, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 272, 0, 24, + 2896,2904,2912,2920, 312, 8, 8, 8, 8,2928, 536, 8, 8, 8, 8,2936, + 2944, 8, 8, 312, 8, 8, 8, 8, 120,2952, 8, 8, 24, 24,2960, 8, + 24, 584, 592, 24,2968, 600, 24, 24, 592, 24, 24, 600, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 24, 24, 24, 24, + 8,2976, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 152, 24, 24, 24, 608, 8, 8, 552, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 2984, 8,2992, 0, 48, 48,3000,3008, 48,3016, 8, 8, 8, 8,3024,3032, + 456,3040,3048,3056, 48, 48, 48,3064,3072,3080,3088,3096,3104,3112, 0,3120, + 3128, 8,3136,3144, 8, 8, 8,3152,3160, 8, 8,3168,3176, 80, 64,3184, + 232, 8,3192, 8,3200,3208, 8, 152, 480, 8, 8,3216,3224, 360,3232,3240, + 8, 8,3248,3256,3264,3272, 8,3280, 8, 8, 8,3288,3296,3304,3312,3320, + 3328,3336, 208, 40, 40,3344,3352, 40, 40, 40, 40, 40, 8, 8,3360, 80, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 368, 8,3368, 8, 8, 184, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 112, 8, 8, 8, 8, 8, 8, 192, 0, 0, + 3376,3384,3392,3400,3408, 8, 8, 8, 8, 8, 8,3416,3424,3432, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8,3440, 24, 8, 8, 8, 8,3448, 8, 8,3456, 0, 0,3464, + 64,3472, 64,3480,3488,3496,3504,3512, 8, 8, 8, 8, 8, 8, 8,3520, + 3528, 424, 432, 440, 448,3536,3544,3552, 8,3560, 8, 120,3568,3576,3584,3592, + 3600, 8, 520,3608, 112, 112, 0, 0, 8, 8, 8, 8, 8, 8, 8, 176, + 3616, 88, 88,3624, 104, 104, 104,3632,3640, 280, 376, 0, 0, 24, 24,3648, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 152, 8, 8, 8, 248,3656,3664, + 8, 8,3672, 8,3680, 8, 8,3688, 8,3696, 8, 8,3704,3712, 0, 0, + 72, 72,3720, 40, 40, 8, 8, 8, 8, 112, 80, 72, 72,3728, 40,3736, + 8, 8, 616, 8, 8, 8,3744, 624, 624,3752,3760,3768, 8, 8, 8, 368, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 200, 8, 328, 616, 0,3776, 96, 96,3784, 0, 0, 0, 0, + 3792, 8, 8,3800, 8,3808, 8,3816, 8, 120,3824, 0, 0, 0, 8,3832, + 8,3840, 8,3848, 8, 192, 0, 0, 8, 8, 8,3856, 88, 632, 88, 88, + 3864,3872, 8,3880, 640,3888, 8,3896, 8, 648, 0, 0,3904, 8,3912,3920, + 8, 8, 8,3928, 8,3936, 8,3944, 8,3952,3960, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 160, 0, 0, 0, 72, 72, 72,3968, 40, 40, 40,3976, + 8, 8,3984, 80,3992, 72,4000, 40,4008, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 88,4016, 8, 8,4024, 656,4032,4040, 0,4048, + 8, 648,4056, 8, 472,4064, 0, 8,4072, 0, 0, 8,4080, 0, 8, 200, + 4088, 8, 8,4096,4104, 632,4112,4120, 336, 8, 8,4128,4136, 8, 160, 80, + 4144, 8,4152,4160,4168, 8, 8,4176, 336, 8, 8,4184,4192,4200, 384,4208, + 8, 488, 664,4216,4224, 0, 0, 0,4232,4240,4248, 8, 8,4256,4264, 80, + 4272, 240, 128,4280,4288,4296,4304,4312,4320, 8, 8,4328,4336,4344,4352, 0, + 8, 8, 8,4360,4368,4376, 656, 0, 8, 8, 8,4384,4392, 80, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 672,4400,4408,4416, 0, 0, + 8, 8, 8,4424,4432, 80,4440, 0, 8, 8,4448,4456, 80, 288,4464, 0, + 8,4472,4480,4488, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 664,4496, 0, 0, 0, 0, 0, 0, 72, 72, 40, 40, 320,4504, + 4512,4520, 8,4528,4536, 80, 0, 0, 0, 0,4544, 8, 8,4552,4560, 0, + 4568, 8, 8,4576,4584,4592, 8, 8,4600,4608,4616, 8, 8, 8, 8, 160, + 4624, 0, 0, 0, 0, 0,4632, 0, 0, 0, 0, 0, 8, 8,4640, 80, + 128, 8, 672,4648,4656, 320, 528,4664, 8,4672,4680,4688, 0, 0, 0, 0, + 4696, 8, 8,4704,4712, 80,4720, 8,4728,4736, 80, 8, 8,4744, 80, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,4752, + 4760, 256, 8,4768,4776,4784, 0, 0, 0, 0, 0, 248, 88,4792,4800,4808, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 192, 0, 0, 0, 0, 0, 0, + 104, 104, 104, 104, 104, 104,4816,4824, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 368, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8,4832, + 8, 8, 8, 136,4840,4848, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 176, + 8, 8, 8, 8, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 680,4856, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 160, 8, 120, 360, 8, 8, 8, 8, 120, 80, 8, 112,4864, + 8, 8, 8,4872,4880,4888,4896,4904, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,4912, 8,4920, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 72, 72, 40, 40, 88,4928, 72,4936, 40,4944, 0, 0, + 8, 8, 8, 8,4952,4960, 688, 688,4968,4976, 0, 0, 0, 0,4984,4992, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 328, 0,5000, + 8, 120, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 696, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,5008, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 696,5016, 0,5024,5032, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 184, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 8, 8, 176, 152, 160,5040,5048, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5056, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5064, 24, 376, 24,5072, + 64, 64, 544, 64, 704, 24, 24, 24, 24, 24, 24, 24, 352, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 272, + 24, 24,5080, 24, 24, 24,5088,5096,5104, 24,5112, 24, 24, 24, 576, 0, + 24, 24, 24, 24,5120, 0, 0, 0, 0, 0, 0, 0, 88, 712, 88, 712, + 24, 24, 24, 24, 24, 608, 88, 640, 0, 0, 0, 0, 0, 0, 0, 0, + 72, 296, 40, 720, 728,5128, 168, 72, 392,5136,5144,5152,5160, 72, 296, 40, + 5168,5176, 40,5184,5192,5200, 736, 72, 744, 40, 72, 296, 40, 720, 728, 40, + 168, 72, 392, 736, 72, 744, 40, 72, 296, 40,5208, 72,5216,5224,5232,5240, + 40,5248, 72,5256,5264,5272,5280, 40,5288, 72,5296, 40,5304, 288, 288, 288, + 64, 64, 64,5312, 64, 64,5320,5328,5336,5344, 464, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5352,5360,5368, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5376,5384,5392, 96, 96, 96,5400, 0,5408, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 152,5416,5424, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,5432, 0, 8, 8,5440,5448, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,5456, 80, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 680,5464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 120,5472,5480, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,5488, 120, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,5496, 704, 0, 0, + 72, 72, 392, 40,5504, 360, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 384, 88, 88,5512,5520, 0, 0, 0, 0, + 384, 88,5528,5536, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5544, 8,5552,5560,5568,5576,5584,5592,5600, 184,5608, 184, 0, 0, 0,5616, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 24, 24, 216, 24, 24, 24, 24, 24, 24, 352, 584, 400, 400, 400, 24, 272, + 5624, 24, 24, 24, 24, 24, 24, 24, 24, 24, 408, 0, 0, 0,5632, 24, + 5640, 24, 24, 216, 752, 760, 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5648, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5656, 280, 280, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 264, 216, 376, + 216, 24, 24, 24, 416, 264, 24, 24, 416, 24, 408, 216, 760,5664, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 416, 408, 280,5672, 24, 24, 24,5680,5688,5696, 752, + 24, 24, 24, 24, 24, 24, 24, 24, 24,5704, 24, 24, 24, 24, 24,5712, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 112, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 112, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 248, 8, + 8, 8, 8, 8, 8, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 176, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 192, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5720, 0, 136, 136, 136, 136, 136, 136, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,5728, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, + 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, + 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, + 24, 24, 24, 24, 24, 24, 24, 24,1104, 48, 48,1112,1104, 48, 48,1112, + 24, 24, 24, 24, 24,1288, 24,1288, 48, 48,1512, 48, 48, 48,1512, 48, + 48, 48, 48, 48, 48, 48, 48,2048, 24, 24, 24, 24,2056,2064, 24, 24, + 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,2072,2080, + 2088,2096, 144, 144,2104, 144, 144, 144, 144, 144, 144, 144,2112, 296, 144, 144, + 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, + 2120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, + 120, 120, 120, 120, 120, 120,1520, 592, 592, 592,2128,1520, 592, 592, 592, 592, + 592,2136,2144, 352, 352, 352, 352, 352, 352, 0, 352, 352, 352,2152,2160, 0, + 1528,2168, 56,2176, 56, 56, 56, 56,2184,2192,2200, 56, 56, 56,2208, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,1528, 56, 56, 56, 56, + 496,2216, 496, 496, 496, 496, 496, 496, 496,2224, 56, 56, 56, 56, 56, 56, + 784, 784, 784, 784, 784, 784,2232, 0, 688, 688, 688, 688, 688, 688, 688,2240, + 792, 792, 792, 792, 792,2248, 792,2256,1296,1296,1296,2264, 496,2272, 56, 56, + 56, 56,2280, 56, 56, 56, 56, 56, 56, 56, 56, 56,2288, 56, 56, 56, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240,2296, 240,2304, 240, 240, 240, + 2312,1536,2320,1120,1120,2328,2336,2344,1536,2352,2360,2368,2376,1120,1120,2384, + 2392,1544,2400,1304,1304,2408,2416,2424,1544,2432,2440,2448,2456,1304,2464, 0, + 2472,1552,2480,1312,1312,2488,2496,2504,1552,2512,2520, 0,2528,1312,2536,2544, + 2552,1560,2560,1128,1128,2568,2576,2584,1560,2592,2600,2608,2616,1128,1128, 0, + 2624,1320,1568,2632,2640,1320, 504,2648,1320,1568,2656, 0,2664, 504, 504,2672, + 800,1576,1584, 800, 800,1584, 800,2680,1576,2688,2696,2704,2712, 800,2720, 800, + 1136,1592,1600,1136,1136,1600,2728,2736,1592,2744,2752,2760,2768,1136,2776, 0, + 400,1608,1616, 400, 400, 400, 400, 400,1608,1616,2784, 400,2792, 400, 400, 400, + 2800, 808,1624,2808, 808, 808,2816,2824,1624,2832,2840, 808,2848, 808,2856, 0, + 2864, 512, 512, 512, 512, 512, 512,2872, 512, 512, 512,2880, 0, 0, 0, 0, + 2888,2896, 984, 984,2904, 984, 984,2912,2920,2928, 984,2936, 0, 0, 0, 0, + 224, 224, 224, 224, 224, 224, 224, 224, 224,1328, 224, 224, 224,2944,1328, 224, + 224, 224, 224,1328, 224, 224, 224,1632, 224,1632,2952,2960, 0, 0, 0, 0, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 256, 256, 256, 256,1640,1648, 256, 256, 256, 256, 256,2968, + 160, 160, 160, 160, 160, 160, 160, 160, 160, 816, 280, 816, 160, 160, 160, 160, + 160, 816, 160, 160, 160, 160, 816, 280, 816, 160, 280, 160, 160, 160, 160, 160, + 160, 160, 816, 160, 160, 160, 160, 160, 160, 160, 160,2976, 160, 160, 160,2984, + 160, 160, 160,2992, 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,1656,1656, + 1336,1336,1336,3000, 408, 408, 408, 408, 408, 408, 408, 408, 408,3008, 408,3016, + 1664,1664,3024,3032,1672,1672,3040, 0,1680,1680,3048, 0,3056,3064,3072, 0, + 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,3080, 272,1688, 272,1688, + 3088, 248, 248,3096, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248,3104, + 248, 248, 248, 248, 248,3112, 80, 80, 80, 80, 80, 80, 80, 80,3120, 0, + 824, 824, 824,3128, 824,1696, 824,1696,3136, 824,1344,1344,1344,3144,3152, 0, + 520, 520, 520, 520, 520,3160, 520, 520, 520,3168, 520,3176, 272, 272, 272, 272, + 1352,1352,1352,3184, 320, 320, 320, 320, 320, 320, 320,3192, 320, 320, 320,3200, + 320,1704, 320,1704, 320,3208, 104, 104, 104, 104, 104,1712, 104,3216, 0, 0, + 304, 304, 304, 304, 304, 304, 304, 304, 304,3224, 304, 304, 304, 304, 304, 304, + 528, 528, 528, 528, 528, 528, 528, 528, 832, 832, 832, 832, 832, 832,3232,3240, + 600, 600, 600, 600, 600, 600, 600,3248, 600,3256, 840, 840, 840, 840, 840, 840, + 120,3264, 256, 256, 256, 256, 256,3272, 528, 0,3280, 104,3288,3296,3304,3312, + 48, 48, 48, 48,3320,3328, 48, 48, 48, 48, 48,3336,3344,3352, 48,3360, + 48, 48, 48, 48, 48, 48, 48,3368, 104, 104, 104, 104, 104, 104, 104, 104, + 144, 144, 848, 848, 144, 144, 144, 144, 848, 848, 144,3376, 144, 144, 144, 848, + 144, 144, 144, 144, 144, 144,1720, 144,1720, 144,3384,3392, 144, 144,3400,1728, + 24,3408, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 992, 24,3416,3424, + 24, 608, 48,1736, 24, 24, 24, 24, 616, 0, 104, 104, 104, 104,3432, 0, + 24, 24, 24, 24,3440,3448,1288, 24, 24,3456, 24, 24, 48, 48, 48, 48, + 48,3464, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 616, 0, 0, 24,1360, 0, 0, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,1744, 24, + 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, 48, 48, 48, 48, + 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,3472,3480, + 256, 256, 256, 256,1640,1648, 696, 696, 696, 696, 696, 696, 696,1752,3488,1752, + 160, 160, 280, 0, 280, 280, 280, 280, 280, 280, 280, 280, 120, 120, 120, 120, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 416, 0, 0, 0, 0, + 8, 8, 8,3496, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,3504, 0, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 856, 0, 0, 0, 24, 24, + 3512, 24, 24, 24,3520,3528, 24,3536,3544, 152, 152, 152, 152, 152, 152, 152, + 152, 152,3552,3560,1760, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,3568, + 3576, 536, 536, 536, 536, 536,3584, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 16,1144, 24, 24, 536, 536, 536, 536, 24, 24, 24, 24, 416,3592, 184, 184, + 16, 16, 16,1144, 24, 24, 24, 24, 24, 24, 24, 24, 16, 16, 16,3600, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 184, 184, 184, 184, 184,3608, + 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 24, 24, 24, 24, 24, + 8, 8, 8, 8, 8, 8, 8, 8, 24, 24, 24, 24, 24, 24, 24, 24, + 72,3616, 72, 72, 72, 72, 72, 72,3624, 0, 864, 864, 864, 864, 864, 864, + 176, 176, 176, 176, 176,3632, 0, 0, 120, 120, 120, 120, 120, 120, 120, 120, + 120, 120, 120, 120, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 0, + 24, 24, 24, 24,3640, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48,3648, 48, 48, 48, 48, 48, 48, 48, 48, 48,1736, 0, 0,3656, 48, + 1000,1000,1000,1000,1000,3664, 24, 616, 704, 704, 704, 704, 704, 704, 704, 0, + 544, 544, 544, 544, 544, 544, 544, 544,3672,3680, 544,3688, 240, 240, 240, 240, + 1008,1008,1008,1008,1008,3696,1152,1152,1152,1152,3704,3712, 16, 16, 16,3720, + 424, 424, 424, 424, 424, 424, 424, 424, 424,3728, 424,3736, 200, 200, 200,3744, + 624, 624, 624, 624, 624, 624,3752, 0, 624,3760, 624,3768, 200, 200, 200, 200, + 632, 632, 632, 632, 632, 632, 632, 632,3776, 0, 0,3784, 640, 640,3792, 0, + 1368,1368,1368, 0, 280, 280, 48, 48, 48, 48, 48,3800,3808,3816, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 640, 640, 640, 640, 640,3824, 640,3832, + 16, 16, 16, 16,1768, 0, 16, 16,1144,3840, 16, 16, 16, 16, 16,1768, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 856, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,1776, 0, 0, 0, 0, + 1784, 0,3848,3856, 352, 352,3864,3872,3880, 352, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56,3888, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 0, 0, 0, 0, 56, 56, + 104, 104, 24, 616, 104,3896, 24, 24, 24, 24,1792, 24, 608, 328,3904, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,3912, + 712, 24, 24, 24,1104, 48, 48,1112,1104, 48, 48,1112,3920, 184,1760, 184, + 184, 184, 184,3928, 16, 16, 16,1144,1376,1376,1376,3936, 608, 608, 0,3944, + 216,3952, 216, 216,3960, 216, 216,3968, 216,1800, 216,1800, 0, 0, 0, 0, + 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216,3976, + 1808, 24, 24, 24, 24, 24,3984, 24, 144, 144, 144, 144, 144, 144, 144, 144, + 144,1728, 24, 872,3992, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24,4000, + 1384,1384,1384,4008, 880, 880, 880, 880, 880, 880,4016, 0,4024, 24, 24, 328, + 1160,1160,1160,1160,4032,4040,1392,1392,1392,4048,1016,1016,1016,1016,1016,4056, + 1400,1400,1400,4064,1024,1024,1024,1024,4072,1024,4080, 0, 0, 0, 0, 0, + 432, 432, 432, 432, 432, 432, 432, 432, 432, 432, 888, 888, 888, 888, 888, 888, + 1168,1168,1168,4088,1168,4096, 648, 648, 648, 648,1816, 648, 648, 648, 648,1816, + 1032,1032,1032,1032,1032, 0, 896, 896, 896, 896, 896, 896,4104,4112,1176,1824, + 1176,1824,4120,1176,1832,1176,1832,4128, 904, 904, 904, 904, 904, 904,4136, 0, + 168, 168, 168, 168, 168, 168,4144, 0, 168, 168,4152, 0, 168, 0, 0, 0, + 4160, 48, 48, 48, 48, 48,4168,1840, 0, 0, 0, 0, 0, 0, 0, 0, + 4176,4184,1184,1184,1184,1184,4192,4200,1408,1408,4208,1408,1192,1192,1192,1192, + 1200,1200,1200,4216,4224,1200, 0, 0, 0, 0, 0, 0,1848,1848,4232,4240, + 1416,1416,1416,4248,1424,1424,1424,4256,1432,1432,1432,4264, 0, 0, 0, 0, + 1208,1208,1208,1208, 440, 440, 440,4272, 440, 440,4280, 440, 440, 440, 440, 440, + 4288,4296,4304,4312,1216,1216,4320,4328,1216,1856,1216,1856,1224,1224,1224,1224, + 1232,1232,1232,1232, 0, 0, 0, 0,1240,1240,1240,1240,1864,4336,1864, 0, + 912, 912, 912, 912, 912, 912,4344,4352,1440,1440,4360,1440,1448,1448,4368,1448, + 1872,1872,4376,4384, 0,4392, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 552, 552, 552, 552, 552, 552, 552, 552, 552,4400, 0, 0, 0, 0, 0, 0, + 360, 360, 360, 360, 360, 360,1880, 0, 360, 360, 360, 360, 360, 360,1880,4408, + 920, 920, 920, 920, 920, 0, 920,4416, 928, 928, 928, 928,1888,4424, 928, 928, + 1888,4432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 56, 56,4440, + 1040,1040,1040,1040,1040,4448,4456, 0,1896, 0, 56,4464, 0, 0, 0,1896, + 1048,1048,1048,1048,1048, 0,1056,1056,1056,1056,1056,4472, 0, 0,1456,1456, + 1456,4480, 0, 0, 0, 0,1464,1464,1464,4488, 0, 0,1904,1904,4496, 0, + 368, 368, 368, 368, 368, 368, 368, 368, 368,1912,4504, 368, 368, 368,1912,4512, + 656, 656, 656, 656, 656, 656, 656, 656,4520,4528,1248,1248,1248,4536,1248,4544, + 664, 664, 664, 664, 664, 664,4552, 664, 664, 0,1256,1256,1256,1256,4560, 0, + 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336,4568, 808,4576, 0, + 720, 720,4584, 720, 720, 720, 720, 720,4592, 0, 0, 0, 0, 0, 0, 0, + 4600,4608,1920,4616,1920,4624, 672, 672, 672, 672, 672, 672, 672,4632, 672,4640, + 4648,1928,4656,1936,1936,4664,4672,4680,1928,4688,4696,4704,4712,1944,1944, 0, + 936,4720, 936, 936, 936, 936,1952, 936,4728,4736,1952,4744,4752, 0, 0, 0, + 384, 384, 384, 384, 384, 384, 384, 384, 384, 384, 384,4760,4768, 0, 0, 0, + 448, 448, 448, 448, 448, 448, 448, 448, 448, 0, 448,4776, 0, 0, 0, 0, + 456, 456, 456, 456, 456, 456,1960, 456, 456, 456, 456,1960, 0, 0, 0, 0, + 560, 560, 560, 560, 560, 560, 560, 560,4784, 0, 560,4792, 248,4800, 0, 0, + 680, 680, 680, 680, 680, 680, 680,1968, 680,1968, 200, 200,4808, 0, 0, 0, + 944, 944, 944,4816, 944,4824, 944, 944,4832, 0, 0, 0, 0, 0, 0, 0, + 728, 728, 728, 728, 728, 728, 728,4840, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 464, 464, 464, 464, 464, 464, 464, 464, 464, 464,4848,4856, + 1976,4864,4872,1264,1264,1264,4880,4888,1976, 0,1264,4896, 0, 0, 0, 0, + 0, 0, 0, 0, 952,1984, 952, 952, 952, 952, 952,1984,4904, 0, 0, 0, + 568, 568, 568, 568, 568, 568, 568, 568, 568, 0, 472, 472, 472, 472, 472, 472, + 472, 472, 472, 472,4912, 0, 80, 80, 736, 736, 736, 736, 736, 736, 736,4920, + 240,4928, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 336, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,1064,1064,1064,1064,1992, 0,1064,1992, + 576,4936, 576, 576, 576, 576,4944, 576,4952, 0, 576, 576, 576,4960, 960, 960, + 960, 960,4968, 960, 960,4976,4984, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2000,4992, 968, 968, 968, 968,2000,5000, 968, 0, 968,5008,5016,5024,1272,1272, + 1272,5032,5040,5048,1272,5056, 976, 976, 976, 976, 976,5064, 976,5072, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1472,1472,1472,5080, + 584, 584,5088, 584, 584, 584, 584,5096, 584, 584, 584,5104, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,5112, 0, 504, 504, 504, 504, 504, 504,5120,5128, + 64, 64, 64,5136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,5144,5152, 0, + 64, 64, 64, 64, 64, 64, 64, 64,5160, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376, 376,5168, 0, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,5176, 0, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,5184, + 112, 112, 112, 112, 112, 112, 112, 112,5192, 0, 0, 0, 0, 0, 0, 0, + 744, 744, 744, 744, 744, 744, 744,5200, 0, 0, 0, 0, 0, 0, 0, 0, + 88, 88, 88, 88, 88, 88, 88,5208,1280,1280,1280,5216,1280,5224, 480, 480, + 480, 480, 480, 480, 480, 480, 480,5232, 480,5240,1480,1480,1480,2008,2008, 0, + 344, 344, 344, 344, 344, 344, 344, 344,5248, 0, 344,2016,2016, 344, 344,5256, + 344, 344, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 752, 752, 752, 752, 752, 752, 752,5264, + 0, 0, 0, 0, 0, 0, 0, 0, 392, 392, 392, 392, 392, 392, 392, 392, + 392, 392, 392,5272,1072,1072,1072,5280,1072,1072,5288, 0, 0, 0, 0, 0, + 264, 264, 264, 264, 264, 264, 264, 264, 264,5296, 264, 264, 264, 264, 264, 264, + 264,5304, 264, 264, 0, 0, 0, 0, 0, 0, 0, 0,5312, 0,5320, 0, + 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,5328, 0, 0, 0, 0,5336, + 32, 32, 32,5344, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,5352, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,5360,5368, + 5376, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, + 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, + 152, 152, 152, 152,5384, 0,5392, 0, 0, 0,5400, 0,5408, 0, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,5416, + 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288,5424, 288,5432, + 288,5440, 288,5448, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 872, + 24, 24, 24, 24, 24, 24, 328,2024, 24, 24, 760, 0, 24, 24, 760, 0, + 104, 104, 104, 104, 104,1712, 104, 104,5456, 0, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 328, 0, 0, 0, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 416, 0, + 24, 24, 24, 24, 608, 712, 24, 24, 24, 24, 24, 24,5464,5472, 24,5480, + 5488,5496, 24, 24, 24,5504, 24, 24, 24, 24, 24, 24, 24,1360, 0, 0, + 144, 144, 144, 144, 144, 144, 144, 144, 848, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 328, 0, 24, 24, 328, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 608, 0, 24, 24, 24, 760, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 992, 24, 24, 24, 24, 24, + 24, 24, 24, 992,5512,5520, 24,5528,5536, 24, 24, 24, 24, 24, 24, 24, + 5544,5552, 992, 992, 24, 24, 24,5560,5568,2024,5576, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 416, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24,1744, 24, 24, 24, 24, 24, 24, + 96,5584, 0,5592,5600, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 48, 48, 48,1784,5608,1840, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5616, 312, 312,5624,5632,5640, 120, 120, 120, 120, 120, 120, 120,5648, 0, 0, + 0,5656, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 768, 768, 768, 768, 768,5664, 768,5672, 768,5680, 0, 0, 0, 0, 0, 0, + 0, 0,1488,1488,1488,5688, 0, 0, 776, 776, 776, 776, 776, 776, 776,5696, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1080,1080,1080,1080,1080,5704, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1088,1088,1088,1088,1088,5712, + 0, 0, 0, 0, 0, 0, 0, 0,1096,1096,1096,5720,1096,1096,5728,5736, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 280,5744, 160, 280, + 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 208,5752, 208,5760, 0, 0, 0, 0, 0, + 488, 488, 488, 488, 488, 488, 488, 488, 488,5768, 488,5776, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 712, 24, + 24, 24, 24, 24, 24, 24, 872, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 712, 24, 24, 24, 24, 24, 24, 416, 0, 0, 0, 0, 0, 0, 0, 0, + 5784, 56, 56, 56,1496,5792,1504,5800,5808,5816,1496,5824,1496,1504,1504,5832, + 56,2032, 56,2040,5840,2032, 56,2040, 0, 0, 0, 0, 0, 0,5848, 0, + 24, 24, 24, 24, 24, 328, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 328, 0, 24, 608, 712, 24, 712, 24, 712, 24, 24, 24, 416, 0, + 24, 24, 24, 24, 24, 416, 0, 0, 0, 0, 0, 0,5856, 24, 24, 24, + 5864, 0, 24, 24, 24, 24, 24, 328, 24, 760, 616, 0, 416, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5872, 24, 872, 24, 872, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 616, 24, 328, 760, 0, + 24, 328, 24, 24, 24, 24, 24, 24, 24, 0, 24, 616, 24, 24, 24, 24, + 24, 0, 24, 24, 24, 416, 24, 328, 616, 0, 24, 760, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 24, 416, 24, 872, + 24,5880, 24, 24, 24, 24, 24, 24, 608,5888, 24,5896, 24,1808, 24, 760, + 24, 24,1792, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,1360, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, + 8, 8, 8, 856, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 856, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,5904, 0, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 856, 0, 0, 0, 0, + 8, 8, 8, 856, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 8, 8, 8, 8, 8,5912, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,1776, + 5920, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 939, 940, 941, 942, 946, 948, 0, 962, 969, 970, 971, 976,1001,1002,1003,1008, 0,1033,1040,1041,1042,1043,1047, 0, 0,1080,1081,1082,1086,1110, 0, 0, @@ -2690,15 +2686,15 @@ static const uint16_t _hb_ucd_u16[10832]= }; static const int16_t _hb_ucd_i16[196]= { - 0, 0, 0, 0, 1, -1, 0, 0, 2, 0, -2, 0, 0, 0, 0, 2, - 0, -2, 0, 0, 0, 0, 0, 16, 0, 0, 0, -16, 0, 0, 1, -1, - 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, 0, 3, 3, 3, -3, + 0, 0, 0, 0, 1, -1, 1, -1, 1, -1, 0, 0, -1, 1, -1, 1, + 0, 0, 1, -1, -1, 1, -1, 0, 0, 0, 0, 1, 0, 1, -1, 0, + 0, 0, 0, 2, 0, -2, 0, 0, 0, 1, -1, 1, 2, 0, -2, 0, + -1, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, -16, 3, 3, 3, -3, -3, -3, 0, 0, 0, 2016, 0, 0, 0, 0, 0, 2527, 1923, 1914, 1918, 0, 2250, 0, 0, 0, 0, 0, 0, 138, 0, 7, 0, 0, -7, 0, 0, 0, - 1, -1, 1, -1, -1, 1, -1, 0, 1824, 0, 0, 0, 0, 0, 2104, 0, - 2108, 2106, 0, 2106, 1316, 0, 0, 0, 0, 1, -1, 1, -1, -138, 0, 0, - 1, -1, 8, 8, 8, 0, 7, 7, 0, 0, -8, -8, -8, -7, -7, 0, - 1, -1, 0, 2,-1316, 1, -1, 0, -1, 1, -1, 1, -1, 3, 1, -1, + 1824, 0, 0, 0, 0, 0, 2104, 0, 2108, 2106, 0, 2106, 1316, 0, 0, 0, + -1, -138, 0, 0, 1, -1, 8, 8, 8, 0, 7, 7, 0, 0, -8, -8, + -8, -7, -7, 0, 1, -1, 0, 2,-1316, 1, -1, 0, -1, 3, 1, -1, -3, 1, -1, 1, -1, 0, 0,-1914,-1918, 0, 0,-1923,-1824, 0, 0, 0, 0,-2016, 0, 0, 1, -1, 0, 1, 0, 0,-2104, 0, 0, 0, 0,-2106, -2108,-2106, 0, 0, 1, -1,-2250, 0, 0, 0,-2527, 0, 0, -2, 0, 1, @@ -2707,11 +2703,13 @@ static const int16_t _hb_ucd_i16[196]= static inline uint8_t _hb_ucd_gc (unsigned u) { - return u<1114110 ? _hb_ucd_u8[7920u+((_hb_ucd_u8[2176u+((_hb_ucd_u16[((_hb_ucd_u8[((((((u)>>1))>>3))>>5)])<<5)+((((((u)>>1))>>3))&31)])<<3)+((((u)>>1))&7)])<<1)+((u)&1)] : 2; + /* packtab: [2^8,2^5,2^3,2^1] */ + return u<1114110u ? (uint8_t)(_hb_ucd_u8[7912u+((_hb_ucd_u8[2176u+_hb_ucd_u16[((_hb_ucd_u8[((((((u)>>1))>>3))>>5)])<<5)+((((((u)>>1))>>3))&31)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2; } static inline uint8_t _hb_ucd_ccc (unsigned u) { - return u<125259 ? _hb_ucd_u8[10388u+((_hb_ucd_u8[9284u+((_hb_ucd_u8[8548u+((_hb_ucd_u8[8302u+((((((u)>>2))>>3))>>4)])<<4)+((((((u)>>2))>>3))&15)])<<3)+((((u)>>2))&7)])<<2)+((u)&3)] : 0; + /* packtab: [2^8,2^4,2^3,2^2] */ + return u<125259u ? (uint8_t)(_hb_ucd_u8[10370u+((_hb_ucd_u8[9270u+((_hb_ucd_u8[8539u+((_hb_ucd_u8[8294u+((((((u)>>2))>>3))>>4)])<<4)+((((((u)>>2))>>3))&15)])<<3)+((((u)>>2))&7)])<<2)+((u)&3)]) : 0; } static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i) { @@ -2719,15 +2717,18 @@ static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i) } static inline int16_t _hb_ucd_bmg (unsigned u) { - return u<65380 ? _hb_ucd_i16[((_hb_ucd_u8[11140u+((_hb_ucd_u8[11020u+((_hb_ucd_b4(_hb_ucd_u8+10892u,((((((u)>>2))>>3))>>3)))<<3)+((((((u)>>2))>>3))&7)])<<3)+((((u)>>2))&7)])<<2)+((u)&3)] : 0; + /* packtab: [2^4,2^3,2^3,2^2] */ + return u<65380u ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[11118u+((_hb_ucd_u8[11002u+((_hb_ucd_b4(_hb_ucd_u8+10874u,((((((u)>>2))>>3))>>3)))<<3)+((((((u)>>2))>>3))&7)])<<3)+((((u)>>2))&7)]+((u)&3)]) : 0; } static inline uint8_t _hb_ucd_sc (unsigned u) { - return u<918000 ? _hb_ucd_u8[12662u+((_hb_ucd_u16[3328u+((_hb_ucd_u8[11926u+((_hb_ucd_u8[11476u+((((((u)>>3))>>4))>>4)])<<4)+((((((u)>>3))>>4))&15)])<<4)+((((u)>>3))&15)])<<3)+((u)&7)] : 2; + /* packtab: [2^8,2^4,2^4,2^3] */ + return u<918000u ? (uint8_t)(_hb_ucd_u8[12639u+_hb_ucd_u16[3296u+((_hb_ucd_u8[11903u+((_hb_ucd_u8[11454u+((((((u)>>3))>>4))>>4)])<<4)+((((((u)>>3))>>4))&15)])<<4)+((((u)>>3))&15)]+((u)&7)]) : 2; } static inline uint16_t _hb_ucd_dm (unsigned u) { - return u<195102 ? _hb_ucd_u16[7408u+((_hb_ucd_u8[18972u+((_hb_ucd_u8[18590u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)] : 0; + /* packtab: [2^8,2^5,2^4] */ + return u<195102u ? (uint16_t)(_hb_ucd_u16[7360u+((_hb_ucd_u8[18949u+((_hb_ucd_u8[18567u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0; } @@ -2735,1624 +2736,1620 @@ static inline uint16_t _hb_ucd_dm (unsigned u) #include -static const uint8_t _hb_ucd_u8[14800]= +static const uint8_t _hb_ucd_u8[14763]= { - 0, 1, 2, 3, 4, 5, 5, 5, 5, 5, 6, 5, 5, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 5, 17, 15, 18, 19, 20, 21, 22, 23, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 24, 25, 26, 5, 27, 28, - 5, 29, 5, 30, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 32, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 33, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 17, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 33, 41, 42, 43, 44, 45, - 46, 47, 48, 39, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 49, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 50, 17, 17, 17, 51, 17, 52, 53, 54, 55, 56, 57, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 58, 59, 59, 59, 59, 59, 59, 59, 59, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 17, 61, 62, 17, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 17, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 17, 17, 17, 97, 98, 99,100,100,100,100,100,100,100,100,100,101, - 17, 17, 17, 17,102, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17,103, 17, 17,104,100,100,100,100,100,100,100,100,100, - 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, - 100,105,100,100,100,100,100,100, 17, 17,106,107,100,108,109,110, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,111,112,100,100, - 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,113, - 17,114,115,100,100,100,100,100,100,100,100,100,116,100,100,100, - 100,100,100,100,100,100,100,100,100,100,100,100,117, 39,118,119, - 120,121,122,123,124,125,126,127, 39, 39,128,100,100,100,100,129, - 130,131,132,100,133,134,135,136,137,138,100,100,139,140,141,100, - 142,143,144,145, 39, 39,146,147,148, 39,149,150,100,100,100,100, - 17, 17, 17, 17, 17, 17,151, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17,152, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,153, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,154, 17, 17,155,100, - 100,100,100,100,100,100,100,100, 17, 17,156,100,100,100,100,100, - 17, 17, 17,157, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17,158,100,100,100,100,100,100,100,100,100,100,100, - 159,160,100,100,100,100,100,100,100,100,100,100,100,100,100,100, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,161, - 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,162, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 2, 4, 5, 6, 2, - 7, 7, 7, 7, 7, 2, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 17, 18, 19, 1, 20, 20, 21, 22, 23, 24, 25, - 26, 27, 15, 2, 28, 29, 27, 30, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 31, 11, 11, 11, 32, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 33, 16, 16, 16, 16, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 34, 34, 34, 34, 34, 34, 34, 34, 16, 32, 32, 32, - 32, 32, 32, 32, 11, 34, 34, 16, 34, 32, 32, 11, 34, 11, 16, 11, - 11, 34, 32, 11, 32, 16, 11, 34, 32, 32, 32, 11, 34, 16, 32, 11, - 34, 11, 34, 34, 32, 35, 32, 16, 36, 36, 37, 34, 38, 37, 34, 34, - 34, 34, 34, 34, 34, 34, 16, 32, 34, 38, 32, 11, 32, 32, 32, 32, - 32, 32, 16, 16, 16, 11, 34, 32, 34, 34, 11, 32, 32, 32, 32, 32, - 16, 16, 36, 16, 16, 16, 16, 16, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 40, 40, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, - 39, 39, 41, 40, 40, 40, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, - 42, 42, 42, 42, 42, 42, 42, 42, 32, 32, 41, 32, 43, 44, 16, 10, - 43, 43, 40, 45, 11, 46, 46, 11, 34, 11, 11, 11, 11, 11, 11, 11, - 11, 47, 11, 11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 34, - 16, 11, 32, 16, 32, 32, 32, 32, 16, 16, 32, 48, 34, 32, 34, 11, - 32, 49, 42, 42, 50, 32, 32, 32, 11, 34, 34, 34, 34, 34, 34, 16, - 47, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 46, 51, 2, 2, 2, - 16, 16, 16, 16, 52, 53, 54, 55, 56, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 57, 58, 59, 42, 58, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 60, 43, 61, - 36, 62, 63, 43, 43, 43, 43, 43, 64, 64, 64, 8, 9, 65, 2, 66, - 42, 42, 42, 42, 42, 59, 67, 2, 68, 36, 36, 36, 36, 69, 42, 42, - 7, 7, 7, 7, 7, 2, 2, 36, 70, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 71, 42, 42, 42, 72, 49, 42, 42, 73, 74, 75, 42, 42, 36, - 7, 7, 7, 7, 7, 36, 76, 77, 2, 2, 2, 2, 2, 2, 2, 78, - 69, 36, 36, 36, 36, 36, 36, 36, 42, 42, 42, 42, 42, 79, 61, 36, - 36, 36, 36, 42, 42, 42, 42, 42, 70, 43, 43, 43, 43, 43, 43, 43, - 7, 7, 7, 7, 7, 36, 36, 36, 36, 36, 36, 36, 36, 69, 42, 42, - 42, 42, 39, 21, 2, 80, 56, 20, 36, 36, 36, 42, 42, 74, 42, 42, - 42, 42, 74, 42, 74, 42, 42, 43, 2, 2, 2, 2, 2, 2, 2, 63, - 36, 36, 36, 36, 69, 42, 43, 63, 36, 36, 36, 36, 36, 60, 43, 43, - 36, 36, 36, 36, 81, 36, 36, 36, 64, 43, 43, 56, 42, 42, 42, 42, - 36, 36, 36, 36, 82, 42, 42, 42, 42, 83, 42, 42, 42, 42, 42, 42, - 42, 84, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 84, 70, 85, - 86, 42, 42, 42, 84, 85, 86, 85, 69, 42, 42, 42, 36, 36, 36, 36, - 36, 42, 2, 7, 7, 7, 7, 7, 87, 36, 36, 36, 36, 36, 36, 36, - 69, 85, 61, 36, 36, 36, 60, 61, 60, 61, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 60, 36, 36, 36, 60, 60, 43, 36, 36, 43, 70, 85, - 86, 42, 79, 88, 89, 88, 86, 60, 43, 43, 43, 88, 43, 43, 36, 61, - 36, 42, 43, 7, 7, 7, 7, 7, 36, 20, 27, 27, 27, 55, 62, 79, - 56, 84, 61, 36, 36, 60, 43, 61, 60, 36, 61, 60, 36, 43, 79, 85, - 86, 79, 43, 56, 79, 56, 42, 43, 56, 43, 43, 43, 61, 36, 60, 60, - 43, 43, 43, 7, 7, 7, 7, 7, 42, 36, 69, 63, 43, 43, 43, 43, - 56, 84, 61, 36, 36, 36, 36, 61, 36, 61, 36, 36, 36, 36, 36, 36, - 60, 36, 61, 36, 36, 43, 70, 85, 86, 42, 42, 56, 84, 88, 86, 43, - 60, 43, 43, 43, 43, 43, 43, 43, 65, 43, 43, 43, 61, 42, 42, 42, - 56, 85, 61, 36, 36, 36, 60, 61, 60, 36, 61, 36, 36, 43, 70, 86, - 86, 42, 79, 88, 89, 88, 86, 43, 43, 43, 56, 84, 43, 43, 36, 61, - 77, 27, 27, 27, 43, 43, 43, 43, 43, 70, 61, 36, 36, 60, 43, 36, - 60, 36, 36, 43, 61, 60, 60, 36, 43, 61, 60, 43, 36, 60, 43, 36, - 36, 36, 36, 36, 36, 43, 43, 85, 84, 89, 43, 85, 89, 85, 86, 43, - 60, 43, 43, 88, 43, 43, 43, 43, 27, 90, 66, 66, 55, 91, 43, 43, - 84, 85, 70, 36, 36, 36, 60, 36, 60, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 43, 70, 42, 84, 85, 89, 42, 79, 42, 42, 43, - 43, 43, 56, 79, 36, 60, 36, 43, 43, 43, 43, 92, 27, 27, 27, 90, - 69, 85, 71, 36, 36, 36, 60, 36, 36, 36, 61, 36, 36, 43, 70, 86, - 85, 85, 89, 84, 89, 85, 42, 43, 43, 43, 88, 89, 43, 43, 36, 60, - 61, 93, 43, 43, 43, 43, 43, 43, 42, 85, 36, 36, 36, 36, 60, 36, - 36, 36, 36, 36, 36, 69, 70, 85, 86, 42, 79, 85, 89, 85, 86, 76, - 43, 43, 36, 93, 27, 27, 27, 94, 27, 27, 27, 27, 90, 36, 36, 36, - 56, 85, 61, 36, 36, 36, 36, 36, 36, 36, 36, 60, 43, 36, 36, 36, - 36, 61, 36, 36, 36, 36, 61, 43, 36, 36, 36, 60, 43, 79, 43, 88, - 85, 42, 79, 79, 85, 85, 85, 85, 43, 85, 63, 43, 43, 43, 43, 43, - 61, 36, 36, 36, 36, 36, 36, 36, 69, 36, 42, 42, 42, 79, 43, 95, - 36, 36, 36, 74, 42, 42, 42, 59, 7, 7, 7, 7, 7, 2, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 61, 60, 60, 36, 36, 60, 36, 36, - 36, 36, 61, 61, 36, 36, 36, 36, 69, 36, 42, 42, 42, 42, 70, 43, - 36, 36, 60, 80, 42, 42, 42, 79, 7, 7, 7, 7, 7, 43, 36, 36, - 76, 66, 2, 2, 2, 2, 2, 2, 2, 96, 96, 66, 42, 66, 66, 66, - 7, 7, 7, 7, 7, 27, 27, 27, 27, 27, 49, 49, 49, 4, 4, 85, - 36, 36, 36, 36, 61, 36, 36, 36, 36, 36, 36, 36, 36, 36, 60, 43, - 56, 42, 42, 42, 42, 42, 42, 84, 42, 42, 59, 42, 36, 36, 69, 42, - 42, 42, 42, 42, 56, 42, 42, 42, 42, 42, 42, 42, 42, 42, 79, 66, - 66, 66, 66, 75, 66, 66, 91, 66, 2, 2, 96, 66, 21, 63, 43, 43, - 36, 36, 36, 36, 36, 93, 86, 42, 84, 42, 42, 42, 86, 84, 86, 70, - 7, 7, 7, 7, 7, 2, 2, 2, 36, 36, 36, 85, 42, 36, 36, 42, - 70, 85, 97, 93, 85, 85, 85, 36, 69, 42, 70, 36, 36, 36, 36, 36, - 36, 84, 86, 84, 85, 85, 86, 93, 7, 7, 7, 7, 7, 85, 86, 66, - 11, 11, 11, 47, 43, 43, 47, 43, 16, 16, 16, 16, 16, 52, 44, 16, - 36, 36, 36, 36, 60, 36, 36, 43, 36, 36, 36, 60, 60, 36, 36, 43, - 60, 36, 36, 43, 36, 36, 36, 60, 60, 36, 36, 43, 36, 36, 36, 36, - 36, 36, 36, 60, 36, 36, 36, 36, 36, 36, 36, 36, 36, 60, 56, 42, - 2, 2, 2, 2, 98, 27, 27, 27, 27, 27, 27, 27, 27, 27, 99, 43, - 66, 66, 66, 66, 66, 43, 43, 43, 11, 11, 11, 43, 16, 16, 16, 43, - 100, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 76, 71, - 101, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,102,103, 43, - 36, 36, 36, 36, 36, 62, 2,104,105, 36, 36, 36, 60, 43, 43, 43, - 36, 42, 84, 43, 43, 43, 43, 61, 36, 42,106, 63, 43, 43, 43, 43, - 36, 42, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 36, 36, 60, 36, - 60, 42, 43, 43, 43, 43, 43, 43, 36, 36, 42, 86, 42, 42, 42, 85, - 85, 85, 85, 84, 86, 42, 42, 42, 42, 42, 2, 87, 2, 65, 69, 43, - 7, 7, 7, 7, 7, 43, 43, 43, 27, 27, 27, 27, 27, 43, 43, 43, - 2, 2, 2,107, 2, 58, 42, 83, 36, 82, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 60, 43, 43, 43, 36, 36, 69, 70, 36, 36, 36, 36, - 36, 36, 36, 36, 69, 60, 43, 43, 36, 36, 36, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 60, 42, 84, 85, 86, 84, 85, 43, 43, - 85, 84, 85, 85, 86, 42, 43, 43, 91, 43, 2, 7, 7, 7, 7, 7, - 36, 36, 36, 36, 36, 36, 36, 43, 36, 36, 60, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 43, 43, 36, 36, 36, 36, 36, 43, 43, 43, - 7, 7, 7, 7, 7, 99, 43, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 36, 36, 36, 69, 84, 86, 43, 2, 36, 36, 93, 84, 42, 42, 42, 79, - 84, 84, 86, 42, 42, 42, 84, 85, 85, 86, 42, 42, 42, 42, 79, 56, - 2, 2, 2, 87, 2, 2, 2, 43, 42, 42, 42, 42, 42, 42, 42,108, - 42, 42, 42, 42, 42, 42, 42, 43, 42, 42, 42, 42, 42, 42, 43, 43, - 42, 42, 97, 36, 36, 36, 36, 36, 36, 36, 84, 42, 42, 84, 84, 85, - 85, 84, 97, 36, 36, 36, 60, 2, 96, 66, 66, 66, 66, 49, 42, 42, - 42, 42, 66, 66, 66, 66, 21, 2, 42, 97, 36, 36, 36, 36, 36, 36, - 93, 42, 42, 85, 42, 86, 42, 36, 36, 36, 36, 84, 42, 85, 86, 86, - 42, 85, 43, 43, 43, 43, 2, 2, 36, 36, 85, 85, 85, 85, 42, 42, - 42, 42, 85, 42, 43, 92, 2, 2, 7, 7, 7, 7, 7, 43, 61, 36, - 36, 36, 36, 36, 39, 39, 39, 2, 16, 16, 16, 16, 34,109, 43, 43, - 11, 11, 11, 11, 11, 46, 47, 11, 2, 2, 2, 2, 43, 43, 43, 43, - 42, 59, 42, 42, 42, 42, 42, 42, 84, 42, 42, 42, 70, 36, 69, 36, - 36, 36, 70, 93, 42, 60, 43, 43, 16, 16, 16, 16, 16, 16, 39, 39, - 39, 39, 39, 39, 39, 44, 16, 16, 16, 16, 16, 16, 44, 16, 16, 16, - 16, 16, 16, 16, 16,110, 39, 39, 32, 32, 32, 16, 16, 16, 16, 32, - 16, 16, 16, 16, 11, 11, 11, 11, 16, 16, 16, 43, 11, 11, 11, 43, - 16, 16, 16, 16, 47, 47, 47, 47, 16, 16, 16, 16, 16, 16, 16, 43, - 16, 16, 16, 16,111,111,111,111, 16, 16,109, 16, 11, 11,112,113, - 40, 16,109, 16, 11, 11,112, 40, 16, 16, 43, 16, 11, 11,114, 40, - 16, 16, 16, 16, 11, 11,115, 40, 43, 16,109, 16, 11, 11,112,116, - 117,117,117,117,117,118, 64, 64,119,119,119, 2,120,121,120,121, - 2, 2, 2, 2,122, 64, 64,123, 2, 2, 2, 2,124,125, 2,126, - 127, 2,128,129, 2, 2, 2, 2, 2, 9,127, 2, 2, 2, 2,130, - 64, 64,131, 64, 64, 64, 64, 64,132, 43, 27, 27, 27, 8,128,133, - 27, 27, 27, 27, 27, 8,128,103, 39, 39, 39, 39, 39, 39, 80, 43, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 43, 43, 43, 43, 43, 43, 43, - 42, 42, 42, 42, 42, 42,134, 50,108, 50,108, 42, 42, 42, 42, 42, - 79, 43, 43, 43, 43, 43, 43, 43, 66,135, 66,136, 66, 34, 11, 16, - 11, 32,136, 66, 48, 11, 11, 66, 66, 66,135,135,135, 11, 11,137, - 11, 11, 35, 36,138, 66, 16, 11, 8, 8, 48, 16, 16, 26, 66,139, - 27, 27, 27, 27, 27, 27, 27, 27,104,104,104,104,104,104,104,104, - 104,140,141,104,142, 66, 43, 43, 8, 8,143, 66, 66, 8, 66, 66, - 143, 26, 66,143, 66, 66, 66,143, 66, 66, 66, 66, 66, 66, 66, 8, - 66,143,143, 66, 66, 66, 66, 66, 66, 66, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 66, 66, 66, 66, 4, 4, 66, 66, - 8, 66, 66, 66,144,145, 66, 66, 66, 66, 66, 66, 66, 66,143, 66, - 66, 66, 66, 66, 66, 26, 8, 8, 8, 8, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 8, 8, 8, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 91, 43, 43, 27, 27, 27, 27, 27, 27, 66, 66, - 66, 66, 66, 66, 66, 27, 27, 27, 66, 66, 66, 26, 66, 66, 66, 66, - 26, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 8, 8, 8, 8, - 66, 66, 66, 66, 66, 66, 66, 26, 66, 66, 66, 66, 4, 4, 4, 4, - 4, 4, 4, 27, 27, 27, 27, 27, 27, 27, 66, 66, 66, 66, 66, 66, - 8, 8,128,146, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, - 8,128,147,147,147,147,147,147,147,147,147,147,146, 8, 8, 8, - 8, 8, 8, 8, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 4, 8, - 8, 8,143, 26, 8, 8,143, 66, 66, 66, 43, 66, 66, 66, 66, 66, - 32, 11, 32, 34, 34, 34, 34, 11, 32, 32, 34, 16, 16, 16, 39, 11, - 32, 32,139, 66, 66,136, 34,148, 42, 32, 43, 43, 92, 2, 98, 2, - 16, 16, 16,149, 43, 43,149, 43, 36, 36, 36, 36, 43, 43, 43, 51, - 63, 43, 43, 43, 43, 43, 43, 56, 36, 36, 36, 60, 43, 43, 43, 43, - 36, 36, 36, 60, 36, 36, 36, 60, 2,120,120, 2,124,125,120, 2, - 2, 2, 2, 6, 2,107,120, 2,120, 4, 4, 4, 4, 2, 2, 87, - 2, 2, 2, 2, 2,119, 2, 2,107,150, 2, 2, 2, 2, 2, 2, - 66, 2,151,147,147,147,152, 43, 66, 66, 66, 66, 66, 54, 66, 66, - 66, 66, 43, 43, 43, 43, 43, 43, 66, 66, 66, 43, 43, 43, 43, 43, - 1, 2,153,154, 4, 4, 4, 4, 4, 66, 4, 4, 4, 4,155,156, - 157,104,104,104,104, 42, 42, 85,158, 39, 39, 66,104,159, 62, 66, - 36, 36, 36, 60, 56,160,161, 68, 36, 36, 36, 36, 36, 62, 39, 68, - 43, 43, 61, 36, 36, 36, 36, 36, 66, 27, 27, 66, 66, 66, 66, 66, - 66, 66, 66, 43, 43, 43, 43, 54, 66, 66, 66, 66, 66, 66, 66, 91, - 27, 27, 27, 27, 27, 66, 66, 66, 66, 66, 66, 66, 27, 27, 27, 27, - 162, 27, 27, 27, 27, 27, 27, 27, 36, 36, 82, 36, 36, 36, 36, 36, - 66, 66, 66, 91, 43, 43, 43, 43, 36, 36, 36, 36, 36, 36,163, 2, - 7, 7, 7, 7, 7, 36, 43, 43, 32, 32, 32, 32, 32, 32, 32, 69, - 50,164, 42, 42, 42, 42, 42, 87, 32, 32, 32, 32, 32, 32, 39, 42, - 36, 36, 36,104,104,104,104,104, 42, 2, 2, 2, 43, 43, 43, 43, - 40, 40, 40,161, 39, 39, 39, 39, 40, 32, 32, 32, 32, 32, 32, 32, - 16, 32, 32, 32, 32, 32, 32, 32, 44, 16, 16, 16, 34, 34, 34, 32, - 32, 32, 32, 32, 41,165, 34, 35, 32, 32, 16, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 11, 11, 32, 11, 11, 32, 32, 32, 32, 32, 32, - 32, 32, 11, 11, 34, 34, 32, 32, 32, 32, 32, 32, 32, 32, 46, 43, - 51, 39,166, 35, 39, 35, 36, 36, 36, 70, 36, 70, 36, 69, 36, 36, - 36, 93, 86, 84, 66, 66, 79, 43, 27, 27, 27, 66,167, 43, 43, 43, - 36, 36, 2, 2, 43, 43, 43, 43, 85, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 85, 85, 85, 85, 85, 85, 85, 85, 42, 43, 43, 43, 43, 2, - 42, 36, 36, 36, 2, 71, 71, 69, 36, 36, 36, 42, 42, 42, 42, 2, - 36, 36, 36, 69, 42, 42, 42, 42, 42, 85, 43, 43, 43, 43, 43, 92, - 36, 69, 85, 42, 42, 85, 42, 85,106, 2, 2, 2, 2, 2, 2, 51, - 7, 7, 7, 7, 7, 43, 43, 2, 36, 36, 69, 68, 36, 36, 36, 36, - 7, 7, 7, 7, 7, 36, 36, 60, 36, 36, 36, 36, 69, 42, 42, 84, - 86, 84, 86, 79, 43, 43, 43, 43, 36, 69, 36, 36, 36, 36, 84, 43, - 7, 7, 7, 7, 7, 43, 2, 2, 68, 36, 36, 76, 66, 93, 84, 36, - 70, 42, 70, 69, 70, 36, 36, 42, 69, 60, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 61, 82, 2, 36, 36, 36, 36, 36, 93, 42, 85, - 2, 82,168, 79, 43, 43, 43, 43, 61, 36, 36, 60, 61, 36, 36, 60, - 61, 36, 36, 60, 43, 43, 43, 43, 16, 16, 16, 16, 16,113, 39, 39, - 16, 16, 16, 16,110, 40, 43, 43, 36, 93, 86, 85, 84,106, 86, 43, - 36, 36, 43, 43, 43, 43, 43, 43, 36, 36, 36, 60, 43, 61, 36, 36, - 169,169,169,169,169,169,169,169,170,170,170,170,170,170,170,170, - 16, 16, 16,109, 43, 43, 43, 43, 43,149, 16, 16, 43, 43, 61, 70, - 36, 36, 36, 36,171, 36, 36, 36, 36, 36, 36, 60, 36, 36, 60, 60, - 36, 61, 60, 36, 36, 36, 36, 36, 36, 40, 40, 40, 40, 40, 40, 40, - 40, 22, 66, 66, 66, 66, 66, 66, 66, 77, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36,147, 66, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 66, 66, 66, 66, 36, 36, 36, 36, 36, 36,167, 66, - 2, 2, 2,151,129, 43, 43, 43, 6,172,173,147,147,147,147,147, - 147,147,129,151,129, 2,126,174, 2, 63, 2, 2,155,147,147,129, - 2,175, 8,176, 65, 2, 43, 43, 36, 36, 60, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 60, 78, 92, 2, 3, 2, 4, 5, 6, 2, - 16, 16, 16, 16, 16, 17, 18,128,129, 4, 2, 36, 36, 36, 36, 36, - 68, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 39, - 43, 36, 36, 36, 43, 36, 36, 36, 43, 36, 36, 36, 43, 36, 60, 43, - 20,177, 55,178, 26, 8,143, 91, 43, 43, 43, 43, 78, 64, 66, 43, - 36, 36, 36, 36, 36, 36, 61, 36, 36, 36, 36, 36, 36, 60, 36, 61, - 2, 63, 43,179, 27, 27, 27, 27, 27, 27, 43, 54, 66, 66, 66, 66, - 104,104,142, 27, 90, 66, 66, 66, 66, 66, 66, 66, 66, 27, 66, 91, - 66, 66, 66, 66, 66, 66, 91, 43, 91, 43, 43, 43, 43, 43, 43, 43, - 66, 66, 66, 66, 66, 66, 49, 43,180, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 43, 43, 27, 27, 43, 43, 43, 43, 61, 36, - 154, 36, 36, 36, 36,181, 43, 43, 36, 36, 36, 42, 42, 79, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 92, 36, 36, 43, 43, 36, 36, 36, 36, - 182,104,104, 43, 43, 43, 43, 43, 11, 11, 11, 11, 16, 16, 16, 16, - 11, 11, 43, 43, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 43, 43, - 36, 36, 36, 36, 43, 43, 43, 43, 36, 36, 43, 43, 43, 43, 43, 92, - 11, 11, 11, 11, 11, 46, 11, 11, 11, 46, 11,149, 16, 16, 16, 16, - 16,149, 16, 16, 16, 16, 16, 16, 16,149, 16, 16, 16,149,109, 43, - 39, 39, 39, 51, 39, 39, 39, 39, 80, 39, 39, 39, 39, 80, 43, 43, - 36, 36, 36, 43, 60, 36, 36, 36, 36, 36, 36, 61, 60, 43, 60, 61, - 36, 36, 36, 92, 27, 27, 27, 27, 36, 36, 36, 76,162, 27, 27, 27, - 43, 43, 43,179, 27, 27, 27, 27, 36, 60, 36, 43, 43,179, 27, 27, - 36, 36, 36, 27, 27, 27, 43, 92, 36, 36, 36, 36, 36, 43, 43, 92, - 36, 36, 36, 36, 43, 43, 27, 36, 43, 27, 27, 27, 27, 27, 27, 27, - 69, 42, 56, 79, 43, 43, 42, 42, 36, 36, 61, 36, 61, 36, 36, 36, - 36, 36, 36, 43, 42, 79, 43, 56, 27, 27, 27, 27, 99, 43, 43, 43, - 2, 2, 2, 2, 63, 43, 43, 43, 36, 36, 36, 36, 36, 36,183, 30, - 36, 36, 36, 36, 36, 36,183, 27, 36, 36, 36, 36, 77, 36, 36, 36, - 36, 36, 69, 79, 43,179, 27, 27, 2, 2, 2, 63, 43, 43, 43, 43, - 36, 36, 36, 43, 92, 2, 2, 2, 36, 36, 36, 43, 27, 27, 27, 27, - 36, 60, 43, 43, 27, 27, 27, 27, 36, 43, 43, 43, 92, 2, 63, 43, - 43, 43, 43, 43,179, 27, 27, 27, 11, 46, 43, 43, 43, 43, 43, 43, - 16,109, 43, 43, 43, 27, 27, 27, 36, 36, 42, 42, 43, 43, 43, 43, - 7, 7, 7, 7, 7, 36, 36, 68, 11, 11, 11, 43, 56, 42, 42,158, - 16, 16, 16, 43, 43, 43, 43, 8, 27, 27, 27, 27, 27, 27, 27, 99, - 36, 36, 36, 36, 36, 56,184, 43, 36, 43, 43, 43, 43, 43, 43, 43, - 43, 36, 82, 36, 43, 43, 43, 43, 96, 66, 66, 66, 91, 43, 43, 43, - 43, 43, 43, 43, 43, 42, 42, 42, 27, 27, 27, 94, 43, 43, 43, 43, - 180, 27, 30, 2, 2, 43, 43, 43, 36, 42, 42, 2, 2, 43, 43, 43, - 36, 36,183, 27, 27, 27, 43, 43, 86, 97, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 42, 42, 42, 42, 42, 42, 42, 59, 2, 2, 2, 43, - 27, 27, 27, 7, 7, 7, 7, 7, 70, 69, 70, 43, 43, 43, 43, 56, - 85, 86, 42, 84, 86, 59,185, 2, 2, 79, 43, 43, 43, 43, 78, 43, - 42, 70, 36, 36, 36, 36, 36, 36, 36, 36, 36, 69, 42, 42, 86, 42, - 42, 42, 79, 7, 7, 7, 7, 7, 2, 2, 93, 97, 43, 43, 43, 43, - 36, 69, 2, 60, 43, 43, 43, 43, 36, 93, 85, 42, 42, 42, 42, 84, - 97, 36, 62, 2, 58, 42, 59, 86, 7, 7, 7, 7, 7, 62, 62, 2, - 179, 27, 27, 27, 27, 27, 27, 27, 27, 27, 99, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 85, 86, 42, 85, 84, 42, 2, 2, 2, 70, - 69, 43, 43, 43, 43, 43, 43, 43, 36, 36, 36, 60, 60, 36, 36, 61, - 36, 36, 36, 36, 36, 36, 36, 61, 36, 36, 36, 36, 62, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 69, 85, 86, 42, 42, 42, 79, 43, 43, - 42, 85, 61, 36, 36, 36, 60, 61, 60, 36, 61, 36, 36, 56, 70, 85, - 84, 85, 89, 88, 89, 88, 85, 43, 60, 43, 43, 88, 43, 43, 61, 36, - 36, 85, 43, 42, 42, 42, 79, 43, 42, 42, 79, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 61, 43, 60, 36, 36, 36, 61, 85, 86, 42, 42, - 79, 89, 88, 88, 85, 89, 85, 84, 70, 70, 2, 92, 63, 43, 43, 43, - 56, 79, 43, 43, 43, 43, 43, 43, 36, 36, 93, 85, 42, 42, 42, 42, - 85, 42, 84, 70, 36, 62, 2, 2, 7, 7, 7, 7, 7, 2, 92, 70, - 85, 86, 42, 42, 84, 84, 85, 86, 84, 42, 36, 71, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 93, 85, 42, 42, 43, 85, 85, 42, 86, - 59, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, 36, 42, 43, - 85, 86, 42, 42, 42, 84, 86, 86, 59, 2, 60, 43, 43, 43, 43, 43, - 2, 2, 2, 2, 2, 2, 63, 43, 36, 36, 36, 36, 36, 69, 86, 85, - 42, 42, 42, 86, 62, 43, 43, 43, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 36, 60, 56, 86, - 85, 42, 42, 86, 42, 42, 43, 43, 7, 7, 7, 7, 7, 27, 2, 96, - 42, 42, 42, 42, 86, 59, 43, 43, 27, 99, 43, 43, 43, 43, 43, 61, - 36, 36, 36, 60, 61, 43, 36, 36, 36, 36, 61, 60, 36, 36, 36, 36, - 85, 85, 85, 88, 89, 56, 84, 70, 97, 86, 2, 63, 43, 43, 43, 43, - 36, 36, 36, 36, 43, 36, 36, 36, 93, 85, 42, 42, 43, 42, 85, 85, - 70, 71, 89, 43, 43, 43, 43, 43, 69, 42, 42, 42, 42, 70, 36, 36, - 36, 69, 42, 42, 84, 69, 42, 59, 2, 2, 2, 58, 43, 43, 43, 43, - 69, 42, 42, 84, 86, 42, 36, 36, 36, 36, 36, 36, 36, 42, 42, 42, - 42, 42, 42, 84, 42, 2, 71, 2, 2, 63, 43, 43, 43, 43, 43, 43, - 2, 2, 2, 2, 2, 43, 43, 43, 84, 42, 84, 84, 43, 43, 43, 43, - 62, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 79, 42, 42, 42, 86, - 62, 2, 2, 43, 43, 43, 43, 43, 2, 36, 36, 36, 36, 36, 36, 36, - 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 88, 42, 42, 42, - 84, 42, 86, 79, 43, 43, 43, 43, 36, 36, 36, 60, 36, 61, 36, 36, - 69, 42, 42, 79, 43, 79, 42, 56, 42, 42, 42, 69, 43, 43, 43, 43, - 36, 36, 36, 61, 60, 36, 36, 36, 36, 36, 36, 36, 36, 85, 85, 89, - 42, 88, 86, 86, 60, 43, 43, 43, 36, 36, 36, 36, 82, 36, 43, 43, - 36, 69, 84,106, 63, 43, 43, 43, 42, 93, 36, 36, 36, 36, 36, 36, - 36, 36, 85, 42, 42, 79, 43, 85, 84, 59, 2, 2, 2, 2, 2, 2, - 7, 7, 7, 7, 7, 79, 43, 43, 27, 27, 90, 66, 66, 66, 55, 20, - 167, 66, 66, 66, 66, 66, 66, 66, 66, 43, 43, 43, 43, 43, 43, 92, - 104,104,104,104,104,104,104,181, 2, 2, 63, 43, 43, 43, 43, 43, - 62, 63, 43, 43, 43, 43, 43, 43, 64, 64, 64, 64, 64, 64, 64, 64, - 70, 36, 36, 69, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 36, 36, 42, 42, 42, 42, 42, 42, 85, 86, 42, - 42, 42, 59, 43, 43, 43, 43, 43, 42, 42, 42, 59, 2, 2, 66, 66, - 39, 39, 96, 43, 43, 43, 43, 43, 7, 7, 7, 7, 7,179, 27, 27, - 27, 61, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 43, 43, 61, 36, - 39, 68, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 82,163, 2, - 27, 27, 27, 30, 2, 63, 43, 43, 11, 11, 11, 11, 46,149, 16, 16, - 16, 16, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 36, 60, 43, 56, - 93, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 43, 43, 43, 56, 42, 73, 39, 39, 39, 39, 39, 39, - 39, 87, 79, 43, 43, 43, 43, 43, 85, 39,104,181, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 61, 36, 60, 43, 43, 43, 43, 43, 43, - 39, 39, 51, 39, 39, 39, 51, 80, 43, 60, 43, 43, 43, 43, 43, 43, - 36, 60, 61, 43, 43, 43, 43, 43, 43, 43, 36, 36, 43, 43, 43, 43, - 36, 36, 36, 36, 36, 43, 49, 59, 64, 64, 43, 43, 43, 43, 43, 43, - 7, 7, 7, 7, 7, 66, 91, 43, 66, 66, 43, 43, 43, 66, 66, 66, - 176, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 79, 43, 43, 43, 43, - 66, 66, 66, 91, 54, 66, 66, 66, 66, 66,186, 86, 42, 66,186, 85, - 85,187, 64, 64, 64, 83, 42, 42, 42, 75, 49, 42, 42, 42, 66, 66, - 66, 66, 66, 66, 66, 42, 42, 66, 66, 42, 75, 43, 43, 43, 43, 43, - 27, 27, 43, 43, 43, 43, 43, 43, 11, 11, 11, 11, 11, 16, 16, 16, - 16, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16, - 16, 16,109, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 46, 11, 43, 46, 47, 46, 47, 11, 46, 11, - 11, 11, 11, 16, 16,149,149, 16, 16, 16,149, 16, 16, 16, 16, 16, - 16, 16, 11, 47, 11, 46, 47, 11, 11, 11, 46, 11, 11, 11, 46, 16, - 16, 16, 16, 16, 11, 47, 11, 46, 11, 11, 46, 46, 43, 11, 11, 11, - 46, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11, 11, - 11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 43, 11, 11, 11, 11, - 31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33, 16, 16, - 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31, 16, 16, - 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, - 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 32, 43, 7, - 42, 42, 42, 75, 66, 49, 42, 42, 42, 42, 42, 42, 42, 42, 75, 66, - 66, 66, 49, 66, 66, 66, 66, 66, 66, 66, 75, 21, 2, 2, 43, 43, - 43, 43, 43, 43, 43, 56, 42, 42, 16, 16, 16, 16, 16,138, 16, 16, - 16, 16, 16, 16, 16, 16, 16,109, 43, 43,149, 16, 16,109, 43, 43, - 42, 42, 42, 79, 42, 42, 42, 42, 42, 42, 42, 42, 79, 56, 42, 42, - 42, 56, 79, 42, 42, 79, 43, 43, 39, 39, 39, 39, 39, 39, 39, 43, - 43, 43, 43, 43, 43, 43, 43, 56, 42, 42, 42, 73, 39, 39, 39, 43, - 7, 7, 7, 7, 7, 43, 43, 76, 36, 36, 36, 36, 36, 36, 36, 79, - 36, 36, 36, 36, 36, 36, 42, 42, 7, 7, 7, 7, 7, 43, 43, 95, - 36, 36, 36, 36, 36, 82, 42, 42,188, 7, 7, 7, 7,189, 43, 92, - 36, 69, 36, 70, 36, 36, 36, 42, 36, 36, 69, 43, 43, 43, 43, 82, - 36, 36, 36, 60, 36, 36, 61, 60, 36, 36, 60,179, 27, 27, 27, 27, - 16, 16, 42, 42, 42, 73, 43, 43, 27, 27, 27, 27, 27, 27,162, 27, - 190, 27, 99, 43, 43, 43, 43, 43, 27, 27, 27, 27, 27, 27, 27,162, - 27, 27, 27, 27, 27, 27, 27, 43, 36, 36, 61, 36, 36, 36, 36, 36, - 61, 60, 60, 61, 61, 36, 36, 36, 36, 60, 36, 36, 61, 61, 43, 43, - 43, 60, 43, 61, 61, 61, 61, 36, 61, 60, 60, 61, 61, 61, 61, 61, - 61, 60, 60, 61, 36, 60, 36, 36, 36, 60, 36, 36, 61, 36, 60, 60, - 36, 36, 36, 36, 36, 61, 36, 36, 61, 36, 61, 36, 36, 61, 36, 36, - 8, 43, 43, 43, 43, 43, 43, 43, 66, 66, 66, 66, 66, 66, 43, 43, - 54, 66, 66, 66, 66, 66, 66, 66, 27, 27, 27, 27, 27, 27, 90, 66, - 66, 66, 66, 66, 66, 66, 66, 43, 43, 43, 43, 66, 66, 66, 66, 66, - 66, 91, 43, 43, 43, 43, 43, 43, 66, 66, 66, 66, 91, 43, 43, 43, - 66, 43, 43, 43, 43, 43, 43, 43, 66, 66, 66, 66, 66, 25, 40, 40, - 66, 66, 66, 66, 91, 43, 66, 66, 66, 66, 66, 66, 43, 43, 43, 43, - 8, 8, 8, 8,176, 43, 43, 43, 66, 66, 66, 66, 66, 91, 43, 66, - 66, 66, 66, 91, 91, 43, 54, 66, 66, 66, 66, 66, 66, 66, 91, 54, - 66, 66, 66, 66, 66, 91, 43, 54, 66, 91, 66, 66, 66, 66, 66, 66, - 7, 7, 7, 7, 7, 91, 43, 43, 78, 43, 43, 43, 43, 43, 43, 43, - 170,170,170,170,170,170,170, 43,170,170,170,170,170,170,170, 0, - 0, 0, 29, 21, 21, 21, 23, 21, 22, 18, 21, 25, 21, 17, 13, 13, - 25, 25, 25, 21, 21, 9, 9, 9, 9, 22, 21, 18, 24, 16, 24, 5, - 5, 5, 5, 22, 25, 18, 25, 0, 23, 23, 26, 21, 24, 26, 7, 20, - 25, 1, 26, 24, 26, 25, 15, 15, 24, 15, 7, 19, 15, 21, 9, 25, - 9, 5, 5, 25, 5, 9, 5, 7, 7, 7, 9, 8, 8, 5, 6, 6, - 24, 24, 6, 24, 12, 12, 2, 2, 6, 5, 9, 21, 9, 2, 2, 9, - 25, 9, 26, 12, 11, 11, 2, 6, 5, 21, 17, 2, 2, 26, 26, 23, - 2, 12, 17, 12, 21, 12, 12, 21, 7, 2, 2, 7, 7, 21, 21, 2, - 1, 1, 21, 23, 26, 26, 1, 21, 6, 7, 7, 12, 12, 7, 21, 7, - 12, 1, 12, 6, 6, 12, 12, 26, 7, 26, 26, 7, 2, 1, 12, 2, - 6, 2, 24, 7, 7, 6, 1, 12, 12, 10, 10, 10, 10, 12, 21, 6, - 2, 10, 10, 2, 15, 26, 26, 2, 2, 21, 7, 10, 15, 7, 2, 23, - 21, 26, 10, 7, 21, 15, 15, 2, 17, 7, 29, 7, 7, 22, 18, 2, - 14, 14, 14, 7, 10, 21, 17, 21, 11, 12, 5, 2, 5, 6, 8, 8, - 8, 24, 5, 24, 2, 24, 9, 24, 24, 2, 29, 29, 29, 1, 17, 17, - 20, 19, 22, 20, 27, 28, 1, 29, 21, 20, 19, 21, 21, 16, 16, 21, - 25, 22, 18, 21, 21, 29, 1, 2, 15, 6, 18, 6, 12, 11, 9, 26, - 26, 9, 26, 5, 7, 5, 5, 26, 14, 9, 5, 14, 14, 15, 25, 26, - 26, 22, 18, 26, 18, 25, 18, 22, 5, 12, 2, 5, 22, 21, 21, 22, - 18, 17, 26, 6, 7, 14, 17, 22, 18, 18, 26, 14, 17, 6, 14, 6, - 12, 24, 24, 6, 26, 15, 6, 21, 11, 21, 24, 9, 6, 9, 23, 26, - 6, 10, 4, 4, 3, 3, 7, 25, 17, 16, 16, 22, 16, 16, 25, 17, - 25, 2, 25, 24, 23, 2, 2, 15, 12, 15, 14, 2, 21, 14, 7, 15, - 12, 17, 21, 1, 26, 10, 10, 1, 7, 13, 13, 2, 23, 15, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 0, 14, 0, - 0, 0, 0, 0, 15, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 21, 22, 23, - 0, 0, 0, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, - 0, 0, 0, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 39, 40, 0, 0, 0, 0, 0, 0, 41, 42, - 43, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 0, 0, 0, 0, 3, 0, 0, 0, 4, 5, 6, 7, 0, 8, - 9, 10, 0, 11, 12, 13, 14, 15, 16, 17, 16, 18, 16, 19, 16, 19, - 16, 19, 0, 19, 16, 20, 16, 19, 21, 19, 0, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, 35, 0, 0, 36, 0, - 37, 0, 0, 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, 0, 0, 47, - 0, 0, 0, 48, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 50, - 0, 51, 0, 52, 53, 0, 54, 0, 0, 0, 0, 0, 0, 55, 56, 57, - 0, 0, 0, 0, 58, 0, 0, 59, 60, 61, 62, 63, 0, 0, 64, 65, - 0, 0, 0, 66, 0, 0, 0, 0, 67, 0, 0, 0, 68, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 70, - 0, 71, 0, 0, 72, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 74, 75, 0, 0, 0, 0, 76, 77, 0, 78, 79, 0, 0, 80, 81, 0, - 82, 62, 0, 83, 84, 0, 0, 85, 86, 87, 0, 88, 0, 89, 0, 90, - 0, 0, 51, 91, 51, 0, 92, 0, 93, 0, 0, 0, 81, 0, 0, 0, - 94, 95, 0, 96, 97, 98, 99, 0, 0, 0, 0, 0, 51, 0, 0, 0, - 0,100,101, 0, 0, 0, 0, 0, 0,102, 0, 0, 0, 0, 0, 0, - 103, 0, 0, 0, 0, 0, 0,104,105, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,106, 0, 0,107, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,108,109, 0, 0,110, 0, 0, 0, 0, 0, 0,111, 0,112, 0, - 105, 0, 0, 0, 0, 0,113,114, 0, 0, 0, 0, 0, 0, 0,115, - 0, 0, 0,116, 0, 0, 0,117, 0, 0, 0, 0, 0, 0, 0,118, - 0,119, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 0, - 8, 0, 0, 0, 0, 9, 10, 11, 12, 0, 0, 0, 0, 13, 0, 0, - 14, 15, 0, 16, 0, 17, 18, 0, 0, 19, 0, 20, 21, 0, 0, 0, - 0, 0, 22, 23, 0, 24, 25, 0, 0, 26, 0, 0, 0, 27, 0, 0, - 28, 29, 30, 31, 0, 0, 0, 32, 33, 34, 0, 0, 33, 0, 0, 35, - 33, 0, 0, 0, 33, 36, 0, 0, 0, 0, 0, 37, 38, 0, 0, 0, - 0, 0, 0, 39, 40, 0, 0, 0, 0, 0, 0, 41, 42, 0, 0, 0, - 0, 43, 0, 44, 0, 0, 0, 45, 46, 0, 0, 0, 47, 0, 0, 0, - 0, 0, 0, 48, 49, 0, 0, 0, 0, 50, 0, 0, 0, 51, 0, 52, - 0, 53, 0, 0, 0, 0, 54, 0, 0, 0, 0, 55, 0, 56, 0, 0, - 0, 0, 57, 58, 0, 0, 0, 59, 60, 61, 62, 0, 0, 0, 0, 63, - 52, 0, 64, 65, 0, 0, 66, 0, 0, 0, 67, 68, 0, 0, 0, 69, - 0, 70, 71, 72, 73, 74, 1, 75, 0, 76, 77, 78, 0, 0, 79, 80, - 0, 0, 0, 81, 0, 0, 1, 1, 0, 0, 82, 0, 0, 83, 0, 0, - 0, 0, 79, 84, 0, 85, 0, 0, 0, 0, 0, 80, 86, 0, 87, 0, - 52, 0, 1, 80, 0, 0, 88, 0, 0, 89, 0, 0, 0, 0, 0, 90, - 57, 0, 0, 0, 0, 0, 0, 91, 92, 0, 0, 86, 0, 0, 33, 0, - 0, 93, 0, 0, 0, 0, 94, 0, 0, 0, 0, 49, 0, 0, 95, 0, - 0, 0, 0, 96, 97, 0, 0, 98, 0, 0, 99, 0, 0, 0,100, 0, - 0, 0,101, 0, 0, 0,102, 0, 0, 0, 0,103,104, 95, 0, 0, - 105, 0, 0, 0, 86, 0, 0,106, 0, 0, 0,107,108, 0, 0,109, - 110, 0, 0, 0, 0, 0, 0,111, 0, 0,112, 0, 0, 0, 0,113, - 33, 0,114,115,116, 57, 0, 0,117, 35, 0, 0,118, 0, 0, 0, - 119, 0, 0, 0, 0, 0, 0,120, 0, 0,121, 0, 0, 0, 0,122, - 90, 0, 0, 0, 0, 0, 57, 0, 0, 0, 0, 52,123, 0, 0, 0, - 0,124, 0, 0,125, 0, 0, 0, 0,123, 0, 0,126, 0, 0, 0, - 0, 0, 81, 0, 0, 0, 0,127, 0, 0, 0,128, 0, 0, 0,129, - 0,130, 0, 0, 0, 0,131,132,133, 0,134, 0,135, 0, 0, 0, - 136,137,138, 0, 79, 0, 0, 0, 0, 0, 35, 0, 0, 0,139, 0, - 0, 0,140, 0, 0, 0,141, 0, 0, 0,142,143, 0,144, 0, 0, - 145, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, - 5, 6, 7, 4, 4, 8, 9, 10, 1, 11, 12, 13, 14, 15, 16, 17, - 18, 1, 1, 1, 19, 1, 0, 0, 20, 21, 22, 1, 23, 4, 21, 24, - 25, 26, 27, 28, 29, 30, 0, 0, 1, 1, 31, 0, 0, 0, 32, 33, - 34, 35, 1, 36, 37, 0, 0, 0, 0, 38, 1, 39, 14, 39, 40, 41, - 42, 0, 0, 0, 43, 36, 44, 45, 21, 45, 46, 0, 0, 0, 19, 1, - 21, 0, 0, 47, 0, 38, 48, 1, 1, 49, 49, 50, 0, 0, 51, 0, - 0, 19, 52, 1, 0, 0, 38, 14, 4, 1, 1, 1, 53, 21, 43, 52, - 54, 21, 35, 1, 0, 0, 0, 55, 0, 0, 0, 56, 57, 58, 0, 0, - 0, 0, 0, 59, 0, 60, 0, 0, 0, 0, 61, 62, 0, 0, 63, 0, - 0, 0, 64, 0, 0, 0, 65, 0, 0, 0, 66, 0, 0, 0, 67, 0, - 0, 0, 68, 0, 0, 69, 70, 0, 71, 72, 73, 74, 75, 76, 0, 0, - 0, 77, 0, 0, 0, 78, 79, 0, 0, 0, 0, 47, 0, 0, 0, 49, - 0, 80, 0, 0, 0, 62, 0, 0, 63, 0, 0, 81, 0, 0, 82, 0, - 0, 0, 83, 0, 0, 19, 84, 0, 62, 0, 0, 0, 0, 49, 1, 85, - 1, 52, 15, 86, 36, 10, 21, 1, 1, 1, 1, 41, 1, 21, 87, 0, - 0, 55, 0, 0, 0, 0, 19, 10, 1, 0, 0, 0, 0, 0, 88, 0, - 0, 89, 0, 0, 88, 0, 0, 0, 0, 78, 0, 0, 90, 9, 12, 4, - 91, 8, 92, 47, 0, 58, 50, 0, 21, 1, 21, 93, 94, 1, 1, 1, - 1, 95, 96, 97, 98, 1, 99, 58, 81,100,101, 4, 58, 0, 0, 0, - 0, 0, 0, 19, 50, 0, 0, 0, 0, 0, 0, 61, 0, 0,102,103, - 0, 0,104, 0, 0, 1, 1, 50, 0, 0, 0, 38, 0, 63, 0, 0, - 0, 0, 0, 62, 0, 0,105, 68, 61, 0, 0, 0, 78, 0, 0, 0, - 106,107, 58, 38, 81, 0, 0, 0, 0, 0, 0,108, 1, 14, 4, 12, - 84, 0, 0, 0, 0, 38, 90, 0, 0, 0, 0,109, 0, 0,110, 61, - 0,111, 0, 0, 0, 1, 0, 0, 0, 0, 49, 50, 0, 0, 19, 58, - 0, 0,112, 51, 0,112, 14, 52,113, 41, 0, 0, 62, 0, 0, 61, - 0, 0,114, 0, 90, 0, 0, 0, 61, 62, 0, 0, 62, 0, 89, 0, - 0,114, 0, 0, 0, 0,115, 0, 0, 0, 78, 55, 0, 38, 1, 58, - 1, 58, 0, 0, 0, 0, 0, 88, 63, 89, 0, 0,116, 0, 0, 0, - 55, 0, 0, 0, 0,116, 0, 0, 0, 0, 61, 0, 0, 0, 0, 79, - 0, 61, 0, 0, 0, 0, 56, 0, 89, 80, 0, 0, 79, 0, 0, 0, - 8, 92, 0, 0, 1, 90, 0, 0,117, 0, 0, 0, 0, 0, 0,118, - 0,119,120,121,122, 0,105, 4,123, 49, 23, 0, 0, 0, 38, 50, - 38, 58, 0, 0, 1, 90, 1, 1, 1, 1, 39, 1, 48,106, 90, 0, - 0, 0, 0, 1, 0, 0, 0,124, 0, 0, 0,113, 19, 59, 0, 38, - 0, 81, 0, 0, 4,123, 0, 0, 0, 1,125, 0, 0, 0, 0, 0, - 230,230,230,230,230,232,220,220,220,220,232,216,220,220,220,220, - 220,202,202,220,220,220,220,202,202,220,220,220, 1, 1, 1, 1, - 1,220,220,220,220,230,230,230,230,240,230,220,220,220,230,230, - 230,220,220, 0,230,230,230,220,220,220,220,230,232,220,220,230, - 233,234,234,233,234,234,233,230, 0, 0, 0,230, 0,220,230,230, - 230,230,220,230,230,230,222,220,230,230,220,220,230,222,228,230, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 0, 23, - 0, 24, 25, 0,230,220, 0, 18, 30, 31, 32, 0, 0, 0, 0, 27, - 28, 29, 30, 31, 32, 33, 34,230,230,220,220,230,220,230,230,220, - 35, 0, 0, 0, 0, 0,230,230,230, 0, 0,230,230, 0,220,230, - 230,220, 0, 0, 0, 36, 0, 0,230,220,230,230,220,220,230,220, - 220,230,220,230,220,230,230, 0, 0,220, 0, 0,230,230, 0,230, - 0,230,230,230,230,230, 0, 0, 0,220,220,220,230,220,220,220, - 230,230, 0,220, 27, 28, 29,230, 7, 0, 0, 0, 0, 9, 0, 0, - 0,230,220,230,230, 0, 0, 0, 0, 0,230, 0, 0, 84, 91, 0, - 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 9, 0,103,103, 9, 0, - 107,107,107,107,118,118, 9, 0,122,122,122,122,220,220, 0, 0, - 0,220, 0,220, 0,216, 0, 0, 0,129,130, 0,132, 0, 0, 0, - 0, 0,130,130,130,130, 0, 0,130, 0,230,230, 9, 0,230,230, - 0, 0,220, 0, 0, 0, 0, 7, 0, 9, 9, 0, 9, 9, 0, 0, - 0,230, 0, 0, 0,228, 0, 0, 0,222,230,220,220, 0, 0, 0, - 230, 0, 0,220,230,220, 0,220,230,230,230,234, 0, 0, 9, 9, - 0, 0, 7, 0,230,230,230, 0,230, 0, 1, 1, 1, 0, 0, 0, - 230,234,214,220,202,230,230,230,230,230,232,228,228,220,218,230, - 233,220,230,220,230,230, 1, 1, 1, 1, 1,230, 0, 1, 1,230, - 220,230, 1, 1, 0, 0,218,228,232,222,224,224, 0, 8, 8, 0, - 0, 0, 0,220,230, 0,230,230,220, 0, 0,230, 0, 0, 26, 0, - 0,220, 0,230,230, 1,220, 0, 0,230,220, 0, 0, 0,220,220, - 0, 0,230,220, 0, 9, 7, 0, 0, 7, 9, 0, 0, 0, 9, 7, - 6, 6, 0, 0, 0, 0, 1, 0, 0,216,216, 1, 1, 1, 0, 0, - 0,226,216,216,216,216,216, 0,220,220,220, 0,232,232,220,230, - 230,230, 7, 0, 16, 17, 17, 33, 17, 49, 17, 17, 84, 97,135,145, - 26, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17,177, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 5, 3, - 3, 3, 3, 3, 6, 7, 8, 3, 3, 3, 3, 3, 9, 10, 11, 12, - 13, 3, 3, 3, 3, 3, 3, 3, 3, 14, 3, 15, 3, 3, 3, 3, - 3, 3, 16, 17, 18, 19, 20, 21, 3, 3, 3, 22, 23, 24, 3, 3, - 3, 3, 3, 3, 25, 3, 3, 3, 3, 3, 3, 3, 3, 26, 3, 3, - 27, 28, 0, 1, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 3, - 0, 0, 0, 3, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, 0, 0, - 0, 0, 0, 9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, - 13, 0, 0, 14, 15, 16, 6, 0, 17, 18, 19, 19, 19, 20, 21, 22, - 23, 24, 19, 25, 0, 26, 27, 19, 19, 28, 29, 30, 0, 31, 0, 0, - 0, 8, 0, 0, 0, 0, 0, 0, 0, 19, 28, 0, 32, 33, 9, 34, - 35, 19, 0, 0, 36, 37, 38, 39, 40, 19, 0, 41, 42, 43, 44, 31, - 0, 1, 45, 42, 0, 0, 0, 0, 0, 32, 14, 14, 0, 0, 0, 0, - 14, 0, 0, 46, 47, 47, 47, 47, 48, 49, 47, 47, 47, 47, 50, 51, - 52, 53, 43, 21, 0, 0, 0, 0, 0, 0, 0, 54, 6, 55, 0, 14, - 19, 1, 0, 0, 0, 0, 56, 57, 0, 0, 0, 0, 0, 19, 58, 31, - 0, 0, 0, 0, 0, 0, 0, 59, 14, 0, 0, 0, 0, 1, 0, 2, - 0, 0, 0, 3, 0, 0, 0, 60, 61, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 2, 3, 0, 4, 5, 0, 0, 6, 0, 0, - 0, 7, 0, 0, 0, 1, 1, 0, 0, 8, 9, 0, 8, 9, 0, 0, - 0, 0, 8, 9, 10, 11, 12, 0, 0, 0, 13, 0, 0, 0, 0, 14, - 15, 16, 17, 0, 0, 0, 1, 0, 0, 18, 19, 0, 0, 0, 20, 0, - 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 8, - 21, 9, 0, 0, 22, 0, 0, 0, 0, 1, 0, 23, 24, 25, 0, 0, - 26, 0, 0, 0, 8, 21, 27, 0, 1, 0, 0, 1, 1, 1, 1, 0, - 1, 28, 29, 30, 0, 31, 32, 20, 1, 1, 0, 0, 0, 8, 21, 9, - 1, 4, 5, 0, 0, 0, 33, 9, 0, 1, 1, 1, 0, 8, 21, 21, - 21, 21, 34, 1, 35, 21, 21, 21, 9, 36, 0, 0, 37, 38, 1, 0, - 39, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 8, 21, 9, 1, 0, - 0, 0, 40, 0, 8, 21, 21, 21, 21, 21, 21, 21, 21, 9, 0, 1, - 1, 1, 1, 8, 21, 21, 21, 9, 0, 0, 0, 41, 0, 42, 43, 0, - 0, 0, 1, 44, 0, 0, 0, 45, 8, 9, 1, 0, 0, 0, 8, 21, - 21, 21, 9, 0, 1, 0, 1, 1, 8, 21, 21, 9, 0, 4, 5, 8, - 9, 1, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 9, 10, 11, 11, 11, 11, 12, 13, - 13, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 13, 13, 13, - 24, 25, 26, 26, 26, 27, 13, 13, 13, 28, 29, 30, 13, 31, 32, 33, - 34, 35, 36, 37, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 38, 7, 7, 39, 7, 40, 7, 7, - 7, 41, 13, 42, 7, 7, 43, 7, 7, 7, 44, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 45, 0, 0, 1, 2, 2, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 37, - 37, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 2, 2, 53, 54, 55, 56, 57, 58, 59, 59, 59, 59, 60, 59, - 59, 59, 59, 59, 59, 59, 61, 61, 59, 59, 59, 59, 62, 59, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 59, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 78, 69, 69, 69, 69, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, - 81, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 94, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 69, 69, 96, 97, 98, 99, 99, 99, - 100,101,102,103,104,105,106,107,108,109, 95,110,111,112,113,114, - 115,116,117,117,118,119,120,121,122,123,124,125,126,127,128,129, - 130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145, - 95,146,147,148,149, 95,150,151,152,153,154,155,156,157,158,159, - 160,161, 95,162,163,164,165,165,165,165,165,165,165,166,167,165, - 168, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95,169,170,170,170,170,170,170,170,170,171,170, - 170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170, - 170,170,170,170,170,170,170,170,170,170,170,170,170,172,173,173, - 173,173,174, 95, 95, 95, 95, 95,175, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95,176,176,176,176,177,178,179,180, 95, 95, - 181, 95,182,183,184,185,186,186,186,186,186,186,186,186,186,186, - 186,186,186,186,186,186,186,186,186,186,186,186,187,187,187,188, - 189,190, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95,191,192,193,194,195,195,196, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,197,198, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 59,199, - 59, 59, 59,200,201,202, 59,203,204,205,206,207,208, 95,209,210, - 211, 59, 59,212, 59,213,214,214,214,214,214,215, 95, 95, 95, 95, - 95, 95, 95, 95,216, 95,217,218,219, 95, 95,220, 95, 95, 95,221, - 95,222, 95,223, 95,224,225,226,227, 95, 95, 95, 95, 95,228,229, - 230, 95,231,232, 95, 95,233,234, 59,235,236, 95, 59, 59, 59, 59, - 59, 59, 59,237, 59,238,239,240, 59, 59,241,242, 59,243, 95, 95, - 95, 95, 95, 95, 95, 95, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69,244, 69, 69,245, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, - 69, 69, 69,246, 69, 69, 69, 69, 69, 69, 69, 69, 69,247, 69, 69, - 69, 69,248, 95, 95, 95, 69, 69, 69, 69,249, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 69, 69, 69, 69, 69, 69,250, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,251, 95, - 95, 95, 95, 95, 95, 95,252, 95,253,254, 0, 1, 2, 2, 0, 1, - 2, 2, 2, 3, 4, 5, 0, 0, 0, 0, 0, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 0, 0, 0, 19, 0, 19, 0, 0, 0, 0, 0, - 26, 26, 1, 1, 1, 1, 9, 9, 9, 9, 0, 9, 9, 9, 2, 2, - 9, 9, 9, 9, 0, 9, 2, 2, 2, 2, 9, 0, 9, 0, 9, 9, - 9, 2, 9, 2, 9, 9, 9, 9, 2, 9, 9, 9, 55, 55, 55, 55, - 55, 55, 6, 6, 6, 6, 6, 1, 1, 6, 2, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 2, 2, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 2, 2, 2, 2, 14, 14, 2, 2, 2, 3, 3, 3, 3, 3, 0, - 3, 3, 0, 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 1, 1, 1, - 3, 3, 1, 3, 3, 3, 37, 37, 37, 37, 37, 37, 2, 37, 37, 37, - 37, 2, 2, 37, 37, 37, 38, 38, 38, 38, 38, 38, 2, 2, 64, 64, - 64, 64, 64, 64, 64, 2, 2, 64, 64, 64, 90, 90, 90, 90, 90, 90, - 2, 2, 90, 90, 90, 2, 95, 95, 95, 95, 2, 2, 95, 2, 3, 3, - 2, 2, 2, 2, 2, 3, 3, 3, 0, 3, 7, 7, 7, 7, 7, 1, - 1, 1, 1, 7, 7, 7, 0, 0, 7, 7, 5, 5, 5, 5, 2, 5, - 5, 5, 5, 2, 2, 5, 5, 2, 5, 5, 5, 2, 5, 2, 2, 2, - 5, 5, 5, 5, 2, 2, 5, 5, 5, 2, 2, 2, 2, 5, 5, 5, - 2, 5, 2, 11, 11, 11, 11, 11, 11, 2, 2, 2, 2, 11, 11, 2, - 2, 11, 11, 11, 11, 11, 11, 2, 11, 11, 2, 11, 11, 2, 11, 11, - 2, 2, 2, 11, 2, 2, 11, 2, 11, 2, 2, 2, 11, 11, 2, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 2, 10, 10, 2, 10, 10, 10, 10, - 2, 2, 10, 2, 2, 2, 2, 2, 10, 10, 2, 21, 21, 21, 21, 21, - 21, 21, 21, 2, 2, 21, 21, 2, 21, 21, 21, 21, 2, 2, 21, 21, - 2, 21, 2, 2, 21, 21, 2, 2, 22, 22, 2, 22, 22, 22, 22, 22, - 22, 2, 22, 2, 22, 22, 22, 22, 2, 2, 2, 22, 22, 2, 2, 2, - 2, 22, 22, 2, 2, 2, 22, 22, 22, 22, 23, 23, 23, 23, 23, 2, - 23, 23, 23, 23, 2, 2, 2, 23, 23, 2, 23, 23, 23, 2, 2, 2, - 23, 23, 2, 2, 2, 23, 16, 16, 16, 16, 16, 2, 16, 16, 2, 16, - 16, 16, 16, 16, 2, 2, 2, 16, 16, 2, 16, 16, 16, 2, 2, 2, - 16, 16, 20, 20, 20, 20, 20, 2, 20, 20, 2, 2, 20, 20, 2, 36, - 36, 36, 36, 36, 36, 36, 36, 36, 36, 2, 2, 2, 36, 36, 36, 36, - 2, 36, 2, 36, 2, 2, 2, 2, 36, 2, 2, 2, 2, 36, 36, 2, - 36, 2, 36, 2, 2, 2, 2, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 2, 2, 2, 2, 0, 2, 18, 18, 2, 18, 2, 18, 18, 18, 18, - 18, 2, 18, 18, 18, 18, 2, 18, 2, 18, 18, 18, 2, 2, 18, 2, - 18, 2, 25, 25, 25, 25, 2, 25, 25, 25, 25, 2, 2, 2, 25, 2, - 25, 25, 25, 0, 0, 0, 0, 25, 25, 2, 33, 33, 33, 33, 8, 8, - 8, 8, 8, 8, 2, 8, 2, 8, 2, 2, 8, 8, 8, 0, 12, 12, - 12, 12, 30, 30, 30, 30, 30, 2, 30, 30, 30, 30, 2, 2, 30, 30, - 30, 2, 2, 30, 30, 30, 30, 2, 2, 2, 29, 29, 29, 29, 29, 29, - 2, 2, 28, 28, 28, 28, 34, 34, 34, 34, 34, 2, 2, 2, 35, 35, - 35, 35, 35, 35, 35, 0, 0, 0, 35, 35, 35, 2, 2, 2, 45, 45, - 45, 45, 45, 45, 2, 2, 2, 2, 2, 45, 44, 44, 44, 44, 44, 0, - 0, 2, 43, 43, 43, 43, 46, 46, 46, 46, 46, 2, 46, 46, 31, 31, - 31, 31, 31, 31, 2, 2, 32, 32, 0, 0, 32, 0, 32, 32, 32, 32, - 32, 32, 32, 32, 2, 2, 32, 2, 2, 2, 32, 32, 32, 2, 28, 28, - 2, 2, 48, 48, 48, 48, 48, 48, 48, 2, 48, 2, 2, 2, 52, 52, - 52, 52, 52, 52, 2, 2, 52, 2, 2, 2, 58, 58, 58, 58, 58, 58, - 2, 2, 58, 58, 58, 2, 2, 2, 58, 58, 54, 54, 54, 54, 2, 2, - 54, 54, 91, 91, 91, 91, 91, 91, 91, 2, 91, 2, 2, 91, 91, 91, - 2, 2, 1, 1, 2, 2, 62, 62, 62, 62, 62, 2, 62, 62, 76, 76, - 76, 76, 93, 93, 93, 93, 70, 70, 70, 70, 2, 2, 2, 70, 70, 70, - 2, 2, 2, 70, 70, 70, 73, 73, 73, 73, 6, 6, 6, 2, 8, 8, - 8, 2, 2, 8, 8, 8, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, - 0, 0, 0, 1, 0, 0, 1, 1, 0, 2, 19, 19, 9, 9, 9, 9, - 9, 6, 19, 9, 9, 9, 9, 9, 19, 19, 9, 9, 9, 19, 6, 19, - 19, 19, 19, 19, 19, 9, 9, 9, 2, 2, 2, 9, 2, 9, 2, 9, - 9, 9, 1, 1, 0, 0, 0, 2, 0, 0, 0, 19, 2, 2, 0, 0, - 0, 19, 0, 0, 0, 2, 19, 2, 2, 2, 0, 0, 2, 2, 1, 2, - 2, 2, 0, 0, 9, 0, 0, 0, 19, 19, 27, 27, 27, 27, 2, 2, - 0, 0, 56, 56, 56, 56, 2, 55, 55, 55, 61, 61, 61, 61, 2, 2, - 2, 61, 61, 2, 2, 2, 13, 13, 13, 13, 13, 13, 2, 13, 13, 13, - 2, 2, 0, 13, 0, 13, 0, 13, 13, 13, 13, 13, 1, 1, 1, 1, - 12, 12, 2, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 1, - 1, 0, 0, 15, 15, 15, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 0, 2, 26, 26, 26, 26, 26, 26, 26, 2, 12, 12, 12, 12, 12, - 12, 2, 12, 12, 12, 0, 39, 39, 39, 39, 39, 2, 2, 2, 39, 39, - 39, 2, 86, 86, 86, 86, 77, 77, 77, 77, 79, 79, 79, 79, 2, 19, - 19, 19, 60, 60, 60, 60, 60, 2, 2, 2, 65, 65, 65, 65, 75, 75, - 75, 75, 75, 75, 2, 2, 2, 2, 75, 75, 69, 69, 69, 69, 69, 69, - 0, 69, 74, 74, 74, 74, 2, 2, 2, 74, 12, 2, 2, 2, 84, 84, - 84, 84, 84, 84, 2, 0, 84, 84, 2, 2, 2, 2, 84, 84, 33, 33, - 33, 2, 68, 68, 68, 68, 68, 68, 68, 2, 68, 68, 2, 2, 92, 92, - 92, 92, 92, 92, 92, 2, 2, 2, 2, 92, 87, 87, 87, 87, 87, 87, - 87, 2, 19, 9, 19, 19, 19, 19, 0, 0, 87, 87, 2, 2, 2, 2, - 2, 12, 19, 19, 19, 2, 2, 2, 2, 4, 14, 2, 14, 2, 14, 14, - 2, 14, 14, 2, 14, 14, 3, 3, 0, 0, 1, 1, 6, 6, 3, 2, - 3, 3, 3, 2, 2, 0, 2, 0, 0, 0, 0, 0, 17, 17, 17, 17, - 0, 0, 2, 2, 12, 12, 49, 49, 49, 49, 2, 49, 49, 49, 49, 49, - 49, 2, 49, 49, 2, 49, 49, 49, 2, 2, 0, 2, 2, 2, 9, 2, - 2, 2, 0, 1, 2, 2, 71, 71, 71, 71, 71, 2, 2, 2, 67, 67, - 67, 67, 67, 2, 2, 2, 42, 42, 42, 42, 2, 42, 42, 42, 41, 41, - 41, 41, 41, 41, 41, 2,118,118,118,118,118,118,118, 2, 53, 53, - 53, 53, 53, 53, 2, 53, 59, 59, 59, 59, 59, 59, 2, 2, 40, 40, - 40, 40, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 2, 2,135,135, - 135,135,106,106,106,106,104,104,104,104, 2, 2, 2,104,161,161, - 161,161,161,161,161, 2,161,161, 2,161,161, 2, 2, 2,170,170, - 170,170,110,110,110,110,110,110,110, 2,110,110, 2, 2, 19, 19, - 2, 19, 19, 2, 19, 19, 47, 47, 47, 47, 47, 47, 2, 2, 47, 2, - 47, 47, 47, 47, 2, 47, 47, 2, 2, 2, 47, 2, 2, 47, 81, 81, - 81, 81, 81, 81, 2, 81,120,120,120,120,116,116,116,116,116,116, - 116, 2, 2, 2, 2,116,128,128,128,128,128,128,128, 2,128,128, - 2, 2, 2, 2, 2,128, 66, 66, 66, 66, 2, 2, 2, 66, 72, 72, - 72, 72, 72, 72, 2, 2, 2, 2, 2, 72,173,173,173,173,173,173, - 2, 2, 98, 98, 98, 98, 97, 97, 97, 97, 2, 2, 97, 97, 57, 57, - 57, 57, 2, 57, 57, 2, 2, 57, 57, 57, 57, 57, 2, 2, 57, 57, - 57, 2, 2, 2, 2, 57, 57, 2, 2, 2, 88, 88, 88, 88,117,117, - 117,117,112,112,112,112,112,112,112, 2, 2, 2, 2,112, 78, 78, - 78, 78, 78, 78, 2, 2, 2, 78, 78, 78, 83, 83, 83, 83, 83, 83, - 2, 2, 82, 82, 82, 82, 82, 82, 82, 2,122,122,122,122,122,122, - 2, 2, 2,122,122,122,122, 2, 2, 2, 89, 89, 89, 89, 89, 2, - 2, 2,130,130,130,130,130,130,130, 2, 2, 2,130,130,144,144, - 144,144,144,144, 2, 2,165,165,165,165,165,165, 2, 2, 2,165, - 165,165, 2, 2,165,165, 3, 3, 3, 2,156,156,156,156,156,156, - 2,156,156,156, 2, 2, 2, 2, 3, 3, 3, 2, 2, 2,147,147, - 147,147,148,148,148,148,148,148, 2, 2,158,158,158,158,158,158, - 2, 2,153,153,153,153,149,149,149,149,149,149,149, 2, 94, 94, - 94, 94, 94, 94, 2, 2, 2, 2, 94, 94, 2, 2, 2, 94, 85, 85, - 85, 85, 85, 85, 85, 2, 2, 85, 2, 2,101,101,101,101,101, 2, - 2, 2,101,101, 2, 2, 96, 96, 96, 96, 96, 2, 96, 96,111,111, - 111,111,111,111,111, 2,100,100,100,100,108,108,108,108,108,108, - 2,108,108,108, 2, 2,129,129,129,129,129,129,129, 2,129, 2, - 129,129,129,129, 2,129,129,129, 2, 2,109,109,109,109,109,109, - 109, 2,109,109, 2, 2,107,107,107,107, 2,107,107,107,107, 2, - 2,107,107, 2,107,107,107,107, 2, 1,107,107, 2, 2,107, 2, - 2, 2, 2, 2, 2,107, 2, 2,107,107,171,171,171,171,171,171, - 2,171, 2, 2,171, 2,171, 2,171, 2, 2,171, 2,171,171,171, - 171, 2,171, 2, 2, 2, 2,171,171, 2,137,137,137,137, 2,137, - 137,137,137,137, 2, 2,124,124,124,124,124,124, 2, 2,123,123, - 123,123,123,123, 2, 2,114,114,114,114,114, 2, 2, 2,114,114, - 2, 2,102,102,102,102,102,102, 2, 2,126,126,126,126,126,126, - 126, 2, 2,126,126,126,142,142,142,142,125,125,125,125,125,125, - 125, 2, 2, 2, 2,125,154,154,154,154,154,154,154, 2, 2,154, - 2, 2, 2,154,154, 2,154,154, 2,154,154, 2, 2,154,154,154, - 2, 2,150,150,150,150, 2, 2,150,150,150, 2, 2, 2,141,141, - 141,141,140,140,140,140,140,140,140, 2,121,121,121,121,121, 2, - 2, 2, 7, 7, 2, 2,169,169,169,169,169,169, 2, 2,133,133, - 133,133,133, 2,133,133,133,133,133, 2,133,133, 2, 2,133, 2, - 2, 2,134,134,134,134, 2, 2,134,134, 2,134,134,134,134,134, - 134, 2,138,138,138,138,138,138,138, 2,138,138, 2,138, 2, 2, - 138, 2,138,138, 2, 2,143,143,143,143,143,143, 2,143,143, 2, - 143,143,143,143,143, 2,143, 2, 2, 2,143,143, 2, 2,175,175, - 175,175,175,175, 2, 2,145,145,145,145,145, 2, 2, 2,163,163, - 163,163,163, 2,163,163,163,163,163, 2, 2, 2,163,163, 86, 2, - 2, 2, 63, 63, 63, 63, 63, 63, 2, 2, 63, 63, 63, 2, 63, 2, - 2, 2,157,157,157,157,157,157,157, 2, 80, 80, 80, 80, 80, 80, - 2, 2, 80, 80, 80, 2,127,127,127,127,127,127,127, 2,166,166, - 166,166,166,166, 2, 2, 79, 2, 2, 2,115,115,115,115,115,115, - 115, 2,115,115, 2, 2, 2, 2,115,115,159,159,159,159,159,159, - 159, 2,159,159, 2, 2,103,103,103,103,103,103, 2, 2,119,119, - 119,119,119,119, 2, 2,119,119, 2,119, 2,119,119,119,167,167, - 167,167,167,167, 2, 2,146,146,146,146,146,146,146, 2,172,172, - 172,172,172, 2, 2,172, 99, 99, 99, 99, 99, 99, 99, 2, 2, 2, - 2, 99,136,139, 13, 13,155, 2, 2, 2, 13, 13, 13, 2,136,136, - 136,136,155,155,155,155,155,155, 2, 2, 2, 2, 2,155,136,136, - 136, 2, 2, 17, 17, 17, 2, 17, 17, 2, 17, 15, 15, 15, 17, 17, - 17, 2, 2, 2, 15, 2, 2, 17, 2, 2,139,139,139,139,105,105, - 105,105,105,105,105, 2,105, 2, 2, 2,105,105, 2, 2, 1, 1, - 1, 2, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 2, 2, - 0, 2, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 2,131,131, - 131,131, 2, 2, 2,131, 2,131,131,131, 56, 56, 56, 2, 56, 2, - 2, 56, 56, 56, 2, 56, 56, 2, 56, 56, 6, 6, 2, 2, 2, 2, - 2, 6,151,151,151,151,151, 2, 2, 2,151,151, 2, 2, 2, 2, - 151,151,160,160,160,160,160,160,160, 2,152,152,152,152,152,152, - 2, 2, 2, 2, 2,152,164,164,164,164,164,164, 2, 2,168,168, - 168,168,168,168,168, 2, 2, 2, 2,168,174,174,174,174,174,174, - 174, 2,174,174, 2, 2, 2, 2,174,174, 2, 30, 30, 2,113,113, - 113,113,113, 2, 2,113,113,113,113, 2,132,132,132,132,132,132, - 2, 2, 2, 2,132,132, 2, 3, 3, 3, 2, 3, 3, 2, 3, 2, - 2, 3, 2, 3, 2, 3, 2, 2, 3, 2, 3, 2, 3, 2, 3, 3, - 2, 3, 15, 0, 0, 2, 0, 2, 2, 0, 13, 2, 2, 2, 2, 0, - 2, 2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9, 10, - 9, 11, 12, 13, 9, 9, 9, 14, 9, 9, 15, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 16, 17, - 9, 9, 9, 9, 18, 9, 9, 9, 9, 9, 19, 20, 21, 9, 22, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 23, 9, 9, 9, 9, 9, 24, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 25, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 26, 27, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 23, 0, 0, 24, 25, 26, 27, 28, 29, 30, 0, 0, - 31, 32, 0, 33, 0, 34, 0, 35, 0, 0, 0, 0, 36, 37, 38, 39, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 42, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 43, 44, 0, 45, 0, 0, 0, 0, 0, 0, 46, 47, 0, 0, - 0, 0, 0, 48, 0, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 51, 0, 0, 0, 52, 0, 0, 53, 0, 0, 0, - 0, 0, 0, 0, 54, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, - 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 58, 59, 60, 61, 62, 63, 64, 65, 0, 0, 0, 0, - 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 67, 68, 0, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102, - 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,104, 0, 0, 0, 0, 0, 0,105,106, 0,107, 0, 0, 0, - 108, 0,109, 0,110, 0,111,112,113, 0,114, 0, 0, 0,115, 0, - 0, 0,116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,117, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,118,119,120,121, 0,122,123,124,125,126, 0,127, + 3, 4, 5, 6, 7, 2, 2, 2, 2, 2, 8, 2, 2, 9, 1, 10, + 11, 12, 13, 14, 15, 0, 16, 2, 17, 0, 18, 19, 20, 21, 22, 23, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 24, 25, 26, 2, 27, 28, + 2, 29, 2, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 32, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 2, 23, 24, 25, 2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 5, 38, 39, 40, 41, 42, 3, 43, 5, 44, 45, 46, 47, 48, + 49, 50, 51, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 52, 2, 2, + 53, 2, 2, 2, 54, 2, 55, 56, 57, 58, 59, 60, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 61, 4, 4, 4, 4, 4, 4, 4, 4, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 62, 63, 2, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 2, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 2, 2, 2, 98, 99,100, 0, 0, 0, 0, 0, 0, 0, 0, 0,101, + 2, 2, 2, 2,102, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2,103, 2, 2,104, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0,105, 0, 0, 0, 0, 0, 0, 2, 2,106,107, 0,108,109,110, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,111,112, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,113, + 2,114,115, 0, 0, 0, 0, 0, 0, 0, 0, 0,116, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,117, 3,118,119, + 120,121,122,123,124,125,126,127, 3, 3,128, 0, 0, 0, 0,129, + 130,131,132, 0,133,134,135,136,137,138, 0, 0,139,140,141, 0, + 142,143,144,145, 3, 3,146,147,148, 3,149,150, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2,151, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2,152, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,153, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,154, 2, 2,155, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,156, 0, 0, 0, 0, 0, + 2, 2, 2,157, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2,158, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 159,160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,161, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, + 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, + 5, 5, 5, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, + 11, 11, 11, 11, 11, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, + 13, 13, 13, 13, 13, 13, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, + 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 14, + 1, 1, 1, 1, 14, 1, 1, 1, 18, 18, 18, 18, 18, 18, 18, 18, + 1, 5, 0, 11, 11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 14, 0, + 1, 1, 1, 1, 14, 0, 0, 0, 6, 6, 6, 6, 7, 7, 7, 7, + 1, 1, 1, 1, 1, 14, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 14, 0, 0, 0, 0, + 1, 1, 1, 14, 1, 1, 1, 14, 3, 3, 3, 3, 3, 3, 0, 0, + 28, 28, 28, 28, 28, 28, 28, 28, 11, 11, 11, 11, 11, 1, 1, 1, + 14, 17, 1, 1, 1, 1, 1, 1, 14, 0, 0, 0, 0, 0, 0, 0, + 14, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 0, 0, 0, + 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 29, 0, + 11, 11, 11, 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 6, 6, 6, + 0, 0, 0, 11, 11, 11, 11, 11, 17, 1, 1, 1, 1, 1, 1, 1, + 11, 11, 11, 11, 11, 10, 10, 10, 1, 1, 1, 0, 0, 0, 0, 0, + 5, 46, 1, 1, 1, 1, 1, 1, 6, 6, 6, 6, 41, 41, 41, 41, + 3, 3, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 11, 0, 0, 12, + 1, 1, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, + 49, 10, 10, 10, 10, 10, 10, 10, 7, 6, 6, 6, 6, 6, 6, 6, + 44, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, + 3, 3, 3, 3, 0, 0, 0, 0, 11, 11, 11, 11, 11, 12, 9, 77, + 88, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,102,103,104, + 89, 6, 6, 6, 6, 6, 6, 6, 22, 22, 22, 22, 22, 22, 22, 22, + 26, 5, 5, 5, 5, 5, 5, 5, 1, 1, 1, 5, 5, 5, 5, 5, + 5, 20, 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 1, 1, + 11, 11, 11, 11, 11, 12, 12, 12, 1, 1, 1, 1, 14, 1, 1, 0, + 14, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 14, 1, 1, 1, 1, + 10, 10, 10, 10, 10, 10, 51, 0,115, 1, 1, 1, 1, 1, 1, 1, + 5, 5, 5, 5, 5, 5, 5, 0, 1, 1, 1, 1, 13, 13, 13, 12, + 6, 6, 6, 0, 7, 7, 7, 0, 30, 30, 30, 30, 30, 30, 30, 30, + 3, 3, 3, 3, 3, 29, 0, 0, 3, 3, 3, 3, 3, 3, 3, 29, + 10, 10, 10, 10, 10, 3, 3, 3, 75, 10, 10, 10, 10, 10, 10, 10, + 3, 3, 3, 29, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, + 7, 7, 7, 7, 7, 32, 7, 7, 0, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 51, 0, 0, 0, 1, 1, 1, 1, 1, 1, 86, 10, + 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 15, 19, + 1, 1, 1, 1, 1, 1, 1, 34, 1, 1, 1, 1, 1, 1, 1, 5, + 15, 15, 15, 15, 15, 15, 15, 15, 1, 14, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 23, 0, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0, 0, + 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, + 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, + 3, 3, 3, 3, 29, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, + 87, 12,100, 12, 27,101, 76, 12, 6, 6, 6, 6, 6,105,106,135, + 87, 30, 30, 66,107,136,137,108, 50, 10, 89, 12,138,139, 10, 78, + 7, 7, 7, 59, 7, 7, 7, 8, 6, 6, 6, 60, 6, 6, 6, 6, + 8, 8, 8, 8, 21, 21, 21, 21, 21, 21, 21, 21, 6, 8, 8, 8, + 8, 8, 8, 8, 7, 21, 21, 6, 21, 8, 8, 7, 21, 7, 6, 7, + 7, 21, 8, 7, 8, 6, 7, 21, 8, 8, 8, 7, 21, 6, 8, 7, + 21, 7, 21, 21, 8, 67, 8, 6, 1, 1,109, 21,110,109, 21, 21, + 21, 21, 21, 21, 21, 21, 6, 8, 21,110, 8, 7, 8, 8, 8, 8, + 8, 8, 6, 6, 6, 7, 21, 8, 21, 21, 7, 8, 8, 8, 8, 8, + 6, 6, 1, 6, 6, 6, 6, 6, 13, 22, 22, 13, 13, 13, 13, 13, + 13, 22, 22, 22, 22, 22, 22, 22, 13, 13, 68, 22, 22, 22, 68, 68, + 8, 8, 68, 8, 0, 69, 6, 88, 0, 0, 22,140, 7, 32, 32, 7, + 21, 7, 7, 7, 7, 7, 7, 7, 7, 39, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 21, 6, 7, 8, 6, 8, 8, 8, 8, + 6, 6, 8, 90, 21, 8, 21, 7, 8, 43, 5, 5, 79, 8, 8, 8, + 7, 21, 21, 21, 21, 21, 21, 6, 39, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 32, 54, 12, 12, 12, 6, 6, 6, 6,111,141, 44, 70, + 5, 5, 5, 5, 5, 5, 5,142, 71, 36, 5, 71, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 14, 0, 17, 1, 40, 33, 0, 0, 0, 0, 0, + 18, 18, 18, 9, 77, 80, 12, 3, 5, 5, 5, 5, 5, 36,143, 12, + 52, 1, 1, 1, 1, 24, 5, 5, 11, 11, 11, 11, 11, 12, 12, 1, + 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 53, 5, 5, 5,144, 43, + 5, 5, 81, 72, 55, 5, 5, 1, 11, 11, 11, 11, 11, 1, 56, 82, + 12, 12, 12, 12, 12, 12, 12, 73, 24, 1, 1, 1, 1, 1, 1, 1, + 5, 5, 5, 5, 5, 23, 17, 1, 25, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 24, 5, 5, 5, 5, 13, 66, 12, 61, 26, 30, + 1, 1, 1, 5, 5, 72, 5, 5, 5, 5, 72, 5, 72, 5, 5, 0, + 12, 12, 12, 12, 12, 12, 12, 33, 1, 1, 1, 1, 24, 5, 0, 33, + 1, 1, 1, 1,145, 1, 1, 1, 18, 0, 0, 26, 5, 5, 5, 5, + 1, 1, 1, 1, 45, 5, 5, 5, 5, 91, 5, 5, 5, 5, 5, 5, + 1, 1, 1, 1, 1, 20, 25, 15, 19, 5, 5, 5, 20, 15, 19, 15, + 24, 5, 5, 5, 1, 1, 1, 1, 1, 5, 12, 11, 11, 11, 11, 11, + 62, 1, 1, 1, 1, 1, 1, 1, 24, 15, 17, 1, 1, 1, 14, 17, + 14, 14, 0, 1, 1, 0, 25, 15, 19, 5, 23, 35, 37, 35, 19, 14, + 0, 0, 0, 35, 0, 0, 1, 17, 1, 30, 10, 10, 10, 70, 40, 23, + 26, 20, 17, 1, 1, 14, 0, 17, 14, 1, 17, 14, 1, 0, 23, 15, + 19, 23, 0, 26, 23, 26, 5, 0, 26, 0, 0, 0, 17, 1, 14, 14, + 5, 1, 24, 33, 0, 0, 0, 0, 26, 20, 17, 1, 1, 1, 1, 17, + 14, 1, 17, 1, 1, 0, 25, 15, 19, 5, 5, 26, 20, 35, 19, 0, + 80, 0, 0, 0, 17, 5, 5, 5, 26, 15, 17, 1, 1, 1, 14, 17, + 14, 1, 17, 1, 1, 0, 25, 19, 19, 5, 23, 35, 37, 35, 19, 0, + 0, 0, 26, 20, 0, 0, 1, 17, 82, 10, 10, 10, 0, 0, 0, 0, + 0, 25, 17, 1, 1, 14, 0, 1, 14, 1, 1, 0, 17, 14, 14, 1, + 0, 17, 14, 0, 1, 14, 0, 1, 1, 1, 1, 1, 1, 0, 0, 15, + 20, 37, 0, 15, 37, 15, 19, 0, 14, 0, 0, 35, 0, 0, 0, 0, + 10, 63, 3, 3, 70, 29, 0, 0, 20, 15, 25, 1, 1, 1, 14, 1, + 1, 1, 1, 1, 1, 0, 25, 5, 20, 15, 37, 5, 23, 5, 5, 0, + 0, 0, 26, 23, 1, 14, 1, 0, 0, 0, 0, 38, 10, 10, 10, 63, + 24, 15, 53, 1, 1, 1, 14, 1, 1, 1, 17, 1, 1, 0, 25, 19, + 15, 15, 37, 20, 37, 15, 5, 0, 0, 0, 35, 37, 0, 0, 1, 14, + 17, 34, 0, 0, 0, 0, 0, 0, 5, 15, 1, 1, 1, 1, 14, 1, + 1, 1, 1, 1, 1, 24, 25, 15, 19, 5, 23, 15, 37, 15, 19, 56, + 0, 0, 1, 34, 10, 10, 10,112, 10, 10, 10, 10, 63, 1, 1, 1, + 26, 15, 17, 1, 1, 1, 1, 1, 1, 1, 1, 14, 0, 1, 1, 1, + 1, 17, 1, 1, 1, 1, 17, 0, 1, 1, 1, 14, 0, 23, 0, 35, + 15, 5, 23, 23, 15, 15, 15, 15, 0, 15, 33, 0, 0, 0, 0, 0, + 24, 1, 5, 5, 5, 23, 0,113, 1, 1, 1, 72, 5, 5, 5, 36, + 11, 11, 11, 11, 11, 12, 0, 0, 17, 14, 14, 1, 1, 14, 1, 1, + 1, 1, 17, 17, 1, 1, 1, 1, 24, 1, 5, 5, 5, 5, 25, 0, + 1, 1, 14, 61, 5, 5, 5, 23, 11, 11, 11, 11, 11, 0, 1, 1, + 56, 3, 12, 12, 12, 12, 12, 12, 12, 57, 57, 3, 5, 3, 3, 3, + 10, 10, 43, 43, 43, 27, 27, 15, 1, 1, 1, 1, 17, 1, 1, 1, + 26, 5, 5, 5, 5, 5, 5, 20, 5, 5, 36, 5, 1, 1, 24, 5, + 5, 5, 5, 5, 26, 5, 5, 5, 5, 5, 5, 5, 5, 5, 23, 3, + 3, 3, 3, 55, 3, 3, 29, 3, 12, 12, 57, 3, 66, 33, 0, 0, + 1, 1, 1, 1, 1, 34, 19, 5, 20, 5, 5, 5, 19, 20, 19, 25, + 1, 1, 1, 15, 5, 1, 1, 5, 25, 15, 46, 34, 15, 15, 15, 1, + 24, 5, 25, 1, 1, 1, 1, 1, 1, 20, 19, 20, 15, 15, 19, 34, + 11, 11, 11, 11, 11, 15, 19, 3, 7, 7, 7, 39, 0, 0, 39, 0, + 6, 6, 6, 6, 6,111, 69, 6, 1, 1, 1, 14, 14, 1, 1, 0, + 14, 1, 1, 0, 1, 1, 1, 14, 1, 1, 1, 1, 1, 14, 26, 5, + 12, 12, 12, 12,114, 10, 10, 10, 7, 7, 7, 0, 6, 6, 6, 0, + 1, 1, 1, 1, 1, 1, 56, 53,146, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1,147,116, 0, 1, 1, 1, 1, 1, 40, 12, 16, + 148, 1, 1, 1, 14, 0, 0, 0, 1, 5, 20, 0, 0, 0, 0, 17, + 1, 5, 83, 33, 0, 0, 0, 0, 1, 5, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 14, 1, 14, 5, 0, 0, 0, 0, 0, 0, + 1, 1, 5, 19, 5, 5, 5, 15, 15, 15, 15, 20, 19, 5, 5, 5, + 5, 5, 12, 62, 12, 80, 24, 0, 10, 10, 10, 10, 10, 0, 0, 0, + 12, 12, 12, 92, 12, 71, 5, 91, 1, 45, 1, 1, 1, 1, 1, 1, + 1, 1, 24, 25, 1, 1, 1, 1, 1, 1, 1, 1, 24, 14, 0, 0, + 5, 20, 15, 19, 20, 15, 0, 0, 15, 20, 15, 15, 19, 5, 0, 0, + 29, 0, 12, 11, 11, 11, 11, 11, 1, 1, 14, 0, 0, 0, 0, 0, + 11, 11, 11, 11, 11, 51, 0, 3, 1, 1, 1, 24, 20, 19, 0, 12, + 1, 1, 34, 20, 5, 5, 5, 23, 20, 20, 19, 5, 5, 5, 20, 15, + 15, 19, 5, 5, 5, 5, 23, 26, 12, 12, 12, 62, 12, 12, 12, 0, + 5, 5, 5, 5, 5, 5, 5, 93, 5, 5, 5, 5, 5, 5, 0, 0, + 5, 5, 46, 1, 1, 1, 1, 1, 1, 1, 20, 5, 5, 20, 20, 15, + 15, 20, 46, 1, 1, 1, 14, 12, 57, 3, 3, 3, 3, 43, 5, 5, + 5, 5, 3, 3, 3, 3, 66, 12, 34, 5, 5, 15, 5, 19, 5, 1, + 1, 1, 1, 20, 5, 15, 19, 19, 5, 15, 0, 0, 0, 0, 12, 12, + 1, 1, 15, 15, 15, 15, 5, 5, 5, 5, 15, 5, 0, 38, 12, 12, + 11, 11, 11, 11, 11, 0, 17, 1, 6, 6, 6, 6, 21, 47, 0, 0, + 7, 7, 7, 7, 7, 32, 39, 7, 12, 12, 12, 12, 0, 0, 0, 0, + 5, 36, 5, 5, 5, 5, 5, 5, 20, 5, 5, 5, 25, 1, 24, 1, + 1, 1, 25, 34, 5, 14, 0, 0, 6, 6, 6, 6, 6, 6, 13, 13, + 13, 13, 13, 13, 13, 69, 6, 6, 6, 6, 6, 6, 69, 6, 6, 6, + 6, 6, 6, 6, 6,117, 13, 13, 8, 8, 8, 6, 6, 6, 6, 8, + 6, 6, 6, 6, 39, 39, 39, 39, 6, 6, 6, 6, 6, 6, 6, 0, + 6, 6, 47, 6, 7, 7, 94,118, 22, 6, 47, 6, 7, 7, 94, 22, + 6, 6, 0, 6, 7, 7,149, 22, 6, 6, 6, 6, 7, 7,150, 22, + 0, 6, 47, 6, 7, 7, 94,151, 74, 74, 74, 74, 74,152, 18, 18, + 84, 84, 84, 12, 58,119, 58,119, 12, 12, 12, 12,153, 18, 18,154, + 12, 12, 12, 12,120,121, 12,122,123, 12, 64, 65, 12, 12, 12, 12, + 12, 77,123, 12, 12, 12, 12,155, 18, 18,156, 18, 18, 18, 18, 18, + 157, 0, 10, 10, 10, 9, 64,158, 10, 10, 10, 10, 10, 9, 64,116, + 13, 13, 13, 13, 13, 13, 61, 0, 30, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 5,159, 79, 93, 79, 93, 5, 5, 5, 5, 5, + 23, 0, 0, 0, 0, 0, 0, 0, 3, 85, 3, 95, 3, 21, 7, 6, + 7, 8, 95, 3, 90, 7, 7, 3, 3, 3, 85, 85, 85, 7, 7,160, + 7, 7, 67, 1,124, 3, 6, 7, 9, 9, 90, 6, 6, 50, 3,125, + 16,161,162, 16,126, 3, 0, 0, 9, 9, 48, 3, 3, 9, 3, 3, + 48, 50, 3, 48, 3, 3, 3, 48, 3, 3, 3, 3, 3, 3, 3, 9, + 3, 48, 48, 3, 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, + 3, 3, 3, 3, 27, 27, 3, 3, 9, 3, 3, 3,163,164, 3, 3, + 3, 3, 3, 3, 3, 3, 48, 3, 3, 3, 3, 3, 3, 50, 9, 9, + 9, 9, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 9, 9, + 9, 3, 3, 3, 3, 3, 3, 3, 10, 10, 10, 10, 10, 10, 3, 3, + 3, 3, 3, 3, 3, 10, 10, 10, 3, 3, 3, 50, 3, 3, 3, 3, + 50, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 9, 9, 9, 9, + 3, 3, 3, 3, 3, 3, 3, 50, 3, 3, 3, 3, 27, 27, 27, 27, + 27, 27, 27, 10, 10, 10, 10, 10, 10, 10, 3, 3, 3, 3, 3, 3, + 9, 9, 64,127, 9, 9, 9, 9, 9, 9, 9, 27, 27, 27, 27, 27, + 9, 64, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,127, 9, 9, 9, + 9, 9, 9, 9, 27, 27, 9, 9, 9, 9, 9, 9, 9, 9, 27, 9, + 9, 9, 48, 50, 9, 9, 48, 3, 3, 3, 0, 3, 3, 3, 3, 3, + 8, 7, 8, 21, 21, 21, 21, 7, 8, 8, 21, 6, 6, 6, 13, 7, + 8, 8,125, 3, 3, 95, 21,165, 5, 8, 0, 0, 38, 12,114, 12, + 6, 6, 6, 42, 0, 0, 42, 0, 1, 1, 1, 1, 0, 0, 0, 54, + 33, 0, 0, 0, 0, 0, 0, 26, 12, 58, 58, 12,120,121, 58, 12, + 12, 12, 12, 76, 12, 92, 58, 12, 58, 27, 27, 27, 27, 12, 12, 62, + 12, 12, 12, 12, 12, 84, 12, 12, 92,166, 12, 12, 12, 12, 12, 12, + 3, 12, 96, 31, 31, 31,167, 0, 3, 3, 3, 3, 3, 44, 3, 3, + 87, 12,168,128, 27, 27, 27, 27, 27, 3, 27, 27, 27, 27,129,169, + 170, 16, 16, 16, 16, 5, 5, 15,130, 13, 13, 3, 16,171, 40, 3, + 1, 1, 1, 14, 26,172,131, 52, 1, 1, 1, 1, 1, 40, 13, 52, + 0, 0, 17, 1, 1, 1, 1, 1, 3, 10, 10, 3, 3, 3, 3, 3, + 3, 3, 3, 0, 0, 0, 0, 44, 3, 3, 3, 3, 10, 10, 10, 10, + 1, 1, 45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,132, 12, + 11, 11, 11, 11, 11, 1, 0, 0, 8, 8, 8, 8, 8, 8, 8, 24, + 79,173, 5, 5, 5, 5, 5, 62, 8, 8, 8, 8, 8, 8, 13, 5, + 1, 1, 1, 16, 16, 16, 16, 16, 5, 12, 12, 12, 0, 0, 0, 0, + 22, 22, 22,131, 13, 13, 13, 13, 22, 8, 8, 8, 8, 8, 8, 8, + 6, 8, 8, 8, 8, 8, 8, 8, 69, 6, 6, 6, 21, 21, 21, 8, + 8, 8, 8, 8, 68,174, 21, 67, 8, 8, 6, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 7, 7, 8, 7, 7, 8, 8, 8, 8, 8, 8, + 8, 8, 7, 7, 21, 21, 8, 8, 8, 8, 8, 8, 8, 8, 32, 0, + 54, 13,175, 67, 13, 67, 1, 1, 1, 25, 1, 25, 1, 24, 1, 1, + 1, 34, 19, 20, 3, 3, 23, 0, 10, 10, 10, 3, 97, 0, 0, 0, + 1, 1, 12, 12, 0, 0, 0, 0, 15, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 15, 15, 15, 15, 15, 15, 15, 15, 5, 0, 0, 0, 0, 12, + 5, 1, 1, 1, 12, 53, 53, 24, 1, 1, 1, 5, 5, 5, 5, 12, + 1, 1, 1, 24, 5, 5, 5, 5, 5, 15, 0, 0, 0, 0, 0, 38, + 1, 24, 15, 5, 5, 15, 5, 15, 83, 12, 12, 12, 12, 12, 12, 54, + 1, 1, 24, 52, 1, 1, 1, 1, 11, 11, 11, 11, 11, 1, 1, 14, + 1, 1, 1, 1, 24, 5, 5, 20, 19, 20, 19, 23, 0, 0, 0, 0, + 1, 24, 1, 1, 1, 1, 20, 0, 11, 11, 11, 11, 11, 0, 12, 12, + 52, 1, 1, 56, 3, 34, 20, 1, 25, 5, 25, 24, 25, 1, 1, 5, + 24, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 45, 12, + 1, 1, 1, 1, 1, 34, 5, 15, 12, 45,176, 23, 0, 0, 0, 0, + 17, 1, 1, 14, 17, 1, 1, 14, 17, 1, 1, 14, 0, 0, 0, 0, + 6, 6, 6, 6, 6,118, 13, 13, 6, 6, 6, 6,117, 22, 0, 0, + 1, 34, 19, 15, 20, 83, 19, 0, 1, 1, 1, 14, 0, 17, 1, 1, + 6, 6, 6, 47, 0, 0, 0, 0, 0, 42, 6, 6, 0, 0, 17, 25, + 1, 1, 1, 1,177, 1, 1, 1, 1, 1, 1, 14, 1, 1, 14, 14, + 1, 17, 14, 1, 1, 1, 1, 1, 1, 22, 22, 22, 22, 22, 22, 22, + 22,107, 3, 3, 3, 3, 3, 3, 3, 82, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 31, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 97, 3, + 12, 12, 12, 96, 65, 0, 0, 0, 76,178,179, 31, 31, 31, 31, 31, + 31, 31, 65, 96, 65, 12,122,180, 12, 33, 12, 12,129, 31, 31, 65, + 12,181, 9, 98, 80, 12, 0, 0, 1, 1, 14, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 14, 73, 38, 12,100, 12, 27,101, 76, 12, + 6, 6, 6, 6, 6,105,106, 64, 65, 27, 12, 1, 1, 1, 1, 1, + 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, + 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 14, 0, + 30,182, 70,183, 50, 9, 48, 29, 0, 0, 0, 0, 73, 18, 3, 0, + 1, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 1, 1, 14, 1, 17, + 12, 33, 0, 49, 10, 10, 10, 10, 10, 10, 0, 44, 3, 3, 3, 3, + 16, 16,126, 10, 63, 3, 3, 3, 3, 3, 3, 3, 3, 10, 3, 29, + 3, 3, 3, 3, 3, 3, 43, 0,133, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 0, 0, 10, 10, 0, 0, 0, 0, 17, 1, + 128, 1, 1, 1, 1, 99, 0, 0, 1, 1, 1, 5, 5, 23, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 38, 1, 1, 0, 0, 1, 1, 1, 1, + 184, 16, 16, 0, 0, 0, 0, 0, 7, 7, 7, 7, 6, 6, 6, 6, + 7, 7, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, + 1, 1, 0, 0, 0, 0, 0, 38, 7, 32, 7, 42, 6, 6, 6, 6, + 6, 42, 6, 6, 6, 6, 6, 6, 6, 42, 6, 6, 6, 42, 47, 0, + 13, 13, 13, 54, 13, 13, 13, 13, 61, 13, 13, 13, 13, 61, 0, 0, + 1, 1, 1, 0, 14, 1, 1, 1, 1, 1, 1, 17, 14, 0, 14, 17, + 1, 1, 1, 38, 10, 10, 10, 10, 1, 1, 1, 56, 75, 10, 10, 10, + 0, 0, 0, 49, 10, 10, 10, 10, 1, 14, 1, 0, 0, 49, 10, 10, + 1, 1, 1, 10, 10, 10, 0, 38, 1, 1, 1, 1, 1, 0, 0, 38, + 1, 1, 1, 1, 0, 0, 10, 1, 24, 5, 26, 23, 0, 0, 5, 5, + 1, 1, 17, 1, 17, 1, 1, 1, 1, 1, 1, 0, 5, 23, 0, 26, + 12, 12, 12, 12, 33, 0, 0, 0, 1, 1, 1, 1, 1, 1, 86, 78, + 1, 1, 1, 1, 82, 1, 1, 1, 1, 1, 24, 23, 0, 49, 10, 10, + 12, 12, 12, 33, 0, 0, 0, 0, 1, 1, 1, 0, 38, 12, 12, 12, + 1, 1, 1, 0, 10, 10, 10, 10, 1, 14, 0, 0, 10, 10, 10, 10, + 1, 0, 0, 0, 38, 12, 33, 0, 0, 0, 0, 0, 49, 10, 10, 10, + 7, 32, 0, 0, 0, 0, 0, 0, 6, 47, 0, 0, 0, 10, 10, 10, + 1, 1, 5, 5, 0, 0, 0, 0, 11, 11, 11, 11, 11, 1, 1, 52, + 7, 7, 7, 0, 26, 5, 5,130, 6, 6, 6, 0, 0, 0, 0, 9, + 10, 10, 10, 10, 10, 10, 10, 51, 1, 1, 1, 1, 1, 26,185, 0, + 0, 1, 45, 1, 0, 0, 0, 0, 57, 3, 3, 3, 29, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 5, 5, 10, 10, 10,112, 0, 0, 0, 0, + 133, 10, 78, 12, 12, 0, 0, 0, 1, 5, 5, 12, 12, 0, 0, 0, + 1, 1, 86, 10, 10, 10, 0, 0, 19, 46, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 36, 12, 12, 12, 0, + 10, 10, 10, 11, 11, 11, 11, 11, 25, 24, 25, 0, 0, 0, 0, 26, + 15, 19, 5, 20, 19, 36,186, 12, 12, 23, 0, 0, 0, 0, 73, 0, + 5, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 24, 5, 5, 19, 5, + 5, 5, 23, 11, 11, 11, 11, 11, 12, 12, 34, 46, 0, 0, 0, 0, + 1, 24, 12, 14, 0, 0, 0, 0, 1, 34, 15, 5, 5, 5, 5, 20, + 46, 1, 40, 12, 71, 5, 36, 19, 11, 11, 11, 11, 11, 40, 40, 12, + 10, 10, 51, 0, 0, 0, 0, 0, 5, 15, 20, 5, 12, 12, 12, 25, + 24, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 14, 14, 1, 1, 17, + 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, 1, 1, 40, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 24, 15, 19, 5, 5, 5, 23, 0, 0, + 5, 15, 17, 1, 1, 1, 14, 17, 14, 1, 17, 1, 1, 26, 25, 15, + 20, 15, 37, 35, 37, 35, 15, 0, 14, 0, 0, 35, 0, 0, 17, 1, + 1, 15, 0, 5, 5, 5, 23, 0, 5, 5, 23, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 17, 0, 14, 1, 1, 1, 17, 15, 19, 5, 5, + 23, 37, 35, 35, 15, 37, 15, 20, 25, 25, 12, 38, 33, 0, 0, 0, + 26, 23, 0, 0, 0, 0, 0, 0, 1, 1, 34, 15, 5, 5, 5, 5, + 15, 5, 20, 25, 1, 40, 12, 12, 11, 11, 11, 11, 11, 12, 38, 25, + 15, 19, 5, 5, 20, 20, 15, 19, 20, 5, 1, 53, 0, 0, 0, 0, + 15, 5, 5, 0, 15, 15, 5, 19, 36, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 1, 1, 5, 0, 15, 19, 5, 5, 5, 20, 19, 19, + 36, 12, 14, 0, 0, 0, 0, 0, 12, 12, 12, 12, 12, 12, 33, 0, + 1, 1, 1, 1, 1, 24, 19, 15, 5, 5, 5, 19, 40, 0, 0, 0, + 11, 11, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 14, 26, 19, + 15, 5, 5, 19, 5, 5, 0, 0, 11, 11, 11, 11, 11, 10, 12, 57, + 5, 5, 5, 5, 19, 36, 0, 0, 10, 51, 0, 0, 0, 0, 0, 17, + 1, 1, 1, 14, 17, 0, 1, 1, 1, 1, 17, 14, 1, 1, 1, 1, + 15, 15, 15, 35, 37, 26, 20, 25, 46, 19, 12, 33, 0, 0, 0, 0, + 1, 1, 1, 1, 0, 1, 1, 1, 34, 15, 5, 5, 0, 5, 15, 15, + 25, 53, 37, 0, 0, 0, 0, 0, 24, 5, 5, 5, 5, 25, 1, 1, + 1, 24, 5, 5, 20, 24, 5, 36, 12, 12, 12, 71, 0, 0, 0, 0, + 24, 5, 5, 20, 19, 5, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, + 5, 5, 5, 20, 5, 12, 53, 12, 12, 33, 0, 0, 0, 0, 0, 0, + 12, 12, 12, 12, 12, 0, 0, 0, 20, 5, 20, 20, 0, 0, 0, 0, + 40, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 23, 5, 5, 5, 19, + 40, 12, 12, 0, 0, 0, 0, 0, 12, 1, 1, 1, 1, 1, 1, 1, + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 35, 5, 5, 5, + 20, 5, 19, 23, 0, 0, 0, 0, 1, 1, 1, 14, 1, 17, 1, 1, + 24, 5, 5, 23, 0, 23, 5, 26, 5, 5, 5, 24, 0, 0, 0, 0, + 1, 1, 1, 17, 14, 1, 1, 1, 1, 1, 1, 1, 1, 15, 15, 37, + 5, 35, 19, 19, 14, 0, 0, 0, 1, 1, 1, 1, 45, 1, 0, 0, + 1, 24, 20, 83, 33, 0, 0, 0, 5, 34, 1, 1, 1, 1, 1, 1, + 1, 1, 15, 5, 5, 23, 0, 15, 20, 36, 12, 12, 12, 12, 12, 12, + 11, 11, 11, 11, 11, 23, 0, 0, 10, 10, 63, 3, 3, 3, 70, 30, + 97, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 38, + 16, 16, 16, 16, 16, 16, 16, 99, 12, 12, 33, 0, 0, 0, 0, 0, + 40, 33, 0, 0, 0, 0, 0, 0, 25, 1, 1, 24, 5, 5, 5, 5, + 5, 5, 5, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 15, 19, 5, + 5, 5, 36, 0, 0, 0, 0, 0, 5, 5, 5, 36, 12, 12, 3, 3, + 13, 13, 57, 0, 0, 0, 0, 0, 11, 11, 11, 11, 11, 49, 10, 10, + 10, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 17, 1, + 13, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 45,132, 12, + 10, 10, 10, 78, 12, 33, 0, 0, 7, 7, 7, 7, 32, 42, 6, 6, + 6, 6, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 14, 0, 26, + 34, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 26, + 5, 81, 13, 13, 13, 13, 13, 13, 13, 62, 23, 0, 0, 0, 0, 0, + 15, 13, 16, 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, + 13, 13, 54, 13, 13, 13, 54, 61, 0, 14, 0, 0, 0, 0, 0, 0, + 1, 14, 17, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 0, 43, 36, 18, 18, 0, 0, 0, 0, 0, 0, + 11, 11, 11, 11, 11, 3, 29, 0, 3, 3, 0, 0, 0, 3, 3, 3, + 98, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 29, 44, 3, 3, 3, + 3, 3,134, 19, 5, 3,134, 15, 15,187, 18, 18, 18, 91, 5, 5, + 5, 55, 43, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 5, 5, 3, + 3, 5, 55, 0, 0, 0, 0, 0, 6, 6, 47, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 32, 7, 0, 32, 39, 32, 39, 7, 32, 7, + 7, 7, 7, 6, 6, 42, 42, 6, 6, 6, 42, 6, 6, 6, 6, 6, + 6, 6, 7, 39, 7, 32, 39, 7, 7, 7, 32, 7, 7, 7, 32, 6, + 6, 6, 6, 6, 7, 39, 7, 32, 7, 7, 32, 32, 0, 7, 7, 7, + 32, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 0, 7, 7, 7, 7, + 59, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 60, 6, 6, + 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 59, 6, 6, + 6, 6, 60, 6, 6, 6, 7, 7, 7, 7, 59, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 60, 6, 6, 6, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 59, 6, 6, 6, 6, 60, 6, 6, 6, + 7, 7, 7, 7, 59, 6, 6, 6, 6, 60, 6, 6, 6, 8, 0, 11, + 5, 5, 5, 55, 3, 43, 5, 5, 5, 5, 5, 5, 5, 5, 55, 3, + 3, 3, 43, 3, 3, 3, 3, 3, 3, 3, 55, 66, 12, 12, 0, 0, + 0, 0, 0, 0, 0, 26, 5, 5, 6, 6, 6, 6, 6,124, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 47, 0, 0, 42, 6, 6, 47, 0, 0, + 5, 5, 5, 23, 5, 5, 5, 5, 5, 5, 5, 5, 23, 26, 5, 5, + 5, 26, 23, 5, 5, 23, 0, 0, 13, 13, 13, 13, 13, 13, 13, 0, + 0, 0, 0, 0, 0, 0, 0, 26, 5, 5, 5, 81, 13, 13, 13, 0, + 11, 11, 11, 11, 11, 0, 0, 56, 1, 1, 1, 1, 1, 1, 1, 23, + 1, 1, 1, 1, 1, 1, 5, 5, 11, 11, 11, 11, 11, 0, 0,113, + 1, 1, 1, 1, 1, 45, 5, 5,188, 11, 11, 11, 11,189, 0, 38, + 1, 24, 1, 25, 1, 1, 1, 5, 1, 1, 24, 0, 0, 0, 0, 45, + 1, 1, 1, 14, 1, 1, 17, 14, 1, 1, 14, 49, 10, 10, 10, 10, + 6, 6, 5, 5, 5, 81, 0, 0, 10, 10, 10, 10, 10, 10, 75, 10, + 190, 10, 51, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 10, 75, + 10, 10, 10, 10, 10, 10, 10, 0, 1, 1, 17, 1, 1, 1, 1, 1, + 17, 14, 14, 17, 17, 1, 1, 1, 1, 14, 1, 1, 17, 17, 0, 0, + 0, 14, 0, 17, 17, 17, 17, 1, 17, 14, 14, 17, 17, 17, 17, 17, + 17, 14, 14, 17, 1, 14, 1, 1, 1, 14, 1, 1, 17, 1, 14, 14, + 1, 1, 1, 1, 1, 17, 1, 1, 17, 1, 17, 1, 1, 17, 1, 1, + 9, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10, 63, 3, + 0, 0, 0, 3, 3, 3, 3, 3, 3, 29, 0, 0, 0, 0, 0, 0, + 3, 3, 3, 3, 3,108, 22, 22, 3, 3, 3, 3, 29, 0, 3, 3, + 9, 9, 9, 9, 98, 0, 0, 0, 3, 3, 3, 3, 3, 29, 0, 3, + 3, 3, 3, 29, 29, 0, 44, 3, 3, 3, 3, 3, 3, 3, 29, 44, + 3, 3, 3, 3, 3, 29, 0, 44, 3, 29, 3, 3, 3, 3, 3, 3, + 11, 11, 11, 11, 11, 29, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 7, 7, 3, 3, 26, 26, + 4, 4, 12, 12, 5, 5, 9, 9, 9, 5, 25, 25, 15, 15, 13, 13, + 21, 21, 6, 6, 7, 2, 10, 10, 14, 14, 2, 7, 1, 1, 10, 12, + 12, 10, 5, 9, 24, 24, 12, 2, 7, 12, 12, 7, 2, 12, 22, 18, + 0, 0, 26, 2, 23, 23, 18, 22, 9, 2, 21, 2, 7, 10, 2, 10, + 12, 21, 10, 2, 2, 21, 2, 9, 7, 21, 8, 8, 2, 5, 26, 12, + 2, 26, 7, 6, 10, 7, 5, 2, 25, 26, 2, 15, 26, 25, 15, 2, + 6, 7, 21, 7, 2, 6, 12, 26, 7, 26, 21, 26, 20, 19, 9, 25, + 5, 25, 6, 2, 21, 6, 15, 26, 25, 22, 18, 21, 26, 21, 5, 7, + 6, 24, 6, 5, 26, 23, 21, 12, 6, 12, 2, 1, 29, 29, 26, 15, + 21, 17, 25, 21, 15, 21, 11, 11, 21, 23, 12, 6, 26, 7, 10, 21, + 17, 17, 9, 26, 7, 15, 29, 21, 21, 9, 24, 5, 25, 9, 1, 12, + 17, 21, 11, 12, 8, 24, 26, 9, 21, 22, 23, 26, 25, 2, 14, 2, + 23, 21, 21, 25, 9, 22, 21, 18, 24, 16, 5, 22, 25, 18, 24, 26, + 26, 24, 9, 8, 8, 5, 5, 21, 15, 7, 2, 23, 21, 15, 17, 7, + 18, 2, 5, 6, 5, 24, 22, 20, 21, 20, 19, 21, 21, 16, 16, 21, + 7, 5, 5, 26, 14, 15, 18, 25, 7, 14, 17, 22, 17, 6, 24, 6, + 6, 21, 12, 15, 26, 10, 25, 0, 7, 20, 25, 1, 24, 15, 7, 19, + 9, 21, 17, 2, 17, 12, 1, 21, 12, 1, 24, 7, 29, 7, 7, 22, + 14, 7, 2, 24, 9, 24, 24, 2, 29, 1, 27, 28, 1, 29, 21, 29, + 1, 2, 15, 6, 18, 6, 12, 11, 26, 5, 14, 9, 5, 14, 26, 22, + 18, 26, 5, 12, 22, 21, 18, 17, 26, 6, 18, 18, 26, 14, 14, 6, + 12, 24, 11, 21, 24, 9, 6, 9, 6, 10, 7, 25, 17, 16, 16, 22, + 16, 16, 25, 17, 25, 24, 23, 2, 21, 14, 12, 17, 21, 1, 10, 1, + 7, 13, 13, 2, 23, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 0, 10, 11, 12, 13, 0, 14, 0, 0, 0, 0, 0, 15, 0, 16, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 20, 0, 21, 22, 23, 0, 0, 0, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, 0, 36, 0, 37, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, + 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, 45, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 9, 0, 0, + 0, 10, 11, 12, 13, 0, 14, 15, 16, 0, 17, 18, 19, 20, 21, 1, + 22, 1, 23, 1, 2, 1, 2, 1, 2, 0, 2, 1, 24, 1, 2, 25, + 2, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, 36, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 38, + 0, 0, 39, 0, 0, 40, 0, 41, 0, 0, 0, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 0, 0, 51, 0, 0, 0, 52, 0, 0, 0, 53, 0, + 0, 0, 0, 0, 0, 0, 54, 0, 3, 0, 55, 56, 0, 57, 0, 0, + 0, 0, 0, 0, 58, 59, 60, 0, 0, 0, 0, 61, 0, 0, 62, 63, + 64, 4, 65, 0, 0, 66, 67, 0, 0, 0, 68, 0, 0, 0, 0, 69, + 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 71, 0, 0, 0, 72, 0, 73, 0, 0, 74, 0, 0, 75, 0, + 0, 0, 0, 0, 0, 0, 0, 76, 77, 0, 0, 0, 0, 78, 79, 0, + 80, 81, 0, 0, 82, 5, 0, 83, 4, 0, 84, 85, 0, 0, 86, 87, + 88, 0, 89, 0, 90, 0, 91, 0, 0, 3, 92, 3, 0, 93, 0, 94, + 0, 0, 0, 5, 0, 0, 0, 95, 96, 0, 97, 98, 99,100, 0, 0, + 0, 0, 0, 3, 0, 0, 0, 0,101,102, 0, 0, 0, 0, 0, 0, + 103, 0, 0, 0, 0, 0, 0,104, 0, 0, 0, 0, 0, 0,105, 6, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,106, 0, 0,107, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,108,109, 0, 0,110, 0, 0, 0, + 0, 0, 0,111, 0,112, 0, 6, 0, 0, 0, 0, 0,113,114, 0, + 0, 0, 0, 0, 0, 0,115, 0, 0, 0,116, 0, 0, 0,117, 0, + 0, 0, 0, 0, 0, 0,118, 0,119, 0, 0, 0, 0, 0, 0, 0, + 2, 1, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 11, 0, 0, 0, + 14, 0, 0, 0, 16, 3, 17, 18, 19, 20, 21, 22, 0, 23, 0, 0, + 0, 0, 24, 25, 26, 27, 0, 0, 0, 0, 28, 0, 0, 29, 30, 0, + 31, 0, 32, 33, 0, 0, 34, 0, 35, 36, 0, 0, 0, 0, 0, 37, + 38, 0, 39, 40, 0, 0, 41, 0, 0, 0, 42, 0, 0, 43, 44, 45, + 46, 1, 47, 0, 0, 1, 0, 0, 7, 1, 48, 0, 0, 0, 0, 0, + 49, 50, 0, 0, 0, 0, 0, 0, 51, 52, 0, 0, 0, 0, 0, 0, + 53, 54, 0, 0, 0, 0, 55, 0, 56, 0, 0, 0, 57, 58, 0, 0, + 0, 59, 0, 0, 0, 0, 0, 0, 60, 12, 0, 0, 0, 0, 61, 0, + 0, 0, 62, 0, 5, 0, 63, 0, 0, 0, 0, 64, 0, 0, 0, 0, + 65, 0, 66, 0, 0, 0, 0, 6, 67, 0, 0, 0, 68, 69, 70, 71, + 0, 0, 0, 0, 72, 5, 0, 73, 74, 0, 0, 75, 0, 0, 0, 76, + 77, 0, 0, 0, 78, 0, 79, 80, 81, 82, 83, 3, 84, 0, 85, 86, + 87, 0, 0, 8, 9, 0, 0, 3, 3, 0, 0, 88, 0, 0, 89, 0, + 0, 0, 0, 8, 90, 0, 91, 0, 0, 0, 0, 0, 9, 10, 0, 92, + 0, 5, 0, 3, 9, 0, 0, 93, 0, 0, 94, 0, 0, 6, 0, 0, + 0, 0, 0, 0, 95, 96, 0, 0, 10, 0, 0, 1, 0, 0, 97, 0, + 0, 0, 0, 98, 0, 0, 0, 0, 12, 0, 0, 13, 0, 0, 0, 0, + 99,100, 0, 0,101, 0, 0,102, 0, 0, 0,103, 0, 0, 0,104, + 0, 0, 0,105, 0, 0, 0, 0,106,107, 13, 0, 0,108, 0, 0, + 0, 10, 0, 0,109,110, 0, 0,111,112, 0, 0, 0, 0, 0, 0, + 113, 0, 0,114, 0, 0, 0, 0,115, 1, 0,116,117,118, 6, 0, + 0,119, 7, 0, 0,120, 0, 0, 0,121, 0, 0, 0, 0, 0, 0, + 122, 0, 0,123, 0, 0, 0, 0,124, 11, 0, 0, 0, 0, 0, 6, + 0, 0, 0, 0, 5, 15, 0, 0, 0, 0,125, 0, 0,126, 0, 0, + 0, 0, 15, 0, 0,127, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, + 128, 0, 0, 0,129, 0,130, 0, 0, 0, 0,131,132,133, 0,134, + 0,135, 0, 0, 0,136,137,138, 0, 8, 0, 0, 0, 0, 0, 7, + 0, 0, 0,139, 0, 0, 0,140, 0, 0, 0,141, 0, 0, 0,142, + 143, 0,144, 0, 0,145, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, + 0, 9, 1, 1, 1, 1, 0, 0, 0, 2, 0, 3, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 19, 0, 0, 0, 6, 11, 0, 0, 0, 0, 14, + 0, 0, 15, 0, 0, 0, 0, 0, 0, 17, 29, 0, 0, 0, 0, 0, + 31, 0, 0, 2, 0, 0, 1, 12, 0, 0, 1, 49, 50, 5, 51, 52, + 53, 5, 5, 22, 32, 23, 1, 54, 24, 55, 16, 33, 56, 57, 58, 1, + 1, 1, 6, 1, 0, 0, 59, 7, 60, 1, 34, 5, 7, 61, 62, 63, + 64, 65, 66, 67, 0, 0, 1, 1, 68, 0, 0, 0, 69, 70, 71, 35, + 1, 25, 72, 0, 0, 0, 0, 8, 1, 26, 16, 26, 73, 27, 74, 0, + 0, 0, 36, 25, 75, 37, 7, 37, 76, 0, 0, 0, 6, 1, 7, 0, + 0, 17, 0, 8, 38, 1, 1, 13, 13, 11, 0, 0, 39, 0, 0, 6, + 18, 1, 0, 0, 8, 16, 5, 1, 1, 1, 77, 7, 36, 18, 78, 7, + 35, 1, 79, 10, 0, 0, 0, 80, 0, 0, 0, 0, 2, 3, 0, 0, + 14, 0, 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 83, 0, 0, 0, + 84, 0, 0, 0, 40, 0, 0, 85, 86, 0, 87, 88, 89, 90, 91, 92, + 0, 0, 0, 93, 0, 0, 0, 15, 28, 0, 0, 0, 0, 13, 0, 41, + 0, 0, 14, 0, 0, 20, 0, 0, 94, 0, 0, 0, 95, 0, 0, 6, + 29, 0, 0, 13, 1, 96, 1, 18, 33, 97, 25, 23, 7, 1, 1, 1, + 1, 27, 1, 7, 98, 0, 0, 9, 0, 0, 0, 0, 6, 23, 1, 0, + 0, 0, 0, 0, 30, 0, 0, 21, 0, 0, 30, 0, 0, 0, 0, 15, + 0, 0, 12, 32, 24, 5, 99, 22, 42, 17, 0, 10, 11, 0, 7, 1, + 7,100,101, 1, 1, 1, 1,102,103,104,105, 1,106, 10, 20,107, + 108, 5, 10, 0, 0, 0, 0, 0,109,110, 0, 0,111, 0, 0, 1, + 1, 11, 0, 0, 0, 8, 0, 0, 0, 3, 0, 0, 43, 40, 2, 0, + 0, 0, 44,112, 10, 8, 20, 0, 0, 0, 0, 0, 0,113, 1, 16, + 5, 24, 0, 8, 12, 0, 0, 0, 0,114, 0, 0,115, 2, 0,116, + 0, 0, 0, 1, 0, 0, 0, 0, 13, 11, 0, 0, 6, 10, 0, 0, + 45, 39, 0, 45, 16, 18, 46, 27, 0, 0, 3, 0, 0, 2, 12, 0, + 0, 0, 2, 3, 0, 0, 3, 0, 21, 0, 0, 31, 0, 0, 0, 0, + 117, 0, 0, 0, 15, 9, 0, 8, 1, 10, 1, 10, 0, 0, 0, 0, + 0, 30, 14, 21, 0, 0, 47, 0, 0, 0, 9, 0, 0, 0, 0, 47, + 0, 0, 0, 0, 2, 0, 0, 0, 0, 28, 0, 0, 4, 0, 21, 41, + 0, 0, 28, 0, 0, 0, 22, 42, 0, 0,118, 0, 0, 0, 0, 0, + 0,119, 0,120,121,122,123, 0, 43, 5, 48, 13, 34, 0, 0, 0, + 8, 11, 8, 10, 0, 0, 1, 12, 1, 1, 1, 1, 26, 1, 38, 44, + 12, 0, 0, 0, 0, 1, 0, 0, 0,124, 0, 0, 0, 46, 6, 19, + 0, 8, 0, 20, 0, 0, 5, 48, 0, 0, 0, 1,125, 0, 0, 0, + 0,230,230,230,230, 0, 0, 0, 9, 9, 0, 0, 0, 0, 9, 0, + 0,220,220,220,220, 0, 0, 0,230,230,230,220,230, 0, 0,230, + 230, 7, 0, 0, 0,230, 0, 0, 0,230,230, 0, 0,230,230,230, + 0, 0,230,230,230, 0, 0, 9, 0, 0, 0, 0, 7,230,230,230, + 220, 0,220, 0, 0,230,220,220,220, 0, 0,230, 0, 0,230, 0, + 0, 0, 0, 7, 0, 1, 1, 1, 1,220,230,230,230,220,220,230, + 230,220,230,230,220,230, 0, 0,230,230,220, 0, 0, 0, 9, 9, + 0,220, 0, 0, 0, 0, 0, 9, 9, 0, 9, 7, 0, 1,220,220, + 220,220,220,220,230,230,230,220,220,230,220,220,230,230,220,230, + 230,220,230,220,230,230,230, 0,230, 0,220,220,220,220,220, 0, + 0, 9, 9, 0, 0, 1, 0, 0, 0, 0, 0, 0,220,230, 0,230, + 230, 0, 0,220,220, 0, 0,230,220, 0, 0, 9, 7,220,220,220, + 0,230,232,220,220,220,220,232,216,220,202,202,220,220,220,220, + 202,202,220,220,220,230,240,230,220,230,220,220, 0,232,220,220, + 230,233,234,234,233,234,234,233,230, 0,220,230,230,230,230,222, + 220,230,222,228,230, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, + 20, 21, 22, 0, 23, 0, 24, 25, 0,230,220, 0, 18, 30, 31, 32, + 0, 0, 0, 0, 27, 28, 29, 30, 31, 32, 33, 34,230, 35, 0, 0, + 0,230, 0,220,230, 0, 36, 0, 0,220,220,230,220,220,230,230, + 0,230,230, 0,220, 27, 28, 29,230, 0,230,220,230, 0, 84, 91, + 0,103,103, 9, 0,107,107,107,107,118,118, 9, 0,122,122,122, + 122, 0,220, 0,220, 0,216, 0, 0, 0,129,130, 0,132, 0, 0, + 0, 0, 0,130,130,130,130, 0, 0,130, 0,230,230, 9, 0,230, + 230, 0, 0,220, 0, 0,228, 0, 0, 0,222,230,220,230, 0, 0, + 220,230,220, 0,220,230,230,230,234,230, 0, 1, 1,230,234,214, + 220,202,230,230,230,230,230,232,228,228,220,218,230,233,220,230, + 220,230,230, 1, 1, 1, 1, 1,230, 0, 1, 1,230,220,230, 1, + 1, 0, 0,218,228,232,222,224,224, 0, 8, 8, 0,220, 0, 0, + 230, 0, 0, 26, 0, 0,220, 0,230,230, 1,220, 0, 0,230,220, + 0, 0, 7, 9, 0, 6, 6, 0, 0, 0, 0, 1, 0, 0,216,216, + 1, 1, 1, 0, 0, 0,226,216,216,216,216,216, 0,232,232,220, + 230,230,230, 7, 0, 1, 0, 0, 32, 0, 48, 0, 0, 84, 96,135, + 144, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,176, 0, 0, 0, 0, 0, 0, 0, 0, 8, 16, 24, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 40, + 0, 0, 0, 0, 0, 48, 56, 64, 0, 0, 0, 0, 0, 72, 80, 88, + 96,104, 0, 0, 0, 0, 0, 0, 0, 0,112, 0,120, 0, 0, 0, + 0, 0, 0,128,136,144,152,160,168, 0, 0, 0,176,184,192, 0, + 0, 0, 0, 0, 0,200, 0, 0, 0, 0, 0, 0, 0, 0,208, 0, + 0,216,224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 36, 0, 0, 0, 24, 0, 0, 0, 24, 0, 0, 0, 0, 0, + 64, 0, 68, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 72, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 20, 0, 0, 0, 0, + 0, 0, 20, 0, 20, 0, 0, 0, 0, 0, 0, 0, 76, 80, 84, 88, + 0, 0, 12, 92, 96, 28, 0,100,104, 4, 4, 4,108, 44,112,116, + 120, 4,124, 0,128,132, 4, 4, 48,136,140, 0, 32, 0, 0, 0, + 40, 0, 0, 0, 0, 0, 0, 0, 4, 48, 0, 52,144, 20,148,152, + 4, 0, 0,156,160,164,168,172, 4, 0,176, 56, 60,180, 32, 0, + 16,184, 56, 0, 0, 0, 0, 0, 52, 12, 12, 0, 0, 0, 0, 12, + 0, 0,188, 8, 8, 8, 8,192,196, 8, 8, 8, 8,200,204,208, + 212, 60, 44, 0, 0, 0, 0, 0, 0, 0,216, 28,220, 0, 12, 4, + 16, 0, 0, 0, 0,224,228, 0, 0, 0, 0, 0, 4,232, 32, 0, + 0, 0, 0, 0, 0, 0,236, 12, 0, 0, 0, 0, 16, 0, 36, 0, + 0, 0, 24, 0, 0, 0,240,244, 0, 0, 0, 0, 2, 2, 2, 2, + 4, 4, 4, 4, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 6, 8, + 0, 10, 12, 0, 0, 2, 2, 0, 2, 2, 0, 0, 0, 0, 14, 16, + 6, 8, 0, 0, 4, 8, 0, 0, 2, 2, 2, 0, 0, 6, 4, 8, + 2, 0, 2, 0, 0, 0, 0, 6, 0, 20, 0, 0, 0, 22, 0, 0, + 0, 6, 8, 0, 24, 26, 28, 0, 0, 0, 30, 0, 0, 0, 0, 32, + 34, 36, 38, 0, 0, 40, 42, 0, 0, 0, 18, 0, 0, 0, 2, 2, + 2, 2, 0, 2, 2, 2, 0, 6, 44, 0, 0, 0, 0, 2, 0, 46, + 48, 50, 0, 0, 52, 0, 0, 0, 6, 4, 54, 0, 2, 0, 0, 2, + 2, 56, 58, 60, 0, 62, 64, 18, 2, 10, 12, 0, 0, 0, 66, 8, + 0, 2, 2, 2, 0, 6, 4, 4, 4, 4, 68, 2, 70, 4, 4, 4, + 8, 72, 0, 0, 74, 76, 2, 0, 78, 0, 0, 0, 4, 8, 2, 0, + 0, 0, 80, 0, 6, 4, 4, 4, 4, 8, 0, 2, 2, 2, 2, 6, + 4, 4, 4, 8, 0, 0, 0, 82, 0, 84, 86, 0, 0, 0, 2, 88, + 0, 0, 0, 90, 6, 8, 2, 0, 0, 0, 6, 4, 4, 4, 8, 0, + 2, 0, 2, 2, 6, 4, 4, 8, 0, 10, 12, 6, 8, 2, 0, 0, + 4, 5, 6, 7, 8, 9, 10, 1, 1, 11, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 12, 13, 2, 2, 2, 2, 14, 0, 0, 0, 0, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 0, 0, 25, 26, 3, 3, + 3, 27, 0, 0, 0, 28, 29, 30, 0, 31, 32, 33, 34, 35, 36, 37, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 38, 1, 1, 39, 1, 40, 1, 1, 1, 41, 0, 42, + 1, 1, 43, 1, 1, 1, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 20, 21, 8, 8, 8, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 2, 2, 51, 52, 53, 54, 9, 9, 9, 9, 9, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 8, 8, 70, + 71, 72, 73, 74, 75, 5, 5, 5, 5, 76, 5, 5, 5, 5, 5, 5, + 5, 15, 15, 5, 5, 5, 5, 77, 5, 78, 79, 80, 81, 82, 83, 1, + 84, 85, 86, 87, 88, 89, 90, 91, 5, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 92, 1, 1, 1, + 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 93, 16, 16, 94, 95, 96, + 97, 98, 99,100,101,102,103,104,105, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 106, 0, 0, 1, 1,107,108,109, 13, 13, 13,110,111,112,113,114, + 115,116,117,118,119, 0,120,121,122,123,124,125,126, 17, 17,127, 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, - 144,145,146,147,148,149,150,151,152,153,154,155,156,157, 0, 0, - 0,158,159,160,161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 144,145,146,147,148,149,150,151,152,153,154, 0,155,156,157,158, + 0,159,160,161,162,163,164,165,166,167,168,169,170, 0,171,172, + 173, 7, 7, 7, 7, 7, 7, 7,174,175, 7,176, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 177, 4, 4, 4, 4, 4, 4, 4, 4,178, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4,179, 11, 11, 11, 11,180, 0, 0, + 0, 0, 0,181, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 12, 12, 12, 12,182,183,184,185, 0, 0,186, 0,187,188,189, + 190, 3, 3, 3, 3, 3, 3, 14, 14, 14,191,192,193, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 194,195,196,197, 18, 18,198, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,199,200, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,201, 5, 5, 5,202,203, + 204, 5,205,206,207,208,209,210, 0,211,212,213, 5, 5,214, 5, + 215, 10, 10, 10, 10, 10,216, 0, 0, 0, 0, 0, 0, 0, 0,217, + 0,218,219,220, 0, 0,221, 0, 0, 0,222, 0,223, 0,224, 0, + 225,226,227,228, 0, 0, 0, 0, 0,229,230,231, 0,232,233, 0, + 0,234,235, 5,236,237, 0, 5, 5, 5, 5, 5, 5, 5,238, 5, + 239,240,241, 5, 5,242,243, 5,244, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,245, 1, + 1,246, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,247, 1, + 1, 1, 1, 1, 1, 1, 1, 1,248, 1, 1, 1, 1,249, 0, 0, + 0, 1, 1, 1, 1,250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 1, 1, 1,251, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1,252, 0, 0, 0, 0, 0, 0, + 0,253, 0, 19, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 2, 2, 2, 2, 13, 13, 13, 13, 12, 12, 12, 12, 0, 0, 0, + 0,136,136,136,136, 80, 80, 80, 80, 19, 19, 19, 19, 3, 3, 3, + 3, 63, 63, 63, 63, 39, 39, 39, 39, 28, 28, 28, 28,131,131,131, + 131, 79, 79, 79, 79, 1, 1, 1, 1,127,127,127,127, 6, 6, 6, + 6,155,155,155,155, 9, 9, 9, 9, 30, 30, 30, 30,139,139,139, + 139, 15, 15, 15, 15,110,110,110,110, 77, 77, 77, 77, 17, 17, 17, + 17, 27, 27, 27, 27, 33, 33, 33, 33,113,113,113,113, 49, 49, 49, + 49, 25, 25, 25, 25, 29, 29, 29, 29, 7, 7, 7, 7, 8, 8, 8, + 8, 32, 32, 32, 32, 99, 99, 99, 99, 31, 31, 31, 31,105,105,105, + 105, 55, 55, 55, 55, 62, 62, 62, 62, 56, 56, 56, 56, 91, 91, 91, + 91,119,119,119,119, 14, 14, 14, 14, 94, 94, 94, 94, 20, 20, 20, + 20,100,100,100,100,130,130,130,130,157,157,157,157,137,137,137, + 137, 97, 97, 97, 97,123,123,123,123,133,133,133,133,146,146,146, + 146, 84, 84, 84, 84,159,159,159,159,132,132,132,132, 4, 4, 4, + 4, 36, 36, 36, 36, 24, 24, 24, 24, 30, 30, 30, 2, 35, 35, 35, + 35, 40, 40, 40, 40,124,124,124,124,125,125,125,125,140,140,140, + 140, 37, 37, 37, 37, 58, 58, 58, 58, 0, 0, 2, 2, 75, 75, 75, + 75, 68, 68, 68, 68,114,114,114,114,163,163,163,163, 22, 22, 22, + 22, 23, 23, 23, 23, 76, 76, 76, 76, 0, 0, 0, 2, 26, 26, 26, + 26, 87, 87, 87, 87,135,135,135,135, 89, 89, 89, 89,141,141,141, + 141, 70, 70, 70, 70, 92, 92, 92, 92, 96, 96, 96, 96, 5, 5, 5, + 5, 18, 18, 18, 18, 48, 48, 48, 48, 85, 85, 85, 85,109,109,109, + 109,102,102,102,102,151,151,151,151, 16, 16, 16, 16, 0, 2, 2, + 2,165,165,165,165,108,108,108,108,171,171,171,171,142,142,142, + 142,150,150,150,150,134,134,134,134,138,138,138,138, 64, 64, 64, + 64, 90, 90, 90, 90, 21, 21, 21, 21, 93, 93, 93, 93, 61, 61, 61, + 61, 65, 65, 65, 65, 78, 78, 78, 78,126,126,126,126,154,154,154, + 154,121,121,121,121,166,166,166,166,167,167,167,167,152,152,152, + 152, 10, 10, 10, 10, 2, 0, 0, 0,104,104,104,104,170,170,170, + 170, 57, 57, 57, 57,107,107,107,107,175,175,175,175, 38, 38, 38, + 38, 73, 73, 73, 73, 86, 86, 86, 86, 67, 67, 67, 67, 59, 59, 59, + 59, 51, 51, 51, 51,161,161,161,161,144,144,144,144,143,143,143, + 143,172,172,172,172,174,174,174,174, 60, 60, 60, 60, 69, 69, 69, + 69, 47, 47, 47, 47,112,112,112,112,118,118,118,118,106,106,106, + 106,156,156,156,156,147,147,147,147,148,148,148,148,169,169,169, + 169,164,164,164,164,168,168,168,168, 11, 11, 11, 11, 74, 74, 74, + 74, 42, 42, 42, 42, 50, 50, 50, 50,116,116,116,116,111,111,111, + 111,115,115,115,115, 52, 52, 52, 52, 13, 13, 2, 2,120,120,120, + 120, 98, 98, 98, 98, 88, 88, 88, 88,117,117,117,117,101,101,101, + 101,103,103,103,103, 19, 19, 19, 0, 95, 95, 95, 95, 30, 30, 2, + 2, 34, 34, 34, 34, 54, 54, 54, 54, 0, 2, 0, 0, 71, 71, 71, + 71, 53, 53, 53, 53, 81, 81, 81, 81, 66, 66, 66, 66, 83, 83, 83, + 83,153,153,153,153,160,160,160,160, 2, 2, 22, 22, 30, 2, 30, + 30, 9, 9, 2, 2, 2, 2, 0, 0, 41, 41, 41, 41, 72, 72, 72, + 72,173,173,173,173, 82, 82, 82, 82,158,158,158,158,129,129,129, + 129,145,145,145,145, 2, 3, 3, 3, 23, 2, 23, 23, 16, 2, 16, + 16, 2, 2, 2, 0, 45, 45, 45, 45, 44, 44, 44, 44, 43, 43, 43, + 43,128,128,128,128,122,122,122,122,149,149,149,149, 0, 19, 19, + 19, 0, 0, 19, 0, 9, 2, 9, 9, 5, 2, 2, 5, 2, 10, 10, + 10, 10, 10, 2, 10, 2, 21, 21, 21, 21, 2, 2, 21, 22, 22, 22, + 2, 22, 22, 2, 2, 20, 2, 20, 20, 2, 30, 30, 30, 12, 12, 12, + 2, 19, 19, 19, 2, 2, 2, 12, 12,161,161, 2,161, 3, 3, 3, + 2,107, 2, 2,107, 2, 3, 2, 3, 19, 0, 0, 0, 2, 2, 9, + 9, 9, 9, 9, 2, 2, 4, 4, 4, 2, 11, 11, 11, 11, 11, 11, + 2, 11, 2, 11, 11, 10, 10, 2, 2, 22, 2, 22, 22, 2, 2, 2, + 22, 23, 23, 2, 2, 2, 36, 36, 36, 2, 2, 36, 36, 2, 25, 25, + 25, 46, 46, 46, 46, 31, 31, 2, 2, 91, 91, 2, 2, 1, 0, 0, + 0, 1, 1, 0, 0, 0, 17, 17, 17, 49, 49, 49, 2,161,161,161, + 2, 2,107,107,107,107, 2, 2, 2,171,171, 2,171, 0, 0, 2, + 0, 2, 3, 3, 2, 3, 2, 2, 3, 4, 4, 4, 2, 2, 14, 14, + 14, 14, 14, 14, 2, 3, 0, 3, 3, 0, 3, 3, 3, 3, 3, 3, + 0, 37, 37, 37, 2, 3, 3, 2, 2, 2, 2, 2, 3, 2, 2, 5, + 5, 5, 5, 5, 2, 2, 2, 2, 11, 11, 2, 2, 11, 11, 11, 2, + 2, 10, 2, 10, 10, 21, 2, 21, 21, 21, 21, 2, 2, 22, 2, 2, + 2, 2, 16, 16, 16, 16, 16, 2, 2, 36, 36, 36, 2, 36, 2, 2, + 2, 18, 18, 18, 2, 18, 18, 2, 2, 25, 2, 25, 25, 8, 8, 2, + 8, 2, 8, 2, 2, 29, 29, 2, 2, 46, 2, 46, 46, 32, 2, 2, + 2, 1, 1, 2, 2, 1, 1, 1, 0, 19, 19, 9, 9, 2, 9, 2, + 9, 0, 0, 0, 19, 19, 2, 2, 2, 0, 0, 19, 19, 2, 2, 2, + 61, 15, 15, 15, 2, 17, 17, 17, 0, 2, 19, 19, 19, 75, 75, 2, + 2, 12, 2, 2, 2, 68, 68, 2, 2, 87, 87, 2, 2, 49, 49, 2, + 2, 50, 50, 2, 2, 2, 57, 57, 57, 57, 2, 2, 2,112,112,112, + 2, 2,122,122,122,130,130,130, 2,165,165, 2, 2,156,156, 2, + 2, 2, 2, 3, 3, 94, 94, 2, 2,129,129, 2,129,107, 2,107, + 107,123,123, 2, 2,102,102, 2, 2,126,126,126, 2,154,154,154, + 2, 2, 2,150,150,169,169, 2, 2,138,138,138, 2,138,138, 2, + 138,143,143, 2,143,163,163,163, 2,103,103, 2, 2,119,119, 2, + 119, 2, 2, 2, 99, 13, 13, 13, 2,136,136,136, 2,105, 2, 2, + 2, 0, 0, 0, 1, 56, 56, 56, 2,151,151, 2, 2, 3, 3, 2, + 3, 0, 0, 26, 26, 0, 9, 9, 9, 9, 9, 0, 9, 9, 0, 9, + 0, 9, 9, 2, 9, 9, 9, 55, 55, 6, 1, 1, 6, 2, 2, 2, + 14, 14, 2, 2, 2, 3, 3, 3, 1, 1, 1, 3, 3, 1, 3, 3, + 3, 37, 37, 2, 37, 2, 37, 37, 37, 38, 38, 2, 2, 64, 64, 64, + 2, 2, 64, 64, 64, 90, 90, 2, 2, 90, 90, 90, 2, 2, 2, 95, + 2, 3, 3, 0, 3, 7, 1, 1, 1, 1, 7, 7, 7, 0, 0, 7, + 7, 2, 5, 5, 5, 5, 2, 5, 5, 5, 2, 5, 2, 5, 5, 2, + 2, 2, 2, 2, 5, 5, 5, 2, 5, 2, 11, 11, 2, 2, 11, 2, + 2, 11, 2, 11, 2, 2, 2, 11, 11, 10, 2, 2, 2, 2, 2, 10, + 10, 21, 21, 2, 21, 2, 2, 21, 21, 2, 22, 22, 22, 2, 22, 22, + 2, 2, 23, 23, 2, 23, 23, 23, 2, 2, 2, 23, 23, 2, 2, 2, + 23, 2, 16, 16, 2, 16, 16, 16, 2, 2, 2, 16, 16, 2, 2, 20, + 20, 36, 36, 2, 36, 2, 36, 2, 2, 2, 2, 36, 2, 2, 2, 2, + 36, 36, 2, 36, 2, 2, 24, 24, 24, 24, 24, 24, 2, 2, 18, 18, + 2, 18, 2, 18, 18, 2, 18, 2, 18, 18, 2, 18, 2, 25, 2, 2, + 2, 25, 0, 0, 0, 0, 25, 25, 2, 8, 8, 8, 0, 30, 2, 2, + 2, 34, 2, 2, 2, 35, 35, 35, 0, 0, 0, 35, 35, 35, 2, 2, + 2, 45, 45, 2, 2, 2, 2, 2, 45, 44, 0, 0, 2, 32, 32, 0, + 0, 32, 0, 32, 32, 32, 32, 2, 2, 32, 32, 32, 2, 28, 28, 2, + 2, 48, 48, 48, 2, 48, 2, 2, 2, 52, 52, 2, 2, 52, 2, 2, + 2, 58, 58, 2, 2, 58, 58, 58, 2, 2, 2, 58, 58, 2, 2, 54, + 54, 91, 91, 91, 2, 91, 2, 2, 91, 62, 2, 62, 62, 2, 2, 2, + 70, 70, 70, 2, 2, 2, 70, 70, 70, 6, 6, 6, 2, 8, 8, 8, + 2, 2, 8, 8, 8, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, + 2, 9, 9, 9, 6, 19, 9, 9, 9, 9, 9, 19, 19, 9, 9, 9, + 19, 6, 19, 19, 19, 19, 19, 19, 9, 2, 9, 9, 9, 0, 19, 2, + 2, 1, 2, 2, 2, 0, 0, 9, 0, 2, 55, 55, 55, 61, 2, 2, + 2, 13, 13, 2, 13, 0, 13, 0, 13, 0, 13, 13, 13, 13, 13, 1, + 1, 1, 1, 12, 12, 2, 15, 15, 15, 2, 1, 1, 0, 0, 15, 15, + 15, 2, 26, 26, 26, 2, 12, 12, 12, 12, 12, 12, 0, 39, 2, 2, + 2, 39, 39, 39, 2, 60, 2, 2, 2, 2, 2, 75, 75, 69, 69, 0, + 69, 2, 2, 2, 74, 84, 84, 2, 0, 84, 84, 2, 2, 2, 2, 84, + 84, 33, 33, 33, 2, 68, 68, 68, 2, 92, 92, 92, 2, 2, 2, 2, + 92, 87, 87, 87, 2, 19, 9, 19, 19, 19, 19, 0, 0, 2, 2, 2, + 12, 2, 2, 2, 4, 14, 2, 14, 2, 14, 14, 2, 14, 14, 2, 14, + 14, 3, 3, 0, 0, 1, 1, 6, 6, 3, 2, 3, 3, 3, 2, 2, + 0, 0, 0, 17, 17, 17, 17, 0, 0, 2, 49, 49, 49, 49, 49, 2, + 49, 9, 2, 2, 2, 0, 1, 2, 2, 71, 2, 2, 2, 67, 2, 2, + 2, 2, 42, 42, 42, 41, 41, 41, 2,118,118,118, 2, 53, 53, 2, + 53, 59, 59, 2, 2, 2, 2, 2,104,161, 2, 2, 2,110,110,110, + 2,110,110, 2, 2, 19, 19, 2, 19, 19, 2, 19, 19, 47, 47, 2, + 2, 47, 2, 47, 47, 47, 47, 2, 47, 47, 2, 2, 2, 47, 2, 2, + 47, 81, 81, 2, 81,116,116,116, 2, 2, 2, 2,116,128,128,128, + 2,128,128, 2, 2, 2, 2, 2,128, 2, 2, 2, 66, 72, 72, 2, + 2, 2, 2, 2, 72,173,173, 2, 2, 2, 2, 97, 97, 2, 57, 57, + 2, 57, 57, 2, 2, 57, 57, 57, 2, 2, 2, 2, 57, 2, 2, 2, + 112, 78, 78, 2, 2, 2, 78, 78, 78, 83, 83, 2, 2, 82, 82, 82, + 2,122,122, 2, 2,122, 2, 2, 2, 89, 2, 2, 2, 2, 2,130, + 130,144,144, 2, 2, 2,165,165,165, 2, 2,165,165,156,156, 2, + 156, 3, 2, 2, 2,148,148, 2, 2,158,158, 2, 2,149,149,149, + 2, 2, 2, 94, 94, 2, 2, 2, 94, 85, 85, 85, 2, 2, 85, 2, + 2,101, 2, 2, 2,101,101, 2, 2, 96, 2, 96, 96,111,111,111, + 2,108,108, 2,108,108,108, 2, 2,129,129,129, 2,129, 2,129, + 129,129,129, 2, 2,109,109,109, 2,109,109, 2, 2,107,107, 2, + 1,107,107, 2, 2, 2, 2, 2,107, 2, 2,107,107, 2, 2,171, + 2,171, 2,171, 2, 2,171, 2,171,171,171,171, 2,171, 2, 2, + 2, 2,171,171, 2, 2,137,137,137,137,137, 2, 2,124,124, 2, + 2,114, 2, 2, 2,114,114, 2, 2, 2,126,126,126,125,125,125, + 2, 2, 2, 2,125, 2,154, 2, 2, 2,154,154, 2,154,154, 2, + 154,154, 2, 2,154,154,154, 2, 2,150, 2, 2, 2,140,140,140, + 2,121, 2, 2, 2, 7, 7, 2, 2,133, 2,133,133,133,133,133, + 2,133,133, 2, 2,133, 2, 2, 2, 2, 2,134,134, 2,134,134, + 134,134,134,134, 2, 2, 2,138, 2,138,138, 2, 2,143, 2,143, + 143,143,143,143, 2,143, 2, 2, 2,143,143, 2, 2,175,175, 2, + 2,145, 2, 2, 2,163, 2,163,163, 2, 2,163,163, 86, 2, 2, + 2, 63, 63, 2, 2, 63, 63, 63, 2, 63, 2, 2, 2,157,157,157, + 2, 80, 80, 2, 2, 80, 80, 80, 2,127,127,127, 2,166,166, 2, + 2, 79, 2, 2, 2,115,115,115, 2,115,115, 2, 2, 2, 2,115, + 115,159,159,159, 2,159,159, 2, 2,119,119, 2, 2, 2,119,119, + 119,167,167, 2, 2,146,146,146, 2,172, 2, 2,172, 99, 99, 99, + 2,136,139, 13, 13,155, 2, 2, 2,155,155, 2, 2, 2, 2, 2, + 155, 2, 17, 17, 17, 2, 17, 17, 2, 17, 15, 15, 15, 17, 17, 17, + 2, 2, 2, 15, 2, 2, 17, 2, 2,105,105,105, 2,105,105, 2, + 2, 1, 1, 1, 2, 0, 1, 1, 1, 0, 0, 1, 1, 2, 2, 0, + 2, 2, 0, 0, 2, 0, 2, 0, 2, 2, 2, 2,131, 2,131,131, + 131, 56, 2, 2, 56, 56, 56, 2, 56, 56, 2, 56, 56, 6, 6, 2, + 2, 2, 2, 2, 6,151, 2, 2, 2, 2, 2,151,151,160,160,160, + 2,152,152, 2, 2, 2, 2, 2,152,164,164, 2, 2,168,168,168, + 2, 2, 2, 2,168,174,174,174, 2,174,174, 2, 2, 2, 2,174, + 174, 2, 30, 30, 2,113, 2, 2,113,113,113,113, 2,132,132, 2, + 2, 2, 2,132,132, 2, 2, 3, 2, 3, 2, 3, 2, 15, 0, 0, + 2, 0, 2, 2, 0, 13, 2, 2, 2, 2, 0, 2, 2, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 10, 0, 11, 12, 13, 0, + 0, 0, 14, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,162, 0,163, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,164,165, 0, 0, 0, 0, 0, - 0, 0,166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,167, 0, 0, 0,168,169, 0, 0,170, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,171, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,172, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 0, 0, 0, 0, 18, + 0, 0, 0, 0, 0, 19, 20, 21, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, + 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0,175, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0,176,177, 0, 0, 0, 0,178,179, 0, 0, 0, - 180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195, - 196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211, - 212,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, + 0, 0, 24, 25, 26, 27, 28, 29, 30, 0, 0, 31, 32, 0, 33, 0, + 34, 0, 35, 0, 0, 0, 0, 36, 37, 38, 39, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 41, 42, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 44, 0, + 45, 0, 0, 0, 0, 0, 0, 46, 47, 0, 0, 0, 0, 0, 48, 0, + 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, + 51, 0, 0, 0, 52, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, 54, + 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 56, + 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, + 59, 60, 61, 62, 63, 64, 65, 0, 0, 0, 0, 0, 0, 66, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 68, 0, 69, 70, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,104, 0, 0, + 0, 0, 0, 0,105,106, 0,107, 0, 0, 0,108, 0,109, 0,110, + 0,111,112,113, 0,114, 0, 0, 0,115, 0, 0, 0,116, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,117, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,118, + 119,120,121, 0,122,123,124,125,126, 0,127, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,129,130,131,132, + 133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148, + 149,150,151,152,153,154,155,156,157, 0, 0, 0,158,159,160,161, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,162, 0,163, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,164,165, 0, 0, 0, 0, 0, 0, 0,166, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,167, + 0, 0, 0,168,169, 0, 0,170, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,171, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,172, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,173, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,174, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0,175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 176,177, 0, 0, 0, 0,178,179, 0, 0, 0,180,181,182,183,184, + 185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200, + 201,202,203,204,205,206,207,208,209,210,211,212,213, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const uint16_t _hb_ucd_u16[10904]= +static const uint16_t _hb_ucd_u16[10877]= { - 0, 0, 1, 2, 3, 4, 5, 6, 0, 0, 7, 8, 9, 10, 11, 12, - 13, 13, 13, 14, 15, 13, 13, 16, 17, 18, 19, 20, 21, 22, 13, 23, - 13, 13, 13, 24, 25, 11, 11, 11, 11, 26, 11, 27, 28, 29, 30, 31, - 32, 32, 32, 32, 32, 32, 32, 33, 34, 35, 36, 11, 37, 38, 13, 39, - 9, 9, 9, 11, 11, 11, 13, 13, 40, 13, 13, 13, 41, 13, 13, 13, - 13, 13, 13, 42, 9, 43, 11, 11, 44, 45, 32, 46, 47, 48, 49, 50, - 51, 52, 48, 48, 53, 32, 54, 55, 48, 48, 48, 48, 48, 56, 57, 58, - 59, 60, 48, 32, 61, 48, 48, 48, 48, 48, 62, 63, 64, 48, 65, 66, - 48, 67, 68, 69, 48, 70, 71, 48, 72, 73, 48, 48, 74, 32, 75, 32, - 76, 48, 48, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 83, 84, 91, 92, 93, 94, 95, 96, 97, 84, 98, 99, 100, 88, 101, - 102, 83, 84, 103, 104, 105, 88, 106, 107, 108, 109, 110, 111, 112, 94, 113, - 114, 115, 84, 116, 117, 118, 88, 119, 120, 115, 84, 121, 122, 123, 88, 124, - 125, 115, 48, 126, 127, 128, 88, 129, 130, 131, 48, 132, 133, 134, 94, 135, - 136, 48, 48, 137, 138, 139, 140, 140, 141, 48, 142, 143, 144, 145, 140, 140, - 146, 147, 148, 149, 150, 48, 151, 152, 153, 154, 32, 155, 156, 157, 140, 140, - 48, 48, 158, 159, 160, 161, 162, 163, 164, 165, 9, 9, 166, 11, 11, 167, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 168, 169, 48, 48, 168, 48, 48, 170, 171, 172, 48, 48, - 48, 171, 48, 48, 48, 173, 174, 175, 48, 176, 9, 9, 9, 9, 9, 177, - 178, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 179, 48, 180, 181, 48, 48, 48, 48, 182, 183, - 48, 184, 48, 185, 48, 186, 187, 188, 48, 48, 48, 189, 190, 191, 192, 193, - 194, 192, 48, 48, 195, 48, 48, 196, 197, 48, 198, 48, 48, 48, 48, 199, - 48, 200, 201, 202, 203, 48, 204, 205, 48, 48, 206, 48, 207, 208, 209, 209, - 48, 210, 48, 48, 48, 211, 212, 213, 192, 192, 214, 215, 32, 216, 217, 140, - 218, 48, 48, 219, 220, 160, 221, 222, 223, 48, 224, 64, 48, 48, 225, 226, - 48, 48, 227, 228, 229, 64, 48, 230, 231, 9, 9, 232, 233, 234, 235, 236, - 11, 11, 237, 27, 27, 27, 238, 239, 11, 240, 27, 27, 32, 32, 32, 32, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 241, 13, 13, 13, 13, 13, 13, - 242, 243, 242, 242, 243, 244, 242, 245, 246, 246, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 273, 274, 275, 276, 209, 277, 278, 209, 279, - 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, 280, - 281, 209, 282, 209, 209, 209, 209, 283, 209, 284, 280, 285, 209, 286, 287, 209, - 209, 209, 176, 140, 288, 140, 272, 272, 272, 289, 209, 209, 209, 209, 290, 272, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 291, 292, 209, 209, 293, - 209, 209, 209, 209, 209, 209, 294, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 209, 209, 295, 296, 272, 297, 209, 209, 298, 280, 299, 280, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 280, 280, 280, 280, 280, 280, 280, 280, 300, 301, 280, 280, 280, 302, 280, 303, - 209, 209, 209, 280, 304, 209, 209, 305, 209, 209, 209, 209, 209, 209, 209, 209, - 9, 9, 9, 11, 11, 11, 306, 307, 13, 13, 13, 13, 13, 13, 308, 309, - 11, 11, 310, 48, 48, 48, 311, 312, 48, 313, 314, 314, 314, 314, 32, 32, - 315, 316, 317, 318, 319, 320, 140, 140, 209, 321, 209, 209, 209, 209, 209, 322, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 323, 140, 209, - 324, 325, 326, 327, 136, 48, 48, 48, 48, 328, 178, 48, 48, 48, 48, 329, - 330, 48, 48, 136, 48, 48, 48, 48, 200, 331, 48, 48, 209, 209, 332, 48, - 209, 333, 334, 209, 335, 336, 209, 209, 334, 209, 209, 336, 209, 209, 209, 209, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 209, 209, 209, 209, - 48, 337, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 151, 209, 209, 209, 338, 48, 48, 230, - 339, 48, 340, 140, 13, 13, 341, 342, 13, 343, 48, 48, 48, 48, 344, 345, - 31, 346, 347, 348, 13, 13, 13, 349, 350, 351, 352, 353, 354, 355, 140, 356, - 357, 48, 358, 359, 48, 48, 48, 360, 361, 48, 48, 362, 363, 192, 32, 364, - 64, 48, 365, 48, 366, 367, 48, 151, 76, 48, 48, 368, 369, 370, 371, 372, - 48, 48, 373, 374, 375, 376, 48, 377, 48, 48, 48, 378, 379, 380, 381, 382, - 383, 384, 314, 11, 11, 385, 386, 11, 11, 11, 11, 11, 48, 48, 387, 192, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 388, 48, 389, 48, 48, 206, - 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, - 48, 48, 48, 48, 48, 48, 204, 48, 48, 48, 48, 48, 48, 207, 140, 140, - 392, 393, 394, 395, 396, 48, 48, 48, 48, 48, 48, 397, 398, 399, 48, 48, - 48, 48, 48, 400, 209, 48, 48, 48, 48, 401, 48, 48, 402, 140, 140, 403, - 32, 404, 32, 405, 406, 407, 408, 409, 48, 48, 48, 48, 48, 48, 48, 410, - 411, 2, 3, 4, 5, 412, 413, 414, 48, 415, 48, 200, 416, 417, 418, 419, - 420, 48, 172, 421, 204, 204, 140, 140, 48, 48, 48, 48, 48, 48, 48, 71, - 422, 272, 272, 423, 273, 273, 273, 424, 425, 426, 427, 140, 140, 209, 209, 428, - 140, 140, 140, 140, 140, 140, 140, 140, 48, 151, 48, 48, 48, 100, 429, 430, - 48, 48, 431, 48, 432, 48, 48, 433, 48, 434, 48, 48, 435, 436, 140, 140, - 9, 9, 437, 11, 11, 48, 48, 48, 48, 204, 192, 9, 9, 438, 11, 439, - 48, 48, 440, 48, 48, 48, 441, 442, 442, 443, 444, 445, 48, 48, 48, 388, - 48, 48, 48, 313, 48, 199, 440, 140, 446, 27, 27, 447, 140, 140, 140, 140, - 448, 48, 48, 449, 48, 450, 48, 451, 48, 200, 452, 140, 140, 140, 48, 453, - 48, 454, 48, 455, 48, 207, 140, 140, 48, 48, 48, 456, 272, 457, 272, 272, - 458, 459, 48, 460, 461, 462, 48, 463, 48, 464, 140, 140, 465, 48, 466, 467, - 48, 48, 48, 468, 48, 469, 48, 470, 48, 471, 472, 140, 140, 140, 140, 140, - 48, 48, 48, 48, 196, 140, 140, 140, 9, 9, 9, 473, 11, 11, 11, 474, - 48, 48, 475, 192, 476, 9, 477, 11, 478, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 272, 479, 48, 48, 480, 481, 482, 483, 140, 484, - 48, 464, 485, 48, 62, 486, 140, 48, 487, 140, 140, 48, 488, 140, 48, 313, - 489, 48, 48, 490, 491, 457, 492, 493, 223, 48, 48, 494, 495, 48, 196, 192, - 496, 48, 497, 498, 499, 48, 48, 500, 223, 48, 48, 501, 502, 503, 504, 505, - 48, 97, 506, 507, 508, 140, 140, 140, 509, 510, 511, 48, 48, 512, 513, 192, - 514, 83, 84, 515, 516, 517, 518, 519, 520, 48, 48, 521, 522, 523, 524, 140, - 48, 48, 48, 525, 526, 527, 481, 140, 48, 48, 48, 528, 529, 192, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 48, 48, 530, 531, 532, 533, 140, 140, - 48, 48, 48, 534, 535, 192, 536, 140, 48, 48, 537, 538, 192, 539, 540, 140, - 48, 541, 542, 543, 313, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 506, 544, 140, 140, 140, 140, 140, 140, 9, 9, 11, 11, 148, 545, - 546, 547, 48, 548, 549, 192, 140, 140, 140, 140, 550, 48, 48, 551, 552, 140, - 553, 48, 48, 554, 555, 556, 48, 48, 557, 558, 559, 48, 48, 48, 48, 196, - 560, 140, 140, 140, 140, 140, 561, 140, 140, 140, 140, 140, 48, 48, 562, 192, - 84, 48, 530, 563, 564, 148, 175, 565, 48, 566, 567, 568, 140, 140, 140, 140, - 569, 48, 48, 570, 571, 192, 572, 48, 573, 574, 192, 48, 48, 575, 192, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 576, - 577, 115, 48, 578, 579, 580, 140, 140, 140, 140, 140, 100, 272, 581, 582, 583, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 207, 140, 140, 140, 140, 140, 140, - 273, 273, 273, 273, 273, 273, 584, 585, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 388, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 48, 48, 48, 48, 48, 586, - 48, 48, 48, 587, 588, 589, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 71, - 48, 48, 48, 48, 313, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 590, 591, 192, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 48, 196, 48, 200, 370, 48, 48, 48, 48, 200, 192, 48, 204, 592, - 48, 48, 48, 593, 594, 595, 596, 597, 48, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 598, 48, 599, 192, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 9, 9, 11, 11, 272, 600, 9, 601, 11, 602, 140, 140, - 48, 48, 48, 48, 603, 604, 605, 605, 606, 607, 140, 140, 140, 140, 608, 609, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 199, 140, 610, - 48, 200, 140, 140, 140, 140, 140, 140, 48, 48, 48, 48, 48, 48, 48, 611, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 612, - 48, 48, 611, 613, 140, 614, 615, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 206, - 48, 48, 48, 48, 48, 48, 71, 151, 196, 616, 617, 140, 140, 140, 140, 140, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 618, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 619, 209, 427, 209, 620, - 32, 32, 216, 32, 621, 209, 209, 209, 209, 209, 209, 209, 322, 140, 140, 140, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 323, - 209, 209, 622, 209, 209, 209, 623, 624, 625, 209, 626, 209, 209, 209, 288, 140, - 209, 209, 209, 209, 627, 140, 140, 140, 140, 140, 140, 140, 272, 628, 272, 628, - 209, 209, 209, 209, 209, 338, 272, 461, 140, 140, 140, 140, 140, 140, 140, 140, - 9, 629, 11, 630, 631, 632, 242, 9, 633, 634, 635, 636, 637, 9, 629, 11, - 638, 639, 11, 640, 641, 642, 643, 9, 644, 11, 9, 629, 11, 630, 631, 11, - 242, 9, 633, 643, 9, 644, 11, 9, 629, 11, 645, 9, 646, 647, 648, 649, - 11, 650, 9, 651, 652, 653, 654, 11, 655, 9, 656, 11, 657, 539, 539, 539, - 32, 32, 32, 658, 32, 32, 659, 660, 661, 662, 45, 140, 140, 140, 140, 140, - 663, 664, 665, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 666, 667, 668, 27, 27, 27, 669, 140, 670, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 151, 671, 672, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 673, 140, 48, 48, 674, 675, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 676, 192, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 590, 677, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 48, 200, 678, 679, - 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 680, 200, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 681, 621, 140, 140, - 9, 9, 633, 11, 682, 370, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 140, 140, 140, 140, 140, 140, 140, 504, 272, 272, 683, 684, 140, 140, 140, 140, - 504, 272, 685, 686, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 687, 48, 688, 689, 690, 691, 692, 693, 694, 206, 695, 206, 140, 140, 140, 696, - 209, 209, 697, 209, 209, 209, 209, 209, 209, 322, 333, 698, 698, 698, 209, 323, - 699, 209, 209, 209, 209, 209, 209, 209, 209, 209, 700, 140, 140, 140, 701, 209, - 702, 209, 209, 697, 703, 704, 323, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 705, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 706, 426, 426, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 176, 697, 427, - 697, 209, 209, 209, 707, 176, 209, 209, 707, 209, 700, 697, 704, 708, 140, 140, - 209, 209, 209, 209, 209, 707, 700, 426, 709, 209, 209, 209, 710, 711, 712, 703, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 713, 209, 209, 209, 209, 209, 714, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 140, 140, - 48, 204, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 204, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 100, 48, - 48, 48, 48, 48, 48, 204, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 204, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, - 48, 48, 48, 48, 71, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 207, 140, 140, 140, 140, 140, 140, 140, 140, - 715, 140, 587, 587, 587, 587, 587, 587, 140, 140, 140, 140, 140, 140, 140, 140, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 140, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 716, - 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 717, - 0, 0, 0, 0, 1, 2, 1, 2, 0, 0, 3, 3, 4, 5, 4, 5, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 0, 0, 7, 0, - 8, 8, 8, 8, 8, 8, 8, 9, 10, 11, 12, 11, 11, 11, 13, 11, - 14, 14, 14, 14, 14, 14, 14, 14, 15, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 16, 17, 18, 17, 17, 19, 20, 21, 21, 22, 21, 23, 24, - 25, 26, 27, 27, 28, 29, 27, 30, 27, 27, 27, 27, 27, 31, 27, 27, - 32, 33, 33, 33, 34, 27, 27, 27, 35, 35, 35, 36, 37, 37, 37, 38, - 39, 39, 40, 41, 42, 43, 44, 27, 27, 45, 27, 27, 27, 27, 46, 27, - 47, 47, 47, 47, 47, 48, 49, 47, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 108, 109, 110, 111, 108, 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 121, 122, 121, 123, 124, 124, 125, 126, 127, 128, 129, 130, 124, 124, - 131, 131, 131, 131, 132, 131, 133, 134, 131, 132, 131, 135, 135, 136, 124, 124, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 138, 138, 139, 138, 138, 140, - 141, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 143, 144, 142, 142, - 143, 142, 142, 145, 146, 147, 142, 142, 142, 146, 142, 142, 142, 148, 142, 149, - 142, 150, 151, 151, 151, 151, 151, 152, 153, 153, 153, 153, 153, 153, 153, 153, - 154, 155, 156, 156, 156, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 167, 167, 167, 167, 168, 169, 169, 170, 171, 172, 172, 172, 172, 172, 173, - 172, 172, 174, 153, 153, 153, 153, 175, 176, 177, 178, 178, 179, 180, 181, 182, - 183, 183, 184, 183, 185, 186, 167, 167, 187, 188, 189, 189, 189, 190, 189, 191, - 192, 192, 193, 8, 8, 194, 195, 124, 196, 196, 196, 196, 197, 196, 196, 196, - 198, 198, 198, 198, 199, 199, 199, 200, 201, 201, 201, 202, 203, 204, 204, 204, - 205, 138, 138, 206, 207, 208, 209, 210, 4, 4, 211, 4, 4, 212, 213, 214, - 4, 4, 4, 215, 8, 8, 8, 8, 11, 216, 11, 11, 216, 217, 11, 218, - 11, 11, 11, 219, 219, 220, 11, 221, 222, 0, 0, 0, 0, 0, 223, 224, - 225, 226, 0, 0, 227, 8, 8, 228, 0, 0, 229, 230, 231, 0, 4, 4, - 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 233, 124, 234, 124, 0, 0, 235, 235, 235, 235, 235, 235, 235, 235, - 0, 0, 0, 0, 0, 0, 0, 236, 237, 237, 237, 237, 237, 237, 4, 4, - 238, 238, 238, 238, 238, 238, 238, 239, 138, 138, 139, 240, 240, 240, 241, 242, - 142, 243, 244, 244, 244, 244, 14, 14, 0, 0, 0, 0, 0, 245, 124, 124, - 246, 247, 246, 246, 246, 246, 246, 248, 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 249, 124, 0, 250, 0, 251, 252, 253, 254, 254, 254, - 254, 255, 256, 257, 257, 257, 257, 258, 259, 260, 260, 261, 141, 141, 141, 141, - 262, 0, 260, 260, 0, 0, 263, 257, 141, 262, 0, 0, 0, 0, 141, 264, - 0, 0, 0, 0, 0, 257, 257, 265, 257, 257, 257, 257, 257, 266, 0, 0, - 246, 246, 246, 246, 0, 0, 0, 0, 267, 267, 267, 267, 267, 267, 267, 267, - 268, 267, 267, 267, 269, 270, 270, 270, 271, 271, 271, 271, 271, 271, 271, 271, - 271, 271, 272, 124, 14, 14, 14, 14, 14, 14, 273, 273, 273, 273, 273, 274, - 0, 0, 275, 4, 4, 4, 4, 4, 276, 4, 4, 4, 4, 226, 124, 277, - 278, 278, 279, 233, 280, 280, 280, 281, 282, 282, 282, 282, 283, 284, 47, 47, - 285, 285, 286, 287, 287, 288, 141, 289, 290, 290, 290, 290, 291, 292, 137, 293, - 294, 294, 294, 295, 296, 297, 137, 137, 298, 298, 298, 298, 299, 300, 301, 302, - 303, 304, 244, 4, 4, 305, 306, 151, 151, 151, 151, 151, 301, 301, 307, 308, - 141, 141, 309, 141, 310, 141, 141, 311, 124, 124, 124, 124, 124, 124, 124, 124, - 246, 246, 246, 246, 246, 246, 312, 246, 246, 246, 246, 246, 246, 313, 124, 124, - 314, 315, 21, 316, 317, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 318, 27, 27, 27, 27, 27, 27, 27, 27, 27, 124, 124, 27, - 8, 233, 319, 0, 0, 320, 321, 322, 27, 27, 27, 27, 27, 27, 27, 323, - 324, 0, 1, 2, 1, 2, 325, 256, 257, 326, 141, 262, 327, 328, 329, 330, - 331, 332, 333, 334, 335, 335, 124, 124, 332, 332, 332, 332, 332, 332, 332, 336, - 337, 0, 0, 338, 11, 11, 11, 11, 339, 340, 341, 124, 124, 0, 0, 342, - 343, 344, 345, 345, 345, 346, 347, 348, 349, 349, 350, 351, 352, 353, 353, 354, - 355, 356, 357, 357, 358, 359, 124, 124, 360, 360, 360, 360, 360, 361, 361, 361, - 362, 363, 364, 365, 365, 366, 365, 367, 368, 368, 369, 370, 370, 370, 371, 372, - 372, 373, 374, 375, 376, 376, 376, 377, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 379, 378, 380, 381, 124, 382, 4, 4, 383, 124, 124, 124, 124, - 384, 385, 385, 386, 387, 388, 389, 389, 390, 391, 392, 124, 124, 124, 393, 394, - 395, 396, 397, 398, 399, 400, 124, 124, 401, 401, 402, 403, 402, 404, 402, 402, - 405, 406, 407, 408, 409, 409, 410, 410, 411, 411, 124, 124, 412, 412, 413, 414, - 415, 415, 415, 416, 417, 418, 419, 420, 421, 422, 423, 124, 124, 124, 124, 124, - 424, 424, 424, 424, 425, 124, 124, 124, 426, 426, 426, 427, 426, 426, 426, 428, - 429, 429, 430, 431, 432, 432, 433, 432, 434, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 27, 435, 436, 436, 437, 438, 439, 440, 124, 441, - 442, 442, 443, 444, 444, 445, 124, 446, 447, 124, 124, 448, 449, 124, 450, 451, - 452, 452, 452, 452, 453, 454, 452, 455, 456, 456, 456, 456, 457, 458, 459, 460, - 461, 461, 461, 462, 463, 464, 464, 465, 466, 466, 466, 466, 466, 466, 467, 468, - 469, 470, 469, 469, 471, 124, 124, 124, 472, 473, 474, 475, 475, 475, 476, 477, - 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 487, 488, 489, 490, 491, 124, - 492, 492, 492, 492, 492, 493, 494, 124, 495, 495, 495, 495, 496, 497, 124, 124, - 498, 498, 498, 499, 498, 500, 124, 124, 501, 501, 501, 501, 502, 503, 504, 124, - 505, 505, 505, 506, 506, 137, 507, 124, 508, 509, 510, 508, 511, 124, 124, 124, - 512, 512, 512, 513, 124, 124, 124, 124, 124, 124, 514, 514, 514, 514, 514, 515, - 516, 517, 518, 519, 520, 521, 124, 124, 124, 124, 522, 523, 523, 522, 524, 124, - 525, 525, 525, 525, 526, 527, 527, 527, 527, 527, 528, 153, 529, 529, 529, 530, - 531, 124, 124, 124, 124, 124, 532, 124, 124, 124, 124, 124, 533, 533, 534, 535, - 536, 537, 537, 538, 539, 537, 540, 541, 541, 542, 543, 544, 124, 124, 124, 124, - 545, 546, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 555, 556, 557, 124, - 124, 124, 124, 124, 124, 124, 558, 559, 560, 561, 560, 562, 560, 563, 124, 124, - 124, 124, 124, 564, 565, 565, 565, 566, 567, 567, 567, 567, 567, 567, 567, 567, - 567, 568, 124, 124, 124, 124, 124, 124, 567, 567, 567, 567, 567, 567, 569, 570, - 567, 567, 567, 567, 571, 124, 124, 124, 124, 572, 572, 572, 572, 572, 572, 573, - 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 575, 574, 574, - 574, 574, 574, 574, 574, 574, 574, 576, 577, 577, 577, 577, 577, 577, 577, 577, - 577, 577, 577, 577, 578, 124, 124, 124, 579, 579, 579, 580, 124, 124, 124, 124, - 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 581, 582, 583, 584, 585, - 585, 585, 585, 586, 587, 588, 589, 590, 591, 591, 591, 591, 592, 593, 594, 595, - 591, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 596, 596, 596, 597, - 124, 124, 124, 124, 598, 598, 598, 598, 598, 599, 600, 601, 600, 602, 124, 124, - 603, 603, 603, 603, 604, 603, 603, 603, 605, 603, 124, 124, 124, 124, 606, 607, - 608, 608, 608, 608, 608, 608, 608, 608, 609, 609, 609, 609, 609, 609, 609, 609, - 609, 609, 609, 609, 609, 610, 124, 611, 608, 612, 124, 124, 124, 124, 124, 124, - 608, 608, 608, 608, 608, 608, 608, 613, 124, 124, 124, 124, 124, 124, 124, 614, - 615, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 616, 617, 124, 618, 619, 620, 620, 620, 620, 620, 620, 620, 620, 620, - 620, 620, 620, 620, 620, 620, 620, 621, 622, 622, 622, 622, 622, 622, 623, 624, - 625, 626, 627, 124, 124, 124, 124, 124, 0, 0, 0, 0, 0, 0, 0, 340, - 0, 0, 0, 628, 0, 629, 0, 629, 8, 8, 194, 8, 630, 0, 0, 0, - 0, 0, 0, 0, 627, 124, 124, 124, 0, 0, 0, 0, 0, 0, 0, 631, - 0, 0, 632, 0, 0, 0, 633, 634, 635, 0, 636, 0, 0, 0, 234, 124, - 11, 11, 11, 11, 637, 124, 124, 124, 124, 124, 124, 124, 0, 627, 0, 627, - 0, 0, 0, 0, 0, 638, 0, 639, 0, 0, 0, 0, 0, 223, 0, 0, - 0, 640, 641, 642, 643, 0, 0, 0, 644, 645, 0, 646, 647, 648, 0, 0, - 0, 0, 649, 0, 0, 0, 0, 0, 0, 0, 0, 0, 650, 0, 0, 0, - 651, 651, 651, 651, 651, 651, 651, 651, 652, 653, 654, 124, 124, 124, 124, 124, - 4, 655, 656, 124, 124, 124, 124, 124, 657, 658, 659, 14, 14, 14, 660, 124, - 661, 124, 124, 124, 124, 124, 124, 124, 662, 662, 663, 664, 665, 124, 124, 124, - 124, 666, 667, 124, 668, 668, 668, 669, 124, 124, 124, 124, 124, 670, 670, 671, - 124, 124, 124, 124, 124, 672, 672, 673, 124, 124, 124, 124, 674, 675, 674, 676, - 124, 124, 124, 124, 124, 124, 677, 678, 679, 679, 679, 679, 679, 679, 679, 679, - 679, 679, 679, 679, 680, 681, 124, 124, 682, 682, 682, 682, 683, 684, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 324, 0, 0, 0, 685, 124, 124, 124, 124, - 324, 0, 0, 245, 124, 124, 124, 124, 686, 27, 687, 688, 689, 690, 691, 692, - 693, 694, 695, 694, 124, 124, 124, 696, 0, 0, 348, 0, 0, 0, 0, 0, - 0, 627, 225, 324, 324, 324, 0, 631, 0, 0, 245, 124, 124, 124, 697, 0, - 698, 0, 0, 348, 639, 227, 631, 124, 0, 0, 0, 0, 0, 699, 340, 340, - 0, 0, 0, 0, 0, 233, 348, 629, 348, 0, 0, 0, 700, 233, 0, 0, - 700, 0, 245, 348, 227, 639, 124, 124, 0, 0, 0, 0, 0, 700, 245, 340, - 701, 0, 0, 0, 702, 703, 704, 639, 0, 320, 0, 0, 0, 0, 0, 234, - 246, 246, 246, 246, 246, 246, 124, 124, 246, 312, 246, 246, 246, 246, 246, 246, - 246, 246, 312, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 705, 246, - 246, 246, 246, 246, 246, 312, 124, 124, 246, 312, 124, 124, 124, 124, 124, 124, - 246, 246, 246, 246, 706, 246, 246, 246, 246, 246, 246, 246, 246, 246, 246, 313, - 707, 124, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 1, 2, 2, 2, - 2, 2, 3, 0, 0, 0, 4, 0, 2, 2, 2, 2, 2, 3, 2, 2, - 2, 2, 5, 0, 2, 5, 6, 0, 7, 7, 7, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 8, 8, 8, 8, 16, 8, 8, 8, 17, 18, 18, 18, - 19, 19, 19, 19, 19, 20, 19, 19, 21, 22, 22, 22, 22, 22, 22, 22, - 22, 23, 21, 22, 22, 22, 23, 21, 24, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 12, 12, 25, 25, 26, 27, 25, 28, 12, 12, 29, 30, 29, 31, - 29, 29, 32, 32, 29, 29, 29, 29, 31, 29, 33, 7, 7, 34, 29, 29, - 35, 29, 29, 29, 29, 29, 29, 30, 36, 36, 36, 37, 36, 36, 36, 36, - 36, 36, 38, 39, 40, 40, 40, 40, 41, 12, 12, 12, 42, 42, 42, 42, - 42, 42, 43, 44, 45, 45, 45, 45, 45, 45, 45, 46, 45, 45, 45, 47, - 48, 48, 48, 48, 48, 48, 48, 49, 36, 36, 38, 12, 50, 51, 29, 29, - 52, 29, 29, 29, 53, 53, 53, 53, 54, 55, 53, 53, 53, 56, 53, 53, - 57, 58, 57, 59, 59, 57, 57, 57, 57, 57, 60, 57, 61, 62, 63, 57, - 57, 59, 59, 64, 12, 65, 12, 66, 57, 62, 57, 57, 57, 57, 57, 64, - 67, 67, 68, 69, 70, 71, 71, 71, 71, 71, 72, 71, 72, 73, 74, 72, - 68, 69, 70, 74, 75, 12, 67, 76, 12, 77, 71, 71, 71, 68, 12, 12, - 78, 78, 79, 80, 80, 79, 79, 79, 79, 79, 81, 79, 81, 78, 82, 79, - 79, 80, 80, 82, 83, 12, 12, 12, 79, 84, 79, 79, 82, 12, 78, 79, - 85, 85, 86, 87, 87, 86, 86, 86, 86, 86, 88, 86, 88, 85, 89, 86, - 86, 87, 87, 89, 12, 85, 12, 90, 86, 91, 86, 86, 86, 86, 12, 12, - 92, 93, 94, 92, 95, 96, 97, 95, 98, 99, 94, 92, 100, 100, 96, 92, - 94, 92, 95, 96, 99, 98, 12, 12, 12, 92, 100, 100, 100, 100, 94, 12, - 101, 101, 101, 102, 102, 101, 101, 101, 101, 101, 102, 101, 101, 101, 103, 101, - 101, 102, 102, 103, 12, 104, 105, 103, 101, 106, 101, 101, 12, 107, 101, 101, - 108, 108, 108, 109, 109, 108, 108, 108, 108, 108, 109, 108, 108, 110, 111, 108, - 108, 109, 109, 111, 12, 112, 12, 113, 108, 114, 108, 108, 110, 12, 12, 12, - 115, 115, 115, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 116, 116, 115, - 12, 115, 115, 115, 115, 117, 115, 115, 118, 118, 119, 119, 119, 120, 121, 119, - 119, 119, 119, 119, 122, 119, 119, 123, 119, 120, 124, 125, 119, 126, 119, 119, - 12, 121, 119, 119, 121, 127, 12, 12, 128, 129, 129, 129, 129, 129, 129, 129, - 129, 129, 130, 131, 129, 129, 129, 12, 12, 12, 12, 12, 132, 133, 134, 135, - 135, 135, 135, 135, 135, 136, 135, 135, 135, 135, 135, 137, 135, 138, 135, 134, - 135, 135, 137, 135, 139, 139, 139, 139, 139, 139, 140, 139, 139, 139, 139, 141, - 140, 139, 139, 139, 139, 139, 139, 142, 139, 143, 144, 12, 145, 145, 145, 145, - 146, 146, 146, 146, 146, 147, 12, 148, 146, 146, 149, 146, 150, 150, 150, 150, - 151, 151, 151, 151, 151, 151, 152, 153, 151, 154, 152, 153, 152, 153, 151, 154, - 152, 153, 151, 151, 151, 154, 151, 151, 151, 151, 154, 155, 151, 151, 151, 156, - 151, 151, 153, 12, 157, 157, 157, 157, 157, 158, 157, 158, 159, 159, 159, 159, - 160, 160, 160, 160, 160, 160, 160, 161, 162, 162, 162, 162, 162, 162, 163, 164, - 162, 162, 165, 12, 166, 166, 166, 166, 166, 167, 12, 168, 169, 169, 169, 169, - 169, 170, 12, 12, 171, 171, 171, 171, 171, 12, 12, 12, 172, 172, 172, 173, - 173, 12, 12, 12, 174, 174, 174, 174, 174, 174, 174, 175, 174, 174, 175, 12, - 176, 177, 178, 178, 178, 178, 179, 12, 178, 178, 178, 178, 178, 178, 180, 12, - 178, 178, 181, 12, 159, 182, 12, 12, 183, 183, 183, 183, 183, 183, 183, 184, - 183, 183, 183, 12, 185, 183, 183, 183, 186, 186, 186, 186, 186, 186, 186, 187, - 186, 188, 12, 12, 189, 189, 189, 189, 189, 189, 189, 12, 189, 189, 190, 12, - 189, 189, 191, 192, 193, 193, 193, 193, 193, 193, 193, 194, 195, 195, 195, 195, - 195, 195, 195, 196, 195, 195, 195, 197, 195, 195, 198, 12, 195, 195, 195, 198, - 7, 7, 7, 199, 7, 7, 7, 12, 200, 200, 200, 200, 200, 200, 200, 201, - 202, 202, 202, 202, 203, 203, 203, 203, 203, 12, 12, 203, 204, 204, 204, 204, - 204, 204, 205, 204, 204, 204, 206, 207, 208, 208, 208, 208, 19, 19, 209, 12, - 146, 146, 210, 211, 202, 202, 12, 12, 212, 7, 7, 7, 213, 7, 214, 215, - 0, 214, 216, 12, 2, 217, 218, 2, 2, 2, 2, 219, 220, 217, 221, 2, - 2, 2, 222, 2, 2, 2, 2, 223, 8, 224, 8, 224, 8, 8, 225, 225, - 8, 8, 8, 224, 8, 15, 8, 8, 8, 10, 8, 226, 10, 15, 8, 14, - 0, 0, 0, 227, 0, 228, 0, 0, 229, 0, 0, 230, 0, 0, 0, 231, - 2, 2, 2, 232, 233, 12, 12, 12, 234, 12, 12, 12, 0, 235, 236, 0, - 4, 0, 0, 0, 0, 0, 0, 4, 2, 2, 5, 12, 0, 0, 233, 12, - 0, 0, 231, 12, 237, 237, 237, 237, 0, 238, 0, 0, 239, 239, 239, 239, - 18, 18, 18, 18, 18, 12, 240, 18, 241, 241, 241, 241, 241, 241, 12, 242, - 243, 12, 12, 242, 151, 154, 12, 12, 151, 154, 151, 154, 0, 0, 0, 233, - 244, 244, 244, 244, 244, 244, 245, 244, 244, 12, 12, 12, 244, 246, 12, 12, - 0, 247, 0, 0, 248, 244, 249, 250, 0, 0, 244, 0, 251, 252, 252, 252, - 252, 252, 252, 252, 252, 253, 254, 255, 256, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 258, 256, 12, 259, 260, 260, 260, 260, 260, 260, 261, 150, 150, 150, - 150, 150, 150, 262, 0, 233, 12, 131, 150, 150, 150, 263, 257, 257, 257, 258, - 257, 257, 0, 0, 264, 264, 264, 264, 264, 264, 264, 265, 264, 266, 12, 12, - 267, 267, 267, 267, 268, 268, 268, 268, 268, 268, 268, 12, 269, 269, 269, 269, - 269, 269, 12, 12, 236, 2, 2, 2, 2, 2, 230, 2, 270, 2, 2, 2, - 271, 271, 271, 271, 271, 271, 271, 272, 273, 273, 273, 273, 273, 273, 12, 12, - 274, 274, 274, 274, 274, 275, 12, 276, 274, 274, 275, 12, 277, 277, 277, 277, - 277, 277, 277, 278, 279, 279, 279, 279, 279, 12, 12, 280, 150, 150, 150, 281, - 282, 282, 282, 282, 282, 282, 282, 283, 282, 282, 284, 285, 145, 145, 145, 286, - 287, 287, 287, 287, 287, 288, 12, 12, 287, 287, 287, 289, 287, 287, 289, 287, - 290, 290, 290, 290, 291, 12, 12, 12, 12, 12, 292, 290, 293, 293, 293, 293, - 293, 294, 12, 12, 155, 154, 155, 154, 155, 154, 12, 12, 2, 2, 3, 2, - 2, 295, 296, 12, 293, 293, 293, 297, 293, 293, 297, 12, 150, 12, 12, 12, - 150, 262, 298, 150, 150, 150, 150, 12, 244, 244, 244, 246, 244, 244, 246, 12, - 2, 299, 12, 12, 300, 22, 12, 24, 25, 26, 25, 301, 302, 303, 25, 25, - 29, 29, 29, 304, 7, 7, 7, 305, 231, 0, 0, 0, 0, 231, 0, 12, - 29, 306, 29, 29, 29, 29, 29, 307, 308, 0, 0, 0, 0, 309, 257, 257, - 257, 257, 257, 310, 311, 150, 311, 150, 311, 150, 311, 281, 0, 231, 0, 231, - 12, 12, 308, 233, 312, 312, 312, 313, 312, 312, 312, 312, 312, 314, 312, 312, - 312, 312, 314, 315, 312, 312, 312, 316, 312, 312, 314, 12, 231, 131, 0, 0, - 0, 131, 0, 0, 8, 8, 8, 14, 0, 0, 0, 317, 318, 12, 12, 12, - 0, 0, 0, 319, 320, 320, 320, 320, 320, 320, 320, 321, 322, 322, 322, 322, - 323, 12, 12, 12, 214, 0, 0, 0, 0, 0, 0, 12, 324, 324, 324, 324, - 324, 12, 12, 325, 326, 326, 326, 326, 326, 326, 327, 12, 328, 328, 328, 328, - 328, 328, 329, 12, 330, 330, 330, 330, 330, 330, 330, 331, 332, 332, 332, 332, - 332, 12, 332, 332, 332, 333, 12, 12, 334, 334, 334, 334, 335, 335, 335, 335, - 336, 336, 336, 336, 336, 336, 336, 337, 336, 336, 337, 12, 338, 338, 338, 338, - 338, 12, 338, 338, 338, 338, 338, 12, 339, 339, 339, 339, 339, 339, 12, 12, - 340, 340, 340, 340, 340, 12, 12, 341, 342, 342, 343, 342, 343, 344, 342, 342, - 344, 342, 342, 342, 344, 342, 344, 345, 346, 346, 346, 346, 346, 12, 12, 12, - 347, 347, 347, 347, 347, 348, 12, 12, 347, 349, 12, 12, 347, 347, 12, 12, - 2, 350, 2, 2, 351, 2, 299, 12, 352, 353, 354, 352, 352, 352, 352, 352, - 352, 355, 356, 357, 358, 358, 358, 358, 358, 359, 358, 358, 360, 360, 360, 360, - 361, 361, 361, 361, 361, 361, 361, 362, 12, 363, 361, 361, 364, 364, 364, 364, - 365, 366, 367, 364, 368, 368, 368, 368, 368, 368, 368, 369, 370, 370, 370, 370, - 370, 370, 371, 372, 373, 373, 373, 373, 373, 373, 374, 12, 375, 375, 375, 375, - 376, 376, 376, 376, 376, 376, 12, 376, 377, 376, 376, 376, 378, 379, 12, 378, - 378, 380, 380, 378, 378, 378, 378, 378, 378, 381, 382, 383, 378, 378, 384, 12, - 385, 385, 385, 385, 386, 386, 386, 386, 387, 387, 387, 387, 387, 388, 389, 387, - 387, 388, 12, 12, 390, 390, 390, 390, 390, 391, 392, 390, 393, 393, 393, 393, - 393, 394, 393, 393, 395, 395, 395, 395, 396, 12, 395, 395, 397, 397, 397, 397, - 398, 12, 399, 400, 12, 12, 399, 397, 401, 401, 401, 401, 401, 401, 402, 12, - 403, 403, 403, 403, 404, 12, 12, 12, 404, 12, 405, 403, 406, 406, 406, 406, - 406, 406, 12, 12, 406, 406, 407, 12, 408, 408, 408, 408, 408, 409, 410, 408, - 408, 409, 12, 411, 29, 29, 29, 412, 413, 413, 413, 413, 413, 413, 414, 415, - 415, 12, 12, 12, 416, 29, 12, 12, 29, 29, 417, 12, 12, 12, 416, 29, - 418, 418, 418, 418, 418, 418, 12, 12, 419, 419, 419, 419, 419, 419, 420, 12, - 421, 421, 421, 421, 421, 421, 422, 12, 423, 423, 423, 423, 423, 423, 423, 12, - 424, 424, 424, 424, 424, 425, 12, 12, 426, 426, 426, 426, 426, 426, 426, 427, - 428, 426, 426, 426, 426, 427, 12, 429, 430, 430, 430, 430, 431, 12, 12, 432, - 433, 433, 433, 433, 433, 433, 434, 12, 433, 433, 435, 12, 436, 436, 436, 436, - 436, 437, 436, 436, 436, 436, 12, 12, 438, 438, 438, 438, 438, 439, 12, 12, - 440, 440, 440, 440, 118, 119, 119, 119, 119, 127, 12, 12, 441, 441, 441, 441, - 442, 441, 441, 441, 443, 12, 12, 12, 444, 445, 446, 447, 444, 444, 444, 447, - 444, 444, 448, 12, 449, 449, 449, 449, 449, 449, 450, 12, 449, 449, 451, 12, - 452, 453, 452, 454, 454, 452, 452, 452, 452, 452, 455, 452, 455, 453, 456, 452, - 452, 454, 454, 457, 458, 459, 12, 453, 452, 460, 452, 458, 452, 458, 12, 12, - 461, 461, 462, 463, 461, 461, 461, 461, 461, 462, 461, 461, 464, 465, 466, 461, - 461, 462, 467, 12, 468, 12, 12, 12, 469, 469, 469, 469, 469, 469, 469, 470, - 471, 12, 12, 12, 472, 472, 472, 472, 472, 472, 12, 12, 472, 472, 473, 12, - 474, 474, 474, 474, 474, 475, 474, 474, 474, 474, 474, 475, 476, 476, 476, 476, - 476, 477, 12, 12, 476, 476, 478, 12, 178, 178, 178, 180, 479, 479, 479, 479, - 479, 479, 480, 12, 145, 12, 12, 12, 481, 481, 481, 481, 481, 481, 482, 483, - 481, 481, 481, 12, 481, 482, 12, 12, 484, 484, 484, 484, 484, 484, 484, 12, - 485, 485, 485, 485, 486, 12, 12, 487, 488, 489, 490, 488, 488, 491, 488, 488, - 488, 488, 488, 488, 488, 492, 493, 488, 488, 489, 12, 12, 488, 488, 494, 12, - 495, 495, 496, 495, 495, 495, 495, 495, 495, 497, 12, 12, 498, 498, 498, 498, - 498, 498, 12, 12, 499, 499, 499, 499, 500, 12, 12, 12, 501, 501, 501, 501, - 501, 501, 502, 12, 53, 53, 503, 12, 440, 440, 12, 12, 504, 504, 504, 504, - 505, 12, 12, 12, 504, 504, 505, 12, 506, 506, 507, 506, 506, 506, 506, 506, - 506, 508, 506, 506, 506, 509, 12, 12, 506, 506, 506, 510, 511, 511, 511, 511, - 512, 511, 511, 511, 511, 511, 513, 511, 511, 514, 12, 12, 515, 516, 517, 515, - 515, 515, 515, 515, 515, 516, 518, 517, 515, 515, 12, 12, 515, 515, 519, 12, - 520, 521, 522, 520, 520, 520, 520, 520, 520, 520, 520, 523, 521, 520, 524, 12, - 520, 520, 525, 12, 526, 526, 526, 526, 526, 526, 526, 12, 526, 526, 527, 12, - 528, 528, 528, 528, 528, 528, 529, 12, 530, 530, 530, 530, 531, 530, 530, 530, - 530, 530, 532, 533, 530, 530, 532, 12, 534, 12, 12, 12, 100, 100, 100, 100, - 96, 12, 12, 98, 535, 535, 535, 535, 535, 535, 536, 12, 535, 535, 535, 537, - 535, 538, 12, 12, 535, 12, 12, 12, 539, 539, 539, 539, 540, 12, 12, 12, - 541, 541, 541, 541, 541, 542, 12, 12, 541, 541, 543, 12, 544, 544, 544, 544, - 544, 545, 12, 12, 546, 546, 546, 546, 546, 546, 547, 12, 269, 269, 548, 12, - 549, 549, 549, 549, 549, 549, 549, 550, 549, 549, 551, 552, 553, 553, 553, 553, - 553, 553, 553, 554, 553, 553, 555, 12, 556, 556, 556, 556, 556, 556, 556, 557, - 556, 557, 12, 12, 558, 558, 558, 558, 558, 559, 12, 12, 558, 558, 560, 558, - 560, 558, 558, 558, 558, 558, 12, 561, 562, 562, 562, 562, 562, 562, 563, 12, - 564, 564, 564, 564, 564, 564, 565, 12, 566, 566, 566, 566, 566, 566, 567, 566, - 566, 12, 12, 12, 568, 568, 568, 568, 568, 568, 569, 570, 568, 568, 12, 570, - 571, 572, 12, 12, 244, 573, 12, 12, 574, 574, 574, 574, 575, 575, 575, 575, - 575, 576, 12, 12, 12, 12, 12, 577, 574, 574, 574, 578, 578, 12, 12, 12, - 257, 579, 257, 580, 581, 252, 252, 252, 582, 12, 12, 12, 583, 12, 12, 12, - 253, 584, 12, 12, 12, 257, 12, 12, 585, 585, 585, 585, 585, 585, 585, 12, - 586, 586, 586, 586, 586, 586, 587, 12, 586, 586, 586, 588, 586, 586, 588, 12, - 586, 586, 589, 586, 0, 12, 12, 12, 0, 12, 238, 0, 317, 12, 12, 12, - 7, 590, 12, 12, 0, 233, 12, 12, 0, 231, 308, 0, 0, 591, 227, 0, - 0, 0, 591, 7, 212, 592, 7, 0, 0, 0, 593, 227, 8, 224, 12, 12, - 0, 231, 12, 12, 0, 0, 317, 12, 0, 0, 0, 228, 594, 595, 308, 228, - 0, 0, 596, 308, 0, 308, 0, 0, 0, 596, 231, 308, 0, 228, 0, 228, - 0, 0, 596, 231, 0, 597, 238, 0, 228, 0, 0, 0, 0, 233, 0, 0, - 0, 0, 0, 238, 598, 598, 598, 598, 598, 598, 598, 12, 12, 12, 599, 598, - 600, 598, 598, 598, 2, 2, 2, 299, 12, 270, 299, 12, 239, 601, 239, 239, - 239, 239, 602, 239, 603, 604, 601, 12, 19, 19, 19, 605, 12, 12, 12, 606, - 607, 607, 607, 607, 607, 607, 607, 608, 607, 607, 607, 609, 607, 607, 609, 610, - 611, 611, 611, 611, 611, 611, 611, 612, 613, 613, 613, 613, 613, 613, 614, 615, - 616, 616, 616, 616, 616, 616, 617, 12, 618, 618, 618, 618, 618, 618, 619, 620, - 621, 621, 621, 621, 621, 621, 621, 622, 621, 623, 12, 624, 151, 154, 151, 625, - 151, 151, 151, 154, 626, 626, 626, 626, 626, 627, 626, 626, 626, 628, 12, 12, - 629, 629, 629, 629, 629, 629, 629, 12, 629, 629, 630, 631, 0, 317, 12, 12, - 29, 632, 29, 29, 633, 634, 632, 29, 412, 29, 635, 12, 636, 51, 635, 632, - 633, 634, 635, 635, 633, 634, 412, 29, 412, 29, 632, 637, 29, 29, 638, 29, - 29, 29, 29, 12, 632, 632, 638, 29, 50, 12, 12, 12, 12, 238, 0, 0, - 639, 12, 12, 12, 0, 0, 317, 0, 0, 0, 12, 12, 0, 0, 231, 238, - 0, 231, 317, 308, 0, 0, 0, 640, 0, 0, 231, 131, 641, 12, 12, 12, - 244, 244, 573, 12, 642, 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 939, 940, 941, 942, 946, 948, 0, 962, - 969, 970, 971, 976,1001,1002,1003,1008, 0,1033,1040,1041,1042,1043,1047, 0, - 0,1080,1081,1082,1086,1110, 0, 0,1124,1125,1126,1127,1131,1133, 0,1147, - 1154,1155,1156,1161,1187,1188,1189,1193, 0,1219,1226,1227,1228,1229,1233, 0, - 0,1267,1268,1269,1273,1298, 0,1303, 943,1128, 944,1129, 954,1139, 958,1143, - 959,1144, 960,1145, 961,1146, 964,1149, 0, 0, 973,1158, 974,1159, 975,1160, - 983,1168, 978,1163, 988,1173, 990,1175, 991,1176, 993,1178, 994,1179, 0, 0, - 1004,1190,1005,1191,1006,1192,1014,1199,1007, 0, 0, 0,1016,1201,1020,1206, - 0,1022,1208,1025,1211,1023,1209, 0, 0, 0, 0,1032,1218,1037,1223,1035, - 1221, 0, 0, 0,1044,1230,1045,1231,1049,1235, 0, 0,1058,1244,1064,1250, - 1060,1246,1066,1252,1067,1253,1072,1258,1069,1255,1077,1264,1074,1261, 0, 0, - 1083,1270,1084,1271,1085,1272,1088,1275,1089,1276,1096,1283,1103,1290,1111,1299, - 1115,1118,1307,1120,1309,1121,1310, 0,1053,1239, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0,1093,1280, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 949,1134,1010,1195,1050,1236,1090,1277,1341,1368,1340, - 1367,1342,1369,1339,1366, 0,1320,1347,1418,1419,1323,1350, 0, 0, 992,1177, - 1018,1204,1055,1241,1416,1417,1415,1424,1202, 0, 0, 0, 987,1172, 0, 0, - 1031,1217,1321,1348,1322,1349,1338,1365, 950,1135, 951,1136, 979,1164, 980,1165, - 1011,1196,1012,1197,1051,1237,1052,1238,1061,1247,1062,1248,1091,1278,1092,1279, - 1071,1257,1076,1263, 0, 0, 997,1182, 0, 0, 0, 0, 0, 0, 945,1130, - 982,1167,1337,1364,1335,1362,1046,1232,1422,1423,1113,1301, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, 10,1425, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,1314,1427, 5, - 1434,1438,1443, 0,1450, 0,1455,1461,1514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1446,1458,1468,1476,1480,1486,1517, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 224, 224, 768, 424, 432, 440, 448, 776, 224, 224, 784, 792, 72, 800, 40, 808, + 48, 48, 48, 816, 824, 48, 48, 832, 840, 848, 856, 864, 872, 880, 48, 888, + 48, 48, 48, 896, 904, 40, 40, 40, 40, 912, 40, 96, 920, 928, 936, 456, + 64, 64, 64, 64, 64, 64, 64, 944, 952, 960, 968, 40, 976, 984, 48, 992, + 72, 72, 72, 40, 40, 40, 48, 48,1000, 48, 48, 48,1008, 48, 48, 48, + 48, 48, 48,1016, 72,1024, 40, 40,1032, 464, 64,1040,1048, 8,1056,1064, + 1072,1080, 8, 8,1088, 64,1096,1104, 8, 8, 8, 8, 8,1112,1120,1128, + 1136,1144, 8, 64,1152, 8, 8, 8, 8, 8, 472,1160, 232, 8,1168,1176, + 8,1184,1192,1200, 8,1208, 176, 8,1216,1224, 8, 8,1232, 64,1240, 64, + 480, 8, 8,1248,1256,1264,1272,1280,1288, 240, 128,1296,1304,1312, 144,1320, + 1328, 240, 128,1336,1344,1352, 304,1360,1368, 488, 128,1376,1384, 248, 144,1392, + 1400, 240, 128,1408,1416,1424, 144,1432,1440,1448,1456,1464,1472,1480, 304,1488, + 1496, 256, 128,1504,1512,1520, 144,1528,1536, 256, 128,1544,1552,1560, 144,1568, + 1576, 256, 8,1584,1592,1600, 144,1608,1616,1624, 8,1632,1640,1648, 304,1656, + 312, 8, 8,1664,1672,1680, 0, 0,1688, 8,1696,1704,1712,1720, 0, 0, + 1728,1736, 320,1744,1752, 8, 152,1760,1768,1776, 64,1784,1792,1800, 0, 0, + 8, 8,1808,1816, 496,1824,1832,1840,1848,1856, 72, 72,1864, 40, 40,1872, + 8, 8, 8, 8, 504,1880, 8, 8, 504, 8, 8,1888, 512, 520, 8, 8, + 8, 512, 8, 8, 8,1896,1904, 528, 8, 264, 72, 72, 72, 72, 72,1912, + 536, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8,1920, 8,1928,1936, 8, 8, 8, 8,1944,1952, + 8,1960, 8,1968, 8,1976,1984,1992, 8, 8, 8,2000,2008,2016, 80,2024, + 2032, 80, 8, 8,2040, 8, 8, 160,2048, 8,2056, 8, 8, 8, 8, 328, + 8, 120,2064,2072,2080, 8, 112,2088, 8, 8, 184, 8, 192,2096, 24, 24, + 8,2104, 8, 8, 8,2112,2120,2128, 80, 80,2136,2144, 64, 544,2152, 0, + 2160, 8, 8,2168,2176, 496,2184,2192, 336, 8,2200, 232, 8, 8,2208,2216, + 8, 8,2224,2232,2240, 232, 8, 552,2248, 72, 72,2256,2264,2272,2280,2288, + 40, 40,2296, 96, 96, 96,2304,2312, 40,2320, 96, 96, 64, 64, 64, 64, + 48, 48, 48, 48, 48, 48, 48, 48, 48,2328, 48, 48, 48, 48, 48, 48, + 168, 560, 168, 168, 560,2336, 168,2344, 344, 344, 344,2352,2360,2368,2376,2384, + 2392,2400,2408,2416,2424,2432,2440,2448,2456,2464, 568, 568,2472,2480,2488,2496, + 2504,2512,2520,2528,2536, 88, 104, 104,2544,2552,2560, 24,2568,2576, 24,2584, + 2592, 24,2600, 24, 24, 24, 24,2608, 24,2616, 56,2624, 24,2632,2640, 24, + 24, 24, 264, 0, 576, 0, 88, 88, 88,2648, 24, 24, 24, 24,2656, 88, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,2664,2672, 24, 24,2680, + 24, 24, 24, 24, 24, 24,2688, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24,2696,2704, 88,2712, 24, 24,2720, 56,2728, 56, + 56, 56, 56, 56, 56, 56, 56, 56,2736,2744, 56, 56, 56,2752, 56,2760, + 24, 24, 24, 56,2768, 24, 24,2776, 24, 24, 24, 24, 24, 24, 24, 24, + 72, 72, 72, 40, 40, 40,2784,2792, 48, 48, 48, 48, 48, 48,2800,2808, + 40, 40,2816, 8, 8, 8,2824,2832, 8, 200, 208, 208, 208, 208, 64, 64, + 2840,2848,2856,2864,2872,2880, 0, 0, 24,2888, 24, 24, 24, 24, 24, 352, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 272, 0, 24, + 2896,2904,2912,2920, 312, 8, 8, 8, 8,2928, 536, 8, 8, 8, 8,2936, + 2944, 8, 8, 312, 8, 8, 8, 8, 120,2952, 8, 8, 24, 24,2960, 8, + 24, 584, 592, 24,2968, 600, 24, 24, 592, 24, 24, 600, 24, 24, 24, 24, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 24, 24, 24, 24, + 8,2976, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 152, 24, 24, 24, 608, 8, 8, 552, + 2984, 8,2992, 0, 48, 48,3000,3008, 48,3016, 8, 8, 8, 8,3024,3032, + 456,3040,3048,3056, 48, 48, 48,3064,3072,3080,3088,3096,3104,3112, 0,3120, + 3128, 8,3136,3144, 8, 8, 8,3152,3160, 8, 8,3168,3176, 80, 64,3184, + 232, 8,3192, 8,3200,3208, 8, 152, 480, 8, 8,3216,3224, 360,3232,3240, + 8, 8,3248,3256,3264,3272, 8,3280, 8, 8, 8,3288,3296,3304,3312,3320, + 3328,3336, 208, 40, 40,3344,3352, 40, 40, 40, 40, 40, 8, 8,3360, 80, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 368, 8,3368, 8, 8, 184, + 8, 8, 8, 8, 8, 8, 112, 8, 8, 8, 8, 8, 8, 192, 0, 0, + 3376,3384,3392,3400,3408, 8, 8, 8, 8, 8, 8,3416,3424,3432, 8, 8, + 8, 8, 8,3440, 24, 8, 8, 8, 8,3448, 8, 8,3456, 0, 0,3464, + 64,3472, 64,3480,3488,3496,3504,3512, 8, 8, 8, 8, 8, 8, 8,3520, + 3528, 424, 432, 440, 448,3536,3544,3552, 8,3560, 8, 120,3568,3576,3584,3592, + 3600, 8, 520,3608, 112, 112, 0, 0, 8, 8, 8, 8, 8, 8, 8, 176, + 3616, 88, 88,3624, 104, 104, 104,3632,3640, 280, 376, 0, 0, 24, 24,3648, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 152, 8, 8, 8, 248,3656,3664, + 8, 8,3672, 8,3680, 8, 8,3688, 8,3696, 8, 8,3704,3712, 0, 0, + 72, 72,3720, 40, 40, 8, 8, 8, 8, 112, 80, 72, 72,3728, 40,3736, + 8, 8, 616, 8, 8, 8,3744, 624, 624,3752,3760,3768, 8, 8, 8, 368, + 8, 8, 8, 200, 8, 328, 616, 0,3776, 96, 96,3784, 0, 0, 0, 0, + 3792, 8, 8,3800, 8,3808, 8,3816, 8, 120,3824, 0, 0, 0, 8,3832, + 8,3840, 8,3848, 8, 192, 0, 0, 8, 8, 8,3856, 88, 632, 88, 88, + 3864,3872, 8,3880, 640,3888, 8,3896, 8, 648, 0, 0,3904, 8,3912,3920, + 8, 8, 8,3928, 8,3936, 8,3944, 8,3952,3960, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 160, 0, 0, 0, 72, 72, 72,3968, 40, 40, 40,3976, + 8, 8,3984, 80,3992, 72,4000, 40,4008, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 88,4016, 8, 8,4024, 656,4032,4040, 0,4048, + 8, 648,4056, 8, 472,4064, 0, 8,4072, 0, 0, 8,4080, 0, 8, 200, + 4088, 8, 8,4096,4104, 632,4112,4120, 336, 8, 8,4128,4136, 8, 160, 80, + 4144, 8,4152,4160,4168, 8, 8,4176, 336, 8, 8,4184,4192,4200, 384,4208, + 8, 488, 664,4216,4224, 0, 0, 0,4232,4240,4248, 8, 8,4256,4264, 80, + 4272, 240, 128,4280,4288,4296,4304,4312,4320, 8, 8,4328,4336,4344,4352, 0, + 8, 8, 8,4360,4368,4376, 656, 0, 8, 8, 8,4384,4392, 80, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 672,4400,4408,4416, 0, 0, + 8, 8, 8,4424,4432, 80,4440, 0, 8, 8,4448,4456, 80, 288,4464, 0, + 8,4472,4480,4488, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 664,4496, 0, 0, 0, 0, 0, 0, 72, 72, 40, 40, 320,4504, + 4512,4520, 8,4528,4536, 80, 0, 0, 0, 0,4544, 8, 8,4552,4560, 0, + 4568, 8, 8,4576,4584,4592, 8, 8,4600,4608,4616, 8, 8, 8, 8, 160, + 4624, 0, 0, 0, 0, 0,4632, 0, 0, 0, 0, 0, 8, 8,4640, 80, + 128, 8, 672,4648,4656, 320, 528,4664, 8,4672,4680,4688, 0, 0, 0, 0, + 4696, 8, 8,4704,4712, 80,4720, 8,4728,4736, 80, 8, 8,4744, 80, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,4752, + 4760, 256, 8,4768,4776,4784, 0, 0, 0, 0, 0, 248, 88,4792,4800,4808, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 192, 0, 0, 0, 0, 0, 0, + 104, 104, 104, 104, 104, 104,4816,4824, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 368, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8,4832, + 8, 8, 8, 136,4840,4848, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 176, + 8, 8, 8, 8, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 680,4856, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 160, 8, 120, 360, 8, 8, 8, 8, 120, 80, 8, 112,4864, + 8, 8, 8,4872,4880,4888,4896,4904, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,4912, 8,4920, 80, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 72, 72, 40, 40, 88,4928, 72,4936, 40,4944, 0, 0, + 8, 8, 8, 8,4952,4960, 688, 688,4968,4976, 0, 0, 0, 0,4984,4992, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 328, 0,5000, + 8, 120, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 696, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,5008, + 8, 8, 696,5016, 0,5024,5032, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 184, + 8, 8, 8, 8, 8, 8, 176, 152, 160,5040,5048, 0, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5056, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5064, 24, 376, 24,5072, + 64, 64, 544, 64, 704, 24, 24, 24, 24, 24, 24, 24, 352, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 272, + 24, 24,5080, 24, 24, 24,5088,5096,5104, 24,5112, 24, 24, 24, 576, 0, + 24, 24, 24, 24,5120, 0, 0, 0, 0, 0, 0, 0, 88, 712, 88, 712, + 24, 24, 24, 24, 24, 608, 88, 640, 0, 0, 0, 0, 0, 0, 0, 0, + 72, 296, 40, 720, 728,5128, 168, 72, 392,5136,5144,5152,5160, 72, 296, 40, + 5168,5176, 40,5184,5192,5200, 736, 72, 744, 40, 72, 296, 40, 720, 728, 40, + 168, 72, 392, 736, 72, 744, 40, 72, 296, 40,5208, 72,5216,5224,5232,5240, + 40,5248, 72,5256,5264,5272,5280, 40,5288, 72,5296, 40,5304, 288, 288, 288, + 64, 64, 64,5312, 64, 64,5320,5328,5336,5344, 464, 0, 0, 0, 0, 0, + 5352,5360,5368, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5376,5384,5392, 96, 96, 96,5400, 0,5408, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 152,5416,5424, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,5432, 0, 8, 8,5440,5448, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,5456, 80, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 680,5464, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 120,5472,5480, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,5488, 120, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,5496, 704, 0, 0, + 72, 72, 392, 40,5504, 360, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 384, 88, 88,5512,5520, 0, 0, 0, 0, + 384, 88,5528,5536, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5544, 8,5552,5560,5568,5576,5584,5592,5600, 184,5608, 184, 0, 0, 0,5616, + 24, 24, 216, 24, 24, 24, 24, 24, 24, 352, 584, 400, 400, 400, 24, 272, + 5624, 24, 24, 24, 24, 24, 24, 24, 24, 24, 408, 0, 0, 0,5632, 24, + 5640, 24, 24, 216, 752, 760, 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5648, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,5656, 280, 280, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 264, 216, 376, + 216, 24, 24, 24, 416, 264, 24, 24, 416, 24, 408, 216, 760,5664, 0, 0, + 24, 24, 24, 24, 24, 416, 408, 280,5672, 24, 24, 24,5680,5688,5696, 752, + 24, 24, 24, 24, 24, 24, 24, 24, 24,5704, 24, 24, 24, 24, 24,5712, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, + 8, 112, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 112, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 248, 8, + 8, 8, 8, 8, 8, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 8, 8, 8, 176, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 192, 0, 0, 0, 0, 0, 0, 0, 0, + 5720, 0, 136, 136, 136, 136, 136, 136, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,5728, + 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, + 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, + 20, 20, 20, 20, 20, 20, 20, 20, 12, 12, 12, 12, 12, 12, 12, 12, + 24, 24, 24, 24, 24, 24, 24, 24, 28, 28, 28, 28, 28, 28, 28, 28, + 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 40, 40, 40, + 48, 48, 48, 48, 48, 48, 48, 48, 52, 52, 52, 52, 52, 52, 52, 52, + 44, 44, 44, 44, 44, 44, 44, 44, 36, 36, 36, 36, 36, 36, 36, 36, + 64, 64, 64, 64, 64, 64, 64, 64, 92, 92, 92, 92, 92, 92, 92, 92, + 84, 84, 84, 84, 84, 84, 84, 84, 80, 80, 80, 80, 80, 80, 80, 80, + 68, 68, 68, 68, 68, 68, 68, 68, 56, 56, 56, 56, 56, 56, 56, 56, + 12, 12, 12, 12, 228, 232, 228, 232, 12, 12, 468, 468, 32, 472, 32, 472, + 32, 32, 32, 692, 12, 12, 696, 12, 56, 56, 56, 56, 56, 56, 56, 700, + 704, 72, 708, 72, 72, 72, 712, 72, 60, 60, 60, 60, 60, 60, 60, 60, + 716, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 720, 308, 724, 308, 308, + 728, 732, 236, 236, 736, 236, 740, 744, 748, 752, 36, 36, 756, 760, 36, 764, + 36, 36, 36, 36, 36, 768, 36, 36, 772, 312, 312, 312, 776, 36, 36, 36, + 316, 316, 316, 780, 320, 320, 320, 784, 476, 476, 788, 792, 796, 800, 804, 36, + 36, 808, 36, 36, 36, 36, 812, 36, 112, 112, 112, 112, 112, 816, 820, 112, + 824, 828, 832, 836, 840, 844, 848, 852, 856, 860, 864, 868, 872, 876, 880, 884, + 888, 892, 896, 900, 904, 908, 912, 916, 920, 924, 928, 932, 936, 940, 944, 948, + 952, 956, 960, 964, 968, 972, 976, 980, 984, 988, 992, 996,1000,1004,1008,1012, + 1016,1020,1024,1028,1032,1036,1040,1044,1048,1052, 324, 324,1056,1060,1064, 324, + 1068,1072,1076,1080,1084,1088,1092,1096,1100, 328, 328,1104, 328,1108, 0, 0, + 1112,1116,1120,1124,1128,1132, 0, 0, 128, 128, 128, 128, 480, 128,1136,1140, + 128, 480, 128, 484, 484,1144, 0, 0, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 116, 116, 488, 116, 116,1148, 88, 88, 88, 88, 492,1152, 88, 88, + 492, 88, 88,1156, 496,1160, 88, 88, 88, 496, 88, 88, 88,1164, 88,1168, + 88,1172, 108, 108, 108, 108, 108,1176,1180,1184, 240, 240, 240, 240,1188,1192, + 1196,1200,1204,1208,1212,1216,1220,1224, 132, 132, 132, 132, 132,1228, 500, 500, + 1232,1236, 136, 136, 136, 136, 136,1240, 136, 136,1244, 40, 40, 40, 40,1248, + 1252,1256, 504, 504,1260,1264,1268,1272, 332, 332,1276, 332,1280,1284, 132, 132, + 1288,1292, 244, 244, 244,1296, 244,1300, 508, 508,1304, 56, 56, 512,1308, 0, + 140, 140, 140, 140,1312, 140, 140, 140, 248, 248, 248, 248, 336, 336, 336,1316, + 340, 340, 340,1320,1324, 344, 344, 344,1328, 116, 116,1332,1336,1340,1344,1348, + 32, 32,1352, 32, 32,1356,1360,1364, 32, 32, 32,1368, 56, 56, 56, 56, + 72, 516, 72, 72, 516,1372, 72,1376, 72, 72, 72, 520, 520,1380, 72,1384, + 1388, 12, 12, 12, 12, 12, 524,1392, 528, 532, 12, 12, 348, 56, 56,1396, + 12, 12,1400,1404,1408, 12, 32, 32,1412, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 176, 0, 352, 0, 12, 12, 12, 12, 12, 12, 12, 12, 12,1416, + 148, 148, 148, 148, 148, 148, 32, 32, 144, 144, 144, 144, 144, 144, 144,1420, + 116, 116, 488, 356, 356, 356,1424,1428, 88,1432, 180, 180, 180, 180, 60, 60, + 12, 12, 12, 12, 12, 184, 0, 0, 4,1436, 4, 4, 4, 4, 4,1440, + 4, 4, 4, 4, 4,1444, 0, 12,1448, 12,1452,1456,1460, 76, 76, 76, + 76,1464, 536, 100, 100, 100, 100,1468,1472, 252, 252,1476, 8, 8, 8, 8, + 360, 12, 252, 252, 12, 12,1480, 100, 8, 360, 12, 12, 12, 12, 8,1484, + 12, 12, 12, 12, 12, 100, 100,1488, 100, 100, 100, 100, 100,1492, 12, 12, + 4, 4, 4, 4, 12, 12, 12, 12,1496, 24, 24, 24,1500, 364, 364, 364, + 84, 84,1504, 0, 60, 60, 60, 60, 60, 60, 44, 44, 44, 44, 44,1508, + 12, 12,1512, 32, 32, 32, 32, 32,1516, 32, 32, 32, 32, 532, 0,1520, + 540, 540,1524, 176, 368, 368, 368,1528, 256, 256, 256, 256,1532,1536, 112, 112, + 544, 544,1540, 548, 548,1544, 8,1548, 260, 260, 260, 260,1552,1556, 96,1560, + 372, 372, 372,1564,1568,1572, 96, 96, 264, 264, 264, 264,1576,1580, 376,1584, + 1588,1592, 180, 32, 32,1596,1600, 108, 108, 108, 108, 108, 376, 376,1604,1608, + 8, 8,1612, 8,1616, 8, 8,1620, 4, 4, 4, 4, 4, 4, 188, 4, + 4, 4, 4, 4, 4, 552, 0, 0,1624,1628, 236,1632,1636, 36, 36, 36, + 36, 36, 36,1640, 36, 36, 36, 36, 36, 36, 36, 36, 36, 0, 0, 36, + 56, 176,1644, 12, 12, 556,1648,1652, 36, 36, 36, 36, 36, 36, 36,1656, + 152, 12, 228, 232, 228, 232,1660, 536, 100,1664, 8, 360,1668,1672,1676,1680, + 1684, 120,1688,1692, 560, 560, 0, 0, 120, 120, 120, 120, 120, 120, 120,1696, + 1700, 12, 12,1704, 72, 72, 72, 72,1708, 192,1712, 0, 0, 12, 12,1716, + 1720,1724, 380, 380, 380,1728,1732, 156, 564, 564,1736,1740,1744, 568, 568,1748, + 1752,1756, 572, 572,1760,1764, 0, 0, 196, 196, 196, 196, 196, 384, 384, 384, + 1768,1772,1776, 388, 388,1780, 388,1784, 576, 576,1788, 392, 392, 392,1792, 580, + 580,1796,1800,1804, 396, 396, 396,1808, 80, 80, 80,1812, 80,1816,1820, 0, + 1824, 32, 32,1828, 0, 0, 0, 0,1832, 584, 584,1836,1840,1844, 588, 588, + 1848,1852,1856, 0, 0, 0,1860,1864,1868,1872,1876,1880,1884,1888, 0, 0, + 592, 592, 268,1892, 268,1896, 268, 268,1900,1904,1908,1912, 596, 596, 600, 600, + 604, 604, 0, 0, 608, 608,1916,1920, 400, 400, 400,1924,1928,1932,1936,1940, + 1944,1948,1952, 0, 0, 0, 0, 0, 272, 272, 272, 272,1956, 0, 0, 0, + 160, 160, 160,1960, 160, 160, 160,1964, 612, 612,1968,1972, 404, 404,1976, 404, + 1980, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36,1984, + 616, 616,1988,1992,1996,2000, 0,2004, 620, 620,2008, 624, 624,2012, 0,2016, + 2020, 0, 0,2024,2028, 0,2032,2036, 200, 200, 200, 200,2040,2044, 200,2048, + 276, 276, 276, 276,2052,2056,2060,2064, 408, 408, 408,2068,2072, 628, 628,2076, + 164, 164, 164, 164, 164, 164,2080,2084, 412,2088, 412, 412,2092, 0, 0, 0, + 2096,2100,2104, 416, 416, 416,2108,2112,2116,2120,2124,2128,2132,2136,2140,2144, + 2148, 632, 632,2152,2156,2160,2164, 0, 204, 204, 204, 204, 204,2168,2172, 0, + 280, 280, 280, 280,2176,2180, 0, 0, 284, 284, 284,2184, 284,2188, 0, 0, + 288, 288, 288, 288,2192,2196,2200, 0, 420, 420, 420, 636, 636, 96,2204, 0, + 640,2208,2212, 640,2216, 0, 0, 0, 424, 424, 424,2220, 0, 0, 0, 0, + 0, 0, 208, 208, 208, 208, 208,2224,2228,2232,2236,2240,2244,2248, 0, 0, + 0, 0, 644, 648, 648, 644,2252, 0, 292, 292, 292, 292,2256, 212, 212, 212, + 212, 212,2260, 40, 428, 428, 428,2264,2268, 0, 0, 0, 0, 0,2272, 0, + 0, 0, 0, 0, 652, 652,2276,2280,2284, 432, 432,2288,2292, 432,2296, 656, + 656,2300,2304,2308, 0, 0, 0, 0,2312, 660, 660,2316,2320,2324,2328,2332, + 2336,2340,2344, 664, 664,2348,2352, 0, 0, 0, 0, 0, 0, 0,2356,2360, + 436,2364, 436,2368, 436,2372, 0, 0, 0, 0, 0,2376, 440, 440, 440,2380, + 28,2384, 0, 0, 0, 0, 0, 0, 28, 28, 28, 28, 28, 28,2388,2392, + 28, 28, 28, 28,2396, 0, 0, 0, 0, 168, 168, 168, 168, 168, 168,2400, + 20, 20, 20, 20, 20,2404, 20, 20, 20, 20, 20, 20, 20, 20, 20,2408, + 52, 52, 52, 52,2412, 0, 0, 0, 444, 444, 444,2416, 0, 0, 0, 0, + 44, 44, 44,2420,2424,2428,2432, 296, 296, 296, 296,2436,2440,2444,2448,2452, + 216, 216, 216, 216,2456,2460,2464,2468, 216, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 448, 448, 448,2472, 0, 0, 0, 0, 220, 220, 220, 220, + 220,2476, 668,2480, 668,2484, 0, 0, 124, 124, 124, 124,2488, 124, 124, 124, + 2492, 124, 0, 0, 0, 0,2496,2500, 64, 64, 64, 64, 64,2504, 0,2508, + 16,2512, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16,2516, + 0, 0, 0, 0, 0, 0, 0,2520,2524, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,2528,2532, 0,2536,2540, 68, + 68, 68, 68, 68, 68, 68, 68,2544, 172, 172, 172, 172, 172, 172,2548,2552, + 2556,2560, 224, 0, 0, 0, 0, 0, 12, 12, 12, 12, 12, 12, 12, 192, + 12, 12, 12,2564, 12, 452, 12, 452, 56, 56, 512, 56,2568, 12, 12, 12, + 12, 12, 12, 12, 224, 0, 0, 0, 12, 12, 12, 12, 12, 12, 12, 456, + 12, 12,2572, 12, 12, 12,2576,2580,2584, 12,2588, 12, 12, 12, 352, 0, + 72, 72, 72, 72,2592, 0, 0, 0, 0, 0, 0, 0, 12, 224, 12, 224, + 12, 12, 12, 12, 12,2596, 12, 300, 12, 12, 12, 12, 12, 524, 12, 12, + 12,2600,2604,2608,2612, 12, 12, 12,2616,2620, 12,2624,2628,2632, 12, 12, + 12, 12,2636, 12, 12, 12, 12, 12, 12, 12, 12, 12,2640, 12, 12, 12, + 2644,2648,2652, 0, 0, 0, 0, 0, 32,2656,2660, 0, 0, 0, 0, 0, + 2664,2668,2672, 60, 60, 60,2676, 0,2680, 0, 0, 0, 0, 0, 0, 0, + 672, 672,2684,2688,2692, 0, 0, 0, 0,2696,2700, 0, 460, 460, 460,2704, + 0, 0, 0, 0, 0, 676, 676,2708, 0, 0, 0, 0, 0, 680, 680,2712, + 0, 0, 0, 0, 684,2716, 684,2720, 0, 0, 0, 0, 0, 0,2724,2728, + 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,2732,2736, 0, 0, + 304, 304, 304, 304,2740,2744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 152, + 12, 12, 12,2748, 0, 0, 0, 0, 152, 12, 12, 184, 0, 0, 0, 0, + 2752, 36,2756,2760,2764,2768,2772,2776,2780, 688,2784, 688, 0, 0, 0,2788, + 12, 12, 156, 12, 12, 12, 12, 12, 12, 224, 528, 152, 152, 152, 12, 456, + 12, 12, 184, 0, 0, 0,2792, 12,2796, 12, 12, 156, 300, 348, 456, 0, + 12, 12, 12, 12, 12,2800, 192, 192, 12, 12, 12, 12, 12, 176, 156, 452, + 156, 12, 12, 12, 464, 176, 12, 12, 464, 12, 184, 156, 348, 300, 0, 0, + 12, 12, 12, 12, 12, 464, 184, 192,2804, 12, 12, 12,2808,2812,2816, 300, + 12, 556, 12, 12, 12, 12, 12, 352, 4, 4, 4, 4, 4, 4, 0, 0, + 4, 188, 4, 4, 4, 4, 4, 4, 4, 4, 188, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4,2820, 4, 4, 4, 4, 4, 4, 188, 0, 0, + 4, 188, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4,2824, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 552,2828, 0, 12, 12, 12, 12, 12, 12, + 0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8, 12, 12, 12, 12, + 16, 16, 16, 16, 20, 20, 20, 20, 36, 36, 36, 36, 32, 32, 32, 32, + 24, 24, 24, 24, 28, 28, 28, 28, 40, 40, 40, 40, 48, 48, 48, 48, + 44, 44, 44, 44, 56, 56, 56, 56, 52, 52, 52, 52, 60, 60, 60, 60, + 64, 64, 64, 64, 76, 76, 76, 76, 68, 68, 68, 68, 80, 80, 80, 80, + 84, 84, 84, 84, 88, 88, 88, 88, 72, 72, 72, 72, 96, 96, 96, 96, + 100, 100, 100, 100, 92, 92, 92, 92, 104, 104, 104, 104, 116, 116, 116, 116, + 120, 120, 120, 120, 124, 124, 124, 124, 108, 108, 108, 108, 132, 132, 132, 132, + 112, 112, 112, 112, 136, 136, 136, 136, 128, 128, 128, 128, 148, 148, 148, 148, + 144, 144, 144, 144, 152, 152, 152, 152, 452, 12, 12, 12, 12, 12, 12, 0, + 180, 180, 180, 180, 176, 176, 176, 176, 184, 184, 184, 184, 140, 140, 140, 140, + 12, 12, 264, 0, 72, 232, 72, 232, 12, 12, 12, 264, 4, 4, 4, 600, + 12, 12, 12, 364, 240, 240, 240, 240, 168, 168, 168, 168, 188, 188, 188, 188, + 248, 248, 248, 248, 252, 252, 252, 252, 160, 160, 160, 160, 204, 204, 204, 204, + 12, 0, 0, 0, 764, 24, 24, 24, 24, 24, 628, 12, 164, 164, 164, 164, + 236, 236, 236, 236, 156, 156, 156, 156, 292, 292, 292, 292, 300, 300, 300, 300, + 268, 268, 268, 268, 208, 208, 208, 208, 324, 324, 324, 324, 192, 192, 192, 192, + 312, 312, 312, 312, 344, 344, 344, 344, 244, 244, 244, 244, 196, 196, 196, 196, + 276, 276, 276, 276, 316, 316, 316, 316, 212, 212, 212, 212, 12, 12, 364, 0, + 216, 216, 216, 216, 220, 220, 220, 220, 256, 256, 256, 256, 476, 476, 476, 476, + 396, 396, 396, 396, 172, 172, 172, 172, 228, 228, 228, 228, 260, 260, 260, 260, + 408, 408, 408, 408, 320, 320, 320, 320, 480, 480, 480, 480, 264, 0, 0, 0, + 12, 12, 296, 0, 412, 412, 412, 412, 8, 8, 8, 812, 484, 484, 484, 484, + 416, 416, 416, 416, 272, 272, 272, 272, 304, 304, 304, 304, 488, 488, 488, 488, + 496, 496, 496, 496, 308, 308, 308, 308, 456, 456, 456, 456, 460, 460, 460, 460, + 420, 420, 420, 420, 368, 368, 368, 368, 328, 328, 328, 328, 372, 372, 372, 372, + 348, 348, 348, 348, 352, 352, 352, 352, 380, 380, 380, 380, 432, 432, 432, 432, + 200, 200, 200, 200, 280, 280, 280, 280, 284, 284, 284, 284, 436, 436, 436, 436, + 440, 440, 440, 440, 364, 0, 0, 0, 12, 264, 0, 0, 444, 444, 444, 444, + 12, 12, 0, 0, 12, 12, 768, 12, 24, 628, 24, 24, 400, 400, 400, 400, + 112, 112, 892, 112, 112, 112, 112,1048, 124,1052, 0,1056, 72, 72, 684, 636, + 684, 636, 72, 72, 136, 136, 900, 0, 340, 340, 340, 0, 156, 156, 904, 0, + 52, 52, 52,1072, 68, 688, 68, 688, 68, 772, 68, 68, 12, 648, 12, 12, + 12, 12, 12, 296, 24, 24, 24,1092, 916, 92, 92, 92, 520, 520, 520, 520, + 524, 524, 524, 524, 572, 572, 572, 572, 4, 4, 600, 0, 296, 12, 12, 12, + 108, 108, 108,1132, 576, 576, 576, 576, 536, 536, 536, 536, 492, 492, 492, 492, + 540, 540, 540, 540, 500, 500, 924, 500, 528, 528, 528, 528, 604, 604, 604, 604, + 608, 608, 608, 608, 464, 464,1144, 0, 612, 612, 612, 612, 616, 616, 616, 616, + 532, 532, 532, 532, 504, 504, 504, 504, 544, 544, 544, 544, 548, 548, 548, 548, + 552, 552, 552, 552, 588, 588, 588, 588, 376, 376, 376, 376, 352, 352,1188, 0, + 424, 424, 424, 424, 384, 384,1200, 384, 384, 384, 384, 384, 556, 556, 556, 556, + 388, 388, 388, 388, 392, 392, 392, 392, 472, 472, 472, 472, 512, 512, 512, 512, + 356, 356, 356, 356, 560, 560, 560, 560, 564, 564, 564, 564, 516, 516, 516, 516, + 28, 28, 28, 0, 24, 24, 840, 12, 24, 840,1264, 12, 68,1268, 844,1272, + 0,1276, 848, 772,1280, 68, 68, 68,1284, 144, 144, 144, 60,1288, 60, 60, + 852, 220, 220, 220, 220, 952, 852, 220, 220, 220, 952, 852, 956, 164, 164, 164, + 164, 164, 0, 0, 164, 164, 960,1292, 164,1296, 0, 0, 28, 964, 28, 968, + 28, 28, 972, 972, 968, 28,1300, 52, 52,1304, 28, 28,1308, 28, 28, 28, + 28, 28, 28, 964, 256, 256, 256,1312, 256, 256, 976,1316,1320, 0, 0, 0, + 396, 396,1324,1328, 400, 400, 400,1332, 400, 400, 400,1336, 632, 632, 632, 632, + 632, 632, 632,1340, 256, 256, 976, 0, 980, 984, 28, 28,1344, 28, 28, 28, + 1348,1352, 120, 120, 120,1356, 120, 120, 332,1360, 332, 776, 776, 332, 332, 332, + 332, 332,1364, 332,1368, 988,1372, 332, 332, 776, 776, 992, 0,1376, 0,1380, + 332, 988, 332, 332, 332, 332, 332, 992, 856, 856, 860, 996,1000, 568, 568, 568, + 568, 568, 864, 568, 864,1384,1004, 864, 860, 996,1000,1004,1388, 0, 856,1392, + 0,1396, 568, 568, 568, 860, 0, 0, 780, 780, 448, 784, 784, 448, 448, 448, + 448, 448,1008, 448,1008, 780, 868, 448, 448, 784, 784, 868,1400, 0, 0, 0, + 448,1404, 448, 448, 868, 0, 780, 448, 788, 788, 404, 792, 792, 404, 404, 404, + 404, 404,1012, 404,1012, 788,1016, 404, 404, 792, 792,1016, 0, 788, 0,1408, + 404,1412, 404, 404, 404, 404, 0, 0, 680,1416, 796, 680, 872, 800,1420, 872, + 876,1020, 796, 680, 284, 284, 800, 680, 796, 680, 872, 800,1020, 876, 0, 0, + 0, 680, 284, 284, 284, 284, 796, 0, 288, 288, 288, 728, 728, 288, 288, 288, + 288, 288, 728, 288, 288, 288, 880, 288, 288, 728, 728, 880, 0,1424,1428, 880, + 288,1432, 288, 288, 0,1436, 288, 288, 360, 360, 360, 732, 732, 360, 360, 360, + 360, 360, 732, 360, 360,1024,1028, 360, 360, 732, 732,1028, 0,1440, 0,1444, + 360,1448, 360, 360,1024, 0, 0, 0, 172, 172, 172, 804, 804, 172, 172, 172, + 172, 804, 804, 172, 0, 172, 172, 172, 172,1452, 172, 172, 884, 884, 224, 224, + 224,1032, 888, 224, 224, 224, 224, 224,1456, 224, 224,1460, 224,1032,1464,1468, + 224,1472, 224, 224, 0, 888, 224, 224, 888,1036, 0, 0,1476, 228, 228, 228, + 228, 228,1480, 736, 228, 228, 228, 0,1484,1488,1040, 336, 336, 336, 336, 336, + 336,1492, 336, 336, 336, 336, 336,1044, 336,1496, 336,1040, 336, 336,1044, 336, + 112, 112, 112,1500, 892, 112, 112, 112, 112,1504,1508, 0, 124, 124,1512, 124, + 72, 232, 684, 636, 684, 636, 72, 232, 72, 232, 72, 72, 72, 72, 232, 808, + 72, 72, 72,1516, 72, 72, 636, 0, 116,1060, 116,1060, 640, 640, 640, 640, + 640, 640, 640,1520, 236, 236,1524,1528, 236, 236,1532, 0, 740, 740, 740, 740, + 740,1536, 0,1540, 744, 744, 744, 744, 744,1544, 0, 0, 748, 748, 748, 748, + 748, 0, 0, 0, 896, 896, 896,1064,1064, 0, 0, 0, 136, 136, 136, 900, + 1548,1552, 128, 128, 128, 128,1556, 0, 128, 128,1068, 0, 128, 128,1560, 0, + 40,1564, 0, 0, 340, 340, 340, 340, 340, 340, 340,1568,1572, 340, 340, 340, + 596, 596, 596, 596, 596, 596, 596,1576, 596,1580, 0, 0, 260, 260, 260, 0, + 260, 260,1584, 0, 260, 260,1588,1592, 644, 644, 644, 644, 644, 644, 644,1596, + 156, 156, 156,1600, 156, 156, 156,1604, 156, 156, 156, 904, 52, 52, 52, 0, + 148, 148, 148,1608, 408, 0, 0, 408, 320, 320,1612, 320, 320, 320,1616,1620, + 60, 60,1624, 0, 124, 124,1628,1632, 292, 292, 0, 0,1076, 52, 52, 52, + 1636, 52, 908,1640, 12, 908,1644, 0, 24,1080,1648, 24, 24, 24, 24,1652, + 1656,1080,1660, 24, 24, 24,1664, 24, 24, 24, 24,1668, 68, 68,1084,1084, + 68, 68, 68, 688, 68, 844, 68,1672, 844, 772, 68, 848, 12, 12, 12, 912, + 1676, 12, 12,1088,1680, 0, 0, 0, 12,1684,1096, 12, 768, 12, 12, 12, + 12, 12, 12, 768, 24, 24, 840, 0, 12, 692, 12, 12, 144, 0,1688, 144, + 412, 412, 0,1100,1692, 0, 0,1100, 72, 232, 0, 0, 4, 4,1696, 4, + 4, 0, 0, 0, 4, 600, 0, 0, 12,1700, 12, 12,1704, 4,1708,1712, + 12, 12, 4, 12,1716, 80, 80, 80, 80,1104,1720,1724, 92, 92,1108, 916, + 0,1728, 300, 300,1732, 8, 8, 8, 12, 264, 0, 736, 8, 8, 8,1736, + 92, 92, 92,1108, 92, 92, 12, 12, 36, 36, 36,1740, 36,1744, 0, 0, + 88, 88, 88, 0, 48, 48, 0, 0,1096, 24, 24, 24, 24, 24,1088, 24, + 1112, 24, 24, 24, 520, 520, 520,1748, 416, 416, 0, 0, 268,1116, 0,1752, + 268, 268,1116, 0, 524, 524, 524,1756, 572, 0, 0,1760, 8, 8, 8,1120, + 208, 208, 208,1764, 208, 208,1768,1772, 100, 100, 100,1776, 272,1780, 0, 0, + 272, 272, 272,1124, 272, 272,1124, 272,1784, 0, 0, 0, 0, 0,1788, 324, + 304,1792, 0, 0, 808, 232, 808, 232, 808, 232, 0, 0, 24, 24, 628, 24, + 24,1796,1800, 0, 304, 304, 304,1128, 304, 304,1128, 0, 8, 0, 0, 0, + 8, 812,1804, 8, 8, 8, 8, 0, 24, 816, 0, 0,1808, 220, 0, 956, + 164, 960, 164,1812,1816,1820, 164, 164, 28, 28, 28,1824, 52, 52, 52,1828, + 12, 296, 12, 0, 28,1832, 28, 28, 28, 28, 28,1836, 12,1840, 92, 92, + 92, 92, 92,1844, 820, 8, 820, 8, 820, 8, 820,1120, 12, 296, 12, 296, + 0, 0, 452, 264, 108, 108, 108,1848, 108, 920, 108, 108, 108, 108, 920,1852, + 108, 108, 920, 0, 296, 736, 12, 12, 12, 736, 12, 12, 68, 68, 68, 848, + 1856, 0, 0, 0, 12, 12, 12,1860, 652, 652, 652, 652, 652, 652, 652,1864, + 1868, 0, 0, 0, 908, 12, 12, 12, 576, 0, 0,1872, 696, 696, 696, 696, + 696, 696,1876, 0, 536, 536,1880, 0, 656, 656, 656, 656, 656, 656, 656,1884, + 492, 0, 492, 492, 492,1888, 0, 0, 580, 580, 580, 580, 580, 580, 580,1136, + 580, 580,1136, 0, 308, 0, 308, 308, 308, 308, 308, 0, 540, 540, 0, 0, + 456, 0, 0,1892, 924, 824, 500, 500, 824, 500, 500, 500, 824, 500, 824,1896, + 460, 0, 0, 0, 84,1900, 0, 0, 84,1904, 0, 0, 84, 84, 0, 0, + 24,1908, 24, 24,1912, 24, 816, 0, 528,1916,1920, 528, 528,1924,1928,1932, + 660, 660, 660, 660, 660,1936, 660, 660, 584, 584, 584, 584, 584, 584, 584,1940, + 0,1944, 584, 584, 752, 752, 752, 752,1948,1952,1956, 752, 664, 664, 664, 664, + 664, 664, 664,1960, 700, 700, 700, 700, 700, 700,1964,1968, 704, 704, 704, 704, + 704, 704,1972, 0, 192, 192, 0, 192,1976, 192, 192, 192, 464,1980, 0, 464, + 464,1140,1140, 464, 464, 464, 464, 464, 464,1984,1988,1992, 532,1148,1996, 532, + 532,1148, 0, 0, 420,2000,2004, 420, 668, 668, 668, 668, 668,2008, 668, 668, + 708, 708, 708, 708,2012, 0, 708, 708, 756, 756, 756, 756,2016, 0,1152,2020, + 0, 0,1152, 756, 312, 312,2024, 0,1156, 0, 0, 0,1156, 0,2028, 180, + 504, 504, 0, 0, 504, 504,2032, 0, 368,1160,2036, 368, 368,1160, 0,2040, + 28, 28, 28, 828, 544, 544,2044,1164,1164, 0, 0, 0,1168, 28, 0, 0, + 28, 28,2048, 0, 0, 0,1168, 28, 548, 548, 0, 0, 552, 552,2052, 0, + 712, 712, 712, 712, 712, 712,2056, 0, 672, 672, 672, 672, 672, 672, 672, 0, + 760, 760, 760, 760, 760,2060, 0, 0, 168, 168, 168,1172,2064, 168, 168, 168, + 168,1172, 0,2068,2072, 0, 0,2076, 620, 620, 620, 620, 620, 620,2080, 0, + 620, 620,2084, 0, 328,2088, 328, 328, 328, 328, 0, 0, 588,2092, 0, 0, + 884, 224, 224, 224, 224,1036, 0, 0,2096, 372, 372, 372,2100, 0, 0, 0, + 716,2104,2108,1176, 716, 716, 716,1176, 716, 716,2112, 0, 348, 348,2116, 0, + 348, 348,2120, 0, 468, 928, 468, 832, 832, 468, 468, 468, 468, 468,1180, 468, + 1180, 928,2124, 468, 468, 832, 832,2128, 932,2132, 0, 928, 468,2136, 468, 932, + 468, 932, 0, 0, 376, 376, 936,2140, 376, 936, 376, 376,2144,2148,2152, 376, + 376, 936,2156, 0,2160, 0, 0, 0, 188, 188, 188,2164,2168, 0, 0, 0, + 244, 244, 0, 0, 244, 244,2172, 0, 196,1184, 196, 196, 196, 196, 196,1184, + 276,2176, 0, 0, 276, 276,2180, 0, 128, 128, 128,1068, 100, 0, 0, 0, + 424, 424,1192,2184, 424, 424, 424, 0, 424,1192, 0, 0, 380, 380, 380, 0, + 2188, 0, 0,2192, 428,1196,2196, 428, 428,2200, 428, 428, 428, 428, 428, 428, + 428,2204,2208, 428, 428,1196, 0, 0, 428, 428,2212, 0, 384,2216, 0, 0, + 316, 316, 0, 0,2220, 0, 0, 0, 432, 432,2224, 0, 120, 120,2228, 0, + 176, 176, 0, 0,1204, 0, 0, 0, 556, 556,1204, 0, 200, 200,2232, 200, + 200,2236, 200, 200, 200,2240, 0, 0, 200, 200, 200,2244,2248, 388, 388, 388, + 388, 388,2252, 388, 388,2256, 0, 0, 392,1208,1212, 392, 392,1208,2260,1212, + 392, 392, 0, 0, 392, 392,2264, 0, 508,1216,2268, 508, 508, 508, 508, 508, + 508, 508, 508,2272,1216, 508,2276, 0, 508, 508,2280, 0, 472, 472, 472, 0, + 472, 472,2284, 0, 720, 720, 720, 720, 720, 720,2288, 0,2292, 280, 280, 280, + 280, 280,1220,2296, 280, 280,1220, 0,2300, 0, 0, 0, 800, 0, 0, 876, + 32, 32,2304, 0, 32, 32, 32,2308, 32,2312, 0, 0, 32, 0, 0, 0, + 2316, 0, 0, 0, 20,2320, 0, 0, 20, 20,2324, 0, 56,2328, 0, 0, + 436, 436,2332, 0, 48, 48,2336, 0, 592, 592, 592, 592, 592, 592, 592,2340, + 592, 592,2344,2348, 212, 212, 212,2352, 212, 212,2356, 0, 624, 624, 624, 624, + 624, 624, 624,1224, 624,1224, 0, 0, 160,2360, 0, 0, 160, 160,1228, 160, + 1228, 160, 160, 160, 160, 160, 0,2364, 440, 440,2368, 0, 204, 204,2372, 0, + 512, 512,2376, 512, 512, 0, 0, 0, 132, 132,2380,1232, 132, 132, 0,1232, + 2384,2388, 0, 0, 4,1236, 0, 0, 64,2392, 0, 0, 0, 0, 0,2396, + 16, 16, 16,1240,1240, 0, 0, 0, 92,2400, 92,2404,2408, 80, 80, 80, + 2412, 0, 0, 0,2416, 0, 0, 0,1104,2420, 0, 0, 0, 92, 0, 0, + 76, 76, 76, 0, 140, 140,2424, 0, 140, 140, 140,1244, 140, 140,1244, 0, + 140, 140,2428, 140, 12, 0, 692, 12, 52,2432, 0, 0, 12, 296, 452, 12, + 12,1248, 912, 12, 12, 12,1248, 52,1076,2436, 52, 12, 12, 12,2440, 912, + 68, 688, 0, 0, 12, 296, 0, 0, 12, 12, 12, 648,2444,2448, 452, 648, + 12, 12, 940, 452, 12, 452, 12, 12, 12, 940, 296, 452, 12, 648, 12, 648, + 12, 12, 940, 296, 12,2452, 692, 12, 648, 12, 12, 12, 12, 264, 12, 12, + 12, 12, 12, 692, 44, 44, 44, 0, 0, 0,2456, 44,2460, 44, 44, 44, + 24, 24, 24, 816, 0,1112, 816, 0, 152,1252, 152, 152, 152, 152,2464, 152, + 2468,2472,1252, 0, 60, 60, 60,2476, 0, 0, 0,2480, 356, 356, 356,2484, + 356, 356, 356,1256, 356, 356,1256,2488, 676, 676, 676, 676, 676, 676, 676,2492, + 444, 444,2496,2500, 560, 560,2504, 0, 564, 564,2508,2512, 516, 516, 516,2516, + 516,2520, 0,2524, 72, 232, 72,2528, 72, 72, 72, 232, 104,2532, 104, 104, + 104,2536, 0, 0, 216, 216, 216, 0, 216, 216,2540,2544, 12, 364, 0, 0, + 28, 724, 28, 28, 944, 948, 724, 28, 828, 28, 836, 0,2548, 984, 836, 724, + 944, 948, 836, 836, 944, 948, 828, 28, 828, 28, 724,2552, 28, 28,1260, 28, + 724, 724,1260, 28, 980, 0, 0, 0, 0, 692, 12, 12,2556, 0, 0, 0, + 12, 12, 364, 12, 12, 12, 296, 692, 12, 296, 364, 452, 12, 12, 12,2560, + 12, 12, 296, 736,2564, 0, 0, 0, 4, 4,1236, 0,2568, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 939, 940, 941, + 942, 946, 948, 0, 962, 969, 970, 971, 976,1001,1002,1003,1008, 0,1033,1040, + 1041,1042,1043,1047, 0, 0,1080,1081,1082,1086,1110, 0, 0,1124,1125,1126, + 1127,1131,1133, 0,1147,1154,1155,1156,1161,1187,1188,1189,1193, 0,1219,1226, + 1227,1228,1229,1233, 0, 0,1267,1268,1269,1273,1298, 0,1303, 943,1128, 944, + 1129, 954,1139, 958,1143, 959,1144, 960,1145, 961,1146, 964,1149, 0, 0, 973, + 1158, 974,1159, 975,1160, 983,1168, 978,1163, 988,1173, 990,1175, 991,1176, 993, + 1178, 994,1179, 0, 0,1004,1190,1005,1191,1006,1192,1014,1199,1007, 0, 0, + 0,1016,1201,1020,1206, 0,1022,1208,1025,1211,1023,1209, 0, 0, 0, 0, + 1032,1218,1037,1223,1035,1221, 0, 0, 0,1044,1230,1045,1231,1049,1235, 0, + 0,1058,1244,1064,1250,1060,1246,1066,1252,1067,1253,1072,1258,1069,1255,1077, + 1264,1074,1261, 0, 0,1083,1270,1084,1271,1085,1272,1088,1275,1089,1276,1096, + 1283,1103,1290,1111,1299,1115,1118,1307,1120,1309,1121,1310, 0,1053,1239, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1093,1280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1489,1503,1494,1500,1508, 0, 0, 0, 0,1520,1521, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0,1526,1528, 0,1525, 0, 0, 0,1522, - 0, 0, 0, 0,1536,1532,1539, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1534, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1556, 0, 0, 0, 0, 0, 0,1548,1550, 0,1547, 0, 0, 0,1567, - 0, 0, 0, 0,1558,1554,1561, 0, 0, 0, 0, 0, 0, 0,1568,1569, - 0, 0, 0, 0, 0, 0, 0, 0, 0,1529,1551, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0,1523,1545,1524,1546, 0, 0,1527,1549, - 0, 0,1570,1571,1530,1552,1531,1553, 0, 0,1533,1555,1535,1557,1537,1559, - 0, 0,1572,1573,1544,1566,1538,1560,1540,1562,1541,1563,1542,1564, 0, 0, - 1543,1565, 0, 0, 0, 0, 0, 0, 0, 0,1606,1607,1609,1608,1610, 0, - 0, 0, 0, 0, 0, 0, 0, 0,1613, 0,1611, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1612, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 949,1134,1010,1195,1050,1236, + 1090,1277,1341,1368,1340,1367,1342,1369,1339,1366, 0,1320,1347,1418,1419,1323, + 1350, 0, 0, 992,1177,1018,1204,1055,1241,1416,1417,1415,1424,1202, 0, 0, + 0, 987,1172, 0, 0,1031,1217,1321,1348,1322,1349,1338,1365, 950,1135, 951, + 1136, 979,1164, 980,1165,1011,1196,1012,1197,1051,1237,1052,1238,1061,1247,1062, + 1248,1091,1278,1092,1279,1071,1257,1076,1263, 0, 0, 997,1182, 0, 0, 0, + 0, 0, 0, 945,1130, 982,1167,1337,1364,1335,1362,1046,1232,1422,1423,1113, + 1301, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, + 10,1425, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0,1314,1427, 5,1434,1438,1443, 0,1450, 0,1455,1461,1514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1620, 0, 0, 0, 0, 0, 0, 0,1623, 0, 0,1624, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,1446,1458,1468,1476,1480,1486,1517, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1614,1615,1616,1617,1618,1619,1621,1622, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,1628,1629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,1625,1626, 0,1627, 0, 0, 0,1634, 0, 0,1635, 0, + 0, 0, 0, 0, 0, 0, 0,1489,1503,1494,1500,1508, 0, 0, 0, 0, + 1520,1521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1526,1528, 0, + 1525, 0, 0, 0,1522, 0, 0, 0, 0,1536,1532,1539, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,1534, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,1556, 0, 0, 0, 0, 0, 0,1548,1550, 0, + 1547, 0, 0, 0,1567, 0, 0, 0, 0,1558,1554,1561, 0, 0, 0, 0, + 0, 0, 0,1568,1569, 0, 0, 0, 0, 0, 0, 0, 0, 0,1529,1551, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1523,1545,1524, + 1546, 0, 0,1527,1549, 0, 0,1570,1571,1530,1552,1531,1553, 0, 0,1533, + 1555,1535,1557,1537,1559, 0, 0,1572,1573,1544,1566,1538,1560,1540,1562,1541, + 1563,1542,1564, 0, 0,1543,1565, 0, 0, 0, 0, 0, 0, 0, 0,1606, + 1607,1609,1608,1610, 0, 0, 0, 0, 0, 0, 0, 0, 0,1613, 0,1611, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1630,1631,1632, 0, 0,1633, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1639, 0, 0,1638,1640, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,1636,1637, 0, 0, 0, 0, 0, 0,1641, 0, 0, 0, + 1612, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,1620, 0, 0, 0, 0, 0, 0, 0,1623, 0, + 0,1624, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,1614,1615,1616,1617,1618,1619,1621,1622, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,1628,1629, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,1625,1626, 0,1627, 0, 0, 0, + 1634, 0, 0,1635, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,1630,1631,1632, 0, 0,1633, 0, 0, 0, 0, + 0, 0, 0, 0, 0,1639, 0, 0,1638,1640, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,1636,1637, 0, 0, 0, 0, 0, + 0,1641, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,1642,1644,1643, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,1645, 0, 0, 0, 0, 0, 0, 0,1646, 0, 0, + 0, 0, 0, 0,1648,1649, 0,1647,1650, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,1651,1653,1652, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,1654, 0,1655,1657,1656, 0, 0, 0, 0, + 1659, 0, 0, 0, 0, 0, 0, 0, 0, 0,1660, 0, 0, 0, 0,1661, + 0, 0, 0, 0,1662, 0, 0, 0, 0,1663, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,1658, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1664, 0,1665,1673, 0,1674, 0, 0, 0, 0, 0, 0, 0, 0,1666, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1642,1644,1643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1645, 0, 0, 0, 0, 0, 0, 0,1646, 0, 0, 0, 0, 0, 0,1648, - 1649, 0,1647,1650, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1651,1653,1652, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1654, 0,1655,1657,1656, 0, 0, 0, 0,1659, 0, 0, 0, 0, - 0, 0, 0, 0, 0,1660, 0, 0, 0, 0,1661, 0, 0, 0, 0,1662, - 0, 0, 0, 0,1663, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1658, 0, 0, 0, 0, 0, 0, 0, 0, 0,1664, 0,1665,1673, 0, - 1674, 0, 0, 0, 0, 0, 0, 0, 0,1666, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1668, 0, 0, 0, 0, - 0, 0, 0, 0, 0,1669, 0, 0, 0, 0,1670, 0, 0, 0, 0,1671, - 0, 0, 0, 0,1672, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1667, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1675, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1676, 0, - 1677, 0,1678, 0,1679, 0,1680, 0, 0, 0,1681, 0, 0, 0, 0, 0, + 1668, 0, 0, 0, 0, 0, 0, 0, 0, 0,1669, 0, 0, 0, 0,1670, + 0, 0, 0, 0,1671, 0, 0, 0, 0,1672, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,1667, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,1675, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,1676, 0,1677, 0,1678, 0,1679, 0,1680, 0, 0, 0,1681, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,1682, 0,1683, 0, 0,1684,1685, 0,1686, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 953,1138, 955,1140, 956,1141, 957,1142, - 1324,1351, 963,1148, 965,1150, 968,1153, 966,1151, 967,1152,1378,1380,1379,1381, - 984,1169, 985,1170,1420,1421, 986,1171, 989,1174, 995,1180, 998,1183, 996,1181, - 999,1184,1000,1185,1015,1200,1329,1356,1017,1203,1019,1205,1021,1207,1024,1210, - 1687,1688,1027,1213,1026,1212,1028,1214,1029,1215,1030,1216,1034,1220,1036,1222, - 1039,1225,1038,1224,1334,1361,1336,1363,1382,1384,1383,1385,1056,1242,1057,1243, - 1059,1245,1063,1249,1689,1690,1065,1251,1068,1254,1070,1256,1386,1387,1388,1389, - 1691,1692,1073,1259,1075,1262,1079,1266,1078,1265,1095,1282,1098,1285,1097,1284, - 1390,1391,1392,1393,1099,1286,1100,1287,1101,1288,1102,1289,1105,1292,1104,1291, - 1106,1294,1107,1295,1108,1296,1114,1302,1119,1308,1122,1311,1123,1312,1186,1260, - 1293,1305, 0,1394, 0, 0, 0, 0, 952,1137, 947,1132,1317,1344,1316,1343, - 1319,1346,1318,1345,1693,1695,1371,1375,1370,1374,1373,1377,1372,1376,1694,1696, - 981,1166, 977,1162, 972,1157,1326,1353,1325,1352,1328,1355,1327,1354,1697,1698, - 1009,1194,1013,1198,1054,1240,1048,1234,1331,1358,1330,1357,1333,1360,1332,1359, - 1699,1700,1396,1401,1395,1400,1398,1403,1397,1402,1399,1404,1094,1281,1087,1274, - 1406,1411,1405,1410,1408,1413,1407,1412,1409,1414,1109,1297,1117,1306,1116,1304, - 1112,1300, 0, 0, 0, 0, 0, 0,1471,1472,1701,1705,1702,1706,1703,1707, - 1430,1431,1715,1719,1716,1720,1717,1721,1477,1478,1729,1731,1730,1732, 0, 0, - 1435,1436,1733,1735,1734,1736, 0, 0,1481,1482,1737,1741,1738,1742,1739,1743, - 1439,1440,1751,1755,1752,1756,1753,1757,1490,1491,1765,1768,1766,1769,1767,1770, - 1447,1448,1771,1774,1772,1775,1773,1776,1495,1496,1777,1779,1778,1780, 0, 0, - 1451,1452,1781,1783,1782,1784, 0, 0,1504,1505,1785,1788,1786,1789,1787,1790, - 0,1459, 0,1791, 0,1792, 0,1793,1509,1510,1794,1798,1795,1799,1796,1800, - 1462,1463,1808,1812,1809,1813,1810,1814,1467, 21,1475, 22,1479, 23,1485, 24, - 1493, 27,1499, 28,1507, 29, 0, 0,1704,1708,1709,1710,1711,1712,1713,1714, - 1718,1722,1723,1724,1725,1726,1727,1728,1740,1744,1745,1746,1747,1748,1749,1750, - 1754,1758,1759,1760,1761,1762,1763,1764,1797,1801,1802,1803,1804,1805,1806,1807, - 1811,1815,1816,1817,1818,1819,1820,1821,1470,1469,1822,1474,1465, 0,1473,1825, - 1429,1428,1426, 12,1432, 0, 26, 0, 0,1315,1823,1484,1466, 0,1483,1829, - 1433, 13,1437, 14,1441,1826,1827,1828,1488,1487,1513, 19, 0, 0,1492,1515, - 1445,1444,1442, 15, 0,1831,1832,1833,1502,1501,1516, 25,1497,1498,1506,1518, - 1457,1456,1454, 17,1453,1313, 11, 3, 0, 0,1824,1512,1519, 0,1511,1830, - 1449, 16,1460, 18,1464, 4, 0, 0, 30, 31, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, - 0, 0, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1834,1835, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0,1836, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0,1837,1839,1838, 0, 0, 0, 0,1840, 0, 0, 0, - 0,1841, 0, 0,1842, 0, 0, 0, 0, 0, 0, 0,1843, 0,1844, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0,1845, 0, 0,1846, 0, 0,1847, - 0,1848, 0, 0, 0, 0, 0, 0, 937, 0,1850, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0,1849, 936, 938,1851,1852, 0, 0,1853,1854, 0, 0, - 1855,1856, 0, 0, 0, 0, 0, 0,1857,1858, 0, 0,1861,1862, 0, 0, - 1863,1864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,1867,1868,1869,1870,1859,1860,1865,1866, 0, 0, 0, 0, - 0, 0,1871,1872,1873,1874, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 32, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,1875, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,1877, 0,1878, 0,1879, 0,1880, 0,1881, 0,1882, 0, - 1883, 0,1884, 0,1885, 0,1886, 0,1887, 0,1888, 0, 0,1889, 0,1890, - 0,1891, 0, 0, 0, 0, 0, 0,1892,1893, 0,1894,1895, 0,1896,1897, - 0,1898,1899, 0,1900,1901, 0, 0, 0, 0, 0, 0,1876, 0, 0, 0, - 0, 0, 0, 0, 0, 0,1902, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0,1904, 0,1905, 0,1906, 0,1907, 0,1908, 0,1909, 0, - 1910, 0,1911, 0,1912, 0,1913, 0,1914, 0,1915, 0, 0,1916, 0,1917, - 0,1918, 0, 0, 0, 0, 0, 0,1919,1920, 0,1921,1922, 0,1923,1924, - 0,1925,1926, 0,1927,1928, 0, 0, 0, 0, 0, 0,1903, 0, 0,1929, - 1930,1931,1932, 0, 0, 0,1933, 0, 710, 385, 724, 715, 455, 103, 186, 825, - 825, 242, 751, 205, 241, 336, 524, 601, 663, 676, 688, 738, 411, 434, 474, 500, - 649, 746, 799, 108, 180, 416, 482, 662, 810, 275, 462, 658, 692, 344, 618, 679, - 293, 388, 440, 492, 740, 116, 146, 168, 368, 414, 481, 527, 606, 660, 665, 722, - 781, 803, 809, 538, 553, 588, 642, 758, 811, 701, 233, 299, 573, 612, 487, 540, - 714, 779, 232, 267, 412, 445, 457, 585, 594, 766, 167, 613, 149, 148, 560, 589, - 648, 768, 708, 345, 411, 704, 105, 259, 313, 496, 518, 174, 542, 120, 307, 101, - 430, 372, 584, 183, 228, 529, 650, 697, 424, 732, 428, 349, 632, 355, 517, 110, - 135, 147, 403, 580, 624, 700, 750, 170, 193, 245, 297, 374, 463, 543, 763, 801, - 812, 815, 162, 384, 420, 730, 287, 330, 337, 366, 459, 476, 509, 558, 591, 610, - 726, 652, 734, 759, 154, 163, 198, 473, 683, 697, 292, 311, 353, 423, 572, 494, - 113, 217, 259, 280, 314, 499, 506, 603, 608, 752, 778, 782, 788, 117, 557, 748, - 774, 320, 109, 126, 260, 265, 373, 411, 479, 523, 655, 737, 823, 380, 765, 161, - 395, 398, 438, 451, 502, 516, 537, 583, 791, 136, 340, 769, 122, 273, 446, 727, - 305, 322, 400, 496, 771, 155, 190, 269, 377, 391, 406, 432, 501, 519, 599, 684, - 687, 749, 776, 175, 452, 191, 480, 510, 659, 772, 805, 813, 397, 444, 619, 566, - 568, 575, 491, 471, 707, 111, 636, 156, 153, 288, 346, 578, 256, 435, 383, 729, - 680, 767, 694, 295, 128, 210, 0, 0, 227, 0, 379, 0, 0, 150, 493, 525, - 544, 551, 552, 556, 783, 576, 604, 0, 661, 0, 703, 0, 0, 735, 743, 0, - 0, 0, 793, 794, 795, 808, 741, 773, 118, 127, 130, 166, 169, 177, 207, 213, - 215, 226, 229, 268, 270, 317, 327, 329, 335, 369, 375, 381, 404, 441, 448, 458, - 477, 484, 503, 539, 545, 547, 546, 548, 549, 550, 554, 555, 561, 564, 569, 591, - 593, 595, 598, 607, 620, 625, 625, 651, 690, 695, 705, 706, 716, 717, 733, 735, - 777, 786, 790, 315, 869, 623, 0, 0, 102, 145, 134, 115, 129, 138, 165, 171, - 207, 202, 206, 212, 227, 231, 240, 243, 250, 254, 294, 296, 303, 308, 319, 325, - 321, 329, 326, 335, 341, 357, 360, 362, 370, 379, 388, 389, 393, 421, 424, 438, - 456, 454, 458, 465, 477, 535, 485, 490, 493, 507, 512, 514, 521, 522, 525, 526, - 528, 533, 532, 541, 565, 569, 574, 586, 591, 597, 607, 637, 647, 674, 691, 693, - 695, 698, 703, 699, 705, 704, 702, 706, 709, 717, 728, 736, 747, 754, 770, 777, - 783, 784, 786, 787, 790, 802, 825, 848, 847, 857, 55, 65, 66, 883, 892, 916, - 822, 824, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0,1586, 0,1605, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1602,1603,1934,1935,1574,1575,1576,1577,1579,1580,1581,1583,1584, 0, - 1585,1587,1588,1589,1591, 0,1592, 0,1593,1594, 0,1595,1596, 0,1598,1599, - 1600,1601,1604,1582,1578,1590,1597, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,1936, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1937, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,1682, 0,1683, 0, 0,1684,1685, 0, + 1686, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 953,1138, 955, + 1140, 956,1141, 957,1142,1324,1351, 963,1148, 965,1150, 968,1153, 966,1151, 967, + 1152,1378,1380,1379,1381, 984,1169, 985,1170,1420,1421, 986,1171, 989,1174, 995, + 1180, 998,1183, 996,1181, 999,1184,1000,1185,1015,1200,1329,1356,1017,1203,1019, + 1205,1021,1207,1024,1210,1687,1688,1027,1213,1026,1212,1028,1214,1029,1215,1030, + 1216,1034,1220,1036,1222,1039,1225,1038,1224,1334,1361,1336,1363,1382,1384,1383, + 1385,1056,1242,1057,1243,1059,1245,1063,1249,1689,1690,1065,1251,1068,1254,1070, + 1256,1386,1387,1388,1389,1691,1692,1073,1259,1075,1262,1079,1266,1078,1265,1095, + 1282,1098,1285,1097,1284,1390,1391,1392,1393,1099,1286,1100,1287,1101,1288,1102, + 1289,1105,1292,1104,1291,1106,1294,1107,1295,1108,1296,1114,1302,1119,1308,1122, + 1311,1123,1312,1186,1260,1293,1305, 0,1394, 0, 0, 0, 0, 952,1137, 947, + 1132,1317,1344,1316,1343,1319,1346,1318,1345,1693,1695,1371,1375,1370,1374,1373, + 1377,1372,1376,1694,1696, 981,1166, 977,1162, 972,1157,1326,1353,1325,1352,1328, + 1355,1327,1354,1697,1698,1009,1194,1013,1198,1054,1240,1048,1234,1331,1358,1330, + 1357,1333,1360,1332,1359,1699,1700,1396,1401,1395,1400,1398,1403,1397,1402,1399, + 1404,1094,1281,1087,1274,1406,1411,1405,1410,1408,1413,1407,1412,1409,1414,1109, + 1297,1117,1306,1116,1304,1112,1300, 0, 0, 0, 0, 0, 0,1471,1472,1701, + 1705,1702,1706,1703,1707,1430,1431,1715,1719,1716,1720,1717,1721,1477,1478,1729, + 1731,1730,1732, 0, 0,1435,1436,1733,1735,1734,1736, 0, 0,1481,1482,1737, + 1741,1738,1742,1739,1743,1439,1440,1751,1755,1752,1756,1753,1757,1490,1491,1765, + 1768,1766,1769,1767,1770,1447,1448,1771,1774,1772,1775,1773,1776,1495,1496,1777, + 1779,1778,1780, 0, 0,1451,1452,1781,1783,1782,1784, 0, 0,1504,1505,1785, + 1788,1786,1789,1787,1790, 0,1459, 0,1791, 0,1792, 0,1793,1509,1510,1794, + 1798,1795,1799,1796,1800,1462,1463,1808,1812,1809,1813,1810,1814,1467, 21,1475, + 22,1479, 23,1485, 24,1493, 27,1499, 28,1507, 29, 0, 0,1704,1708,1709, + 1710,1711,1712,1713,1714,1718,1722,1723,1724,1725,1726,1727,1728,1740,1744,1745, + 1746,1747,1748,1749,1750,1754,1758,1759,1760,1761,1762,1763,1764,1797,1801,1802, + 1803,1804,1805,1806,1807,1811,1815,1816,1817,1818,1819,1820,1821,1470,1469,1822, + 1474,1465, 0,1473,1825,1429,1428,1426, 12,1432, 0, 26, 0, 0,1315,1823, + 1484,1466, 0,1483,1829,1433, 13,1437, 14,1441,1826,1827,1828,1488,1487,1513, + 19, 0, 0,1492,1515,1445,1444,1442, 15, 0,1831,1832,1833,1502,1501,1516, + 25,1497,1498,1506,1518,1457,1456,1454, 17,1453,1313, 11, 3, 0, 0,1824, + 1512,1519, 0,1511,1830,1449, 16,1460, 18,1464, 4, 0, 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1938, 0,1939, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,1940, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0,1941,1942, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,1943,1944, 0, 0, 0, 0, 0, 0,1945, 0,1946, 0, 0, - 0, 0, 0, 0, 0, 0,1947, 0, 0,1948, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1950, 0,1949, - 1951, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,1953,1952, 0,1954, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0,1955,1956, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1957, 0, 0, 0, 0, 0, 0, 0, 0,1958,1961,1959,1965,1960,1962,1964, - 1963, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1967,1966,1968, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0,1969,1970,1971,1972,1973,1974,1975, 0, 0, 0, + 0, 0, 0, 20, 0, 0, 0, 2, 6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,1834,1835, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1836, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1837,1839,1838, 0, 0, 0, + 0,1840, 0, 0, 0, 0,1841, 0, 0,1842, 0, 0, 0, 0, 0, 0, + 0,1843, 0,1844, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1845, 0, + 0,1846, 0, 0,1847, 0,1848, 0, 0, 0, 0, 0, 0, 937, 0,1850, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1849, 936, 938,1851,1852, 0, + 0,1853,1854, 0, 0,1855,1856, 0, 0, 0, 0, 0, 0,1857,1858, 0, + 0,1861,1862, 0, 0,1863,1864, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,1867,1868,1869,1870,1859,1860,1865, + 1866, 0, 0, 0, 0, 0, 0,1871,1872,1873,1874, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 32, 33, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,1875, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,1877, 0,1878, 0,1879, 0,1880, + 0,1881, 0,1882, 0,1883, 0,1884, 0,1885, 0,1886, 0,1887, 0,1888, + 0, 0,1889, 0,1890, 0,1891, 0, 0, 0, 0, 0, 0,1892,1893, 0, + 1894,1895, 0,1896,1897, 0,1898,1899, 0,1900,1901, 0, 0, 0, 0, 0, + 0,1876, 0, 0, 0, 0, 0, 0, 0, 0, 0,1902, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,1904, 0,1905, 0,1906, 0,1907, + 0,1908, 0,1909, 0,1910, 0,1911, 0,1912, 0,1913, 0,1914, 0,1915, + 0, 0,1916, 0,1917, 0,1918, 0, 0, 0, 0, 0, 0,1919,1920, 0, + 1921,1922, 0,1923,1924, 0,1925,1926, 0,1927,1928, 0, 0, 0, 0, 0, + 0,1903, 0, 0,1929,1930,1931,1932, 0, 0, 0,1933, 0, 710, 385, 724, + 715, 455, 103, 186, 825, 825, 242, 751, 205, 241, 336, 524, 601, 663, 676, 688, + 738, 411, 434, 474, 500, 649, 746, 799, 108, 180, 416, 482, 662, 810, 275, 462, + 658, 692, 344, 618, 679, 293, 388, 440, 492, 740, 116, 146, 168, 368, 414, 481, + 527, 606, 660, 665, 722, 781, 803, 809, 538, 553, 588, 642, 758, 811, 701, 233, + 299, 573, 612, 487, 540, 714, 779, 232, 267, 412, 445, 457, 585, 594, 766, 167, + 613, 149, 148, 560, 589, 648, 768, 708, 345, 411, 704, 105, 259, 313, 496, 518, + 174, 542, 120, 307, 101, 430, 372, 584, 183, 228, 529, 650, 697, 424, 732, 428, + 349, 632, 355, 517, 110, 135, 147, 403, 580, 624, 700, 750, 170, 193, 245, 297, + 374, 463, 543, 763, 801, 812, 815, 162, 384, 420, 730, 287, 330, 337, 366, 459, + 476, 509, 558, 591, 610, 726, 652, 734, 759, 154, 163, 198, 473, 683, 697, 292, + 311, 353, 423, 572, 494, 113, 217, 259, 280, 314, 499, 506, 603, 608, 752, 778, + 782, 788, 117, 557, 748, 774, 320, 109, 126, 260, 265, 373, 411, 479, 523, 655, + 737, 823, 380, 765, 161, 395, 398, 438, 451, 502, 516, 537, 583, 791, 136, 340, + 769, 122, 273, 446, 727, 305, 322, 400, 496, 771, 155, 190, 269, 377, 391, 406, + 432, 501, 519, 599, 684, 687, 749, 776, 175, 452, 191, 480, 510, 659, 772, 805, + 813, 397, 444, 619, 566, 568, 575, 491, 471, 707, 111, 636, 156, 153, 288, 346, + 578, 256, 435, 383, 729, 680, 767, 694, 295, 128, 210, 0, 0, 227, 0, 379, + 0, 0, 150, 493, 525, 544, 551, 552, 556, 783, 576, 604, 0, 661, 0, 703, + 0, 0, 735, 743, 0, 0, 0, 793, 794, 795, 808, 741, 773, 118, 127, 130, + 166, 169, 177, 207, 213, 215, 226, 229, 268, 270, 317, 327, 329, 335, 369, 375, + 381, 404, 441, 448, 458, 477, 484, 503, 539, 545, 547, 546, 548, 549, 550, 554, + 555, 561, 564, 569, 591, 593, 595, 598, 607, 620, 625, 625, 651, 690, 695, 705, + 706, 716, 717, 733, 735, 777, 786, 790, 315, 869, 623, 0, 0, 102, 145, 134, + 115, 129, 138, 165, 171, 207, 202, 206, 212, 227, 231, 240, 243, 250, 254, 294, + 296, 303, 308, 319, 325, 321, 329, 326, 335, 341, 357, 360, 362, 370, 379, 388, + 389, 393, 421, 424, 438, 456, 454, 458, 465, 477, 535, 485, 490, 493, 507, 512, + 514, 521, 522, 525, 526, 528, 533, 532, 541, 565, 569, 574, 586, 591, 597, 607, + 637, 647, 674, 691, 693, 695, 698, 703, 699, 705, 704, 702, 706, 709, 717, 728, + 736, 747, 754, 770, 777, 783, 784, 786, 787, 790, 802, 825, 848, 847, 857, 55, + 65, 66, 883, 892, 916, 822, 824, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1586, 0,1605, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,1602,1603,1934,1935,1574,1575,1576,1577,1579, + 1580,1581,1583,1584, 0,1585,1587,1588,1589,1591, 0,1592, 0,1593,1594, 0, + 1595,1596, 0,1598,1599,1600,1601,1604,1582,1578,1590,1597, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,1936, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0,1937, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,1938, 0,1939, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,1940, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1941,1942, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,1943,1944, 0, 0, 0, 0, 0, 0, + 1945, 0,1946, 0, 0, 0, 0, 0, 0, 0, 0,1947, 0, 0,1948, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0,1976,1977,1978,1980,1979,1981, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 106, 104, 107, 826, 114, 118, 119, 121, - 123, 124, 127, 125, 34, 830, 130, 131, 132, 137, 827, 35, 133, 139, 829, 142, - 143, 112, 144, 145, 924, 151, 152, 37, 157, 158, 159, 160, 38, 165, 166, 169, - 171, 172, 173, 174, 176, 177, 178, 179, 181, 182, 182, 182, 833, 468, 184, 185, - 834, 187, 188, 189, 196, 192, 194, 195, 197, 199, 200, 201, 203, 204, 204, 206, - 208, 209, 211, 218, 213, 219, 214, 216, 153, 234, 221, 222, 223, 220, 225, 224, - 230, 835, 235, 236, 237, 238, 239, 244, 836, 837, 247, 248, 249, 246, 251, 39, - 40, 253, 255, 255, 838, 257, 258, 259, 261, 839, 262, 263, 301, 264, 41, 266, - 270, 272, 271, 841, 274, 842, 277, 276, 278, 281, 282, 42, 283, 284, 285, 286, - 43, 843, 44, 289, 290, 291, 293, 934, 298, 845, 845, 621, 300, 300, 45, 852, - 894, 302, 304, 46, 306, 309, 310, 312, 316, 48, 47, 317, 846, 318, 323, 324, - 325, 324, 328, 329, 333, 331, 332, 334, 335, 336, 338, 339, 342, 343, 347, 351, - 849, 350, 348, 352, 354, 359, 850, 361, 358, 356, 49, 363, 365, 367, 364, 50, - 369, 371, 851, 376, 386, 378, 53, 381, 52, 51, 140, 141, 387, 382, 614, 78, - 388, 389, 390, 394, 392, 856, 54, 399, 396, 402, 404, 858, 405, 401, 407, 55, - 408, 409, 410, 413, 859, 415, 56, 417, 860, 418, 57, 419, 422, 424, 425, 861, - 840, 862, 426, 863, 429, 431, 427, 433, 437, 441, 438, 439, 442, 443, 864, 436, - 449, 450, 58, 454, 453, 865, 447, 460, 866, 867, 461, 466, 465, 464, 59, 467, - 470, 469, 472, 828, 475, 868, 478, 870, 483, 485, 486, 871, 488, 489, 872, 873, - 495, 497, 60, 498, 61, 61, 504, 505, 507, 508, 511, 62, 513, 874, 515, 875, - 518, 844, 520, 876, 877, 878, 63, 64, 528, 880, 879, 881, 882, 530, 531, 531, - 533, 66, 534, 67, 68, 884, 536, 538, 541, 69, 885, 549, 886, 887, 556, 559, - 70, 561, 562, 563, 888, 889, 889, 567, 71, 890, 570, 571, 72, 891, 577, 73, - 581, 579, 582, 893, 587, 74, 590, 592, 596, 75, 895, 896, 76, 897, 600, 898, - 602, 605, 607, 899, 900, 609, 901, 611, 853, 77, 615, 616, 79, 617, 252, 902, - 903, 854, 855, 621, 622, 731, 80, 627, 626, 628, 164, 629, 630, 631, 633, 904, - 632, 634, 639, 640, 635, 641, 646, 651, 638, 643, 644, 645, 905, 907, 906, 81, - 653, 654, 656, 911, 657, 908, 82, 83, 909, 910, 84, 664, 665, 666, 667, 669, - 668, 671, 670, 674, 672, 673, 675, 85, 677, 678, 86, 681, 682, 912, 685, 686, - 87, 689, 36, 913, 914, 88, 89, 696, 702, 709, 711, 915, 712, 713, 718, 719, - 917, 831, 721, 720, 723, 832, 725, 728, 918, 919, 739, 742, 744, 920, 745, 753, - 756, 757, 755, 760, 761, 921, 762, 90, 764, 922, 91, 775, 279, 780, 923, 925, - 92, 93, 785, 926, 94, 927, 787, 787, 789, 928, 792, 95, 796, 797, 798, 800, - 96, 929, 802, 804, 806, 97, 98, 807, 930, 99, 931, 932, 933, 814, 100, 816, - 817, 818, 819, 820, 821, 935, 0, 0, + 0, 0,1950, 0,1949,1951, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,1953,1952, 0,1954, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,1955,1956, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,1957, 0, 0, 0, 0, 0, 0, 0, 0,1958,1961, + 1959,1965,1960,1962,1964,1963, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,1967,1966,1968, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,1969,1970,1971,1972,1973, + 1974,1975, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,1976,1977,1978,1980,1979,1981, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106, 104, 107, + 826, 114, 118, 119, 121, 123, 124, 127, 125, 34, 830, 130, 131, 132, 137, 827, + 35, 133, 139, 829, 142, 143, 112, 144, 145, 924, 151, 152, 37, 157, 158, 159, + 160, 38, 165, 166, 169, 171, 172, 173, 174, 176, 177, 178, 179, 181, 182, 182, + 182, 833, 468, 184, 185, 834, 187, 188, 189, 196, 192, 194, 195, 197, 199, 200, + 201, 203, 204, 204, 206, 208, 209, 211, 218, 213, 219, 214, 216, 153, 234, 221, + 222, 223, 220, 225, 224, 230, 835, 235, 236, 237, 238, 239, 244, 836, 837, 247, + 248, 249, 246, 251, 39, 40, 253, 255, 255, 838, 257, 258, 259, 261, 839, 262, + 263, 301, 264, 41, 266, 270, 272, 271, 841, 274, 842, 277, 276, 278, 281, 282, + 42, 283, 284, 285, 286, 43, 843, 44, 289, 290, 291, 293, 934, 298, 845, 845, + 621, 300, 300, 45, 852, 894, 302, 304, 46, 306, 309, 310, 312, 316, 48, 47, + 317, 846, 318, 323, 324, 325, 324, 328, 329, 333, 331, 332, 334, 335, 336, 338, + 339, 342, 343, 347, 351, 849, 350, 348, 352, 354, 359, 850, 361, 358, 356, 49, + 363, 365, 367, 364, 50, 369, 371, 851, 376, 386, 378, 53, 381, 52, 51, 140, + 141, 387, 382, 614, 78, 388, 389, 390, 394, 392, 856, 54, 399, 396, 402, 404, + 858, 405, 401, 407, 55, 408, 409, 410, 413, 859, 415, 56, 417, 860, 418, 57, + 419, 422, 424, 425, 861, 840, 862, 426, 863, 429, 431, 427, 433, 437, 441, 438, + 439, 442, 443, 864, 436, 449, 450, 58, 454, 453, 865, 447, 460, 866, 867, 461, + 466, 465, 464, 59, 467, 470, 469, 472, 828, 475, 868, 478, 870, 483, 485, 486, + 871, 488, 489, 872, 873, 495, 497, 60, 498, 61, 61, 504, 505, 507, 508, 511, + 62, 513, 874, 515, 875, 518, 844, 520, 876, 877, 878, 63, 64, 528, 880, 879, + 881, 882, 530, 531, 531, 533, 66, 534, 67, 68, 884, 536, 538, 541, 69, 885, + 549, 886, 887, 556, 559, 70, 561, 562, 563, 888, 889, 889, 567, 71, 890, 570, + 571, 72, 891, 577, 73, 581, 579, 582, 893, 587, 74, 590, 592, 596, 75, 895, + 896, 76, 897, 600, 898, 602, 605, 607, 899, 900, 609, 901, 611, 853, 77, 615, + 616, 79, 617, 252, 902, 903, 854, 855, 621, 622, 731, 80, 627, 626, 628, 164, + 629, 630, 631, 633, 904, 632, 634, 639, 640, 635, 641, 646, 651, 638, 643, 644, + 645, 905, 907, 906, 81, 653, 654, 656, 911, 657, 908, 82, 83, 909, 910, 84, + 664, 665, 666, 667, 669, 668, 671, 670, 674, 672, 673, 675, 85, 677, 678, 86, + 681, 682, 912, 685, 686, 87, 689, 36, 913, 914, 88, 89, 696, 702, 709, 711, + 915, 712, 713, 718, 719, 917, 831, 721, 720, 723, 832, 725, 728, 918, 919, 739, + 742, 744, 920, 745, 753, 756, 757, 755, 760, 761, 921, 762, 90, 764, 922, 91, + 775, 279, 780, 923, 925, 92, 93, 785, 926, 94, 927, 787, 787, 789, 928, 792, + 95, 796, 797, 798, 800, 96, 929, 802, 804, 806, 97, 98, 807, 930, 99, 931, + 932, 933, 814, 100, 816, 817, 818, 819, 820, 821, 935, 0, 0, }; static const int16_t _hb_ucd_i16[92]= { - 0, 0, 1, -1, 2, 0, -2, 0, 0, 2, 0, -2, 0, 16, 0, -16, - 0, 1, -1, 0, 3, 3, 3, -3, -3, -3, 0, 2016, 0, 2527, 1923, 1914, - 1918, 0, 2250, 0, 0, 138, 0, 7, -7, 0, -1, 1, 1824, 0, 2104, 0, + 0, 0, 1, -1, -1, 1, 0, 1, -1, 0, 0, 2, 0, -2, 2, 0, + -2, 0, -7, 0, 0, 16, 0, -16, 3, 3, 3, -3, -3, -3, 0, 2016, + 0, 2527, 1923, 1914, 1918, 0, 2250, 0, 0, 138, 0, 7, 1824, 0, 2104, 0, 2108, 2106, 0, 2106, 1316, 0, -1, -138, 8, 8, 8, 0, 7, 7, -8, -8, -8, -7,-1316, 1, -1, 3, -3, 1, 0,-1914,-1918, 0, 0,-1923,-1824, 0, 0,-2016,-2104, 0, 0,-2106,-2108,-2106,-2250, 0,-2527, 0, @@ -4360,11 +4357,13 @@ static const int16_t _hb_ucd_i16[92]= static inline uint8_t _hb_ucd_gc (unsigned u) { - return u<1114110 ? _hb_ucd_u8[6560u+((_hb_ucd_u8[816u+((_hb_ucd_u16[((_hb_ucd_u8[272u+((_hb_ucd_u8[((((((((u)>>1))>>3))>>4))>>4)])<<4)+((((((((u)>>1))>>3))>>4))&15)])<<4)+((((((u)>>1))>>3))&15)])<<3)+((((u)>>1))&7)])<<1)+((u)&1)] : 2; + /* packtab: [2^8,2^4,2^4,2^3,2^1] */ + return u<1114110u ? (uint8_t)(_hb_ucd_u8[6536u+((_hb_ucd_u8[800u+_hb_ucd_u16[((_hb_ucd_u8[272u+((_hb_ucd_u8[((((((((u)>>1))>>3))>>4))>>4)])<<4)+((((((((u)>>1))>>3))>>4))&15)])<<4)+((((((u)>>1))>>3))&15)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2; } static inline uint8_t _hb_ucd_ccc (unsigned u) { - return u<125259 ? _hb_ucd_u8[8620u+((_hb_ucd_u8[8036u+((_hb_ucd_u8[7556u+((_hb_ucd_u8[7188u+((_hb_ucd_u8[6942u+((((((((u)>>2))>>2))>>2))>>3)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)] : 0; + /* packtab: [2^8,2^3,2^2,2^2,2^2] */ + return u<125259u ? (uint8_t)(_hb_ucd_u8[8589u+((_hb_ucd_u8[8006u+((_hb_ucd_u8[7529u+((_hb_ucd_u8[7163u+((_hb_ucd_u8[6918u+((((((((u)>>2))>>2))>>2))>>3)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 0; } static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i) { @@ -4372,15 +4371,18 @@ static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i) } static inline int16_t _hb_ucd_bmg (unsigned u) { - return u<65380 ? _hb_ucd_i16[((_hb_ucd_u8[9516u+((_hb_ucd_u8[9284u+((_hb_ucd_u8[9188u+((_hb_ucd_b4(_hb_ucd_u8+9124u,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)])<<3)+((((((u)>>1))>>2))&7)])<<2)+((((u)>>1))&3)])<<1)+((u)&1)] : 0; + /* packtab: [2^4,2^3,2^3,2^2,2^1] */ + return u<65380u ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[9480u+_hb_ucd_u8[9251u+_hb_ucd_u8[9157u+((_hb_ucd_b4(_hb_ucd_u8+9093u,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)]+((((((u)>>1))>>2))&7)]+((((u)>>1))&3)]+((u)&1)]) : 0; } static inline uint8_t _hb_ucd_sc (unsigned u) { - return u<918000 ? _hb_ucd_u8[10950u+((_hb_ucd_u16[4648u+((_hb_ucd_u16[2608u+((_hb_ucd_u8[10214u+((_hb_ucd_u8[9764u+((((((((u)>>2))>>2))>>3))>>4)])<<4)+((((((((u)>>2))>>2))>>3))&15)])<<3)+((((((u)>>2))>>2))&7)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)] : 2; + /* packtab: [2^8,2^4,2^3,2^2,2^2] */ + return u<918000u ? (uint8_t)(_hb_ucd_u8[10913u+_hb_ucd_u16[4624u+_hb_ucd_u16[2592u+((_hb_ucd_u8[10177u+((_hb_ucd_u8[9728u+((((((((u)>>2))>>2))>>3))>>4)])<<4)+((((((((u)>>2))>>2))>>3))&15)])<<3)+((((((u)>>2))>>2))&7)]+((((u)>>2))&3)]+((u)&3)]) : 2; } static inline uint16_t _hb_ucd_dm (unsigned u) { - return u<195102 ? _hb_ucd_u16[7480u+((_hb_ucd_u8[13904u+((_hb_ucd_u8[13522u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)] : 0; + /* packtab: [2^8,2^5,2^4] */ + return u<195102u ? (uint16_t)(_hb_ucd_u16[7453u+((_hb_ucd_u8[13867u+((_hb_ucd_u8[13485u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0; } @@ -4388,824 +4390,824 @@ static inline uint16_t _hb_ucd_dm (unsigned u) #include -static const uint8_t _hb_ucd_u8[13937]= +static const uint8_t _hb_ucd_u8[13905]= { - 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 9, 10, 7, 7, 7, 7, 7, 11, 12, 12, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 7, 21, 22, 22, 22, 23, 24, 7, 7, - 7, 25, 22, 22, 22, 26, 27, 28, 22, 29, 30, 31, 32, 33, 34, 35, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 21, 22, 36, - 7, 7, 7, 7, 7, 7, 37, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 38, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 34, 34, 34, 35, 36, 37, 34, 34, 34, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 62, 63, 64, 65, 66, 67, 68, 69, 67, 70, 71, - 67, 67, 62, 72, 62, 62, 73, 67, 74, 75, 76, 77, 78, 67, 67, 67, - 79, 80, 34, 81, 82, 83, 67, 67, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 84, 34, 34, 34, 34, - 85, 34, 34, 34, 34, 34, 34, 34, 34, 86, 34, 34, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 34, 34, 34, 34, 34, 34, 34, 34, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, - 100,100, 34, 34, 34, 34,101,102, 34, 34,103,104,105,106,107,108, - 34, 34,109,110,111,112,113,114,115,116,117,118, 34, 34, 34,119, - 120,121,122,123,124,125,126,127, 34,128,129,130,131,132,133,134, - 135,136,137,138,139,140,141,142,143,144,111,145,146,147,148,111, - 149,150,151,152,153,154,155,156,157,158,159,160,111,161,162,163, - 34, 34, 34, 34, 34, 34, 34, 34,164, 34, 34,111,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,165, - 34, 34, 34, 34, 34, 34, 34, 34,166, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111, - 111,111,167,111,111,111,111,111,111,111,111,111,111,111,111,111, - 34, 34, 34, 34,168,169,170, 34,111,111,171,111,172,173,174,175, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,111,111,111,111, - 111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,119, - 34, 34, 34, 34, 34, 34,111,111,111,111,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111, 34,176,111,111,111,111,111,111, - 111,111,111,111,111,111,111,111, 67,177, 67, 67, 67,178,179, 67, - 67, 67,180,181,182,131, 65,111,183,184,185,186,187,188,189,190, - 67, 67, 67, 67,191,192,111,111,111,111,111,111,111,111,193,111, - 194,195,196,111,111,197,111,111,111,198,111,199,111,200,111, 34, - 34,201,202,111,111,111,111,111,131,203,204,111, 34,205,111,111, - 67, 67,206, 67, 67,111, 67,207, 67, 67, 67, 67, 67, 67, 67, 67, - 67,208, 67, 67, 67, 67, 67,177,111,111,111,111,111,111,111,111, - 34, 34, 34, 34, 34,111,111,111,111,111,111,111,111,111,111,111, - 34, 34, 34, 34, 34, 34, 34, 34, 34,111,111,111,111,111,111,111, - 209,111,195,195,111,111,111,111,111,111,111,111,111,111,111,111, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 2, 4, 5, 6, 2, - 7, 7, 7, 7, 7, 2, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 17, 18, 19, 1, 20, 20, 21, 22, 23, 24, 25, - 26, 27, 15, 2, 28, 29, 27, 30, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 31, 11, 11, 11, 32, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 33, 16, 16, 16, 16, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 34, 34, 34, 34, 34, 34, 34, 34, 16, 32, 32, 32, - 32, 32, 32, 32, 11, 34, 34, 16, 34, 32, 32, 11, 34, 11, 16, 11, - 11, 34, 32, 11, 32, 16, 11, 34, 32, 32, 32, 11, 34, 16, 32, 11, - 34, 11, 34, 34, 32, 35, 32, 16, 36, 36, 37, 34, 38, 37, 34, 34, - 34, 34, 34, 34, 34, 34, 16, 32, 34, 38, 32, 11, 32, 32, 32, 32, - 32, 32, 16, 16, 16, 11, 34, 32, 34, 34, 11, 32, 32, 32, 32, 32, - 16, 16, 36, 16, 16, 16, 16, 16, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 40, 40, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, - 39, 39, 41, 40, 40, 40, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, - 42, 42, 42, 42, 42, 42, 42, 42, 32, 32, 41, 32, 16, 43, 16, 10, - 40, 40, 40, 44, 11, 11, 11, 11, 34, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 34, - 16, 11, 32, 16, 32, 32, 32, 32, 16, 16, 32, 45, 34, 32, 34, 11, - 32, 46, 42, 42, 47, 32, 32, 32, 11, 34, 34, 34, 34, 34, 34, 16, - 11, 11, 11, 11, 48, 2, 2, 2, 16, 16, 16, 16, 49, 50, 51, 52, - 53, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 54, - 55, 56, 42, 55, 42, 42, 42, 42, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 57, 2, 2, 2, 2, 2, 2, 58, 58, 58, 8, 9, 59, 2, 60, - 42, 42, 42, 42, 42, 56, 61, 2, 62, 36, 36, 36, 36, 63, 42, 42, - 7, 7, 7, 7, 7, 2, 2, 36, 64, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 65, 42, 42, 42, 66, 46, 42, 42, 67, 68, 69, 42, 42, 36, - 7, 7, 7, 7, 7, 36, 70, 71, 2, 2, 2, 2, 2, 2, 2, 72, - 63, 36, 36, 36, 36, 36, 36, 36, 42, 42, 42, 42, 42, 42, 64, 36, - 36, 36, 36, 42, 42, 42, 42, 42, 7, 7, 7, 7, 7, 36, 36, 36, - 36, 36, 36, 36, 36, 63, 42, 42, 42, 42, 39, 21, 2, 39, 68, 20, - 36, 36, 36, 42, 42, 68, 42, 42, 42, 42, 68, 42, 68, 42, 42, 42, - 2, 2, 2, 2, 2, 2, 2, 2, 36, 36, 36, 36, 63, 42, 42, 2, - 36, 36, 36, 36, 73, 36, 36, 36, 58, 58, 58, 74, 42, 42, 42, 42, - 36, 36, 36, 36, 75, 42, 42, 42, 42, 74, 42, 42, 42, 42, 42, 42, - 42, 76, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 76, 64, 77, - 78, 42, 42, 42, 76, 77, 78, 77, 63, 42, 42, 42, 36, 36, 36, 36, - 36, 42, 2, 7, 7, 7, 7, 7, 79, 36, 36, 36, 36, 36, 36, 36, - 63, 77, 80, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 64, 77, - 78, 42, 42, 76, 77, 77, 78, 36, 36, 36, 36, 81, 77, 77, 36, 36, - 36, 42, 42, 7, 7, 7, 7, 7, 36, 20, 27, 27, 27, 52, 57, 42, - 42, 76, 80, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 42, 77, - 78, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 64, 36, 36, 36, - 36, 36, 36, 7, 7, 7, 7, 7, 42, 36, 63, 2, 2, 2, 2, 2, - 78, 42, 42, 42, 76, 77, 78, 42, 59, 20, 20, 20, 82, 42, 42, 42, - 42, 77, 80, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 64, 78, - 78, 42, 42, 76, 77, 77, 78, 42, 42, 42, 42, 76, 77, 77, 36, 36, - 71, 27, 27, 27, 27, 27, 27, 27, 42, 64, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 77, 76, 77, 77, 77, 77, 77, 78, 42, - 36, 36, 36, 81, 77, 77, 77, 77, 77, 77, 77, 7, 7, 7, 7, 7, - 27, 83, 60, 60, 52, 60, 60, 60, 76, 77, 64, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 64, 42, 76, 77, 77, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 36, 36, 36, 36, 7, 7, 7, 84, 27, 27, 27, 83, - 63, 77, 65, 36, 36, 36, 36, 36, 77, 77, 77, 76, 77, 77, 42, 42, - 42, 42, 76, 77, 77, 77, 36, 36, 85, 81, 77, 77, 77, 77, 77, 77, - 42, 77, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 63, 64, 77, - 78, 42, 42, 77, 77, 77, 78, 70, 60, 60, 36, 81, 27, 27, 27, 86, - 27, 27, 27, 27, 83, 36, 36, 36, 36, 36, 36, 36, 36, 42, 42, 76, - 77, 42, 42, 42, 77, 77, 77, 77, 7, 77, 2, 2, 2, 2, 2, 2, - 63, 36, 42, 42, 42, 42, 42, 87, 36, 36, 36, 68, 42, 42, 42, 56, - 7, 7, 7, 7, 7, 2, 2, 2, 63, 36, 42, 42, 42, 42, 64, 36, - 36, 36, 36, 39, 42, 42, 42, 42, 7, 7, 7, 7, 7, 7, 36, 36, - 70, 60, 2, 2, 2, 2, 2, 2, 2, 88, 88, 60, 42, 60, 60, 60, - 7, 7, 7, 7, 7, 27, 27, 27, 27, 27, 46, 46, 46, 4, 4, 77, - 63, 42, 42, 42, 42, 42, 42, 76, 42, 42, 56, 42, 36, 36, 63, 42, - 42, 42, 42, 42, 42, 42, 42, 60, 60, 60, 60, 69, 60, 60, 60, 60, - 2, 2, 88, 60, 21, 2, 2, 2, 36, 36, 36, 36, 36, 81, 78, 42, - 76, 42, 42, 42, 78, 76, 78, 64, 36, 36, 36, 77, 42, 36, 36, 42, - 64, 77, 80, 81, 77, 77, 77, 36, 63, 42, 64, 36, 36, 36, 36, 36, - 36, 76, 78, 76, 77, 77, 78, 81, 7, 7, 7, 7, 7, 77, 78, 60, - 16, 16, 16, 16, 16, 49, 43, 16, 36, 36, 36, 36, 36, 36, 63, 42, - 2, 2, 2, 2, 89, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 60, 60, 60, 60, 60, 60, 60, 60, 11, 11, 11, 11, 16, 16, 16, 16, - 90, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 70, 65, - 91, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 92, 93, 93, - 36, 36, 36, 36, 36, 57, 2, 94, 95, 36, 36, 36, 36, 36, 36, 36, - 36, 42, 76, 77, 77, 77, 77, 80, 36, 42, 96, 2, 2, 2, 2, 2, - 36, 42, 42, 42, 42, 42, 42, 42, 36, 36, 42, 78, 42, 42, 42, 77, - 77, 77, 77, 76, 78, 42, 42, 42, 42, 42, 2, 79, 2, 59, 63, 42, - 7, 7, 7, 7, 7, 7, 7, 7, 2, 2, 2, 97, 2, 55, 42, 74, - 36, 75, 36, 36, 36, 36, 36, 36, 36, 36, 63, 64, 36, 36, 36, 36, - 36, 36, 36, 36, 63, 36, 36, 36, 42, 76, 77, 78, 76, 77, 77, 77, - 77, 76, 77, 77, 78, 42, 42, 42, 60, 60, 2, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 27, 27, 60, 36, 36, 36, 63, 76, 78, 42, 2, - 36, 36, 81, 76, 42, 42, 42, 42, 76, 76, 78, 42, 42, 42, 76, 77, - 77, 78, 42, 42, 42, 42, 42, 42, 2, 2, 2, 79, 2, 2, 2, 2, - 42, 42, 42, 42, 42, 42, 42, 98, 42, 42, 80, 36, 36, 36, 36, 36, - 36, 36, 76, 42, 42, 76, 76, 77, 77, 76, 80, 36, 36, 36, 36, 2, - 88, 60, 60, 60, 60, 46, 42, 42, 42, 42, 60, 60, 60, 60, 21, 2, - 42, 80, 36, 36, 36, 36, 36, 36, 81, 42, 42, 77, 42, 78, 42, 36, - 36, 36, 36, 76, 42, 77, 78, 78, 42, 77, 77, 77, 77, 77, 2, 2, - 36, 36, 77, 77, 77, 77, 42, 42, 42, 42, 77, 42, 42, 56, 2, 2, - 7, 7, 7, 7, 7, 7, 85, 36, 36, 36, 36, 36, 39, 39, 39, 2, - 16, 16, 16, 16, 34, 16, 16, 16, 42, 56, 42, 42, 42, 42, 42, 42, - 76, 42, 42, 42, 64, 36, 63, 36, 36, 36, 64, 81, 42, 36, 36, 36, - 16, 16, 16, 16, 16, 16, 39, 39, 39, 39, 39, 39, 39, 43, 16, 16, - 16, 16, 16, 16, 43, 16, 16, 16, 16, 16, 16, 16, 16, 99, 39, 39, - 32, 32, 32, 16, 16, 16, 16, 32, 16, 16, 16, 16, 11, 11, 11, 11, - 16, 16, 16, 16, 34, 11, 11, 11, 16, 16, 16, 16,100,100,100,100, - 16, 16, 16, 16, 11, 11,101,102, 40, 16, 16, 16, 11, 11,101, 40, - 16, 16, 16, 16, 11, 11,103, 40,104,104,104,104,104,105, 58, 58, - 50, 50, 50, 2,106,107,106,107, 2, 2, 2, 2,108, 58, 58,109, - 2, 2, 2, 2,110,111, 2,112,113, 2,114,115, 2, 2, 2, 2, - 2, 9,113, 2, 2, 2, 2,116, 58, 58, 58, 58, 58, 58, 58, 58, - 117, 39, 27, 27, 27, 8,114,118, 27, 27, 27, 27, 27, 8,114, 93, - 20, 20, 20, 20, 20, 20, 20, 20, 42, 42, 42, 42, 42, 42,119, 47, - 98, 47, 98, 42, 42, 42, 42, 42, 60,120, 60,121, 60, 34, 11, 16, - 11, 32,121, 60, 45, 11, 11, 60, 60, 60,120,120,120, 11, 11,122, - 11, 11, 35, 36,123, 60, 16, 11, 8, 8, 45, 16, 16, 26, 60,124, - 94, 94, 94, 94, 94, 94, 94, 94, 94,125,126, 94,127, 60, 60, 60, - 8, 8,128, 60, 60, 8, 60, 60,128, 26, 60,128, 60, 60, 60,128, - 60, 60, 60, 60, 60, 60, 60, 8, 60,128,128, 60, 60, 60, 60, 60, - 60, 60, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 60, 60, 60, 60, 4, 4, 60, 60, 8, 60, 60, 60,129,130, 60, 60, - 60, 60, 60, 60, 60, 60,128, 60, 60, 60, 60, 60, 60, 26, 8, 8, - 8, 8, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 8, 8, - 8, 60, 60, 60, 60, 60, 60, 60, 27, 27, 27, 27, 27, 27, 60, 60, - 60, 60, 60, 60, 60, 27, 27, 27, 60, 60, 60, 26, 60, 60, 60, 60, - 26, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 8, 8, 8, 8, - 60, 60, 60, 60, 60, 60, 60, 26, 60, 60, 60, 60, 4, 4, 4, 4, - 4, 4, 4, 27, 27, 27, 27, 27, 27, 27, 60, 60, 60, 60, 60, 60, - 8, 8,114,131, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, - 8,114,132,132,132,132,132,132,132,132,132,132,131, 8, 8, 8, - 8, 8, 8, 8, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 4, 8, - 8, 8,128, 26, 8, 8,128, 60, 32, 11, 32, 34, 34, 34, 34, 11, - 32, 32, 34, 16, 16, 16, 39, 11, 32, 32,124, 60, 60,121, 34,133, - 42, 32, 16, 16, 49, 2, 89, 2, 36, 36, 36, 36, 36, 36, 36, 75, - 2, 2, 2, 2, 2, 2, 2, 55, 2,106,106, 2,110,111,106, 2, - 2, 2, 2, 6, 2, 97,106, 2,106, 4, 4, 4, 4, 2, 2, 79, - 2, 2, 2, 2, 2, 50, 2, 2, 97,134, 2, 2, 2, 2, 2, 2, - 60, 2,135,132,132,132,136, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 1, 2,137,138, 4, 4, 4, 4, 4, 60, 4, 4, 4, 4,139, 93, - 140, 94, 94, 94, 94, 42, 42, 77,141, 39, 39, 60, 94,142, 57, 60, - 71, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 63,143,144, 62, - 36, 36, 36, 36, 36, 57, 39, 62, 60, 27, 27, 60, 60, 60, 60, 60, - 27, 27, 27, 27, 27, 60, 60, 60, 60, 60, 60, 60, 27, 27, 27, 27, - 145, 27, 27, 27, 27, 27, 27, 27, 36, 36, 75, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36,146, 2, 32, 32, 32, 32, 32, 32, 32, 63, - 47,147, 42, 42, 42, 42, 42, 79, 32, 32, 32, 32, 32, 32, 39, 42, - 36, 36, 36, 94, 94, 94, 94, 94, 42, 2, 2, 2, 2, 2, 2, 2, - 40, 40, 40,144, 39, 39, 39, 39, 40, 32, 32, 32, 32, 32, 32, 32, - 16, 32, 32, 32, 32, 32, 32, 32, 43, 16, 16, 16, 34, 34, 34, 32, - 32, 32, 32, 32, 41,148, 34, 35, 32, 32, 16, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 11, 11, 32, 11, 11, 32, 32, 32, 32, 32, 32, - 32, 32, 11, 11, 34, 34, 32, 32, 32, 32, 32, 32, 32, 32, 11, 11, - 48, 39,149, 35, 39, 35, 36, 36, 36, 64, 36, 64, 36, 63, 36, 36, - 36, 81, 78, 76, 60, 60, 42, 42, 27, 27, 27, 60,150, 60, 60, 60, - 36, 36, 2, 2, 2, 2, 2, 2, 77, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 77, 77, 77, 77, 77, 77, 77, 77, 42, 42, 42, 42, 42, 2, - 42, 36, 36, 36, 2, 65, 65, 63, 36, 36, 36, 42, 42, 42, 42, 2, - 36, 36, 36, 63, 42, 42, 42, 42, 42, 77, 77, 77, 77, 77, 77, 96, - 36, 63, 77, 42, 42, 77, 42, 77, 96, 2, 2, 2, 2, 2, 2, 79, - 7, 7, 7, 7, 7, 7, 7, 2, 36, 36, 63, 62, 36, 36, 36, 36, - 36, 36, 36, 36, 63, 42, 42, 76, 78, 76, 78, 42, 42, 42, 42, 42, - 36, 63, 36, 36, 36, 36, 76, 77, 7, 7, 7, 7, 7, 7, 2, 2, - 62, 36, 36, 70, 60, 81, 76, 36, 64, 42, 64, 63, 64, 36, 36, 42, - 36, 36, 36, 36, 36, 36, 75, 2, 36, 36, 36, 36, 36, 81, 42, 77, - 2, 75,151, 42, 42, 42, 42, 42, 16, 16, 16, 16, 16,102, 39, 39, - 16, 16, 16, 16, 99, 40, 40, 40, 36, 81, 78, 77, 76, 96, 78, 42, - 152,152,152,152,152,152,152,152,153,153,153,153,153,153,153,153, - 16, 16, 16, 16, 16, 16, 35, 64, 36, 36, 36, 36,154, 36, 36, 36, - 36, 40, 40, 40, 40, 40, 40, 40, 40, 22, 60, 60, 60, 60, 60, 60, - 60, 71, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,132, - 60, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 60, 60, 60, 60, - 36, 36, 36, 36, 36, 36,150, 60, 2, 2, 2,135,115, 2, 2, 2, - 6,155,156,132,132,132,132,132,132,132,115,135,115, 2,112,157, - 2, 2, 2, 2,139,132,132,115, 2,158, 8, 8, 59, 2, 2, 2, - 36, 36, 36, 36, 36, 36, 36,159, 2, 2, 3, 2, 4, 5, 6, 2, - 16, 16, 16, 16, 16, 17, 18,114,115, 4, 2, 36, 36, 36, 36, 36, - 62, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 39, - 20,160, 52, 20, 26, 8,128, 60, 60, 60, 60, 60,161, 58, 60, 60, - 2, 2, 2, 89, 27, 27, 27, 27, 27, 27, 27, 83, 60, 60, 60, 60, - 94, 94,127, 27, 83, 60, 60, 60, 60, 60, 60, 60, 60, 27, 60, 60, - 60, 60, 60, 60, 60, 60, 46, 42,162,162,162,162,162,162,162,162, - 163, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 86, 36, - 138, 36, 36, 36, 36, 94, 94, 94, 36, 36, 36, 36, 36, 36, 36, 57, - 164, 94, 94, 94, 94, 94, 94, 94, 11, 11, 11, 32, 16, 16, 16, 16, - 36, 36, 36, 57, 27, 27, 27, 27, 36, 36, 36, 70,145, 27, 27, 27, - 36, 36, 36,165, 27, 27, 27, 27, 36, 36, 36, 36, 36,165, 27, 27, - 36, 36, 36, 27, 27, 27, 27, 30, 36, 36, 36, 36, 36, 36, 27, 36, - 63, 42, 42, 42, 42, 42, 42, 42, 36, 36, 36, 36, 42, 42, 42, 42, - 36, 36, 36, 36, 36, 36,165, 30, 36, 36, 36, 36, 36, 36,165, 27, - 36, 36, 36, 36, 71, 36, 36, 36, 36, 36, 63, 42, 42,163, 27, 27, - 36, 36, 36, 36, 57, 2, 2, 2, 36, 36, 36, 36, 27, 27, 27, 27, - 16, 16, 16, 16, 16, 27, 27, 27, 36, 36, 42, 42, 42, 42, 42, 42, - 7, 7, 7, 7, 7, 36, 36, 62, 11, 11, 11, 11,166, 42, 42,141, - 16, 16, 16, 16, 16, 16, 16, 8, 36, 36, 36, 36, 36, 63,167, 50, - 88, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 42, 42, 42, - 27, 27, 27, 86, 36, 36, 36, 36,163, 27, 30, 2, 2, 2, 2, 2, - 36, 42, 42, 2, 2, 2, 2, 2, 36, 36,165, 27, 27, 27, 27, 27, - 78, 80, 36, 36, 36, 36, 36, 36, 42, 42, 42, 56, 2, 2, 2, 2, - 2, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 7, 7, 7, 7, 7, - 64, 63, 64, 36, 36, 36, 36, 63, 77, 78, 42, 76, 78, 56, 72, 2, - 2, 42, 42, 42, 42, 42, 66, 58, 36, 36, 36, 63, 42, 42, 78, 42, - 42, 42, 42, 7, 7, 7, 7, 7, 2, 2, 81, 80, 36, 36, 36, 36, - 36, 63, 2, 36, 36, 36, 36, 36, 36, 81, 77, 42, 42, 42, 42, 76, - 80, 36, 57, 2, 55, 42, 56, 78, 7, 7, 7, 7, 7, 57, 57, 2, - 89, 27, 27, 27, 27, 27, 27, 27, 36, 36, 36, 36, 36, 36, 77, 78, - 42, 77, 76, 42, 2, 2, 2, 64, 36, 36, 36, 36, 36, 36, 36, 63, - 76, 77, 77, 77, 77, 77, 77, 77, 36, 36, 36, 81, 77, 77, 80, 36, - 36, 77, 77, 42, 42, 42, 42, 42, 36, 36, 36, 36, 77, 78, 42, 42, - 42, 77, 77, 77, 77, 77, 77, 76, 64, 64, 2, 2, 2, 2, 2, 2, - 55, 42, 42, 42, 42, 42, 42, 42, 36, 36, 81, 77, 42, 42, 42, 42, - 77, 42, 76, 64, 36, 57, 2, 2, 7, 7, 7, 7, 7, 2, 2, 64, - 77, 78, 42, 42, 76, 76, 77, 78, 76, 42, 36, 65, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 81, 77, 42, 42, 42, 77, 77, 42, 78, - 56, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, 36, 42, 42, - 77, 78, 42, 42, 42, 76, 78, 78, 56, 2, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 63, 78, 77, 42, 42, 42, 78, 57, 2, 2, 2, - 36, 36, 36, 36, 36, 36, 63, 78, 77, 42, 42, 78, 42, 42, 42, 42, - 7, 7, 7, 7, 7, 27, 2, 88, 42, 42, 42, 42, 78, 56, 2, 2, - 27, 27, 27, 27, 27, 27, 27, 86, 77, 77, 77, 77, 77, 78, 76, 64, - 80, 78, 2, 2, 2, 2, 2, 2, 81, 77, 42, 42, 42, 42, 77, 77, - 64, 65, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 63, 42, 42, 42, 42, 64, 36, 36, 36, 63, 42, 42, 76, 63, 42, 56, - 2, 2, 2, 55, 42, 42, 42, 42, 63, 42, 42, 76, 78, 42, 36, 36, - 36, 36, 36, 36, 36, 42, 42, 42, 42, 42, 42, 76, 42, 2, 65, 2, - 76, 42, 76, 76, 77, 77, 77, 77, 57, 2, 2, 2, 2, 2, 2, 2, - 42, 42, 42, 42, 42, 42, 42, 78, 2, 36, 36, 36, 36, 36, 36, 36, - 42, 42, 42, 42, 76, 42, 42, 42, 76, 42, 78, 42, 42, 42, 42, 42, - 42, 42, 42, 63, 42, 42, 42, 42, 36, 36, 36, 36, 36, 77, 77, 77, - 42, 76, 78, 78, 36, 36, 36, 36, 36, 36, 36, 36, 75, 36, 36, 36, - 36, 63, 76, 96, 2, 2, 2, 2, 42, 81, 36, 36, 36, 36, 36, 36, - 36, 36, 77, 42, 42, 42, 42, 77, 76, 56, 2, 2, 2, 2, 2, 2, - 7, 7, 7, 7, 7, 42, 42, 42, 27, 27, 83, 60, 60, 60, 52, 20, - 150, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 21, - 64, 36, 36, 63, 42, 42, 42, 42, 36, 36, 36, 36, 36, 36, 36, 42, - 42, 42, 42, 42, 42, 77, 78, 42, 42, 42, 56, 2, 2, 2, 2, 2, - 42, 42, 42, 56, 2, 2, 60, 60, 39, 39, 88, 60, 60, 60, 60, 60, - 7, 7, 7, 7, 7,168, 27, 27, 27, 86, 36, 36, 36, 36, 36, 36, - 39, 62, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 75,146, 2, - 27, 27, 27, 30, 2, 2, 2, 2, 11, 11, 11, 11, 11, 32, 16, 16, - 81, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 78, - 42, 67, 39, 39, 39, 39, 39, 39, 39, 79, 42, 42, 42, 42, 42, 42, - 77, 39, 94, 94, 94, 94, 94, 94, 36, 36, 36, 36, 36, 36, 46, 56, - 7, 7, 7, 7, 7, 60, 60, 60, 60, 60,169, 78, 42, 60,169, 77, - 77,170, 58, 58, 58, 74, 42, 42, 42, 69, 46, 42, 42, 42, 60, 60, - 60, 60, 60, 60, 60, 42, 42, 60, 60, 42, 69, 60, 60, 60, 60, 60, - 11, 11, 11, 11, 11, 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 16, 11, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 16, 16, 16, 16, 16, - 31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33, 16, 16, - 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31, 16, 16, - 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, - 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 32, 16, 7, - 42, 42, 42, 69, 60, 46, 42, 42, 42, 42, 42, 42, 42, 42, 69, 60, - 60, 60, 46, 60, 60, 60, 60, 60, 60, 60, 69, 21, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 55, 42, 42, 16, 16, 16, 16, 16,123, 16, 16, - 42, 42, 42, 67, 39, 39, 39, 39, 7, 7, 7, 7, 7, 7, 7, 70, - 36, 36, 36, 36, 36, 36, 42, 42, 7, 7, 7, 7, 7, 7, 7,171, - 36, 36, 36, 36, 36, 75, 42, 42,172, 7, 7, 7, 7, 7, 7, 84, - 36, 63, 36, 64, 36, 36, 36, 42, 36, 36, 63, 42, 42, 42, 42, 75, - 16, 16, 42, 42, 42, 67, 39, 39, 27, 27, 27, 27, 27, 27,145, 27, - 173, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,145, - 27, 27, 27, 27, 27, 27, 83, 60, 60, 60, 60, 60, 60, 25, 40, 40, - 0, 0, 29, 21, 21, 21, 23, 21, 22, 18, 21, 25, 21, 17, 13, 13, - 25, 25, 25, 21, 21, 9, 9, 9, 9, 22, 21, 18, 24, 16, 24, 5, - 5, 5, 5, 22, 25, 18, 25, 0, 23, 23, 26, 21, 24, 26, 7, 20, - 25, 1, 26, 24, 26, 25, 15, 15, 24, 15, 7, 19, 15, 21, 9, 25, - 9, 5, 5, 25, 5, 9, 5, 7, 7, 7, 9, 8, 8, 5, 6, 6, - 24, 24, 6, 24, 12, 12, 6, 5, 9, 21, 25, 9, 26, 12, 11, 11, - 9, 6, 5, 21, 17, 17, 17, 26, 26, 23, 23, 12, 17, 12, 21, 12, - 12, 21, 7, 21, 1, 1, 21, 23, 26, 26, 1, 21, 6, 7, 7, 12, - 12, 7, 21, 7, 12, 1, 12, 6, 6, 12, 12, 26, 7, 26, 26, 7, - 21, 1, 24, 7, 1, 12, 7, 6, 12, 10, 10, 10, 10, 12, 21, 6, - 10, 7, 7, 10, 23, 7, 15, 26, 13, 21, 13, 7, 15, 7, 12, 23, - 21, 26, 21, 15, 17, 7, 29, 7, 7, 22, 18, 18, 14, 14, 14, 7, - 10, 21, 17, 21, 11, 12, 5, 6, 8, 8, 8, 24, 5, 24, 9, 24, - 29, 29, 29, 1, 20, 19, 22, 20, 27, 28, 1, 29, 21, 20, 19, 21, - 21, 16, 16, 21, 25, 22, 18, 21, 21, 29, 15, 6, 18, 6, 12, 11, - 9, 26, 26, 9, 26, 5, 7, 5, 5, 26, 14, 9, 5, 14, 14, 15, - 25, 26, 26, 22, 18, 26, 18, 25, 18, 22, 5, 12, 22, 21, 21, 22, - 18, 17, 26, 6, 7, 14, 17, 22, 26, 14, 17, 6, 14, 6, 12, 24, - 24, 6, 26, 15, 6, 21, 11, 21, 24, 9, 6, 9, 23, 26, 6, 10, - 4, 4, 3, 3, 7, 25, 17, 16, 16, 22, 16, 16, 25, 17, 7, 1, - 25, 24, 26, 1, 2, 2, 12, 15, 21, 14, 7, 15, 9, 12, 12, 17, - 13, 15, 26, 10, 10, 1, 13, 23, 7, 13, 23, 15, 0, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 0, 10, 11, 12, 13, 0, 14, 0, 0, 0, - 0, 0, 15, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, - 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 21, 22, 23, 0, 0, - 0, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, - 0, 36, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 39, 40, 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, - 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, - 0, 0, 0, 0, 3, 0, 0, 0, 4, 5, 6, 7, 0, 8, 9, 10, - 0, 11, 12, 13, 14, 15, 16, 17, 16, 18, 16, 19, 16, 19, 16, 19, - 0, 19, 16, 20, 16, 19, 21, 19, 0, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, - 0, 0, 0, 0, 0, 0, 34, 0, 0, 35, 0, 0, 36, 0, 37, 0, - 0, 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, 0, 0, 47, 0, 0, - 0, 48, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, 50, 0, 51, - 0, 52, 53, 0, 54, 0, 0, 0, 0, 0, 0, 55, 56, 57, 0, 0, - 0, 0, 58, 0, 0, 59, 60, 61, 62, 63, 0, 0, 64, 65, 0, 0, - 0, 66, 0, 0, 0, 0, 67, 0, 0, 0, 68, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 70, 0, 71, - 0, 0, 72, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, 74, 75, - 0, 0, 0, 0, 76, 77, 0, 78, 79, 0, 0, 80, 81, 0, 82, 62, - 0, 83, 84, 0, 0, 85, 86, 87, 0, 88, 0, 89, 0, 90, 0, 0, - 51, 91, 51, 0, 92, 0, 93, 0, 0, 0, 81, 0, 0, 0, 94, 95, - 0, 96, 97, 98, 99, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0,100, - 101, 0, 0, 0, 0, 0, 0,102, 0, 0, 0, 0, 0, 0,103, 0, - 0, 0, 0, 0, 0,104,105, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0,106, 0, 0,107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,108, - 109, 0, 0,110, 0, 0, 0, 0, 0, 0,111, 0,112, 0,105, 0, - 0, 0, 0, 0,113,114, 0, 0, 0, 0, 0, 0, 0,115, 0, 0, - 0,116, 0, 0, 0,117, 0, 0, 0, 0, 0, 0, 0,118, 0,119, - 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 0, 8, 0, - 0, 0, 0, 9, 10, 11, 12, 0, 0, 0, 0, 13, 0, 0, 14, 15, - 0, 16, 0, 17, 18, 0, 0, 19, 0, 20, 21, 0, 0, 0, 0, 0, - 22, 23, 0, 24, 25, 0, 0, 26, 0, 0, 0, 27, 0, 0, 28, 29, - 30, 31, 0, 0, 0, 32, 33, 34, 0, 0, 33, 0, 0, 35, 33, 0, - 0, 0, 33, 36, 0, 0, 0, 0, 0, 37, 38, 0, 0, 0, 0, 0, - 0, 39, 40, 0, 0, 0, 0, 0, 0, 41, 42, 0, 0, 0, 0, 43, - 0, 44, 0, 0, 0, 45, 46, 0, 0, 0, 47, 0, 0, 0, 0, 0, - 0, 48, 49, 0, 0, 0, 0, 50, 0, 0, 0, 51, 0, 52, 0, 53, - 0, 0, 0, 0, 54, 0, 0, 0, 0, 55, 0, 56, 0, 0, 0, 0, - 57, 58, 0, 0, 0, 59, 60, 61, 62, 0, 0, 0, 0, 63, 52, 0, - 64, 65, 0, 0, 66, 0, 0, 0, 67, 68, 0, 0, 0, 69, 0, 70, - 71, 72, 73, 74, 1, 75, 0, 76, 77, 78, 0, 0, 79, 80, 0, 0, - 0, 81, 0, 0, 1, 1, 0, 0, 82, 0, 0, 83, 0, 0, 0, 0, - 79, 84, 0, 85, 0, 0, 0, 0, 0, 80, 86, 0, 87, 0, 52, 0, - 1, 80, 0, 0, 88, 0, 0, 89, 0, 0, 0, 0, 0, 90, 57, 0, - 0, 0, 0, 0, 0, 91, 92, 0, 0, 86, 0, 0, 33, 0, 0, 93, - 0, 0, 0, 0, 94, 0, 0, 0, 0, 49, 0, 0, 95, 0, 0, 0, - 0, 96, 97, 0, 0, 98, 0, 0, 99, 0, 0, 0,100, 0, 0, 0, - 101, 0, 0, 0,102, 0, 0, 0, 0,103,104, 95, 0, 0,105, 0, - 0, 0, 86, 0, 0,106, 0, 0, 0,107,108, 0, 0,109,110, 0, - 0, 0, 0, 0, 0,111, 0, 0,112, 0, 0, 0, 0,113, 33, 0, - 114,115,116, 57, 0, 0,117, 35, 0, 0,118, 0, 0, 0,119, 0, - 0, 0, 0, 0, 0,120, 0, 0,121, 0, 0, 0, 0,122, 90, 0, - 0, 0, 0, 0, 57, 0, 0, 0, 0, 52,123, 0, 0, 0, 0,124, - 0, 0,125, 0, 0, 0, 0,123, 0, 0,126, 0, 0, 0, 0, 0, - 81, 0, 0, 0, 0,127, 0, 0, 0,128, 0, 0, 0,129, 0,130, - 0, 0, 0, 0,131,132,133, 0,134, 0,135, 0, 0, 0,136,137, - 138, 0, 79, 0, 0, 0, 0, 0, 35, 0, 0, 0,139, 0, 0, 0, - 140, 0, 0, 0,141, 0, 0, 0,142,143, 0,144, 0, 0,145, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, - 7, 4, 4, 8, 9, 10, 1, 11, 12, 13, 14, 15, 16, 17, 18, 1, - 1, 1, 19, 1, 0, 0, 20, 21, 22, 1, 23, 4, 21, 24, 25, 26, - 27, 28, 29, 30, 0, 0, 1, 1, 31, 0, 0, 0, 32, 33, 34, 35, - 1, 36, 37, 0, 0, 0, 0, 38, 1, 39, 14, 39, 40, 41, 42, 0, - 0, 0, 43, 36, 44, 45, 21, 45, 46, 0, 0, 0, 19, 1, 21, 0, - 0, 47, 0, 38, 48, 1, 1, 49, 49, 50, 0, 0, 51, 0, 0, 19, - 52, 1, 0, 0, 38, 14, 4, 1, 1, 1, 53, 21, 43, 52, 54, 21, - 35, 1, 0, 0, 0, 55, 0, 0, 0, 56, 57, 58, 0, 0, 0, 0, - 0, 59, 0, 60, 0, 0, 0, 0, 61, 62, 0, 0, 63, 0, 0, 0, - 64, 0, 0, 0, 65, 0, 0, 0, 66, 0, 0, 0, 67, 0, 0, 0, - 68, 0, 0, 69, 70, 0, 71, 72, 73, 74, 75, 76, 0, 0, 0, 77, - 0, 0, 0, 78, 79, 0, 0, 0, 0, 47, 0, 0, 0, 49, 0, 80, - 0, 0, 0, 62, 0, 0, 63, 0, 0, 81, 0, 0, 82, 0, 0, 0, - 83, 0, 0, 19, 84, 0, 62, 0, 0, 0, 0, 49, 1, 85, 1, 52, - 15, 86, 36, 10, 21, 1, 1, 1, 1, 41, 1, 21, 87, 0, 0, 55, - 0, 0, 0, 0, 19, 10, 1, 0, 0, 0, 0, 0, 88, 0, 0, 89, - 0, 0, 88, 0, 0, 0, 0, 78, 0, 0, 90, 9, 12, 4, 91, 8, - 92, 47, 0, 58, 50, 0, 21, 1, 21, 93, 94, 1, 1, 1, 1, 95, - 96, 97, 98, 1, 99, 58, 81,100,101, 4, 58, 0, 0, 0, 0, 0, - 0, 19, 50, 0, 0, 0, 0, 0, 0, 61, 0, 0,102,103, 0, 0, - 104, 0, 0, 1, 1, 50, 0, 0, 0, 38, 0, 63, 0, 0, 0, 0, - 0, 62, 0, 0,105, 68, 61, 0, 0, 0, 78, 0, 0, 0,106,107, - 58, 38, 81, 0, 0, 0, 0, 0, 0,108, 1, 14, 4, 12, 84, 0, - 0, 0, 0, 38, 90, 0, 0, 0, 0,109, 0, 0,110, 61, 0,111, - 0, 0, 0, 1, 0, 0, 0, 0, 49, 50, 0, 0, 19, 58, 0, 0, - 112, 51, 0,112, 14, 52,113, 41, 0, 0, 62, 0, 0, 61, 0, 0, - 114, 0, 90, 0, 0, 0, 61, 62, 0, 0, 62, 0, 89, 0, 0,114, - 0, 0, 0, 0,115, 0, 0, 0, 78, 55, 0, 38, 1, 58, 1, 58, - 0, 0, 0, 0, 0, 88, 63, 89, 0, 0,116, 0, 0, 0, 55, 0, - 0, 0, 0,116, 0, 0, 0, 0, 61, 0, 0, 0, 0, 79, 0, 61, - 0, 0, 0, 0, 56, 0, 89, 80, 0, 0, 79, 0, 0, 0, 8, 92, - 0, 0, 1, 90, 0, 0,117, 0, 0, 0, 0, 0, 0,118, 0,119, - 120,121,122, 0,105, 4,123, 49, 23, 0, 0, 0, 38, 50, 38, 58, - 0, 0, 1, 90, 1, 1, 1, 1, 39, 1, 48,106, 90, 0, 0, 0, - 0, 1, 0, 0, 0,124, 0, 0, 0,113, 19, 59, 0, 38, 0, 81, - 0, 0, 4,123, 0, 0, 0, 1,125, 0, 0, 0, 0, 0,230,230, - 230,230,230,232,220,220,220,220,232,216,220,220,220,220,220,202, - 202,220,220,220,220,202,202,220,220,220, 1, 1, 1, 1, 1,220, - 220,220,220,230,230,230,230,240,230,220,220,220,230,230,230,220, - 220, 0,230,230,230,220,220,220,220,230,232,220,220,230,233,234, - 234,233,234,234,233,230, 0, 0, 0,230, 0,220,230,230,230,230, - 220,230,230,230,222,220,230,230,220,220,230,222,228,230, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 0, 23, 0, 24, - 25, 0,230,220, 0, 18, 30, 31, 32, 0, 0, 0, 0, 27, 28, 29, - 30, 31, 32, 33, 34,230,230,220,220,230,220,230,230,220, 35, 0, - 0, 0, 0, 0,230,230,230, 0, 0,230,230, 0,220,230,230,220, - 0, 0, 0, 36, 0, 0,230,220,230,230,220,220,230,220,220,230, - 220,230,220,230,230, 0, 0,220, 0, 0,230,230, 0,230, 0,230, - 230,230,230,230, 0, 0, 0,220,220,220,230,220,220,220,230,230, - 0,220, 27, 28, 29,230, 7, 0, 0, 0, 0, 9, 0, 0, 0,230, - 220,230,230, 0, 0, 0, 0, 0,230, 0, 0, 84, 91, 0, 0, 0, - 0, 9, 9, 0, 0, 0, 0, 0, 9, 0,103,103, 9, 0,107,107, - 107,107,118,118, 9, 0,122,122,122,122,220,220, 0, 0, 0,220, - 0,220, 0,216, 0, 0, 0,129,130, 0,132, 0, 0, 0, 0, 0, - 130,130,130,130, 0, 0,130, 0,230,230, 9, 0,230,230, 0, 0, - 220, 0, 0, 0, 0, 7, 0, 9, 9, 0, 9, 9, 0, 0, 0,230, - 0, 0, 0,228, 0, 0, 0,222,230,220,220, 0, 0, 0,230, 0, - 0,220,230,220, 0,220,230,230,230,234, 0, 0, 9, 9, 0, 0, - 7, 0,230,230,230, 0,230, 0, 1, 1, 1, 0, 0, 0,230,234, - 214,220,202,230,230,230,230,230,232,228,228,220,218,230,233,220, - 230,220,230,230, 1, 1, 1, 1, 1,230, 0, 1, 1,230,220,230, - 1, 1, 0, 0,218,228,232,222,224,224, 0, 8, 8, 0, 0, 0, - 0,220,230, 0,230,230,220, 0, 0,230, 0, 0, 26, 0, 0,220, - 0,230,230, 1,220, 0, 0,230,220, 0, 0, 0,220,220, 0, 0, - 230,220, 0, 9, 7, 0, 0, 7, 9, 0, 0, 0, 9, 7, 6, 6, - 0, 0, 0, 0, 1, 0, 0,216,216, 1, 1, 1, 0, 0, 0,226, - 216,216,216,216,216, 0,220,220,220, 0,232,232,220,230,230,230, - 7, 0, 16, 17, 17, 33, 17, 49, 17, 17, 84, 97,135,145, 26, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17,177, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 5, 3, 3, 3, - 3, 3, 6, 7, 8, 3, 3, 3, 3, 3, 9, 10, 11, 12, 13, 3, - 3, 3, 3, 3, 3, 3, 3, 14, 3, 15, 3, 3, 3, 3, 3, 3, - 16, 17, 18, 19, 20, 21, 3, 3, 3, 22, 23, 24, 3, 3, 3, 3, - 3, 3, 25, 3, 3, 3, 3, 3, 3, 3, 3, 26, 3, 3, 27, 28, - 0, 1, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 3, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, 0, 0, 0, 0, - 0, 9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 0, - 0, 14, 15, 16, 6, 0, 17, 18, 19, 19, 19, 20, 21, 22, 23, 24, - 19, 25, 0, 26, 27, 19, 19, 28, 29, 30, 0, 31, 0, 0, 0, 8, - 0, 0, 0, 0, 0, 0, 0, 19, 28, 0, 32, 33, 9, 34, 35, 19, - 0, 0, 36, 37, 38, 39, 40, 19, 0, 41, 42, 43, 44, 31, 0, 1, - 45, 42, 0, 0, 0, 0, 0, 32, 14, 14, 0, 0, 0, 0, 14, 0, - 0, 46, 47, 47, 47, 47, 48, 49, 47, 47, 47, 47, 50, 51, 52, 53, - 43, 21, 0, 0, 0, 0, 0, 0, 0, 54, 6, 55, 0, 14, 19, 1, - 0, 0, 0, 0, 56, 57, 0, 0, 0, 0, 0, 19, 58, 31, 0, 0, - 0, 0, 0, 0, 0, 59, 14, 0, 0, 0, 0, 1, 0, 2, 0, 0, - 0, 3, 0, 0, 0, 60, 61, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 2, 3, 0, 4, 5, 0, 0, 6, 0, 0, 0, 7, - 0, 0, 0, 1, 1, 0, 0, 8, 9, 0, 8, 9, 0, 0, 0, 0, - 8, 9, 10, 11, 12, 0, 0, 0, 13, 0, 0, 0, 0, 14, 15, 16, - 17, 0, 0, 0, 1, 0, 0, 18, 19, 0, 0, 0, 20, 0, 0, 0, - 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 8, 21, 9, - 0, 0, 22, 0, 0, 0, 0, 1, 0, 23, 24, 25, 0, 0, 26, 0, - 0, 0, 8, 21, 27, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 28, - 29, 30, 0, 31, 32, 20, 1, 1, 0, 0, 0, 8, 21, 9, 1, 4, - 5, 0, 0, 0, 33, 9, 0, 1, 1, 1, 0, 8, 21, 21, 21, 21, - 34, 1, 35, 21, 21, 21, 9, 36, 0, 0, 37, 38, 1, 0, 39, 0, - 0, 0, 1, 0, 1, 0, 0, 0, 0, 8, 21, 9, 1, 0, 0, 0, - 40, 0, 8, 21, 21, 21, 21, 21, 21, 21, 21, 9, 0, 1, 1, 1, - 1, 8, 21, 21, 21, 9, 0, 0, 0, 41, 0, 42, 43, 0, 0, 0, - 1, 44, 0, 0, 0, 45, 8, 9, 1, 0, 0, 0, 8, 21, 21, 21, - 9, 0, 1, 0, 1, 1, 8, 21, 21, 9, 0, 4, 5, 8, 9, 1, - 0, 0, 16, 50, 84,118,136,152,186,187,187,187,187,187,187,187, - 187,187,187,187,187,187,187,187,187,187,187,187,187,187, 12, 0, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, - 13, 13, 14, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 15, 16, 17, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 19, 32, 33, 33, 33, 33, 33, - 34, 19, 19, 19, 19, 19, 19, 35, 19, 36, 37, 38, 38, 38, 38, 38, - 38, 39, 40, 19, 19, 19, 19, 19, 19, 19, 41, 42, 19, 19, 43, 19, - 19, 19, 44, 45, 9, 46, 47, 48, 49, 50, 51, 52, 9, 9, 19, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 53, 19, 19, 53, 19, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 54, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 55, - 0, 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7, 0, - 1, 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 32, 33, 33, 33, 34, 35, 35, 35, 35, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 2, 2, 51, 51, 52, - 53, 54, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 57, - 57, 56, 56, 56, 56, 56, 56, 58, 59, 60, 61, 56, 62, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 56, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 71, 62, 62, 62, 62, 72, 72, 72, 72, 72, 72, 72, 72, 72, - 73, 74, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 32, - 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 87, 87, 87, 87, 87, - 87, 62, 62, 62, 62, 88, 89, 89, 89, 90, 89, 91, 92, 93, 94, 95, - 95, 96, 97, 87, 98, 99,100,101,102,103,104,105,105,105, 2,106, - 107,108,109,110,111,112,113,114,115,116,117, 89,118,119,120,121, - 122,123,124,125,126,127,128,129,130, 87,131,132,133,134, 87,135, - 136,137,138,139,140,141,142,143,144,145,146, 87,147,148,149,150, - 150,150,150,150,150,150,150,150,150,150, 87, 87, 87, 87, 87, 87, - 87, 87, 87, 87, 87, 87,151,152,152,152,152,152,152,152,152,153, - 153,153,153,153, 87, 87, 87, 87, 87,154, 87, 87, 87, 87, 87,155, - 155,155,155,156,157,158,158, 87, 87,159, 87,160,161,162,163,164, - 164,164,164,164,164,164,164,164,164,164,164,164,164,165,165,165, - 165,164,164, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,166,167, - 168,169,170,170,170, 87, 87,171,172, 87, 87, 87, 87, 87, 87, 56, - 56, 56, 56, 56, 56,173, 56, 56, 56,174,175, 51, 56, 56, 87,176, - 176,176,176,176,176, 87, 87, 87, 87, 87, 87, 87, 87, 2, 87,177, - 6,178, 87, 87,179, 87, 87, 87,180, 87,181, 87,182, 87, 33,183, - 183,184, 87, 87, 87, 87, 87, 56, 56, 56, 87, 89, 89, 87, 87, 56, - 56, 56, 56,185, 87, 56, 56, 62, 62, 62, 62, 62, 87, 87, 87, 62, - 87, 87, 87, 87, 87, 87, 87, 56, 87,186,186, 0, 1, 2, 2, 0, - 0, 0, 0, 1, 2, 1, 2, 0, 0, 3, 3, 4, 5, 4, 5, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 0, 0, 7, 0, 8, - 8, 8, 8, 8, 8, 8, 9, 10, 11, 11, 11, 11, 11, 12, 11, 13, - 13, 13, 13, 13, 13, 13, 13, 14, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 15, 16, 16, 16, 16, 16, 17, 18, 18, 18, 18, 18, 18, 19, - 20, 21, 21, 22, 23, 21, 24, 21, 21, 21, 21, 21, 25, 21, 21, 26, - 26, 26, 26, 26, 21, 21, 21, 27, 27, 27, 27, 28, 28, 28, 28, 29, - 29, 29, 29, 30, 30, 26, 21, 21, 21, 21, 21, 21, 21, 31, 21, 32, - 32, 32, 32, 32, 33, 34, 32, 35, 35, 35, 35, 35, 35, 35, 35, 36, - 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 37, 37, 38, - 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 40, - 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 42, - 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 44, - 44, 44, 45, 44, 44, 44, 44, 46, 46, 46, 46, 46, 46, 46, 46, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 47, 47, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 52, - 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 56, - 56, 57, 57, 57, 57, 58, 57, 59, 59, 60, 61, 62, 62, 63, 63, 64, - 64, 64, 64, 64, 64, 64, 64, 65, 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 55, 55, 55, 55, 55, 67, 67, 67, 67, 67, 68, 68, 68, 69, - 69, 69, 69, 69, 69, 64, 64, 70, 70, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 8, 8, 8, 8, 8, 72, 72, 72, 72, 72, 72, 72, 72, 73, - 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 75, 75, 76, 76, 76, 13, - 50, 50, 50, 73, 77, 78, 79, 4, 4, 80, 4, 4, 81, 82, 83, 4, - 4, 4, 84, 8, 8, 8, 8, 11, 11, 11, 11, 11, 11, 11, 11, 85, - 0, 0, 0, 0, 0, 0, 86, 0, 4, 0, 0, 0, 8, 8, 8, 0, - 0, 87, 88, 89, 0, 4, 4, 6, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 90, 90, 90, 90, 90, 90, 90, 90, 91, - 91, 91, 91, 91, 91, 4, 4, 92, 92, 92, 92, 92, 92, 92, 92, 50, - 50, 50, 93, 93, 93, 93, 93, 53, 53, 53, 53, 53, 53, 13, 13, 94, - 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 0, 95, - 0, 96, 97, 98, 99, 99, 99, 99,100,101,102,102,102,102,103,104, - 104,104,105, 52, 52, 52, 52, 52, 0,104,104, 0, 0, 0,102, 52, - 52, 0, 0, 0, 0, 52,106, 0, 0, 0, 0, 0,102,102,107,102, - 102,102,102,102,108, 0, 0, 94, 94, 94, 94, 0, 0, 0, 0,109, - 109,109,109,109,109,109,109,109,109,109,109,109,110,110,110,111, - 111,111,111,111,111,111,111,111,111,111,111, 13, 13, 13, 13, 13, - 13,112,112,112,112,112,112, 0, 0,113, 4, 4, 4, 4, 4,114, - 4, 4, 4, 4, 4, 4, 4,115,115,115, 0,116,116,116,116,117, - 117,117,117,117,117, 32, 32,118,118,119,120,120,120, 52, 52,121, - 121,121,121,122,121, 49, 49,123,123,123,123,123,123, 49, 49,124, - 124,124,124,124,124,125,125, 53, 53, 53, 4, 4,126,127, 54, 54, - 54, 54, 54,125,125,125,125,128,128,128,128,128,128,128,128, 4, - 129, 18, 18, 18, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21,130, 21, 21, 21, 21, 8, 0,131, 0, 0, 0, 0, 21, 21, - 21, 21, 21, 21, 21, 21,132, 0, 0, 1, 2, 1, 2,133,101,102, - 134, 52, 52, 52, 52, 0, 0,135,135,135,135,135,135,135,135, 0, - 0, 0, 0, 11, 11, 11, 11, 11, 0, 11, 11, 11, 0, 0,136,137, - 137,138,138,138,138,139, 0,140,140,140,141,141,142,142,142,143, - 143,144,144,144,144,144,144,145,145,145,145,145,146,146,146,147, - 147,147,148,148,148,148,148,149,149,149,150,150,150,150,151,151, - 151,151,151,152,152,152,152,153,153,153,153,153,153,153,153,154, - 154,154,154,155,155,156,156,157,157,157,157,157,157,158,158,159, - 159,160,160,161,161,161,161,162,162,163,163,163,163,163,163,164, - 164,164,164,164,164,165,165,166,166,166,166,167,167,167,167,168, - 168,168,168,169,169,170,170,171,171,171,171,171,171,171,171,172, - 172,172,172,172,172,172,172,173,173,173,173,173,173,173,173,174, - 174,174,174,175,175,175,175,175,175,175,175,175,175,175,175,176, - 176,176,176,177, 21, 21, 21,178,178,178,179,179,179,179,180,180, - 180,180,181,181,181,182,182,183,183,183,183,183,183,183,183,184, - 184,184,184,184,185,185,185,186,186,186,186,186,187,187,187,188, - 188,188,188,188,188,189, 43,190,190,190,190,190,190,190,190,191, - 191,191,192,192,192,192,192,193,193,193,194,193,193,193,193,195, - 195,195,195,195,195,195,195,196,196,196,196,196,196,196,196,197, - 197,197,197,197,197,197,197,198,198,198,198,198,198,198,198,199, - 199,199,199,199,199, 66, 66,200,200,200,200,200, 49, 49, 49,201, - 201,201,201,201,201,201,201,202,202,202,202,202,202,202,202,203, - 203,203,203,203,203,203,203,204,204,204,204,204,204,204,204,205, - 205,205,205,205,205,205,205,206,206,206,206,206,207,207,207,207, - 207,207, 55,208,208,208,208, 32, 32, 32, 32, 32, 32,188,188,209, - 209,209,209,209,209,209,209,210,210,210,210,210,210,210,211,211, - 211,211,211,211,211,211,211,212,212,212,212,212,212,213,213,213, - 213,213,214,214,214,214,214,215,215,215,215,215,215,215,215,216, - 216,216,216,216,216,216,216,110,110,110,110, 39, 39, 39, 39,217, - 217,217,217,217,217,217,217,218,218,218,218,218,218,218,218,219, - 219,219,219,219,219,219,219,220,220,220,220,220,220,220,220,221, - 221,221,221,221,221,221,221,112,112,112,112,112,112,112,112,112, - 112,112,112,222,222,222,223,223,223,223,223,223,224,224,224,225, - 225,225,225,225,225,225,225,226,226,226,226,226,226,226,226,227, - 227,227,227,227,227,227,227,227,227,228,228,228,228,228,228,229, - 229,229,229,229,229,229,229,229,229,229,229,229,229,230, 94,231, - 231,231,231,231,231,231,231,232,232,232,232,232,232,232,232,102, - 102,102,102,102,102,102,102,233, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99,102,234, 99,235,102,236,236, - 236,236,236,236,236,236,236,237,237,237,237,237,237,237,237,237, - 237, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 0, 0, 0, 0, - 0, 0, 0, 0, 0,238,239,240, 0,241, 0, 0, 0, 0, 0,242, - 242,242,242,242,242,242,242, 91, 91, 91, 13, 13, 13, 13, 13,243, - 243,243,243,243,243,243,243,244,244,244,244,245,245,245,245,246, - 246,246,246,246,246,246,246,247,247,247,247,247,247,247,247,248, - 248,248,248,248,248,248,248,249,249,249,249,249,249,249,249,250, - 250,250,250,250,250,250,250,251, 0, 0, 0, 0, 0, 0, 0, 8, - 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 1, 2, 2, 2, 2, - 2, 3, 0, 0, 0, 4, 0, 2, 2, 2, 2, 2, 3, 2, 2, 2, - 2, 5, 0, 2, 5, 6, 0, 7, 7, 7, 7, 8, 9, 8, 10, 8, - 11, 8, 8, 8, 8, 8, 8, 12, 13, 13, 13, 14, 14, 14, 14, 14, - 15, 14, 14, 16, 17, 17, 17, 17, 17, 17, 17, 18, 19, 19, 19, 19, - 19, 19, 19, 20, 21, 20, 22, 20, 20, 23, 23, 20, 20, 20, 20, 22, - 20, 24, 7, 7, 25, 20, 20, 26, 20, 20, 20, 20, 20, 20, 21, 27, - 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, - 31, 31, 31, 32, 20, 20, 20, 33, 33, 33, 33, 34, 35, 33, 33, 33, - 36, 33, 33, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39, 40, - 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, - 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 47, 48, - 48, 48, 48, 49, 49, 49, 49, 49, 50, 51, 49, 52, 52, 52, 52, 53, - 53, 53, 53, 53, 53, 54, 53, 55, 55, 55, 55, 56, 56, 56, 56, 57, - 57, 57, 57, 58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 60, - 60, 61, 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 0, 0, 66, - 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 69, 70, 71, 71, 71, - 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 75, - 75, 75, 75, 76, 76, 76, 76, 77, 77, 77, 77, 78, 78, 78, 78, 79, - 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 82, 7, 7, 7, 83, - 7, 84, 85, 0, 84, 86, 0, 2, 87, 88, 2, 2, 2, 2, 89, 90, - 87, 91, 2, 2, 2, 92, 2, 2, 2, 2, 93, 0, 0, 0, 86, 1, - 0, 0, 94, 0, 95, 96, 0, 4, 0, 0, 0, 0, 0, 0, 4, 97, - 97, 97, 97, 98, 98, 98, 98, 13, 13, 13, 13, 99, 99, 99, 99,100, - 100,100,100, 0,101, 0, 0,102,100,103,104, 0, 0,100, 0,105, - 106,106,106,106,106,106,106,106,106,107,105,108,109,109,109,109, - 109,109,109,109,109,110,108,111,111,111,111,112, 55, 55, 55, 55, - 55, 55,113,109,109,109,110,109,109, 0, 0,114,114,114,114,115, - 115,115,115,116,116,116,116,117,117,117,117, 96, 2, 2, 2, 2, - 2, 94, 2,118,118,118,118,119,119,119,119,120,120,120,120,121, - 121,121,121,121,121,121,122,123,123,123,123,124,124,124,124,124, - 124,124,125,126,126,126,126,127,127,127,127,128,128,128,128, 2, - 2, 3, 2, 2,129,130, 0,131,131,131,131,132, 17, 17, 18, 20, - 20, 20,133, 7, 7, 7,134, 20, 20, 20, 23, 0,135,109,109,109, - 109,109,136,137,137,137,137, 0, 0, 0,138,139,139,139,139,140, - 140,140,140, 84, 0, 0, 0,141,141,141,141,142,142,142,142,143, - 143,143,143,144,144,144,144,145,145,145,145,146,146,146,146,147, - 147,147,147,148,148,148,148,149,149,149,149,150,150,150,150,151, - 151,151,151,152,152,152,152,153,153,153,153,154,154,154,154,155, - 155,155,155,156,156,156,156,157,157,157,157,158,158,158,158,159, - 159,159,159,160,160,160,160,161,161,161,161,162,162,162,162,163, - 163,163,163,164,164,164,164,165,165,165,165,166,166,166,166,167, - 167,167,167,168,168,168,168,169,169,169,169,170,170,170,170,171, - 171,171,171,172,172,172,172,173,173,173,173,174,174,174,174,175, - 175,175,175,176,176,176,176,177,177,177,177,178, 20, 20, 20,179, - 179,179,179,180,180,180,180,181,181,181,181,182,182,182,182,183, - 183,183,183,184,184,184,184,185,185,185,185,186,186,186,186,187, - 187,187,187,188,188,188,188,189,189,189,189,190, 45, 45, 45,191, - 191,191,191,192,192,192,192,193,193,193,193,194,194,194,194,194, - 194,195,194,196,196,196,196,197,197,197,197,198,198,198,198,199, - 199,199,199,200,200,200,200,201,201,201,201,202,202,202,202,203, - 203,203,203,204,204,204,204,205,205,205,205,206,206,206,206,207, - 207,207,207,208,208,208,208,209,209,209,209,210,210,210,210,211, - 211,211,211,212,212,212,212,213,213,213,213,214,214,214,214,215, - 215,215,215,216,216,216,216,217,217,217,217,218,218,218,218,219, - 219,219,219,220,220,220,220,221,221,221,221,222,222,222,222,223, - 223,223,223,224,224,224,224,225,225,225,225,226,226,226,226,227, - 227,227,227,228,228,228,228,229,229,229,229,230,230,230,230,231, - 232,232,232,233,233,233,233,232,232,232,232,234,106,106,106,235, - 106,106,106,106,236,109,109,237,237,237,237,238,238,238,238, 0, - 239, 86, 0, 0, 0,239, 7, 82,138, 7, 0, 0, 0,240, 86,241, - 241,241,241,242,242,242,242,243,243,243,243,244,244,244,244,245, - 245,245,245,246,246,246,246,247,247,247,247,248,248,248,248,249, - 249,249,249,250, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 0, 0, 0, 19, 0, 19, 0, 0, 0, 0, - 0, 26, 26, 1, 1, 1, 1, 9, 9, 9, 9, 0, 9, 9, 9, 9, - 9, 0, 9, 9, 0, 9, 0, 9, 9, 55, 55, 55, 55, 55, 55, 6, - 6, 6, 6, 6, 1, 1, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, - 14, 14, 14, 14, 14, 14, 14, 3, 3, 3, 3, 3, 0, 3, 3, 0, - 3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 1, 1, 1, 3, 3, 1, - 3, 3, 3, 37, 37, 37, 37, 38, 38, 38, 38, 64, 64, 64, 64, 90, - 90, 90, 90, 95, 95, 95, 95, 3, 3, 0, 3, 7, 7, 7, 7, 7, - 1, 1, 1, 1, 7, 7, 7, 0, 0, 7, 7, 5, 5, 5, 5, 11, - 11, 11, 11, 10, 10, 10, 10, 21, 21, 21, 21, 22, 22, 22, 22, 23, - 23, 23, 23, 16, 16, 16, 16, 20, 20, 20, 20, 36, 36, 36, 36, 24, - 24, 24, 24, 24, 24, 24, 0, 18, 18, 18, 18, 25, 25, 25, 25, 25, - 0, 0, 0, 0, 25, 25, 25, 33, 33, 33, 33, 8, 8, 8, 8, 8, - 8, 8, 0, 12, 12, 12, 12, 30, 30, 30, 30, 29, 29, 29, 29, 28, - 28, 28, 28, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 0, 0, - 0, 35, 35, 45, 45, 45, 45, 44, 44, 44, 44, 44, 0, 0, 0, 43, - 43, 43, 43, 46, 46, 46, 46, 31, 31, 31, 31, 32, 32, 0, 0, 32, - 0, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 52, 52, 52, 52, 58, - 58, 58, 58, 54, 54, 54, 54, 91, 91, 91, 91, 62, 62, 62, 62, 76, - 76, 76, 76, 93, 93, 93, 93, 70, 70, 70, 70, 73, 73, 73, 73, 1, - 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, - 1, 0, 0, 19, 19, 9, 9, 9, 9, 9, 6, 19, 9, 9, 9, 9, - 9, 19, 19, 9, 9, 9, 19, 6, 19, 19, 19, 19, 19, 19, 9, 0, - 0, 0, 19, 0, 0, 9, 0, 0, 0, 19, 19, 27, 27, 27, 27, 56, - 56, 56, 56, 61, 61, 61, 61, 13, 13, 13, 13, 0, 13, 0, 13, 0, - 13, 13, 13, 13, 13, 1, 1, 1, 1, 12, 12, 0, 15, 15, 15, 15, - 15, 15, 15, 15, 1, 1, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 0, 26, 26, 26, 26, 26, 12, 12, 12, 12, 12, 12, 0, 39, - 39, 39, 39, 86, 86, 86, 86, 77, 77, 77, 77, 79, 79, 79, 79, 60, - 60, 60, 60, 65, 65, 65, 65, 75, 75, 75, 75, 69, 69, 69, 69, 69, - 69, 0, 69, 74, 74, 74, 74, 84, 84, 84, 84, 84, 84, 84, 0, 68, - 68, 68, 68, 92, 92, 92, 92, 87, 87, 87, 87, 19, 9, 19, 19, 19, - 19, 0, 0, 2, 2, 2, 2, 19, 19, 19, 4, 3, 3, 0, 0, 1, - 1, 6, 6, 0, 0, 17, 17, 17, 17, 0, 0, 49, 49, 49, 49, 0, - 1, 1, 1, 71, 71, 71, 71, 67, 67, 67, 67, 42, 42, 42, 42, 41, - 41, 41, 41,118,118,118,118, 53, 53, 53, 53, 59, 59, 59, 59, 40, - 40, 40, 40, 51, 51, 51, 51, 50, 50, 50, 50,135,135,135,135,106, - 106,106,106,104,104,104,104,161,161,161,161,170,170,170,170,110, - 110,110,110, 47, 47, 47, 47, 81, 81, 81, 81,120,120,120,120,116, - 116,116,116,128,128,128,128, 66, 66, 66, 66, 72, 72, 72, 72,173, - 173,173,173, 98, 98, 98, 98, 97, 97, 97, 97, 57, 57, 57, 57, 88, - 88, 88, 88,117,117,117,117,112,112,112,112, 78, 78, 78, 78, 83, - 83, 83, 83, 82, 82, 82, 82,122,122,122,122, 89, 89, 89, 89,130, - 130,130,130,144,144,144,144,165,165,165,165,156,156,156,156,156, - 156, 3, 3,147,147,147,147,148,148,148,148,158,158,158,158,153, - 153,153,153,149,149,149,149, 94, 94, 94, 94, 85, 85, 85, 85,101, - 101,101,101, 96, 96, 96, 96,111,111,111,111,100,100,100,100,100, - 36, 36, 36,108,108,108,108,129,129,129,129,109,109,109,109,107, - 107,107,107,107,107,107, 1,171,171,171,171,137,137,137,137,124, - 124,124,124,123,123,123,123,114,114,114,114,102,102,102,102,126, - 126,126,126,142,142,142,142,125,125,125,125,154,154,154,154,150, - 150,150,150,141,141,141,141,140,140,140,140,121,121,121,121,169, - 169,169,169,133,133,133,133,134,134,134,134,138,138,138,138,143, - 143,143,143,175,175,175,175,145,145,145,145,163,163,163,163, 63, - 63, 63, 63,157,157,157,157, 80, 80, 80, 80,127,127,127,127,166, - 166,166,166,115,115,115,115,159,159,159,159,103,103,103,103,119, - 119,119,119,167,167,167,167,146,146,146,146,172,172,172,172, 99, - 99, 99, 99,136,139, 13, 13,155,155,155,155,136,136,136,136, 17, - 15, 15, 15, 17, 17, 15, 15, 15, 17, 17, 17,139,139,139,139,105, - 105,105,105, 0, 0, 0, 1, 0, 0, 1, 1,131,131,131,131,151, - 151,151,151,160,160,160,160,152,152,152,152,164,164,164,164,168, - 168,168,168,174,174,174,174,113,113,113,113,132,132,132,132, 15, - 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9, - 10, 9, 11, 12, 13, 9, 9, 9, 14, 9, 9, 15, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 16, - 17, 9, 9, 9, 9, 18, 9, 9, 9, 9, 9, 19, 20, 21, 9, 22, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 23, 9, 9, 9, 9, 9, 24, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 25, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 26, - 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 2, 2, 11, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 12, 13, 2, 2, 2, 2, 2, 14, 1, 1, 1, 15, + 16, 17, 18, 19, 20, 21, 22, 2, 3, 0, 0, 0, 23, 24, 2, 2, + 2, 25, 0, 0, 0, 26, 27, 28, 0, 29, 30, 31, 32, 33, 34, 35, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 0, 36, + 2, 2, 2, 2, 2, 2, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 2, 2, 2, 2, 45, 46, 47, 2, 2, 2, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 5, 5, 72, 73, 8, 74, 3, 75, 76, 3, 77, 78, + 3, 3, 5, 79, 5, 5, 80, 3, 81, 82, 83, 84, 85, 3, 3, 3, + 86, 87, 2, 88, 89, 90, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 91, 2, 2, 2, 2, + 92, 2, 2, 2, 2, 2, 2, 2, 2, 93, 2, 2, 94, 95, 96, 97, + 98, 99,100,101,102,103,104,105, 2, 2, 2, 2, 2, 2, 2, 2, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 1, 1, 2, 2, 2, 2,106,107, 2, 2,108,109,110,111,112,113, + 2, 2,114,115, 0,116,117,118,119,120,121,122, 2, 2, 2, 9, + 123,124,125,126,127,128,129,130, 2,131,132,133, 6,134,135,136, + 137,138,139,140,141,142,143,144,145,146, 0,147,148,149,150, 0, + 151,152,153,154,155,156,157,158,159,160,161,162, 0,163,164,165, + 2, 2, 2, 2, 2, 2, 2, 2,166, 2, 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,167, + 2, 2, 2, 2, 2, 2, 2, 2,168, 2, 2, 2, 2, 2, 2, 2, + 0, 0,169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2,170,171,172, 2, 0, 0,173, 0,174,175,176,177, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, + 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 2,178, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 3, 3, 3,179,180, 3, + 3, 3,181,182,183, 6, 8, 0,184,185,186,187,188,189,190,191, + 3, 3, 3, 3,192,193, 0, 0, 0, 0, 0, 0, 0, 0,194, 0, + 195, 7,196, 0, 0,197, 0, 0, 0,198, 0,199, 0,200, 0, 2, + 2,201,202, 0, 0, 0, 0, 0, 6,203,204, 0, 2,205, 0, 0, + 3, 3,206, 3, 3, 0, 3,207, 3, 3, 3, 3, 3, 3, 3, 3, + 3,208, 3, 3, 3, 3, 3, 10, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, + 209, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, + 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 11, 11, 11, 11, 11, 11, 11, 11, + 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, + 9, 9, 9, 9, 9, 9, 9, 9, 13, 13, 13, 13, 13, 13, 13, 13, + 10, 10, 10, 10, 10, 10, 10, 10, 15, 15, 15, 15, 15, 15, 15, 15, + 16, 16, 16, 16, 16, 16, 16, 16, 6, 6, 6, 6, 8, 8, 8, 8, + 9, 9, 9, 9, 9, 1, 1, 1, 1, 4, 4, 9, 9, 9, 9, 9, + 25, 25, 25, 25, 25, 25, 25, 25, 14, 14, 14, 14, 14, 14, 14, 14, + 8, 8, 8, 8, 8, 6, 6, 6, 8, 6, 6, 6, 6, 6, 6, 6, + 1, 1, 1, 4, 4, 4, 4, 4, 4, 14, 30, 1, 1, 1, 1, 1, + 9, 9, 9, 9, 9, 10, 10, 10, 9, 9, 9, 9, 9, 7, 7, 7, + 8, 8, 8, 8, 6, 6, 6, 6, 1, 4, 4, 4, 4, 4, 4, 4, + 4, 30, 1, 1, 1, 1, 1, 1, 6, 6, 6, 6, 32, 32, 32, 32, + 24, 24, 24, 24, 24, 24, 24, 24, 9, 9, 9, 9, 9, 9, 9, 10, + 1, 1, 1, 1, 1, 1, 1, 29, 21, 4, 4, 4, 4, 4, 4, 4, + 1, 1, 1, 1, 29, 10, 10, 10, 29, 10, 10, 10, 10, 10, 10, 10, + 1, 1, 1, 1, 1, 1, 1, 4, 6, 6, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 6, 8, 8, + 8, 8, 8, 6, 6, 6, 6, 6, 9, 9, 9, 9, 9, 10, 11, 65, + 73, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 86, 87, 88, + 74, 6, 6, 6, 6, 6, 6, 6, 20, 20, 20, 20, 20, 20, 20, 20, + 19, 8, 8, 8, 8, 8, 8, 8, 22, 1, 1, 1, 1, 1, 1, 1, + 21, 1, 1, 1, 1, 1, 1, 1, 4, 17, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 22, 14, 4, 17, 30, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 22, 18, 4, 22, 1, 1, 1, 1, 1, 1, + 14, 14, 14, 9, 9, 9, 9, 9, 1, 1, 1, 1, 1, 21, 22, 14, + 10, 10, 10, 10, 60, 7, 7, 7,100, 1, 1, 1, 1, 1, 1, 1, + 14, 18, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 13, 13, 13, 10, + 20, 6, 6, 6, 8, 8, 79, 20, 6, 6, 6, 6, 8, 8,103, 20, + 26, 26, 26, 26, 26, 26, 26, 26, 7, 7, 7, 7, 7, 3, 3, 3, + 63, 7, 7, 7, 7, 7, 7, 7, 1, 1, 34, 1, 1, 1, 1, 1, + 1, 1, 1, 46, 7, 7, 7, 7, 1, 1, 1, 1, 4, 4, 4, 4, + 1, 1, 1, 1, 1, 1, 46, 7, 1, 1, 1, 1, 7, 7, 7, 7, + 1, 1, 1, 1, 1, 1, 14, 18, 1, 1, 1, 1, 1, 1, 1, 21, + 1, 1, 1, 1, 1, 1, 1, 27, 9, 9, 9, 9, 9, 3, 3, 3, + 72, 10, 84, 10, 23, 85, 64, 10, 6, 6, 6, 6, 6, 89, 90,119, + 72, 24, 24, 47, 91,120,121, 92, 36, 7, 74, 10,122,123, 7, 54, + 8, 8, 8, 48, 8, 8, 8, 12, 6, 6, 6, 49, 6, 6, 6, 6, + 12, 12, 12, 12, 19, 19, 19, 19, 19, 19, 19, 19, 6, 12, 12, 12, + 12, 12, 12, 12, 8, 19, 19, 6, 19, 12, 12, 8, 19, 8, 6, 8, + 8, 19, 12, 8, 12, 6, 8, 19, 12, 12, 12, 8, 19, 6, 12, 8, + 19, 8, 19, 19, 12, 50, 12, 6, 1, 1, 93, 19, 94, 93, 19, 19, + 19, 19, 19, 19, 19, 19, 6, 12, 19, 94, 12, 8, 12, 12, 12, 12, + 12, 12, 6, 6, 6, 8, 19, 12, 19, 19, 8, 12, 12, 12, 12, 12, + 6, 6, 1, 6, 6, 6, 6, 6, 13, 20, 20, 13, 13, 13, 13, 13, + 13, 20, 20, 20, 20, 20, 20, 20, 13, 13, 55, 20, 20, 20, 55, 55, + 12, 12, 55, 12, 6, 56, 6, 73, 20, 20, 20,124, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 6, 6, 6, 19, + 6, 8, 12, 6, 12, 12, 12, 12, 6, 6, 12, 75, 19, 12, 19, 8, + 12, 33, 4, 4, 66, 12, 12, 12, 8, 19, 19, 19, 19, 19, 19, 6, + 8, 8, 8, 8, 95, 10, 10, 10, 6, 6, 6, 6, 76, 26,125, 57, + 126, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,127, + 37, 31, 4, 37, 4, 4, 4, 4, 1, 29, 10, 10, 10, 10, 10, 10, + 15, 15, 15, 11, 65, 67, 10, 3, 4, 4, 4, 4, 4, 31,128, 10, + 38, 1, 1, 1, 1, 21, 4, 4, 9, 9, 9, 9, 9, 10, 10, 1, + 1, 1, 39, 4, 4, 4, 96, 33, 4, 4, 68, 51, 40, 4, 4, 1, + 9, 9, 9, 9, 9, 1, 41, 58, 10, 10, 10, 10, 10, 10, 10, 97, + 4, 4, 4, 4, 4, 4, 22, 1, 1, 1, 1, 1, 1, 21, 4, 4, + 4, 4, 13, 47, 10, 13, 51, 24, 1, 1, 1, 4, 4, 51, 4, 4, + 4, 4, 51, 4, 51, 4, 4, 4, 1, 1, 1, 1, 21, 4, 4, 10, + 1, 1, 1, 1,129, 1, 1, 1, 15, 15, 15, 69, 4, 4, 4, 4, + 1, 1, 1, 1, 34, 4, 4, 4, 4, 69, 4, 4, 4, 4, 4, 4, + 1, 1, 1, 1, 1, 17, 22, 14, 18, 4, 4, 4, 17, 14, 18, 14, + 21, 4, 4, 4, 1, 1, 1, 1, 1, 4, 10, 9, 9, 9, 9, 9, + 42, 1, 1, 1, 1, 1, 1, 1, 21, 14, 30, 1, 1, 1, 1, 1, + 18, 4, 4, 17, 14, 14, 18, 1, 1, 1, 1, 27, 14, 14, 1, 1, + 1, 24, 7, 7, 7, 57, 29, 4, 1, 1, 1, 1, 1, 1, 4, 14, + 18, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 22, 1, 1, 1, + 1, 1, 1, 9, 9, 9, 9, 9, 4, 1, 21, 10, 10, 10, 10, 10, + 18, 4, 4, 4, 17, 14, 18, 4, 67, 24, 24, 24,130, 4, 4, 4, + 18, 4, 4, 17, 14, 14, 18, 4, 4, 4, 4, 17, 14, 14, 1, 1, + 58, 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 1, 14, + 17, 14, 14, 14, 14, 14, 18, 4, 1, 1, 1, 27, 14, 14, 14, 14, + 7, 43, 3, 3, 57, 3, 3, 3, 17, 14, 22, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 22, 4, 17, 14, 14, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 1, 1, 1, 1, 9, 9, 9, 98, 7, 7, 7, 43, + 21, 14, 39, 1, 1, 1, 1, 1, 14, 14, 14, 17, 14, 14, 4, 4, + 4, 4, 17, 14, 14, 14, 1, 1, 99, 27, 14, 14, 14, 14, 14, 14, + 4, 14, 1, 1, 1, 1, 1, 1, 18, 4, 4, 14, 14, 14, 18, 41, + 3, 3, 1, 27, 7, 7, 7, 59, 7, 7, 7, 7, 43, 1, 1, 1, + 1, 1, 1, 1, 1, 4, 4, 17, 14, 4, 4, 4, 14, 14, 14, 14, + 9, 14, 10, 10, 10, 10, 10, 10, 21, 1, 4, 4, 4, 4, 4,131, + 1, 1, 1, 51, 4, 4, 4, 31, 21, 1, 4, 4, 4, 4, 22, 1, + 1, 1, 1, 13, 4, 4, 4, 4, 9, 9, 9, 9, 9, 9, 1, 1, + 41, 3, 10, 10, 10, 10, 10, 10, 10, 44, 44, 3, 4, 3, 3, 3, + 7, 7, 33, 33, 33, 23, 23, 14, 21, 4, 4, 4, 4, 4, 4, 17, + 4, 4, 31, 4, 1, 1, 21, 4, 4, 4, 4, 4, 4, 4, 4, 3, + 3, 3, 3, 40, 3, 3, 3, 3, 10, 10, 44, 3, 47, 10, 10, 10, + 1, 1, 1, 1, 1, 27, 18, 4, 17, 4, 4, 4, 18, 17, 18, 22, + 1, 1, 1, 14, 4, 1, 1, 4, 22, 14, 30, 27, 14, 14, 14, 1, + 21, 4, 22, 1, 1, 1, 1, 1, 1, 17, 18, 17, 14, 14, 18, 27, + 9, 9, 9, 9, 9, 14, 18, 3, 6, 6, 6, 6, 6, 76, 56, 6, + 1, 1, 1, 1, 1, 1, 21, 4, 1, 1, 1, 1, 1, 1, 41, 39, + 132, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,133, 70, 70, + 1, 1, 1, 1, 1, 29, 10, 16,134, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 17, 14, 14, 14, 14, 30, 1, 4, 61, 10, 10, 10, 10, 10, + 1, 1, 4, 18, 4, 4, 4, 14, 14, 14, 14, 17, 18, 4, 4, 4, + 4, 4, 10, 42, 10, 67, 21, 4, 10, 10, 10, 77, 10, 37, 4, 69, + 1, 34, 1, 1, 1, 1, 1, 1, 1, 1, 21, 22, 1, 1, 1, 1, + 1, 1, 1, 1, 21, 1, 1, 1, 4, 17, 14, 18, 17, 14, 14, 14, + 14, 17, 14, 14, 18, 4, 4, 4, 3, 3, 10, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 7, 7, 3, 1, 1, 1, 21, 17, 18, 4, 10, + 1, 1, 27, 17, 4, 4, 4, 4, 17, 17, 18, 4, 4, 4, 17, 14, + 10, 10, 10, 42, 10, 10, 10, 10, 4, 4, 4, 4, 4, 4, 4, 78, + 4, 4, 30, 1, 1, 1, 1, 1, 1, 1, 17, 4, 4, 17, 17, 14, + 14, 17, 30, 1, 1, 1, 1, 10, 44, 3, 3, 3, 3, 33, 4, 4, + 4, 4, 3, 3, 3, 3, 47, 10, 27, 4, 4, 14, 4, 18, 4, 1, + 1, 1, 1, 17, 4, 14, 18, 18, 4, 14, 14, 14, 14, 14, 10, 10, + 1, 1, 14, 14, 14, 14, 4, 4, 4, 4, 14, 4, 4, 31, 10, 10, + 9, 9, 9, 9, 9, 9, 99, 1, 6, 6, 6, 6, 19, 6, 6, 6, + 4, 31, 4, 4, 4, 4, 4, 4, 17, 4, 4, 4, 22, 1, 21, 1, + 1, 1, 22, 27, 4, 1, 1, 1, 6, 6, 6, 6, 6, 6, 13, 13, + 13, 13, 13, 13, 13, 56, 6, 6, 6, 6, 6, 6, 56, 6, 6, 6, + 6, 6, 6, 6, 6,101, 13, 13, 12, 12, 12, 6, 6, 6, 6, 12, + 6, 6, 6, 6, 19, 8, 8, 8, 6, 6, 6, 6, 8, 8, 79,102, + 62, 62, 62, 62, 62,135, 15, 15, 26, 26, 26, 10, 45,104, 45,104, + 10, 10, 10, 10,136, 15, 15,137, 10, 10, 10, 10,105,106, 10,107, + 108, 10, 52, 53, 10, 10, 10, 10, 10, 65,108, 10, 10, 10, 10,138, + 139, 13, 7, 7, 7, 11, 52,140, 7, 7, 7, 7, 7, 11, 52, 70, + 4, 4, 4, 4, 4, 4,141, 66, 78, 66, 78, 4, 4, 4, 4, 4, + 3, 71, 3, 80, 3, 19, 8, 6, 8, 12, 80, 3, 75, 8, 8, 3, + 3, 3, 71, 71, 71, 8, 8,142, 8, 8, 50, 1,109, 3, 6, 8, + 11, 11, 75, 6, 6, 36, 3,110, 16,143,144, 16,111, 3, 3, 3, + 11, 11, 35, 3, 3, 11, 3, 3, 35, 36, 3, 35, 3, 3, 3, 35, + 3, 3, 3, 3, 3, 3, 3, 11, 3, 35, 35, 3, 3, 3, 3, 3, + 3, 3, 11, 11, 11, 11, 11, 11, 3, 3, 3, 3, 23, 23, 3, 3, + 11, 3, 3, 3,145,146, 3, 3, 3, 3, 3, 3, 3, 3, 35, 3, + 3, 3, 3, 3, 3, 36, 11, 11, 11, 11, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 11, 11, 11, 3, 3, 3, 3, 3, 3, 3, + 7, 7, 7, 7, 7, 7, 3, 3, 3, 3, 3, 3, 3, 7, 7, 7, + 3, 3, 3, 36, 3, 3, 3, 3, 36, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 11, 11, 11, 11, 3, 3, 3, 3, 3, 3, 3, 36, + 3, 3, 3, 3, 23, 23, 23, 23, 23, 23, 23, 7, 7, 7, 7, 7, + 7, 7, 3, 3, 3, 3, 3, 3, 11, 11, 52,112, 11, 11, 11, 11, + 11, 11, 11, 23, 23, 23, 23, 23, 11, 52, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28,112, 11, 11, 11, 11, 11, 11, 11, 23, 23, 11, 11, + 11, 11, 11, 11, 11, 11, 23, 11, 11, 11, 35, 36, 11, 11, 35, 3, + 12, 8, 12, 19, 19, 19, 19, 8, 12, 12, 19, 6, 6, 6, 13, 8, + 12, 12,110, 3, 3, 80, 19,147, 4, 12, 6, 6, 76, 10, 60, 10, + 1, 1, 1, 1, 1, 1, 1, 34, 10, 10, 10, 10, 10, 10, 10, 37, + 10, 45, 45, 10,105,106, 45, 10, 10, 10, 10, 64, 10, 77, 45, 10, + 45, 23, 23, 23, 23, 10, 10, 42, 10, 10, 10, 10, 10, 26, 10, 10, + 77,148, 10, 10, 10, 10, 10, 10, 3, 10, 81, 28, 28, 28,149, 26, + 72, 10,150,113, 23, 23, 23, 23, 23, 3, 23, 23, 23, 23,114, 70, + 151, 16, 16, 16, 16, 4, 4, 14,115, 13, 13, 3, 16,152, 29, 3, + 58, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21,153,116, 38, + 1, 1, 1, 1, 1, 29, 13, 38, 3, 7, 7, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1,117, 10, + 12, 12, 12, 12, 12, 12, 12, 21, 66,154, 4, 4, 4, 4, 4, 42, + 12, 12, 12, 12, 12, 12, 13, 4, 1, 1, 1, 16, 16, 16, 16, 16, + 4, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20,116, 13, 13, 13, 13, + 20, 12, 12, 12, 12, 12, 12, 12, 6, 12, 12, 12, 12, 12, 12, 12, + 56, 6, 6, 6, 19, 19, 19, 12, 12, 12, 12, 12, 55,155, 19, 50, + 12, 12, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 8, 8, 12, + 8, 8, 12, 12, 12, 12, 12, 12, 12, 12, 8, 8, 19, 19, 12, 12, + 12, 12, 12, 12, 12, 12, 8, 8, 95, 13,156, 50, 13, 50, 1, 1, + 1, 22, 1, 22, 1, 21, 1, 1, 1, 27, 18, 17, 3, 3, 4, 4, + 7, 7, 7, 3, 82, 3, 3, 3, 1, 1, 10, 10, 10, 10, 10, 10, + 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, 14, 14, 14, 14, 14, + 14, 14, 4, 4, 4, 4, 4, 10, 4, 1, 1, 1, 10, 39, 39, 21, + 1, 1, 1, 4, 4, 4, 4, 10, 1, 1, 1, 21, 4, 4, 4, 4, + 4, 14, 14, 14, 14, 14, 14, 61, 1, 21, 14, 4, 4, 14, 4, 14, + 61, 10, 10, 10, 10, 10, 10, 42, 1, 1, 21, 38, 1, 1, 1, 1, + 1, 1, 1, 1, 21, 4, 4, 17, 18, 17, 18, 4, 4, 4, 4, 4, + 1, 21, 1, 1, 1, 1, 17, 14, 9, 9, 9, 9, 9, 9, 10, 10, + 38, 1, 1, 41, 3, 27, 17, 1, 22, 4, 22, 21, 22, 1, 1, 4, + 1, 1, 1, 1, 1, 1, 34, 10, 1, 1, 1, 1, 1, 27, 4, 14, + 10, 34,157, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6,102, 13, 13, + 6, 6, 6, 6,101, 20, 20, 20, 1, 27, 18, 14, 17, 61, 18, 4, + 6, 6, 6, 6, 6, 6, 50, 22, 1, 1, 1, 1,158, 1, 1, 1, + 1, 20, 20, 20, 20, 20, 20, 20, 20, 91, 3, 3, 3, 3, 3, 3, + 3, 58, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, + 1, 1, 1, 1, 1, 1, 82, 3, 10, 10, 10, 81, 53, 10, 10, 10, + 64,159,160, 28, 28, 28, 28, 28, 28, 28, 53, 81, 53, 10,107,161, + 10, 10, 10, 10,114, 28, 28, 53, 10,162, 11, 11, 67, 10, 10, 10, + 1, 1, 1, 1, 1, 1, 1,163, 10, 10, 84, 10, 23, 85, 64, 10, + 6, 6, 6, 6, 6, 89, 90, 52, 53, 23, 10, 1, 1, 1, 1, 1, + 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, + 24,164, 57, 24, 36, 11, 35, 3, 3, 3, 3, 3,165, 15, 3, 3, + 10, 10, 10, 60, 7, 7, 7, 7, 7, 7, 7, 43, 3, 3, 3, 3, + 16, 16,111, 7, 43, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 3, + 3, 3, 3, 3, 3, 3, 33, 4, 83, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 59, 1,113, 1, 1, 1, 1, 16, 16, 16, + 166, 16, 16, 16, 16, 16, 16, 16, 8, 8, 8, 12, 6, 6, 6, 6, + 1, 1, 1, 29, 7, 7, 7, 7, 1, 1, 1, 41, 63, 7, 7, 7, + 1, 1, 1, 1, 1, 46, 7, 7, 1, 1, 1, 7, 7, 7, 7, 54, + 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 46, 54, + 1, 1, 1, 1, 58, 1, 1, 1, 1, 1, 21, 4, 4, 83, 7, 7, + 6, 6, 6, 6, 6, 7, 7, 7, 1, 1, 4, 4, 4, 4, 4, 4, + 9, 9, 9, 9, 9, 1, 1, 38, 8, 8, 8, 8,167, 4, 4,115, + 6, 6, 6, 6, 6, 6, 6, 11, 1, 1, 1, 1, 1, 21,168, 26, + 44, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, + 7, 7, 7, 59, 1, 1, 1, 1, 83, 7, 54, 10, 10, 10, 10, 10, + 1, 4, 4, 10, 10, 10, 10, 10, 1, 1, 46, 7, 7, 7, 7, 7, + 18, 30, 1, 1, 1, 1, 1, 1, 4, 4, 4, 31, 10, 10, 10, 10, + 10, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, + 22, 21, 22, 1, 1, 1, 1, 21, 14, 18, 4, 17, 18, 31, 97, 10, + 10, 4, 4, 4, 4, 4, 96, 15, 1, 1, 1, 21, 4, 4, 18, 4, + 4, 4, 4, 9, 9, 9, 9, 9, 10, 10, 27, 30, 1, 1, 1, 1, + 1, 21, 10, 1, 1, 1, 1, 1, 1, 27, 14, 4, 4, 4, 4, 17, + 30, 1, 29, 10, 37, 4, 31, 18, 9, 9, 9, 9, 9, 29, 29, 10, + 60, 7, 7, 7, 7, 7, 7, 7, 4, 14, 17, 4, 10, 10, 10, 22, + 17, 14, 14, 14, 14, 14, 14, 14, 1, 1, 1, 27, 14, 14, 30, 1, + 1, 14, 14, 4, 4, 4, 4, 4, 1, 1, 1, 1, 14, 18, 4, 4, + 4, 14, 14, 14, 14, 14, 14, 17, 22, 22, 10, 10, 10, 10, 10, 10, + 37, 4, 4, 4, 4, 4, 4, 4, 1, 1, 27, 14, 4, 4, 4, 4, + 14, 4, 17, 22, 1, 29, 10, 10, 9, 9, 9, 9, 9, 10, 10, 22, + 14, 18, 4, 4, 17, 17, 14, 18, 17, 4, 1, 39, 1, 1, 1, 1, + 14, 4, 4, 4, 14, 14, 4, 18, 31, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 1, 1, 4, 4, 14, 18, 4, 4, 4, 17, 18, 18, + 31, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 18, 14, + 4, 4, 4, 18, 29, 10, 10, 10, 1, 1, 1, 1, 1, 1, 21, 18, + 14, 4, 4, 18, 4, 4, 4, 4, 9, 9, 9, 9, 9, 7, 10, 44, + 4, 4, 4, 4, 18, 31, 10, 10, 7, 7, 7, 7, 7, 7, 7, 59, + 14, 14, 14, 14, 14, 18, 17, 22, 30, 18, 10, 10, 10, 10, 10, 10, + 27, 14, 4, 4, 4, 4, 14, 14, 22, 39, 14, 14, 14, 14, 14, 14, + 21, 4, 4, 4, 4, 22, 1, 1, 1, 21, 4, 4, 17, 21, 4, 31, + 10, 10, 10, 37, 4, 4, 4, 4, 21, 4, 4, 17, 18, 4, 1, 1, + 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 17, 4, 10, 39, 10, + 17, 4, 17, 17, 14, 14, 14, 14, 4, 4, 4, 4, 4, 4, 4, 18, + 10, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 17, 4, 4, 4, + 17, 4, 18, 4, 4, 4, 4, 4, 4, 4, 4, 21, 4, 4, 4, 4, + 1, 1, 1, 1, 1, 14, 14, 14, 4, 17, 18, 18, 1, 1, 1, 1, + 1, 1, 1, 1, 34, 1, 1, 1, 1, 21, 17, 61, 10, 10, 10, 10, + 4, 27, 1, 1, 1, 1, 1, 1, 1, 1, 14, 4, 4, 4, 4, 14, + 17, 31, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 4, 4, 4, + 7, 7, 43, 3, 3, 3, 57, 24, 82, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 47, 22, 1, 1, 21, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 14, 18, 4, 4, 4, 31, 10, 10, 10, 10, 10, + 4, 4, 4, 31, 10, 10, 3, 3, 13, 13, 44, 3, 3, 3, 3, 3, + 9, 9, 9, 9, 9,169, 7, 7, 7, 59, 1, 1, 1, 1, 1, 1, + 13, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 34,117, 10, + 7, 7, 7, 54, 10, 10, 10, 10, 8, 8, 8, 8, 8, 12, 6, 6, + 27, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, + 4, 68, 13, 13, 13, 13, 13, 13, 13, 42, 4, 4, 4, 4, 4, 4, + 14, 13, 16, 16, 16, 16, 16, 16, 1, 1, 1, 1, 1, 1, 33, 31, + 3, 3,118, 18, 4, 3,118, 14, 14,170, 15, 15, 15, 69, 4, 4, + 4, 40, 33, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 4, 4, 3, + 3, 4, 40, 3, 3, 3, 3, 3, 48, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 49, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 48, 6, 6, 6, 6, 49, 6, 6, 6, 8, 8, + 8, 8, 48, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 49, + 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 48, + 6, 6, 6, 6, 49, 6, 6, 6, 8, 8, 8, 8, 48, 6, 6, 6, + 6, 49, 6, 6, 6, 12, 6, 9, 4, 4, 4, 40, 3, 33, 4, 4, + 4, 4, 4, 4, 4, 4, 40, 3, 3, 3, 33, 3, 3, 3, 3, 3, + 3, 3, 40, 47, 10, 10, 10, 10, 10, 10, 10, 10, 10, 37, 4, 4, + 6, 6, 6, 6, 6,109, 6, 6, 4, 4, 4, 68, 13, 13, 13, 13, + 9, 9, 9, 9, 9, 9, 9, 41, 1, 1, 1, 1, 1, 1, 4, 4, + 9, 9, 9, 9, 9, 9, 9,171, 1, 1, 1, 1, 1, 34, 4, 4, + 172, 9, 9, 9, 9, 9, 9, 98, 1, 21, 1, 22, 1, 1, 1, 4, + 1, 1, 21, 4, 4, 4, 4, 34, 6, 6, 4, 4, 4, 68, 13, 13, + 7, 7, 7, 7, 7, 7, 63, 7,173, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 63, 7, 7, 7, 7, 7, 7, 43, 3, + 3, 3, 3, 3, 3, 92, 20, 20, 2, 2, 7, 7, 3, 3, 26, 26, + 12, 12, 4, 4, 5, 5, 15, 15, 9, 9, 13, 13, 21, 21, 25, 25, + 9, 5, 6, 6, 10, 10, 1, 1, 14, 14, 12, 10, 10, 12, 5, 9, + 24, 24, 7, 12, 12, 7, 22, 18, 23, 23, 0, 0, 17, 17, 7, 10, + 18, 22, 7, 21, 10, 7, 12, 21, 8, 8, 26, 12, 7, 6, 25, 26, + 26, 25, 21, 12, 6, 7, 21, 7, 12, 26, 7, 26, 21, 6, 15, 26, + 21, 26, 20, 19, 7, 15, 26, 21, 9, 25, 5, 25, 5, 7, 6, 12, + 25, 22, 18, 21, 15, 21, 6, 24, 6, 5, 26, 23, 26, 7, 15, 7, + 21, 15, 10, 21, 29, 29, 26, 15, 21, 17, 25, 21, 11, 11, 21, 23, + 12, 6, 1, 12, 18, 18, 9, 26, 29, 21, 21, 9, 24, 5, 25, 9, + 5, 21, 17, 21, 11, 12, 8, 24, 26, 9, 21, 22, 23, 26, 12, 15, + 23, 21, 21, 25, 9, 22, 21, 18, 24, 16, 5, 22, 25, 18, 24, 26, + 26, 24, 9, 8, 8, 5, 9, 6, 12, 1, 21, 1, 13, 21, 13, 7, + 17, 7, 5, 6, 5, 24, 9, 24, 22, 20, 21, 20, 19, 21, 21, 16, + 16, 21, 7, 5, 5, 26, 14, 15, 18, 25, 7, 14, 17, 22, 17, 6, + 24, 6, 6, 21, 26, 10, 25, 0, 7, 20, 25, 1, 24, 15, 7, 19, + 9, 21, 17, 26, 23, 12, 17, 12, 1, 21, 24, 7, 23, 7, 12, 23, + 29, 7, 7, 22, 14, 7, 29, 1, 27, 28, 1, 29, 21, 29, 15, 6, + 18, 6, 12, 11, 26, 5, 14, 9, 5, 14, 26, 22, 18, 26, 5, 12, + 22, 21, 18, 17, 26, 6, 26, 14, 14, 6, 12, 24, 11, 21, 24, 9, + 6, 9, 6, 10, 7, 25, 17, 16, 16, 22, 16, 16, 25, 17, 7, 1, + 25, 24, 26, 1, 21, 14, 9, 12, 12, 17, 13, 15, 10, 1, 13, 23, + 7, 13, 23, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 10, + 11, 12, 13, 0, 14, 0, 0, 0, 0, 0, 15, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 17, 18, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 20, 0, 21, 22, 23, 0, 0, 0, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 35, 0, 0, 0, 0, 36, 0, 37, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, 0, 0, + 0, 0, 0, 0, 41, 42, 43, 44, 45, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 9, 0, 0, 0, 10, + 11, 12, 13, 0, 14, 15, 16, 0, 17, 18, 19, 20, 21, 1, 22, 1, + 23, 1, 2, 1, 2, 1, 2, 0, 2, 1, 24, 1, 2, 25, 2, 0, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 0, 36, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 38, 0, 0, + 39, 0, 0, 40, 0, 41, 0, 0, 0, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 0, 0, 51, 0, 0, 0, 52, 0, 0, 0, 53, 0, 0, 0, + 0, 0, 0, 0, 54, 0, 3, 0, 55, 56, 0, 57, 0, 0, 0, 0, + 0, 0, 58, 59, 60, 0, 0, 0, 0, 61, 0, 0, 62, 63, 64, 4, + 65, 0, 0, 66, 67, 0, 0, 0, 68, 0, 0, 0, 0, 69, 0, 0, + 0, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 71, 0, 0, 0, 72, 0, 73, 0, 0, 74, 0, 0, 75, 0, 0, 0, + 0, 0, 0, 0, 0, 76, 77, 0, 0, 0, 0, 78, 79, 0, 80, 81, + 0, 0, 82, 5, 0, 83, 4, 0, 84, 85, 0, 0, 86, 87, 88, 0, + 89, 0, 90, 0, 91, 0, 0, 3, 92, 3, 0, 93, 0, 94, 0, 0, + 0, 5, 0, 0, 0, 95, 96, 0, 97, 98, 99,100, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0,101,102, 0, 0, 0, 0, 0, 0,103, 0, + 0, 0, 0, 0, 0,104, 0, 0, 0, 0, 0, 0,105, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0,106, 0, 0,107, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,108,109, 0, 0,110, 0, 0, 0, 0, 0, + 0,111, 0,112, 0, 6, 0, 0, 0, 0, 0,113,114, 0, 0, 0, + 0, 0, 0, 0,115, 0, 0, 0,116, 0, 0, 0,117, 0, 0, 0, + 0, 0, 0, 0,118, 0,119, 0, 0, 0, 0, 0, 0, 0, 2, 1, + 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 11, 0, 0, 0, 14, 0, + 0, 0, 16, 3, 17, 18, 19, 20, 21, 22, 0, 23, 0, 0, 0, 0, + 24, 25, 26, 27, 0, 0, 0, 0, 28, 0, 0, 29, 30, 0, 31, 0, + 32, 33, 0, 0, 34, 0, 35, 36, 0, 0, 0, 0, 0, 37, 38, 0, + 39, 40, 0, 0, 41, 0, 0, 0, 42, 0, 0, 43, 44, 45, 46, 1, + 47, 0, 0, 1, 0, 0, 7, 1, 48, 0, 0, 0, 0, 0, 49, 50, + 0, 0, 0, 0, 0, 0, 51, 52, 0, 0, 0, 0, 0, 0, 53, 54, + 0, 0, 0, 0, 55, 0, 56, 0, 0, 0, 57, 58, 0, 0, 0, 59, + 0, 0, 0, 0, 0, 0, 60, 12, 0, 0, 0, 0, 61, 0, 0, 0, + 62, 0, 5, 0, 63, 0, 0, 0, 0, 64, 0, 0, 0, 0, 65, 0, + 66, 0, 0, 0, 0, 6, 67, 0, 0, 0, 68, 69, 70, 71, 0, 0, + 0, 0, 72, 5, 0, 73, 74, 0, 0, 75, 0, 0, 0, 76, 77, 0, + 0, 0, 78, 0, 79, 80, 81, 82, 83, 3, 84, 0, 85, 86, 87, 0, + 0, 8, 9, 0, 0, 3, 3, 0, 0, 88, 0, 0, 89, 0, 0, 0, + 0, 8, 90, 0, 91, 0, 0, 0, 0, 0, 9, 10, 0, 92, 0, 5, + 0, 3, 9, 0, 0, 93, 0, 0, 94, 0, 0, 6, 0, 0, 0, 0, + 0, 0, 95, 96, 0, 0, 10, 0, 0, 1, 0, 0, 97, 0, 0, 0, + 0, 98, 0, 0, 0, 0, 12, 0, 0, 13, 0, 0, 0, 0, 99,100, + 0, 0,101, 0, 0,102, 0, 0, 0,103, 0, 0, 0,104, 0, 0, + 0,105, 0, 0, 0, 0,106,107, 13, 0, 0,108, 0, 0, 0, 10, + 0, 0,109,110, 0, 0,111,112, 0, 0, 0, 0, 0, 0,113, 0, + 0,114, 0, 0, 0, 0,115, 1, 0,116,117,118, 6, 0, 0,119, + 7, 0, 0,120, 0, 0, 0,121, 0, 0, 0, 0, 0, 0,122, 0, + 0,123, 0, 0, 0, 0,124, 11, 0, 0, 0, 0, 0, 6, 0, 0, + 0, 0, 5, 15, 0, 0, 0, 0,125, 0, 0,126, 0, 0, 0, 0, + 15, 0, 0,127, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0,128, 0, + 0, 0,129, 0,130, 0, 0, 0, 0,131,132,133, 0,134, 0,135, + 0, 0, 0,136,137,138, 0, 8, 0, 0, 0, 0, 0, 7, 0, 0, + 0,139, 0, 0, 0,140, 0, 0, 0,141, 0, 0, 0,142,143, 0, + 144, 0, 0,145, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 9, + 1, 1, 1, 1, 0, 0, 0, 2, 0, 3, 0, 0, 3, 0, 0, 0, + 0, 0, 0, 19, 0, 0, 0, 6, 11, 0, 0, 0, 0, 14, 0, 0, + 15, 0, 0, 0, 0, 0, 0, 17, 29, 0, 0, 0, 0, 0, 31, 0, + 0, 2, 0, 0, 1, 12, 0, 0, 1, 49, 50, 5, 51, 52, 53, 5, + 5, 22, 32, 23, 1, 54, 24, 55, 16, 33, 56, 57, 58, 1, 1, 1, + 6, 1, 0, 0, 59, 7, 60, 1, 34, 5, 7, 61, 62, 63, 64, 65, + 66, 67, 0, 0, 1, 1, 68, 0, 0, 0, 69, 70, 71, 35, 1, 25, + 72, 0, 0, 0, 0, 8, 1, 26, 16, 26, 73, 27, 74, 0, 0, 0, + 36, 25, 75, 37, 7, 37, 76, 0, 0, 0, 6, 1, 7, 0, 0, 17, + 0, 8, 38, 1, 1, 13, 13, 11, 0, 0, 39, 0, 0, 6, 18, 1, + 0, 0, 8, 16, 5, 1, 1, 1, 77, 7, 36, 18, 78, 7, 35, 1, + 79, 10, 0, 0, 0, 80, 0, 0, 0, 0, 2, 3, 0, 0, 14, 0, + 0, 0, 81, 0, 0, 0, 82, 0, 0, 0, 83, 0, 0, 0, 84, 0, + 0, 0, 40, 0, 0, 85, 86, 0, 87, 88, 89, 90, 91, 92, 0, 0, + 0, 93, 0, 0, 0, 15, 28, 0, 0, 0, 0, 13, 0, 41, 0, 0, + 14, 0, 0, 20, 0, 0, 94, 0, 0, 0, 95, 0, 0, 6, 29, 0, + 0, 13, 1, 96, 1, 18, 33, 97, 25, 23, 7, 1, 1, 1, 1, 27, + 1, 7, 98, 0, 0, 9, 0, 0, 0, 0, 6, 23, 1, 0, 0, 0, + 0, 0, 30, 0, 0, 21, 0, 0, 30, 0, 0, 0, 0, 15, 0, 0, + 12, 32, 24, 5, 99, 22, 42, 17, 0, 10, 11, 0, 7, 1, 7,100, + 101, 1, 1, 1, 1,102,103,104,105, 1,106, 10, 20,107,108, 5, + 10, 0, 0, 0, 0, 0,109,110, 0, 0,111, 0, 0, 1, 1, 11, + 0, 0, 0, 8, 0, 0, 0, 3, 0, 0, 43, 40, 2, 0, 0, 0, + 44,112, 10, 8, 20, 0, 0, 0, 0, 0, 0,113, 1, 16, 5, 24, + 0, 8, 12, 0, 0, 0, 0,114, 0, 0,115, 2, 0,116, 0, 0, + 0, 1, 0, 0, 0, 0, 13, 11, 0, 0, 6, 10, 0, 0, 45, 39, + 0, 45, 16, 18, 46, 27, 0, 0, 3, 0, 0, 2, 12, 0, 0, 0, + 2, 3, 0, 0, 3, 0, 21, 0, 0, 31, 0, 0, 0, 0,117, 0, + 0, 0, 15, 9, 0, 8, 1, 10, 1, 10, 0, 0, 0, 0, 0, 30, + 14, 21, 0, 0, 47, 0, 0, 0, 9, 0, 0, 0, 0, 47, 0, 0, + 0, 0, 2, 0, 0, 0, 0, 28, 0, 0, 4, 0, 21, 41, 0, 0, + 28, 0, 0, 0, 22, 42, 0, 0,118, 0, 0, 0, 0, 0, 0,119, + 0,120,121,122,123, 0, 43, 5, 48, 13, 34, 0, 0, 0, 8, 11, + 8, 10, 0, 0, 1, 12, 1, 1, 1, 1, 26, 1, 38, 44, 12, 0, + 0, 0, 0, 1, 0, 0, 0,124, 0, 0, 0, 46, 6, 19, 0, 8, + 0, 20, 0, 0, 5, 48, 0, 0, 0, 1,125, 0, 0, 0, 0,230, + 230,230,230, 0, 0, 0, 9, 9, 0, 0, 0, 0, 9, 0, 0,220, + 220,220,220, 0, 0, 0,230,230,230,220,230, 0, 0,230,230, 7, + 0, 0, 0,230, 0, 0, 0,230,230, 0, 0,230,230,230, 0, 0, + 230,230,230, 0, 0, 9, 0, 0, 0, 0, 7,230,230,230,220, 0, + 220, 0, 0,230,220,220,220, 0, 0,230, 0, 0,230, 0, 0, 0, + 0, 7, 0, 1, 1, 1, 1,220,230,230,230,220,220,230,230,220, + 230,230,220,230, 0, 0,230,230,220, 0, 0, 0, 9, 9, 0,220, + 0, 0, 0, 0, 0, 9, 9, 0, 9, 7, 0, 1,220,220,220,220, + 220,220,230,230,230,220,220,230,220,220,230,230,220,230,230,220, + 230,220,230,230,230, 0,230, 0,220,220,220,220,220, 0, 0, 9, + 9, 0, 0, 1, 0, 0, 0, 0, 0, 0,220,230, 0,230,230, 0, + 0,220,220, 0, 0,230,220, 0, 0, 9, 7,220,220,220, 0,230, + 232,220,220,220,220,232,216,220,202,202,220,220,220,220,202,202, + 220,220,220,230,240,230,220,230,220,220, 0,232,220,220,230,233, + 234,234,233,234,234,233,230, 0,220,230,230,230,230,222,220,230, + 222,228,230, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, + 22, 0, 23, 0, 24, 25, 0,230,220, 0, 18, 30, 31, 32, 0, 0, + 0, 0, 27, 28, 29, 30, 31, 32, 33, 34,230, 35, 0, 0, 0,230, + 0,220,230, 0, 36, 0, 0,220,220,230,220,220,230,230, 0,230, + 230, 0,220, 27, 28, 29,230, 0,230,220,230, 0, 84, 91, 0,103, + 103, 9, 0,107,107,107,107,118,118, 9, 0,122,122,122,122, 0, + 220, 0,220, 0,216, 0, 0, 0,129,130, 0,132, 0, 0, 0, 0, + 0,130,130,130,130, 0, 0,130, 0,230,230, 9, 0,230,230, 0, + 0,220, 0, 0,228, 0, 0, 0,222,230,220,230, 0, 0,220,230, + 220, 0,220,230,230,230,234,230, 0, 1, 1,230,234,214,220,202, + 230,230,230,230,230,232,228,228,220,218,230,233,220,230,220,230, + 230, 1, 1, 1, 1, 1,230, 0, 1, 1,230,220,230, 1, 1, 0, + 0,218,228,232,222,224,224, 0, 8, 8, 0,220, 0, 0,230, 0, + 0, 26, 0, 0,220, 0,230,230, 1,220, 0, 0,230,220, 0, 0, + 7, 9, 0, 6, 6, 0, 0, 0, 0, 1, 0, 0,216,216, 1, 1, + 1, 0, 0, 0,226,216,216,216,216,216, 0,232,232,220,230,230, + 230, 7, 0, 1, 0, 0, 32, 0, 48, 0, 0, 84, 96,135,144, 10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,176, 0, 0, 0, 0, 0, 0, 0, 0, 8, 16, 24, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 40, 0, 0, + 0, 0, 0, 48, 56, 64, 0, 0, 0, 0, 0, 72, 80, 88, 96,104, + 0, 0, 0, 0, 0, 0, 0, 0,112, 0,120, 0, 0, 0, 0, 0, + 0,128,136,144,152,160,168, 0, 0, 0,176,184,192, 0, 0, 0, + 0, 0, 0,200, 0, 0, 0, 0, 0, 0, 0, 0,208, 0, 0,216, + 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, + 36, 0, 0, 0, 24, 0, 0, 0, 24, 0, 0, 0, 0, 0, 64, 0, + 68, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 72, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 40, 20, 0, 0, 0, 0, 0, 0, + 20, 0, 20, 0, 0, 0, 0, 0, 0, 0, 76, 80, 84, 88, 0, 0, + 12, 92, 96, 28, 0,100,104, 4, 4, 4,108, 44,112,116,120, 4, + 124, 0,128,132, 4, 4, 48,136,140, 0, 32, 0, 0, 0, 40, 0, + 0, 0, 0, 0, 0, 0, 4, 48, 0, 52,144, 20,148,152, 4, 0, + 0,156,160,164,168,172, 4, 0,176, 56, 60,180, 32, 0, 16,184, + 56, 0, 0, 0, 0, 0, 52, 12, 12, 0, 0, 0, 0, 12, 0, 0, + 188, 8, 8, 8, 8,192,196, 8, 8, 8, 8,200,204,208,212, 60, + 44, 0, 0, 0, 0, 0, 0, 0,216, 28,220, 0, 12, 4, 16, 0, + 0, 0, 0,224,228, 0, 0, 0, 0, 0, 4,232, 32, 0, 0, 0, + 0, 0, 0, 0,236, 12, 0, 0, 0, 0, 16, 0, 36, 0, 0, 0, + 24, 0, 0, 0,240,244, 0, 0, 0, 0, 2, 2, 2, 2, 4, 4, + 4, 4, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 6, 8, 0, 10, + 12, 0, 0, 2, 2, 0, 2, 2, 0, 0, 0, 0, 14, 16, 6, 8, + 0, 0, 4, 8, 0, 0, 2, 2, 2, 0, 0, 6, 4, 8, 2, 0, + 2, 0, 0, 0, 0, 6, 0, 20, 0, 0, 0, 22, 0, 0, 0, 6, + 8, 0, 24, 26, 28, 0, 0, 0, 30, 0, 0, 0, 0, 32, 34, 36, + 38, 0, 0, 40, 42, 0, 0, 0, 18, 0, 0, 0, 2, 2, 2, 2, + 0, 2, 2, 2, 0, 6, 44, 0, 0, 0, 0, 2, 0, 46, 48, 50, + 0, 0, 52, 0, 0, 0, 6, 4, 54, 0, 2, 0, 0, 2, 2, 56, + 58, 60, 0, 62, 64, 18, 2, 10, 12, 0, 0, 0, 66, 8, 0, 2, + 2, 2, 0, 6, 4, 4, 4, 4, 68, 2, 70, 4, 4, 4, 8, 72, + 0, 0, 74, 76, 2, 0, 78, 0, 0, 0, 4, 8, 2, 0, 0, 0, + 80, 0, 6, 4, 4, 4, 4, 8, 0, 2, 2, 2, 2, 6, 4, 4, + 4, 8, 0, 0, 0, 82, 0, 84, 86, 0, 0, 0, 2, 88, 0, 0, + 0, 90, 6, 8, 2, 0, 0, 0, 6, 4, 4, 4, 8, 0, 2, 0, + 2, 2, 6, 4, 4, 8, 0, 10, 12, 6, 8, 2, 0, 0, 50, 84, + 118,152, 17,161, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 5, 16, 17, 18, 1, 1, 1, 1, 1, 1, 19, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 20, 21, 22, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 0, 35, 4, 4, 4, 4, 4, 36, 0, 0, 0, + 0, 0, 0, 37, 0, 38, 39, 3, 3, 3, 3, 3, 3, 40, 41, 0, + 0, 0, 0, 0, 0, 0, 42, 43, 0, 0, 44, 0, 0, 0, 45, 46, + 5, 47, 48, 49, 50, 51, 52, 53, 5, 5, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 6, 0, 0, 6, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 54, 0, 0, 55, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, + 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, + 3, 3, 3, 1, 1, 1, 1, 1, 0, 0, 0, 26, 27, 8, 8, 8, + 28, 29, 30, 19, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 2, 2, 13, + 13, 13, 56, 11, 11, 11, 11, 11, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 8, 8, 16, 16, 72, 73, 74, 75, 3, + 3, 3, 3, 20, 20, 3, 3, 3, 3, 3, 3, 76, 77, 78, 79, 3, + 1, 1, 80, 81, 82, 83, 84, 85, 86, 87, 3, 1, 1, 1, 88, 1, + 1, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 7, 89, 21, 21, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101, 0, 0, 1, 1, 1, + 1,102, 9, 9, 9,103, 9,104,105,106,107, 22, 22,108,109, 0, + 110,111,112,113,114,115,116, 17, 17, 17, 8,117,118,119,120,121, + 122,123,124,125,126,127,128, 9,129,130,131,132,133,134,135,136, + 137,138,139,140,141, 0,142,143,144,145, 0,146,147,148,149,150, + 151,152,153,154,155,156,157, 0,158,159,160, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0,161, 12, 12, 12, 12, 12, 0, 0, 0, 0, 0,162, 0, 0, + 0, 0, 0, 14, 14, 14, 14,163,164, 23, 23, 0, 0,165, 0,166, + 167,168,169, 4, 4, 4, 4, 4, 4, 15, 15, 15, 15, 4, 4, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,170,171,172,173, 18, 18, + 18, 0, 0,174,175, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, + 3,176, 3, 3, 3,177,178, 16, 3, 3, 0, 10, 10, 10, 10, 10, + 10, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0,179, 19,180, 0, 0, + 181, 0, 0, 0,182, 0,183, 0,184, 0, 13, 24, 24,185, 0, 0, + 0, 0, 0, 3, 3, 3, 0, 9, 9, 0, 0, 3, 3, 3, 3,186, + 0, 3, 3, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 25, 25, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, + 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 8, + 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 7, + 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 10, + 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 16, + 16, 16, 16, 16, 16, 16, 16, 12, 12, 12, 12, 12, 12, 12, 12, 13, + 13, 13, 13, 13, 13, 13, 13, 18, 18, 18, 18, 18, 18, 18, 18, 17, + 17, 17, 17, 17, 17, 17, 17, 20, 20, 20, 20, 20, 20, 20, 20, 19, + 19, 19, 19, 19, 19, 19, 19, 15, 15, 15, 15, 15, 15, 15, 15, 25, + 25, 25, 25, 25, 25, 25, 25, 23, 23, 23, 23, 23, 23, 23, 23, 26, + 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 28, + 28, 28, 28, 28, 28, 28, 28, 14, 14, 14, 14, 14, 14, 14, 14, 3, + 3, 3, 3,118,119,118,119, 3, 3,156,156, 7,157, 7,157, 7, + 7, 7,158, 3, 3,180, 3, 14, 14, 14, 14, 14, 14, 14,181,182, + 17, 17, 17, 17, 17,183, 17,184, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15,185,100,100,100,100,100,186, 40, 40, 40, 40, 40, 40,187, + 188, 6, 6,189,190, 6,191, 6, 6, 6, 6, 6,192, 6, 6, 85, + 85, 85, 85, 85, 6, 6, 6,120,120,120,120,121,121,121,121,122, + 122,122,122,159,159, 85, 6, 6, 6, 6, 6, 6, 6,193, 6, 30, + 30, 30, 30, 30,194,195, 30, 45, 45, 45, 45, 45, 45, 45, 45, 46, + 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 48, + 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32, 49, + 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 51, + 51, 51, 51, 51, 51, 51, 51, 41, 41, 41, 41, 41, 41, 41, 41, 81, + 81, 81,196, 81, 81, 81, 81, 52, 52, 52, 52, 52, 52, 52, 52, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,197, 29, 29, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 35, 35, 35, 35, 35,198, 12, + 12, 36, 36, 36, 36, 36, 36,160,160,101,101,101,101,199,101,161, + 161,200,201,162,162,163,163, 37, 37, 37, 37, 37, 37, 37, 37,202, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 11, 11, 11, 11, 11,102, + 102,102,102,102,140,140,140, 86, 86, 86, 86, 86, 86, 37, 37,164, + 164, 42, 42, 42, 42, 42, 42, 42, 42, 42, 14, 14, 14, 14, 14, 53, + 53, 53, 53, 53, 53, 53, 53,103,103,103,103,123,123,123,123,104, + 104,104,104,104,141,141,141, 15, 35, 35, 35,103,203,204,205, 7, + 7,206, 7, 7,207,208,209, 7, 7, 7,210, 14, 14, 14, 14,211, + 3, 3, 3, 3, 3, 3,212, 3, 7, 3, 3, 3, 14, 14, 14, 3, + 3,213,214,215, 3, 7, 7,158, 3, 3, 3, 3, 3, 3, 3, 43, + 43, 43, 43, 43, 43, 7, 7, 54, 54, 54, 54, 54, 54, 54, 54, 35, + 35, 35,105,105,105,105,105, 12, 12, 12, 12, 12, 12, 15, 15, 1, + 1, 1, 1, 1, 1, 1, 3,216, 3,217,218,219, 22, 22, 22, 22, + 220,165, 21, 21, 21, 21,221,106,106,106,222, 2, 2, 2, 2, 2, + 3,106,106, 3, 3, 3, 21, 2, 2, 3, 3, 3, 3, 2,223, 3, + 3, 3, 3, 3, 21, 21,224, 21, 21, 21, 21, 21,225, 3, 3, 1, + 1, 1, 1, 3, 3, 3, 3, 9, 9, 9, 9, 9, 82, 82, 82, 23, + 23, 23, 23, 15, 15, 15, 15, 15, 15, 13, 13, 13, 13, 13, 13, 3, + 3,226, 7, 7, 7, 7, 7,227, 7, 7, 7, 7, 7, 7, 7,142, + 142,142, 3,124,124,124,124, 87, 87, 87, 87, 87, 87, 30, 30,166, + 166,228,143,143,143, 2, 2,107,107,107,107,229,107, 24, 24, 88, + 88, 88, 88, 88, 88, 24, 24, 89, 89, 89, 89, 89, 89, 90, 90, 12, + 12, 12, 7, 7,230,231, 36, 36, 36, 36, 36, 90, 90, 90, 90, 7, + 232, 40, 40, 40, 6, 6, 6, 6, 6, 6,233, 6, 6, 6, 6, 14, + 3,234, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6,235, 3, + 3,118,119,118,119,236,165, 21,237, 2, 2, 2, 2, 3, 3, 3, + 3, 3, 3, 17, 17, 17, 17, 17, 3, 17, 17, 17, 3, 3,238,167, + 167,125,125,125,125,239, 3,144,144,144,168,168,145,145,145,169, + 169, 91, 91, 91, 91, 91, 91,108,108,108,108,108,146,146,146,147, + 147,147,109,109,109,109,109,148,148,148,126,126,126,126,110,110, + 110,110,110,127,127,127,127,128,128,128,128,170,170,171,171, 92, + 92, 92, 92, 92, 92,172,172,173,173,174,174,129,129,129,129,175, + 175, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94,176,176,130, + 130,130,130,131,131,131,131,132,132,132,132,177,177,178,178, 55, + 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 57, + 57, 57, 57, 57, 57, 57, 57,133,133,133,133, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34,134,134,134,134,240, 6, 6, 6,149, + 149,149,135,135,135,135,136,136,136,136,150,150,150,179,179, 58, + 58, 58, 58, 58, 58, 58, 58,111,111,111,111,111,151,151,151,112, + 112,112,112,112,152,152,152, 59, 59, 59, 59, 59, 59,241, 41, 60, + 60, 60, 60, 60, 60, 60, 60,153,153,153,113,113,113,113,113, 83, + 83, 83,242, 83, 83, 83, 83, 61, 61, 61, 61, 61, 61, 61, 61, 62, + 62, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 64, + 64, 64, 64, 64, 64, 64, 64, 95, 95, 95, 95, 95, 95, 33, 33,114, + 114,114,114,114, 24, 24, 24, 65, 65, 65, 65, 65, 65, 65, 65, 66, + 66, 66, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 68, + 68, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, 69,115, + 115,115,115,115, 96, 96, 96, 96, 96, 96, 11,137,137,137,137, 30, + 30, 30, 30, 30, 30, 59, 59, 70, 70, 70, 70, 70, 70, 70, 70, 84, + 84, 84, 84, 84, 84, 84, 44, 44, 44, 44, 44, 44, 44, 44, 44, 97, + 97, 97, 97, 97, 97,116,116,116,116,116,117,117,117,117,117, 71, + 71, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 82, + 82, 82, 82, 32, 32, 32, 32, 73, 73, 73, 73, 73, 73, 73, 73, 74, + 74, 74, 74, 74, 74, 74, 74, 13, 13, 13, 13,154,154,154, 98, 98, + 98, 98, 98, 98,155,155,155, 75, 75, 75, 75, 75, 75, 75, 75, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 99, 99, 99, 99, 99, 99, 31, + 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,243, 1, 21, + 21, 21, 21, 21, 21, 21, 21,244, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 21,245, 22,246, 21, 19, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 3, 3, 3, 3, 3, 3, 14, + 14, 14, 14, 14, 3, 3, 3, 3, 3, 3, 3, 3, 3,247,248,249, + 3,250, 3, 3, 3, 3, 3, 43, 43, 43, 15, 15, 15, 15, 15, 76, + 76, 76, 76, 76, 76, 76, 76,138,138,138,138,139,139,139,139, 77, + 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 79, + 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80,251, + 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 1, 1, 1, 1, 2, + 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, + 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, + 10, 10, 10, 11, 11, 11, 11, 13, 13, 13, 13, 14, 14, 14, 14, 12, + 12, 12, 12, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, + 18, 18, 18, 21, 21, 21, 21, 22, 22, 22, 22, 19, 19, 19, 19, 20, + 20, 20, 20, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, + 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, + 30, 30, 30, 31, 31, 31, 31, 33, 33, 33, 33, 32, 32, 32, 32, 34, + 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, + 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, + 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 46, 46, 46, 46, 47, + 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, + 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 45, + 45, 45, 45, 55, 55, 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 58, + 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 62, + 62, 62, 62, 63, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 65, 66, + 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, + 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 73, 74, + 74, 74, 74, 75, 75, 75, 75, 76, 76, 76, 76, 77, 77, 77, 77, 78, + 78, 78, 78, 79, 79, 79, 79, 80, 80, 80, 80, 81, 81, 81, 81, 83, + 83, 83, 83, 82, 82, 82, 82, 84, 84, 84, 84, 86, 86, 86, 86, 87, + 87, 87, 87, 88, 88, 88, 88, 89, 89, 89, 89, 90, 90, 90, 90, 91, + 91, 91, 91, 92, 92, 92, 92, 93, 93, 93, 93, 94, 94, 94, 94, 95, + 95, 95, 95, 96, 96, 96, 96, 97, 97, 97, 97, 98, 98, 98, 98, 99, + 99, 99, 99,100,100,100,100, 85, 85, 85, 85,102,102,102,102,103, + 103,103,103,104,104,104,104,105,105,105,105,106,106,106,106,107, + 107,107,107,101,101,101,101,108,108,108,108,109,109,109,109,110, + 110,110,110,111,111,111,111,112,112,112,112,113,113,113,113,114, + 114,114,114,115,115,115,115,116,116,116,116,117,117,117,117,175, + 7, 7, 7, 7, 7,174, 3,118,118,118,118,119,119,119,119,120, + 120,120,120,121,121,121,121,122,122,122,122,123,123,123,123,124, + 124,124,124,125,125,125,125,126,126,126,126,127,127,127,127,128, + 128,128,128,129,129,129,129,130,130,130,130,131,131,131,131,132, + 132,132,132,133,133,133,133,134,134,134,134,135,135,135,135,136, + 136,136,136,137,137,137,137,138,138,138,138,139,139,139,139,140, + 140,140,140,141,141,141,141,142,142,142,142,143,143,143,143,144, + 144,144,144,145,145,145,145,146,146,146,146,147,147,147,147,148, + 148,148,148,149,149,149,149,150,150,150,150,151,151,151,151,152, + 152,152,152,153,153,153,153, 3, 3,177, 3, 7,174, 7, 7, 7, + 7,179, 3,155,155,155,155,156,156,156,156,157,157,157,157,158, + 158,158,158,159,159,159,159,160,160,160,160,182, 19, 19, 19,154, + 154,154,154,161,161,161,161,162,162,162,162,163,163,163,163,164, + 164,164,164,165,165,165,165,166,166,166,166,167,167,167,167,168, + 168,168,168,169,169,169,169,170,170,170,170,171,171,171,171,172, + 172,172,172,173,173,173,173, 7,179,194, 3, 17,195, 17,196, 17, + 197, 17, 17,198, 45, 45, 45, 15,199, 15, 15,200, 85, 85, 85,183, + 40, 40, 40, 6,184, 6,185, 6, 6,180,180,185, 6,201, 12, 12, + 202, 6, 6,203, 6, 6, 6, 6, 6, 6,184,204, 6, 6, 6,205, + 206, 30, 30, 30,207, 30, 30, 81, 81, 81,208, 29,209,210, 29, 35, + 35,211, 35,102,102,212,213,176,176,176,176,176,214, 3, 3,215, + 216, 32, 32,186, 12, 12, 12,217, 12,181,218, 3,181,178, 3, 7, + 187,219, 7, 7, 7, 7,220,221,187,222, 7, 7, 7,223, 7, 7, + 7, 7,224, 3, 3, 3,178,175, 3, 3,188, 3,225,189, 3,177, + 3, 3, 3, 3, 3, 3,177, 3,226, 3, 3,227, 1,228,229, 3, + 3, 1, 3,190, 20, 20, 20, 20, 20,230,190, 19, 19,191,182,231, + 2, 2, 2, 2, 2, 2,232, 19, 19, 19,191, 19, 19, 3, 3,189, + 7, 7, 7, 7, 7,188, 7,154,154,154,233,101,101,101,234, 7, + 7,174, 7, 7,235,236, 3,237, 85, 85,183, 6, 6, 6,238, 12, + 12, 12,239, 6, 6, 6,180, 3,240, 19, 19, 19, 19, 19,241, 3, + 3, 3,192,181, 3, 3, 3,242, 6, 6, 6,243, 41, 41, 41, 82, + 82,244, 82,245, 18, 18, 18,246, 20, 20, 20,247, 20, 20, 20, 20, + 248, 19, 19, 3,193,178, 3, 3, 3,193, 12,186,192, 12, 3, 3, + 3,249,178,250, 3, 3, 3, 2, 2, 2, 2, 13, 13, 13, 13, 12, + 12, 12, 12, 0, 0, 0, 0,136,136,136,136, 80, 80, 80, 80, 3, + 3, 3, 3, 19, 19, 19, 19, 63, 63, 63, 63, 39, 39, 39, 39,131, + 131,131,131, 28, 28, 28, 28, 1, 1, 1, 1, 30, 30, 30, 30, 79, + 79, 79, 79, 6, 6, 6, 6,127,127,127,127, 9, 9, 9, 9,155, + 155,155,155, 17, 17, 17, 17, 15, 15, 15, 15,139,139,139,139,110, + 110,110,110, 77, 77, 77, 77, 33, 33, 33, 33, 27, 27, 27, 27, 49, + 49, 49, 49,119,119,119,119,113,113,113,113, 25, 25, 25, 25, 7, + 7, 7, 7, 99, 99, 99, 99, 32, 32, 32, 32, 22, 22, 22, 22,165, + 165,165,165, 8, 8, 8, 8, 29, 29, 29, 29, 31, 31, 31, 31,146, + 146,146,146,105,105,105,105, 14, 14, 14, 14, 36, 36, 36, 36, 91, + 91, 91, 91, 56, 56, 56, 56,134,134,134,134, 55, 55, 55, 55, 5, + 5, 5, 5, 11, 11, 11, 11, 10, 10, 10, 10, 21, 21, 21, 21, 23, + 23, 23, 23, 16, 16, 16, 16, 20, 20, 20, 20, 18, 18, 18, 18, 62, + 62, 62, 62,122,122,122,122, 89, 89, 89, 89,130,130,130,130, 94, + 94, 94, 94,100,100,100,100,108,108,108,108,171,171,171,171,137, + 137,137,137,124,124,124,124,123,123,123,123,126,126,126,126,142, + 142,142,142,125,125,125,125,154,154,154,154,150,150,150,150,169, + 169,169,169,145,145,145,145,163,163,163,163,157,157,157,157,166, + 166,166,166,167,167,167,167,151,151,151,151,164,164,164,164,168, + 168,168,168,174,174,174,174,132,132,132,132, 24, 24, 24, 24,107, + 107,107,107, 86, 86, 86, 86,133,133,133,133, 4, 4, 4, 4, 37, + 37, 37, 37, 58, 58, 58, 58, 75, 75, 75, 75, 68, 68, 68, 68, 92, + 92, 92, 92, 87, 87, 87, 87, 59, 59, 59, 59,116,116,116,116, 97, + 97, 97, 97, 57, 57, 57, 57,114,114,114,114,140,140,140,140,138, + 138,138,138,159,159,159,159,172,172,172,172, 84, 84, 84, 84, 35, + 35, 35, 35, 48, 48, 48, 48, 76, 76, 76, 76, 70, 70, 70, 70, 61, + 61, 61, 61, 26, 26, 26, 26, 40, 40, 40, 40,135,135,135,135,161, + 161,161,161, 85, 85, 85, 85, 96, 96, 96, 96,109,109,109,109,102, + 102,102,102,141,141,141,141,143,143,143,143,175,175,175,175, 38, + 38, 38, 38, 64, 64, 64, 64, 90, 90, 90, 90, 93, 93, 93, 93, 65, + 65, 65, 65, 67, 67, 67, 67,104,104,104,104,170,170,170,170, 47, + 47, 47, 47,173,173,173,173,117,117,117,117,112,112,112,112, 78, + 78, 78, 78,144,144,144,144,156,156,156,156,148,148,148,148,158, + 158,158,158,121,121,121,121,160,160,160,160,152,152,152,152, 52, + 52, 52, 52, 73, 73, 73, 73, 60, 60, 60, 60, 74, 74, 74, 74, 42, + 42, 42, 42,118,118,118,118, 51, 51, 51, 51, 50, 50, 50, 50,106, + 106,106,106,147,147,147,147,153,153,153,153,101,101,101,101,111, + 111,111,111,129,129,129,129,115,115,115,115,103,103,103,103, 69, + 69, 69, 69, 95, 95, 95, 95, 34, 34, 34, 34, 45, 45, 45, 45, 43, + 43, 43, 43, 46, 46, 46, 46, 54, 54, 54, 54, 71, 71, 71, 71, 41, + 41, 41, 41, 53, 53, 53, 53, 81, 81, 81, 81,120,120,120,120,128, + 128,128,128, 66, 66, 66, 66, 72, 72, 72, 72, 98, 98, 98, 98, 88, + 88, 88, 88, 83, 83, 83, 83, 82, 82, 82, 82,149,149,149,149, 19, + 19, 19, 0, 0, 19, 19, 19, 44, 44, 44, 44, 0, 0, 19, 0, 1, + 1, 0, 0, 19, 0, 0, 0, 3, 3, 3, 0, 1, 0, 0, 0, 0, + 17, 17, 17, 4, 14, 14, 14, 3, 0, 3, 3, 0, 3, 3, 3, 1, + 1, 1, 0, 19, 19, 9, 9, 0, 0, 0, 19, 0, 0, 19, 19, 0, + 15, 15, 15, 17, 17, 17, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, + 0, 26, 26, 0, 9, 9, 9, 9, 9, 0, 9, 9, 0, 9, 0, 9, + 9, 55, 55, 6, 1, 1, 6, 6, 4, 4, 4, 3, 3, 3, 1, 1, + 1, 3, 3, 1, 3, 3, 3, 3, 3, 0, 3, 7, 1, 1, 1, 1, + 7, 7, 7, 0, 0, 7, 7, 24, 24, 24, 0, 25, 0, 0, 0, 0, + 25, 25, 25, 8, 8, 8, 0, 35, 35, 35, 0, 0, 0, 35, 35, 44, + 0, 0, 0, 32, 32, 0, 0, 32, 0, 32, 32, 1, 0, 1, 1, 0, + 1, 0, 0, 9, 9, 9, 6, 19, 9, 9, 9, 9, 9, 19, 19, 9, + 9, 9, 19, 6, 19, 19, 19, 19, 19, 19, 9, 0, 0, 9, 0, 0, + 13, 0, 13, 0, 13, 13, 13, 13, 13, 1, 1, 1, 1, 12, 12, 15, + 1, 1, 0, 26, 12, 12, 12, 12, 12, 12, 0, 69, 69, 0, 69, 84, + 84, 84, 0, 19, 9, 19, 19, 19, 19, 0, 0, 19, 19, 19, 4, 3, + 3, 0, 0, 1, 1, 6, 6, 0, 0, 17, 17, 17, 17, 0, 0,156, + 156, 3, 3,100, 36, 36, 36,107,107,107, 1,136,139, 13, 13, 17, + 15, 15, 15, 17, 17, 15, 15, 15, 17, 17, 17, 0, 0, 1, 1, 15, + 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, + 10, 0, 11, 12, 13, 0, 0, 0, 14, 0, 0, 15, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 17, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 19, 20, 21, 0, 22, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 23, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, + 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 24, 25, 26, 27, 28, 29, 30, 0, @@ -5224,8 +5226,6 @@ static const uint8_t _hb_ucd_u8[13937]= 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 68, 0, 69, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101, @@ -5260,116 +5260,116 @@ static const uint8_t _hb_ucd_u8[13937]= 0,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194, 195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210, 211,212,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, - 4, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, }; static const uint16_t _hb_ucd_u16[5104]= { - 0, 0, 1, 2, 3, 4, 5, 6, 0, 0, 7, 8, 9, 10, 11, 12, - 13, 13, 13, 14, 15, 13, 13, 16, 17, 18, 19, 20, 21, 22, 13, 23, - 13, 13, 13, 24, 25, 11, 11, 11, 11, 26, 11, 27, 28, 29, 30, 31, - 32, 32, 32, 32, 32, 32, 32, 33, 34, 35, 36, 11, 37, 38, 13, 39, - 9, 9, 9, 11, 11, 11, 13, 13, 40, 13, 13, 13, 41, 13, 13, 13, - 13, 13, 13, 35, 9, 42, 11, 11, 43, 44, 32, 45, 46, 47, 47, 48, - 49, 50, 47, 47, 51, 32, 52, 53, 47, 47, 47, 47, 47, 54, 55, 56, - 57, 58, 47, 32, 59, 47, 47, 47, 47, 47, 60, 53, 61, 47, 62, 63, - 47, 64, 65, 66, 47, 67, 47, 47, 68, 69, 47, 47, 70, 32, 71, 32, - 72, 47, 47, 73, 74, 75, 76, 77, 78, 47, 47, 79, 80, 81, 82, 83, - 84, 47, 47, 85, 86, 87, 88, 89, 84, 47, 47, 79, 90, 47, 82, 91, - 92, 47, 47, 93, 94, 95, 82, 96, 97, 47, 47, 98, 99, 100, 101, 102, - 103, 47, 47, 104, 105, 106, 82, 107, 108, 47, 47, 93, 109, 110, 82, 111, - 112, 47, 47, 113, 114, 115, 82, 116, 92, 47, 47, 47, 117, 118, 101, 119, - 47, 47, 47, 120, 121, 122, 66, 66, 47, 47, 47, 123, 124, 125, 47, 47, - 126, 127, 128, 129, 47, 47, 47, 130, 131, 32, 32, 132, 133, 134, 66, 66, - 47, 47, 135, 136, 122, 137, 138, 139, 140, 141, 9, 9, 9, 11, 11, 142, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 143, 144, 145, - 47, 146, 9, 9, 9, 9, 9, 147, 148, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 149, 47, 150, 151, 47, 47, 47, 47, 152, 153, - 47, 154, 47, 155, 47, 156, 47, 156, 47, 47, 47, 157, 158, 159, 160, 145, - 161, 160, 47, 47, 162, 47, 47, 47, 163, 47, 164, 47, 47, 47, 47, 47, - 47, 47, 165, 166, 167, 47, 47, 47, 47, 47, 47, 47, 47, 168, 146, 146, - 47, 169, 47, 47, 47, 170, 171, 172, 160, 160, 173, 174, 32, 32, 32, 32, - 175, 47, 47, 176, 177, 122, 178, 179, 180, 47, 181, 61, 47, 47, 182, 183, - 47, 47, 184, 185, 186, 61, 47, 187, 188, 9, 9, 9, 66, 189, 190, 191, - 11, 11, 192, 27, 27, 27, 193, 194, 11, 195, 27, 27, 32, 32, 32, 32, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 196, 13, 13, 13, 13, 13, 13, - 197, 197, 197, 197, 197, 198, 197, 11, 199, 199, 199, 200, 201, 202, 202, 201, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 27, 212, 212, 212, 213, 214, 32, - 215, 216, 217, 218, 219, 145, 220, 220, 221, 222, 223, 146, 224, 225, 146, 226, - 227, 227, 227, 227, 227, 227, 227, 227, 228, 146, 229, 146, 146, 146, 146, 230, - 146, 231, 227, 232, 146, 233, 234, 146, 146, 146, 146, 146, 146, 146, 145, 145, - 145, 235, 146, 146, 146, 146, 236, 145, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 237, 238, 146, 146, 239, 146, 146, 146, 146, 146, 146, 240, 146, - 146, 146, 146, 146, 146, 146, 241, 242, 145, 243, 146, 146, 244, 227, 245, 227, - 246, 247, 227, 227, 227, 248, 227, 249, 146, 146, 146, 227, 250, 146, 146, 146, - 9, 9, 9, 11, 11, 11, 251, 252, 13, 13, 13, 13, 13, 13, 253, 254, - 11, 11, 11, 47, 47, 47, 255, 256, 47, 47, 47, 47, 47, 47, 32, 32, - 257, 258, 259, 260, 261, 262, 263, 263, 264, 265, 266, 267, 268, 47, 47, 47, - 47, 269, 148, 47, 47, 47, 47, 270, 47, 271, 47, 47, 146, 146, 146, 47, - 146, 146, 272, 146, 273, 274, 146, 146, 272, 146, 146, 274, 146, 146, 146, 146, - 47, 47, 47, 47, 146, 146, 146, 146, 47, 275, 47, 47, 47, 47, 47, 47, - 47, 146, 146, 146, 146, 47, 47, 187, 276, 47, 61, 47, 13, 13, 277, 278, - 13, 279, 47, 47, 47, 47, 280, 281, 31, 282, 283, 284, 13, 13, 13, 285, - 286, 287, 288, 289, 290, 291, 9, 292, 293, 47, 294, 295, 47, 47, 47, 296, - 297, 47, 47, 298, 299, 160, 32, 300, 61, 47, 301, 47, 302, 303, 47, 47, - 72, 47, 47, 304, 305, 306, 307, 61, 47, 47, 308, 309, 310, 311, 47, 312, - 47, 47, 47, 313, 58, 314, 315, 316, 47, 47, 47, 11, 11, 317, 318, 11, - 11, 11, 11, 11, 47, 47, 319, 160, 320, 320, 320, 320, 320, 320, 320, 320, - 321, 321, 321, 321, 321, 321, 321, 321, 11, 322, 323, 47, 47, 47, 47, 47, - 47, 47, 47, 324, 325, 326, 47, 47, 47, 47, 47, 327, 146, 47, 47, 47, - 47, 328, 47, 47, 329, 146, 146, 330, 32, 331, 32, 332, 333, 334, 335, 47, - 47, 47, 47, 47, 47, 47, 47, 336, 337, 2, 3, 4, 5, 338, 339, 340, - 47, 341, 47, 47, 47, 47, 342, 343, 344, 145, 145, 345, 220, 220, 220, 346, - 347, 146, 146, 146, 146, 146, 146, 348, 349, 349, 349, 349, 349, 349, 349, 349, - 47, 47, 47, 47, 47, 47, 350, 145, 47, 47, 351, 47, 352, 47, 47, 60, - 47, 353, 47, 47, 47, 354, 220, 220, 9, 9, 147, 11, 11, 47, 47, 47, - 47, 47, 160, 9, 9, 147, 11, 11, 47, 47, 47, 47, 47, 47, 353, 9, - 9, 355, 11, 11, 47, 47, 47, 47, 27, 27, 27, 27, 27, 27, 27, 27, - 47, 47, 47, 47, 47, 356, 47, 357, 47, 47, 358, 145, 145, 145, 47, 359, - 47, 360, 47, 353, 47, 47, 47, 47, 47, 47, 47, 361, 145, 145, 145, 145, - 362, 47, 47, 363, 145, 66, 47, 364, 47, 365, 145, 145, 366, 47, 367, 66, - 47, 47, 47, 368, 47, 369, 47, 369, 47, 368, 144, 145, 145, 145, 145, 145, - 9, 9, 9, 9, 11, 11, 11, 370, 47, 47, 371, 160, 372, 9, 373, 11, - 374, 227, 227, 227, 227, 227, 227, 227, 145, 145, 145, 145, 145, 145, 145, 145, - 47, 47, 375, 47, 275, 376, 146, 377, 47, 365, 378, 47, 60, 379, 66, 47, - 380, 66, 66, 47, 381, 145, 47, 47, 382, 47, 47, 363, 383, 384, 385, 386, - 180, 47, 47, 387, 388, 47, 47, 160, 97, 47, 389, 390, 391, 47, 47, 392, - 180, 47, 47, 393, 394, 395, 396, 145, 47, 47, 397, 398, 362, 32, 32, 32, - 47, 47, 368, 47, 47, 399, 172, 160, 92, 47, 47, 113, 400, 401, 402, 32, - 47, 47, 47, 403, 404, 405, 406, 32, 47, 47, 47, 407, 408, 409, 47, 47, - 47, 47, 47, 410, 411, 160, 160, 160, 47, 47, 412, 413, 414, 415, 32, 32, - 47, 47, 47, 416, 417, 160, 66, 66, 47, 47, 418, 419, 160, 160, 160, 160, - 47, 420, 421, 422, 47, 47, 47, 47, 47, 47, 397, 423, 66, 66, 66, 66, - 9, 9, 9, 9, 11, 11, 128, 424, 47, 47, 47, 425, 426, 160, 160, 160, - 47, 47, 47, 47, 47, 427, 428, 429, 430, 47, 47, 431, 432, 433, 47, 47, - 434, 435, 66, 47, 47, 47, 47, 47, 66, 66, 66, 66, 66, 66, 436, 429, - 47, 47, 47, 47, 47, 47, 437, 160, 47, 47, 412, 438, 437, 128, 145, 439, - 47, 156, 440, 441, 32, 32, 32, 32, 47, 47, 47, 362, 442, 160, 47, 47, - 443, 444, 160, 47, 47, 445, 160, 160, 47, 47, 47, 47, 47, 47, 47, 446, - 447, 47, 47, 448, 449, 450, 32, 32, 47, 47, 47, 47, 145, 451, 452, 453, - 220, 220, 220, 220, 220, 220, 220, 66, 47, 47, 47, 47, 47, 47, 47, 437, - 47, 47, 47, 209, 454, 32, 47, 47, 47, 455, 456, 160, 160, 160, 160, 160, - 47, 47, 47, 47, 47, 47, 306, 47, 47, 47, 47, 47, 160, 47, 47, 457, - 47, 47, 47, 458, 459, 460, 461, 47, 27, 27, 27, 27, 462, 47, 463, 160, - 9, 9, 9, 9, 9, 9, 11, 11, 145, 464, 9, 465, 11, 11, 11, 11, - 47, 47, 47, 47, 399, 466, 429, 429, 467, 468, 27, 27, 27, 27, 469, 470, - 47, 471, 209, 209, 209, 209, 209, 209, 146, 146, 146, 146, 146, 146, 146, 472, - 146, 146, 146, 146, 146, 146, 146, 227, 32, 32, 32, 32, 32, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 473, 474, 475, 146, 476, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 477, 146, 146, 146, 9, 478, 11, 479, 480, 11, 197, 9, - 481, 482, 9, 483, 11, 9, 478, 11, 479, 480, 11, 197, 9, 481, 482, 9, - 483, 11, 9, 478, 11, 479, 480, 11, 197, 9, 481, 482, 9, 483, 11, 9, - 478, 11, 197, 9, 484, 485, 486, 487, 11, 488, 9, 489, 490, 491, 492, 11, - 493, 9, 494, 11, 495, 160, 160, 160, 32, 32, 32, 496, 32, 32, 497, 498, - 499, 500, 32, 32, 32, 32, 32, 32, 501, 11, 11, 11, 11, 11, 11, 11, - 32, 32, 32, 27, 27, 27, 27, 27, 32, 32, 32, 32, 32, 32, 32, 32, - 47, 47, 47, 502, 503, 146, 146, 146, 47, 47, 455, 32, 47, 47, 504, 505, - 47, 47, 47, 47, 47, 47, 506, 160, 47, 47, 47, 47, 47, 47, 455, 507, - 47, 47, 47, 47, 47, 47, 508, 509, 47, 47, 47, 47, 358, 32, 32, 32, - 9, 9, 481, 11, 510, 306, 66, 66, 145, 145, 511, 512, 145, 145, 145, 145, - 145, 145, 513, 145, 145, 145, 145, 145, 47, 47, 47, 47, 47, 47, 47, 227, - 514, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 515, - 146, 146, 146, 146, 146, 227, 227, 227, 209, 209, 209, 209, 209, 209, 209, 209, + 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, + 8, 8, 8, 8, 8, 8, 8, 8, 24, 24, 24, 24, 24, 24, 24, 24, + 32, 32, 32, 32, 32, 32, 32, 32, 64, 64, 64, 64, 64, 64, 64, 64, + 56, 56, 56, 56, 56, 56, 56, 56, 40, 40, 40, 40, 40, 40, 40, 40, + 24, 24, 24, 24, 24, 24, 56, 56, 96, 96, 96, 96, 96, 96, 96, 96, + 24, 24, 24, 24, 24, 24, 24, 592, 152, 152, 600, 336, 344, 352, 360, 608, + 152, 152, 616, 624, 72, 632, 48, 640, 80, 80, 80, 648, 656, 80, 80, 664, + 672, 680, 688, 696, 704, 712, 80, 720, 80, 80, 80, 728, 736, 48, 48, 48, + 48, 744, 48, 96, 752, 760, 768, 368, 40, 40, 40, 40, 40, 40, 40, 776, + 784, 376, 792, 48, 800, 808, 80, 816, 72, 72, 72, 48, 48, 48, 80, 80, + 824, 80, 80, 80, 832, 80, 80, 80, 80, 80, 80, 376, 72, 840, 48, 48, + 848, 856, 40, 864, 872, 8, 8, 880, 888, 896, 8, 8, 904, 40, 912, 384, + 8, 8, 8, 8, 8, 920, 928, 936, 944, 392, 8, 40, 952, 8, 8, 8, + 8, 8, 184, 384, 136, 8, 960, 968, 8, 976, 984, 104, 8, 992, 8, 8, + 1000,1008, 8, 8,1016, 40,1024, 40, 400, 8, 8,1032,1040,1048,1056,1064, + 1072, 8, 8, 408,1080,1088, 144,1096, 416, 8, 8,1104,1112,1120,1128,1136, + 416, 8, 8, 408,1144, 8, 144,1152, 192, 8, 8, 424,1160,1168, 144,1176, + 432, 8, 8,1184,1192,1200, 440,1208,1216, 8, 8,1224,1232,1240, 144,1248, + 1256, 8, 8, 424,1264,1272, 144,1280,1288, 8, 8, 448,1296,1304, 144,1312, + 192, 8, 8, 8,1320,1328, 440,1336, 8, 8, 8,1344,1352, 200, 104, 104, + 8, 8, 8,1360,1368,1376, 8, 8,1384,1392, 208,1400, 8, 8, 8,1408, + 1416, 40, 40,1424,1432,1440, 104, 104, 8, 8,1448,1456, 200,1464,1472,1480, + 1488,1496, 72, 72, 72, 48, 48,1504, 8, 8, 8, 8, 8,1512, 456, 56, + 8, 24, 72, 72, 72, 72, 72, 216, 464, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8,1520, 8,1528,1536, 8, 8, 8, 8,1544,1552, + 8,1560, 8,1568, 8, 224, 8, 224, 8, 8, 8,1576,1584,1592, 88, 56, + 1600, 88, 8, 8,1608, 8, 8, 8,1616, 8,1624, 8, 8, 8, 8, 8, + 8, 8,1632,1640,1648, 8, 8, 8, 8, 8, 8, 8, 8,1656, 24, 24, + 8,1664, 8, 8, 8,1672,1680, 472, 88, 88,1688,1696, 40, 40, 40, 40, + 1704, 8, 8,1712,1720, 200,1728,1736, 232, 8,1744, 136, 8, 8,1752,1760, + 8, 8,1768,1776,1784, 136, 8, 480,1792, 72, 72, 72, 104,1800,1808,1816, + 48, 48,1824, 96, 96, 96,1832,1840, 48,1848, 96, 96, 40, 40, 40, 40, + 80, 80, 80, 80, 80, 80, 80, 80, 80,1856, 80, 80, 80, 80, 80, 80, + 128, 128, 128, 128, 128,1864, 128, 48, 240, 240, 240,1872, 488, 496, 496, 488, + 1880,1888,1896,1904,1912,1920, 112,1928,1936, 96, 248, 248, 248,1944,1952, 40, + 1960,1968,1976,1984,1992, 56, 120, 120,2000,2008,2016, 24,2024,2032, 24,2040, + 2048, 24,2056, 24, 24, 24, 24,2064, 24,2072, 64,2080, 24,2088,2096, 24, + 56,2104, 24, 24, 24, 24,2112, 56, 24, 24, 24,2120,2128, 24, 24,2136, + 24, 24, 24, 24, 24, 24,2144, 24, 24, 24, 24, 24, 24, 24,2152,2160, + 56,2168, 24, 24,2176, 64,2184, 64,2192,2200, 64, 64, 64,2208, 64,2216, + 24, 24, 24, 64,2224, 24, 24, 24, 72, 72, 72, 48, 48, 48,2232,2240, + 80, 80, 80, 80, 80, 80,2248,2256, 48, 48, 48, 8, 8, 8,2264,2272, + 8, 8, 8, 8, 8, 8, 40, 40,2280,2288,2296,2304,2312,2320, 504, 504, + 2328,2336,2344,2352,2360, 8, 8, 8, 8,2368, 464, 8, 8, 8, 8,2376, + 8,2384, 8, 8, 24, 24, 24, 8, 24, 24, 512, 24,2392, 520, 24, 24, + 512, 24, 24, 520, 24, 24, 24, 24, 8, 8, 8, 8, 24, 24, 24, 24, + 8, 528, 8, 8, 8, 8, 8, 8, 8, 24, 24, 24, 24, 8, 8, 480, + 2400, 8, 136, 8, 80, 80,2408,2416, 80,2424, 8, 8, 8, 8,2432,2440, + 368,2448,2456,2464, 80, 80, 80,2472,2480,2488,2496,2504,2512,2520, 72,2528, + 2536, 8,2544,2552, 8, 8, 8,2560,2568, 8, 8,2576,2584, 88, 40,2592, + 136, 8,2600, 8,2608,2616, 8, 8, 400, 8, 8,2624,2632, 256,2640, 136, + 8, 8,2648,2656,2664,2672, 8,2680, 8, 8, 8,2688, 392,2696,2704,2712, + 8, 8, 8, 48, 48,2720,2728, 48, 48, 48, 48, 48, 8, 8,2736, 88, + 48,2744,2752, 8, 8, 8, 8, 8, 8, 8, 8,2760,2768,2776, 8, 8, + 8, 8, 8,2784, 24, 8, 8, 8, 8,2792, 8, 8,2800, 24, 24,2808, + 40,2816, 40,2824,2832,2840,2848, 8, 8, 8, 8, 8, 8, 8, 8,2856, + 2864, 336, 344, 352, 360,2872,2880,2888, 8,2896, 8, 8, 8, 8,2904,2912, + 2920, 56, 56,2928, 120, 120, 120,2936,2944, 24, 24, 24, 24, 24, 24,2952, + 8, 8, 8, 8, 8, 8,2960, 56, 8, 8,2968, 8,2976, 8, 8, 184, + 8, 264, 8, 8, 8,2984, 120, 120, 72, 72, 216, 48, 48, 8, 8, 8, + 8, 8, 88, 72, 72, 216, 48, 48, 8, 8, 8, 8, 8, 8, 264, 72, + 72,2992, 48, 48, 8, 8, 8, 8, 8, 8, 8, 8, 8,3000, 8,3008, + 8, 8, 536, 56, 56, 56, 8,3016, 8,3024, 8, 264, 8, 8, 8, 8, + 8, 8, 8,3032, 56, 56, 56, 56, 272, 8, 8, 544, 56, 104, 8,3040, + 8, 552, 56, 56,3048, 8,3056, 104, 8, 8, 8, 280, 8, 560, 8, 560, + 8, 280, 456, 56, 56, 56, 56, 56, 72, 72, 72, 72, 48, 48, 48,3064, + 8, 8,3072, 88,3080, 72,3088, 48,3096, 64, 64, 64, 64, 64, 64, 64, + 8, 8,3104, 8, 528,3112, 24,3120, 8, 552,3128, 8, 184,3136, 104, 8, + 3144, 104, 104, 8,3152, 56, 8, 8,3160, 8, 8, 544,3168,3176,3184,3192, + 232, 8, 8,3200,3208, 8, 8, 88, 432, 8,3216,3224,3232, 8, 8,3240, + 232, 8, 8,3248,3256,3264,3272, 56, 8, 8, 568,3280, 272, 40, 40, 40, + 8, 8, 280, 8, 8, 576, 472, 88, 192, 8, 8, 448,3288,3296,3304, 40, + 8, 8, 8,3312,3320,3328,3336, 40, 8, 8, 8,3344,3352,3360, 8, 8, + 8, 8, 8,3368,3376, 88, 88, 88, 8, 8, 584,3384,3392,3400, 40, 40, + 8, 8, 8,3408,3416, 88, 104, 104, 8, 8,3424,3432, 88, 88, 88, 88, + 8,3440,3448,3456, 8, 8, 8, 8, 8, 8, 568,3464, 104, 104, 104, 104, + 72, 72, 72, 72, 48, 48, 208,3472, 8, 8, 8,3480,3488, 88, 88, 88, + 8, 8, 8, 8, 8,3496,3504, 160,3512, 8, 8,3520,3528,3536, 8, 8, + 3544,3552, 104, 8, 8, 8, 8, 8, 104, 104, 104, 104, 104, 104,3560, 160, + 8, 8, 8, 8, 8, 8, 288, 88, 8, 8, 584,3568, 288, 208, 56,3576, + 8, 224,3584,3592, 40, 40, 40, 40, 8, 8, 8, 272,3600, 88, 8, 8, + 3608,3616, 88, 8, 8,3624, 88, 88, 8, 8, 8, 8, 8, 8, 8,3632, + 3640, 8, 8,3648,3656,3664, 40, 40, 8, 8, 8, 8, 56,3672,3680,3688, + 120, 120, 120, 120, 120, 120, 120, 104, 8, 8, 8, 8, 8, 8, 8, 288, + 8, 8, 8, 112,3696, 40, 8, 8, 8, 296,3704, 88, 88, 88, 88, 88, + 8, 8, 8, 8, 8, 8, 256, 8, 8, 8, 8, 8, 88, 8, 8,3712, + 8, 8, 8,3720,3728,3736,3744, 8, 96, 96, 96, 96,3752, 8,3760, 88, + 72, 72, 72, 72, 72, 72, 48, 48, 56,3768, 72,3776, 48, 48, 48, 48, + 8, 8, 8, 8, 576,3784, 160, 160,3792,3800, 96, 96, 96, 96,3808,3816, + 8,3824, 112, 112, 112, 112, 112, 112, 24, 24, 24, 24, 24, 24, 24, 64, + 40, 40, 40, 40, 40, 24, 24, 24, 24, 24, 24, 24, 24, 24,3832,3840, + 3848, 24,3856, 24, 24, 24, 24, 24, 24, 24, 24, 24,3864, 24, 24, 24, + 72, 168, 48, 304, 312, 48, 128, 72, 176, 320, 72, 328, 48, 72, 168, 48, + 304, 312, 48, 128, 72, 176, 320, 72, 328, 48, 72, 168, 48, 304, 312, 48, + 128, 72, 176, 320, 72, 328, 48, 72, 168, 48, 128, 72,3872,3880,3888,3896, + 48,3904, 72,3912,3920,3928,3936, 48,3944, 72,3952, 48,3960, 88, 88, 88, + 40, 40, 40,3968, 40, 40,3976,3984,3992,4000, 40, 40, 40, 40, 40, 40, + 4008, 48, 48, 48, 48, 48, 48, 48, 40, 40, 40, 96, 96, 96, 96, 96, + 8, 8, 8,4016,4024, 24, 24, 24, 8, 8, 296, 40, 8, 8,4032,4040, + 8, 8, 8, 8, 8, 8,4048, 88, 8, 8, 8, 8, 8, 8, 296,4056, + 8, 8, 8, 8, 8, 8,4064,4072, 8, 8, 8, 8, 536, 40, 40, 40, + 72, 72, 176, 48,4080, 256, 104, 104, 56, 56,4088,4096, 56, 56, 56, 56, + 56, 56,4104, 56, 56, 56, 56, 56, 8, 8, 8, 8, 8, 8, 8, 64, + 4112, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,4120, + 24, 24, 24, 24, 24, 64, 64, 64, 112, 112, 112, 112, 112, 112, 112, 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 939, 940, 941, 942, 946, 948, 0, 962, 969, 970, 971, 976,1001,1002,1003,1008, 0,1033,1040,1041,1042,1043,1047, 0, 0,1080,1081,1082,1086,1110, 0, 0, @@ -5587,9 +5587,9 @@ static const uint16_t _hb_ucd_u16[5104]= }; static const int16_t _hb_ucd_i16[92]= { - 0, 0, 1, -1, 2, 0, -2, 0, 0, 2, 0, -2, 0, 16, 0, -16, - 0, 1, -1, 0, 3, 3, 3, -3, -3, -3, 0, 2016, 0, 2527, 1923, 1914, - 1918, 0, 2250, 0, 0, 138, 0, 7, -7, 0, -1, 1, 1824, 0, 2104, 0, + 0, 0, 1, -1, -1, 1, 0, 1, -1, 0, 0, 2, 0, -2, 2, 0, + -2, 0, -7, 0, 0, 16, 0, -16, 3, 3, 3, -3, -3, -3, 0, 2016, + 0, 2527, 1923, 1914, 1918, 0, 2250, 0, 0, 138, 0, 7, 1824, 0, 2104, 0, 2108, 2106, 0, 2106, 1316, 0, -1, -138, 8, 8, 8, 0, 7, 7, -8, -8, -8, -7,-1316, 1, -1, 3, -3, 1, 0,-1914,-1918, 0, 0,-1923,-1824, 0, 0,-2016,-2104, 0, 0,-2106,-2108,-2106,-2250, 0,-2527, 0, @@ -5597,11 +5597,13 @@ static const int16_t _hb_ucd_i16[92]= static inline uint8_t _hb_ucd_gc (unsigned u) { - return u<1114112 ? _hb_ucd_u8[5296u+((_hb_ucd_u8[1168u+((_hb_ucd_u16[((_hb_ucd_u8[544u+((_hb_ucd_u8[((((((((u)>>1))>>3))>>3))>>4)])<<4)+((((((((u)>>1))>>3))>>3))&15)])<<3)+((((((u)>>1))>>3))&7)])<<3)+((((u)>>1))&7)])<<1)+((u)&1)] : 2; + /* packtab: [2^8,2^4,2^3,2^3,2^1] */ + return u<1114112u ? (uint8_t)(_hb_ucd_u8[5288u+((_hb_ucd_u8[1160u+_hb_ucd_u16[((_hb_ucd_u8[544u+((_hb_ucd_u8[((((((((u)>>1))>>3))>>3))>>4)])<<4)+((((((((u)>>1))>>3))>>3))&15)])<<3)+((((((u)>>1))>>3))&7)]+((((u)>>1))&7)])<<1)+((u)&1)]) : 2; } static inline uint8_t _hb_ucd_ccc (unsigned u) { - return u<125259 ? _hb_ucd_u8[7322u+((_hb_ucd_u8[6738u+((_hb_ucd_u8[6258u+((_hb_ucd_u8[5890u+((_hb_ucd_u8[5644u+((((((((u)>>2))>>2))>>2))>>3)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)] : 0; + /* packtab: [2^8,2^3,2^2,2^2,2^2] */ + return u<125259u ? (uint8_t)(_hb_ucd_u8[7307u+((_hb_ucd_u8[6724u+((_hb_ucd_u8[6247u+((_hb_ucd_u8[5881u+((_hb_ucd_u8[5636u+((((((((u)>>2))>>2))>>2))>>3)])<<3)+((((((((u)>>2))>>2))>>2))&7)])<<2)+((((((u)>>2))>>2))&3)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 0; } static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i) { @@ -5609,15 +5611,18 @@ static inline uint8_t _hb_ucd_b4 (const uint8_t* a, unsigned i) } static inline int16_t _hb_ucd_bmg (unsigned u) { - return u<65380 ? _hb_ucd_i16[((_hb_ucd_u8[8218u+((_hb_ucd_u8[7986u+((_hb_ucd_u8[7890u+((_hb_ucd_b4(_hb_ucd_u8+7826u,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)])<<3)+((((((u)>>1))>>2))&7)])<<2)+((((u)>>1))&3)])<<1)+((u)&1)] : 0; + /* packtab: [2^4,2^3,2^3,2^2,2^1] */ + return u<65380u ? (int16_t)(_hb_ucd_i16[_hb_ucd_u8[8198u+_hb_ucd_u8[7969u+_hb_ucd_u8[7875u+((_hb_ucd_b4(_hb_ucd_u8+7811u,((((((((u)>>1))>>2))>>3))>>3)))<<3)+((((((((u)>>1))>>2))>>3))&7)]+((((((u)>>1))>>2))&7)]+((((u)>>1))&3)]+((u)&1)]) : 0; } static inline uint8_t _hb_ucd_sc (unsigned u) { - return u<918016 ? _hb_ucd_u8[11655u+((_hb_ucd_u8[10647u+((_hb_ucd_u8[9151u+((_hb_ucd_u8[8703u+((_hb_ucd_u8[8495u+((_hb_ucd_b4(_hb_ucd_u8+8466u,((((((((((u)>>2))>>2))>>3))>>3))>>4)))<<4)+((((((((((u)>>2))>>2))>>3))>>3))&15)])<<3)+((((((((u)>>2))>>2))>>3))&7)])<<3)+((((((u)>>2))>>2))&7)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)] : 2; + /* packtab: [2^4,2^4,2^3,2^3,2^2,2^2] */ + return u<918016u ? (uint8_t)(_hb_ucd_u8[11623u+((_hb_ucd_u8[10615u+((_hb_ucd_u8[9119u+((_hb_ucd_u8[8675u+((_hb_ucd_u8[8475u+((_hb_ucd_b4(_hb_ucd_u8+8446u,((((((((((u)>>2))>>2))>>3))>>3))>>4)))<<4)+((((((((((u)>>2))>>2))>>3))>>3))&15)])<<3)+((((((((u)>>2))>>2))>>3))&7)])<<3)+((((((u)>>2))>>2))&7)])<<2)+((((u)>>2))&3)])<<2)+((u)&3)]) : 2; } static inline uint16_t _hb_ucd_dm (unsigned u) { - return u<195102 ? _hb_ucd_u16[1680u+((_hb_ucd_u8[13041u+((_hb_ucd_u8[12659u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)] : 0; + /* packtab: [2^8,2^5,2^4] */ + return u<195102u ? (uint16_t)(_hb_ucd_u16[1680u+((_hb_ucd_u8[13009u+((_hb_ucd_u8[12627u+((((u)>>4))>>5)])<<5)+((((u)>>4))&31)])<<4)+((u)&15)]) : 0; } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-unicode-emoji-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-unicode-emoji-table.hh index 711dd9b65716..7200952547a1 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-unicode-emoji-table.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-unicode-emoji-table.hh @@ -27,36 +27,36 @@ static const uint8_t _hb_emoji_u8[624]= { - 16, 17, 17, 17, 50, 20, 21, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,118,152, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 50, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 3, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 6, 0, 0, 7, - 0, 0, 0, 8, 0, 0, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, - 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 20, 0, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, - 23, 0, 24, 25, 0, 26, 27, 28, 29, 30, 31, 31, 32, 31, 33, 34, - 31, 31, 31, 35, 36, 37, 38, 39, 31, 40, 31, 41, 0, 0, 0, 42, - 43, 44, 45, 46, 47, 48, 31, 31, 0, 49, 31, 31, 0, 0, 0, 0, - 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 36, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 16, 0, 2, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, 0, 2, 0, 0,240, 3, 0, 6, 0, 0, - 0, 0, 0, 12, 0, 1, 0, 0, 0,128, 0, 0, 0,254, 15, 7, - 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 64, 0, - 1, 0, 0, 0, 0, 0, 0,120, 31, 64, 50, 33, 77,196, 0, 7, - 5,255, 15,128,105, 1, 0,200, 0, 0,252, 26,131, 12, 3, 96, - 48,193, 26, 0, 0, 6,191, 39, 36,191, 84, 32, 2, 1, 24, 0, - 144, 80,184, 0, 24, 0, 0, 0, 0, 0,224, 0, 2, 0, 1,128, - 0, 0, 0, 0, 0, 0, 48, 0,224, 0, 0, 24, 0, 0, 0, 0, - 0, 0, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 32, - 0, 0,128, 2, 0, 0, 0, 0, 16, 0, 0, 0, 0,240, 0, 0, - 0, 0,240,255, 0,128, 1, 0, 1,128, 1, 0, 0, 0,192,255, - 0, 0, 0, 0, 0, 0, 3,192, 0, 64,254, 7, 0,192,255,255, - 255,255,255,255, 63, 0, 0, 0,254,255, 0, 4, 0,128,252,247, - 0,254,255,255,192,255,255,255,255,255,255,255,255,255,255,255, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,118,152, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 4, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 7, 0, 0, 8, + 0, 0, 0, 9, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 0, + 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 20, 21, 0, 0, + 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, + 24, 0, 25, 26, 0, 27, 28, 29, 30, 31, 1, 1, 32, 1, 33, 34, + 1, 1, 1, 35, 36, 37, 38, 39, 1, 40, 1, 41, 0, 0, 0, 42, + 43, 44, 45, 46, 47, 48, 1, 1, 0, 49, 1, 1, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255, + 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 2, + 0, 0,240, 3, 0, 6, 0, 0, 0, 0, 0, 12, 0, 1, 0, 0, + 0,128, 0, 0, 0,254, 15, 7, 4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 12, 64, 0, 1, 0, 0, 0, 0, 0, 0,120, + 31, 64, 50, 33, 77,196, 0, 7, 5,255, 15,128,105, 1, 0,200, + 0, 0,252, 26,131, 12, 3, 96, 48,193, 26, 0, 0, 6,191, 39, + 36,191, 84, 32, 2, 1, 24, 0,144, 80,184, 0, 24, 0, 0, 0, + 0, 0,224, 0, 2, 0, 1,128, 0, 0, 0, 0, 0, 0, 48, 0, + 224, 0, 0, 24, 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 32, 0, 0,128, 2, 0, 0, 0, 0, + 16, 0, 0, 0, 0,240, 0, 0, 0, 0,240,255, 0,128, 1, 0, + 1,128, 1, 0, 0, 0,192,255, 0, 0, 0, 0, 0, 0, 3,192, + 0, 64,254, 7, 0,192,255,255,255,255,255,255, 63, 0, 0, 0, + 254,255, 0, 4, 0,128,252,247, 0,254,255,255,192,255,255,255, 255,255,255,255,243,255,255,255,255,255,207,206,255,255,255,255, 255,255,255,255,255,255,185, 7,255,255,255,255,255,255,255,191, 255,255,255,255,255,255,255, 63, 0,126,255,255,255,128,249, 7, @@ -78,7 +78,8 @@ static inline uint8_t _hb_emoji_b1 (const uint8_t* a, unsigned i) } static inline uint8_t _hb_emoji_is_Extended_Pictographic (unsigned u) { - return u<131070 ? _hb_emoji_b1(_hb_emoji_u8+224u,((_hb_emoji_u8[64u+((_hb_emoji_b4(_hb_emoji_u8,((((u)>>6))>>4)))<<4)+((((u)>>6))&15)])<<6)+((u)&63)) : 0; + /* packtab: [2^4,2^4,2^6] */ + return u<131070u ? (uint8_t)(_hb_emoji_b1(_hb_emoji_u8+224u,((_hb_emoji_u8[64u+((_hb_emoji_b4(_hb_emoji_u8,((((u)>>6))>>4)))<<4)+((((u)>>6))&15)])<<6)+((u)&63))) : 0; } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-unicode.cc b/src/java.desktop/share/native/libharfbuzz/hb-unicode.cc index fa0d66174ff0..df76bd99d902 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-unicode.cc +++ b/src/java.desktop/share/native/libharfbuzz/hb-unicode.cc @@ -376,8 +376,12 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, void *user_data, \ hb_destroy_func_t destroy) \ { \ + auto destroy_guard = hb_make_scope_guard ([&]() { \ + if (destroy) destroy (user_data); \ + }); \ + \ if (hb_object_is_immutable (ufuncs)) \ - goto fail; \ + return; \ \ if (!func) \ { \ @@ -396,11 +400,7 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, ufuncs->func.name = ufuncs->parent->func.name; \ ufuncs->user_data.name = user_data; \ ufuncs->destroy.name = destroy; \ - return; \ - \ -fail: \ - if (destroy) \ - destroy (user_data); \ + destroy_guard.release (); \ } HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS diff --git a/src/java.desktop/share/native/libharfbuzz/hb-vector.hh b/src/java.desktop/share/native/libharfbuzz/hb-vector.hh index b650ca9f0665..b0aa842bb232 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-vector.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb-vector.hh @@ -62,7 +62,7 @@ struct hb_vector_t hb_requires (hb_is_iterable (Iterable))> explicit hb_vector_t (const Iterable &o) : hb_vector_t () { - extend (o); + extend (o, true); } HB_ALWAYS_INLINE_VECTOR_ALLOCS hb_vector_t (const hb_vector_t &o) : hb_vector_t () @@ -117,12 +117,12 @@ struct hb_vector_t template HB_ALWAYS_INLINE_VECTOR_ALLOCS - void extend (const Iterable &o) + void extend (const Iterable &o, bool exact=false) { auto iter = hb_iter (o); if (iter.is_random_access_iterator || iter.has_fast_len) { - if (unlikely (!alloc (hb_len (iter), true))) + if (unlikely (!alloc (length + hb_len (iter), exact))) return; unsigned count = hb_len (iter); for (unsigned i = 0; i < count; i++) @@ -138,16 +138,16 @@ struct hb_vector_t } } HB_ALWAYS_INLINE_VECTOR_ALLOCS - void extend (array_t o) + void extend (array_t o, bool exact=false) { - alloc (length + o.length); + alloc (length + o.length, exact); if (unlikely (in_error ())) return; copy_array (o); } HB_ALWAYS_INLINE_VECTOR_ALLOCS - void extend (c_array_t o) + void extend (c_array_t o, bool exact=false) { - alloc (length + o.length); + alloc (length + o.length, exact); if (unlikely (in_error ())) return; copy_array (o); } @@ -182,10 +182,46 @@ struct hb_vector_t { if (unlikely (in_error ())) reset_error (); - resize (0); + clear (); return *this; } + HB_ALWAYS_INLINE_VECTOR_ALLOCS + hb_vector_t &reset_if_error () + { + if (unlikely (in_error ())) + reset (); + return *this; + } + + /* Transfer ownership of the backing storage to caller. + * Returns nullptr if storage is not owned by this vector. */ + Type * + steal (unsigned *len = nullptr, int *allocated_out = nullptr) + { + if (!is_owned ()) + return nullptr; + if (len) + *len = length; + if (allocated_out) + *allocated_out = allocated; + Type *p = arrayZ; + init (); + return p; + } + + /* Adopt a previously detached owned buffer. */ + void + recycle_buffer (Type *buffer, + unsigned len, + int allocated_len) + { + fini (); + arrayZ = buffer; + length = len; + allocated = allocated_len; + } + friend void swap (hb_vector_t& a, hb_vector_t& b) noexcept { hb_swap (a.allocated, b.allocated); @@ -236,7 +272,7 @@ struct hb_vector_t const Type& tail () const { return (*this)[length - 1]; } explicit operator bool () const { return length; } - unsigned get_size () const { return length * item_size; } + size_t get_size () const { return length * item_size; } /* Sink interface. */ template @@ -290,6 +326,12 @@ struct hb_vector_t } template HB_ALWAYS_INLINE_VECTOR_ALLOCS + bool push_or_fail (Args&&... args) + { + return push (std::forward (args)...) != std::addressof (Crap (Type)); + } + template + HB_ALWAYS_INLINE_VECTOR_ALLOCS Type *push_has_room (Args&&... args) { /* Emplace. */ @@ -543,7 +585,7 @@ struct hb_vector_t HB_ALWAYS_INLINE_VECTOR_ALLOCS void clear () { - resize (0); + shrink_vector (0); } template @@ -671,8 +713,11 @@ struct hb_vector_t /* Sorting API. */ - void qsort (int (*cmp)(const void*, const void*) = Type::cmp) - { as_array ().qsort (cmp); } + template + void qsort (Compar compar) + { as_array ().qsort (compar); } + void qsort () + { as_array ().qsort (); } /* Unsorted search API. */ template diff --git a/src/java.desktop/share/native/libharfbuzz/hb-version.h b/src/java.desktop/share/native/libharfbuzz/hb-version.h index c673d1e3612c..7ab4a82fd85a 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb-version.h +++ b/src/java.desktop/share/native/libharfbuzz/hb-version.h @@ -41,26 +41,26 @@ HB_BEGIN_DECLS * * The major component of the library version available at compile-time. */ -#define HB_VERSION_MAJOR 12 +#define HB_VERSION_MAJOR 14 /** * HB_VERSION_MINOR: * * The minor component of the library version available at compile-time. */ -#define HB_VERSION_MINOR 3 +#define HB_VERSION_MINOR 2 /** * HB_VERSION_MICRO: * * The micro component of the library version available at compile-time. */ -#define HB_VERSION_MICRO 2 +#define HB_VERSION_MICRO 0 /** * HB_VERSION_STRING: * * A string literal containing the library version available at compile-time. */ -#define HB_VERSION_STRING "12.3.2" +#define HB_VERSION_STRING "14.2.0" /** * HB_VERSION_ATLEAST: diff --git a/src/java.desktop/share/native/libharfbuzz/hb-zlib.hh b/src/java.desktop/share/native/libharfbuzz/hb-zlib.hh new file mode 100644 index 000000000000..3b8eb791a17a --- /dev/null +++ b/src/java.desktop/share/native/libharfbuzz/hb-zlib.hh @@ -0,0 +1,37 @@ +#ifndef HB_ZLIB_HH +#define HB_ZLIB_HH + +#include "hb-blob.hh" + +static inline bool +hb_blob_is_gzip (const char *data, + unsigned data_len) +{ + return data_len >= 3 && + (unsigned char) data[0] == 0x1Fu && + (unsigned char) data[1] == 0x8Bu && + (unsigned char) data[2] == 0x08u; +} + +static inline bool +hb_gzip_get_uncompressed_size (const char *data, + unsigned data_len, + uint32_t *size) +{ + if (data_len < 4) + return false; + + const unsigned char *trailer = (const unsigned char *) data + data_len - 4; + if (size) + *size = (uint32_t) trailer[0] | + ((uint32_t) trailer[1] << 8) | + ((uint32_t) trailer[2] << 16) | + ((uint32_t) trailer[3] << 24); + return true; +} + +HB_INTERNAL hb_blob_t * +hb_blob_decompress_gzip (hb_blob_t *blob, + unsigned max_output_len); + +#endif /* HB_ZLIB_HH */ diff --git a/src/java.desktop/share/native/libharfbuzz/hb.hh b/src/java.desktop/share/native/libharfbuzz/hb.hh index 7582abaa9333..25565c0caa1c 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb.hh @@ -138,6 +138,7 @@ /* Ignored intentionally. */ #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED +#pragma GCC diagnostic ignored "-Warray-bounds" // https://github.com/harfbuzz/harfbuzz/issues/5738 #pragma GCC diagnostic ignored "-Wclass-memaccess" #pragma GCC diagnostic ignored "-Wcast-function-type-strict" // https://github.com/harfbuzz/harfbuzz/pull/3859#issuecomment-1295409126 #pragma GCC diagnostic ignored "-Wdangling-reference" // https://github.com/harfbuzz/harfbuzz/issues/4043 @@ -526,7 +527,7 @@ static_assert ((sizeof (hb_var_int_t) == 4), ""); /* Pie time. */ // https://github.com/harfbuzz/harfbuzz/issues/4166 -#define HB_PI 3.14159265358979f +#define HB_PI 3.14159265358979323846f #define HB_2_PI (2.f * HB_PI) /* Compile-time custom allocator support. */ @@ -570,6 +571,13 @@ extern "C" void hb_free_impl(void *ptr); #include "hb-object.hh" // Requires: hb-atomic hb-mutex hb-vector +/* Library-internal alias for hb::unique_ptr defined in hb-cplusplus.hh. + * Unique-ownership RAII wrapper around an HB object; destroys on scope exit + * via the type's hb_*_destroy() function. Usage: hb_unique_ptr_t. + * Matches the hb_*_t naming used elsewhere in internal code. */ +template using hb_unique_ptr_t = hb::unique_ptr; + + /* Our src/test-*.cc use hb_assert(), such that it's not compiled out under NDEBUG. * https://github.com/harfbuzz/harfbuzz/issues/5418 */ #define hb_always_assert(x) \ diff --git a/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c b/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c index b4281458d79d..aec464596be8 100644 --- a/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c +++ b/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -120,6 +120,7 @@ typedef struct streamBufferStruct { size_t bufferLength; // Allocated, nut just used int suspendable; // Set to true to suspend input long remaining_skip; // Used only on input + jboolean isCopy; // GetByteArrayElements copied/pinned the Java array } streamBuffer, *streamBufferPtr; /* @@ -200,7 +201,8 @@ static void destroyStreamBuffer(JNIEnv *env, streamBufferPtr sb) { // Forward reference static void unpinStreamBuffer(JNIEnv *env, streamBufferPtr sb, - const JOCTET *next_byte); + const JOCTET *next_byte, + int streamReleaseMode); /* * Resets the state of a streamBuffer object that has been in use. * The global reference to the stream is released, but the reference @@ -212,15 +214,16 @@ static void resetStreamBuffer(JNIEnv *env, streamBufferPtr sb) { (*env)->DeleteWeakGlobalRef(env, sb->ioRef); sb->ioRef = NULL; } - unpinStreamBuffer(env, sb, NULL); + unpinStreamBuffer(env, sb, NULL, JNI_ABORT); sb->bufferOffset = NO_DATA; sb->suspendable = FALSE; sb->remaining_skip = 0; } /* - * Pins the data buffer associated with this stream. Returns OK on - * success, NOT_OK on failure, as GetPrimitiveArrayCritical may fail. + * Pins/copies the data buffer associated with this stream. Returns OK on + * success, NOT_OK on failure, as GetByteArrayElements + * may fail. */ static int pinStreamBuffer(JNIEnv *env, streamBufferPtr sb, @@ -228,9 +231,9 @@ static int pinStreamBuffer(JNIEnv *env, if (sb->hstreamBuffer != NULL) { assert(sb->buf == NULL); sb->buf = - (JOCTET *)(*env)->GetPrimitiveArrayCritical(env, - sb->hstreamBuffer, - NULL); + (JOCTET *)(*env)->GetByteArrayElements(env, + sb->hstreamBuffer, + &sb->isCopy); if (sb->buf == NULL) { return NOT_OK; } @@ -242,11 +245,12 @@ static int pinStreamBuffer(JNIEnv *env, } /* - * Unpins the data buffer associated with this stream. + * Unpins/releases the data buffer associated with this stream. */ static void unpinStreamBuffer(JNIEnv *env, streamBufferPtr sb, - const JOCTET *next_byte) { + const JOCTET *next_byte, + int streamReleaseMode) { if (sb->buf != NULL) { assert(sb->hstreamBuffer != NULL); if (next_byte == NULL) { @@ -254,11 +258,13 @@ static void unpinStreamBuffer(JNIEnv *env, } else { sb->bufferOffset = next_byte - sb->buf; } - (*env)->ReleasePrimitiveArrayCritical(env, - sb->hstreamBuffer, - sb->buf, - 0); - sb->buf = NULL; + (*env)->ReleaseByteArrayElements(env, + sb->hstreamBuffer, + (jbyte *)sb->buf, + streamReleaseMode); + if (streamReleaseMode != JNI_COMMIT) { + sb->buf = NULL; + } } } @@ -276,6 +282,7 @@ static void clearStreamBuffer(streamBufferPtr sb) { typedef struct pixelBufferStruct { jobject hpixelObject; // Usually a DataBuffer bank as a byte array unsigned int byteBufferLength; + jboolean isCopy; // GetByteArrayElements copied/pinned the Java array union pixptr { INT32 *ip; // Pinned buffer pointer, as 32-bit ints unsigned char *bp; // Pinned buffer pointer, as bytes @@ -309,7 +316,7 @@ static int setPixelBuffer(JNIEnv *env, pixelBufferPtr pb, jobject obj) { } // Forward reference -static void unpinPixelBuffer(JNIEnv *env, pixelBufferPtr pb); +static void unpinPixelBuffer(JNIEnv *env, pixelBufferPtr pb, int pixelReleaseMode); /* * Resets a pixel buffer to its initial state. Unpins any pixel buffer, @@ -318,7 +325,7 @@ static void unpinPixelBuffer(JNIEnv *env, pixelBufferPtr pb); */ static void resetPixelBuffer(JNIEnv *env, pixelBufferPtr pb) { if (pb->hpixelObject != NULL) { - unpinPixelBuffer(env, pb); + unpinPixelBuffer(env, pb, JNI_ABORT); (*env)->DeleteGlobalRef(env, pb->hpixelObject); pb->hpixelObject = NULL; pb->byteBufferLength = 0; @@ -326,13 +333,13 @@ static void resetPixelBuffer(JNIEnv *env, pixelBufferPtr pb) { } /* - * Pins the data buffer. Returns OK on success, NOT_OK on failure. + * Pins/copies the data buffer. Returns OK on success, NOT_OK on failure. */ static int pinPixelBuffer(JNIEnv *env, pixelBufferPtr pb) { if (pb->hpixelObject != NULL) { assert(pb->buf.ip == NULL); - pb->buf.bp = (unsigned char *)(*env)->GetPrimitiveArrayCritical - (env, pb->hpixelObject, NULL); + pb->buf.bp = (unsigned char *)(*env)->GetByteArrayElements + (env, pb->hpixelObject, &pb->isCopy); if (pb->buf.bp == NULL) { return NOT_OK; } @@ -341,17 +348,19 @@ static int pinPixelBuffer(JNIEnv *env, pixelBufferPtr pb) { } /* - * Unpins the data buffer. + * Unpins/releases the pixel buffer. */ -static void unpinPixelBuffer(JNIEnv *env, pixelBufferPtr pb) { +static void unpinPixelBuffer(JNIEnv *env, pixelBufferPtr pb, int pixelReleaseMode) { if (pb->buf.ip != NULL) { assert(pb->hpixelObject != NULL); - (*env)->ReleasePrimitiveArrayCritical(env, - pb->hpixelObject, - pb->buf.ip, - 0); - pb->buf.ip = NULL; + (*env)->ReleaseByteArrayElements(env, + pb->hpixelObject, + (jbyte *)pb->buf.ip, + pixelReleaseMode); + if (pixelReleaseMode != JNI_COMMIT) { + pb->buf.ip = NULL; + } } } @@ -468,34 +477,28 @@ static j_common_ptr destroyImageioData(JNIEnv *env, imageIODataPtr data) { /******************** Java array pinning and unpinning *****************/ -/* We use Get/ReleasePrimitiveArrayCritical functions to avoid - * the need to copy array elements for the above two objects. - * - * MAKE SURE TO: - * - * - carefully insert pairs of RELEASE_ARRAYS and GET_ARRAYS around - * callbacks to Java. - * - call RELEASE_ARRAYS before returning to Java. - * - * Otherwise things will go horribly wrong. There may be memory leaks, - * excessive pinning, or even VM crashes! - * - * Note that GetPrimitiveArrayCritical may fail! +/* + * We use Get/ReleaseByteArrayElements functions for access stream + * and pixel information from Java level arrays. + * If we receive reference to copy of Java array make sure you update + * Java array also when the latest information is needed at Java level. + * Also we use specific release modes for performance optimizations. */ /* - * Release (unpin) all the arrays in use during a read. + * Release (unpin) both stream and pixel arrays. */ -static void RELEASE_ARRAYS(JNIEnv *env, imageIODataPtr data, const JOCTET *next_byte) +static void RELEASE_ARRAYS(JNIEnv *env, imageIODataPtr data, const JOCTET *next_byte, + int streamReleaseMode, int pixelReleaseMode) { - unpinStreamBuffer(env, &data->streamBuf, next_byte); + unpinStreamBuffer(env, &data->streamBuf, next_byte, streamReleaseMode); - unpinPixelBuffer(env, &data->pixelBuf); + unpinPixelBuffer(env, &data->pixelBuf, pixelReleaseMode); } /* - * Get (pin) all the arrays in use during a read. + * Get (pin) both stream and pixel arrays. */ static int GET_ARRAYS(JNIEnv *env, imageIODataPtr data, const JOCTET **next_byte) { if (pinStreamBuffer(env, &data->streamBuf, next_byte) == NOT_OK) { @@ -503,7 +506,7 @@ static int GET_ARRAYS(JNIEnv *env, imageIODataPtr data, const JOCTET **next_byte } if (pinPixelBuffer(env, &data->pixelBuf) == NOT_OK) { - RELEASE_ARRAYS(env, data, *next_byte); + RELEASE_ARRAYS(env, data, *next_byte, JNI_ABORT, JNI_ABORT); return NOT_OK; } return OK; @@ -570,26 +573,16 @@ sun_jpeg_output_message (j_common_ptr cinfo) theObject = data->imageIOobj; if (cinfo->is_decompressor) { - struct jpeg_source_mgr *src = ((j_decompress_ptr)cinfo)->src; - RELEASE_ARRAYS(env, data, src->next_input_byte); (*env)->CallVoidMethod(env, theObject, JPEGImageReader_warningWithMessageID, string); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { - cinfo->err->error_exit(cinfo); - } } else { - struct jpeg_destination_mgr *dest = ((j_compress_ptr)cinfo)->dest; - RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); (*env)->CallVoidMethod(env, theObject, JPEGImageWriter_warningWithMessageID, string); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, - (const JOCTET **)(&dest->next_output_byte))) { - cinfo->err->error_exit(cinfo); - } + } + if ((*env)->ExceptionCheck(env)) { + cinfo->err->error_exit(cinfo); } } @@ -941,7 +934,7 @@ imageio_fill_input_buffer(j_decompress_ptr cinfo) #ifdef DEBUG_IIO_JPEG printf("Filling input buffer, remaining skip is %ld, ", sb->remaining_skip); - printf("Buffer length is %d\n", sb->bufferLength); + printf("Buffer length is %zu\n", sb->bufferLength); #endif /* @@ -956,8 +949,15 @@ imageio_fill_input_buffer(j_decompress_ptr cinfo) /* * Now fill a complete buffer, or as much of one as the stream * will give us if we are near the end. + * + * The native copy of java array is not valid anymore so we just + * release it and get new copy, if we don't have native copy we rely + * on JVM to maintain the pinned handle of java array. */ - RELEASE_ARRAYS(env, data, src->next_input_byte); + jboolean isCopy = sb->isCopy; + if (isCopy) { + unpinStreamBuffer(env, &data->streamBuf, src->next_input_byte, JNI_ABORT); + } GET_IO_REF(input); @@ -969,9 +969,12 @@ imageio_fill_input_buffer(j_decompress_ptr cinfo) if ((ret > 0) && ((unsigned int)ret > sb->bufferLength)) { ret = (int)sb->bufferLength; } - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { - cinfo->err->error_exit((j_common_ptr) cinfo); + + if ((*env)->ExceptionCheck(env) || + (isCopy && (pinStreamBuffer(env, + &data->streamBuf, + &(src->next_input_byte)) == NOT_OK))) { + cinfo->err->error_exit((j_common_ptr) cinfo); } #ifdef DEBUG_IIO_JPEG @@ -988,12 +991,10 @@ imageio_fill_input_buffer(j_decompress_ptr cinfo) #ifdef DEBUG_IIO_JPEG printf("YO! Early EOI! ret = %d\n", ret); #endif - RELEASE_ARRAYS(env, data, src->next_input_byte); (*env)->CallVoidMethod(env, reader, JPEGImageReader_warningOccurredID, READ_NO_EOI); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { + if ((*env)->ExceptionCheck(env)) { cinfo->err->error_exit((j_common_ptr) cinfo); } @@ -1008,97 +1009,6 @@ imageio_fill_input_buffer(j_decompress_ptr cinfo) return TRUE; } -/* - * With I/O suspension turned on, the JPEG library requires that all - * buffer filling be done at the top application level, using this - * function. Due to the way that backtracking works, this procedure - * saves all of the data that was left in the buffer when suspension - * occurred and read new data only at the end. - */ - -GLOBAL(void) -imageio_fill_suspended_buffer(j_decompress_ptr cinfo) -{ - struct jpeg_source_mgr *src = cinfo->src; - imageIODataPtr data = (imageIODataPtr) cinfo->client_data; - streamBufferPtr sb = &data->streamBuf; - JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2); - jint ret; - size_t offset, buflen; - jobject input = NULL; - - /* - * The original (jpegdecoder.c) had code here that called - * InputStream.available and just returned if the number of bytes - * available was less than any remaining skip. Presumably this was - * to avoid blocking, although the benefit was unclear, as no more - * decompression can take place until more data is available, so - * the code would block on input a little further along anyway. - * ImageInputStreams don't have an available method, so we'll just - * block in the skip if we have to. - */ - - if (sb->remaining_skip) { - src->skip_input_data(cinfo, 0); - } - - /* Save the data currently in the buffer */ - offset = src->bytes_in_buffer; - if (src->next_input_byte > sb->buf) { - memcpy(sb->buf, src->next_input_byte, offset); - } - - - RELEASE_ARRAYS(env, data, src->next_input_byte); - - GET_IO_REF(input); - - buflen = sb->bufferLength - offset; - if (buflen <= 0) { - if (!GET_ARRAYS(env, data, &(src->next_input_byte))) { - cinfo->err->error_exit((j_common_ptr) cinfo); - } - RELEASE_ARRAYS(env, data, src->next_input_byte); - return; - } - - ret = (*env)->CallIntMethod(env, input, - JPEGImageReader_readInputDataID, - sb->hstreamBuffer, - offset, buflen); - if ((ret > 0) && ((unsigned int)ret > buflen)) ret = (int)buflen; - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { - cinfo->err->error_exit((j_common_ptr) cinfo); - } - /* - * If we have reached the end of the stream, then the EOI marker - * is missing. We accept such streams but generate a warning. - * The image is likely to be corrupted, though everything through - * the end of the last complete MCU should be usable. - */ - if (ret <= 0) { - jobject reader = data->imageIOobj; - RELEASE_ARRAYS(env, data, src->next_input_byte); - (*env)->CallVoidMethod(env, reader, - JPEGImageReader_warningOccurredID, - READ_NO_EOI); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { - cinfo->err->error_exit((j_common_ptr) cinfo); - } - - sb->buf[offset] = (JOCTET) 0xFF; - sb->buf[offset + 1] = (JOCTET) JPEG_EOI; - ret = 2; - } - - src->next_input_byte = sb->buf; - src->bytes_in_buffer = ret + offset; - - return; -} - /* * Skip num_bytes worth of data. The buffer pointer and count are * advanced over num_bytes input bytes, using the input stream @@ -1160,16 +1070,13 @@ imageio_skip_input_data(j_decompress_ptr cinfo, long num_bytes) return; } - RELEASE_ARRAYS(env, data, src->next_input_byte); - GET_IO_REF(input); ret = (*env)->CallLongMethod(env, input, JPEGImageReader_skipInputBytesID, (jlong) num_bytes); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { + if ((*env)->ExceptionCheck(env)) { cinfo->err->error_exit((j_common_ptr) cinfo); } @@ -1181,15 +1088,12 @@ imageio_skip_input_data(j_decompress_ptr cinfo, long num_bytes) */ if (ret <= 0) { reader = data->imageIOobj; - RELEASE_ARRAYS(env, data, src->next_input_byte); (*env)->CallVoidMethod(env, reader, JPEGImageReader_warningOccurredID, READ_NO_EOI); - - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { - cinfo->err->error_exit((j_common_ptr) cinfo); + if ((*env)->ExceptionCheck(env)) { + cinfo->err->error_exit((j_common_ptr) cinfo); } sb->buf[0] = (JOCTET) 0xFF; sb->buf[1] = (JOCTET) JPEG_EOI; @@ -1215,7 +1119,7 @@ imageio_term_source(j_decompress_ptr cinfo) JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2); jobject reader = data->imageIOobj; if (src->bytes_in_buffer > 0) { - RELEASE_ARRAYS(env, data, src->next_input_byte); + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, 0); (*env)->CallVoidMethod(env, reader, JPEGImageReader_pushBackID, @@ -1659,7 +1563,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader if (setjmp(jerr->setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error while reading the header. */ - RELEASE_ARRAYS(env, data, src->next_input_byte); + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, JNI_ABORT); if (!(*env)->ExceptionOccurred(env)) { char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message) ((struct jpeg_common_struct *) cinfo, @@ -1678,7 +1582,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader (*env)->ExceptionClear(env); JNU_ThrowByName(env, "javax/imageio/IIOException", - "Array pin failed"); + "Get array elements failed"); return retval; } @@ -1701,7 +1605,11 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader printf("just read tables-only image; q table 0 at %p\n", cinfo->quant_tbl_ptrs[0]); #endif - RELEASE_ARRAYS(env, data, src->next_input_byte); + /* + * readImageHeader can be called independently, so + * we release the arrays when we return back. + */ + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, 0); } else { /* * Now adjust the jpeg_color_space variable, which was set in @@ -1802,7 +1710,6 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader /* Leave the output space as CMYK */ } } - RELEASE_ARRAYS(env, data, src->next_input_byte); /* read icc profile data */ profileData = read_icc_profile(env, cinfo); @@ -1819,14 +1726,17 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader cinfo->out_color_space, cinfo->num_components, profileData); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { + if ((*env)->ExceptionCheck(env)) { cinfo->err->error_exit((j_common_ptr) cinfo); } if (reset) { jpeg_abort_decompress(cinfo); } - RELEASE_ARRAYS(env, data, src->next_input_byte); + /* + * readImageHeader can be called independently, so + * we release the arrays when we return back. + */ + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, 0); } return retval; @@ -1987,7 +1897,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage if (setjmp(jerr->setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error while reading. */ - RELEASE_ARRAYS(env, data, src->next_input_byte); + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, JNI_ABORT); if (!(*env)->ExceptionOccurred(env)) { char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message) ((struct jpeg_common_struct *) cinfo, @@ -2005,7 +1915,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage (*env)->ExceptionClear(env); JNU_ThrowByName(env, "javax/imageio/IIOException", - "Array pin failed"); + "Get array elements failed"); return data->abortFlag; } @@ -2037,7 +1947,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage jpeg_start_decompress(cinfo); if (numBands != cinfo->output_components) { - RELEASE_ARRAYS(env, data, src->next_input_byte); + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, JNI_ABORT); JNU_ThrowByName(env, "javax/imageio/IIOException", "Invalid argument to native readImage"); return data->abortFlag; @@ -2046,7 +1956,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage if (cinfo->output_components <= 0 || cinfo->image_width > (0xffffffffu / (unsigned int)cinfo->output_components)) { - RELEASE_ARRAYS(env, data, src->next_input_byte); + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, JNI_ABORT); JNU_ThrowByName(env, "javax/imageio/IIOException", "Invalid number of output components"); return data->abortFlag; @@ -2055,7 +1965,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage // Allocate a 1-scanline buffer scanLinePtr = (JSAMPROW)malloc(cinfo->image_width*cinfo->output_components); if (scanLinePtr == NULL) { - RELEASE_ARRAYS(env, data, src->next_input_byte); + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, JNI_ABORT); JNU_ThrowByName( env, "java/lang/OutOfMemoryError", "Reading JPEG Stream"); @@ -2070,22 +1980,18 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage // the first interesting pass. jpeg_start_output(cinfo, cinfo->input_scan_number); if (wantUpdates) { - RELEASE_ARRAYS(env, data, src->next_input_byte); (*env)->CallVoidMethod(env, this, JPEGImageReader_passStartedID, cinfo->input_scan_number-1); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { + if ((*env)->ExceptionCheck(env)) { cinfo->err->error_exit((j_common_ptr) cinfo); } } } else if (wantUpdates) { - RELEASE_ARRAYS(env, data, src->next_input_byte); (*env)->CallVoidMethod(env, this, JPEGImageReader_passStartedID, 0); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { + if ((*env)->ExceptionCheck(env)) { cinfo->err->error_exit((j_common_ptr) cinfo); } } @@ -2136,16 +2042,20 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage } } - // And call it back to Java - RELEASE_ARRAYS(env, data, src->next_input_byte); + /* + * Optimisation to just commit the native pixel buffer + * content back to java array without releasing the + * native buffer. + */ + if (pb->isCopy) { + unpinPixelBuffer(env, pb, JNI_COMMIT); + } (*env)->CallVoidMethod(env, this, JPEGImageReader_acceptPixelsID, targetLine++, progressive); - - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { + if ((*env)->ExceptionCheck(env)) { cinfo->err->error_exit((j_common_ptr) cinfo); } @@ -2175,11 +2085,9 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage done = TRUE; } if (wantUpdates) { - RELEASE_ARRAYS(env, data, src->next_input_byte); (*env)->CallVoidMethod(env, this, JPEGImageReader_passCompleteID); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, &(src->next_input_byte))) { + if ((*env)->ExceptionCheck(env)) { cinfo->err->error_exit((j_common_ptr) cinfo); } } @@ -2204,13 +2112,16 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage this, JPEGImageReader_skipPastImageID, imageIndex); + if ((*env)->ExceptionCheck(env)) { + cinfo->err->error_exit((j_common_ptr) cinfo); + } } else { jpeg_finish_decompress(cinfo); } free(scanLinePtr); - RELEASE_ARRAYS(env, data, src->next_input_byte); + RELEASE_ARRAYS(env, data, src->next_input_byte, JNI_ABORT, 0); return data->abortFlag; } @@ -2405,8 +2316,16 @@ imageio_empty_output_buffer (j_compress_ptr cinfo) JNIEnv *env = (JNIEnv *)JNU_GetEnv(the_jvm, JNI_VERSION_1_2); jobject output = NULL; - RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); - + /* + * Optimization to not delete the native copy of stream buffer, + * but just commit the content back to the Java array. + * In case where we don't have a copy, we rely on JVM to maintain + * the native reference of Java array. + */ + jboolean isCopy = sb->isCopy; + if (isCopy) { + unpinStreamBuffer(env, sb, dest->next_output_byte, JNI_COMMIT); + } GET_IO_REF(output); (*env)->CallVoidMethod(env, @@ -2415,10 +2334,8 @@ imageio_empty_output_buffer (j_compress_ptr cinfo) sb->hstreamBuffer, 0, sb->bufferLength); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, - (const JOCTET **)(&dest->next_output_byte))) { - cinfo->err->error_exit((j_common_ptr) cinfo); + if ((*env)->ExceptionCheck(env)) { + cinfo->err->error_exit((j_common_ptr) cinfo); } dest->next_output_byte = sb->buf; @@ -2447,7 +2364,16 @@ imageio_term_destination (j_compress_ptr cinfo) if (datacount != 0) { jobject output = NULL; - RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); + /* + * Optimization to not delete the native copy of stream buffer, + * but just commit the content back to the Java array. + * In case where we don't have a copy, we rely on JVM to maintain + * the native reference of Java array. + */ + jboolean isCopy = sb->isCopy; + if (isCopy) { + unpinStreamBuffer(env, sb, dest->next_output_byte, JNI_COMMIT); + } GET_IO_REF(output); @@ -2457,17 +2383,13 @@ imageio_term_destination (j_compress_ptr cinfo) sb->hstreamBuffer, 0, datacount); - - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, - (const JOCTET **)(&dest->next_output_byte))) { + if ((*env)->ExceptionCheck(env)) { cinfo->err->error_exit((j_common_ptr) cinfo); } } dest->next_output_byte = NULL; dest->free_in_buffer = 0; - } /* @@ -2668,7 +2590,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables if (setjmp(jerr->setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error while writing. */ - RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); + RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte), JNI_ABORT, JNI_ABORT); if (!(*env)->ExceptionOccurred(env)) { char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message) ((j_common_ptr) cinfo, @@ -2683,7 +2605,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables (*env)->ExceptionClear(env); JNU_ThrowByName(env, "javax/imageio/IIOException", - "Array pin failed"); + "Get array elements failed"); return; } @@ -2703,7 +2625,15 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables } jpeg_write_tables(cinfo); // Flushes the buffer for you - RELEASE_ARRAYS(env, data, NULL); + /* + * writeTables can be called independently, so + * we release the arrays when we return back. + * Also the table content in output_buffer is + * already flushed, so no need to commit the + * native copy of stream content back to the + * Java array. + */ + RELEASE_ARRAYS(env, data, NULL, JNI_ABORT, 0); } static void freeArray(UINT8** arr, jint size) { @@ -2766,7 +2696,6 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage UINT8** scale = NULL; boolean success = TRUE; - /* verify the inputs */ if (data == NULL) { @@ -2891,7 +2820,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage if (setjmp(jerr->setjmp_buffer)) { /* If we get here, the JPEG code has signaled an error while writing. */ - RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); + RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte), JNI_ABORT, JNI_ABORT); if (!(*env)->ExceptionOccurred(env)) { char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message) ((j_common_ptr) cinfo, @@ -2973,7 +2902,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage free(scanLinePtr); JNU_ThrowByName(env, "javax/imageio/IIOException", - "Array pin failed"); + "Get array elements failed"); return data->abortFlag; } @@ -3006,7 +2935,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage scanptr = (int *) cinfo->script_space; scanData = (*env)->GetIntArrayElements(env, scanInfo, NULL); if (scanData == NULL) { - RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); + RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte), JNI_ABORT, JNI_ABORT); freeArray(scale, numBands); free(scanLinePtr); return data->abortFlag; @@ -3034,16 +2963,13 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage if (haveMetadata) { // Flush the buffer imageio_flush_destination(cinfo); - // Call Java to write the metadata - RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); + // Call Java to write the metadata. (*env)->CallVoidMethod(env, this, JPEGImageWriter_writeMetadataID); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, - (const JOCTET **)(&dest->next_output_byte))) { - cinfo->err->error_exit((j_common_ptr) cinfo); - } + if ((*env)->ExceptionCheck(env)) { + cinfo->err->error_exit((j_common_ptr) cinfo); + } } targetLine = 0; @@ -3053,20 +2979,29 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage // for each line in destHeight while ((data->abortFlag == JNI_FALSE) && (cinfo->next_scanline < cinfo->image_height)) { - // get the line from Java - RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte)); + /* + * Get a line of pixel data from Java. + * In case where we have native copy of Java pixel array, + * we need to just use JNI_ABORT to exclude any copy operation + * and then get new copy for next scanline. + * + * If we have direct reference to Java array, we rely on + * JVM to maintain the reference appropriately. + */ + jboolean isCopy = pb->isCopy; + if (isCopy) { + unpinPixelBuffer(env, pb, JNI_ABORT); + } (*env)->CallVoidMethod(env, this, JPEGImageWriter_grabPixelsID, targetLine); - if ((*env)->ExceptionOccurred(env) - || !GET_ARRAYS(env, data, - (const JOCTET **)(&dest->next_output_byte))) { - cinfo->err->error_exit((j_common_ptr) cinfo); - } + if ((*env)->ExceptionCheck(env) || + (isCopy && (pinPixelBuffer(env, pb) == NOT_OK))) { + cinfo->err->error_exit((j_common_ptr) cinfo); + } // subsample it into our buffer - in = data->pixelBuf.buf.bp; out = scanLinePtr; pixelLimit = in + ((pixelBufferSize > data->pixelBuf.byteBufferLength) ? @@ -3108,7 +3043,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage freeArray(scale, numBands); free(scanLinePtr); - RELEASE_ARRAYS(env, data, NULL); + RELEASE_ARRAYS(env, data, NULL, 0, JNI_ABORT); return data->abortFlag; } diff --git a/src/java.desktop/share/native/liblcms/cmsalpha.c b/src/java.desktop/share/native/liblcms/cmsalpha.c index 2e50b65be24c..bcedbde938e8 100644 --- a/src/java.desktop/share/native/liblcms/cmsalpha.c +++ b/src/java.desktop/share/native/liblcms/cmsalpha.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -406,7 +406,7 @@ int FormatterPos(cmsUInt32Number frm) static cmsFormatterAlphaFn _cmsGetFormatterAlpha(cmsContext id, cmsUInt32Number in, cmsUInt32Number out) { -static cmsFormatterAlphaFn FormattersAlpha[6][6] = { +static const cmsFormatterAlphaFn FormattersAlpha[6][6] = { /* from 8 */ { copy8, from8to16, from8to16SE, from8toHLF, from8toFLT, from8toDBL }, /* from 16*/ { from16to8, copy16, from16to16, from16toHLF, from16toFLT, from16toDBL }, diff --git a/src/java.desktop/share/native/liblcms/cmscam02.c b/src/java.desktop/share/native/liblcms/cmscam02.c index 45ef4eef970c..168ef597032a 100644 --- a/src/java.desktop/share/native/liblcms/cmscam02.c +++ b/src/java.desktop/share/native/liblcms/cmscam02.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -285,27 +285,32 @@ CAM02COLOR InverseCorrelates(CAM02COLOR clr, cmsCIECAM02* pMod) (clr.J / 100.0), (1.0 / (pMod->c * pMod->z))); - p1 = e / t; p2 = (clr.A / pMod->Nbb) + 0.305; - p3 = 21.0 / 20.0; - hr = clr.h * d2r; - - if (fabs(sin(hr)) >= fabs(cos(hr))) { - p4 = p1 / sin(hr); - clr.b = (p2 * (2.0 + p3) * (460.0 / 1403.0)) / - (p4 + (2.0 + p3) * (220.0 / 1403.0) * - (cos(hr) / sin(hr)) - (27.0 / 1403.0) + - p3 * (6300.0 / 1403.0)); - clr.a = clr.b * (cos(hr) / sin(hr)); + if ( t <= 0.0 ) { // special case from spec notes, avoid divide by zero + clr.a = clr.b = 0.0; } else { - p5 = p1 / cos(hr); - clr.a = (p2 * (2.0 + p3) * (460.0 / 1403.0)) / - (p5 + (2.0 + p3) * (220.0 / 1403.0) - - ((27.0 / 1403.0) - p3 * (6300.0 / 1403.0)) * - (sin(hr) / cos(hr))); - clr.b = clr.a * (sin(hr) / cos(hr)); + hr = clr.h * d2r; + p1 = e / t; + p3 = 21.0 / 20.0; + + if (fabs(sin(hr)) >= fabs(cos(hr))) { + p4 = p1 / sin(hr); + clr.b = (p2 * (2.0 + p3) * (460.0 / 1403.0)) / + (p4 + (2.0 + p3) * (220.0 / 1403.0) * + (cos(hr) / sin(hr)) - (27.0 / 1403.0) + + p3 * (6300.0 / 1403.0)); + clr.a = clr.b * (cos(hr) / sin(hr)); + } + else { + p5 = p1 / cos(hr); + clr.a = (p2 * (2.0 + p3) * (460.0 / 1403.0)) / + (p5 + (2.0 + p3) * (220.0 / 1403.0) - + ((27.0 / 1403.0) - p3 * (6300.0 / 1403.0)) * + (sin(hr) / cos(hr))); + clr.b = clr.a * (sin(hr) / cos(hr)); + } } clr.RGBpa[0] = ((460.0 / 1403.0) * p2) + diff --git a/src/java.desktop/share/native/liblcms/cmscgats.c b/src/java.desktop/share/native/liblcms/cmscgats.c index 3e62d064c3f6..d1585443816d 100644 --- a/src/java.desktop/share/native/liblcms/cmscgats.c +++ b/src/java.desktop/share/native/liblcms/cmscgats.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -295,7 +295,7 @@ typedef struct { WRITEMODE as; // How is supposed to be written } PROPERTY; -static PROPERTY PredefinedProperties[] = { +static const PROPERTY PredefinedProperties[] = { {"NUMBER_OF_FIELDS", WRITE_UNCOOKED}, // Required - NUMBER OF FIELDS {"NUMBER_OF_SETS", WRITE_UNCOOKED}, // Required - NUMBER OF SETS @@ -458,7 +458,7 @@ cmsBool StringAppend(string* s, char c) new_ptr = (char*) AllocChunk(s->it8, s->max); if (new_ptr == NULL) return FALSE; - if (new_ptr != NULL && s->begin != NULL) + if (s->begin != NULL) memcpy(new_ptr, s->begin, s->len); s->begin = new_ptr; @@ -899,6 +899,11 @@ void InSymbol(cmsIT8* it8) sign = -1; NextCh(it8); } + else + if (it8->ch == '+') { + sign = +1; + NextCh(it8); + } it8->inum = 0; it8->sy = SINUM; @@ -1269,19 +1274,26 @@ void* AllocChunk(cmsIT8* it8, cmsUInt32Number size) it8 ->Allocator.Used = 0; new_block = (cmsUInt8Number*)AllocBigBlock(it8, it8->Allocator.BlockSize); - if (new_block == NULL) - return NULL; + if (new_block == NULL) goto Error; it8->Allocator.Block = new_block; } if (it8->Allocator.Block == NULL) - return NULL; + goto Error; ptr = it8 ->Allocator.Block + it8 ->Allocator.Used; it8 ->Allocator.Used += size; return (void*) ptr; + +Error: + + SynError(it8, "Allocation error"); + it8->Allocator.BlockSize = 0; + it8->Allocator.Used = 0; + it8->Allocator.Block = NULL; + return NULL; } @@ -1701,8 +1713,8 @@ cmsBool SetDataFormat(cmsIT8* it8, int n, const char *label) return FALSE; } - if (n >= t -> nSamples) { - SynError(it8, "More than NUMBER_OF_FIELDS fields."); + if (n < 0 || n >= t -> nSamples) { + SynError(it8, "Invalid or more than NUMBER_OF_FIELDS fields."); return FALSE; } @@ -1715,9 +1727,11 @@ cmsBool SetDataFormat(cmsIT8* it8, int n, const char *label) } -cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE h, int n, const char *Sample) +cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE h, int n, const char *Sample) { cmsIT8* it8 = (cmsIT8*)h; + + _cmsAssert(n >= 0); return SetDataFormat(it8, n, Sample); } @@ -3139,6 +3153,8 @@ cmsBool ParseCube(cmsIT8* cube, cmsStage** Shaper, cmsStage** CLUT, char title[] InSymbol(cube); if (!Check(cube, SINUM, "Shaper size expected")) return FALSE; shaper_size = cube->inum; + if (shaper_size < 2 || shaper_size > 65536) + return SynError(cube, "LUT_1D_SIZE '%d' is out of bounds", shaper_size); InSymbol(cube); break; @@ -3204,9 +3220,18 @@ cmsBool ParseCube(cmsIT8* cube, cmsStage** Shaper, cmsStage** CLUT, char title[] if (lut_size > 0) { - int nodes = lut_size * lut_size * lut_size; + int nodes; + + /** + * Professional LUT generation tools (e.g., Nobe LutBake) list 65×65×65 as their highest supported size. + */ + if (lut_size < 2 || lut_size > 65) + return SynError(cube, "LUT size '%d' is not allowed", lut_size); - cmsFloat32Number* lut_table = _cmsMalloc(cube->ContextID, nodes * 3 * sizeof(cmsFloat32Number)); + nodes = lut_size * lut_size * lut_size; + + + cmsFloat32Number* lut_table = (cmsFloat32Number*) _cmsMalloc(cube->ContextID, nodes * 3 * sizeof(cmsFloat32Number)); if (lut_table == NULL) return FALSE; for (i = 0; i < nodes; i++) { @@ -3275,13 +3300,17 @@ cmsHPROFILE CMSEXPORT cmsCreateDeviceLinkFromCubeFileTHR(cmsContext ContextID, c // Populates the pipeline if (Shaper != NULL) { - if (!cmsPipelineInsertStage(Pipeline, cmsAT_BEGIN, Shaper)) + if (!cmsPipelineInsertStage(Pipeline, cmsAT_BEGIN, Shaper)) { + cmsStageFree(Shaper); goto Done; + } } if (CLUT != NULL) { - if (!cmsPipelineInsertStage(Pipeline, cmsAT_END, CLUT)) + if (!cmsPipelineInsertStage(Pipeline, cmsAT_END, CLUT)) { + cmsStageFree(CLUT); goto Done; + } } // Propagate the description. We put no copyright because we know diff --git a/src/java.desktop/share/native/liblcms/cmscnvrt.c b/src/java.desktop/share/native/liblcms/cmscnvrt.c index 9f8619cb9dac..c66dbcbebad8 100644 --- a/src/java.desktop/share/native/liblcms/cmscnvrt.c +++ b/src/java.desktop/share/native/liblcms/cmscnvrt.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmserr.c b/src/java.desktop/share/native/liblcms/cmserr.c index d421c550d32d..220602d4a361 100644 --- a/src/java.desktop/share/native/liblcms/cmserr.c +++ b/src/java.desktop/share/native/liblcms/cmserr.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -77,25 +77,64 @@ int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2) return (toupper(*us1) - toupper(*--us2)); } +#ifdef CMS_LARGE_FILE_SUPPORT + +long long int CMSEXPORT cmsfilelength(FILE* f) +{ + long long int p, n; + +#ifdef CMS_IS_WINDOWS_ + p = _ftelli64(f); + if (p == -1LL) + return -1LL; + + if (_fseeki64(f, 0, SEEK_END) != 0) + return -1LL; + + n = _ftelli64(f); + + if (_fseeki64(f, p, SEEK_SET) != 0) + return -1LL; +#else + p = (long long int) ftello(f); + if (p < 0) + return -1LL; + + if (fseeko(f, 0, SEEK_END) != 0) + return -1LL; + + n = (long long int) ftello(f); + + if (fseeko(f, (off_t) p, SEEK_SET) != 0) + return -1LL; +#endif + + return n; +} + +#else + // long int because C99 specifies ftell in such way (7.19.9.2) long int CMSEXPORT cmsfilelength(FILE* f) { - long int p , n; + long int p, n; - p = ftell(f); // register current file position + p = ftell(f); if (p == -1L) return -1L; - if (fseek(f, 0, SEEK_END) != 0) { + if (fseek(f, 0, SEEK_END) != 0) return -1L; - } n = ftell(f); - fseek(f, p, SEEK_SET); // file position restored + + if (fseek(f, p, SEEK_SET) != 0) + return -1L; return n; } +#endif // Memory handling ------------------------------------------------------------------ // @@ -104,7 +143,11 @@ long int CMSEXPORT cmsfilelength(FILE* f) // amount of memory that can be reclaimed. This is mostly as a safety feature to prevent // bogus or evil code to allocate huge blocks that otherwise lcms would never need. -#define MAX_MEMORY_FOR_ALLOC ((cmsUInt32Number)(1024U*1024U*512U)) +#ifdef CMS_LARGE_FILE_SUPPORT +# define MAX_MEMORY_FOR_ALLOC ((cmsUInt32Number)(1024U*1024U*2048U)) +#else +# define MAX_MEMORY_FOR_ALLOC ((cmsUInt32Number)(1024U*1024U*512U)) +#endif // User may override this behaviour by using a memory plug-in, which basically replaces // the default memory management functions. In this case, no check is performed and it diff --git a/src/java.desktop/share/native/liblcms/cmsgamma.c b/src/java.desktop/share/native/liblcms/cmsgamma.c index 773858b0c1f0..bace6ab02e2a 100644 --- a/src/java.desktop/share/native/liblcms/cmsgamma.c +++ b/src/java.desktop/share/native/liblcms/cmsgamma.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -1187,6 +1187,7 @@ cmsBool smooth2(cmsContext ContextID, cmsFloat32Number w[], cmsFloat32Number y[] cmsFloat32Number *c, *d, *e; cmsBool st; + if (m < 4 || lambda < MATRIX_DET_TOLERANCE) return FALSE; c = (cmsFloat32Number*) _cmsCalloc(ContextID, MAX_NODES_IN_CURVE, sizeof(cmsFloat32Number)); d = (cmsFloat32Number*) _cmsCalloc(ContextID, MAX_NODES_IN_CURVE, sizeof(cmsFloat32Number)); diff --git a/src/java.desktop/share/native/liblcms/cmsgmt.c b/src/java.desktop/share/native/liblcms/cmsgmt.c index 03ac70202a50..1b023dcc299f 100644 --- a/src/java.desktop/share/native/liblcms/cmsgmt.c +++ b/src/java.desktop/share/native/liblcms/cmsgmt.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmshalf.c b/src/java.desktop/share/native/liblcms/cmshalf.c index 7e5f7a3c7e03..e1fb1d554883 100644 --- a/src/java.desktop/share/native/liblcms/cmshalf.c +++ b/src/java.desktop/share/native/liblcms/cmshalf.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmsintrp.c b/src/java.desktop/share/native/liblcms/cmsintrp.c index 43c47429c3cd..23e59a229a9f 100644 --- a/src/java.desktop/share/native/liblcms/cmsintrp.c +++ b/src/java.desktop/share/native/liblcms/cmsintrp.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -984,9 +984,9 @@ void Eval4Inputs(CMSREGISTER const cmsUInt16Number Input[], c1 = c2 = c3 = 0; } - Rest = c1 * rx + c2 * ry + c3 * rz; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; - Tmp1[OutChan] = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); + Tmp1[OutChan] = (cmsUInt16Number)c0 + ((Rest + (Rest >> 16)) >> 16); } @@ -1048,9 +1048,9 @@ void Eval4Inputs(CMSREGISTER const cmsUInt16Number Input[], c1 = c2 = c3 = 0; } - Rest = c1 * rx + c2 * ry + c3 * rz; + Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; - Tmp2[OutChan] = (cmsUInt16Number) (c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); + Tmp2[OutChan] = (cmsUInt16Number) c0 + ((Rest + (Rest >> 16)) >> 16); } diff --git a/src/java.desktop/share/native/liblcms/cmsio0.c b/src/java.desktop/share/native/liblcms/cmsio0.c index 5258b7939d2b..6e2a856b4b81 100644 --- a/src/java.desktop/share/native/liblcms/cmsio0.c +++ b/src/java.desktop/share/native/liblcms/cmsio0.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -106,6 +106,9 @@ cmsBool NULLWrite(cmsIOHANDLER* iohandler, cmsUInt32Number size, const void *Pt { FILENULL* ResData = (FILENULL*) iohandler ->stream; + if (size > (cmsUInt32Number)(0xFFFFFFFFU - ResData->Pointer)) + return FALSE; + ResData ->Pointer += size; if (ResData ->Pointer > iohandler->UsedSpace) iohandler->UsedSpace = ResData ->Pointer; @@ -159,7 +162,6 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromNULL(cmsContext ContextID) } - // Memory-based stream -------------------------------------------------------------- // Those functions implements an iohandler which takes a block of memory as storage medium. @@ -179,12 +181,20 @@ cmsUInt32Number MemoryRead(struct _cms_io_handler* iohandler, void *Buffer, cmsU cmsUInt8Number* Ptr; cmsUInt32Number len = size * count; - if (ResData -> Pointer + len > ResData -> Size){ - - len = (ResData -> Size - ResData -> Pointer); - cmsSignalError(iohandler ->ContextID, cmsERROR_READ, "Read from memory error. Got %d bytes, block should be of %d bytes", len, count * size); + if (size == 0 || count == 0) return 0; - } + + if ((len / count) != size) + goto ReadError; + + if (Buffer == NULL) + goto ReadError; + + if (len > ResData->Size) + goto ReadError; + + if (ResData -> Pointer > ResData -> Size - len) + goto ReadError; Ptr = ResData -> Block; Ptr += ResData -> Pointer; @@ -192,18 +202,21 @@ cmsUInt32Number MemoryRead(struct _cms_io_handler* iohandler, void *Buffer, cmsU ResData -> Pointer += len; return count; + +ReadError: + cmsSignalError(iohandler->ContextID, cmsERROR_READ, "Read from memory error"); + return 0; + } // SEEK_CUR is assumed static -cmsBool MemorySeek(struct _cms_io_handler* iohandler, cmsUInt32Number offset) +cmsBool MemorySeek(struct _cms_io_handler* iohandler, cmsUInt32Number offset) { FILEMEM* ResData = (FILEMEM*) iohandler ->stream; - if (offset > ResData ->Size) { - cmsSignalError(iohandler ->ContextID, cmsERROR_SEEK, "Too few data; probably corrupted profile"); + if (offset > ResData ->Size) return FALSE; - } ResData ->Pointer = offset; return TRUE; @@ -226,15 +239,17 @@ cmsBool MemoryWrite(struct _cms_io_handler* iohandler, cmsUInt32Number size, con { FILEMEM* ResData = (FILEMEM*) iohandler ->stream; - if (ResData == NULL) return FALSE; // Housekeeping - - // Check for available space. Clip. - if (ResData->Pointer + size > ResData->Size) { - size = ResData ->Size - ResData->Pointer; - } + if (ResData == NULL || Ptr == NULL) goto WriteError; if (size == 0) return TRUE; // Write zero bytes is ok, but does nothing + // Check for available space. Truncate the output in case the space + // is not enough instead of erroring out. See + // https://github.com/hughsie/colord/issues/147. + + if (size > ResData->Size - ResData->Pointer) + size = ResData->Size - ResData->Pointer; + memmove(ResData ->Block + ResData ->Pointer, Ptr, size); ResData ->Pointer += size; @@ -242,6 +257,10 @@ cmsBool MemoryWrite(struct _cms_io_handler* iohandler, cmsUInt32Number size, con iohandler->UsedSpace = ResData ->Pointer; return TRUE; + +WriteError: + cmsSignalError(iohandler->ContextID, cmsERROR_WRITE, "Write to memory error"); + return FALSE; } @@ -362,8 +381,15 @@ cmsUInt32Number FileRead(cmsIOHANDLER* iohandler, void *Buffer, cmsUInt32Number static cmsBool FileSeek(cmsIOHANDLER* iohandler, cmsUInt32Number offset) { +#ifdef CMS_LARGE_FILE_SUPPORT +# ifdef CMS_IS_WINDOWS_ + if (_fseeki64((FILE*) iohandler->stream, (long long int) offset, SEEK_SET) != 0) { +# else + if (fseeko((FILE*) iohandler->stream, (off_t) offset, SEEK_SET) != 0) { +# endif +#else if (fseek((FILE*) iohandler ->stream, (long) offset, SEEK_SET) != 0) { - +#endif cmsSignalError(iohandler ->ContextID, cmsERROR_FILE, "Seek error; probably corrupted file"); return FALSE; } @@ -375,13 +401,24 @@ cmsBool FileSeek(cmsIOHANDLER* iohandler, cmsUInt32Number offset) static cmsUInt32Number FileTell(cmsIOHANDLER* iohandler) { +#ifdef CMS_LARGE_FILE_SUPPORT +# ifdef CMS_IS_WINDOWS_ + long long int t = _ftelli64((FILE*) iohandler->stream); +# else + long long int t = (long long int) ftello((FILE*) iohandler->stream); +# endif + if (t < 0) { + cmsSignalError(iohandler->ContextID, cmsERROR_FILE, "Tell error; probably corrupted file"); + return 0; + } +#else long t = ftell((FILE*)iohandler ->stream); if (t == -1L) { cmsSignalError(iohandler->ContextID, cmsERROR_FILE, "Tell error; probably corrupted file"); return 0; } - - return (cmsUInt32Number)t; +#endif + return (cmsUInt32Number) t; } // Writes data to stream, also keeps used space for further reference. Returns TRUE on success, FALSE on error @@ -408,7 +445,11 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const cha { cmsIOHANDLER* iohandler = NULL; FILE* fm = NULL; - cmsInt32Number fileLen; +#ifdef CMS_LARGE_FILE_SUPPORT + long long int fileLen; +#else + long int fileLen; +#endif char mode[4] = { 0,0,0,0 }; _cmsAssert(FileName != NULL); @@ -459,7 +500,7 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const cha cmsSignalError(ContextID, cmsERROR_FILE, "File '%s' not found", FileName); return NULL; } - fileLen = (cmsInt32Number)cmsfilelength(fm); + fileLen = cmsfilelength(fm); if (fileLen < 0) { fclose(fm); @@ -467,6 +508,15 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const cha cmsSignalError(ContextID, cmsERROR_FILE, "Cannot get size of file '%s'", FileName); return NULL; } +#ifdef CMS_LARGE_FILE_SUPPORT + if (fileLen > (long long int) 0xFFFFFFFFLL) + { + fclose(fm); + _cmsFree(ContextID, iohandler); + cmsSignalError(ContextID, cmsERROR_FILE, "File '%s' is too large", FileName); + return NULL; + } +#endif iohandler -> ReportedSize = (cmsUInt32Number) fileLen; break; @@ -506,14 +556,25 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromFile(cmsContext ContextID, const cha cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream) { cmsIOHANDLER* iohandler = NULL; - cmsInt32Number fileSize; +#ifdef CMS_LARGE_FILE_SUPPORT + long long int fileSize; +#else + long int fileSize; +#endif - fileSize = (cmsInt32Number)cmsfilelength(Stream); + fileSize = cmsfilelength(Stream); if (fileSize < 0) { cmsSignalError(ContextID, cmsERROR_FILE, "Cannot get size of stream"); return NULL; } +#ifdef CMS_LARGE_FILE_SUPPORT + if (fileSize > (long long int) 0xFFFFFFFFLL) + { + cmsSignalError(ContextID, cmsERROR_FILE, "Stream is too large"); + return NULL; + } +#endif iohandler = (cmsIOHANDLER*) _cmsMallocZero(ContextID, sizeof(cmsIOHANDLER)); if (iohandler == NULL) return NULL; @@ -626,6 +687,18 @@ cmsTagSignature CMSEXPORT cmsGetTagSignature(cmsHPROFILE hProfile, cmsUInt32Numb return Icc ->TagNames[n]; } +// Return location of the tag +cmsBool CMSEXPORT cmsGetTagOffsetAndSize(cmsHPROFILE hProfile, cmsUInt32Number n, cmsUInt32Number* offset, cmsUInt32Number* size) +{ + _cmsICCPROFILE* Icc = (_cmsICCPROFILE*)hProfile; + + if (n > Icc->TagCount) return FALSE; + if (n >= MAX_TABLE_TAG) return FALSE; + + if (offset != NULL) *offset = Icc->TagOffsets[n]; + if (size != NULL) *size = Icc->TagSizes[n]; + return TRUE; +} static int SearchOneTag(_cmsICCPROFILE* Profile, cmsTagSignature sig) @@ -685,6 +758,7 @@ void _cmsDeleteTagByPos(_cmsICCPROFILE* Icc, int i) // Free previous version if (Icc ->TagSaveAsRaw[i]) { _cmsFree(Icc ->ContextID, Icc ->TagPtrs[i]); + Icc->TagSaveAsRaw[i] = FALSE; } else { cmsTagTypeHandler* TypeHandler = Icc ->TagTypeHandlers[i]; @@ -790,7 +864,8 @@ cmsUInt32Number _validatedVersion(cmsUInt32Number DWord) static cmsBool validDeviceClass(cmsProfileClassSignature cl) { - if ((int)cl == 0) return TRUE; // We allow zero because older lcms versions defaulted to that. + if (cl == (cmsProfileClassSignature)0) + return TRUE; // We allow zero because older lcms versions defaulted to that. switch (cl) { @@ -801,6 +876,10 @@ cmsBool validDeviceClass(cmsProfileClassSignature cl) case cmsSigAbstractClass: case cmsSigColorSpaceClass: case cmsSigNamedColorClass: + case cmsSigColorEncodingSpaceClass: + case cmsSigMultiplexIdentificationClass: + case cmsSigMultiplexLinkClass: + case cmsSigMultiplexVisualizationClass: return TRUE; default: @@ -1009,6 +1088,17 @@ cmsBool _cmsWriteHeader(_cmsICCPROFILE* Icc, cmsUInt32Number UsedSpace) // ----------------------------------------------------------------------- Set/Get several struct members +cmsUInt32Number CMSEXPORT cmsGetHeaderCMM(cmsHPROFILE hProfile) +{ + _cmsICCPROFILE* Icc = (_cmsICCPROFILE*)hProfile; + return Icc->CMM; +} + +void CMSEXPORT _cmsSetHeaderCMM(cmsHPROFILE hProfile, cmsUInt32Number CMM) +{ + _cmsICCPROFILE* Icc = (_cmsICCPROFILE*)hProfile; + Icc->CMM = CMM; +} cmsUInt32Number CMSEXPORT cmsGetHeaderRenderingIntent(cmsHPROFILE hProfile) { @@ -1227,7 +1317,6 @@ cmsHPROFILE CMSEXPORT cmsOpenProfileFromIOhandler2THR(cmsContext ContextID, cmsI return NULL; } - // Create profile from disk file cmsHPROFILE CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *lpFileName, const char *sAccess) { @@ -1295,7 +1384,6 @@ cmsHPROFILE CMSEXPORT cmsOpenProfileFromStream(FILE* ICCProfile, const char *sA return cmsOpenProfileFromStreamTHR(NULL, ICCProfile, sAccess); } - // Open from memory block cmsHPROFILE CMSEXPORT cmsOpenProfileFromMemTHR(cmsContext ContextID, const void* MemPtr, cmsUInt32Number dwSize) { @@ -1444,7 +1532,6 @@ cmsBool SaveTags(_cmsICCPROFILE* Icc, _cmsICCPROFILE* FileOrig) return TRUE; } - // Fill the offset and size fields for all linked tags static cmsBool SetLinks( _cmsICCPROFILE* Icc) @@ -1526,7 +1613,6 @@ cmsUInt32Number CMSEXPORT cmsSaveProfileToIOhandler(cmsHPROFILE hProfile, cmsIOH return 0; } - // Low-level save to disk. cmsBool CMSEXPORT cmsSaveProfileToFile(cmsHPROFILE hProfile, const char* FileName) { @@ -1605,6 +1691,8 @@ void freeOneTag(_cmsICCPROFILE* Icc, cmsUInt32Number i) else _cmsFree(Icc->ContextID, Icc->TagPtrs[i]); } + + Icc->TagPtrs[i] = NULL; } // Closes a profile freeing any involved resources @@ -1660,21 +1748,23 @@ cmsBool IsTypeSupported(cmsTagDescriptor* TagDescriptor, cmsTagTypeSignature Typ return FALSE; } - // That's the main read function void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig) { - _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile; + _cmsICCPROFILE* Icc = (_cmsICCPROFILE*)hProfile; + cmsBool avoidCheck; cmsIOHANDLER* io; cmsTagTypeHandler* TypeHandler; cmsTagTypeHandler LocalTypeHandler; - cmsTagDescriptor* TagDescriptor; + cmsTagDescriptor* TagDescriptor = NULL; cmsTagTypeSignature BaseType; cmsUInt32Number Offset, TagSize; cmsUInt32Number ElemCount; int n; - if (!_cmsLockMutex(Icc->ContextID, Icc ->UsrMutex)) return NULL; + if (!_cmsLockMutex(Icc->ContextID, Icc->UsrMutex)) return NULL; + + avoidCheck = _cmsAvoidTypeCheckOnTags(Icc->ContextID); n = _cmsSearchTag(Icc, sig, TRUE); if (n < 0) @@ -1685,7 +1775,7 @@ void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig) } // If the element is already in memory, return the pointer - if (Icc -> TagPtrs[n]) { + if (Icc->TagPtrs[n]) { if (Icc->TagTypeHandlers[n] == NULL) goto Error; @@ -1693,24 +1783,26 @@ void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig) BaseType = Icc->TagTypeHandlers[n]->Signature; if (BaseType == 0) goto Error; - TagDescriptor = _cmsGetTagDescriptor(Icc->ContextID, sig); - if (TagDescriptor == NULL) goto Error; + if (!avoidCheck) { - if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error; + TagDescriptor = _cmsGetTagDescriptor(Icc->ContextID, sig); + if (TagDescriptor == NULL) goto Error; + if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error; + } - if (Icc ->TagSaveAsRaw[n]) goto Error; // We don't support read raw tags as cooked + if (Icc->TagSaveAsRaw[n]) goto Error; // We don't support read raw tags as cooked - _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex); - return Icc -> TagPtrs[n]; + _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex); + return Icc->TagPtrs[n]; } // We need to read it. Get the offset and size to the file - Offset = Icc -> TagOffsets[n]; - TagSize = Icc -> TagSizes[n]; + Offset = Icc->TagOffsets[n]; + TagSize = Icc->TagSizes[n]; if (TagSize < 8) goto Error; - io = Icc ->IOhandler; + io = Icc->IOhandler; if (io == NULL) { // This is a built-in profile that has been manipulated, abort early @@ -1719,70 +1811,75 @@ void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig) } // Seek to its location - if (!io -> Seek(io, Offset)) + if (!io->Seek(io, Offset)) goto Error; - // Search for support on this tag - TagDescriptor = _cmsGetTagDescriptor(Icc-> ContextID, sig); - if (TagDescriptor == NULL) { + if (!avoidCheck) { + // Search for support on this tag + TagDescriptor = _cmsGetTagDescriptor(Icc->ContextID, sig); + if (TagDescriptor == NULL) { - char String[5]; + char String[5]; - _cmsTagSignature2String(String, sig); + _cmsTagSignature2String(String, sig); - // An unknown element was found. - cmsSignalError(Icc ->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown tag type '%s' found.", String); - goto Error; // Unsupported. + // An unknown element was found. + cmsSignalError(Icc->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown tag type '%s' found.", String); + goto Error; // Unsupported. + } } // if supported, get type and check if in list BaseType = _cmsReadTypeBase(io); if (BaseType == 0) goto Error; - if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error; + if (!avoidCheck) { + if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error; + } - TagSize -= 8; // Already read by the type base logic + TagSize -= 8; // Already read by the type base logic // Get type handler - TypeHandler = _cmsGetTagTypeHandler(Icc ->ContextID, BaseType); + TypeHandler = _cmsGetTagTypeHandler(Icc->ContextID, BaseType); if (TypeHandler == NULL) goto Error; LocalTypeHandler = *TypeHandler; // Read the tag - Icc -> TagTypeHandlers[n] = TypeHandler; + Icc->TagTypeHandlers[n] = TypeHandler; - LocalTypeHandler.ContextID = Icc ->ContextID; - LocalTypeHandler.ICCVersion = Icc ->Version; - Icc -> TagPtrs[n] = LocalTypeHandler.ReadPtr(&LocalTypeHandler, io, &ElemCount, TagSize); + LocalTypeHandler.ContextID = Icc->ContextID; + LocalTypeHandler.ICCVersion = Icc->Version; + Icc->TagPtrs[n] = LocalTypeHandler.ReadPtr(&LocalTypeHandler, io, &ElemCount, TagSize); // The tag type is supported, but something wrong happened and we cannot read the tag. // let know the user about this (although it is just a warning) - if (Icc -> TagPtrs[n] == NULL) { + if (Icc->TagPtrs[n] == NULL) { char String[5]; _cmsTagSignature2String(String, sig); - cmsSignalError(Icc ->ContextID, cmsERROR_CORRUPTION_DETECTED, "Corrupted tag '%s'", String); + cmsSignalError(Icc->ContextID, cmsERROR_CORRUPTION_DETECTED, "Corrupted tag '%s'", String); goto Error; } - // This is a weird error that may be a symptom of something more serious, the number of - // stored item is actually less than the number of required elements. - if (ElemCount < TagDescriptor ->ElemCount) { + if (!avoidCheck) { + // This is a weird error that may be a symptom of something more serious, the number of + // stored item is actually less than the number of required elements. + if (ElemCount < TagDescriptor->ElemCount) { - char String[5]; + char String[5]; - _cmsTagSignature2String(String, sig); - cmsSignalError(Icc ->ContextID, cmsERROR_CORRUPTION_DETECTED, "'%s' Inconsistent number of items: expected %d, got %d", - String, TagDescriptor ->ElemCount, ElemCount); - goto Error; + _cmsTagSignature2String(String, sig); + cmsSignalError(Icc->ContextID, cmsERROR_CORRUPTION_DETECTED, "'%s' Inconsistent number of items: expected %d, got %d", + String, TagDescriptor->ElemCount, ElemCount); + goto Error; + } } - // Return the data - _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex); - return Icc -> TagPtrs[n]; + _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex); + return Icc->TagPtrs[n]; // Return error and unlock the data @@ -1791,7 +1888,7 @@ void* CMSEXPORT cmsReadTag(cmsHPROFILE hProfile, cmsTagSignature sig) freeOneTag(Icc, n); Icc->TagPtrs[n] = NULL; - _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex); + _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex); return NULL; } @@ -1809,6 +1906,8 @@ cmsTagTypeSignature _cmsGetTagTrueType(cmsHPROFILE hProfile, cmsTagSignature sig // Get the handler. The true type is there TypeHandler = Icc -> TagTypeHandlers[n]; + if (TypeHandler == NULL) return (cmsTagTypeSignature) 0; + return TypeHandler ->Signature; } @@ -1847,8 +1946,11 @@ cmsBool CMSEXPORT cmsWriteTag(cmsHPROFILE hProfile, cmsTagSignature sig, const v if (!_cmsNewTag(Icc, sig, &i)) goto Error; - // This is not raw - Icc ->TagSaveAsRaw[i] = FALSE; + // This cannot be RAW + if (Icc->TagSaveAsRaw[i]) { + cmsSignalError(Icc->ContextID, cmsERROR_ALREADY_DEFINED, "Tag '%x' was already saved as RAW", sig); + goto Error; + } // This is not a link Icc ->TagLinked[i] = (cmsTagSignature) 0; @@ -2116,7 +2218,6 @@ cmsBool CMSEXPORT cmsLinkTag(cmsHPROFILE hProfile, cmsTagSignature sig, cmsTagSi return TRUE; } - // Returns the tag linked to sig, in the case two tags are sharing same resource cmsTagSignature CMSEXPORT cmsTagLinkedTo(cmsHPROFILE hProfile, cmsTagSignature sig) { diff --git a/src/java.desktop/share/native/liblcms/cmsio1.c b/src/java.desktop/share/native/liblcms/cmsio1.c index 48772c7cbde9..463f1192c2a4 100644 --- a/src/java.desktop/share/native/liblcms/cmsio1.c +++ b/src/java.desktop/share/native/liblcms/cmsio1.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -1012,7 +1012,13 @@ const cmsMLU* GetInfo(cmsHPROFILE hProfile, cmsInfoType Info) switch (Info) { case cmsInfoDescription: - sig = cmsSigProfileDescriptionTag; + /** + * Add for MacOS, which uses propiertary tags for description + */ + if (cmsIsTag(hProfile, cmsSigProfileDescriptionMLTag)) + sig = cmsSigProfileDescriptionMLTag; + else + sig = cmsSigProfileDescriptionTag; break; case cmsInfoManufacturer: diff --git a/src/java.desktop/share/native/liblcms/cmslut.c b/src/java.desktop/share/native/liblcms/cmslut.c index 3cf4e8cac5a6..6ac5b63d2de1 100644 --- a/src/java.desktop/share/native/liblcms/cmslut.c +++ b/src/java.desktop/share/native/liblcms/cmslut.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -489,25 +489,26 @@ void EvaluateCLUTfloatIn16(const cmsFloat32Number In[], cmsFloat32Number Out[], static cmsUInt32Number CubeSize(const cmsUInt32Number Dims[], cmsUInt32Number b) { - cmsUInt32Number rv, dim; + cmsUInt32Number dim; + cmsUInt64Number rv; _cmsAssert(Dims != NULL); for (rv = 1; b > 0; b--) { dim = Dims[b-1]; - if (dim <= 1) return 0; // Error - - rv *= dim; + if (dim <= 1) return 0; // Check for overflow if (rv > UINT_MAX / dim) return 0; + + rv *= dim; } // Again, prevent overflow if (rv > UINT_MAX / 15) return 0; - return rv; + return (cmsUInt32Number) rv; } static diff --git a/src/java.desktop/share/native/liblcms/cmsmd5.c b/src/java.desktop/share/native/liblcms/cmsmd5.c index d9b9a4e52608..f18300ebace2 100644 --- a/src/java.desktop/share/native/liblcms/cmsmd5.c +++ b/src/java.desktop/share/native/liblcms/cmsmd5.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmsmtrx.c b/src/java.desktop/share/native/liblcms/cmsmtrx.c index 841da662a107..1db000752e3a 100644 --- a/src/java.desktop/share/native/liblcms/cmsmtrx.c +++ b/src/java.desktop/share/native/liblcms/cmsmtrx.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmsnamed.c b/src/java.desktop/share/native/liblcms/cmsnamed.c index 451bfe9f34d5..4338b7cb8f58 100644 --- a/src/java.desktop/share/native/liblcms/cmsnamed.c +++ b/src/java.desktop/share/native/liblcms/cmsnamed.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -116,8 +116,11 @@ cmsBool GrowMLUpool(cmsMLU* mlu) return TRUE; } - // Grows a entry table for a MLU. Each time this function is called, table size is multiplied times two. +// No need to check integer overflow since that is 2*16*count = 2^32-1 ; => count = 128 M entries, +// That would be 2Gb, which is over MAX_MEMORY_FOR_ALLOC, even for large file size. +// I added this check to silence the continuous spam reports of people using AI to catch what +// they think are "vulnerabilities". static cmsBool GrowMLUtable(cmsMLU* mlu) { @@ -129,8 +132,12 @@ cmsBool GrowMLUtable(cmsMLU* mlu) AllocatedEntries = mlu ->AllocatedEntries * 2; - // Check for overflow - if (AllocatedEntries / 2 != mlu ->AllocatedEntries) return FALSE; + // Check for overflow in count doubling: if wrapped, result < original + if (AllocatedEntries < mlu->AllocatedEntries) return FALSE; + + // Check for overflow in byte-size multiplication: + // dividing back by sizeof must recover the original count + if ((AllocatedEntries * sizeof(_cmsMLUentry)) / sizeof(_cmsMLUentry) != AllocatedEntries) return FALSE; // Reallocate the memory NewPtr = (_cmsMLUentry*)_cmsRealloc(mlu ->ContextID, mlu ->Entries, AllocatedEntries*sizeof(_cmsMLUentry)); @@ -303,7 +310,7 @@ cmsUInt32Number encodeUTF8(char* out, const wchar_t* in, cmsUInt32Number max_wch cmsUInt32Number size = 0; cmsUInt32Number len_w = 0; - while (*in && len_w < max_wchars) + while (len_w < max_wchars && *in) { if (*in >= 0xd800 && *in <= 0xdbff) codepoint = ((*in - 0xd800) << 10) + 0x10000; @@ -834,7 +841,8 @@ cmsNAMEDCOLORLIST* CMSEXPORT cmsDupNamedColorList(const cmsNAMEDCOLORLIST* v) memmove(NewNC ->Prefix, v ->Prefix, sizeof(v ->Prefix)); memmove(NewNC ->Suffix, v ->Suffix, sizeof(v ->Suffix)); NewNC ->ColorantCount = v ->ColorantCount; - memmove(NewNC->List, v ->List, v->nColors * sizeof(_cmsNAMEDCOLOR)); + if (v->nColors > 0) + memmove(NewNC->List, v ->List, v->nColors * sizeof(_cmsNAMEDCOLOR)); NewNC ->nColors = v ->nColors; return NewNC; } @@ -1071,17 +1079,17 @@ cmsSEQ* CMSEXPORT cmsDupProfileSequenceDescription(const cmsSEQ* pseq) if (pseq == NULL) return NULL; - NewSeq = (cmsSEQ*) _cmsMalloc(pseq -> ContextID, sizeof(cmsSEQ)); + NewSeq = (cmsSEQ*)_cmsMallocZero(pseq->ContextID, sizeof(cmsSEQ)); if (NewSeq == NULL) return NULL; + NewSeq->ContextID = pseq->ContextID; - NewSeq -> seq = (cmsPSEQDESC*) _cmsCalloc(pseq ->ContextID, pseq ->n, sizeof(cmsPSEQDESC)); - if (NewSeq ->seq == NULL) goto Error; + NewSeq->seq = (cmsPSEQDESC*)_cmsCalloc(pseq->ContextID, pseq->n, sizeof(cmsPSEQDESC)); + if (NewSeq->seq == NULL) goto Error; - NewSeq -> ContextID = pseq ->ContextID; - NewSeq -> n = pseq ->n; + NewSeq->n = pseq->n; - for (i=0; i < pseq->n; i++) { + for (i = 0; i < pseq->n; i++) { memmove(&NewSeq ->seq[i].attributes, &pseq ->seq[i].attributes, sizeof(cmsUInt64Number)); diff --git a/src/java.desktop/share/native/liblcms/cmsopt.c b/src/java.desktop/share/native/liblcms/cmsopt.c index 767008e68c58..bba317223835 100644 --- a/src/java.desktop/share/native/liblcms/cmsopt.c +++ b/src/java.desktop/share/native/liblcms/cmsopt.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -698,11 +698,16 @@ cmsBool OptimizeByResampling(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUInt3 if (ColorSpace == (cmsColorSpaceSignature)0 || OutputColorSpace == (cmsColorSpaceSignature)0) return FALSE; - nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags); - // For empty LUTs, 2 points are enough if (cmsPipelineStageCount(*Lut) == 0) nGridPoints = 2; + else + { + nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags); + + // Lab16 as input cannot be optimized by a CLUT due to centering issues, thanks to Mike Chaney for discovering this. + if (!(*dwFlags & cmsFLAGS_FORCE_CLUT) && (ColorSpace == cmsSigLabData) && (T_BYTES(*InputFormat) == 2)) return FALSE; + } Src = *Lut; @@ -813,6 +818,11 @@ cmsBool OptimizeByResampling(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUInt3 Dest ->OutputChannels, DataSetOut); + if (p16 == NULL) { + cmsPipelineFree(Dest); + return FALSE; + } + _cmsPipelineSetOptimizationParameters(Dest, PrelinEval16, (void*) p16, PrelinOpt16free, Prelin16dup); } @@ -1211,10 +1221,13 @@ cmsBool OptimizeByComputingLinearization(cmsPipeline** Lut, cmsUInt32Number Inte if (Trans[t]) cmsFreeToneCurve(Trans[t]); if (TransReverse[t]) cmsFreeToneCurve(TransReverse[t]); + + Trans[t] = NULL; + TransReverse[t] = NULL; } cmsPipelineFree(LutPlusCurves); - + LutPlusCurves = NULL; OptimizedPrelinCurves = _cmsStageGetPtrToCurveSet(OptimizedPrelinMpe); OptimizedPrelinCLUT = (_cmsStageCLutData*) OptimizedCLUTmpe ->Data; @@ -1225,7 +1238,7 @@ cmsBool OptimizeByComputingLinearization(cmsPipeline** Lut, cmsUInt32Number Inte Prelin8Data* p8 = PrelinOpt8alloc(OptimizedLUT ->ContextID, OptimizedPrelinCLUT ->Params, OptimizedPrelinCurves); - if (p8 == NULL) return FALSE; + if (p8 == NULL) goto Error; _cmsPipelineSetOptimizationParameters(OptimizedLUT, PrelinEval8, (void*) p8, Prelin8free, Prelin8dup); @@ -1235,7 +1248,8 @@ cmsBool OptimizeByComputingLinearization(cmsPipeline** Lut, cmsUInt32Number Inte Prelin16Data* p16 = PrelinOpt16alloc(OptimizedLUT ->ContextID, OptimizedPrelinCLUT ->Params, 3, OptimizedPrelinCurves, 3, NULL); - if (p16 == NULL) return FALSE; + + if (p16 == NULL) goto Error; _cmsPipelineSetOptimizationParameters(OptimizedLUT, PrelinEval16, (void*) p16, PrelinOpt16free, Prelin16dup); @@ -1249,7 +1263,7 @@ cmsBool OptimizeByComputingLinearization(cmsPipeline** Lut, cmsUInt32Number Inte if (!FixWhiteMisalignment(OptimizedLUT, ColorSpace, OutputColorSpace)) { - return FALSE; + goto Error; } } diff --git a/src/java.desktop/share/native/liblcms/cmspack.c b/src/java.desktop/share/native/liblcms/cmspack.c index d430e73051de..b740567af3b6 100644 --- a/src/java.desktop/share/native/liblcms/cmspack.c +++ b/src/java.desktop/share/native/liblcms/cmspack.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmspcs.c b/src/java.desktop/share/native/liblcms/cmspcs.c index 5f1b1f0d8e6d..8c33057721e9 100644 --- a/src/java.desktop/share/native/liblcms/cmspcs.c +++ b/src/java.desktop/share/native/liblcms/cmspcs.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmsplugin.c b/src/java.desktop/share/native/liblcms/cmsplugin.c index aaad39f52b04..a943c9f4dd96 100644 --- a/src/java.desktop/share/native/liblcms/cmsplugin.c +++ b/src/java.desktop/share/native/liblcms/cmsplugin.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -522,7 +522,7 @@ cmsBool CMSEXPORT _cmsIOPrintf(cmsIOHANDLER* io, const char* frm, ...) va_start(args, frm); len = vsnprintf((char*) Buffer, 2047, frm, args); - if (len < 0) { + if (len < 0 || len >= 2047) { va_end(args); return FALSE; // Truncated, which is a fatal error for us } diff --git a/src/java.desktop/share/native/liblcms/cmsps2.c b/src/java.desktop/share/native/liblcms/cmsps2.c index 476817e9c1a2..3901f92d2127 100644 --- a/src/java.desktop/share/native/liblcms/cmsps2.c +++ b/src/java.desktop/share/native/liblcms/cmsps2.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -358,6 +358,32 @@ char* RemoveCR(const char* txt) } +// Writes the body of a PostScript string literal, escaping the metacharacters +// '\\', '(' and ')' and emitting non-printable / high-bit bytes as octal +// triples per PLRM 3.3.4.1. The caller is responsible for the surrounding +// '(' and ')' delimiters. +static +void EmitPSEscaped(cmsIOHANDLER* m, const char* txt) +{ + const unsigned char* p; + + if (txt == NULL) return; + + for (p = (const unsigned char*)txt; *p != 0; p++) { + unsigned char c = *p; + + if (c == '\\' || c == '(' || c == ')') { + _cmsIOPrintf(m, "\\%c", c); + } + else if (c < 0x20 || c >= 0x7F) { + _cmsIOPrintf(m, "\\%03o", c); + } + else { + _cmsIOPrintf(m, "%c", c); + } + } +} + static void EmitHeader(cmsIOHANDLER* m, const char* Title, cmsHPROFILE hProfile) { @@ -1048,7 +1074,10 @@ int WriteNamedColorCSA(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, cmsUInt32Number continue; cmsDoTransform(xform, In, &Lab, 1); - _cmsIOPrintf(m, " (%s) [ %.3f %.3f %.3f ]\n", ColorName, Lab.L, Lab.a, Lab.b); + + _cmsIOPrintf(m, " ("); + EmitPSEscaped(m, ColorName); + _cmsIOPrintf(m, ") [ %.3f %.3f %.3f ]\n", Lab.L, Lab.a, Lab.b); } _cmsIOPrintf(m, ">>\n"); @@ -1483,7 +1512,10 @@ int WriteNamedColorCRD(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, cmsUInt32Number cmsDoTransform(xform, In, Out, 1); BuildColorantList(Colorant, nColorant, Out); - _cmsIOPrintf(m, " (%s) [ %s ]\n", ColorName, Colorant); + + _cmsIOPrintf(m, " ("); + EmitPSEscaped(m, ColorName); + _cmsIOPrintf(m, ") [ %s ]\n", Colorant); } _cmsIOPrintf(m, " >>"); diff --git a/src/java.desktop/share/native/liblcms/cmssamp.c b/src/java.desktop/share/native/liblcms/cmssamp.c index ca5c4a9d6931..7c8c93d9d52d 100644 --- a/src/java.desktop/share/native/liblcms/cmssamp.c +++ b/src/java.desktop/share/native/liblcms/cmssamp.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -152,9 +152,12 @@ cmsBool BlackPointAsDarkerColorant(cmsHPROFILE hInput, // Convert black to Lab cmsDoTransform(xform, Black, &Lab, 1); - // Force it to be neutral, check for inconsistencies - Lab.a = Lab.b = 0; - if (Lab.L > 50 || Lab.L < 0) Lab.L = 0; + if (Lab.L > 95) + Lab.L = 0; // for synthetical negative profiles + else if (Lab.L < 0) + Lab.L = 0; + else if (Lab.L > 50) + Lab.L = 50; // Free the resources cmsDeleteTransform(xform); @@ -211,6 +214,50 @@ cmsBool BlackPointUsingPerceptualBlack(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfi return TRUE; } + +static +cmsBool isInkColorspace(cmsColorSpaceSignature c) +{ + switch(c) + { + case cmsSigCmykData: + case cmsSigCmyData: + case cmsSigMCH1Data: + case cmsSigMCH2Data: + case cmsSigMCH3Data: + case cmsSigMCH4Data: + case cmsSigMCH5Data: + case cmsSigMCH6Data: + case cmsSigMCH7Data: + case cmsSigMCH8Data: + case cmsSigMCH9Data: + case cmsSigMCHAData: + case cmsSigMCHBData: + case cmsSigMCHCData: + case cmsSigMCHDData: + case cmsSigMCHEData: + case cmsSigMCHFData: + case cmsSig1colorData: + case cmsSig2colorData: + case cmsSig3colorData: + case cmsSig4colorData: + case cmsSig5colorData: + case cmsSig6colorData: + case cmsSig7colorData: + case cmsSig8colorData: + case cmsSig9colorData: + case cmsSig10colorData: + case cmsSig11colorData: + case cmsSig12colorData: + case cmsSig13colorData: + case cmsSig14colorData: + case cmsSig15colorData: + return TRUE; + default: + return FALSE; + } +} + // This function shouldn't exist at all -- there is such quantity of broken // profiles on black point tag, that we must somehow fix chromaticity to // avoid huge tint when doing Black point compensation. This function does @@ -295,7 +342,7 @@ cmsBool CMSEXPORT cmsDetectBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROFILE hProfil // If output profile, discount ink-limiting and that's all if (Intent == INTENT_RELATIVE_COLORIMETRIC && (cmsGetDeviceClass(hProfile) == cmsSigOutputClass) && - (cmsGetColorSpace(hProfile) == cmsSigCmykData)) + (isInkColorspace(cmsGetColorSpace(hProfile)))) return BlackPointUsingPerceptualBlack(BlackPoint, hProfile); // Nope, compute BP using current intent. @@ -352,7 +399,7 @@ cmsFloat64Number RootOfLeastSquaresFitQuadraticCurve(int n, cmsFloat64Number x[] if (fabs(a) < 1.0E-10) { if (fabs(b) < 1.0E-10) return 0; - return cmsmin(0, cmsmax(50, -c/b )); + return cmsmax(0, cmsmin(50, -c/b )); } else { @@ -432,7 +479,7 @@ cmsBool CMSEXPORT cmsDetectDestinationBlackPoint(cmsCIEXYZ* BlackPoint, cmsHPROF if (!cmsIsCLUT(hProfile, Intent, LCMS_USED_AS_OUTPUT ) || (ColorSpace != cmsSigGrayData && ColorSpace != cmsSigRgbData && - ColorSpace != cmsSigCmykData)) { + !isInkColorspace(ColorSpace))) { // In this case, handle as input case return cmsDetectBlackPoint(BlackPoint, hProfile, Intent, dwFlags); diff --git a/src/java.desktop/share/native/liblcms/cmssm.c b/src/java.desktop/share/native/liblcms/cmssm.c index e2a810a26695..b79cd85488bf 100644 --- a/src/java.desktop/share/native/liblcms/cmssm.c +++ b/src/java.desktop/share/native/liblcms/cmssm.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmstypes.c b/src/java.desktop/share/native/liblcms/cmstypes.c index 22514f882268..6ef3031aee09 100644 --- a/src/java.desktop/share/native/liblcms/cmstypes.c +++ b/src/java.desktop/share/native/liblcms/cmstypes.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -4786,7 +4786,6 @@ cmsBool ReadMPEElem(struct _cms_typehandler_struct* self, return TRUE; - cmsUNUSED_PARAMETER(SizeOfTag); cmsUNUSED_PARAMETER(n); } @@ -4894,9 +4893,11 @@ cmsBool Type_MPE_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, v goto Error; } + Before = io ->Tell(io); + if (!_cmsWriteUInt32Number(io, ElementSig)) goto Error; if (!_cmsWriteUInt32Number(io, 0)) goto Error; - Before = io ->Tell(io); + if (!TypeHandler ->WritePtr(self, io, Elem, 1)) goto Error; if (!_cmsWriteAlignment(io)) goto Error; @@ -5645,9 +5646,7 @@ void* Type_VideoSignal_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* { cmsVideoSignalType* cicp = NULL; - if (SizeOfTag != 8) return NULL; - - if (!_cmsReadUInt32Number(io, NULL)) return NULL; + if (SizeOfTag != 4) return NULL; cicp = (cmsVideoSignalType*)_cmsCalloc(self->ContextID, 1, sizeof(cmsVideoSignalType)); if (cicp == NULL) return NULL; @@ -5671,7 +5670,6 @@ cmsBool Type_VideoSignal_Write(struct _cms_typehandler_struct* self, cmsIOHANDLE { cmsVideoSignalType* cicp = (cmsVideoSignalType*)Ptr; - if (!_cmsWriteUInt32Number(io, 0)) return FALSE; if (!_cmsWriteUInt8Number(io, cicp->ColourPrimaries)) return FALSE; if (!_cmsWriteUInt8Number(io, cicp->TransferCharacteristics)) return FALSE; if (!_cmsWriteUInt8Number(io, cicp->MatrixCoefficients)) return FALSE; @@ -5744,11 +5742,11 @@ void Type_MHC2_Free(struct _cms_typehandler_struct* self, void* Ptr) void* Type_MHC2_Dup(struct _cms_typehandler_struct* self, const void* Ptr, cmsUInt32Number n) { - cmsMHC2Type* mhc2 = _cmsDupMem(self->ContextID, Ptr, sizeof(cmsMHC2Type)); + cmsMHC2Type* mhc2 = (cmsMHC2Type*)_cmsDupMem(self->ContextID, Ptr, sizeof(cmsMHC2Type)); - mhc2->RedCurve = _cmsDupMem(self->ContextID, mhc2->RedCurve, mhc2->CurveEntries*sizeof(cmsFloat64Number)); - mhc2->GreenCurve = _cmsDupMem(self->ContextID, mhc2->GreenCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number)); - mhc2->BlueCurve = _cmsDupMem(self->ContextID, mhc2->BlueCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number)); + mhc2->RedCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID, mhc2->RedCurve, mhc2->CurveEntries*sizeof(cmsFloat64Number)); + mhc2->GreenCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID, mhc2->GreenCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number)); + mhc2->BlueCurve = (cmsFloat64Number*) _cmsDupMem(self->ContextID, mhc2->BlueCurve, mhc2->CurveEntries * sizeof(cmsFloat64Number)); if (mhc2->RedCurve == NULL || mhc2->GreenCurve == NULL || @@ -5786,7 +5784,6 @@ cmsBool Type_MHC2_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number MatrixOffset; cmsUInt32Number OffsetRedTable, OffsetGreenTable, OffsetBlueTable; - if (!_cmsWriteUInt32Number(io, 0)) return FALSE; if (!_cmsWriteUInt32Number(io, mhc2->CurveEntries)) return FALSE; if (!_cmsWrite15Fixed16Number(io, mhc2->MinLuminance)) return FALSE; @@ -5811,10 +5808,20 @@ cmsBool Type_MHC2_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, } OffsetRedTable = io->Tell(io) - BaseOffset; + + if(!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE; + if(!_cmsWriteUInt32Number(io, 0)) return FALSE; + if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->RedCurve)) return FALSE; + OffsetGreenTable = io->Tell(io) - BaseOffset; + if (!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE; + if (!_cmsWriteUInt32Number(io, 0)) return FALSE; if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->GreenCurve)) return FALSE; + OffsetBlueTable = io->Tell(io) - BaseOffset; + if (!_cmsWriteUInt32Number(io, cmsSigS15Fixed16ArrayType)) return FALSE; + if (!_cmsWriteUInt32Number(io, 0)) return FALSE; if (!WriteDoubles(io, mhc2->CurveEntries, mhc2->BlueCurve)) return FALSE; if (!io->Seek(io, TablesOffsetPos)) return FALSE; @@ -5858,8 +5865,6 @@ void* Type_MHC2_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cms cmsUInt32Number MatrixOffset; cmsUInt32Number OffsetRedTable, OffsetGreenTable, OffsetBlueTable; - if (!_cmsReadUInt32Number(io, NULL)) return NULL; - mhc2 = (cmsMHC2Type*)_cmsCalloc(self->ContextID, 1, sizeof(cmsMHC2Type)); if (mhc2 == NULL) return NULL; @@ -5890,9 +5895,10 @@ void* Type_MHC2_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cms if (!ReadDoublesAt(io, BaseOffset + MatrixOffset, 3*4, &mhc2->XYZ2XYZmatrix[0][0])) goto Error; } - if (!ReadDoublesAt(io, BaseOffset + OffsetRedTable, mhc2->CurveEntries, mhc2->RedCurve)) goto Error; - if (!ReadDoublesAt(io, BaseOffset + OffsetGreenTable, mhc2->CurveEntries, mhc2->GreenCurve)) goto Error; - if (!ReadDoublesAt(io, BaseOffset + OffsetBlueTable, mhc2->CurveEntries, mhc2->BlueCurve)) goto Error; + // Skip sf32 tag and filler (8bytes) + if (!ReadDoublesAt(io, BaseOffset + OffsetRedTable + 8, mhc2->CurveEntries, mhc2->RedCurve)) goto Error; + if (!ReadDoublesAt(io, BaseOffset + OffsetGreenTable + 8, mhc2->CurveEntries, mhc2->GreenCurve)) goto Error; + if (!ReadDoublesAt(io, BaseOffset + OffsetBlueTable + 8, mhc2->CurveEntries, mhc2->BlueCurve)) goto Error; // Success *nItems = 1; @@ -6259,3 +6265,17 @@ cmsTagDescriptor* _cmsGetTagDescriptor(cmsContext ContextID, cmsTagSignature sig return NULL; } +cmsBool _cmsAvoidTypeCheckOnTags(cmsContext ContextID) +{ + _cmsTagLinkedList* pt; + _cmsTagPluginChunkType* TagPluginChunk = (_cmsTagPluginChunkType*)_cmsContextGetClientChunk(ContextID, TagPlugin); + + for (pt = TagPluginChunk->Tag; + pt != NULL; + pt = pt->Next) { + + if (pt->Signature == (cmsTagSignature)0) return TRUE; + } + + return FALSE; +} diff --git a/src/java.desktop/share/native/liblcms/cmsvirt.c b/src/java.desktop/share/native/liblcms/cmsvirt.c index 1ef86dae0544..2b5cdf896f8b 100644 --- a/src/java.desktop/share/native/liblcms/cmsvirt.c +++ b/src/java.desktop/share/native/liblcms/cmsvirt.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -400,7 +400,7 @@ int InkLimitingSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUI SumCMY = (cmsFloat64Number) In[0] + In[1] + In[2]; SumCMYK = SumCMY + In[3]; - if (SumCMYK > InkLimit) { + if (SumCMYK > InkLimit && SumCMY > 0) { Ratio = 1 - ((SumCMYK - InkLimit) / SumCMY); if (Ratio < 0) @@ -513,16 +513,20 @@ cmsHPROFILE CMSEXPORT cmsCreateLab2ProfileTHR(cmsContext ContextID, const cmsCIE cmsSetColorSpace(hProfile, cmsSigLabData); cmsSetPCS(hProfile, cmsSigLabData); - if (!SetTextTags(hProfile, L"Lab identity built-in")) return NULL; + if (!SetTextTags(hProfile, L"Lab identity built-in")) + goto Error; // An identity LUT is all we need LUT = cmsPipelineAlloc(ContextID, 3, 3); - if (LUT == NULL) goto Error; + if (LUT == NULL) + goto Error; if (!cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCLut(ContextID, 3))) goto Error; - if (!cmsWriteTag(hProfile, cmsSigAToB0Tag, LUT)) goto Error; + if (!cmsWriteTag(hProfile, cmsSigAToB0Tag, LUT)) + goto Error; + cmsPipelineFree(LUT); return hProfile; @@ -550,8 +554,14 @@ cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIE { cmsHPROFILE hProfile; cmsPipeline* LUT = NULL; + cmsCIEXYZ xyz; - hProfile = cmsCreateRGBProfileTHR(ContextID, WhitePoint == NULL ? cmsD50_xyY() : WhitePoint, NULL, NULL); + if (WhitePoint == NULL) + xyz = *cmsD50_XYZ(); + else + cmsxyY2XYZ(&xyz, WhitePoint); + + hProfile = cmsCreateRGBProfileTHR(ContextID, NULL, NULL, NULL); if (hProfile == NULL) return NULL; cmsSetProfileVersion(hProfile, 4.4); @@ -560,6 +570,7 @@ cmsHPROFILE CMSEXPORT cmsCreateLab4ProfileTHR(cmsContext ContextID, const cmsCIE cmsSetColorSpace(hProfile, cmsSigLabData); cmsSetPCS(hProfile, cmsSigLabData); + if (!cmsWriteTag(hProfile, cmsSigMediaWhitePointTag, &xyz)) goto Error; if (!SetTextTags(hProfile, L"Lab identity built-in")) goto Error; // An empty LUTs is all we need @@ -929,25 +940,24 @@ cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID, for (i=0; i < MAX_INPUT_DIMENSIONS; i++) Dimensions[i] = nLUTPoints; CLUT = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 3, 3, NULL); - if (CLUT == NULL) goto Error; - - - if (!cmsStageSampleCLut16bit(CLUT, bchswSampler, (void*) &bchsw, 0)) { + if (CLUT == NULL) + goto Error; - // Shouldn't reach here + if (!cmsStageSampleCLut16bit(CLUT, bchswSampler, (void*) &bchsw, 0)) goto Error; - } - if (!cmsPipelineInsertStage(Pipeline, cmsAT_END, CLUT)) { + if (!cmsPipelineInsertStage(Pipeline, cmsAT_END, CLUT)) goto Error; - } // Create tags - if (!SetTextTags(hICC, L"BCHS built-in")) return NULL; + if (!SetTextTags(hICC, L"BCHS built-in")) + goto Error; - cmsWriteTag(hICC, cmsSigMediaWhitePointTag, (void*) cmsD50_XYZ()); + if (!cmsWriteTag(hICC, cmsSigMediaWhitePointTag, (void*)cmsD50_XYZ())) + goto Error; - cmsWriteTag(hICC, cmsSigAToB0Tag, (void*) Pipeline); + if (!cmsWriteTag(hICC, cmsSigAToB0Tag, (void*)Pipeline)) + goto Error; // Pipeline is already on virtual profile cmsPipelineFree(Pipeline); @@ -1338,12 +1348,23 @@ cmsHPROFILE CMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, cmsFloat if (!cmsWriteTag(hProfile, DestinationTag, LUT)) goto Error; - if (xform -> InputColorant != NULL) { + // Colorant tables have special rules depening on deviceClass + if (xform -> InputColorant != NULL && + (deviceClass == cmsSigLinkClass || deviceClass == cmsSigInputClass)) { + if (!cmsWriteTag(hProfile, cmsSigColorantTableTag, xform->InputColorant)) goto Error; } if (xform -> OutputColorant != NULL) { - if (!cmsWriteTag(hProfile, cmsSigColorantTableOutTag, xform->OutputColorant)) goto Error; + + if (deviceClass == cmsSigLinkClass) { + + if (!cmsWriteTag(hProfile, cmsSigColorantTableOutTag, xform->OutputColorant)) goto Error; + } + else + { + if (!cmsWriteTag(hProfile, cmsSigColorantTableTag, xform->OutputColorant)) goto Error; + } } if ((deviceClass == cmsSigLinkClass) && (xform ->Sequence != NULL)) { diff --git a/src/java.desktop/share/native/liblcms/cmswtpnt.c b/src/java.desktop/share/native/liblcms/cmswtpnt.c index ebba2cd6a978..f6337765c0c7 100644 --- a/src/java.desktop/share/native/liblcms/cmswtpnt.c +++ b/src/java.desktop/share/native/liblcms/cmswtpnt.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/liblcms/cmsxform.c b/src/java.desktop/share/native/liblcms/cmsxform.c index 1eb3eecbf182..397266551b97 100644 --- a/src/java.desktop/share/native/liblcms/cmsxform.c +++ b/src/java.desktop/share/native/liblcms/cmsxform.c @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -528,7 +528,6 @@ void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p, } } - // No gamut check, Cache, 16 bits, static void CachedXFORM(_cmsTRANSFORM* p, @@ -1101,6 +1100,8 @@ cmsBool IsProperColorSpace(cmsColorSpaceSignature Check, cmsUInt32Number dwForm int Space1 = (int) T_COLORSPACE(dwFormat); int Space2 = _cmsLCMScolorSpace(Check); + if (dwFormat == 0) return TRUE; // Bypass used by linkicc + if (Space1 == PT_ANY) return (T_CHANNELS(dwFormat) == cmsChannelsOf(Check)); if (Space1 == Space2) return TRUE; @@ -1183,6 +1184,11 @@ cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID, if (hGamutProfile == NULL) dwFlags &= ~cmsFLAGS_GAMUTCHECK; } + if ((dwFlags & cmsFLAGS_GAMUTCHECK) && (nGamutPCSposition <= 0 || nGamutPCSposition >= nProfiles - 1)) { + cmsSignalError(ContextID, cmsERROR_RANGE, "Wrong gamut PCS position '%d'", nGamutPCSposition); + return NULL; + } + // On floating point transforms, inhibit cache if (_cmsFormatterIsFloat(InputFormat) || _cmsFormatterIsFloat(OutputFormat)) dwFlags |= cmsFLAGS_NOCACHE; @@ -1464,6 +1470,22 @@ cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform) return xform->OutputFormat; } +// Returns the optimized pipeline (Lut) inside a transform. Read-only; do not free. +cmsPipeline* CMSEXPORT cmsGetTransformPipeline(cmsHTRANSFORM hTransform) +{ + _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform; + if (xform == NULL) return NULL; + return xform->Lut; +} + +// Returns the gamut-check pipeline inside a transform. Read-only; do not free. +cmsPipeline* CMSEXPORT cmsGetTransformGamutCheckPipeline(cmsHTRANSFORM hTransform) +{ + _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform; + if (xform == NULL) return NULL; + return xform->GamutCheck; +} + // For backwards compatibility cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform, cmsUInt32Number InputFormat, @@ -1495,3 +1517,19 @@ cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform, xform ->ToOutput = ToOutput; return TRUE; } + +cmsNAMEDCOLORLIST* CMSEXPORT cmsGetTransformInputColorants(cmsHTRANSFORM hTransform) +{ + _cmsTRANSFORM* xform = (_cmsTRANSFORM*)hTransform; + + if (xform == NULL) return NULL; + return xform->InputColorant; +} + +cmsNAMEDCOLORLIST* CMSEXPORT cmsGetTransformOutputColorants(cmsHTRANSFORM hTransform) +{ + _cmsTRANSFORM* xform = (_cmsTRANSFORM*)hTransform; + + if (xform == NULL) return NULL; + return xform->OutputColorant; +} diff --git a/src/java.desktop/share/native/liblcms/lcms2.h b/src/java.desktop/share/native/liblcms/lcms2.h index 5ba096613088..f05378ad95eb 100644 --- a/src/java.desktop/share/native/liblcms/lcms2.h +++ b/src/java.desktop/share/native/liblcms/lcms2.h @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2025 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -52,7 +52,7 @@ // //--------------------------------------------------------------------------------- // -// Version 2.17 +// Version 2.19 // #ifndef _lcms2_H @@ -66,6 +66,13 @@ // "long long" type. // #define CMS_DONT_USE_INT64 1 +// Uncomment this one to enable large file support on file/stream I/O. +// LittleCMS is still limited by ICC 32-bit offsets and sizes, so the +// practical maximum remains 4 GiB minus profile overhead. Be careful +// because such huge profiles have to be loaded into memory and that's +// usually a very bad idea. +// #define CMS_LARGE_FILE_SUPPORT 1 + // Uncomment this if your compiler doesn't work with fast floor function // #define CMS_DONT_USE_FAST_FLOOR 1 @@ -116,7 +123,7 @@ extern "C" { #endif // Version/release -#define LCMS_VERSION 2170 +#define LCMS_VERSION 2190 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED @@ -197,6 +204,9 @@ typedef double cmsFloat64Number; #ifdef CMS_DONT_USE_INT64 typedef cmsUInt32Number cmsUInt64Number[2]; typedef cmsInt32Number cmsInt64Number[2]; +# if defined(CMS_LARGE_FILE_SUPPORT) +# error "You need int64 for large file support" +# endif #endif // Derivative types @@ -533,7 +543,13 @@ typedef enum { cmsSigLinkClass = 0x6C696E6B, // 'link' cmsSigAbstractClass = 0x61627374, // 'abst' cmsSigColorSpaceClass = 0x73706163, // 'spac' - cmsSigNamedColorClass = 0x6e6d636c // 'nmcl' + cmsSigNamedColorClass = 0x6e6d636c, // 'nmcl' + + // iccMAX only + cmsSigColorEncodingSpaceClass = 0x63656E63, // 'cenc' + cmsSigMultiplexIdentificationClass = 0x6D696420, // 'mid ' + cmsSigMultiplexLinkClass = 0x6d6c6e6b, // 'mlnk' + cmsSigMultiplexVisualizationClass = 0x6d766973 // 'mvis' } cmsProfileClassSignature; @@ -1107,8 +1123,12 @@ CMSAPI int CMSEXPORT cmsGetEncodedCMMversion(void); // Support of non-standard functions -------------------------------------------------------------------------------------- CMSAPI int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2); -CMSAPI long int CMSEXPORT cmsfilelength(FILE* f); +#ifdef CMS_LARGE_FILE_SUPPORT +CMSAPI long long int CMSEXPORT cmsfilelength(FILE* f); +#else +CMSAPI long int CMSEXPORT cmsfilelength(FILE* f); +#endif // Context handling -------------------------------------------------------------------------------------------------------- @@ -1531,6 +1551,7 @@ CMSAPI cmsHPROFILE CMSEXPORT cmsCreateProfilePlaceholder(cmsContext Contex CMSAPI cmsContext CMSEXPORT cmsGetProfileContextID(cmsHPROFILE hProfile); CMSAPI cmsInt32Number CMSEXPORT cmsGetTagCount(cmsHPROFILE hProfile); CMSAPI cmsTagSignature CMSEXPORT cmsGetTagSignature(cmsHPROFILE hProfile, cmsUInt32Number n); +CMSAPI cmsBool CMSEXPORT cmsGetTagOffsetAndSize(cmsHPROFILE hProfile, cmsUInt32Number n, cmsUInt32Number* offset, cmsUInt32Number* size); CMSAPI cmsBool CMSEXPORT cmsIsTag(cmsHPROFILE hProfile, cmsTagSignature sig); // Read and write pre-formatted data @@ -1554,6 +1575,8 @@ CMSAPI void CMSEXPORT cmsGetHeaderAttributes(cmsHPROFILE hProfile, CMSAPI void CMSEXPORT cmsGetHeaderProfileID(cmsHPROFILE hProfile, cmsUInt8Number* ProfileID); CMSAPI cmsBool CMSEXPORT cmsGetHeaderCreationDateTime(cmsHPROFILE hProfile, struct tm *Dest); CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderRenderingIntent(cmsHPROFILE hProfile); +CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderCMM(cmsHPROFILE hProfile); + CMSAPI void CMSEXPORT cmsSetHeaderFlags(cmsHPROFILE hProfile, cmsUInt32Number Flags); CMSAPI cmsUInt32Number CMSEXPORT cmsGetHeaderManufacturer(cmsHPROFILE hProfile); @@ -1896,6 +1919,13 @@ CMSAPI cmsContext CMSEXPORT cmsGetTransformContextID(cmsHTRANSFORM hTransf CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM hTransform); CMSAPI cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform); +// Access the optimized pipeline and gamut-check pipeline inside a transform. +CMSAPI cmsPipeline* CMSEXPORT cmsGetTransformPipeline(cmsHTRANSFORM hTransform); +CMSAPI cmsPipeline* CMSEXPORT cmsGetTransformGamutCheckPipeline(cmsHTRANSFORM hTransform); +// Grab colorants +CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsGetTransformInputColorants(cmsHTRANSFORM hTransform); +CMSAPI cmsNAMEDCOLORLIST* CMSEXPORT cmsGetTransformOutputColorants(cmsHTRANSFORM hTransform); + // For backwards compatibility CMSAPI cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform, cmsUInt32Number InputFormat, diff --git a/src/java.desktop/share/native/liblcms/lcms2_internal.h b/src/java.desktop/share/native/liblcms/lcms2_internal.h index d14c0dd823ea..073e497b1b85 100644 --- a/src/java.desktop/share/native/liblcms/lcms2_internal.h +++ b/src/java.desktop/share/native/liblcms/lcms2_internal.h @@ -30,7 +30,7 @@ // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -887,6 +887,7 @@ int _cmsSearchTag(_cmsICCPROFILE* Icc, cmsTagSignature sig, cms cmsTagTypeHandler* _cmsGetTagTypeHandler(cmsContext ContextID, cmsTagTypeSignature sig); cmsTagTypeSignature _cmsGetTagTrueType(cmsHPROFILE hProfile, cmsTagSignature sig); cmsTagDescriptor* _cmsGetTagDescriptor(cmsContext ContextID, cmsTagSignature sig); +cmsBool _cmsAvoidTypeCheckOnTags(cmsContext ContextID); // Error logging --------------------------------------------------------------------------------------------------------- diff --git a/src/java.desktop/share/native/liblcms/lcms2_plugin.h b/src/java.desktop/share/native/liblcms/lcms2_plugin.h index bdfc76f6bf5d..85de9bc56d5f 100644 --- a/src/java.desktop/share/native/liblcms/lcms2_plugin.h +++ b/src/java.desktop/share/native/liblcms/lcms2_plugin.h @@ -30,7 +30,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2024 Marti Maria Saguer +// Copyright (c) 1998-2026 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c b/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c index 2fa005ed20db..61ea6fdf9d3b 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c +++ b/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c @@ -1185,7 +1185,15 @@ void DGifDecreaseImageCounter(GifFileType *GifFile) { GifFreeMapObject(GifFile->SavedImages[GifFile->ImageCount].ImageDesc.ColorMap); } - // Realloc array according to the new image counter. + // Avoid a dodgy edge casse in reallocarray() */ + if (GifFile->ImageCount <= 0) { + free(GifFile->SavedImages); + GifFile->SavedImages = NULL; + GifFile->ImageCount = 0; + return; + } + + /* Realloc array according to the new image counter. */ SavedImage *correct_saved_images = (SavedImage *)reallocarray( GifFile->SavedImages, GifFile->ImageCount, sizeof(SavedImage)); if (correct_saved_images != NULL) { diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h b/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h index 64b33beefa7b..ae6d4a3caa06 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h +++ b/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h @@ -39,7 +39,7 @@ extern "C" { #define GIFLIB_MAJOR 6 #define GIFLIB_MINOR 1 -#define GIFLIB_RELEASE 2 +#define GIFLIB_RELEASE 3 #define GIF_ERROR 0 #define GIF_OK 1 diff --git a/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c b/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c index 25e039144963..38aa86569730 100644 --- a/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c +++ b/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c @@ -167,9 +167,9 @@ ColorMapObject *GifUnionColorMap(const ColorMapObject *ColorIn1, * of table 1. This is very useful if your display is limited to * 16 colors. */ - while (ColorIn1->Colors[CrntSlot - 1].Red == 0 && + while (CrntSlot > 0 && (ColorIn1->Colors[CrntSlot - 1].Red == 0 && ColorIn1->Colors[CrntSlot - 1].Green == 0 && - ColorIn1->Colors[CrntSlot - 1].Blue == 0) { + ColorIn1->Colors[CrntSlot - 1].Blue == 0)) { CrntSlot--; } diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES index ba81df0c0e61..208ca6eaf17d 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES +++ b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES @@ -6379,6 +6379,13 @@ Version 1.6.57 [April 8, 2026] Fixed integer overflow in rowbytes computation in read transforms. (Contributed by Mohammad Seet.) +Version 1.6.58 [April 15, 2026] + Fixed a regression introduced in version 1.6.56 that caused `png_get_PLTE` + to return stale palette data after applying gamma and background transforms + in-place. + (Reported by ralfjunker .) + + Send comments/corrections/commendations to png-mng-implement at lists.sf.net. Subscription is required; visit diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/README b/src/java.desktop/share/native/libsplashscreen/libpng/README index 179b8dc8cb4d..75a92ab72330 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/README +++ b/src/java.desktop/share/native/libsplashscreen/libpng/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.57 +README for libpng version 1.6.58 ================================ See the note about version numbers near the top of `png.h`. diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.c b/src/java.desktop/share/native/libsplashscreen/libpng/png.c index e4e13b0a6840..12f7ce53f34a 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/png.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.c @@ -42,7 +42,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_57 Your_png_h_is_not_version_1_6_57; +typedef png_libpng_version_1_6_58 Your_png_h_is_not_version_1_6_58; /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the * corresponding macro definitions. This causes a compile time failure if @@ -849,7 +849,7 @@ png_get_copyright(png_const_structrp png_ptr) return PNG_STRING_COPYRIGHT #else return PNG_STRING_NEWLINE \ - "libpng version 1.6.57" PNG_STRING_NEWLINE \ + "libpng version 1.6.58" PNG_STRING_NEWLINE \ "Copyright (c) 2018-2026 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.h b/src/java.desktop/share/native/libsplashscreen/libpng/png.h index 349e7d073831..86a7c8ca1b02 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/png.h +++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.h @@ -29,7 +29,7 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * libpng version 1.6.57 + * libpng version 1.6.58 * * Copyright (c) 2018-2026 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson @@ -43,7 +43,7 @@ * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.97, January 1998, through 1.6.35, July 2018: * Glenn Randers-Pehrson - * libpng versions 1.6.36, December 2018, through 1.6.57, April 2026: + * libpng versions 1.6.36, December 2018, through 1.6.58, April 2026: * Cosmin Truta * See also "Contributing Authors", below. */ @@ -267,7 +267,7 @@ * ... * 1.5.30 15 10530 15.so.15.30[.0] * ... - * 1.6.57 16 10657 16.so.16.57[.0] + * 1.6.58 16 10658 16.so.16.58[.0] * * Henceforth the source version will match the shared-library major and * minor numbers; the shared-library major version number will be used for @@ -303,7 +303,7 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.57" +#define PNG_LIBPNG_VER_STRING "1.6.58" #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" /* The versions of shared library builds should stay in sync, going forward */ @@ -314,7 +314,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 57 +#define PNG_LIBPNG_VER_RELEASE 58 /* This should be zero for a public release, or non-zero for a * development version. @@ -345,7 +345,7 @@ * From version 1.0.1 it is: * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10657 /* 1.6.57 */ +#define PNG_LIBPNG_VER 10658 /* 1.6.58 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -455,7 +455,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char *png_libpng_version_1_6_57; +typedef char *png_libpng_version_1_6_58; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h index 1a5bb7b60f8a..e035a155803a 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h @@ -29,7 +29,7 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * libpng version 1.6.57 + * libpng version 1.6.58 * * Copyright (c) 2018-2026 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h index de63c9989279..46cba507f65a 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h @@ -31,7 +31,7 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: */ -/* libpng version 1.6.57 */ +/* libpng version 1.6.58 */ /* Copyright (c) 2018-2026 Cosmin Truta */ /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c index 838c8460f910..99050080e9d1 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c @@ -2099,19 +2099,15 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr) { png_debug(1, "in png_read_transform_info"); - if (png_ptr->transformations != 0) + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + info_ptr->palette != NULL && png_ptr->palette != NULL) { - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - info_ptr->palette != NULL && png_ptr->palette != NULL) - { - /* Sync info_ptr->palette with png_ptr->palette. - * The function png_init_read_transformations may have modified - * png_ptr->palette in place (e.g. for gamma correction or for - * background compositing). - */ - memcpy(info_ptr->palette, png_ptr->palette, - PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))); - } + /* Sync info_ptr->palette with png_ptr->palette, which may + * have been modified by png_init_read_transformations + * (e.g. for gamma correction or background compositing). + */ + memcpy(info_ptr->palette, png_ptr->palette, + PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))); } #ifdef PNG_READ_EXPAND_SUPPORTED diff --git a/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c b/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c index c48b38fa1f3e..2ed575c10c7c 100644 --- a/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c +++ b/src/java.desktop/unix/native/common/java2d/opengl/GLXSurfaceData.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,8 @@ #ifndef HEADLESS +#include + extern LockFunc OGLSD_Lock; extern GetRasInfoFunc OGLSD_GetRasInfo; extern UnlockFunc OGLSD_Unlock; @@ -50,6 +52,74 @@ extern void jboolean surfaceCreationFailed = JNI_FALSE; +/** + * Per-Window GLXWindow entry with reference counting. + * Stored in an XContext keyed by the X Window XID. + */ +typedef struct { + GLXWindow glxWindow; + int refCount; +} GLXWindowRef; + +static XContext glxWindowContext; + +/** + * Gets or creates a shared GLXWindow for the given X Window. + * All callers are synchronized by the AWT lock. + */ +static GLXWindow acquireGLXWindow(Window window, GLXFBConfig fbconfig) +{ + if (glxWindowContext == 0) { + glxWindowContext = XUniqueContext(); + } + + XPointer data; + if (XFindContext(awt_display, window, glxWindowContext, &data) == 0) { + GLXWindowRef *ref = (GLXWindowRef *)data; + ref->refCount++; + return ref->glxWindow; + } + + GLXWindow glxWin = j2d_glXCreateWindow(awt_display, fbconfig, window, NULL); + if (glxWin == 0) { + return 0; + } + + GLXWindowRef *ref = malloc(sizeof(*ref)); + if (ref == NULL) { + j2d_glXDestroyWindow(awt_display, glxWin); + return 0; + } + ref->glxWindow = glxWin; + ref->refCount = 1; + if (XSaveContext(awt_display, window, glxWindowContext, (XPointer)ref) != 0) + { + j2d_glXDestroyWindow(awt_display, glxWin); + free(ref); + return 0; + } + return glxWin; +} + +/** + * Decrements the reference count for the GLXWindow associated with the given + * X Window. Destroys it when the count reaches zero. + * All callers are synchronized by the AWT lock. + */ +static void releaseGLXWindow(Window window) +{ + XPointer data; + if (XFindContext(awt_display, window, glxWindowContext, &data) != 0) { + return; + } + GLXWindowRef *ref = (GLXWindowRef *)data; + if (--ref->refCount <= 0) { + j2d_glXDestroyWindow(awt_display, ref->glxWindow); + XDeleteContext(awt_display, window, glxWindowContext); + free(ref); + } +} + #endif /* !HEADLESS */ JNIEXPORT void JNICALL @@ -74,7 +144,7 @@ Java_sun_java2d_opengl_GLXSurfaceData_initOps(JNIEnv *env, jobject glxsd, // later the graphicsConfig will be used for deallocation of oglsdo oglsdo->graphicsConfig = gc; - GLXSDOps *glxsdo = (GLXSDOps *)malloc(sizeof(GLXSDOps)); + GLXSDOps *glxsdo = (GLXSDOps *)calloc(1, sizeof(GLXSDOps)); if (glxsdo == NULL) { JNU_ThrowOutOfMemoryError(env, "creating native GLX ops"); @@ -125,8 +195,13 @@ Java_sun_java2d_opengl_GLXSurfaceData_initOps(JNIEnv *env, jobject glxsd, void OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo) { + GLXSDOps *glxsdo = (GLXSDOps *)oglsdo->privOps; J2dTraceLn(J2D_TRACE_INFO, "OGLSD_DestroyOGLSurface"); - // X Window is free'd later by AWT code... + if (glxsdo != NULL && glxsdo->drawable != 0) { + releaseGLXWindow(glxsdo->window); + glxsdo->drawable = 0; + oglsdo->drawableType = OGLSD_UNDEFINED; + } } /** @@ -296,6 +371,13 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo) return JNI_FALSE; } + glxsdo->drawable = acquireGLXWindow(window, + glxsdo->configData->glxInfo->fbconfig); + if (glxsdo->drawable == 0) { + J2dRlsTraceLn(J2D_TRACE_ERROR, "OGLSD_InitOGLWindow: GLXWindow is 0"); + return JNI_FALSE; + } + XGetWindowAttributes(awt_display, window, &attr); oglsdo->width = attr.width; oglsdo->height = attr.height; @@ -304,7 +386,6 @@ OGLSD_InitOGLWindow(JNIEnv *env, OGLSDOps *oglsdo) oglsdo->isOpaque = JNI_TRUE; oglsdo->xOffset = 0; oglsdo->yOffset = 0; - glxsdo->drawable = window; glxsdo->xdrawable = window; J2dTraceLn2(J2D_TRACE_VERBOSE, " created window: w=%d h=%d", @@ -333,7 +414,16 @@ OGLSD_SwapBuffers(JNIEnv *env, jlong window) return; } - j2d_glXSwapBuffers(awt_display, (Window)window); + XPointer data; + if (XFindContext(awt_display, (Window)window, glxWindowContext, &data) != 0) + { + J2dRlsTraceLn(J2D_TRACE_ERROR, + "OGLSD_SwapBuffers: GLXWindow not found"); + return; + } + + GLXWindowRef *ref = (GLXWindowRef *)data; + j2d_glXSwapBuffers(awt_display, ref->glxWindow); } // needed by Mac OS X port, no-op on other platforms diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java index dbc913582f2a..7cb43a5ea54d 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxMenuItemUI.java @@ -73,19 +73,20 @@ protected void paintBackground(Graphics g, JMenuItem menuItem, super.paintBackground(g, menuItem, bgColor); } - /** - * Paint MenuItem. - */ + @Override protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { if (WindowsMenuItemUI.isVistaPainting()) { - WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, - arrowIcon, background, foreground, - disabledForeground, acceleratorSelectionForeground, - acceleratorForeground, defaultTextIconGap, - menuItem, getPropertyPrefix()); + WindowsMenuItemUI.paintMenuItem(accessor, g, c, + checkIcon, arrowIcon, + background, foreground, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground, + defaultTextIconGap, + menuItem, getPropertyPrefix()); return; } super.paintMenuItem(g, c, checkIcon, arrowIcon, background, diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java index 3fc04bb93b98..417f2ab1898b 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -873,10 +873,46 @@ public void paintIcon(Component c, Graphics g, int x, int y) { XPStyle xp = XPStyle.getXP(); if (xp != null) { Skin skin = xp.getSkin(c, part); - if (icon == null || icon.getIconHeight() <= 16) { - skin.paintSkin(g, x + OFFSET, y + OFFSET, state); + if (WindowsGraphicsUtils.isLeftToRight(c)) { + if (icon == null || icon.getIconHeight() <= 16) { + skin.paintSkin(g, x + OFFSET, y + OFFSET, state); + } else { + skin.paintSkin(g, x + OFFSET, y + icon.getIconHeight() / 2, state); + } } else { - skin.paintSkin(g, x + OFFSET, y + icon.getIconHeight() / 2, state); + if (icon == null) { + skin.paintSkin(g, x + 4 * OFFSET, y + OFFSET, state); + } else { + int ycoord = (icon.getIconHeight() <= 16) + ? y + OFFSET + : (y + icon.getIconHeight() / 2); + if (icon.getIconWidth() <= 8) { + skin.paintSkin(g, x + OFFSET, ycoord, state); + } else if (icon.getIconWidth() <= 16) { + if (menuItem.getText().isEmpty()) { + skin.paintSkin(g, + (menuItem.getAccelerator() != null) + ? (x + 2 * OFFSET) : (x + 3 * OFFSET), + ycoord, state); + } else { + skin.paintSkin(g, + (type == JRadioButtonMenuItem.class) + ? (x + 4 * OFFSET) : (x + 3 * OFFSET), + ycoord, state); + } + } else { + if (menuItem.getText().isEmpty() + || menuItem.getAccelerator() != null) { + skin.paintSkin(g, + (type == JRadioButtonMenuItem.class) + ? (x + 3 * OFFSET) : (x + 4 * OFFSET), + ycoord, state); + } else { + skin.paintSkin(g, x + 7 * OFFSET, + ycoord, state); + } + } + } } } } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java index 23df6b67849e..10aadfa7cd87 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -139,19 +139,22 @@ protected void installKeyboardActions() { */ @SuppressWarnings("serial") // Superclass is not serializable across versions private static class TakeFocus extends AbstractAction { + @Override public void actionPerformed(ActionEvent e) { JMenuBar menuBar = (JMenuBar)e.getSource(); JMenu menu = menuBar.getMenu(0); if (menu != null) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); - MenuElement[] path = new MenuElement[2]; - path[0] = (MenuElement)menuBar; - path[1] = (MenuElement)menu; - msm.setSelectedPath(path); - - // show mnemonics - WindowsLookAndFeel.setMnemonicHidden(false); + MenuElement[] selectedPath = msm.getSelectedPath(); + if (selectedPath.length > 0 && (selectedPath[0] instanceof JMenuBar)) { + msm.clearSelectedPath(); + WindowsLookAndFeel.setMnemonicHidden(true); + } else { + MenuElement[] path = {menuBar, menu}; + msm.setSelectedPath(path); + WindowsLookAndFeel.setMnemonicHidden(false); + } WindowsLookAndFeel.repaintRootPane(menuBar); } } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java index 0fa284294e27..de9a5afa547e 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,16 +29,11 @@ import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; -import java.awt.Insets; import java.awt.Rectangle; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.util.Enumeration; -import javax.swing.AbstractButton; -import javax.swing.ButtonGroup; import javax.swing.ButtonModel; -import javax.swing.DefaultButtonModel; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JMenu; @@ -129,27 +124,6 @@ public void propertyChange(PropertyChangeEvent e) { menuItem.addPropertyChangeListener(changeListener); } - protected void installDefaults() { - super.installDefaults(); - String prefix = getPropertyPrefix(); - - if (acceleratorSelectionForeground == null || - acceleratorSelectionForeground instanceof UIResource) { - acceleratorSelectionForeground = - UIManager.getColor(prefix + ".acceleratorSelectionForeground"); - } - if (acceleratorForeground == null || - acceleratorForeground instanceof UIResource) { - acceleratorForeground = - UIManager.getColor(prefix + ".acceleratorForeground"); - } - if (disabledForeground == null || - disabledForeground instanceof UIResource) { - disabledForeground = - UIManager.getColor(prefix + ".disabledForeground"); - } - } - /** * {@inheritDoc} */ @@ -162,15 +136,19 @@ protected void uninstallListeners() { changeListener = null; } + @Override protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { if (WindowsMenuItemUI.isVistaPainting()) { - WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, - arrowIcon, background, foreground, - disabledForeground, acceleratorSelectionForeground, - acceleratorForeground, defaultTextIconGap, menuItem, + WindowsMenuItemUI.paintMenuItem(accessor, g, c, + checkIcon, arrowIcon, + background, foreground, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground, + defaultTextIconGap, menuItem, getPropertyPrefix()); return; } @@ -179,12 +157,16 @@ protected void paintMenuItem(Graphics g, JComponent c, } static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, - JComponent c, Icon checkIcon, Icon arrowIcon, + JComponent c, + Icon checkIcon, Icon arrowIcon, Color background, Color foreground, Color disabledForeground, Color acceleratorSelectionForeground, Color acceleratorForeground, - int defaultTextIconGap, JMenuItem menuItem, String prefix) { + int defaultTextIconGap, JMenuItem menuItem, + String prefix) { + assert c == menuItem : "menuItem passed as 'c' must be the same"; + // Save original graphics font and color Font holdf = g.getFont(); Color holdc = g.getColor(); @@ -252,6 +234,15 @@ static void paintMenuItem(WindowsMenuItemUIAccessor accessor, Graphics g, SwingUtilities3.paintAccText(g, lh, lr, disabledForeground, acceleratorSelectionForeground, acceleratorForeground); + if (lh.getCheckIcon() != null && lh.useCheckAndArrow()) { + Rectangle rect = lr.getArrowRect(); + if (menuItem.getComponentOrientation().isLeftToRight()) { + rect.x += lh.getAfterCheckIconGap(); + } else { + rect.x -= lh.getAfterCheckIconGap(); + } + lr.setArrowRect(rect); + } SwingUtilities3.paintArrowIcon(g, lh, lr, foreground); // Restore original graphics font and color diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java index d2d07fd79502..d4e1d1a95301 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java @@ -127,18 +127,20 @@ protected void installDefaults() { hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true; } - /** - * Paint MenuItem. - */ + @Override protected void paintMenuItem(Graphics g, JComponent c, - Icon checkIcon, Icon arrowIcon, - Color background, Color foreground, - int defaultTextIconGap) { + Icon checkIcon, Icon arrowIcon, + Color background, Color foreground, + int defaultTextIconGap) { + assert c == menuItem : "menuItem passed as 'c' must be the same"; if (WindowsMenuItemUI.isVistaPainting()) { - WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, arrowIcon, + WindowsMenuItemUI.paintMenuItem(accessor, g, c, + checkIcon, arrowIcon, background, foreground, - disabledForeground, acceleratorSelectionForeground, - acceleratorForeground, defaultTextIconGap, menuItem, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground, + defaultTextIconGap, menuItem, getPropertyPrefix()); return; } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java index 4ca4517638a1..31ed16c77a21 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonMenuItemUI.java @@ -73,19 +73,20 @@ protected void paintBackground(Graphics g, JMenuItem menuItem, super.paintBackground(g, menuItem, bgColor); } - /** - * Paint MenuItem. - */ + @Override protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap) { if (WindowsMenuItemUI.isVistaPainting()) { - WindowsMenuItemUI.paintMenuItem(accessor, g, c, checkIcon, - arrowIcon, background, foreground, - disabledForeground, acceleratorSelectionForeground, - acceleratorForeground, defaultTextIconGap, - menuItem, getPropertyPrefix()); + WindowsMenuItemUI.paintMenuItem(accessor, g, c, + checkIcon, arrowIcon, + background, foreground, + disabledForeground, + acceleratorSelectionForeground, + acceleratorForeground, + defaultTextIconGap, + menuItem, getPropertyPrefix()); return; } super.paintMenuItem(g, c, checkIcon, arrowIcon, background, diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java index 85b4866e2323..5e0e8e44b75d 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1742,6 +1742,12 @@ private void setRangeCopiesAttribute(int from, int to, boolean isRangeSet, if (isRangeSet) { attributes.add(new PageRanges(from, to)); setPageRange(from, to); + } else { + // Sets default values for PageRange attribute and setPageRange + attributes.add(new PageRanges(1, + Integer.MAX_VALUE)); + setPageRange(Pageable.UNKNOWN_NUMBER_OF_PAGES, + Pageable.UNKNOWN_NUMBER_OF_PAGES); } defaultCopies = false; attributes.add(new Copies(copies)); diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp index ebb43b2f0789..ba69fa75f734 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,6 +92,8 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute if (wcscmp(verb_c, L"open") == 0) { BOOL isExecutable = SaferiIsExecutableFileType(fileOrUri_c, FALSE); if (isExecutable) { + JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c); + JNU_ReleaseStringPlatformChars(env, verb_j, verb_c); return env->NewStringUTF("Unsupported URI content"); } } diff --git a/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java b/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java index 39a787bf4fb7..6c204d89c637 100644 --- a/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java +++ b/src/java.naming/share/classes/sun/security/provider/certpath/ldap/LDAPCertStoreImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,6 +52,7 @@ import sun.security.provider.certpath.X509CertificatePair; import sun.security.util.Cache; import sun.security.util.Debug; +import sun.security.util.SecurityProperties; /** * Core implementation of a LDAP Cert Store. @@ -96,6 +97,16 @@ final class LDAPCertStoreImpl { private static final String PROP_DISABLE_APP_RESOURCE_FILES = "sun.security.certpath.ldap.disable.app.resource.files"; + /** + * Maximum size for a CRL downloaded through an LDAPCertStoreImpl + * in bytes. This can be controlled by the com.sun.security.crl.maxSize + * Security or System property. The System property, if set, overrides + * the Security property. The default size is 20MiB. + */ + private static final long MAX_CRL_DOWNLOAD_SIZE = + SecurityProperties.getOverridableLongProp( + "com.sun.security.crl.maxSize", 20971520, debug); + static { @SuppressWarnings("removal") String s = AccessController.doPrivileged( @@ -105,6 +116,13 @@ final class LDAPCertStoreImpl { } else { LIFETIME = DEFAULT_CACHE_LIFETIME; } + + // Add a debug message for the configured CRL download limit + if (debug != null) { + debug.println("Maximum downloadable CRL size: " + + MAX_CRL_DOWNLOAD_SIZE + + ((MAX_CRL_DOWNLOAD_SIZE < 0) ? " (DISABLED)" : "")); + } } /** @@ -675,12 +693,12 @@ private Collection getMatchingCrossCerts( return certs; } - /* + /** * Gets CRLs from an attribute id and location in the LDAP directory. * Returns a Collection containing only the CRLs that match the * specified X509CRLSelector. * - * @param name the location holding the attribute + * @param request the LDAP request used for this CRL fetch operation * @param id the attribute identifier * @param sel a X509CRLSelector that the CRLs must match * @return a Collection of CRLs found @@ -692,7 +710,26 @@ private Collection getCRLs(LDAPRequest request, String id, /* fetch the encoded crls from storage */ byte[][] encodedCRL; try { - encodedCRL = request.getValues(id); + byte[][] tmpCrls = request.getValues(id); + if (MAX_CRL_DOWNLOAD_SIZE > -1) { + int totalSize = 0; + for (byte[] tCrl : tmpCrls) { + totalSize += tCrl.length; + } + if (totalSize <= MAX_CRL_DOWNLOAD_SIZE) { + encodedCRL = tmpCrls; + } else { + if (debug != null) { + debug.println("Received " + tmpCrls.length + + " CRL(s). Combined length of " + totalSize + + " exceeds configured maximum. Discarding."); + } + encodedCRL = new byte[0][]; + } + } else { + // Download limits disabled + encodedCRL = tmpCrls; + } } catch (NamingException namingEx) { throw new CertStoreException(namingEx); } diff --git a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java index fc01f006e976..7bff17a455fa 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -55,7 +55,7 @@ * serializers (xml, html, text ...) that write output to a stream. * * @xsl.usage internal - * @LastModified: Mar 2022 + * @LastModified: Feb 2025 */ abstract public class ToStream extends SerializerBase { @@ -955,7 +955,7 @@ protected int writeUTF16Surrogate(char c, char ch[], int i, int end) throws IOException, SAXException { int status = -1; - if (i + 1 >= end) + if (i + 1 >= end && m_highSurrogate == 0) { m_highSurrogate = c; return status; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index f35c847b98e6..cdf08cd4aa75 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -4295,7 +4295,7 @@ public void checkImportedPackagesObservable(final JCCompilationUnit toplevel) { TypeSymbol tsym = imp.qualid.selected.type.tsym; if (tsym.kind == PCK && tsym.members().isEmpty() && !(Feature.IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES.allowedInSource(source) && tsym.exists())) { - log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, Errors.DoesntExist(tsym)); + log.error(DiagnosticFlag.RESOLVE_ERROR, imp.qualid.selected.pos(), Errors.DoesntExist(tsym)); } } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java index c83768dc693e..568b8a426553 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -764,15 +764,24 @@ public void run () { requestLine, "Bad request line"); return; } - String uriStr = requestLine.substring (start, space); + + // Read the request URI + String uriStr = requestLine.substring(start, space); + // Reject ambiguous URIs + if (uriStr.startsWith("//")) { + reject(Code.HTTP_BAD_REQUEST, + requestLine, "Bad request URI"); + return; + } URI uri; try { uri = new URI (uriStr); } catch (URISyntaxException e3) { reject(Code.HTTP_BAD_REQUEST, - requestLine, "URISyntaxException thrown"); + requestLine, "Bad request URI"); return; } + start = space+1; String version = requestLine.substring (start); Headers headers = req.headers(); diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java index b3dc1ff5f4ad..aceb72f911f2 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -114,16 +114,22 @@ private void handleGET(HttpExchange exchange, Path path) throws IOException { private void handleSupportedMethod(HttpExchange exchange, Path path, boolean writeBody) throws IOException { + boolean requestURIEndsWithSlash = pathEndsWithSlash(exchange); if (Files.isDirectory(path)) { - if (missingSlash(exchange)) { + if (!requestURIEndsWithSlash) { handleMovedPermanently(exchange); return; } - if (indexFile(path) != null) { - serveFile(exchange, indexFile(path), writeBody); + Path indexFile = indexFile(path); + if (indexFile != null) { + serveFile(exchange, indexFile, writeBody); } else { listFiles(exchange, path, writeBody); } + } + // Disallow non-directory paths ending with slash + else if (requestURIEndsWithSlash) { + handleNotFound(exchange); } else { serveFile(exchange, path, writeBody); } @@ -134,10 +140,6 @@ private void handleMovedPermanently(HttpExchange exchange) throws IOException { exchange.sendResponseHeaders(301, -1); } - private void handleForbidden(HttpExchange exchange) throws IOException { - exchange.sendResponseHeaders(403, -1); - } - private void handleNotFound(HttpExchange exchange) throws IOException { String fileNotFound = ResourceBundleHelper.getMessage("html.not.found"); var bytes = (openHTML @@ -169,8 +171,8 @@ private String getRedirectURI(URI uri) { return query == null ? redirectPath : redirectPath + "?" + query; } - private static boolean missingSlash(HttpExchange exchange) { - return !exchange.getRequestURI().getPath().endsWith("/"); + private static boolean pathEndsWithSlash(HttpExchange exchange) { + return exchange.getRequestURI().getPath().endsWith("/"); } private static String contextPath(HttpExchange exchange) { diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java index bc513f5f636a..ca1c34ef4eed 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/LineReader.java @@ -10,6 +10,7 @@ import java.io.File; import java.io.InputStream; +import java.nio.file.Path; import java.util.Collection; import java.util.Map; import java.util.function.IntConsumer; @@ -766,7 +767,11 @@ String readLine(String prompt, String rightPrompt, MaskingCallback maskingCallba void addCommandsInBuffer(Collection commands); - void editAndAddInBuffer(File file) throws Exception; + default void editAndAddInBuffer(File file) throws Exception { + editAndAddInBuffer(file != null ? file.toPath() : null); + } + + void editAndAddInBuffer(Path file) throws Exception; String getLastBinding(); diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/UserInterruptException.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/UserInterruptException.java index 68bec8041faa..e5bc5b3180c6 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/UserInterruptException.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/UserInterruptException.java @@ -19,6 +19,11 @@ public class UserInterruptException extends RuntimeException { private final String partialLine; + public UserInterruptException(Throwable cause) { + super(cause); + this.partialLine = null; + } + public UserInterruptException(String partialLine) { this.partialLine = partialLine; } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/DefaultHighlighter.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/DefaultHighlighter.java index 55d39efde27d..87bf06d00734 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/DefaultHighlighter.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/DefaultHighlighter.java @@ -38,6 +38,7 @@ public AttributedString highlight(LineReader reader, String buffer) { int underlineEnd = -1; int negativeStart = -1; int negativeEnd = -1; + boolean first = true; String search = reader.getSearchTerm(); if (search != null && search.length() > 0) { underlineStart = buffer.indexOf(search); @@ -65,6 +66,7 @@ public AttributedString highlight(LineReader reader, String buffer) { } AttributedStringBuilder sb = new AttributedStringBuilder(); + commandStyle(reader, sb, true); for (int i = 0; i < buffer.length(); i++) { if (i == underlineStart) { sb.style(AttributedStyle::underline); @@ -77,6 +79,10 @@ public AttributedString highlight(LineReader reader, String buffer) { } char c = buffer.charAt(i); + if (first && Character.isSpaceChar(c)) { + first = false; + commandStyle(reader, sb, false); + } if (c == '\t' || c == '\n') { sb.append(c); } else if (c < 32) { @@ -105,4 +111,6 @@ public AttributedString highlight(LineReader reader, String buffer) { } return sb.toAttributedString(); } + + protected void commandStyle(LineReader reader, AttributedStringBuilder sb, boolean enable) {} } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java index da69d08b23c8..302254ab61fa 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/LineReaderImpl.java @@ -10,7 +10,6 @@ import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; import java.io.FileWriter; import java.io.Flushable; import java.io.IOError; @@ -1131,16 +1130,16 @@ public void addCommandsInBuffer(Collection commands) { } @Override - public void editAndAddInBuffer(File file) throws Exception { + public void editAndAddInBuffer(Path file) throws Exception { if (isSet(Option.BRACKETED_PASTE)) { terminal.writer().write(BRACKETED_PASTE_OFF); } - Constructor ctor = Class.forName("org.jline.builtins.Nano").getConstructor(Terminal.class, File.class); - Editor editor = (Editor) ctor.newInstance(terminal, new File(file.getParent())); + Constructor ctor = Class.forName("org.jline.builtins.Nano").getConstructor(Terminal.class, Path.class); + Editor editor = (Editor) ctor.newInstance(terminal, file.getParent()); editor.setRestricted(true); - editor.open(Collections.singletonList(file.getName())); + editor.open(Collections.singletonList(file.getFileName().toString())); editor.run(); - try (BufferedReader br = new BufferedReader(new FileReader(file))) { + try (BufferedReader br = Files.newBufferedReader(file)) { String line; commandsBuffer.clear(); while ((line = br.readLine()) != null) { @@ -3529,7 +3528,7 @@ protected boolean viPutAfter() { buf.move(1); putString(yankBuffer); buf.move(-yankBuffer.length()); - } else if (yankBuffer.length() != 0) { + } else if (!yankBuffer.isEmpty()) { if (buf.cursor() < buf.length()) { buf.move(1); } @@ -3547,7 +3546,7 @@ protected boolean viPutBefore() { ; putString(yankBuffer); buf.move(-yankBuffer.length()); - } else if (yankBuffer.length() != 0) { + } else if (!yankBuffer.isEmpty()) { if (buf.cursor() > 0) { buf.move(-1); } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/completer/SystemCompleter.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/completer/SystemCompleter.java index 2fe6f8df4921..642cf275142a 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/completer/SystemCompleter.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/completer/SystemCompleter.java @@ -9,6 +9,8 @@ package jdk.internal.org.jline.reader.impl.completer; import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; import jdk.internal.org.jline.reader.Candidate; import jdk.internal.org.jline.reader.Completer; @@ -24,6 +26,7 @@ public class SystemCompleter implements Completer { private Map> completers = new HashMap<>(); private Map aliasCommand = new HashMap<>(); + private Map descriptions = new HashMap<>(); private StringsCompleter commands; private boolean compiled = false; @@ -124,6 +127,10 @@ private Map getAliases() { } public void compile() { + compile(s -> new Candidate(AttributedString.stripAnsi(s), s, null, null, null, null, true)); + } + + public void compile(Function candidateBuilder) { if (compiled) { return; } @@ -139,7 +146,7 @@ public void compile() { completers = compiledCompleters; Set cmds = new HashSet<>(completers.keySet()); cmds.addAll(aliasCommand.keySet()); - commands = new StringsCompleter(cmds); + commands = new StringsCompleter(cmds.stream().map(candidateBuilder).collect(Collectors.toList())); compiled = true; } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/history/DefaultHistory.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/history/DefaultHistory.java index c696b33ba9e5..ca275c43c6da 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/history/DefaultHistory.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/reader/impl/history/DefaultHistory.java @@ -200,7 +200,7 @@ public void purge() throws IOException { public void write(Path file, boolean incremental) throws IOException { Path path = file != null ? file : getPath(); if (path != null && Files.exists(path)) { - path.toFile().delete(); + Files.deleteIfExists(path); } internalWrite(path, incremental ? getLastLoaded(path) : 0); } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/TerminalBuilder.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/TerminalBuilder.java index 3b02ec2d8d8a..d66b124448e3 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/TerminalBuilder.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/TerminalBuilder.java @@ -209,41 +209,85 @@ public TerminalBuilder systemOutput(SystemOutput systemOutput) { return this; } + /** + * Forces the usage of the give terminal provider. + * + * @param provider The {@link TerminalProvider}'s name to use when creating the Terminal. + * @return The builder. + */ public TerminalBuilder provider(String provider) { this.provider = provider; return this; } + /** + * Sets the list of providers to try when creating the terminal. + * If not specified, the system property {@link #PROP_PROVIDERS} will be used if set. + * Else, the value {@link #PROP_PROVIDERS_DEFAULT} will be used. + * + * @param providers The list of {@link TerminalProvider}'s names to check when creating the Terminal. + * @return The builder. + */ public TerminalBuilder providers(String providers) { this.providers = providers; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_JNA}/{@code jna} terminal provider. + * If not specified, the system property {@link #PROP_JNA} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder jna(boolean jna) { this.jna = jna; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_JANSI}/{@code jansi} terminal provider. + * If not specified, the system property {@link #PROP_JANSI} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder jansi(boolean jansi) { this.jansi = jansi; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_JNI}/{@code jni} terminal provider. + * If not specified, the system property {@link #PROP_JNI} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder jni(boolean jni) { this.jni = jni; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_EXEC}/{@code exec} terminal provider. + * If not specified, the system property {@link #PROP_EXEC} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder exec(boolean exec) { this.exec = exec; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_FFM}/{@code ffm} terminal provider. + * If not specified, the system property {@link #PROP_FFM} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder ffm(boolean ffm) { this.ffm = ffm; return this; } + /** + * Enables or disables the {@link #PROP_PROVIDER_DUMB}/{@code dumb} terminal provider. + * If not specified, the system property {@link #PROP_DUMB} will be used if set. + * If not specified, the provider will be checked. + */ public TerminalBuilder dumb(boolean dumb) { this.dumb = dumb; return this; diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractPosixTerminal.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractPosixTerminal.java index 5d000d070837..862bf93cd46a 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractPosixTerminal.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractPosixTerminal.java @@ -94,4 +94,13 @@ public TerminalProvider getProvider() { public SystemStream getSystemStream() { return getPty().getSystemStream(); } + + @Override + public String toString() { + return getKind() + "[" + "name='" + + name + '\'' + ", pty='" + + pty + '\'' + ", type='" + + type + '\'' + ", size='" + + getSize() + '\'' + ']'; + } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java index 2608e2e5f37c..34b070487908 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/AbstractTerminal.java @@ -287,4 +287,12 @@ public boolean paused() { public ColorPalette getPalette() { return palette; } + + @Override + public String toString() { + return getKind() + "[" + "name='" + + name + '\'' + ", type='" + + type + '\'' + ", size='" + + getSize() + '\'' + ']'; + } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/Diag.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/Diag.java index dc54ea2157d8..7b7d17499b6a 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/Diag.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/Diag.java @@ -10,7 +10,7 @@ import java.io.PrintStream; import java.nio.charset.StandardCharsets; -import java.util.ServiceLoader; +import java.util.Arrays; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.TimeUnit; @@ -24,10 +24,26 @@ public class Diag { public static void main(String[] args) { - diag(System.out); + diag(System.out, Arrays.asList(args).contains("--verbose")); } public static void diag(PrintStream out) { + diag(out, true); + } + + public static void diag(PrintStream out, boolean verbose) { + new Diag(out, verbose).run(); + } + + private final PrintStream out; + private final boolean verbose; + + public Diag(PrintStream out, boolean verbose) { + this.out = out; + this.verbose = verbose; + } + + public void run() { out.println("System properties"); out.println("================="); out.println("os.name = " + System.getProperty("os.name")); @@ -56,9 +72,9 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("ffm"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("FFM support not available: " + t); + error("FFM support not available", t); } out.println(); @@ -66,9 +82,9 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("jna"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("JNA support not available: " + t); + error("JNA support not available", t); } out.println(); @@ -76,9 +92,9 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("jansi"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("Jansi 2 support not available: " + t); + error("Jansi 2 support not available", t); } out.println(); @@ -86,9 +102,9 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("jni"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("JNI support not available: " + t); + error("JNI support not available", t); } out.println(); @@ -97,26 +113,31 @@ public static void diag(PrintStream out) { out.println("================="); try { TerminalProvider provider = TerminalProvider.load("exec"); - testProvider(out, provider); + testProvider(provider); } catch (Throwable t) { - out.println("Exec support not available: " + t); + error("Exec support not available", t); + } + + if (!verbose) { + out.println(); + out.println("Run with --verbose argument to print stack traces"); } } - private static void testProvider(PrintStream out, TerminalProvider provider) { + private void testProvider(TerminalProvider provider) { try { out.println("StdIn stream = " + provider.isSystemStream(SystemStream.Input)); out.println("StdOut stream = " + provider.isSystemStream(SystemStream.Output)); out.println("StdErr stream = " + provider.isSystemStream(SystemStream.Error)); - } catch (Throwable t2) { - out.println("Unable to check stream: " + t2); + } catch (Throwable t) { + error("Unable to check stream", t); } try { out.println("StdIn stream name = " + provider.systemStreamName(SystemStream.Input)); out.println("StdOut stream name = " + provider.systemStreamName(SystemStream.Output)); out.println("StdErr stream name = " + provider.systemStreamName(SystemStream.Error)); - } catch (Throwable t2) { - out.println("Unable to check stream names: " + t2); + } catch (Throwable t) { + error("Unable to check stream names", t); } try (Terminal terminal = provider.sysTerminal( "diag", @@ -132,9 +153,14 @@ private static void testProvider(PrintStream out, TerminalProvider provider) { Attributes attr = terminal.enterRawMode(); try { out.println("Terminal size: " + terminal.getSize()); - ForkJoinTask t = - new ForkJoinPool(1).submit(() -> terminal.reader().read(1)); - int r = t.get(1000, TimeUnit.MILLISECONDS); + ForkJoinPool forkJoinPool = new ForkJoinPool(1); + try { + ForkJoinTask t = + forkJoinPool.submit(() -> terminal.reader().read(1)); + t.get(1000, TimeUnit.MILLISECONDS); + } finally { + forkJoinPool.shutdown(); + } StringBuilder sb = new StringBuilder(); sb.append("The terminal seems to work: "); sb.append("terminal ").append(terminal.getClass().getName()); @@ -146,22 +172,25 @@ private static void testProvider(PrintStream out, TerminalProvider provider) { .getName()); } out.println(sb); - } catch (Throwable t3) { - out.println("Unable to read from terminal: " + t3); - t3.printStackTrace(); + } catch (Throwable t2) { + error("Unable to read from terminal", t2); } finally { terminal.setAttributes(attr); } } else { out.println("Not supported by provider"); } - } catch (Throwable t2) { - out.println("Unable to open terminal: " + t2); - t2.printStackTrace(); + } catch (Throwable t) { + error("Unable to open terminal", t); } } - static S load(Class clazz) { - return ServiceLoader.load(clazz, clazz.getClassLoader()).iterator().next(); + private void error(String message, Throwable cause) { + if (verbose) { + out.println(message); + cause.printStackTrace(out); + } else { + out.println(message + ": " + cause); + } } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecPty.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecPty.java index c0a35cbd6a21..f21920160d6b 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecPty.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecPty.java @@ -278,7 +278,7 @@ static int doGetInt(String name, String cfg) throws IOException { return Integer.parseInt(matcher.group(1)); } } - throw new IOException("Unable to parse " + name); + return 0; } @Override diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecTerminalProvider.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecTerminalProvider.java index 36ff4a63579c..96be98e851e5 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecTerminalProvider.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/terminal/impl/exec/ExecTerminalProvider.java @@ -46,6 +46,9 @@ public String name() { } public Pty current(SystemStream systemStream) throws IOException { + if (!isSystemStream(systemStream)) { + throw new IOException("Not a system stream: " + systemStream); + } return ExecPty.current(this, systemStream); } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Display.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Display.java index 557024a121ed..6a942048a865 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Display.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Display.java @@ -217,7 +217,8 @@ public void update(List newLines, int targetCursorPos, boolean cursorPos++; if (newLength == 0 || newLine.isHidden(0)) { // go to next line column zero - rawPrint(new AttributedString(" \b")); + rawPrint(' '); + terminal.puts(Capability.key_backspace); } else { AttributedString firstChar = newLine.substring(0, 1); // go to next line column one @@ -317,7 +318,8 @@ public void update(List newLines, int targetCursorPos, boolean } else if (atRight) { if (this.wrapAtEol) { if (!fullScreen || (fullScreen && lineIndex < numLines)) { - terminal.writer().write(" \b"); + rawPrint(' '); + terminal.puts(Capability.key_backspace); cursorPos++; } } else { diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/InputStreamReader.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/InputStreamReader.java index 449d6aa69c85..1198da4fe82d 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/InputStreamReader.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/InputStreamReader.java @@ -22,8 +22,7 @@ import java.nio.charset.MalformedInputException; import java.nio.charset.UnmappableCharacterException; -/** - * +/* * NOTE for JLine: the default InputStreamReader that comes from the JRE * usually read more bytes than needed from the input stream, which * is not usable in a character per character model used in the terminal. diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Status.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Status.java index 7348b1ea1c5f..d0ea5ef8962f 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Status.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/Status.java @@ -48,7 +48,8 @@ public Status(Terminal terminal) { this.supported = terminal.getStringCapability(Capability.change_scroll_region) != null && terminal.getStringCapability(Capability.save_cursor) != null && terminal.getStringCapability(Capability.restore_cursor) != null - && terminal.getStringCapability(Capability.cursor_address) != null; + && terminal.getStringCapability(Capability.cursor_address) != null + && isValid(terminal.getSize()); if (supported) { display = new MovingCursorDisplay(terminal); resize(); @@ -57,6 +58,10 @@ public Status(Terminal terminal) { } } + private boolean isValid(Size size) { + return size.getRows() > 0 && size.getRows() < 1000 && size.getColumns() > 0 && size.getColumns() < 1000; + } + public void close() { terminal.puts(Capability.save_cursor); terminal.puts(Capability.change_scroll_region, 0, display.rows - 1); @@ -147,6 +152,7 @@ public void update(List lines, boolean flush) { if (newScrollRegion < scrollRegion) { // We need to scroll up to grow the status bar terminal.puts(Capability.save_cursor); + terminal.puts(Capability.cursor_address, scrollRegion, 0); for (int i = newScrollRegion; i < scrollRegion; i++) { terminal.puts(Capability.cursor_down); } diff --git a/src/jdk.internal.le/share/legal/jline.md b/src/jdk.internal.le/share/legal/jline.md index 5b813c0af2fa..17392e93659e 100644 --- a/src/jdk.internal.le/share/legal/jline.md +++ b/src/jdk.internal.le/share/legal/jline.md @@ -1,4 +1,4 @@ -## JLine v3.26.1 +## JLine v3.29.0 ### JLine License
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java
index 9429d6e5c940..994735e89fe7 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/MetadataRepository.java
@@ -277,7 +277,7 @@ private byte[] getBinaryRepresentation() {
         }
     }
 
-    synchronized boolean isEnabled(String eventName) {
+    boolean isEnabled(String eventName) {
         return settingsManager.isEnabled(eventName);
     }
 
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java
index c94f7e57d7ba..020f06ff041b 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/SettingsManager.java
@@ -128,7 +128,7 @@ public void finish() {
         }
     }
 
-   private Map availableSettings = new LinkedHashMap<>();
+    private volatile Map availableSettings = new LinkedHashMap<>();
 
     void setSettings(List> activeSettings, boolean writeSettingEvents) {
         // store settings so they are available if a new event class is loaded
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ParserFactory.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ParserFactory.java
index e7dd234ca8d0..c973dadb3b7f 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ParserFactory.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ParserFactory.java
@@ -132,9 +132,12 @@ private Parser createPrimitiveParser(Type type, boolean event) throws IOExceptio
             case "short" -> new ShortParser();
             case "byte" ->  new ByteParser();
             case "java.lang.String" -> {
-                ConstantMap pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type);
-                ConstantLookup lookup = new ConstantLookup(pool, type);
-                constantLookups.put(type.getId(), lookup);
+                ConstantLookup lookup = constantLookups.get(type.getId());
+                if (lookup == null) {
+                    ConstantMap pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type);
+                    lookup = new ConstantLookup(pool, type);
+                    constantLookups.put(type.getId(), lookup);
+                }
                 yield new StringParser(lookup, event);
             }
             default ->  throw new IOException("Unknown primitive type " + type.getName());
diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
index 0ff0c75efd46..1de13400338b 100644
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
@@ -1290,6 +1290,9 @@ private String getInput(String initial) throws IOException{
                 continue;
             }
             if (line == null) {
+                if (!src.isEmpty()) {
+                    errormsg("jshell.err.incomplete.input", src);
+                }
                 //EOF
                 if (input.interactiveOutput()) {
                     // End after user ctrl-D
diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties
index 56af7e2b7433..26f20ad8d70b 100644
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties
@@ -169,6 +169,7 @@ jshell.err.exception.thrown = Exception {0}
 jshell.err.exception.thrown.message = Exception {0}: {1}
 jshell.err.exception.cause = Caused by: {0}
 jshell.err.exception.cause.message = Caused by: {0}: {1}
+jshell.err.incomplete.input = Incomplete input: {0}
 
 jshell.console.see.synopsis = 
 jshell.console.see.full.documentation = 
diff --git a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java
index 007f0d4f7351..663ca164a3de 100644
--- a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java
+++ b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java
@@ -190,7 +190,7 @@ static enum TK {
         EOF(TokenKind.EOF, 0),  //
         ERROR(TokenKind.ERROR, XERRO),  //
         IDENTIFIER(TokenKind.IDENTIFIER, XEXPR1|XDECL1|XTERM),  //
-        UNDERSCORE(TokenKind.UNDERSCORE, XERRO),  //  _
+        UNDERSCORE(TokenKind.UNDERSCORE, XDECL1|XEXPR),  //  _
         CLASS(TokenKind.CLASS, XEXPR|XDECL1|XBRACESNEEDED),  //  class decl (MAPPED: DOTCLASS)
         MONKEYS_AT(TokenKind.MONKEYS_AT, XEXPR|XDECL1),  //  @
         IMPORT(TokenKind.IMPORT, XDECL1|XSTART),  //  import -- consider declaration
diff --git a/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java b/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java
index f18fa429339b..0c80b6d43881 100644
--- a/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java
+++ b/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,9 +148,9 @@ public String toString() {
                 ",previousStatus=" + previousStatus +
                 ",status=" + status +
                 ",isSignatureChange=" + isSignatureChange +
-                ",causeSnippet" + causeSnippet +
-                (value == null? "" : "value=" + value) +
-                (exception == null? "" : "exception=" + exception) +
+                ",causeSnippet=" + causeSnippet +
+                (value == null? "" : ",value=" + value) +
+                (exception == null? "" : ",exception=" + exception) +
                 ")";
     }
 }
diff --git a/src/jdk.jshell/share/classes/jdk/jshell/execution/impl/ConsoleImpl.java b/src/jdk.jshell/share/classes/jdk/jshell/execution/impl/ConsoleImpl.java
index 202f29e3140a..fb171f232ba5 100644
--- a/src/jdk.jshell/share/classes/jdk/jshell/execution/impl/ConsoleImpl.java
+++ b/src/jdk.jshell/share/classes/jdk/jshell/execution/impl/ConsoleImpl.java
@@ -329,7 +329,9 @@ public synchronized void write(int b) throws IOException {
                 buffer = Arrays.copyOf(buffer, 2 * buffer.length);
             }
 
-            buffer[bp++] = b;
+            // Can be negative because widening from byte in write(byte[], int, int).
+            // java.io.OutputStream.write(int b) stipulates "The 24 high-order bits of b are ignored."
+            buffer[bp++] = b & 0xff;
 
             switch (Task.values()[buffer[0]]) {
                 case WRITE_CHARS -> {
@@ -346,7 +348,7 @@ public synchronized void write(int b) throws IOException {
                 }
                 case READ_CHARS -> {
                     if (bp >= 5) {
-                        int len = readInt(b);
+                        int len = readInt(1);
                         int c = console.reader().read();
                         //XXX: EOF handling!
                         sendChars(sinkOutput, new char[] {(char) c}, 0, 1);
diff --git a/src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java b/src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java
index a4c35941081a..5a8927850863 100644
--- a/src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java
+++ b/src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java
@@ -101,10 +101,12 @@ static final class RemoteSettings implements EventSettingsModifier {
 
         private final FlightRecorderMXBean mbean;
         private final long recordingId;
+        private final String identifier;
 
-        RemoteSettings(FlightRecorderMXBean mbean, long recordingId) {
+        RemoteSettings(FlightRecorderMXBean mbean, long recordingId, String identifier) {
             this.mbean = mbean;
             this.recordingId = recordingId;
+            this.identifier = identifier;
         }
 
         @Override
@@ -114,7 +116,7 @@ public void with(String name, String value) {
             // FlightRecorderMXBean implementation always returns
             // new instance of Map so no need to create new here.
             Map newSettings = getEventSettings();
-            newSettings.put(name, value);
+            newSettings.put(identifier + "#" + name, value);
             mbean.setRecordingSettings(recordingId, newSettings);
         }
 
@@ -356,9 +358,9 @@ public void setSettings(Map settings) {
      */
     public EventSettings disable(String name) {
         Objects.requireNonNull(name, "name");
-        EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId));
+        EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId, name));
         try {
-            return s.with(name + "#" + ENABLED, "false");
+            return s.with(ENABLED, "false");
         } catch (Exception e) {
             ManagementSupport.logDebug(e.getMessage());
             close();
@@ -380,9 +382,9 @@ public EventSettings disable(String name) {
      */
     public EventSettings enable(String name) {
         Objects.requireNonNull(name, "name");
-        EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId));
+        EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId, name));
         try {
-            return s.with(name + "#" + ENABLED, "true");
+            return s.with(ENABLED, "true");
         } catch (Exception e) {
             ManagementSupport.logDebug(e.getMessage());
             close();
diff --git a/test/docs/ProblemList.txt b/test/docs/ProblemList.txt
new file mode 100644
index 000000000000..914ae21d49fa
--- /dev/null
+++ b/test/docs/ProblemList.txt
@@ -0,0 +1,41 @@
+###########################################################################
+#
+# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+###########################################################################
+
+#############################################################################
+#
+# List of quarantined tests -- tests that should not be run by default, because
+# they may fail due to known reason. The reason (CR#) must be mandatory specified.
+#
+# List items are testnames followed by labels, all MUST BE commented
+#   as to why they are here and use a label:
+#     generic-all   Problems on all platforms
+#     generic-ARCH  Where ARCH is one of: x64, i586, ppc64, ppc64le, s390x etc.
+#     OSNAME-all    Where OSNAME is one of: linux, windows, macosx, aix
+#     OSNAME-ARCH   Specific on to one OSNAME and ARCH, e.g. macosx-x64
+#     OSNAME-REV    Specific on to one OSNAME and REV, e.g. macosx-10.7.4
+#
+# More than one label is allowed but must be on the same line.
+#
+#############################################################################
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties b/test/docs/TEST.ROOT
similarity index 50%
rename from test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties
rename to test/docs/TEST.ROOT
index 8b51b2a91156..af2e58967795 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties
+++ b/test/docs/TEST.ROOT
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -21,4 +21,31 @@
 # questions.
 #
 
-exclusiveAccess.dirs=.
+#
+
+# This file identifies the root of the test-suite hierarchy.
+# It also contains test-suite configuration information.
+
+# The list of keywords supported in the entire test suite.  The
+# "intermittent" keyword marks tests known to fail intermittently.
+# The "randomness" keyword marks tests using randomness with test
+# cases differing from run to run. (A test using a fixed random seed
+# would not count as "randomness" by this definition.) Extra care
+# should be taken to handle test failures of intermittent or
+# randomness tests.
+
+# Group definitions
+groups=TEST.groups
+
+# Minimum jtreg version
+requiredVersion=7.4+1
+
+# Use new module options
+useNewOptions=true
+
+# Use --patch-module instead of -Xmodule:
+useNewPatchModule=true
+
+# Path to libraries in the topmost test directory. This is needed so @library
+# does not need ../../ notation to reach them
+external.lib.roots = ../../
diff --git a/test/docs/TEST.groups b/test/docs/TEST.groups
new file mode 100644
index 000000000000..e7c2215dc695
--- /dev/null
+++ b/test/docs/TEST.groups
@@ -0,0 +1,29 @@
+#  Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+#  This code is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License version 2 only, as
+#  published by the Free Software Foundation.
+#
+#  This code is distributed in the hope that it will be useful, but WITHOUT
+#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#  version 2 for more details (a copy is included in the LICENSE file that
+#  accompanied this code).
+#
+#  You should have received a copy of the GNU General Public License version
+#  2 along with this work; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+#  or visit www.oracle.com if you need additional information or have any
+#  questions.
+#
+
+# Docs-specific test groups
+
+docs_all = \
+    /
+
+tier2 = \
+    :docs_all
diff --git a/test/docs/jdk/javadoc/TestDocs.java b/test/docs/jdk/javadoc/TestDocs.java
new file mode 100644
index 000000000000..3ccd89ab2e05
--- /dev/null
+++ b/test/docs/jdk/javadoc/TestDocs.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library /test/lib ../../tools/tester
+ * @build jtreg.SkippedException
+ * @summary example of a test on the generated documentation
+ * @run main TestDocs
+ */
+
+import java.nio.file.Files;
+
+public class TestDocs {
+    public static void main(String... args) throws Exception {
+        var docs = DocTester.resolveDocs();
+        System.err.println("Path to the docs is: " + docs);
+        System.err.println("Do docs exits?");
+        System.err.println(Files.exists(docs));
+        System.err.println("tidy location");
+        System.err.println(System.getProperty("tidy"));
+        System.err.println("End of test");
+    }
+}
diff --git a/test/docs/tools/tester/DocTester.java b/test/docs/tools/tester/DocTester.java
new file mode 100644
index 000000000000..11364ce9f4f5
--- /dev/null
+++ b/test/docs/tools/tester/DocTester.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import jtreg.SkippedException;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+/**
+ * Test framework for performing tests on the generated documentation.
+ */
+public class DocTester {
+    private final static String DIR = System.getenv("DOCS_JDK_IMAGE_DIR");
+    private static final Path firstCandidate = Path.of(System.getProperty("test.jdk"))
+            .getParent().resolve("docs");
+
+    public static Path resolveDocs() {
+        if (DIR != null && !DIR.isBlank() && Files.exists(Path.of(DIR))) {
+            return Path.of(DIR);
+        } else if (Files.exists(firstCandidate)) {
+            return firstCandidate;
+        }else {
+            throw new SkippedException("docs folder not found in either location");
+        }
+    }
+}
diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt
index 9866a885956d..23e2757fe463 100644
--- a/test/hotspot/jtreg/ProblemList.txt
+++ b/test/hotspot/jtreg/ProblemList.txt
@@ -129,8 +129,8 @@ runtime/NMT/VirtualAllocCommitMerge.java 8309698 linux-s390x
 
 applications/jcstress/copy.java 8229852 linux-all
 
-containers/docker/TestJcmd.java 8278102 linux-all
 containers/docker/TestMemoryAwareness.java 8303470 linux-all
+containers/docker/TestJcmdWithSideCar.java 8341518 linux-all
 
 #############################################################################
 
diff --git a/test/hotspot/jtreg/compiler/c2/TestBit.java b/test/hotspot/jtreg/compiler/c2/TestBit.java
index b1186a85cae1..01769470d78c 100644
--- a/test/hotspot/jtreg/compiler/c2/TestBit.java
+++ b/test/hotspot/jtreg/compiler/c2/TestBit.java
@@ -33,7 +33,7 @@
  * @library /test/lib /
  *
  * @requires vm.flagless
- * @requires os.arch=="aarch64" | os.arch=="amd64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64"
+ * @requires os.arch == "aarch64" | os.arch == "amd64" | os.arch == "x86_64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64"
  * @requires vm.debug == true & vm.compiler2.enabled
  *
  * @run driver compiler.c2.TestBit
diff --git a/test/hotspot/jtreg/compiler/c2/TestMinMaxSubword.java b/test/hotspot/jtreg/compiler/c2/TestMinMaxSubword.java
index 955aa4058f04..a7e90353f905 100644
--- a/test/hotspot/jtreg/compiler/c2/TestMinMaxSubword.java
+++ b/test/hotspot/jtreg/compiler/c2/TestMinMaxSubword.java
@@ -31,6 +31,7 @@
 /*
  * @test
  * @bug 8294816
+ * @key randomness
  * @summary Test Math.min/max vectorization miscompilation for integer subwords
  * @library /test/lib /
  * @requires vm.compiler2.enabled
diff --git a/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeIntIdealizationTests.java b/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeIntIdealizationTests.java
index 7ec9d98aae00..a21df9ccfc4b 100644
--- a/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeIntIdealizationTests.java
+++ b/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeIntIdealizationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  * @summary Test that Ideal transformations of RotateLeftNode* are being performed as expected.
  * @library /test/lib /
  * @run driver compiler.c2.irTests.RotateLeftNodeIntIdealizationTests
- * @requires os.arch == "x86_64" | os.arch == "aarch64" | (os.arch == "riscv64" & vm.opt.UseZbb == true)
+ * @requires os.arch == "amd64" | os.arch == "x86_64" | os.arch == "aarch64" | (os.arch == "riscv64" & vm.opt.UseZbb == true)
  */
 public class RotateLeftNodeIntIdealizationTests {
 
diff --git a/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeLongIdealizationTests.java b/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeLongIdealizationTests.java
index dcc69d5721a7..4c8f15b40989 100644
--- a/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeLongIdealizationTests.java
+++ b/test/hotspot/jtreg/compiler/c2/irTests/RotateLeftNodeLongIdealizationTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  * @summary Test that Ideal transformations of RotateLeftNode* are being performed as expected.
  * @library /test/lib /
  * @run driver compiler.c2.irTests.RotateLeftNodeLongIdealizationTests
- * @requires os.arch == "x86_64" | os.arch == "aarch64" | (os.arch == "riscv64" & vm.opt.UseZbb == true)
+ * @requires os.arch == "amd64" | os.arch == "x86_64" | os.arch == "aarch64" | (os.arch == "riscv64" & vm.opt.UseZbb == true)
  */
 public class RotateLeftNodeLongIdealizationTests {
 
diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestMulNodeIdealization.java b/test/hotspot/jtreg/compiler/c2/irTests/TestMulNodeIdealization.java
index ca6d5fbe1185..e0307f2eb981 100644
--- a/test/hotspot/jtreg/compiler/c2/irTests/TestMulNodeIdealization.java
+++ b/test/hotspot/jtreg/compiler/c2/irTests/TestMulNodeIdealization.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 /*
  * @test
  * @bug 8291336
+ * @key randomness
  * @summary Test that transformation of multiply-by-2 is appropriately turned into additions.
  * @library /test/lib /
  * @requires vm.compiler2.enabled
diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java b/test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java
index 4396873425ae..c3bdd5f9bbdc 100644
--- a/test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java
+++ b/test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java
@@ -31,6 +31,7 @@
 /*
  * @test
  * @bug 8277850 8278949 8285793
+ * @key randomness
  * @summary C2: optimize mask checks in counted loops
  * @library /test/lib /
  * @run driver compiler.c2.irTests.TestShiftAndMask
diff --git a/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationTest.java b/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
index b3def9455c42..5ad047c826e6 100644
--- a/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
+++ b/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,26 +31,26 @@
  *
  * @build jdk.test.whitebox.WhiteBox compiler.codecache.stress.Helper compiler.codecache.stress.TestCaseImpl
  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * @run main/othervm/timeout=240 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
  *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
  *                   -XX:-SegmentedCodeCache
  *                   compiler.codecache.stress.UnexpectedDeoptimizationTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * @run main/othervm/timeout=240 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
  *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
  *                   -XX:+SegmentedCodeCache
  *                   compiler.codecache.stress.UnexpectedDeoptimizationTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * @run main/othervm/timeout=240 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
  *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
  *                   -XX:-SegmentedCodeCache
  *                   -DhelperVirtualThread=true
  *                   compiler.codecache.stress.UnexpectedDeoptimizationTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ * @run main/othervm/timeout=240 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI
  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom
  *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
@@ -75,7 +75,7 @@ public static void main(String[] args) {
     public void run() {
         Helper.WHITE_BOX.deoptimizeFrames(rng.nextBoolean());
         // Sleep a short while to allow the stacks to grow - otherwise
-        //  we end up running almost all code in the interpreter
+        // we end up running almost all code in the interpreter
         try {
             Thread.sleep(10);
         } catch (Exception e) {
diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java
index 2d4d43538687..22b3bba854ca 100644
--- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java
+++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/DigestOptionsBase.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@ public static BooleanSupplier getPredicateForOption(String optionName) {
             case DigestOptionsBase.USE_SHA256_INTRINSICS_OPTION:
                 return IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE;
             case DigestOptionsBase.USE_SHA512_INTRINSICS_OPTION:
-                return IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE;
+                return IntrinsicPredicates.isSHA512IntrinsicAvailable();
             case DigestOptionsBase.USE_SHA3_INTRINSICS_OPTION:
                 return IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE;
             default:
diff --git a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
index e349c22e3832..7913a25d9398 100644
--- a/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
+++ b/test/hotspot/jtreg/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
  * @test
  * @bug 8035968
  * @summary Verify UseSHA512Intrinsics option processing on supported CPU.
- * @requires os.arch!="x86" & os.arch!="i386"
  * @library /test/lib /
  * @requires vm.flagless
  *
diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java b/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java
index b69258e4a18f..e7f9b949a6d1 100644
--- a/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java
+++ b/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java
@@ -30,6 +30,7 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.concurrent.TimeUnit;
 import java.util.List;
 import jdk.test.lib.JDKToolFinder;
@@ -48,7 +49,7 @@ class Compile {
      * Compile all sources in {@code javaSources}. First write them to the {@code sourceDir},
      * then compile them to class-files which are stored in {@code classesDir}.
      */
-    public static void compileJavaSources(List javaSources, Path sourceDir, Path classesDir) {
+    public static void compileJavaSources(List javaSources, Path sourceDir, Path classesDir, String[] javacFlags) {
         if (javaSources.isEmpty()) {
             Utils.printlnVerbose("No java sources to compile.");
             return;
@@ -56,7 +57,7 @@ public static void compileJavaSources(List javaSources, Path sourceD
         Utils.printlnVerbose("Compiling Java sources: " + javaSources.size());
 
         List javaFilePaths = writeSourcesToFiles(javaSources, sourceDir);
-        compileJavaFiles(javaFilePaths, classesDir);
+        compileJavaFiles(javaFilePaths, classesDir, javacFlags);
         Utils.printlnVerbose("Java sources compiled.");
     }
 
@@ -64,10 +65,13 @@ public static void compileJavaSources(List javaSources, Path sourceD
      * Compile a list of files (i.e. {@code paths}) using javac and store
      * them in {@code classesDir}.
      */
-    private static void compileJavaFiles(List paths, Path classesDir) {
+    private static void compileJavaFiles(List paths, Path classesDir, String[] javacFlags) {
         List command = new ArrayList<>();
 
         command.add(JAVAC_PATH);
+        if (javacFlags != null) {
+            command.addAll(Arrays.asList(javacFlags));
+        }
         command.add("-classpath");
         // Note: the backslashes from windows paths must be escaped!
         command.add(Utils.getEscapedClassPathAndClassesDir(classesDir));
@@ -194,8 +198,10 @@ private static void executeCompileCommand(List command) {
             throw new CompileFrameworkException("InterruptedException during compilation", e);
         }
 
-        if (exitCode != 0 || !output.isEmpty()) {
+        // Note: the output can be non-empty even if the compilation succeeds, e.g. for warnings.
+        if (exitCode != 0) {
             System.err.println("Compilation failed.");
+            System.err.println("Command: " + command);
             System.err.println("Exit code: " + exitCode);
             System.err.println("Output: '" + output + "'");
             throw new CompileFrameworkException("Compilation failed.");
diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java b/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java
index fe23d596f3c6..b86d30ab5280 100644
--- a/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java
+++ b/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java
@@ -71,8 +71,11 @@ public void addJasmSourceCode(String className, String code) {
      * Compile all sources: store the sources to the {@link sourceDir} directory, compile
      * Java and Jasm sources and store the generated class-files in the {@link classesDir}
      * directory.
+     *
+     * @param javacFlags: optional, list of additional flags for javac, e.g. to make modules
+     *                    visible.
      */
-    public void compile() {
+    public void compile(String... javacFlags) {
         if (classLoader != null) {
             throw new CompileFrameworkException("Cannot compile twice!");
         }
@@ -86,7 +89,7 @@ public void compile() {
         System.out.println("Classes directory: " + classesDir);
 
         Compile.compileJasmSources(jasmSources, sourceDir, classesDir);
-        Compile.compileJavaSources(javaSources, sourceDir, classesDir);
+        Compile.compileJavaSources(javaSources, sourceDir, classesDir, javacFlags);
         classLoader = ClassLoaderBuilder.build(classesDir);
     }
 
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java b/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java
index 9dc1cf1f031b..c60144da0cda 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java
@@ -24,12 +24,11 @@
 
 /**
  * @test
- * @requires vm.compiler2.enabled
  * @bug 8238438
  * @summary Tests to select the memory state of the last load in a load pack in SuperWord::co_locate_pack.
  *
  * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,compiler.loopopts.superword.CoLocatePackMemoryState::test
- *      -XX:LoopMaxUnroll=16 compiler.loopopts.superword.CoLocatePackMemoryState
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:LoopMaxUnroll=16 compiler.loopopts.superword.CoLocatePackMemoryState
  */
 
 package compiler.loopopts.superword;
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/MinMaxRed_Int.java b/test/hotspot/jtreg/compiler/loopopts/superword/MinMaxRed_Int.java
index 9b17fa710ded..6190910933a3 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/MinMaxRed_Int.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/MinMaxRed_Int.java
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 8302673
+ * @key randomness
  * @summary [SuperWord] MaxReduction and MinReduction should vectorize for int
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.MinMaxRed_Int
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java b/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java
index 27bfa8cec0eb..ee691a91bdad 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/RedTest_long.java
@@ -25,7 +25,6 @@
  * @test
  * @bug 8240248
  * @summary Add C2 x86 Superword support for scalar logical reduction optimizations : long test
- * @requires vm.bits == "64"
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.RedTest_long
  */
@@ -137,6 +136,7 @@ public static void reductionInit2(
         failOn = {IRNode.ADD_REDUCTION_VL})
     @IR(applyIfCPUFeature = {"avx2", "true"},
         applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.ADD_REDUCTION_VL, ">= 1", IRNode.ADD_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
     public static long sumReductionImplement(
             long[] a,
@@ -154,6 +154,7 @@ public static long sumReductionImplement(
         failOn = {IRNode.OR_REDUCTION_V})
     @IR(applyIfCPUFeature = {"avx2", "true"},
         applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.OR_REDUCTION_V, ">= 1", IRNode.OR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
     public static long orReductionImplement(
             long[] a,
@@ -171,6 +172,7 @@ public static long orReductionImplement(
         failOn = {IRNode.AND_REDUCTION_V})
     @IR(applyIfCPUFeature = {"avx2", "true"},
         applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.AND_REDUCTION_V, ">= 1", IRNode.AND_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
     public static long andReductionImplement(
             long[] a,
@@ -188,6 +190,7 @@ public static long andReductionImplement(
         failOn = {IRNode.XOR_REDUCTION_V})
     @IR(applyIfCPUFeature = {"avx2", "true"},
         applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.XOR_REDUCTION_V, ">= 1", IRNode.XOR_REDUCTION_V, "<= 2"}) // one for main-loop, one for vector-post-loop
     public static long xorReductionImplement(
             long[] a,
@@ -205,6 +208,7 @@ public static long xorReductionImplement(
         failOn = {IRNode.MUL_REDUCTION_VL})
     @IR(applyIfCPUFeature = {"avx512dq", "true"},
         applyIfAnd = {"SuperWordReductions", "true", "LoopMaxUnroll", ">= 8"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.MUL_REDUCTION_VL, ">= 1", IRNode.MUL_REDUCTION_VL, "<= 2"}) // one for main-loop, one for vector-post-loop
     public static long mulReductionImplement(
             long[] a,
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java b/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java
index b1495d00548f..10181ab3da29 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/ReductionPerf.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,12 +24,12 @@
 /*
  * @test
  * @bug 8074981 8302652
+ * @key randomness
  * @summary Test SuperWord Reduction Perf.
- * @requires vm.compiler2.enabled
- * @requires vm.simpleArch == "x86" | vm.simpleArch == "x64" | vm.simpleArch == "aarch64" | vm.simpleArch == "riscv64"
  * @library /test/lib /
- * @run main/othervm -Xbatch -XX:LoopUnrollLimit=250
+ * @run main/othervm -Xbatch
  *                   -XX:CompileCommand=exclude,compiler.loopopts.superword.ReductionPerf::main
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
  *                   compiler.loopopts.superword.ReductionPerf
  */
 
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestCyclicDependency.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestCyclicDependency.java
index 94e47f3f7479..3849f1b05cf2 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestCyclicDependency.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestCyclicDependency.java
@@ -27,7 +27,6 @@
  * @bug 8298935
  * @summary Writing forward on array creates cyclic dependency
  *          which leads to wrong result, when ignored.
- * @requires vm.compiler2.enabled
  * @library /test/lib /
  * @run driver TestCyclicDependency
  */
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java
index c0afe1d66a52..4b543d7fdc13 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestDependencyOffsets.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
  *   Note: CompileCommand Option Vectorize is enabled.
  *
  * Note: this test is auto-generated. Please modify / generate with script:
- *       https://bugs.openjdk.org/browse/JDK-8312570
+ *       https://bugs.openjdk.org/browse/JDK-8333729
  *
  * Types: int, long, short, char, byte, float, double
  * Offsets: 0, -1, 1, -2, 2, -3, 3, -4, 4, -7, 7, -8, 8, -14, 14, -16, 16, -18, 18, -20, 20, -31, 31, -32, 32, -63, 63, -64, 64, -65, 65, -128, 128, -129, 129, -192, 192
@@ -92,8 +92,8 @@
 /*
  * @test id=vanilla-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
- * @requires vm.compiler2.enabled
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestDependencyOffsets vanilla-A
  */
@@ -101,8 +101,8 @@
 /*
  * @test id=vanilla-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
- * @requires vm.compiler2.enabled
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestDependencyOffsets vanilla-U
  */
@@ -110,6 +110,7 @@
 /*
  * @test id=sse4-v016-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -121,6 +122,7 @@
 /*
  * @test id=sse4-v016-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -132,6 +134,7 @@
 /*
  * @test id=sse4-v008-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -143,6 +146,7 @@
 /*
  * @test id=sse4-v008-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -154,6 +158,7 @@
 /*
  * @test id=sse4-v004-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -165,6 +170,7 @@
 /*
  * @test id=sse4-v004-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -176,6 +182,7 @@
 /*
  * @test id=sse4-v002-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -187,6 +194,7 @@
 /*
  * @test id=sse4-v002-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -198,6 +206,7 @@
 /*
  * @test id=avx1-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -209,6 +218,7 @@
 /*
  * @test id=avx1-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -220,6 +230,7 @@
 /*
  * @test id=avx1-v016-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -231,6 +242,7 @@
 /*
  * @test id=avx1-v016-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -242,6 +254,7 @@
 /*
  * @test id=avx2-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -253,6 +266,7 @@
 /*
  * @test id=avx2-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -264,6 +278,7 @@
 /*
  * @test id=avx2-v016-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -275,6 +290,7 @@
 /*
  * @test id=avx2-v016-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -286,6 +302,7 @@
 /*
  * @test id=avx512-v064-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -297,6 +314,7 @@
 /*
  * @test id=avx512-v064-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -308,6 +326,7 @@
 /*
  * @test id=avx512-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -319,6 +338,7 @@
 /*
  * @test id=avx512-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -330,6 +350,7 @@
 /*
  * @test id=avx512bw-v064-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -341,6 +362,7 @@
 /*
  * @test id=avx512bw-v064-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -352,6 +374,7 @@
 /*
  * @test id=avx512bw-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -363,6 +386,7 @@
 /*
  * @test id=avx512bw-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch=="x86" | os.arch=="i386" | os.arch=="amd64" | os.arch=="x86_64")
@@ -374,6 +398,7 @@
 /*
  * @test id=vec-v064-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -384,6 +409,7 @@
 /*
  * @test id=vec-v064-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -394,6 +420,7 @@
 /*
  * @test id=vec-v032-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -404,6 +431,7 @@
 /*
  * @test id=vec-v032-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -414,6 +442,7 @@
 /*
  * @test id=vec-v016-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -424,6 +453,7 @@
 /*
  * @test id=vec-v016-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -434,6 +464,7 @@
 /*
  * @test id=vec-v008-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -444,6 +475,7 @@
 /*
  * @test id=vec-v008-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -454,6 +486,7 @@
 /*
  * @test id=vec-v004-A
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -464,6 +497,7 @@
 /*
  * @test id=vec-v004-U
  * @bug 8298935 8310308 8312570
+ * @key randomness
  * @summary Test SuperWord: vector size, offsets, dependencies, alignment.
  * @requires vm.compiler2.enabled
  * @requires (os.arch!="x86" & os.arch!="i386" & os.arch!="amd64" & os.arch!="x86_64")
@@ -1266,7 +1300,7 @@ public static void main(String args[]) {
                            "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestDependencyOffsets::init",
                            "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestDependencyOffsets::test*",
                            "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestDependencyOffsets::verify",
-                           "-XX:LoopUnrollLimit=250");
+                           "-XX:+IgnoreUnrecognizedVMOptions", "-XX:LoopUnrollLimit=250");
 
         if (args.length != 1) {
             throw new RuntimeException("Test requires exactly one argument!");
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java
index 60ecaf0e4c89..7d0916ba6a9d 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestGeneralizedReductions.java
@@ -27,7 +27,6 @@
  * @summary Test reduction vectorizations that are enabled by performing SLP
  *          reduction analysis on unrolled loops.
  * @library /test/lib /
- * @requires vm.bits == 64
  * @run driver compiler.loopopts.superword.TestGeneralizedReductions
  */
 
@@ -42,7 +41,7 @@ public class TestGeneralizedReductions {
 
     public static void main(String[] args) throws Exception {
         // Fix maximum number of unrolls for test stability.
-        TestFramework.runWithFlags("-XX:LoopMaxUnroll=16");
+        TestFramework.runWithFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:LoopMaxUnroll=16");
     }
 
     @Run(test = {"testReductionOnGlobalAccumulator",
@@ -82,7 +81,9 @@ private static void initArray(long[] array) {
     }
 
     @Test
-    @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"},
+    @IR(applyIfCPUFeature = {"avx2", "true"},
+        applyIf = {"SuperWordReductions", "true"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
     private static long testReductionOnGlobalAccumulator(long[] array) {
         acc = 0;
@@ -93,7 +94,9 @@ private static long testReductionOnGlobalAccumulator(long[] array) {
     }
 
     @Test
-    @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"},
+    @IR(applyIfCPUFeature = {"avx2", "true"},
+        applyIf = {"SuperWordReductions", "true"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
     private static long testReductionOnPartiallyUnrolledLoop(long[] array) {
         int sum = 0;
@@ -105,7 +108,9 @@ private static long testReductionOnPartiallyUnrolledLoop(long[] array) {
     }
 
     @Test
-    @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"},
+    @IR(applyIfCPUFeature = {"avx2", "true"},
+        applyIf = {"SuperWordReductions", "true"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.ADD_REDUCTION_VI, ">= 1"})
     private static long testReductionOnLargePartiallyUnrolledLoop(long[] array) {
         int sum = 0;
@@ -128,7 +133,9 @@ private static long testReductionOnLargePartiallyUnrolledLoop(long[] array) {
     // If this limitation is overcome in the future, the test case should be
     // turned into a positive one.
     @Test
-    @IR(applyIfCPUFeature = {"avx2", "true"}, applyIf = {"SuperWordReductions", "true"},
+    @IR(applyIfCPUFeature = {"avx2", "true"},
+        applyIf = {"SuperWordReductions", "true"},
+        applyIfPlatform = {"64-bit", "true"},
         failOn = {IRNode.ADD_REDUCTION_VI})
     private static long testReductionOnPartiallyUnrolledLoopWithSwappedInputs(long[] array) {
         int sum = 0;
@@ -142,6 +149,7 @@ private static long testReductionOnPartiallyUnrolledLoopWithSwappedInputs(long[]
     @Test
     @IR(applyIfCPUFeature = {"avx2", "true"},
         applyIfAnd = {"SuperWordReductions", "true","UsePopCountInstruction", "true"},
+        applyIfPlatform = {"64-bit", "true"},
         counts = {IRNode.ADD_REDUCTION_VI, ">= 1",
                   IRNode.POPCOUNT_VL, ">= 1"})
     private static long testMapReductionOnGlobalAccumulator(long[] array) {
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java
index b594b446234e..197ae08b6d88 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency.java
@@ -27,8 +27,6 @@
  * @bug 8304042
  * @summary Test some examples with independent packs with cyclic dependency
  *          between the packs.
- * @requires vm.bits == 64
- * @requires vm.compiler2.enabled
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency
@@ -78,7 +76,7 @@ public static void main(String args[]) {
                                    "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency::test*",
                                    "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency::verify",
                                    "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency::init",
-                                   "-XX:LoopUnrollLimit=1000");
+                                   "-XX:+IgnoreUnrecognizedVMOptions", "-XX:LoopUnrollLimit=1000");
     }
 
     TestIndependentPacksWithCyclicDependency() {
@@ -120,6 +118,7 @@ public void runTest0() {
 
     @Test
     @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VF, "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
     static void test0(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) {
         for (int i = 0; i < RANGE; i+=2) {
@@ -144,6 +143,7 @@ public void runTest1() {
 
     @Test
     @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VF, "> 0", IRNode.VECTOR_CAST_F2I, "> 0", IRNode.VECTOR_CAST_I2F, "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
         applyIfCPUFeatureOr = {"avx2", "true", "asimd", "true"})
     static void test1(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) {
         for (int i = 0; i < RANGE; i+=2) {
@@ -167,6 +167,7 @@ public void runTest2() {
 
     @Test
     @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VI, "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
     static void test2(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) {
         for (int i = 0; i < RANGE; i+=2) {
@@ -191,6 +192,7 @@ public void runTest3() {
 
     @Test
     @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VF, "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
     static void test3(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb) {
         for (int i = 0; i < RANGE; i+=2) {
@@ -267,6 +269,7 @@ public void runTest6() {
 
     @Test
     @IR(counts = {IRNode.ADD_VI, "> 0", IRNode.MUL_VI, "> 0", IRNode.ADD_VF, "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
         applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
     static void test6(int[] dataIa, int[] dataIb, float[] dataFa, float[] dataFb,
                       long[] dataLa, long[] dataLb) {
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency2.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency2.java
index 867363fb5202..2be7d52c7808 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency2.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestIndependentPacksWithCyclicDependency2.java
@@ -28,11 +28,10 @@
  * @summary Test some examples with independent packs with cyclic dependency
  *          between the packs.
  *          Before fix, this hit: "assert(!is_visited) failed: visit only once"
- * @requires vm.compiler2.enabled
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /
- * @run main/othervm -XX:LoopUnrollLimit=250
- *                   -XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency2::test
+ * @run main/othervm -XX:CompileCommand=compileonly,compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency2::test
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=250
  *                   compiler.loopopts.superword.TestIndependentPacksWithCyclicDependency2
  */
 
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeScaleAndStride.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeScaleAndStride.java
index cfb2931d928d..b3453c24d778 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeScaleAndStride.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestLargeScaleAndStride.java
@@ -35,8 +35,7 @@
  * @bug 8328938
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /
- * @requires vm.compiler2.enabled
- * @run main/othervm -XX:+AlignVector compiler.loopopts.superword.TestLargeScaleAndStride
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlignVector compiler.loopopts.superword.TestLargeScaleAndStride
  */
 
 package compiler.loopopts.superword;
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java
new file mode 100644
index 000000000000..c5f333c44bf1
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestMemorySegment.java
@@ -0,0 +1,821 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package compiler.loopopts.superword;
+
+import compiler.lib.ir_framework.*;
+import jdk.test.lib.Utils;
+import java.nio.ByteBuffer;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Random;
+import java.lang.foreign.*;
+
+/*
+ * @test id=byte-array
+ * @bug 8329273
+ * @key randomness
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment ByteArray
+ */
+
+/*
+ * @test id=char-array
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment CharArray
+ */
+
+/*
+ * @test id=short-array
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment ShortArray
+ */
+
+/*
+ * @test id=int-array
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment IntArray
+ */
+
+/*
+ * @test id=long-array
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment LongArray
+ */
+
+/*
+ * @test id=float-array
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment FloatArray
+ */
+
+/*
+ * @test id=double-array
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment DoubleArray
+ */
+
+/*
+ * @test id=byte-buffer
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment ByteBuffer
+ */
+
+/*
+ * @test id=byte-buffer-direct
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment ByteBufferDirect
+ */
+
+/*
+ * @test id=native
+ * @bug 8329273
+ * @summary Test vectorization of loops over MemorySegment
+ * @library /test/lib /
+ * @compile --enable-preview -source ${jdk.version} TestMemorySegment.java
+ * @run main/othervm --enable-preview compiler.loopopts.superword.TestMemorySegment Native
+ */
+
+// FAILS: mixed providers currently do not vectorize. Maybe there is some inlining issue.
+// /*
+//  * @test id=mixed-array
+//  * @bug 8329273
+//  * @summary Test vectorization of loops over MemorySegment
+//  * @library /test/lib /
+//  * @run driver compiler.loopopts.superword.TestMemorySegment MixedArray
+//  */
+//
+// /*
+//  * @test id=MixedBuffer
+//  * @bug 8329273
+//  * @summary Test vectorization of loops over MemorySegment
+//  * @library /test/lib /
+//  * @run driver compiler.loopopts.superword.TestMemorySegment MixedBuffer
+//  */
+//
+// /*
+//  * @test id=mixed
+//  * @bug 8329273
+//  * @summary Test vectorization of loops over MemorySegment
+//  * @library /test/lib /
+//  * @run driver compiler.loopopts.superword.TestMemorySegment Mixed
+//  */
+
+public class TestMemorySegment {
+    public static void main(String[] args) {
+        TestFramework framework = new TestFramework(TestMemorySegmentImpl.class);
+        framework.addFlags("--enable-preview", "-DmemorySegmentProviderNameForTestVM=" + args[0]);
+        framework.setDefaultWarmup(100);
+        framework.start();
+    }
+}
+
+class TestMemorySegmentImpl {
+    static final int BACKING_SIZE = 1024 * 8;
+    static final Random RANDOM = Utils.getRandomInstance();
+
+
+    interface TestFunction {
+        Object[] run();
+    }
+
+    interface MemorySegmentProvider {
+        MemorySegment newMemorySegment();
+    }
+
+    static MemorySegmentProvider provider;
+
+    static {
+        String providerName = System.getProperty("memorySegmentProviderNameForTestVM");
+        provider = switch (providerName) {
+            case "ByteArray"        -> TestMemorySegmentImpl::newMemorySegmentOfByteArray;
+            case "CharArray"        -> TestMemorySegmentImpl::newMemorySegmentOfCharArray;
+            case "ShortArray"       -> TestMemorySegmentImpl::newMemorySegmentOfShortArray;
+            case "IntArray"         -> TestMemorySegmentImpl::newMemorySegmentOfIntArray;
+            case "LongArray"        -> TestMemorySegmentImpl::newMemorySegmentOfLongArray;
+            case "FloatArray"       -> TestMemorySegmentImpl::newMemorySegmentOfFloatArray;
+            case "DoubleArray"      -> TestMemorySegmentImpl::newMemorySegmentOfDoubleArray;
+            case "ByteBuffer"       -> TestMemorySegmentImpl::newMemorySegmentOfByteBuffer;
+            case "ByteBufferDirect" -> TestMemorySegmentImpl::newMemorySegmentOfByteBufferDirect;
+            case "Native"           -> TestMemorySegmentImpl::newMemorySegmentOfNative;
+            case "MixedArray"       -> TestMemorySegmentImpl::newMemorySegmentOfMixedArray;
+            case "MixedBuffer"      -> TestMemorySegmentImpl::newMemorySegmentOfMixedBuffer;
+            case "Mixed"            -> TestMemorySegmentImpl::newMemorySegmentOfMixed;
+            default -> throw new RuntimeException("Test argument not recognized: " + providerName);
+        };
+    }
+
+    // List of tests
+    Map tests = new HashMap<>();
+
+    // List of gold, the results from the first run before compilation
+    Map golds = new HashMap<>();
+
+    public TestMemorySegmentImpl () {
+        // Generate two MemorySegments as inputs
+        MemorySegment a = newMemorySegment();
+        MemorySegment b = newMemorySegment();
+        fillRandom(a);
+        fillRandom(b);
+
+        // Add all tests to list
+        tests.put("testMemorySegmentBadExitCheck",                 () -> testMemorySegmentBadExitCheck(copy(a)));
+        tests.put("testIntLoop_iv_byte",                           () -> testIntLoop_iv_byte(copy(a)));
+        tests.put("testIntLoop_longIndex_intInvar_sameAdr_byte",   () -> testIntLoop_longIndex_intInvar_sameAdr_byte(copy(a), 0));
+        tests.put("testIntLoop_longIndex_longInvar_sameAdr_byte",  () -> testIntLoop_longIndex_longInvar_sameAdr_byte(copy(a), 0));
+        tests.put("testIntLoop_longIndex_intInvar_byte",           () -> testIntLoop_longIndex_intInvar_byte(copy(a), 0));
+        tests.put("testIntLoop_longIndex_longInvar_byte",          () -> testIntLoop_longIndex_longInvar_byte(copy(a), 0));
+        tests.put("testIntLoop_intIndex_intInvar_byte",            () -> testIntLoop_intIndex_intInvar_byte(copy(a), 0));
+        tests.put("testIntLoop_iv_int",                            () -> testIntLoop_iv_int(copy(a)));
+        tests.put("testIntLoop_longIndex_intInvar_sameAdr_int",    () -> testIntLoop_longIndex_intInvar_sameAdr_int(copy(a), 0));
+        tests.put("testIntLoop_longIndex_longInvar_sameAdr_int",   () -> testIntLoop_longIndex_longInvar_sameAdr_int(copy(a), 0));
+        tests.put("testIntLoop_longIndex_intInvar_int",            () -> testIntLoop_longIndex_intInvar_int(copy(a), 0));
+        tests.put("testIntLoop_longIndex_longInvar_int",           () -> testIntLoop_longIndex_longInvar_int(copy(a), 0));
+        tests.put("testIntLoop_intIndex_intInvar_int",             () -> testIntLoop_intIndex_intInvar_int(copy(a), 0));
+        tests.put("testLongLoop_iv_byte",                          () -> testLongLoop_iv_byte(copy(a)));
+        tests.put("testLongLoop_longIndex_intInvar_sameAdr_byte",  () -> testLongLoop_longIndex_intInvar_sameAdr_byte(copy(a), 0));
+        tests.put("testLongLoop_longIndex_longInvar_sameAdr_byte", () -> testLongLoop_longIndex_longInvar_sameAdr_byte(copy(a), 0));
+        tests.put("testLongLoop_longIndex_intInvar_byte",          () -> testLongLoop_longIndex_intInvar_byte(copy(a), 0));
+        tests.put("testLongLoop_longIndex_longInvar_byte",         () -> testLongLoop_longIndex_longInvar_byte(copy(a), 0));
+        tests.put("testLongLoop_intIndex_intInvar_byte",           () -> testLongLoop_intIndex_intInvar_byte(copy(a), 0));
+        tests.put("testLongLoop_iv_int",                           () -> testLongLoop_iv_int(copy(a)));
+        tests.put("testLongLoop_longIndex_intInvar_sameAdr_int",   () -> testLongLoop_longIndex_intInvar_sameAdr_int(copy(a), 0));
+        tests.put("testLongLoop_longIndex_longInvar_sameAdr_int",  () -> testLongLoop_longIndex_longInvar_sameAdr_int(copy(a), 0));
+        tests.put("testLongLoop_longIndex_intInvar_int",           () -> testLongLoop_longIndex_intInvar_int(copy(a), 0));
+        tests.put("testLongLoop_longIndex_longInvar_int",          () -> testLongLoop_longIndex_longInvar_int(copy(a), 0));
+        tests.put("testLongLoop_intIndex_intInvar_int",            () -> testLongLoop_intIndex_intInvar_int(copy(a), 0));
+
+        // Compute gold value for all test methods before compilation
+        for (Map.Entry entry : tests.entrySet()) {
+            String name = entry.getKey();
+            TestFunction test = entry.getValue();
+            Object[] gold = test.run();
+            golds.put(name, gold);
+        }
+    }
+
+    MemorySegment newMemorySegment() {
+        return provider.newMemorySegment();
+    }
+
+    MemorySegment copy(MemorySegment src) {
+        MemorySegment dst = newMemorySegment();
+        MemorySegment.copy(src, 0, dst, 0, src.byteSize());
+        return dst;
+    }
+
+    static MemorySegment newMemorySegmentOfByteArray() {
+        return MemorySegment.ofArray(new byte[BACKING_SIZE]);
+    }
+
+    static MemorySegment newMemorySegmentOfCharArray() {
+        return MemorySegment.ofArray(new char[BACKING_SIZE / 2]);
+    }
+
+    static MemorySegment newMemorySegmentOfShortArray() {
+        return MemorySegment.ofArray(new short[BACKING_SIZE / 2]);
+    }
+
+    static MemorySegment newMemorySegmentOfIntArray() {
+        return MemorySegment.ofArray(new int[BACKING_SIZE / 4]);
+    }
+
+    static MemorySegment newMemorySegmentOfLongArray() {
+        return MemorySegment.ofArray(new long[BACKING_SIZE / 8]);
+    }
+
+    static MemorySegment newMemorySegmentOfFloatArray() {
+        return MemorySegment.ofArray(new float[BACKING_SIZE / 4]);
+    }
+
+    static MemorySegment newMemorySegmentOfDoubleArray() {
+        return MemorySegment.ofArray(new double[BACKING_SIZE / 8]);
+    }
+
+    static MemorySegment newMemorySegmentOfByteBuffer() {
+        return MemorySegment.ofBuffer(ByteBuffer.allocate(BACKING_SIZE));
+    }
+
+    static MemorySegment newMemorySegmentOfByteBufferDirect() {
+        return MemorySegment.ofBuffer(ByteBuffer.allocateDirect(BACKING_SIZE));
+    }
+
+    static MemorySegment newMemorySegmentOfNative() {
+        // Auto arena: GC decides when there is no reference to the MemorySegment,
+        // and then it deallocates the backing memory.
+        return Arena.ofAuto().allocate(BACKING_SIZE, 1);
+    }
+
+    static MemorySegment newMemorySegmentOfMixedArray() {
+        switch(RANDOM.nextInt(7)) {
+            case 0  -> { return newMemorySegmentOfByteArray(); }
+            case 1  -> { return newMemorySegmentOfCharArray(); }
+            case 2  -> { return newMemorySegmentOfShortArray(); }
+            case 3  -> { return newMemorySegmentOfIntArray(); }
+            case 4  -> { return newMemorySegmentOfLongArray(); }
+            case 5  -> { return newMemorySegmentOfFloatArray(); }
+            default -> { return newMemorySegmentOfDoubleArray(); }
+        }
+    }
+
+    static MemorySegment newMemorySegmentOfMixedBuffer() {
+        switch (RANDOM.nextInt(2)) {
+            case 0  -> { return newMemorySegmentOfByteBuffer(); }
+            default -> { return newMemorySegmentOfByteBufferDirect(); }
+        }
+    }
+
+    static MemorySegment newMemorySegmentOfMixed() {
+        switch (RANDOM.nextInt(3)) {
+            case 0  -> { return newMemorySegmentOfMixedArray(); }
+            case 1  -> { return newMemorySegmentOfMixedBuffer(); }
+            default -> { return newMemorySegmentOfNative(); }
+        }
+    }
+
+    static void fillRandom(MemorySegment data) {
+        for (int i = 0; i < (int)data.byteSize(); i += 8) {
+            data.set(ValueLayout.JAVA_LONG_UNALIGNED, i, RANDOM.nextLong());
+        }
+    }
+
+
+    static void verify(String name, Object[] gold, Object[] result) {
+        if (gold.length != result.length) {
+            throw new RuntimeException("verify " + name + ": not the same number of outputs: gold.length = " +
+                                       gold.length + ", result.length = " + result.length);
+        }
+        for (int i = 0; i < gold.length; i++) {
+            Object g = gold[i];
+            Object r = result[i];
+            if (g == r) {
+                throw new RuntimeException("verify " + name + ": should be two separate objects (with identical content):" +
+                                           " gold[" + i + "] == result[" + i + "]");
+            }
+
+            if (!(g instanceof MemorySegment && r instanceof MemorySegment)) {
+                throw new RuntimeException("verify " + name + ": only MemorySegment supported, i=" + i);
+            }
+
+            MemorySegment mg = (MemorySegment)g;
+            MemorySegment mr = (MemorySegment)r;
+
+            if (mg.byteSize() != mr.byteSize()) {
+                throw new RuntimeException("verify " + name + ": MemorySegment must have same byteSize:" +
+                                       " gold[" + i + "].byteSize = " + mg.byteSize() +
+                                       " result[" + i + "].byteSize = " + mr.byteSize());
+            }
+
+            for (int j = 0; j < (int)mg.byteSize(); j++) {
+                byte vg = mg.get(ValueLayout.JAVA_BYTE, j);
+                byte vr = mr.get(ValueLayout.JAVA_BYTE, j);
+                if (vg != vr) {
+                    throw new RuntimeException("verify " + name + ": MemorySegment must have same content:" +
+                                               " gold[" + i + "][" + j + "] = " + vg +
+                                               " result[" + i + "][" + j + "] = " + vr);
+                }
+            }
+        }
+    }
+
+    @Run(test = {"testMemorySegmentBadExitCheck",
+                 "testIntLoop_iv_byte",
+                 "testIntLoop_longIndex_intInvar_sameAdr_byte",
+                 "testIntLoop_longIndex_longInvar_sameAdr_byte",
+                 "testIntLoop_longIndex_intInvar_byte",
+                 "testIntLoop_longIndex_longInvar_byte",
+                 "testIntLoop_intIndex_intInvar_byte",
+                 "testIntLoop_iv_int",
+                 "testIntLoop_longIndex_intInvar_sameAdr_int",
+                 "testIntLoop_longIndex_longInvar_sameAdr_int",
+                 "testIntLoop_longIndex_intInvar_int",
+                 "testIntLoop_longIndex_longInvar_int",
+                 "testIntLoop_intIndex_intInvar_int",
+                 "testLongLoop_iv_byte",
+                 "testLongLoop_longIndex_intInvar_sameAdr_byte",
+                 "testLongLoop_longIndex_longInvar_sameAdr_byte",
+                 "testLongLoop_longIndex_intInvar_byte",
+                 "testLongLoop_longIndex_longInvar_byte",
+                 "testLongLoop_intIndex_intInvar_byte",
+                 "testLongLoop_iv_int",
+                 "testLongLoop_longIndex_intInvar_sameAdr_int",
+                 "testLongLoop_longIndex_longInvar_sameAdr_int",
+                 "testLongLoop_longIndex_intInvar_int",
+                 "testLongLoop_longIndex_longInvar_int",
+                 "testLongLoop_intIndex_intInvar_int"})
+    void runTests() {
+        for (Map.Entry entry : tests.entrySet()) {
+            String name = entry.getKey();
+            TestFunction test = entry.getValue();
+            // Recall gold value from before compilation
+            Object[] gold = golds.get(name);
+            // Compute new result
+            Object[] result = test.run();
+            // Compare gold and new result
+            verify(name, gold, result);
+        }
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
+                  IRNode.ADD_VB,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS
+    // Exit check: iv < long_limit      ->     (long)iv < long_limit
+    // Thus, we have an int-iv, but a long-exit-check.
+    // Is not properly recognized by either CountedLoop or LongCountedLoop
+    static Object[] testMemorySegmentBadExitCheck(MemorySegment a) {
+        for (int i = 0; i < a.byteSize(); i++) {
+            long adr = i;
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr);
+            a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
+                  IRNode.ADD_VB,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testIntLoop_iv_byte(MemorySegment a) {
+        for (int i = 0; i < (int)a.byteSize(); i++) {
+            long adr = i;
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr);
+            a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
+                  IRNode.ADD_VB,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testIntLoop_longIndex_intInvar_sameAdr_byte(MemorySegment a, int invar) {
+        for (int i = 0; i < (int)a.byteSize(); i++) {
+            long adr = (long)(i) + (long)(invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr);
+            a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
+                  IRNode.ADD_VB,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testIntLoop_longIndex_longInvar_sameAdr_byte(MemorySegment a, long invar) {
+        for (int i = 0; i < (int)a.byteSize(); i++) {
+            long adr = (long)(i) + (long)(invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr);
+            a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
+                  IRNode.ADD_VB,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: invariants are sorted differently, because of differently inserted Cast.
+    // See: JDK-8330274
+    static Object[] testIntLoop_longIndex_intInvar_byte(MemorySegment a, int invar) {
+        for (int i = 0; i < (int)a.byteSize(); i++) {
+            long adr1 = (long)(i) + (long)(invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr1);
+            long adr2 = (long)(i) + (long)(invar);
+            a.set(ValueLayout.JAVA_BYTE, adr2, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
+                  IRNode.ADD_VB,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: invariants are sorted differently, because of differently inserted Cast.
+    // See: JDK-8330274
+    static Object[] testIntLoop_longIndex_longInvar_byte(MemorySegment a, long invar) {
+        for (int i = 0; i < (int)a.byteSize(); i++) {
+            long adr1 = (long)(i) + (long)(invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr1);
+            long adr2 = (long)(i) + (long)(invar);
+            a.set(ValueLayout.JAVA_BYTE, adr2, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
+                  IRNode.ADD_VB,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: RangeCheck cannot be eliminated because of int_index
+    static Object[] testIntLoop_intIndex_intInvar_byte(MemorySegment a, int invar) {
+        for (int i = 0; i < (int)a.byteSize(); i++) {
+            int int_index = i + invar;
+            byte v = a.get(ValueLayout.JAVA_BYTE, int_index);
+            a.set(ValueLayout.JAVA_BYTE, int_index, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
+                  IRNode.ADD_VI,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIf = {"AlignVector", "false"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testIntLoop_iv_int(MemorySegment a) {
+        for (int i = 0; i < (int)a.byteSize()/4; i++ ) {
+            long adr = 4L * i;
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
+                  IRNode.ADD_VI,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIf = {"AlignVector", "false"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testIntLoop_longIndex_intInvar_sameAdr_int(MemorySegment a, int invar) {
+        for (int i = 0; i < (int)a.byteSize()/4; i++) {
+            long adr = 4L * (long)(i) + 4L * (long)(invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
+                  IRNode.ADD_VI,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIf = {"AlignVector", "false"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testIntLoop_longIndex_longInvar_sameAdr_int(MemorySegment a, long invar) {
+        for (int i = 0; i < (int)a.byteSize()/4; i++) {
+            long adr = 4L * (long)(i) + 4L * (long)(invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0",
+                  IRNode.ADD_VI,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: invariants are sorted differently, because of differently inserted Cast.
+    // See: JDK-8330274
+    static Object[] testIntLoop_longIndex_intInvar_int(MemorySegment a, int invar) {
+        for (int i = 0; i < (int)a.byteSize()/4; i++) {
+            long adr1 = 4L * (long)(i) + 4L * (long)(invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr1);
+            long adr2 = 4L * (long)(i) + 4L * (long)(invar);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr2, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0",
+                  IRNode.ADD_VI,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: invariants are sorted differently, because of differently inserted Cast.
+    // See: JDK-8330274
+    static Object[] testIntLoop_longIndex_longInvar_int(MemorySegment a, long invar) {
+        for (int i = 0; i < (int)a.byteSize()/4; i++) {
+            long adr1 = 4L * (long)(i) + 4L * (long)(invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr1);
+            long adr2 = 4L * (long)(i) + 4L * (long)(invar);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr2, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0",
+                  IRNode.ADD_VI,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: RangeCheck cannot be eliminated because of int_index
+    static Object[] testIntLoop_intIndex_intInvar_int(MemorySegment a, int invar) {
+        for (int i = 0; i < (int)a.byteSize()/4; i++) {
+            int int_index = i + invar;
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, 4L * int_index);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, 4L * int_index, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
+                  IRNode.ADD_VB,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testLongLoop_iv_byte(MemorySegment a) {
+        for (long i = 0; i < a.byteSize(); i++) {
+            long adr = i;
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr);
+            a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
+                  IRNode.ADD_VB,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testLongLoop_longIndex_intInvar_sameAdr_byte(MemorySegment a, int invar) {
+        for (long i = 0; i < a.byteSize(); i++) {
+            long adr = (long)(i) + (long)(invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr);
+            a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "> 0",
+                  IRNode.ADD_VB,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testLongLoop_longIndex_longInvar_sameAdr_byte(MemorySegment a, long invar) {
+        for (long i = 0; i < a.byteSize(); i++) {
+            long adr = (long)(i) + (long)(invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr);
+            a.set(ValueLayout.JAVA_BYTE, adr, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
+                  IRNode.ADD_VB,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: invariants are sorted differently, because of differently inserted Cast.
+    // See: JDK-8330274
+    static Object[] testLongLoop_longIndex_intInvar_byte(MemorySegment a, int invar) {
+        for (long i = 0; i < a.byteSize(); i++) {
+            long adr1 = (long)(i) + (long)(invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr1);
+            long adr2 = (long)(i) + (long)(invar);
+            a.set(ValueLayout.JAVA_BYTE, adr2, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
+                  IRNode.ADD_VB,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: invariants are sorted differently, because of differently inserted Cast.
+    // See: JDK-8330274
+    static Object[] testLongLoop_longIndex_longInvar_byte(MemorySegment a, long invar) {
+        for (long i = 0; i < a.byteSize(); i++) {
+            long adr1 = (long)(i) + (long)(invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, adr1);
+            long adr2 = (long)(i) + (long)(invar);
+            a.set(ValueLayout.JAVA_BYTE, adr2, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_B, "= 0",
+                  IRNode.ADD_VB,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: RangeCheck cannot be eliminated because of int_index
+    static Object[] testLongLoop_intIndex_intInvar_byte(MemorySegment a, int invar) {
+        for (long i = 0; i < a.byteSize(); i++) {
+            int int_index = (int)(i + invar);
+            byte v = a.get(ValueLayout.JAVA_BYTE, int_index);
+            a.set(ValueLayout.JAVA_BYTE, int_index, (byte)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
+                  IRNode.ADD_VI,        "> 0",
+                  IRNode.STORE_VECTOR,  "> 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIf = {"AlignVector", "false"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    static Object[] testLongLoop_iv_int(MemorySegment a) {
+        for (long i = 0; i < a.byteSize()/4; i++ ) {
+            long adr = 4L * i;
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    //@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
+    //              IRNode.ADD_VI,        "> 0",
+    //              IRNode.STORE_VECTOR,  "> 0"},
+    //    applyIfPlatform = {"64-bit", "true"},
+    //    applyIf = {"AlignVector", "false"},
+    //    applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: for native memory. I think it is because of invariants, but need investigation.
+    //        The long -> int loop conversion introduces extra invariants.
+    static Object[] testLongLoop_longIndex_intInvar_sameAdr_int(MemorySegment a, int invar) {
+        for (long i = 0; i < a.byteSize()/4; i++) {
+            long adr = 4L * (long)(i) + 4L * (long)(invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    //@IR(counts = {IRNode.LOAD_VECTOR_I, "> 0",
+    //              IRNode.ADD_VI,        "> 0",
+    //              IRNode.STORE_VECTOR,  "> 0"},
+    //    applyIfPlatform = {"64-bit", "true"},
+    //    applyIf = {"AlignVector", "false"},
+    //    applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: for native memory. I think it is because of invariants, but need investigation.
+    //        The long -> int loop conversion introduces extra invariants.
+    static Object[] testLongLoop_longIndex_longInvar_sameAdr_int(MemorySegment a, long invar) {
+        for (long i = 0; i < a.byteSize()/4; i++) {
+            long adr = 4L * (long)(i) + 4L * (long)(invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0",
+                  IRNode.ADD_VI,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: invariants are sorted differently, because of differently inserted Cast.
+    // See: JDK-8330274
+    static Object[] testLongLoop_longIndex_intInvar_int(MemorySegment a, int invar) {
+        for (long i = 0; i < a.byteSize()/4; i++) {
+            long adr1 = 4L * (long)(i) + 4L * (long)(invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr1);
+            long adr2 = 4L * (long)(i) + 4L * (long)(invar);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr2, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0",
+                  IRNode.ADD_VI,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: invariants are sorted differently, because of differently inserted Cast.
+    // See: JDK-8330274
+    static Object[] testLongLoop_longIndex_longInvar_int(MemorySegment a, long invar) {
+        for (long i = 0; i < a.byteSize()/4; i++) {
+            long adr1 = 4L * (long)(i) + 4L * (long)(invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, adr1);
+            long adr2 = 4L * (long)(i) + 4L * (long)(invar);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, adr2, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+
+    @Test
+    @IR(counts = {IRNode.LOAD_VECTOR_I, "= 0",
+                  IRNode.ADD_VI,        "= 0",
+                  IRNode.STORE_VECTOR,  "= 0"},
+        applyIfPlatform = {"64-bit", "true"},
+        applyIfCPUFeatureOr = {"sse4.1", "true", "asimd", "true"})
+    // FAILS: RangeCheck cannot be eliminated because of int_index
+    static Object[] testLongLoop_intIndex_intInvar_int(MemorySegment a, int invar) {
+        for (long i = 0; i < a.byteSize()/4; i++) {
+            int int_index = (int)(i + invar);
+            int v = a.get(ValueLayout.JAVA_INT_UNALIGNED, 4L * int_index);
+            a.set(ValueLayout.JAVA_INT_UNALIGNED, 4L * int_index, (int)(v + 1));
+        }
+        return new Object[]{ a };
+    }
+}
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestMovingLoadBeforeStore.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestMovingLoadBeforeStore.java
index 80922aeffe9c..a8c0750c6564 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestMovingLoadBeforeStore.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestMovingLoadBeforeStore.java
@@ -24,7 +24,6 @@
 
 /**
  * @test
- * @requires vm.compiler2.enabled
  * @requires vm.cpu.features ~= ".*avx2.*"
  * @bug 8316679 8316594
  * @summary In SuperWord::output, LoadVector can be moved before StoreVector, but only if it is proven to be safe.
@@ -32,9 +31,10 @@
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @run main/othervm -XX:CompileCommand=compileonly,compiler.loopopts.superword.TestMovingLoadBeforeStore::test*
- *                   -Xbatch -XX:LoopUnrollLimit=100
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM
  *                   --add-modules java.base --add-exports java.base/jdk.internal.misc=ALL-UNNAMED
+ *                   -Xbatch
+ *                   -XX:+UnlockDiagnosticVMOptions -XX:+StressLCM
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=100
  *                   compiler.loopopts.superword.TestMovingLoadBeforeStore
  */
 
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestPeeledReductionNode.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestPeeledReductionNode.java
index 99e1e2465f8b..b69bff04088b 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestPeeledReductionNode.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestPeeledReductionNode.java
@@ -29,8 +29,9 @@
  * @library /test/lib
  * @comment The test is run with -XX:LoopUnrollLimit=32 to prevent unrolling
  *          from fully replacing vectorization.
- * @run main/othervm -Xbatch -XX:LoopUnrollLimit=32
- *      compiler.loopopts.superword.TestPeeledReductionNode
+ * @run main/othervm -Xbatch
+ *                   -XX:+IgnoreUnrecognizedVMOptions -XX:LoopUnrollLimit=32
+ *                   compiler.loopopts.superword.TestPeeledReductionNode
  */
 package compiler.loopopts.superword;
 
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestPickFirstMemoryState.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestPickFirstMemoryState.java
index 488e32c416a8..5d419766aebf 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestPickFirstMemoryState.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestPickFirstMemoryState.java
@@ -24,7 +24,6 @@
 
 /**
  * @test
- * @requires vm.compiler2.enabled
  * @bug 8240281
  * @summary Test which needs to select the memory state of the first load in a load pack in SuperWord::co_locate_pack.
  *
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestPickLastMemoryState.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestPickLastMemoryState.java
index 4b71202e99f9..813a7df4cb7b 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestPickLastMemoryState.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestPickLastMemoryState.java
@@ -24,7 +24,6 @@
 
 /**
  * @test
- * @requires vm.compiler2.enabled
  * @bug 8290910 8293216
  * @summary Test which needs to select the memory state of the last load in a load pack in SuperWord::co_locate_pack.
  *
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestScheduleReordersScalarMemops.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestScheduleReordersScalarMemops.java
index 416c360d6f18..c54a684c6911 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestScheduleReordersScalarMemops.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestScheduleReordersScalarMemops.java
@@ -28,7 +28,6 @@
  * @bug 8304720
  * @summary Test some examples where non-vectorized memops also need to
  *          be reordered during SuperWord::schedule.
- * @requires vm.compiler2.enabled
  * @modules java.base/jdk.internal.misc
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestScheduleReordersScalarMemops
@@ -55,8 +54,8 @@ public static void main(String args[]) {
                                    "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestScheduleReordersScalarMemops::test*",
                                    "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestScheduleReordersScalarMemops::verify",
                                    "-XX:CompileCommand=compileonly,compiler.loopopts.superword.TestScheduleReordersScalarMemops::init",
-                                   "-XX:LoopUnrollLimit=1000",
-                                   "-XX:-TieredCompilation", "-Xbatch");
+                                   "-XX:-TieredCompilation", "-Xbatch",
+                                   "-XX:+IgnoreUnrecognizedVMOptions", "-XX:LoopUnrollLimit=1000");
     }
 
     TestScheduleReordersScalarMemops() {
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java
index 30cdc05bfe5c..eed03b3a4a1d 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReduction.java
@@ -25,7 +25,6 @@
  * @test id=Vanilla-Unaligned
  * @bug 8302652 8314612
  * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
- * @requires vm.compiler2.enabled
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestUnorderedReduction Vanilla-Unaligned
  */
@@ -34,7 +33,6 @@
  * @test id=Vanilla-Aligned
  * @bug 8302652 8314612
  * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
- * @requires vm.compiler2.enabled
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestUnorderedReduction Vanilla-Aligned
  */
@@ -43,7 +41,6 @@
  * @test id=MaxVectorSize16-Unaligned
  * @bug 8302652 8314612
  * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
- * @requires vm.compiler2.enabled
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestUnorderedReduction MaxVectorSize16-Unaligned
  */
@@ -52,7 +49,6 @@
  * @test id=MaxVectorSize32-Aligned
  * @bug 8302652 8314612
  * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
- * @requires vm.compiler2.enabled
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestUnorderedReduction MaxVectorSize32-Aligned
  */
@@ -75,10 +71,10 @@ public static void main(String[] args) {
         }
 
         switch (args[0]) {
-            case "Vanilla-Unaligned"         -> { framework.addFlags("-XX:-AlignVector"); }
-            case "Vanilla-Aligned"           -> { framework.addFlags("-XX:+AlignVector"); }
-            case "MaxVectorSize16-Unaligned" -> { framework.addFlags("-XX:-AlignVector", "-XX:MaxVectorSize=16"); }
-            case "MaxVectorSize32-Aligned"   -> { framework.addFlags("-XX:+AlignVector", "-XX:MaxVectorSize=32"); }
+            case "Vanilla-Unaligned"         -> { framework.addFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:-AlignVector"); }
+            case "Vanilla-Aligned"           -> { framework.addFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AlignVector"); }
+            case "MaxVectorSize16-Unaligned" -> { framework.addFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:-AlignVector", "-XX:MaxVectorSize=16"); }
+            case "MaxVectorSize32-Aligned"   -> { framework.addFlags("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AlignVector", "-XX:MaxVectorSize=32"); }
             default -> { throw new RuntimeException("Test argument not recognized: " + args[0]); }
         }
         framework.start();
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java
index 431bbe9ac4f4..5fe6658ff686 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/TestUnorderedReductionPartialVectorization.java
@@ -26,7 +26,6 @@
  * @bug JDK-8310130
  * @summary Special test cases for PhaseIdealLoop::move_unordered_reduction_out_of_loop
  *          Here a case with partial vectorization of the reduction.
- * @requires vm.bits == "64"
  * @library /test/lib /
  * @run driver compiler.loopopts.superword.TestUnorderedReductionPartialVectorization
  */
@@ -62,6 +61,7 @@ public void runTests() throws Exception {
     @IR(counts = {IRNode.LOAD_VECTOR_I,   IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
                   IRNode.VECTOR_CAST_I2L, IRNode.VECTOR_SIZE + "min(max_int, max_long)", "> 0",
                   IRNode.OR_REDUCTION_V,                                                 "> 0",},
+        applyIfPlatform = {"64-bit", "true"},
         applyIfCPUFeatureOr = {"avx2", "true"})
     static long test1(int[] data, long sum) {
         for (int i = 0; i < data.length; i++) {
diff --git a/test/hotspot/jtreg/compiler/loopopts/superword/Vec_MulAddS2I.java b/test/hotspot/jtreg/compiler/loopopts/superword/Vec_MulAddS2I.java
index f63692871adb..d595e914ff40 100644
--- a/test/hotspot/jtreg/compiler/loopopts/superword/Vec_MulAddS2I.java
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/Vec_MulAddS2I.java
@@ -27,47 +27,62 @@
  * @bug 8214751
  * @summary Test operations in C2 MulAddS2I and MulAddVS2VI nodes.
  * @library /test/lib
- * @requires vm.compiler2.enabled
  *
- * @run main/othervm -XX:LoopUnrollLimit=250
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250
  *      -XX:CompileThresholdScaling=0.1
  *      -XX:+UseSuperWord
  *      -XX:LoopMaxUnroll=2
  *      compiler.loopopts.superword.Vec_MulAddS2I
- * @run main/othervm -XX:LoopUnrollLimit=250
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250
  *      -XX:CompileThresholdScaling=0.1
  *      -XX:-UseSuperWord
  *      -XX:LoopMaxUnroll=2
  *      compiler.loopopts.superword.Vec_MulAddS2I
  *
- * @run main/othervm -XX:LoopUnrollLimit=250
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250
  *      -XX:CompileThresholdScaling=0.1
  *      -XX:+UseSuperWord
  *      -XX:LoopMaxUnroll=4
  *      compiler.loopopts.superword.Vec_MulAddS2I
- * @run main/othervm -XX:LoopUnrollLimit=250
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250
  *      -XX:CompileThresholdScaling=0.1
  *      -XX:-UseSuperWord
  *      -XX:LoopMaxUnroll=4
  *      compiler.loopopts.superword.Vec_MulAddS2I
  *
- * @run main/othervm -XX:LoopUnrollLimit=250
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250
  *      -XX:CompileThresholdScaling=0.1
  *      -XX:+UseSuperWord
  *      -XX:LoopMaxUnroll=8
  *      compiler.loopopts.superword.Vec_MulAddS2I
- * @run main/othervm -XX:LoopUnrollLimit=250
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250
  *      -XX:CompileThresholdScaling=0.1
  *      -XX:-UseSuperWord
  *      -XX:LoopMaxUnroll=8
  *      compiler.loopopts.superword.Vec_MulAddS2I
  *
- * @run main/othervm -XX:LoopUnrollLimit=250
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250
  *      -XX:CompileThresholdScaling=0.1
  *      -XX:+UseSuperWord
  *      -XX:LoopMaxUnroll=16
  *      compiler.loopopts.superword.Vec_MulAddS2I
- * @run main/othervm -XX:LoopUnrollLimit=250
+ * @run main/othervm
+ *      -XX:+IgnoreUnrecognizedVMOptions
+ *      -XX:LoopUnrollLimit=250
  *      -XX:CompileThresholdScaling=0.1
  *      -XX:-UseSuperWord
  *      -XX:LoopMaxUnroll=16
diff --git a/test/hotspot/jtreg/compiler/vectorapi/Test8278948.java b/test/hotspot/jtreg/compiler/vectorapi/Test8278948.java
index 5218e10c4af6..5170c188133a 100644
--- a/test/hotspot/jtreg/compiler/vectorapi/Test8278948.java
+++ b/test/hotspot/jtreg/compiler/vectorapi/Test8278948.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 /*
  * @test
  * @bug 8278948
+ * @key randomness
  * @summary Intermediate integer promotion vector length encoding is calculated incorrectly on x86
  * @modules jdk.incubator.vector
  * @library /test/lib
diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestVectorCompressExpandBits.java b/test/hotspot/jtreg/compiler/vectorapi/TestVectorCompressExpandBits.java
index f5174b7e6dcd..8889ccd0d268 100644
--- a/test/hotspot/jtreg/compiler/vectorapi/TestVectorCompressExpandBits.java
+++ b/test/hotspot/jtreg/compiler/vectorapi/TestVectorCompressExpandBits.java
@@ -38,6 +38,7 @@
 /**
  * @test
  * @bug 8301012
+ * @key randomness
  * @library /test/lib /
  * @requires os.arch == "aarch64" & vm.cpu.features ~= ".*sve2.*" & vm.cpu.features ~= ".*svebitperm.*"
  * @summary [vectorapi]: Intrinsify CompressBitsV/ExpandBitsV and add the AArch64 SVE backend implementation
diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestVectorReallocation.java b/test/hotspot/jtreg/compiler/vectorapi/TestVectorReallocation.java
new file mode 100644
index 000000000000..6b21b693d1ed
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/vectorapi/TestVectorReallocation.java
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2026 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package compiler.vectorapi;
+
+import java.util.Arrays;
+
+import compiler.lib.ir_framework.*;
+
+import jdk.incubator.vector.ByteVector;
+import jdk.incubator.vector.ShortVector;
+import jdk.incubator.vector.IntVector;
+import jdk.incubator.vector.LongVector;
+import jdk.incubator.vector.FloatVector;
+import jdk.incubator.vector.DoubleVector;
+import jdk.incubator.vector.VectorSpecies;
+
+import static jdk.test.lib.Asserts.*;
+
+/**
+ * @test
+ * @bug 8380565
+ * @library /test/lib /
+ * @summary Test deoptimization involving vector reallocation
+ * @modules jdk.incubator.vector
+ * @requires vm.opt.final.MaxVectorSize == null | vm.opt.final.MaxVectorSize >= 16
+ *
+ * @run driver compiler.vectorapi.TestVectorReallocation
+ */
+
+public class TestVectorReallocation {
+
+    private static final VectorSpecies    B_SPECIES = ByteVector.SPECIES_PREFERRED;
+    private static final VectorSpecies   S_SPECIES = ShortVector.SPECIES_PREFERRED;
+    private static final VectorSpecies I_SPECIES = IntVector.SPECIES_PREFERRED;
+    private static final VectorSpecies    L_SPECIES = LongVector.SPECIES_PREFERRED;
+    private static final VectorSpecies   F_SPECIES = FloatVector.SPECIES_PREFERRED;
+    private static final VectorSpecies  D_SPECIES = DoubleVector.SPECIES_PREFERRED;
+    private static final int B_LENGTH = B_SPECIES.length();
+    private static final int S_LENGTH = S_SPECIES.length();
+    private static final int I_LENGTH = I_SPECIES.length();
+    private static final int L_LENGTH = L_SPECIES.length();
+    private static final int F_LENGTH = F_SPECIES.length();
+    private static final int D_LENGTH = D_SPECIES.length();
+
+    // The input arrays for the @Test methods match the length of the preferred species for each type
+    private static byte[]   b_a;
+    private static short[]  s_a;
+    private static int[]    i_a;
+    private static long[]   l_a;
+    private static float[]  f_a;
+    private static double[] d_a;
+
+    // The output arrays for the @Test methods
+    private static byte[]   b_r;
+    private static short[]  s_r;
+    private static int[]    i_r;
+    private static long[]   l_r;
+    private static float[]  f_r;
+    private static double[] d_r;
+
+    public static void main(String[] args) {
+        TestFramework.runWithFlags("--add-modules=jdk.incubator.vector");
+    }
+
+    // The test methods annotated with @Test are warmed up by the framework. The calls are indirect
+    // through the runner methods annotated with @Run. Note that each @Test method has its own instance of
+    // the test class TestVectorReallocation as receiver of the calls.
+    //
+    // The @Test methods just copy the elements of the input array (0, 1, 2, 3, ...) to the output array
+    // by means of a vector add operation. The added value is computed but actually always zero. The
+    // computation is done in a loop with a virtual call that is inlined based on class hierarchy analysis
+    // when the method gets compiled.
+    //
+    // The final call after warmup of the now compiled @Test method is performed concurrently in a second
+    // thread. Before the variable `loopIterations` is set very high such that the loop runs practically
+    // infinitely. While the loop is running, a class with an overridden version of the method `value`
+    // (called in the loop) is loaded. This invalidates the result of the class hierarchy analysis that
+    // there is just one implementation of the method and causes deoptimization where the vector `v0` used
+    // in the @Test method is reallocated from a register to the java heap. Finally it is verified that
+    // input and ouput arrays are equal.
+    //
+    // NB: each @Test needs its own Zero class for the desired result of the class hierarchy analysis.
+
+    volatile boolean enteredLoop;
+    volatile long loopIterations;
+
+    void sharedRunner(RunInfo runInfo, Runnable test, Runnable loadOverridingClass, Runnable verify) {
+        enteredLoop = false;
+        if (runInfo.isWarmUp()) {
+            loopIterations = 100;
+            test.run();
+        } else {
+            loopIterations = 1L << 60; // basically infinite
+            Thread t = Thread.ofPlatform().start(test);
+            waitUntilLoopEntered();
+            loadOverridingClass.run(); // invalidates inlining causing deoptimization/reallocation of v0
+            loopIterations = 0;
+            waitUntilLoopLeft();
+            joinThread(t);
+            verify.run();              // verify that input and ouput arrays are equal
+        }
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // byte
+
+    static class ByteZero {
+        volatile byte zero;
+        byte value() {
+            return zero;
+        }
+    }
+    volatile ByteZero byteZero = new ByteZero();
+
+    @Run(test = "byteIdentityWithReallocation")
+    void byteIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> byteIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            byteZero = new ByteZero() {
+                    @Override
+                    byte value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(b_a, b_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VB, " >0 "})
+    void byteIdentityWithReallocation() {
+        ByteVector v0 = ByteVector.fromArray(B_SPECIES, b_a, 0);
+        byte zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += byteZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(b_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // short
+
+    static class ShortZero {
+        volatile short zero;
+        short value() {
+            return zero;
+        }
+    }
+    volatile ShortZero shortZero = new ShortZero();
+
+    @Run(test = "shortIdentityWithReallocation")
+    void shortIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> shortIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            shortZero = new ShortZero() {
+                    @Override
+                    short value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(s_a, s_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VS, " >0 "})
+    void shortIdentityWithReallocation() {
+        ShortVector v0 = ShortVector.fromArray(S_SPECIES, s_a, 0);
+        short zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += shortZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(s_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // int
+
+    static class IntZero {
+        volatile int zero;
+        int value() {
+            return zero;
+        }
+    }
+    volatile IntZero intZero = new IntZero();
+
+    @Run(test = "intIdentityWithReallocation")
+    void intIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> intIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            intZero = new IntZero() {
+                    @Override
+                    int value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(i_a, i_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VI, " >0 "})
+    void intIdentityWithReallocation() {
+        IntVector v0 = IntVector.fromArray(I_SPECIES, i_a, 0);
+        int zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += intZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(i_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // long
+
+    static class LongZero {
+        volatile long zero;
+        long value() {
+            return zero;
+        }
+    }
+    volatile LongZero longZero = new LongZero();
+
+    @Run(test = "longIdentityWithReallocation")
+    void longIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> longIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            longZero = new LongZero() {
+                    @Override
+                    long value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(l_a, l_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VL, " >0 "})
+    void longIdentityWithReallocation() {
+        LongVector v0 = LongVector.fromArray(L_SPECIES, l_a, 0);
+        long zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += longZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(l_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // float
+
+    static class FloatZero {
+        volatile float zero;
+        float value() {
+            return zero;
+        }
+    }
+    volatile FloatZero floatZero = new FloatZero();
+
+    @Run(test = "floatIdentityWithReallocation")
+    void floatIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> floatIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            floatZero = new FloatZero() {
+                    @Override
+                    float value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(f_a, f_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VF, IRNode.VECTOR_SIZE_ANY, " >0 "})
+    void floatIdentityWithReallocation() {
+        FloatVector v0 = FloatVector.fromArray(F_SPECIES, f_a, 0);
+        float zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += floatZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(f_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+    // double
+
+    static class DoubleZero {
+        volatile double zero;
+        double value() {
+            return zero;
+        }
+    }
+    volatile DoubleZero doubleZero = new DoubleZero();
+
+    @Run(test = "doubleIdentityWithReallocation")
+    void doubleIdentityWithReallocation_runner(RunInfo runInfo) {
+        sharedRunner(runInfo, () -> doubleIdentityWithReallocation(), () -> {
+            // Loading the class with the overridden method will cause deoptimization and reallocation of v0
+            doubleZero = new DoubleZero() {
+                    @Override
+                    double value() {
+                        return super.value(); // override but doing the same
+                    }
+                };
+            },
+            () -> assertTrue(Arrays.equals(d_a, d_r), "Input/Output arrays differ"));
+    }
+
+    @Test
+    @IR(counts = {IRNode.ADD_VD, IRNode.VECTOR_SIZE_ANY, " >0 "})
+    void doubleIdentityWithReallocation() {
+        DoubleVector v0 = DoubleVector.fromArray(D_SPECIES, d_a, 0);
+        double zeroSum = 0;
+        enteredLoop = true;
+        for (long i = 0; i < loopIterations; i++) {
+            zeroSum += doubleZero.value(); // inlined based on class hierarchy analysis
+        }
+        v0.add(zeroSum).intoArray(d_r, 0);
+        enteredLoop = false;
+    }
+
+    /////////////////////////////////////////////////////////////////////////////////////
+
+    private void waitUntilLoopEntered() {
+        while (!enteredLoop) {
+            sleep(10);
+        }
+    }
+
+    private void waitUntilLoopLeft() {
+        while (enteredLoop) {
+            sleep(10);
+        }
+    }
+
+    private static void sleep(int ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) { /* ignore */ }
+    }
+
+    private static void joinThread(Thread t) {
+        try {
+            t.join();
+        } catch (InterruptedException e) { /* ignore */ }
+    }
+
+    static {
+        b_a = new byte[B_LENGTH];
+        s_a = new short[S_LENGTH];
+        i_a = new int[I_LENGTH];
+        l_a = new long[L_LENGTH];
+        f_a = new float[F_LENGTH];
+        d_a = new double[D_LENGTH];
+
+        b_r = new byte[B_LENGTH];
+        s_r = new short[S_LENGTH];
+        i_r = new int[I_LENGTH];
+        l_r = new long[L_LENGTH];
+        f_r = new float[F_LENGTH];
+        d_r = new double[D_LENGTH];
+
+        for (int i = 0; i < b_a.length ; i++) {
+            b_a[i] = (byte)i;
+        }
+        for (int i = 0; i < s_a.length ; i++) {
+            s_a[i] = (short)i;
+        }
+        for (int i = 0; i < i_a.length ; i++) {
+            i_a[i] = i;
+        }
+        for (int i = 0; i < l_a.length ; i++) {
+            l_a[i] = i;
+        }
+        for (int i = 0; i < f_a.length ; i++) {
+            f_a[i] = i;
+        }
+        for (int i = 0; i < d_a.length ; i++) {
+            d_a[i] = i;
+        }
+    }
+}
diff --git a/test/hotspot/jtreg/compiler/vectorization/TestAutoVecIntMinMax.java b/test/hotspot/jtreg/compiler/vectorization/TestAutoVecIntMinMax.java
index e3baed37804e..0aa1b07bb80b 100644
--- a/test/hotspot/jtreg/compiler/vectorization/TestAutoVecIntMinMax.java
+++ b/test/hotspot/jtreg/compiler/vectorization/TestAutoVecIntMinMax.java
@@ -30,6 +30,7 @@
 /*
  * @test
  * @bug 8288107
+ * @key randomness
  * @summary Auto-vectorization enhancement for integer Math.max/Math.min operations
  * @library /test/lib /
  * @requires vm.compiler2.enabled
diff --git a/test/hotspot/jtreg/compiler/vectorization/TestEor3AArch64.java b/test/hotspot/jtreg/compiler/vectorization/TestEor3AArch64.java
index d5a3de09123b..3fed3eda1249 100644
--- a/test/hotspot/jtreg/compiler/vectorization/TestEor3AArch64.java
+++ b/test/hotspot/jtreg/compiler/vectorization/TestEor3AArch64.java
@@ -33,6 +33,7 @@
 /*
  * @test
  * @bug 8293488
+ * @key randomness
  * @summary Test EOR3 Neon/SVE2 instruction for aarch64 SHA3 extension
  * @library /test/lib /
  * @requires os.arch == "aarch64"
diff --git a/test/hotspot/jtreg/compiler/vectorization/TestMacroLogicVector.java b/test/hotspot/jtreg/compiler/vectorization/TestMacroLogicVector.java
index d2486f0ed774..9ab5994f5663 100644
--- a/test/hotspot/jtreg/compiler/vectorization/TestMacroLogicVector.java
+++ b/test/hotspot/jtreg/compiler/vectorization/TestMacroLogicVector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 8241040
+ * @key randomness
  * @library /test/lib
  *
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
diff --git a/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java b/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java
index f4c8845b8570..573b3b020d35 100644
--- a/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java
+++ b/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java
@@ -21,20 +21,20 @@
  * questions.
  */
 
+package compiler.vectorization;
+
+import java.util.Random;
+import jdk.test.lib.Utils;
+
 /* @test
  * @bug 8349637
+ * @key randomness
  * @requires vm.flavor == "server" & (vm.opt.TieredStopAtLevel == null | vm.opt.TieredStopAtLevel == 4)
  * @summary Ensure that vectorization of numberOfLeadingZeros and numberOfTrailingZeros outputs correct values
  * @library /test/lib /
  * @run main/othervm compiler.vectorization.TestVectorZeroCount
  */
 
-package compiler.vectorization;
-
-import java.util.Random;
-
-import jdk.test.lib.Utils;
-
 public class TestVectorZeroCount {
     private static final int SIZE = 1024;
     private static final Random RANDOM = Utils.getRandomInstance();
diff --git a/test/hotspot/jtreg/containers/docker/DockerBasicTest.java b/test/hotspot/jtreg/containers/docker/DockerBasicTest.java
index 8e2c0b6a85a9..e908f2a5bf32 100644
--- a/test/hotspot/jtreg/containers/docker/DockerBasicTest.java
+++ b/test/hotspot/jtreg/containers/docker/DockerBasicTest.java
@@ -56,9 +56,7 @@ public static void main(String[] args) throws Exception {
             testHelloDocker();
             testJavaVersionWithCgMounts();
         } finally {
-            if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
-                DockerTestUtils.removeDockerImage(imageNameAndTag);
-            }
+            DockerTestUtils.removeDockerImage(imageNameAndTag);
         }
     }
 
diff --git a/test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java b/test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java
index de7605b44572..efb1690ea75f 100644
--- a/test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java
+++ b/test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java
@@ -24,6 +24,8 @@
 import jdk.jfr.Description;
 import jdk.jfr.Label;
 
+import java.util.concurrent.TimeUnit;
+
 
 // This class generates simple event in a loop for a specified time.
 public class EventGeneratorLoop {
@@ -44,16 +46,21 @@ public static void main(String[] args) throws Exception {
             throw new IllegalArgumentException("Expecting one argument: time to run (seconds)");
         }
         int howLong = Integer.parseInt(args[0]);
+        long endTime = System.nanoTime() + TimeUnit.SECONDS.toNanos(howLong);
 
         System.out.println(MAIN_METHOD_STARTED + ", argument is " + howLong);
 
-        for (int i=0; i < howLong; i++) {
+        int count = 0;
+        while (System.nanoTime() < endTime) {
             SimpleEvent ev = new SimpleEvent();
             ev.msg = "Hello";
-            ev.count = i;
+            ev.count = count++;
             ev.commit();
 
-            try { Thread.sleep(1000); } catch (InterruptedException e) {}
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException ignore) {
+            }
             System.out.print(".");
         }
 
diff --git a/test/hotspot/jtreg/containers/docker/ShareTmpDir.java b/test/hotspot/jtreg/containers/docker/ShareTmpDir.java
index 9a4748563bd7..48876ca37fe2 100644
--- a/test/hotspot/jtreg/containers/docker/ShareTmpDir.java
+++ b/test/hotspot/jtreg/containers/docker/ShareTmpDir.java
@@ -59,9 +59,7 @@ public static void main(String[] args) throws Exception {
         try {
             test();
         } finally {
-            if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
-                DockerTestUtils.removeDockerImage(imageName);
-            }
+            DockerTestUtils.removeDockerImage(imageName);
         }
     }
 
diff --git a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java
index 99220201f666..dc73dd1b5445 100644
--- a/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java
+++ b/test/hotspot/jtreg/containers/docker/TestCPUAwareness.java
@@ -86,9 +86,7 @@ public static void main(String[] args) throws Exception {
             }
 
         } finally {
-            if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
-                DockerTestUtils.removeDockerImage(imageName);
-            }
+            DockerTestUtils.removeDockerImage(imageName);
         }
     }
 
diff --git a/test/hotspot/jtreg/containers/docker/TestJcmd.java b/test/hotspot/jtreg/containers/docker/TestJcmd.java
index 8c210544bb68..3f5afd31801f 100644
--- a/test/hotspot/jtreg/containers/docker/TestJcmd.java
+++ b/test/hotspot/jtreg/containers/docker/TestJcmd.java
@@ -168,14 +168,10 @@ private static Process startObservedContainer() throws Exception {
         opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/:z")
             .addJavaOpts("-cp", "/test-classes/")
             .addDockerOpts("--cap-add=SYS_PTRACE")
+            .addDockerOpts("--pull=never")
             .addDockerOpts("--name", CONTAINER_NAME)
             .addClassOptions("" + TIME_TO_RUN_CONTAINER_PROCESS);
 
-        if (IS_PODMAN && !ROOT_UID.equals(getId("-u"))) {
-            // map the current userid to the one in the target namespace
-            opts.addDockerOpts("--userns=keep-id");
-        }
-
         // avoid large Xmx
         opts.appendTestJavaOptions = false;
 
@@ -184,7 +180,7 @@ private static Process startObservedContainer() throws Exception {
         return ProcessTools.startProcess("main-container-process",
                                       pb,
                                       line -> line.contains(EventGeneratorLoop.MAIN_METHOD_STARTED),
-                                      5, TimeUnit.SECONDS);
+                                      15, TimeUnit.SECONDS);
     }
 
 
diff --git a/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java b/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java
index 3640f0ac587d..91a07012f003 100644
--- a/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java
+++ b/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java
@@ -49,10 +49,10 @@
 import java.util.EnumSet;
 import java.util.List;
 import java.util.Optional;
+import java.util.Random;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Consumer;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 
 import jdk.test.lib.Container;
 import jdk.test.lib.Platform;
@@ -68,7 +68,6 @@ public class TestJcmdWithSideCar {
     private static final String IMAGE_NAME = Common.imageName("jfr-jcmd");
     private static final int TIME_TO_RUN_MAIN_PROCESS = (int) (30 * Utils.TIMEOUT_FACTOR); // seconds
     private static final long TIME_TO_WAIT_FOR_MAIN_METHOD_START = 50 * 1000; // milliseconds
-    private static final String MAIN_CONTAINER_NAME = "test-container-main";
 
     private static final String UID = "uid";
     private static final String GID = "gid";
@@ -116,19 +115,19 @@ public static void main(String[] args) throws Exception {
                         // Elevated attach via proc/root not yet supported.
                         continue;
                     }
-                    long mainProcPid = testCase01(attachStrategy, elevated);
+                    long mainProcPid = testCase01(mainContainer, attachStrategy, elevated);
 
                     // Excluding the test case below until JDK-8228850 is fixed
                     // JDK-8228850: jhsdb jinfo fails with ClassCastException:
                     // s.j.h.oops.TypeArray cannot be cast to s.j.h.oops.Instance
                     // mainContainer.assertIsAlive();
-                    // testCase02(mainProcPid, attachStrategy, elevated);
+                    // testCase02(mainContainer, mainProcPid, attachStrategy, elevated);
 
                     mainContainer.assertIsAlive();
-                    testCase03(mainProcPid, attachStrategy, elevated);
+                    testCase03(mainContainer, mainProcPid, attachStrategy, elevated);
                 }
 
-                mainContainer.waitForAndCheck(TIME_TO_RUN_MAIN_PROCESS * 1000);
+                mainContainer.stop();
             }
         } finally {
             DockerTestUtils.removeDockerImage(IMAGE_NAME);
@@ -137,8 +136,8 @@ public static void main(String[] args) throws Exception {
 
 
     // Run "jcmd -l" in a sidecar container, find a target process.
-    private static long testCase01(AttachStrategy attachStrategy, boolean elevated) throws Exception {
-        OutputAnalyzer out = runSideCar(MAIN_CONTAINER_NAME, attachStrategy, elevated, "/jdk/bin/jcmd", "-l")
+    private static long testCase01(MainContainer mainContainer, AttachStrategy attachStrategy, boolean elevated) throws Exception {
+        OutputAnalyzer out = runSideCar(mainContainer, attachStrategy, elevated, "/jdk/bin/jcmd", "-l")
             .shouldHaveExitValue(0)
             .shouldContain("sun.tools.jcmd.JCmd");
         long pid = findProcess(out, "EventGeneratorLoop");
@@ -150,8 +149,8 @@ private static long testCase01(AttachStrategy attachStrategy, boolean elevated)
     }
 
     // run jhsdb jinfo  (jhsdb uses PTRACE)
-    private static void testCase02(long pid, AttachStrategy attachStrategy, boolean elevated) throws Exception {
-        runSideCar(MAIN_CONTAINER_NAME, attachStrategy, elevated, "/jdk/bin/jhsdb", "jinfo", "--pid", "" + pid)
+    private static void testCase02(MainContainer mainContainer, long pid, AttachStrategy attachStrategy, boolean elevated) throws Exception {
+        runSideCar(mainContainer, attachStrategy, elevated, "/jdk/bin/jhsdb", "jinfo", "--pid", "" + pid)
             .shouldHaveExitValue(0)
             .shouldContain("Java System Properties")
             .shouldContain("VM Flags");
@@ -159,11 +158,11 @@ private static void testCase02(long pid, AttachStrategy attachStrategy, boolean
 
     // test jcmd with some commands (help, start JFR recording)
     // JCMD will use signal mechanism and Unix Socket
-    private static void testCase03(long pid, AttachStrategy attachStrategy, boolean elevated) throws Exception {
-        runSideCar(MAIN_CONTAINER_NAME, attachStrategy, elevated, "/jdk/bin/jcmd", "" + pid, "help")
+    private static void testCase03(MainContainer mainContainer, long pid, AttachStrategy attachStrategy, boolean elevated) throws Exception {
+        runSideCar(mainContainer, attachStrategy, elevated, "/jdk/bin/jcmd", "" + pid, "help")
             .shouldHaveExitValue(0)
             .shouldContain("VM.version");
-        runSideCar(MAIN_CONTAINER_NAME, attachStrategy, elevated, "/jdk/bin/jcmd", "" + pid, "JFR.start")
+        runSideCar(mainContainer, attachStrategy, elevated, "/jdk/bin/jcmd", "" + pid, "JFR.start")
             .shouldHaveExitValue(0)
             .shouldContain("Started recording");
     }
@@ -175,18 +174,18 @@ private static void testCase03(long pid, AttachStrategy attachStrategy, boolean
     // we have two options:
     // 1. mount /tmp from the main container using --volumes-from.
     // 2. access /tmp from the main container via /proc//root/tmp.
-    private static OutputAnalyzer runSideCar(String mainContainerName, AttachStrategy attachStrategy, boolean elevated,  String whatToRun, String... args) throws Exception {
+    private static OutputAnalyzer runSideCar(MainContainer mainContainer, AttachStrategy attachStrategy, boolean elevated,  String whatToRun, String... args) throws Exception {
         System.out.println("Attach strategy " + attachStrategy);
 
         List initialCommands = List.of(
             Container.ENGINE_COMMAND, "run",
             "--tty=true", "--rm",
             "--cap-add=SYS_PTRACE", "--sig-proxy=true",
-            "--pid=container:" + mainContainerName
+            "--pid=container:" + mainContainer.name()
         );
 
         List attachStrategyCommands = switch (attachStrategy) {
-            case TMP_MOUNTED_INTO_SIDECAR -> List.of("--volumes-from", mainContainerName);
+            case TMP_MOUNTED_INTO_SIDECAR -> List.of("--volumes-from", mainContainer.name());
             case ACCESS_TMP_VIA_PROC_ROOT -> List.of();
         };
 
@@ -210,11 +209,11 @@ private static long findProcess(OutputAnalyzer out, String name) throws Exceptio
         List l = out.asLines()
             .stream()
             .filter(s -> s.contains(name))
-            .collect(Collectors.toList());
+            .toList();
         if (l.isEmpty()) {
             return -1;
         }
-        String psInfo = l.get(0);
+        String psInfo = l.getFirst();
         System.out.println("findProcess(): psInfo: " + psInfo);
         String pid = psInfo.substring(0, psInfo.indexOf(' '));
         System.out.println("findProcess(): pid: " + pid);
@@ -237,6 +236,10 @@ private static void sleep(long delay) {
 
 
     static class MainContainer {
+        private static final String MAIN_CONTAINER_NAME_PREFIX = "test-container-main";
+        private static final Random RANDOM = Utils.getRandomInstance();
+
+        String name;
         boolean mainMethodStarted;
         Process p;
 
@@ -256,8 +259,11 @@ public Process start(final boolean elevated) throws Exception {
                 opts.addDockerOpts(NET_BIND_SERVICE);
             }
 
+            name = MAIN_CONTAINER_NAME_PREFIX + "-elevated-" + elevated + "-" + RANDOM.nextInt();
+
             opts.addDockerOpts("--cap-add=SYS_PTRACE")
-                .addDockerOpts("--name", MAIN_CONTAINER_NAME)
+                .addDockerOpts("--init")
+                .addDockerOpts("--name", name)
                 .addDockerOpts("--volume", "/tmp")
                 .addDockerOpts("--volume", Paths.get(".").toAbsolutePath() + ":/workdir/")
                 .addJavaOpts("-XX:+UsePerfData")
@@ -297,25 +303,18 @@ public void waitFor(long timeout) throws Exception {
             p.waitFor(timeout, TimeUnit.MILLISECONDS);
         }
 
-        public void waitForAndCheck(long timeout) throws Exception {
-            int exitValue = -1;
-            int retryCount = 3;
-
-            do {
-                waitFor(timeout);
-                try {
-                    exitValue = p.exitValue();
-                } catch(IllegalThreadStateException ex) {
-                    System.out.println("IllegalThreadStateException occurred when calling exitValue()");
-                    retryCount--;
-                }
-            } while (exitValue == -1 && retryCount > 0);
-
-            if (exitValue != 0) {
-                throw new RuntimeException("DockerThread stopped unexpectedly, non-zero exit value is " + exitValue);
+        public void stop() throws Exception {
+            OutputAnalyzer out = DockerTestUtils.execute(Container.ENGINE_COMMAND, "ps")
+                    .shouldHaveExitValue(0);
+            if (out.contains(name)) {
+                DockerTestUtils.execute(Container.ENGINE_COMMAND, "stop", name)
+                        .shouldHaveExitValue(0);
             }
         }
 
+        public String name() {
+            return name;
+        }
     }
 
     private enum AttachStrategy {
diff --git a/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java b/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java
index 7b05669085c9..e8cb54d7d7b9 100644
--- a/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java
+++ b/test/hotspot/jtreg/containers/docker/TestLimitsUpdating.java
@@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception {
         try {
             testLimitUpdates();
         } finally {
-            if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
-                DockerTestUtils.removeDockerImage(imageName);
-            }
+            DockerTestUtils.removeDockerImage(imageName);
         }
     }
 
diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java b/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
index 06a874e008ae..a5fb3f829135 100644
--- a/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
+++ b/test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java
@@ -105,9 +105,7 @@ public static void main(String[] args) throws Exception {
             testMetricsSwapExceedingPhysical();
             testContainerMemExceedsPhysical();
         } finally {
-            if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
-                DockerTestUtils.removeDockerImage(imageName);
-            }
+            DockerTestUtils.removeDockerImage(imageName);
         }
     }
 
diff --git a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java
index fe976291c8a0..f449008bf44e 100644
--- a/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java
+++ b/test/hotspot/jtreg/containers/docker/TestMemoryWithSubgroups.java
@@ -64,66 +64,48 @@ public static void main(String[] args) throws Exception {
         Common.prepareWhiteBox();
         DockerTestUtils.buildJdkContainerImage(imageName);
 
-        if ("cgroupv1".equals(metrics.getProvider())) {
-            try {
-                testMemoryLimitSubgroupV1("200m", "100m", "104857600", false);
-                testMemoryLimitSubgroupV1("1g", "500m", "524288000", false);
-                testMemoryLimitSubgroupV1("200m", "100m", "104857600", true);
-                testMemoryLimitSubgroupV1("1g", "500m", "524288000", true);
-            } finally {
-                DockerTestUtils.removeDockerImage(imageName);
-            }
-        } else if ("cgroupv2".equals(metrics.getProvider())) {
-            try {
-                testMemoryLimitSubgroupV2("200m", "100m", "104857600", false);
-                testMemoryLimitSubgroupV2("1g", "500m", "524288000", false);
-                testMemoryLimitSubgroupV2("200m", "100m", "104857600", true);
-                testMemoryLimitSubgroupV2("1g", "500m", "524288000", true);
-            } finally {
-                DockerTestUtils.removeDockerImage(imageName);
-            }
-        } else {
+        String provider = metrics.getProvider();
+        if (!"cgroupv1".equals(provider) && !"cgroupv2".equals(provider)) {
             throw new SkippedException("Metrics are from neither cgroup v1 nor v2, skipped for now.");
         }
-    }
-
-    private static void testMemoryLimitSubgroupV1(String containerMemorySize, String valueToSet, String expectedValue, boolean privateNamespace)
-            throws Exception {
-
-        Common.logNewTestCase("Cgroup V1 subgroup memory limit: " + valueToSet);
 
-        DockerRunOptions opts = new DockerRunOptions(imageName, "sh", "-c");
-        opts.javaOpts = new ArrayList<>();
-        opts.appendTestJavaOptions = false;
-        opts.addDockerOpts("--privileged")
-            .addDockerOpts("--cgroupns=" + (privateNamespace ? "private" : "host"))
-            .addDockerOpts("--memory", containerMemorySize);
-        opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " +
-            "echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.limit_in_bytes ; " +
-            "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " +
-            "/jdk/bin/java -Xlog:os+container=trace -version");
-
-        Common.run(opts)
-            .shouldMatch("Lowest limit was:.*" + expectedValue);
+        try {
+            testMemoryLimitSubgroup(provider, "200m", "100m", "104857600", false);
+            testMemoryLimitSubgroup(provider, "1g", "500m", "524288000", false);
+            testMemoryLimitSubgroup(provider, "200m", "100m", "104857600", true);
+            testMemoryLimitSubgroup(provider, "1g", "500m", "524288000", true);
+        } finally {
+            DockerTestUtils.removeDockerImage(imageName);
+        }
     }
 
-    private static void testMemoryLimitSubgroupV2(String containerMemorySize, String valueToSet, String expectedValue, boolean privateNamespace)
+    private static void testMemoryLimitSubgroup(String cgroupVersion, String containerMemorySize,
+                                                String valueToSet, String expectedValue, boolean privateNamespace)
             throws Exception {
 
-        Common.logNewTestCase("Cgroup V2 subgroup memory limit: " + valueToSet);
+        final String upperVersion = "cgroupv1".equals(cgroupVersion) ? "V1" : "V2";
+        Common.logNewTestCase("Cgroup " + upperVersion + " subgroup memory limit: " + valueToSet);
 
         DockerRunOptions opts = new DockerRunOptions(imageName, "sh", "-c");
         opts.javaOpts = new ArrayList<>();
         opts.appendTestJavaOptions = false;
         opts.addDockerOpts("--privileged")
+            .addDockerOpts("--user", "root")
             .addDockerOpts("--cgroupns=" + (privateNamespace ? "private" : "host"))
             .addDockerOpts("--memory", containerMemorySize);
-        opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " +
-            "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " +
-            "echo '+memory' > /sys/fs/cgroup/cgroup.subtree_control ; " +
-            "echo '+memory' > /sys/fs/cgroup/memory/cgroup.subtree_control ; " +
-            "echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.max ; " +
-            "/jdk/bin/java -Xlog:os+container=trace -version");
+        if ("cgroupv1".equals(cgroupVersion)) {
+            opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " +
+                "echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.limit_in_bytes ; " +
+                "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " +
+                "/jdk/bin/java -Xlog:os+container=trace -version");
+        } else {
+            opts.addClassOptions("mkdir -p /sys/fs/cgroup/memory/test ; " +
+                "echo $$ > /sys/fs/cgroup/memory/test/cgroup.procs ; " +
+                "echo '+memory' > /sys/fs/cgroup/cgroup.subtree_control ; " +
+                "echo '+memory' > /sys/fs/cgroup/memory/cgroup.subtree_control ; " +
+                "echo " + valueToSet + " > /sys/fs/cgroup/memory/test/memory.max ; " +
+                "/jdk/bin/java -Xlog:os+container=trace -version");
+        }
 
         Common.run(opts)
             .shouldMatch("Lowest limit was:.*" + expectedValue);
diff --git a/test/hotspot/jtreg/containers/docker/TestMisc.java b/test/hotspot/jtreg/containers/docker/TestMisc.java
index 4da130673994..400119dac9df 100644
--- a/test/hotspot/jtreg/containers/docker/TestMisc.java
+++ b/test/hotspot/jtreg/containers/docker/TestMisc.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
@@ -29,20 +29,24 @@
  * @requires !vm.asan
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.platform
  *          java.management
  *          jdk.jartool/sun.tools.jar
  * @build CheckContainerized jdk.test.whitebox.WhiteBox PrintContainerInfo
  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar jdk.test.whitebox.WhiteBox
  * @run driver TestMisc
  */
+import jdk.internal.platform.Metrics;
 import jdk.test.lib.containers.docker.Common;
 import jdk.test.lib.containers.docker.DockerTestUtils;
 import jdk.test.lib.containers.docker.DockerRunOptions;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
+import jtreg.SkippedException;
 
 
 public class TestMisc {
+    private static final Metrics metrics = Metrics.systemMetrics();
     private static final String imageName = Common.imageName("misc");
 
     public static void main(String[] args) throws Exception {
@@ -58,6 +62,7 @@ public static void main(String[] args) throws Exception {
             testIsContainerized();
             testPrintContainerInfo();
             testPrintContainerInfoActiveProcessorCount();
+            testPrintContainerInfoCPUShares();
         } finally {
             DockerTestUtils.removeDockerImage(imageName);
         }
@@ -94,8 +99,53 @@ private static void testPrintContainerInfo() throws Exception {
         checkContainerInfo(Common.run(opts));
     }
 
+    // Test the mapping function on cgroups v2. Should also pass on cgroups v1 as it's
+    // a direct mapping there.
+    private static void testPrintContainerInfoCPUShares() throws Exception {
+        // Test won't work on cgv1 rootless podman since resource limits don't
+        // work there.
+        if ("cgroupv1".equals(metrics.getProvider()) &&
+            DockerTestUtils.isPodman() &&
+            DockerTestUtils.isRootless()) {
+            throw new SkippedException("Resource limits required for testPrintContainerInfoCPUShares(). " +
+                                       "This is cgv1 with podman in rootless mode. Test skipped.");
+        }
+        // Anything less than 1024 should return the back-mapped cpu-shares value without
+        // rounding to next multiple of 1024 (on cg v2). Only ensure that we get
+        // 'cpu_shares: ' over 'cpu_shares: no shares'.
+        printContainerInfo(512, 1024, false);
+        // Don't use 1024 exactly so as to avoid mapping to the unlimited/uset case.
+        // Use a value > 100 post-mapping so as to hit the non-default branch: 1052 => 103
+        printContainerInfo(1052, 1024, true);
+        // need at least 2 CPU cores for this test to work
+        if (Runtime.getRuntime().availableProcessors() >= 2) {
+            printContainerInfo(2048, 2048, true);
+        }
+    }
+
+    private static void printContainerInfo(int cpuShares, int expected, boolean numberMatch) throws Exception {
+        Common.logNewTestCase("Test print_container_info() - cpu shares - given: " + cpuShares + ", expected: " + expected);
+
+        DockerRunOptions opts = Common.newOpts(imageName, "PrintContainerInfo");
+        Common.addWhiteBoxOpts(opts);
+        opts.addDockerOpts("--cpu-shares", Integer.valueOf(cpuShares).toString());
+
+        OutputAnalyzer out = Common.run(opts);
+        String str = out.getOutput();
+        boolean isCgroupV2 = str.contains("cgroupv2");
+        // cg v1 maps cpu shares values verbatim. Only cg v2 uses the
+        // mapping function.
+        if (numberMatch) {
+          int valueExpected = isCgroupV2 ? expected : cpuShares;
+          out.shouldContain("cpu_shares: " + valueExpected);
+        } else {
+          // must not print "no shares"
+          out.shouldNotContain("cpu_shares: no shares");
+        }
+    }
+
     private static void testPrintContainerInfoActiveProcessorCount() throws Exception {
-        Common.logNewTestCase("Test print_container_info()");
+        Common.logNewTestCase("Test print_container_info() - ActiveProcessorCount");
 
         DockerRunOptions opts = Common.newOpts(imageName, "PrintContainerInfo").addJavaOpts("-XX:ActiveProcessorCount=2");
         Common.addWhiteBoxOpts(opts);
@@ -111,9 +161,11 @@ private static void checkContainerInfo(OutputAnalyzer out) throws Exception {
             "CPU Shares",
             "CPU Quota",
             "CPU Period",
+            "CPU Usage",
             "OSContainer::active_processor_count",
             "Memory Limit",
             "Memory Soft Limit",
+            "Memory Throttle Limit",
             "Memory Usage",
             "Maximum Memory Usage",
             "memory_max_usage_in_bytes",
diff --git a/test/hotspot/jtreg/containers/docker/TestPids.java b/test/hotspot/jtreg/containers/docker/TestPids.java
index 62bd70dc61fb..07a0cbd295dc 100644
--- a/test/hotspot/jtreg/containers/docker/TestPids.java
+++ b/test/hotspot/jtreg/containers/docker/TestPids.java
@@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception {
         try {
             testPids();
         } finally {
-            if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
-                DockerTestUtils.removeDockerImage(imageName);
-            }
+            DockerTestUtils.removeDockerImage(imageName);
         }
     }
 
diff --git a/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java b/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java
new file mode 100644
index 000000000000..9de4cbf4cfac
--- /dev/null
+++ b/test/hotspot/jtreg/gc/TestUseGCOverheadLimit.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package gc;
+
+/*
+ * @test id=Parallel
+ * @requires vm.gc.Parallel & false
+ * @requires !vm.debug
+ * @summary Verifies that the UseGCOverheadLimit functionality works in Parallel GC.
+ * @library /test/lib
+ * @run driver gc.TestUseGCOverheadLimit Parallel
+ */
+
+/*
+ * @test id=G1
+ * @requires vm.gc.G1
+ * @requires !vm.debug
+ * @summary Verifies that the UseGCOverheadLimit functionality works in G1 GC.
+ * @library /test/lib
+ * @run driver gc.TestUseGCOverheadLimit G1
+ */
+
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class TestUseGCOverheadLimit {
+  public static void main(String args[]) throws Exception {
+    String[] parallelArgs = {
+      "-XX:+UseParallelGC",
+      "-XX:NewSize=122m",
+      "-XX:SurvivorRatio=99",
+      "-XX:GCHeapFreeLimit=10"
+    };
+    String[] g1Args = {
+      "-XX:+UseG1GC",
+      "-XX:GCHeapFreeLimit=5"
+    };
+
+    String[] selectedArgs = args[0].equals("G1") ? g1Args : parallelArgs;
+
+    final String[] commonArgs = {
+      "-XX:ParallelGCThreads=1",      // Make GCs take longer.
+      "-XX:+UseGCOverheadLimit",
+      "-Xlog:gc=debug",
+      "-XX:GCTimeLimit=80",           // Ease the CPU requirement.
+      "-Xmx128m",
+      Allocating.class.getName()
+    };
+
+    String[] vmArgs = Stream.concat(Arrays.stream(selectedArgs), Arrays.stream(commonArgs)).toArray(String[]::new);
+    OutputAnalyzer output = ProcessTools.executeLimitedTestJava(vmArgs);
+    output.shouldNotHaveExitValue(0);
+
+    System.out.println(output.getStdout());
+
+    output.stdoutShouldContain("GC Overhead Limit exceeded too often (5).");
+  }
+
+  static class Allocating {
+    public static void main(String[] args) {
+      Object[] cache = new Object[1024 * 1024 * 2];
+
+      // Allocate random objects, keeping around data, causing garbage
+      // collections.
+      for (int i = 0; i < 1024* 1024 * 30; i++) {
+        Object[] obj = new Object[10];
+        cache[i % cache.length] = obj;
+      }
+
+      System.out.println(cache);
+    }
+  }
+}
diff --git a/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java b/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java
index 40dfc4dc7fbe..2cd9e9cd60b2 100644
--- a/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java
+++ b/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,30 @@
 package gc.arguments;
 
 /*
- * @test TestParallelRefProc
- * @summary Test defaults processing for -XX:+ParallelRefProcEnabled.
+ * @test id=Serial
+ * @summary Test defaults processing for -XX:+ParallelRefProcEnabled with Serial GC.
  * @library /test/lib
  * @library /
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.arguments.TestParallelRefProc
+ * @requires vm.gc.Serial
+ * @run driver gc.arguments.TestParallelRefProc Serial
+ */
+
+/*
+ * @test id=Parallel
+ * @summary Test defaults processing for -XX:+ParallelRefProcEnabled with Parallel GC.
+ * @library /test/lib
+ * @library /
+ * @requires vm.gc.Parallel
+ * @run driver gc.arguments.TestParallelRefProc Parallel
+ */
+
+/*
+ * @test id=G1
+ * @summary Test defaults processing for -XX:+ParallelRefProcEnabled with G1 GC.
+ * @library /test/lib
+ * @library /
+ * @requires vm.gc.G1
+ * @run driver gc.arguments.TestParallelRefProc G1
  */
 
 import java.util.Arrays;
@@ -38,34 +55,46 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 
-import jtreg.SkippedException;
-import jdk.test.whitebox.gc.GC;
-
 public class TestParallelRefProc {
 
     public static void main(String args[]) throws Exception {
-        boolean noneGCSupported = true;
-        if (GC.Serial.isSupported()) {
-            noneGCSupported = false;
-            testFlag(new String[] { "-XX:+UseSerialGC" }, false);
+        if (args.length == 0) {
+            throw new IllegalArgumentException("Test type must be specified as argument");
         }
-        if (GC.Parallel.isSupported()) {
-            noneGCSupported = false;
-            testFlag(new String[] { "-XX:+UseParallelGC", "-XX:ParallelGCThreads=1" }, false);
-            testFlag(new String[] { "-XX:+UseParallelGC", "-XX:ParallelGCThreads=2" }, true);
-            testFlag(new String[] { "-XX:+UseParallelGC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false);
-        }
-        if (GC.G1.isSupported()) {
-            noneGCSupported = false;
-            testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=1" }, false);
-            testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=2" }, true);
-            testFlag(new String[] { "-XX:+UseG1GC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false);
-        }
-        if (noneGCSupported) {
-            throw new SkippedException("Skipping test because none of Serial/Parallel/G1 is supported.");
+
+        String testType = args[0];
+
+        switch (testType) {
+            case "Serial":
+                testSerial();
+                break;
+            case "Parallel":
+                testParallel();
+                break;
+            case "G1":
+                testG1();
+                break;
+            default:
+                throw new IllegalArgumentException("Unknown test type \"" + testType + "\"");
         }
     }
 
+    private static void testSerial() throws Exception {
+        testFlag(new String[] { "-XX:+UseSerialGC" }, false);
+    }
+
+    private static void testParallel() throws Exception {
+        testFlag(new String[] { "-XX:+UseParallelGC", "-XX:ParallelGCThreads=1" }, false);
+        testFlag(new String[] { "-XX:+UseParallelGC", "-XX:ParallelGCThreads=2" }, true);
+        testFlag(new String[] { "-XX:+UseParallelGC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false);
+    }
+
+    private static void testG1() throws Exception {
+        testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=1" }, false);
+        testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=2" }, true);
+        testFlag(new String[] { "-XX:+UseG1GC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false);
+    }
+
     private static final String parallelRefProcEnabledPattern =
         " *bool +ParallelRefProcEnabled *= *true +\\{product\\}";
 
@@ -77,7 +106,7 @@ private static void testFlag(String[] args, boolean expectedTrue) throws Excepti
         result.addAll(Arrays.asList(args));
         result.add("-XX:+PrintFlagsFinal");
         result.add("-version");
-        OutputAnalyzer output = GCArguments.executeLimitedTestJava(result);
+        OutputAnalyzer output = GCArguments.executeTestJava(result);
 
         output.shouldHaveExitValue(0);
 
diff --git a/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java b/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java
index fb4787f452fe..a5e144bcd151 100644
--- a/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java
+++ b/test/hotspot/jtreg/gc/arguments/TestSelectDefaultGC.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@ public static void assertVMOption(OutputAnalyzer output, String option, boolean
 
     public static void testDefaultGC(boolean actAsServer) throws Exception {
         // Start VM without specifying GC
-        OutputAnalyzer output = GCArguments.executeLimitedTestJava(
+        OutputAnalyzer output = GCArguments.executeTestJava(
             "-XX:" + (actAsServer ? "+" : "-") + "AlwaysActAsServerClassMachine",
             "-XX:" + (actAsServer ? "-" : "+") + "NeverActAsServerClassMachine",
             "-XX:+PrintFlagsFinal",
diff --git a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java
index 282c4fcfc14d..4e7f2ca32ac6 100644
--- a/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java
+++ b/test/hotspot/jtreg/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,111 +28,68 @@
  * @bug 8051973
  * @summary Test to make sure that eager reclaim of humongous objects correctly clears
  * mark bitmaps at reclaim.
- * @key randomness
  * @requires vm.gc.G1
  * @requires vm.debug
- * @library /test/lib
+ * @library /test/lib /testlibrary /
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
  * @run driver gc.g1.TestEagerReclaimHumongousRegionsClearMarkBits
  */
 
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.Random;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
+import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.Utils;
-
-// An object that has a few references to other instances to slow down marking.
-class ObjectWithSomeRefs {
-    public ObjectWithSomeRefs other1;
-    public ObjectWithSomeRefs other2;
-    public ObjectWithSomeRefs other3;
-    public ObjectWithSomeRefs other4;
-}
-
-class TestEagerReclaimHumongousRegionsClearMarkBitsReclaimRegionFast {
-    public static final long MAX_MILLIS_FOR_RUN = 50 * 1000; // The maximum runtime for the actual test.
+import jdk.test.whitebox.WhiteBox;
 
-    public static final int M = 1024*1024;
+public class TestEagerReclaimHumongousRegionsClearMarkBits {
+    public static void main(String[] args) throws Exception {
+        OutputAnalyzer output = ProcessTools.executeLimitedTestJava("-XX:+UseG1GC",
+                                                                    "-Xmx20M",
+                                                                    "-Xms20m",
+                                                                    "-XX:+UnlockDiagnosticVMOptions",
+                                                                    "-XX:+VerifyAfterGC",
+                                                                    "-Xbootclasspath/a:.",
+                                                                    "-Xlog:gc=debug,gc+humongous=debug",
+                                                                    "-XX:+UnlockDiagnosticVMOptions",
+                                                                    "-XX:+WhiteBoxAPI",
+                                                                    TestEagerReclaimHumongousRegionsClearMarkBitsRunner.class.getName());
+
+        String log = output.getStdout();
+        System.out.println(log);
+        output.shouldHaveExitValue(0);
 
-    public static LinkedList garbageList = new LinkedList();
+        // Find the log output indicating that the humongous object has been reclaimed, and marked.
+        Pattern pattern = Pattern.compile("Humongous region .* marked 1 reclaim candidate 1 type array 1");
+        Asserts.assertTrue(pattern.matcher(log).find(), "Could not find log output matching marked humongous region.");
 
-    public static void genGarbage(Object large) {
-        for (int i = 0; i < 64*1024; i++) {
-            Object[] garbage = new Object[50];
-            garbage[0] = large;
-            garbageList.add(garbage);
-        }
-        garbageList.clear();
+        pattern = Pattern.compile("Reclaimed humongous region .*");
+        Asserts.assertTrue(pattern.matcher(log).find(), "Could not find log output reclaiming humongous region");
     }
+}
 
-    public static ArrayList longList = new ArrayList();
+class TestEagerReclaimHumongousRegionsClearMarkBitsRunner {
+    private static final WhiteBox WB = WhiteBox.getWhiteBox();
+    private static final int M = 1024 * 1024;
 
     public static void main(String[] args) {
+        WB.fullGC();
 
-        for (int i = 0; i < 16*1024; i++) {
-             longList.add(new ObjectWithSomeRefs());
-        }
-
-        Random rnd = Utils.getRandomInstance();
-        for (int i = 0; i < longList.size(); i++) {
-             int len = longList.size();
-             longList.get(i).other1 = longList.get(rnd.nextInt(len));
-             longList.get(i).other2 = longList.get(rnd.nextInt(len));
-             longList.get(i).other3 = longList.get(rnd.nextInt(len));
-             longList.get(i).other4 = longList.get(rnd.nextInt(len));
-        }
-
-        int[] large1 = new int[M];
-        int[] large2 = null;
-        int[] large3 = null;
-        int[] large4 = null;
-
-        Object ref_from_stack = large1;
-
-        long start_millis = System.currentTimeMillis();
-
-        for (int i = 0; i < 20; i++) {
-            long current_millis = System.currentTimeMillis();
-            if ((current_millis - start_millis) > MAX_MILLIS_FOR_RUN) {
-              System.out.println("Finishing test because maximum runtime exceeded");
-              break;
-            }
-            // A set of large objects that will be reclaimed eagerly - and hopefully marked.
-            large1 = new int[M - 20];
-            large2 = new int[M - 20];
-            large3 = new int[M - 20];
-            large4 = new int[M - 20];
-            genGarbage(large1);
-            // Make sure that the compiler cannot completely remove
-            // the allocation of the large object until here.
-            System.out.println(large1 + " " + large2 + " " + large3 + " " + large4);
-        }
-
-        // Keep the reference to the first object alive.
-        System.out.println(ref_from_stack);
-    }
-}
+        Object largeObj = new int[M]; // Humongous object.
 
-public class TestEagerReclaimHumongousRegionsClearMarkBits {
-    public static void main(String[] args) throws Exception {
-        OutputAnalyzer output = ProcessTools.executeLimitedTestJava(
-            "-XX:+UseG1GC",
-            "-Xms128M",
-            "-Xmx128M",
-            "-Xmn2M",
-            "-XX:G1HeapRegionSize=1M",
-            "-XX:InitiatingHeapOccupancyPercent=0", // Want to have as much as possible mark cycles.
-            "-Xlog:gc",
-            "-XX:+UnlockDiagnosticVMOptions",
-            "-XX:+VerifyAfterGC",
-            "-XX:ConcGCThreads=1", // Want to make marking as slow as possible.
-            "-XX:+G1VerifyBitmaps",
-            TestEagerReclaimHumongousRegionsClearMarkBitsReclaimRegionFast.class.getName());
-        output.shouldHaveExitValue(0);
+        WB.concurrentGCAcquireControl();
+        WB.concurrentGCRunTo(WB.BEFORE_MARKING_COMPLETED);
+
+        System.out.println("Large object at " + largeObj);
+
+        largeObj = null;
+        WB.youngGC(); // Should reclaim marked humongous object.
+
+        WB.concurrentGCRunToIdle();
     }
 }
 
diff --git a/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java b/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java
index e9bd47a8f55a..107ebbb3901a 100644
--- a/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java
+++ b/test/hotspot/jtreg/gc/shenandoah/compiler/TestLinkToNativeRBP.java
@@ -28,10 +28,11 @@
  * @summary guarantee(loc != NULL) failed: missing saved register with native invoke
  *
  * @requires vm.flavor == "server"
- * @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") | os.arch == "aarch64" | os.arch == "ppc64" | os.arch == "ppc64le"
+ * @requires ((os.arch == "amd64" | os.arch == "x86_64") & sun.arch.data.model == "64") |
+              os.arch == "aarch64" | os.arch == "ppc64" | os.arch == "ppc64le" | os.arch == "riscv64"
  * @requires vm.gc.Shenandoah
  *
- * @run main/othervm --enable-native-access=ALL-UNNAMED -XX:+UnlockDiagnosticVMOptions
+ * @run main/native/othervm --enable-native-access=ALL-UNNAMED -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive TestLinkToNativeRBP
  *
  */
diff --git a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java
index 0d7e26c91d8c..f55a6f5d8a07 100644
--- a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java
+++ b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java
@@ -24,17 +24,58 @@
 package gc.stress;
 
 /*
- * @test TestReclaimStringsLeaksMemory
+ * @test id=Serial
  * @bug 8180048
- * @summary Ensure that during a Full GC interned string memory is reclaimed completely.
- * @requires vm.gc == "null"
+ * @summary Ensure that during a Full GC interned string memory is reclaimed completely with SerialGC.
+ * @requires vm.gc.Serial
  * @requires !vm.debug
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- * @run driver gc.stress.TestReclaimStringsLeaksMemory
- * @run driver gc.stress.TestReclaimStringsLeaksMemory -XX:+UseSerialGC
- * @run driver gc.stress.TestReclaimStringsLeaksMemory -XX:+UseParallelGC
- * @run driver gc.stress.TestReclaimStringsLeaksMemory -XX:+UseG1GC
+ * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseSerialGC
+ */
+
+/*
+ * @test id=Parallel
+ * @bug 8180048
+ * @summary Ensure that during a Full GC interned string memory is reclaimed completely with ParallelGC.
+ * @requires vm.gc.Parallel
+ * @requires !vm.debug
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseParallelGC
+ */
+
+/*
+ * @test id=G1
+ * @bug 8180048
+ * @summary Ensure that during a Full GC interned string memory is reclaimed completely with G1GC.
+ * @requires vm.gc.G1
+ * @requires !vm.debug
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseG1GC
+ */
+
+/*
+ * @test id=Shenandoah
+ * @bug 8180048
+ * @summary Ensure that during a Full GC interned string memory is reclaimed completely with ShenandoahGC.
+ * @requires vm.gc.Shenandoah
+ * @requires !vm.debug
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseShenandoahGC
+ */
+
+/*
+ * @test id=Z
+ * @bug 8180048
+ * @summary Ensure that during a Full GC interned string memory is reclaimed completely with ZGC.
+ * @requires vm.gc.Z
+ * @requires !vm.debug
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ * @run driver/timeout=480 gc.stress.TestReclaimStringsLeaksMemory -XX:+UseZGC
  */
 
 import java.util.Arrays;
diff --git a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java
index 78a508343d67..d87ca25fc3cc 100644
--- a/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java
+++ b/test/hotspot/jtreg/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOption.java
@@ -116,7 +116,7 @@ static JVMOption createVMOption(String type, String name) {
             default:
                 throw new Error("Expected only \"int\", \"intx\", \"size_t\", "
                         + "\"uint\", \"uintx\", \"uint64_t\", or \"double\" "
-                        + "option types! Got " + type + " type!");
+                        + "option types! Got " + type + " type for option " + name + "!");
         }
 
         return parameter;
diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java
index e9bc29f1d1b2..e2b525581f00 100644
--- a/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/CreateCoredumpOnCrash.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
  *          java.management
  *          jdk.internal.jvmstat/sun.jvmstat.monitor
  * @run driver CreateCoredumpOnCrash
- * @requires !vm.asan
+ * @requires !vm.asan & vm.flagless
  */
 
 import jdk.test.lib.process.ProcessTools;
@@ -44,24 +44,61 @@ public static void main(String[] args) {
         }
     }
 
+    private static String ulimitString(int limit) {
+        String string = "ulimit -c ";
+        if (limit != Integer.MAX_VALUE) {
+            string += limit;
+        } else {
+            string += "unlimited";
+        }
+        return string+";";
+    }
+
     public static void main(String[] args) throws Exception {
         runTest("-XX:-CreateCoredumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped")
-                                             .shouldNotHaveExitValue(0);
+        .shouldNotHaveExitValue(0);
 
         if (Platform.isWindows()) {
             // The old CreateMinidumpOnCrash option should still work
             runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped")
-                                                 .shouldNotHaveExitValue(0);
+            .shouldNotHaveExitValue(0);
         } else {
-            runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped")
-                                                 .shouldNotHaveExitValue(0);
-        }
+            String exec_cmd[] = {"sh", "-c", "ulimit -c"};
+            OutputAnalyzer oa = new OutputAnalyzer(Runtime.getRuntime().exec(exec_cmd));
+            oa.shouldHaveExitValue(0);
+            if (!oa.contains("0\n")) {
+                oa = runTest("-XX:+CreateCoredumpOnCrash");
+                oa.shouldContain("Core dump will be written.");
+                oa.shouldNotHaveExitValue(0);
 
+                oa = runTest("-XX:+CreateCoredumpOnCrash", ulimitString(1024));
+                oa.shouldContain("warning: CreateCoredumpOnCrash specified, but");
+                oa.shouldNotHaveExitValue(0);
+
+                oa = runTest("-XX:+CreateCoredumpOnCrash", ulimitString(0));
+                oa.shouldContain("warning: CreateCoredumpOnCrash specified, but");
+                oa.shouldNotHaveExitValue(0);
+            } else {
+                throw new Exception("ulimit is not set correctly, try 'ulimit -c unlimited' and re-run.");
+            }
+        }
     }
+
     public static OutputAnalyzer runTest(String option) throws Exception {
-        return new OutputAnalyzer(
-            ProcessTools.createLimitedTestJavaProcessBuilder(
-            "-Xmx128m", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", option, Crasher.class.getName())
-            .start());
+        ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128m",
+                                                                             "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
+                                                                             option, Crasher.class.getName());
+        return new OutputAnalyzer(pb.start());
+    }
+    public static OutputAnalyzer runTest(String option, String limit) throws Exception {
+        ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xmx128m",
+                                                                             "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
+                                                                             option, new String("'"+Crasher.class.getName()+"'"));
+        String args = "";
+        for (String s:pb.command()) {
+            args += s+" ";
+        }
+        String exec_cmd[] = {"sh", "-c", limit+args};
+        return new OutputAnalyzer(Runtime.getRuntime().exec(exec_cmd));
     }
 }
diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java b/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java
index 7d7deffdb6e3..7f25f20e8943 100644
--- a/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/StackWalkNativeToJava.java
@@ -33,7 +33,7 @@
  * @test StackWalkNativeToJava
  * @bug 8316309
  * @summary Check that walking the stack works fine when going from C++ frame to Java frame.
- * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64"
+ * @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="aarch64" | os.arch=="riscv64"
  * @requires os.family != "windows"
  * @requires vm.flagless
  * @library /test/lib
diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java
index 0be39d22ebec..26d1f726febd 100644
--- a/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,8 +72,8 @@ public static void main(String[] args) throws Exception {
            #
            # JRE version: OpenJDK Runtime Environment (9.0) (build 1.9.0-internal-debug-cheleswer_2015_10_20_14_32-b00)
            # Java VM: OpenJDK 64-Bit Server VM (1.9.0-internal-debug-cheleswer_2015_10_20_14_32-b00, mixed mode, tiered, compressed oops, serial gc, linux-amd64)
-           # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %P" (or dumping to
-             /home/cheleswer/Desktop/core.6212)
+           # Core dump will be written. Default location: Determined by the following:
+           "/usr/share/apport/apport %p %s %c %P" (alternatively, falling back to /home/cheleswer/Desktop/core.6212)
            #
            # An error report file with more information is saved as:
            # /home/cheleswer/Desktop/hs_err_pid6212.log
diff --git a/test/hotspot/jtreg/runtime/Metaspace/DefineClass.java b/test/hotspot/jtreg/runtime/Metaspace/DefineClass.java
index 302bf7cdc73b..9c7d1b5532a4 100644
--- a/test/hotspot/jtreg/runtime/Metaspace/DefineClass.java
+++ b/test/hotspot/jtreg/runtime/Metaspace/DefineClass.java
@@ -193,7 +193,7 @@ private static int getStringIndex(String needle, byte[] buf) {
 
     private static int getStringIndex(String needle, byte[] buf, int offset) {
         outer:
-        for (int i = offset; i < buf.length - offset - needle.length(); i++) {
+        for (int i = offset; i <= buf.length - needle.length(); i++) {
             for (int j = 0; j < needle.length(); j++) {
                 if (buf[i + j] != (byte)needle.charAt(j)) continue outer;
             }
diff --git a/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java b/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java
index 31aeaccf07a4..b1e6d0aa8c7d 100644
--- a/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java
+++ b/test/hotspot/jtreg/runtime/Monitor/MonitorWithDeadObjectTest.java
@@ -32,20 +32,21 @@
  */
 
 /*
- * @requires os.family != "windows" & os.family != "aix"
  * @test id=DetachThread
+ * @requires os.family != "windows" & os.family != "aix"
  * @run main/othervm/native MonitorWithDeadObjectTest 0
  */
 
 /*
- * @requires os.family != "windows" & os.family != "aix"
  * @test id=DumpThreadsBeforeDetach
+ * @comment Temporarily exclude on Musl-C debug until JDK-8366133 is fixed.
+ * @requires os.family != "windows" & os.family != "aix" & (!vm.musl | !vm.debug)
  * @run main/othervm/native MonitorWithDeadObjectTest 1
  */
 
 /*
- * @requires os.family != "windows" & os.family != "aix"
  * @test id=DumpThreadsAfterDetach
+ * @requires os.family != "windows" & os.family != "aix"
  * @run main/othervm/native MonitorWithDeadObjectTest 2
  */
 
diff --git a/test/hotspot/jtreg/runtime/NMT/CommandLineDetail.java b/test/hotspot/jtreg/runtime/NMT/CommandLineDetail.java
index 57f2302db307..a7561c7792ef 100644
--- a/test/hotspot/jtreg/runtime/NMT/CommandLineDetail.java
+++ b/test/hotspot/jtreg/runtime/NMT/CommandLineDetail.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,13 +35,14 @@
 
 public class CommandLineDetail {
 
-  public static void main(String args[]) throws Exception {
-
-    ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
-      "-XX:NativeMemoryTracking=detail",
-      "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
+            "-Xlog:nmt=warning",
+            "-XX:NativeMemoryTracking=detail",
+            "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("NMT initialization failed");
+        output.shouldNotContain("Could not create the Java Virtual Machine.");
+        output.shouldHaveExitValue(0);
+    }
 }
diff --git a/test/hotspot/jtreg/runtime/NMT/CommandLineSummary.java b/test/hotspot/jtreg/runtime/NMT/CommandLineSummary.java
index 02b37a40ef41..381fe3eba343 100644
--- a/test/hotspot/jtreg/runtime/NMT/CommandLineSummary.java
+++ b/test/hotspot/jtreg/runtime/NMT/CommandLineSummary.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,13 +35,14 @@
 
 public class CommandLineSummary {
 
-  public static void main(String args[]) throws Exception {
-
-    ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
-      "-XX:NativeMemoryTracking=summary",
-      "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
+    public static void main(String args[]) throws Exception {
+        ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(
+            "-Xlog:nmt=warning",
+            "-XX:NativeMemoryTracking=summary",
+            "-version");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("NMT initialization failed");
+        output.shouldNotContain("Could not create the Java Virtual Machine.");
+        output.shouldHaveExitValue(0);
+    }
 }
diff --git a/test/hotspot/jtreg/runtime/Thread/AsyncExceptionOnMonitorEnter.java b/test/hotspot/jtreg/runtime/Thread/AsyncExceptionOnMonitorEnter.java
index 8446ffb20fe2..409313b9626e 100644
--- a/test/hotspot/jtreg/runtime/Thread/AsyncExceptionOnMonitorEnter.java
+++ b/test/hotspot/jtreg/runtime/Thread/AsyncExceptionOnMonitorEnter.java
@@ -44,9 +44,13 @@ public class AsyncExceptionOnMonitorEnter extends Thread {
     public static native int exitRawMonitor();
     public static native void destroyRawMonitor();
 
+    // Avoid using CountDownLatch or similar objects that require unparking the
+    // main thread. Otherwise, if the main thread is run as a virtual thread, the
+    // async exception could be sent while the target is still executing FJP logic.
+    public volatile boolean started = false;
+    public volatile boolean gotMonitor = false;
+
     private static Object o1 = new Object();
-    private static boolean firstWorker = true;
-    private static Semaphore sem = new Semaphore(0);
 
     @Override
     public void run() {
@@ -59,11 +63,9 @@ public void run() {
 
     public void testWithJavaMonitor() {
         try {
+            started = true;
             synchronized (o1) {
-                if (firstWorker) {
-                    firstWorker = false;
-                    sem.release();
-                }
+                gotMonitor = true;
                 Thread.sleep(1000);
             }
         } catch (ThreadDeath td) {
@@ -74,20 +76,16 @@ public void testWithJavaMonitor() {
 
 
     public void testWithJVMTIRawMonitor() {
-        boolean savedFirst = false;
         try {
+            started = true;
             int retCode = enterRawMonitor();
-            if (retCode != 0 && firstWorker) {
+            if (retCode != 0) {
                 throw new RuntimeException("error in JVMTI RawMonitorEnter: retCode=" + retCode);
             }
-            if (firstWorker) {
-                firstWorker = false;
-                savedFirst = true;
-                sem.release();
-            }
-            Thread.sleep(1000);
+            gotMonitor = true;
+            Thread.sleep(500);
             retCode = exitRawMonitor();
-            if (retCode != 0 && savedFirst) {
+            if (retCode != 0) {
                 throw new RuntimeException("error in JVMTI RawMonitorExit: retCode=" + retCode);
             }
         } catch (ThreadDeath td) {
@@ -133,15 +131,18 @@ public static void main(String[] args) {
             AsyncExceptionOnMonitorEnter worker2 = new AsyncExceptionOnMonitorEnter();
 
             try {
-                // Start firstWorker worker and wait until monitor is acquired
-                firstWorker = true;
+                // Start first worker and wait until monitor is acquired
                 worker1.start();
-                sem.acquire();
+                while (!worker1.gotMonitor) {
+                    Thread.sleep(1);
+                }
 
                 // Start second worker and allow some time for target to block on monitorenter
                 // before executing Thread.stop()
                 worker2.start();
-                Thread.sleep(300);
+                while (!worker2.started) {
+                    Thread.sleep(10);
+                }
 
                 while (true) {
                     JVMTIUtils.stopThread(worker2);
@@ -150,6 +151,8 @@ public static void main(String[] args) {
                         // not released worker2 will deadlock on enter
                         JVMTIUtils.stopThread(worker1);
                     }
+                    // Give time to throw exception
+                    Thread.sleep(10);
 
                     if (!worker1.isAlive() && !worker2.isAlive()) {
                         // Done with Thread.stop() calls since
diff --git a/test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java b/test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java
index aa883ac7dbf3..34dbb3018a58 100644
--- a/test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java
+++ b/test/hotspot/jtreg/runtime/Thread/AsyncExceptionTest.java
@@ -36,25 +36,25 @@
 
 import jvmti.JVMTIUtils;
 
-import java.util.concurrent.CountDownLatch;
-
 public class AsyncExceptionTest extends Thread {
     private final static int DEF_TIME_MAX = 30;  // default max # secs to test
     private final static String PROG_NAME = "AsyncExceptionTest";
 
-    public CountDownLatch exitSyncObj = new CountDownLatch(1);
-    public CountDownLatch startSyncObj = new CountDownLatch(1);
+    // Avoid using CountDownLatch or similar objects that require unparking the
+    // main thread. Otherwise, if the main thread is run as a virtual thread, the
+    // async exception could be sent while the target is still executing FJP logic.
+    public volatile boolean started = false;
 
-    private boolean firstEntry = true;
     private boolean receivedThreadDeathinInternal1 = false;
     private boolean receivedThreadDeathinInternal2 = false;
+    private volatile RuntimeException error = null;
 
     @Override
     public void run() {
         try {
             internalRun1();
         } catch (ThreadDeath td) {
-            throw new RuntimeException("Caught ThreadDeath in run() instead of internalRun2() or internalRun1().\n"
+            error = new RuntimeException("Caught ThreadDeath in run() instead of internalRun2() or internalRun1().\n"
                     + "receivedThreadDeathinInternal1=" + receivedThreadDeathinInternal1
                     + "; receivedThreadDeathinInternal2=" + receivedThreadDeathinInternal2);
         } catch (NoClassDefFoundError ncdfe) {
@@ -62,15 +62,15 @@ public void run() {
         }
 
         if (receivedThreadDeathinInternal2 == false && receivedThreadDeathinInternal1 == false) {
-            throw new RuntimeException("Didn't catch ThreadDeath in internalRun2() nor in internalRun1().\n"
+            error = new RuntimeException("Didn't catch ThreadDeath in internalRun2() nor in internalRun1().\n"
                     + "receivedThreadDeathinInternal1=" + receivedThreadDeathinInternal1
                     + "; receivedThreadDeathinInternal2=" + receivedThreadDeathinInternal2);
         }
-        exitSyncObj.countDown();
     }
 
     public void internalRun1() {
         try {
+            started = true;
             while (!receivedThreadDeathinInternal2) {
               internalRun2();
             }
@@ -81,16 +81,10 @@ public void internalRun1() {
 
     public void internalRun2() {
         try {
-            Integer myLocalCount = 1;
-            Integer myLocalCount2 = 1;
-
-            if (firstEntry) {
-                // Tell main thread we have started.
-                startSyncObj.countDown();
-                firstEntry = false;
-            }
+            int myLocalCount = 1;
+            int myLocalCount2 = 1;
 
-            while(myLocalCount > 0) {
+            while (myLocalCount > 0) {
                 myLocalCount2 = (myLocalCount % 3) / 2;
                 myLocalCount -= 1;
             }
@@ -122,19 +116,12 @@ public static void main(String[] args) {
             thread.start();
             try {
                 // Wait for the worker thread to get going.
-                thread.startSyncObj.await();
-                while (true) {
-                    // Send async exception and wait until it is thrown
-                    JVMTIUtils.stopThread(thread);
-                    thread.exitSyncObj.await();
-                    Thread.sleep(100);
-
-                    if (!thread.isAlive()) {
-                        // Done with Thread.stop() calls since
-                        // thread is not alive.
-                        break;
-                    }
+                while (!thread.started) {
+                    Thread.sleep(1);
                 }
+                // Send async exception and wait until it is thrown
+                JVMTIUtils.stopThread(thread);
+                thread.join();
             } catch (InterruptedException e) {
                 throw new Error("Unexpected: " + e);
             } catch (NoClassDefFoundError ncdfe) {
@@ -143,11 +130,14 @@ public static void main(String[] args) {
                 // in a worker thread can subsequently be seen in the
                 // main thread.
             }
-
-            try {
-                thread.join();
-            } catch (InterruptedException e) {
-                throw new Error("Unexpected: " + e);
+            if (thread.isAlive()) {
+                // Really shouldn't be possible after join() above...
+                throw new RuntimeException("Thread did not exit.\n"
+                    + "receivedThreadDeathinInternal1=" + thread.receivedThreadDeathinInternal1
+                    + "; receivedThreadDeathinInternal2=" + thread.receivedThreadDeathinInternal2);
+            }
+            if (thread.error != null) {
+                throw thread.error;
             }
         }
 
@@ -169,4 +159,4 @@ public static void usage() {
                            " seconds)");
         System.exit(1);
     }
-}
+}
\ No newline at end of file
diff --git a/test/hotspot/jtreg/runtime/cds/appcds/SignedJar.java b/test/hotspot/jtreg/runtime/cds/appcds/SignedJar.java
index 1ad28f99408c..9e6cb58bb7fb 100644
--- a/test/hotspot/jtreg/runtime/cds/appcds/SignedJar.java
+++ b/test/hotspot/jtreg/runtime/cds/appcds/SignedJar.java
@@ -50,8 +50,8 @@ public static void main(String[] args) throws Exception {
 
         String skipMsg = "Skipping Hello: Signed JAR";
         String lambdaInArchive = "klasses.*=.*app.*Hello[$][$]Lambda.*hidden";
-        String loadFromJar = ".class,load. Hello source: file:.*signed_hello.jar";
-        String lambdaLoadFromHello = ".class.load. Hello[$][$]Lambda.*/0x.*source.*Hello";
+        String loadFromJar = ".class,load\s*. Hello source: file:.*signed_hello.jar";
+        String lambdaLoadFromHello = ".class.load\s*. Hello[$][$]Lambda.*/0x.*source.*Hello";
 
         for (String mainArg : mainArgs) {
             output = TestCommon.dump(signedJar, TestCommon.list(mainClass),
diff --git a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java
index 9a3754f422ad..6c12e1c4d715 100644
--- a/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java
+++ b/test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/InternSharedString.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Test shared strings together with string intern operation
  * @requires vm.cds.write.archived.java.heap
  * @requires vm.gc == null
+ * @comment CDS archive heap mapping is not supported with large pages
+ * @requires vm.opt.UseLargePages == null | !vm.opt.UseLargePages
  * @library /test/hotspot/jtreg/runtime/cds/appcds /test/lib
  * @compile InternStringTest.java
  * @build jdk.test.whitebox.WhiteBox
diff --git a/test/hotspot/jtreg/runtime/os/AvailableProcessors.java b/test/hotspot/jtreg/runtime/os/AvailableProcessors.java
index 18201d991270..51d6742b8329 100644
--- a/test/hotspot/jtreg/runtime/os/AvailableProcessors.java
+++ b/test/hotspot/jtreg/runtime/os/AvailableProcessors.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,9 @@
 
 import java.util.ArrayList;
 import java.io.File;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
 
 public class AvailableProcessors {
 
@@ -73,13 +76,17 @@ public static void main(String[] args) throws Exception {
                                                                      "AvailableProcessors");
 
             int[] expected = new int[] { 1, available/2, available-1, available };
+            int cpuId = getFirstAllowedCpu();
+            if (cpuId == -1) {
+                throw new SkippedException("Could not determine allowed CPU cores");
+            }
 
             for (int i : expected) {
                 System.out.println("Testing for " + i + " processors ...");
-                int max = i - 1;
+                int max = i - 1 + cpuId;
                 ArrayList cmdline = new ArrayList<>(master.command());
                 // prepend taskset command
-                cmdline.add(0, "0-" + max);
+                cmdline.add(0, cpuId + "-" + max);
                 cmdline.add(0, "-c");
                 cmdline.add(0, taskset);
                 // append expected processor count
@@ -104,4 +111,40 @@ static void checkProcessors(int expected) {
         else
             System.out.println(SUCCESS_STRING + available);
     }
+
+    /**
+     * Retrieves the first available CPU core ID allowed for the current process on Linux.
+     *
+     * @return The first CPU ID in Cpus_allowed_list, or -1 if unavailable.
+     */
+    static int getFirstAllowedCpu() {
+        final String statusFile = "/proc/self/status";
+        final String targetKey = "Cpus_allowed_list:";
+
+        try (BufferedReader br = new BufferedReader(new FileReader(statusFile))) {
+            String line;
+            while ((line = br.readLine()) != null) {
+                // Look for the line starting with "Cpus_allowed_list:"
+                if (line.startsWith(targetKey)) {
+                    // Extract the value part, e.g., "0-15,32-47" or "80,82,84"
+                    String listValue = line.substring(targetKey.length()).trim();
+                    if (listValue.isEmpty()) return -1;
+
+                    // Get the first segment before any comma (e.g., "0-15" from "0-15,32")
+                    String firstSegment = listValue.split(",")[0];
+
+                    // If it is a range (e.g., "80-159"), take the start number
+                    if (firstSegment.contains("-")) {
+                        return Integer.parseInt(firstSegment.split("-")[0]);
+                    } else {
+                        // If it is a single ID (e.g., "1"), parse it directly
+                        return Integer.parseInt(firstSegment);
+                    }
+                }
+            }
+        } catch (IOException | NumberFormatException | ArrayIndexOutOfBoundsException e) {
+            throw new RuntimeException("Failed to read or parse " + statusFile, e);
+        }
+        return -1;
+    }
 }
diff --git a/test/hotspot/jtreg/runtime/vthread/RedefineClass.java b/test/hotspot/jtreg/runtime/vthread/RedefineClass.java
index 33a9d52a5232..b17bb55701bc 100644
--- a/test/hotspot/jtreg/runtime/vthread/RedefineClass.java
+++ b/test/hotspot/jtreg/runtime/vthread/RedefineClass.java
@@ -120,7 +120,7 @@ private static int getStringIndex(String needle, byte[] buf) {
 
     private static int getStringIndex(String needle, byte[] buf, int offset) {
         outer:
-        for (int i = offset; i < buf.length - offset - needle.length(); i++) {
+        for (int i = offset; i <= buf.length - needle.length(); i++) {
             for (int j = 0; j < needle.length(); j++) {
                 if (buf[i + j] != (byte)needle.charAt(j)) continue outer;
             }
diff --git a/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/EarlyDynamicLoad.java b/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/EarlyDynamicLoad.java
new file mode 100644
index 000000000000..cb1596da08cc
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/EarlyDynamicLoad.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.AgentLoadException;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.AfterAll;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.concurrent.TimeUnit;
+import jdk.test.lib.dcmd.PidJcmdExecutor;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.Utils;
+
+/*
+ * @test EarlyDynamicLoad
+ * @summary Test that dynamic attach fails gracefully when the JVM is not in live phase.
+ * @requires vm.jvmti
+ * @library /test/lib
+ * @run junit EarlyDynamicLoad
+ */
+public class EarlyDynamicLoad {
+    private static final String EXPECTED_MESSAGE = "Dynamic agent loading is only permitted in the live phase";
+
+    private static Process child;
+
+    @BeforeAll
+    static void startAndWaitChild() throws Exception {
+        child = ProcessTools.createTestJavaProcessBuilder(
+                        "-XX:+StartAttachListener",
+                        "-agentpath:" + Utils.TEST_NATIVE_PATH + File.separator + System.mapLibraryName("EarlyDynamicLoad"),
+                        "--version").start();
+
+        // Wait until the process enters VMStartCallback
+        try (InputStream is = child.getInputStream()) {
+            is.read();
+        }
+    }
+
+    @AfterAll
+    static void stopChild() throws Exception {
+        try (OutputStream os = child.getOutputStream()) {
+            os.write(0);
+        }
+
+        if (!child.waitFor(5, TimeUnit.SECONDS)) {
+            child.destroyForcibly();
+            throw new AssertionError("Timed out while waiting child process to complete");
+        }
+
+        OutputAnalyzer analyzer = new OutputAnalyzer(child);
+        analyzer.shouldHaveExitValue(0);
+        analyzer.stderrShouldBeEmpty();
+    }
+
+    @Test
+    public void virtualMachine() throws Exception {
+        try {
+            VirtualMachine vm = VirtualMachine.attach(String.valueOf(child.pid()));
+            vm.loadAgent("some.jar");
+            vm.detach();
+            throw new AssertionError("Should have failed with AgentLoadException");
+        } catch(AgentLoadException exception) {
+            if (!exception.getMessage().contains(EXPECTED_MESSAGE)) {
+                throw new AssertionError("Unexpected error message", exception);
+            }
+        }
+    }
+
+    @Test
+    public void jcmd() throws Exception {
+        PidJcmdExecutor executor = new PidJcmdExecutor(String.valueOf(child.pid()));
+        OutputAnalyzer out = executor.execute("JVMTI.agent_load some.jar");
+
+        out.shouldHaveExitValue(0);
+        out.stdoutShouldContain(EXPECTED_MESSAGE);
+    }
+}
diff --git a/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/libEarlyDynamicLoad.cpp b/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/libEarlyDynamicLoad.cpp
new file mode 100644
index 000000000000..3991926306e4
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/attach/EarlyDynamicLoad/libEarlyDynamicLoad.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include 
+#include 
+#include 
+
+extern "C" {
+
+static void JNICALL VMStartCallback(jvmtiEnv* jvmti, JNIEnv* env) {
+  putchar('1');
+  fflush(stdout);
+  getchar();
+}
+
+JNIEXPORT int Agent_OnLoad(JavaVM* vm, char* options, void* reserved) {
+  jvmtiEnv* jvmti;
+  if (vm->GetEnv((void**) &jvmti, JVMTI_VERSION_1_0) != JVMTI_ERROR_NONE) {
+    fprintf(stderr, "JVMTI error occurred during GetEnv\n");
+    return JNI_ERR;
+  }
+
+  jvmtiEventCallbacks callbacks;
+  memset(&callbacks, 0, sizeof(callbacks));
+  callbacks.VMStart = VMStartCallback;
+
+  if (jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)) != JVMTI_ERROR_NONE) {
+    fprintf(stderr, "JVMTI error occurred during SetEventCallbacks\n");
+    return JNI_ERR;
+  }
+  if (jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr) != JVMTI_ERROR_NONE) {
+    fprintf(stderr, "JVMTI error occurred during SetEventNotificationMode\n");
+    return JNI_ERR;
+  }
+
+  return JNI_OK;
+}
+
+}
diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/ClassVersionAfterRedefine.java b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/ClassVersionAfterRedefine.java
index cc601147714d..5eb885e9ac62 100644
--- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/ClassVersionAfterRedefine.java
+++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/ClassVersionAfterRedefine.java
@@ -54,7 +54,7 @@ private static int getStringIndex(String needle, byte[] buf) {
 
     private static int getStringIndex(String needle, byte[] buf, int offset) {
         outer:
-        for (int i = offset; i < buf.length - offset - needle.length(); i++) {
+        for (int i = offset; i <= buf.length - needle.length(); i++) {
             for (int j = 0; j < needle.length(); j++) {
                 if (buf[i + j] != (byte)needle.charAt(j)) continue outer;
             }
diff --git a/test/hotspot/jtreg/serviceability/threads/ThreadInfoTest.java b/test/hotspot/jtreg/serviceability/threads/ThreadInfoTest.java
new file mode 100644
index 000000000000..b5db455cc201
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/threads/ThreadInfoTest.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.Utils;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 8323792
+ * @summary Make sure that jmm_GetThreadInfo() call does not crash JVM
+ * @library /test/lib
+ * @modules java.management
+ * @run main/othervm ThreadInfoTest
+ *
+ * @comment Exercise getThreadInfo(ids, 0).  Depth parameter of zero means
+ * no VM operation, which could crash with Threads starting and ending.
+ */
+
+public class ThreadInfoTest {
+    private static com.sun.management.ThreadMXBean mbean =
+        (com.sun.management.ThreadMXBean)ManagementFactory.getThreadMXBean();
+
+    private static final int NUM_THREADS = 2;
+    static long[] ids = new long[NUM_THREADS];
+    static ThreadInfo[] infos = new ThreadInfo[NUM_THREADS];
+    static volatile int count = 0;
+    static int ITERATIONS = 4;
+
+    public static void main(String[] argv) throws Exception {
+        boolean replacing = false;
+
+        startThreads(ids, NUM_THREADS);
+        new MyGetThreadInfoThread(ids).start();
+        new MyReplacerThread(ids).start();
+        for (int i = 0; i < ITERATIONS; i++) {
+            do {
+                count = countInfo(infos);
+                System.out.println("Iteration " + i + ": ThreadInfos found (Threads alive): " + count);
+                goSleep(100);
+            } while (count > 0);
+        }
+    }
+
+    private static Thread newThread(int i) {
+        Thread thread = new MyThread(i);
+        thread.setDaemon(true);
+        return thread;
+    }
+
+   private static void startThreads(long[] ids, int count) {
+        System.out.println("Starting " + count + " Threads...");
+        Thread[] threads = new Thread[count];
+        for (int i = 0; i < count; i++) {
+            threads[i] = newThread(i);
+            threads[i].start();
+            ids[i] = threads[i].getId();
+        }
+        System.out.println(ids);
+    }
+
+    // Count ThreadInfo from array, return how many are non-null.
+    private static int countInfo(ThreadInfo[] info) {
+        int count = 0;
+        if (info != null) {
+            int i = 0;
+            for (ThreadInfo ti: info) {
+                if (ti != null) {
+                    count++;
+                }
+                i++;
+            }
+        }
+        return count;
+    }
+
+    private static int replaceThreads(long[] ids, ThreadInfo[] info) {
+        int replaced = 0;
+        if (info != null) {
+            for (int i = 0; i < info.length; i++) {
+                ThreadInfo ti = info[i];
+                if (ti == null) {
+                    Thread thread = newThread(i);
+                    thread.start();
+                    ids[i] = thread.getId();
+                    replaced++;
+                }
+            }
+        }
+        return replaced;
+    }
+
+    private static void goSleep(long ms) {
+        try {
+            Thread.sleep(ms);
+        } catch (InterruptedException e) {
+            System.out.println("Unexpected exception is thrown: " + e);
+        }
+    }
+
+    // A Thread which replaces Threads in the shared array of threads.
+    static class MyReplacerThread extends Thread {
+        long[] ids;
+
+        public MyReplacerThread(long[] ids) {
+            this.ids = ids;
+            this.setDaemon(true);
+        }
+
+        public void run() {
+            boolean replacing = false;
+            while (true) {
+                if (replacing) {
+                    replaceThreads(ids, infos);
+                }
+                if (count < 10) {
+                    replacing = true;
+                }
+                if (count > 20) {
+                    replacing = false;
+                }
+                goSleep(1);
+            }
+        }
+    }
+
+    // A Thread which lives for a short while.
+    static class MyThread extends Thread {
+        long endTimeMs;
+
+        public MyThread(long n) {
+            super("MyThread-" + n);
+            endTimeMs = (n * n * 10) + System.currentTimeMillis();
+        }
+
+        public void run() {
+            try {
+                long sleep = Math.max(1, endTimeMs - System.currentTimeMillis());
+                goSleep(sleep);
+            } catch (Exception e) {
+                System.out.println(Thread.currentThread().getName() + ": " + e);
+            }
+        }
+    }
+
+    // A Thread to continually call getThreadInfo on a shared array of thread ids.
+    static class MyGetThreadInfoThread extends Thread {
+        long[] ids;
+
+        public MyGetThreadInfoThread(long[] ids) {
+            this.ids = ids;
+            this.setDaemon(true);
+        }
+
+        public void run() {
+            while (true) {
+                infos = mbean.getThreadInfo(ids, 0);
+                goSleep(10);
+            }
+        }
+    }
+}
diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkWithVectorAPIExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkWithVectorAPIExample.java
new file mode 100644
index 000000000000..7e1f289792b5
--- /dev/null
+++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkWithVectorAPIExample.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Example test to use the Compile Framework together with the IR Framework (i.e. TestFramework),
+ *          and the VectorAPI.
+ * @modules java.base/jdk.internal.misc
+ * @modules jdk.incubator.vector
+ * @library /test/lib /
+ * @compile ../../../compiler/lib/ir_framework/TestFramework.java
+ * @run driver compile_framework.examples.IRFrameworkWithVectorAPIExample
+ */
+
+package compile_framework.examples;
+
+import compiler.lib.compile_framework.*;
+import jdk.test.lib.Utils;
+import jdk.incubator.vector.IntVector;
+import jdk.test.lib.Platform;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * This test shows that the IR verification can be done on code compiled by the Compile Framework.
+ * The "@compile" command for JTREG is required so that the IRFramework is compiled, other javac
+ * might not compile it because it is not present in the class, only in the dynamically compiled
+ * code.
+ * 

+ * Additionally, we must set the classpath for the Test-VM, so that it has access to all compiled + * classes (see {@link CompileFramework#getEscapedClassPathOfCompiledClasses}). + */ +public class IRFrameworkWithVectorAPIExample { + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJavaSourceCode("InnerTest", generateInnerTest(comp)); + + // Compile the source file. "javac" needs to know that it is ok to compile with the + // VectorAPI module. + comp.compile("--add-modules=jdk.incubator.vector"); + + // InnerTest.main(); + comp.invoke("InnerTest", "main", new Object[] {null}); + } + + // Generate a source java file as String + public static String generateInnerTest(CompileFramework comp) { + return String.format(""" + import compiler.lib.ir_framework.*; + import jdk.incubator.vector.*; + + public class InnerTest { + public static void main(String args[]) { + TestFramework framework = new TestFramework(InnerTest.class); + // Also the TestFramework must allow the test VM to see the VectorAPI module. + framework.addFlags("-classpath", "%s", "--add-modules=jdk.incubator.vector"); + framework.start(); + } + + @Test + static Object test() { + return IntVector.broadcast(IntVector.SPECIES_64, 42); + } + } + """, comp.getEscapedClassPathOfCompiledClasses()); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java index a729aa4d28f6..09d54318b602 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ * Test scenario: * - during initialization (from function Agent_OnAttach) agent starts auxiliary thread waiting on * raw monitor and enables GarbageCollectionStart and GarbageCollectionFinish events - * - target application provokes garbage collection (calls System.gc()) + * - target application provokes garbage collection (calls WhiteBox.getWhiteBox().fullGC()) * - agent receives event GarbageCollectionStart * - agent receives event GarbageCollectionFinish event and notifies waiting auxiliary thread * - notified auxiliary thread notifies target application that agent finished its work @@ -48,11 +48,13 @@ * /test/lib * @build nsk.share.aod.AODTestRunner * nsk.jvmti.AttachOnDemand.attach020.attach020Target + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm/native * nsk.share.aod.AODTestRunner * -jdk ${test.jdk} * -target nsk.jvmti.AttachOnDemand.attach020.attach020Target - * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}" + * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI" * -na attach020Agent00 */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java index a20cf935bae2..3a52a539b82b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,14 +22,14 @@ */ package nsk.jvmti.AttachOnDemand.attach020; -import nsk.share.ClassUnloader; import nsk.share.aod.TargetApplicationWaitingAgents; +import jdk.test.whitebox.WhiteBox; public class attach020Target extends TargetApplicationWaitingAgents { protected void targetApplicationActions() { log.display("Provoking garbage collection"); - ClassUnloader.eatMemory(); + WhiteBox.getWhiteBox().fullGC(); } public static void main(String[] args) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties deleted file mode 100644 index 8b51b2a91156..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java index 5cf7b39729b6..3d8dc2f4e854 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,11 +44,13 @@ * /test/lib * @build nsk.share.aod.AODTestRunner * nsk.jvmti.AttachOnDemand.attach021.attach021Target + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm/native * nsk.share.aod.AODTestRunner * -jdk ${test.jdk} * -target nsk.jvmti.AttachOnDemand.attach021.attach021Target - * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}" + * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI" * -na attach021Agent00 */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java index d287616af69c..adb2c1941896 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,8 @@ */ package nsk.jvmti.AttachOnDemand.attach021; -import nsk.share.ClassUnloader; import nsk.share.aod.TargetApplicationWaitingAgents; +import jdk.test.whitebox.WhiteBox; public class attach021Target extends TargetApplicationWaitingAgents { @@ -51,7 +51,7 @@ protected void targetApplicationActions() throws Throwable { try { if (createTaggedObject()) { log.display("Provoking GC"); - ClassUnloader.eatMemory(); + WhiteBox.getWhiteBox().fullGC(); } } finally { shutdownAgent(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties deleted file mode 100644 index 8b51b2a91156..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java index 49b47585749f..5875f7a0f50e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,11 +47,13 @@ * /test/lib * @build nsk.share.aod.AODTestRunner * nsk.jvmti.AttachOnDemand.attach022.attach022Target + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm/native * nsk.share.aod.AODTestRunner * -jdk ${test.jdk} * -target nsk.jvmti.AttachOnDemand.attach022.attach022Target - * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}" + * -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI" * -na attach022Agent00 */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java index eb80c0c2a4c7..3324855e622b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,8 @@ */ package nsk.jvmti.AttachOnDemand.attach022; -import nsk.share.ClassUnloader; import nsk.share.aod.TargetApplicationWaitingAgents; +import jdk.test.whitebox.WhiteBox; class ClassForAllocationEventsTest { @@ -47,7 +47,7 @@ protected void targetApplicationActions() throws Throwable { } log.display("Provoking GC"); - ClassUnloader.eatMemory(); + WhiteBox.getWhiteBox().fullGC(); } finally { if (!shutdownAgent(TEST_ALLOCATION_NUMBER)) { setStatusFailed("Error happened during agent work, see error messages for details"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java index 5724f0ea9f4c..ffdc26b7cb14 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,8 @@ package nsk.jvmti.ClearFieldAccessWatch; +import jdk.test.lib.thread.TestThreadFactory; + import java.io.PrintStream; public class clrfldw001 { @@ -58,7 +60,7 @@ public static void main(String[] args) { public static int run(String argv[], PrintStream ref) { clrfldw001 t = new clrfldw001(); clrfldw001a t_a = new clrfldw001a(); - clrfldw001b t_b = new clrfldw001b(); + Thread t_b = TestThreadFactory.newThread(new clrfldw001b()); for (int i = 0; i < 5; i++) { setWatch(i); } @@ -91,7 +93,7 @@ class clrfldw001a { int fld = 2; } -class clrfldw001b extends Thread { +class clrfldw001b implements Runnable { float fld4 = 6.0f; public void run() { clrfldw001.clearWatch(4); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001.java index 9861f755f8fd..7e1163d91029 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,8 @@ package nsk.jvmti.ClearFieldModificationWatch; +import jdk.test.lib.thread.TestThreadFactory; + import java.io.PrintStream; public class clrfmodw001 { @@ -58,7 +60,7 @@ public static void main(String[] args) { public static int run(String argv[], PrintStream ref) { clrfmodw001 t = new clrfmodw001(); clrfmodw001a t_a = new clrfmodw001a(); - clrfmodw001b t_b = new clrfmodw001b(); + Thread t_b = TestThreadFactory.newThread(new clrfmodw001b()); for (int i = 0; i < 5; i++) { setWatch(i); } @@ -91,7 +93,7 @@ class clrfmodw001a { int fld = 2; } -class clrfmodw001b extends Thread { +class clrfmodw001b implements Runnable { float fld4; public void run() { clrfmodw001.clearWatch(4); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java index 433ee607d7c4..3e25000a2fbf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import java.math.*; import nsk.share.*; +import jdk.test.whitebox.WhiteBox; /** * This test exercises the JVMTI event GarbageCollectionFinish. @@ -63,7 +64,7 @@ public static int run(String argv[], PrintStream out) { private int runThis(String argv[], PrintStream out) { try { for (int i=0; iGarbageCollectionStart. @@ -63,13 +64,7 @@ public static int run(String argv[], PrintStream out) { } private int runThis(String argv[], PrintStream out) { - try { - for (int i=0; iGarbageCollectionStart. @@ -61,13 +62,7 @@ public static int run(String argv[], PrintStream out) { } private int runThis(String argv[], PrintStream out) { - try { - for (int i=0; iGetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) + jvmti->GetCurrentContendedMonitor(debuggee_threads[pThread].thread, &monitor))) return NSK_FALSE; if (monitor != nullptr) { if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != nullptr)) @@ -74,8 +77,8 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { return NSK_FALSE; if (usageInfo.owner == nullptr) break; - for (cThread = 0; cThread < threads_count; cThread++) { - if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) + for (cThread = 0; cThread < debuggee_threads_cnt; cThread++) { + if (jni->IsSameObject(debuggee_threads[cThread].thread, usageInfo.owner)) break; } if (usageInfo.waiters != nullptr) { @@ -84,10 +87,10 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } - if (!NSK_VERIFY(cThread != threads_count)) + if (!NSK_VERIFY(cThread != debuggee_threads_cnt)) return NSK_FALSE; NSK_DISPLAY1(" which is held by \"%s\"\n", - threadList[cThread].name); + debuggee_threads[cThread].name); if (cThread == dThread) break; } @@ -103,8 +106,9 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { int tDfn = 0, gDfn = 0; int pThread, cThread; int i; + int threads_count = 0; - NSK_DISPLAY0("Create threadList\n"); + NSK_DISPLAY0("Create debuggee_threads\n"); /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) @@ -114,7 +118,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; if (!NSK_JVMTI_VERIFY( - jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&threadList))) + jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&debuggee_threads))) return NSK_FALSE; for (i = 0; i < threads_count; i++) { @@ -127,22 +131,30 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); - threadList[i].thread = threads[i]; - threadList[i].dfn = -1; - threadList[i].name = info.name; + if (!strncmp(info.name, THREAD_NAME_PREFIX, THREAD_NAME_PREFIX_LEN)) { + NSK_DISPLAY1("Skipping thread %s\n", info.name); + if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) + return NSK_FALSE; + continue; + } + + debuggee_threads[debuggee_threads_cnt].thread = threads[i]; + debuggee_threads[debuggee_threads_cnt].dfn = -1; + debuggee_threads[debuggee_threads_cnt].name = info.name; + debuggee_threads_cnt++; } /* deallocate thread list */ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - for (i = 0; i < threads_count; i++) { - if (threadList[i].dfn < 0) { + for (i = 0; i < debuggee_threads_cnt; i++) { + if (debuggee_threads[i].dfn < 0) { tDfn = gDfn; - threadList[i].dfn = gDfn++; + debuggee_threads[i].dfn = gDfn++; for (pThread = i;;pThread = cThread) { if (!NSK_JVMTI_VERIFY( - jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) + jvmti->GetCurrentContendedMonitor(debuggee_threads[pThread].thread, &monitor))) return NSK_FALSE; if (monitor == nullptr) break; @@ -150,8 +162,8 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; if (usageInfo.owner == nullptr) break; - for (cThread = 0; cThread < threads_count; cThread++) { - if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) + for (cThread = 0; cThread < debuggee_threads_cnt; cThread++) { + if (jni->IsSameObject(debuggee_threads[cThread].thread, usageInfo.owner)) break; } if (usageInfo.waiters != nullptr) { @@ -160,10 +172,10 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } - if (!NSK_VERIFY(cThread != threads_count)) + if (!NSK_VERIFY(cThread != debuggee_threads_cnt)) return NSK_FALSE; - if (threadList[cThread].dfn < 0) { - threadList[cThread].dfn = gDfn++; + if (debuggee_threads[cThread].dfn < 0) { + debuggee_threads[cThread].dfn = gDfn++; } else if (cThread == pThread) { break; } else { @@ -179,9 +191,9 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { } /* deallocate thread names */ - for (i = 0; i < threads_count; i++) { - if (threadList[i].name != nullptr) { - if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name))) + for (i = 0; i < debuggee_threads_cnt; i++) { + if (debuggee_threads[i].name != nullptr) { + if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)debuggee_threads[i].name))) return NSK_FALSE; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002.java index f4ca83c0b546..852b915acd74 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,7 +104,8 @@ public int runIt(String argv[], PrintStream out) { /* =================================================================== */ class tc03t002Thread extends Thread { - + // The thread name prefix is used to find thread from jvmti agent. + final static String threadNamePrefix = "Debuggee Thread"; static Wicket startingBarrier = new Wicket(3); static Wicket lockingBarrier = new Wicket(3); Wicket waitingBarrier = new Wicket(); @@ -112,7 +113,7 @@ class tc03t002Thread extends Thread { Object lock2; public tc03t002Thread(Object o1, Object o2) { - super("Debuggee Thread " + o1 + o2); + super(threadNamePrefix + " " + o1 + o2); lock1 = o1; lock2 = o2; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp index 11c74e3a9e2c..5d18d6c23afd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,10 +41,13 @@ typedef struct { static jlong timeout = 0; /* test objects */ -static threadDesc *threadList = nullptr; -static jint threads_count = 0; +static threadDesc *debuggee_threads = nullptr; +static jint debuggee_threads_cnt = 0; static int numberOfDeadlocks = 0; +static const char* THREAD_NAME_PREFIX = "Debugee Thread"; +static const size_t THREAD_NAME_PREFIX_LEN = strlen(THREAD_NAME_PREFIX); + /* ========================================================================== */ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { @@ -56,9 +59,9 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { NSK_DISPLAY1("Found deadlock #%d:\n", numberOfDeadlocks); for (pThread = dThread;;pThread = cThread) { - NSK_DISPLAY1(" \"%s\":\n", threadList[pThread].name); + NSK_DISPLAY1(" \"%s\":\n", debuggee_threads[pThread].name); if (!NSK_JVMTI_VERIFY( - jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) + jvmti->GetCurrentContendedMonitor(debuggee_threads[pThread].thread, &monitor))) return NSK_FALSE; if (monitor != nullptr) { if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != nullptr)) @@ -74,8 +77,8 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { return NSK_FALSE; if (usageInfo.owner == nullptr) break; - for (cThread = 0; cThread < threads_count; cThread++) { - if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) + for (cThread = 0; cThread < debuggee_threads_cnt; cThread++) { + if (jni->IsSameObject(debuggee_threads[cThread].thread, usageInfo.owner)) break; } if (usageInfo.waiters != nullptr) { @@ -84,10 +87,10 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } - if (!NSK_VERIFY(cThread != threads_count)) + if (!NSK_VERIFY(cThread != debuggee_threads_cnt)) return NSK_FALSE; NSK_DISPLAY1(" which is held by \"%s\"\n", - threadList[cThread].name); + debuggee_threads[cThread].name); if (cThread == dThread) break; } @@ -103,8 +106,9 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { int tDfn = 0, gDfn = 0; int pThread, cThread; int i; + int threads_count = 0; - NSK_DISPLAY0("Create threadList\n"); + NSK_DISPLAY0("Create debuggee_threads\n"); /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) @@ -114,7 +118,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; if (!NSK_JVMTI_VERIFY( - jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&threadList))) + jvmti->Allocate(threads_count*sizeof(threadDesc), (unsigned char**)&debuggee_threads))) return NSK_FALSE; for (i = 0; i < threads_count; i++) { @@ -127,22 +131,31 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); - threadList[i].thread = threads[i]; - threadList[i].dfn = -1; - threadList[i].name = info.name; + if (!strncmp(info.name, THREAD_NAME_PREFIX, THREAD_NAME_PREFIX_LEN)) { + NSK_DISPLAY1("Skipping thread %s\n", info.name); + if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) + return NSK_FALSE; + continue; + } + + debuggee_threads[debuggee_threads_cnt].thread = threads[i]; + debuggee_threads[debuggee_threads_cnt].dfn = -1; + debuggee_threads[debuggee_threads_cnt].name = info.name; + debuggee_threads_cnt++; } /* deallocate thread list */ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - for (i = 0; i < threads_count; i++) { - if (threadList[i].dfn < 0) { + for (i = 0; i < debuggee_threads_cnt; i++) { + + if (debuggee_threads[i].dfn < 0) { tDfn = gDfn; - threadList[i].dfn = gDfn++; + debuggee_threads[i].dfn = gDfn++; for (pThread = i;;pThread = cThread) { if (!NSK_JVMTI_VERIFY( - jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) + jvmti->GetCurrentContendedMonitor(debuggee_threads[pThread].thread, &monitor))) return NSK_FALSE; if (monitor == nullptr) break; @@ -150,8 +163,8 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; if (usageInfo.owner == nullptr) break; - for (cThread = 0; cThread < threads_count; cThread++) { - if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) + for (cThread = 0; cThread < debuggee_threads_cnt; cThread++) { + if (jni->IsSameObject(debuggee_threads[cThread].thread, usageInfo.owner)) break; } if (usageInfo.waiters != nullptr) { @@ -160,10 +173,10 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } - if (!NSK_VERIFY(cThread != threads_count)) + if (!NSK_VERIFY(cThread != debuggee_threads_cnt)) return NSK_FALSE; - if (threadList[cThread].dfn < 0) { - threadList[cThread].dfn = gDfn++; + if (debuggee_threads[cThread].dfn < 0) { + debuggee_threads[cThread].dfn = gDfn++; } else if (cThread == pThread) { break; } else { @@ -179,9 +192,9 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { } /* deallocate thread names */ - for (i = 0; i < threads_count; i++) { - if (threadList[i].name != nullptr) { - if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name))) + for (i = 0; i < debuggee_threads_cnt; i++) { + if (debuggee_threads[i].name != nullptr) { + if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)debuggee_threads[i].name))) return NSK_FALSE; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp index 9680d01847ab..df67828d28b1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp @@ -42,7 +42,7 @@ static const jlong EXPECTED_TIMEOUT_ACCURACY_NS = 300000; #if (defined(WIN32) || defined(_WIN32)) static const jlong EXPECTED_ACCURACY = 16; // 16ms is longest clock update interval #else -static const jlong EXPECTED_ACCURACY = 10; // high frequency clock updates expected +static const jlong EXPECTED_ACCURACY = 32; // high frequency clock updates expected #endif /* scaffold objects */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002.java index ebd662aa9196..8cde4f727100 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.whitebox.WhiteBox; public class em02t002 extends DebugeeClass { @@ -61,7 +62,7 @@ public int runIt(String argv[], PrintStream out) { logger.display("generating events"); - ClassUnloader.eatMemory(); + WhiteBox.getWhiteBox().fullGC(); int currStatus = em02t002.checkStatus(Consts.TEST_PASSED); if (currStatus != Consts.TEST_PASSED) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/TEST.properties deleted file mode 100644 index 8b51b2a91156..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/TestDescription.java index a9edca92190a..b6dcf409b6e7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/TestDescription.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 @@ -71,9 +71,12 @@ * * @library /vmTestbase * /test/lib + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm/native * -agentlib:em02t002=-waittime=5 * -XX:-UseGCOverheadLimit + * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * nsk.jvmti.scenarios.events.EM02.em02t002 */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006.java index 4521a190eb31..39f153c6f771 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,6 +27,7 @@ import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.whitebox.WhiteBox; public class em02t006 extends DebugeeClass { @@ -62,7 +63,7 @@ public int runIt(String args[], PrintStream out) { } logger.display("ObjectFree:: Provoke JVMTI_EVENT_OBJECT_FREE"); - ClassUnloader.eatMemory(); + WhiteBox.getWhiteBox().fullGC(); if (checkStatus(Consts.TEST_PASSED) == Consts.TEST_FAILED) { status = Consts.TEST_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/TEST.properties b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/TEST.properties deleted file mode 100644 index 8b51b2a91156..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/TEST.properties +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -exclusiveAccess.dirs=. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/TestDescription.java index dacf53b09944..f400b04e5434 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,9 +60,12 @@ * * @library /vmTestbase * /test/lib + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm/native * -agentlib:em02t006=-waittime=5 * -XX:-UseGCOverheadLimit + * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI * nsk.jvmti.scenarios.events.EM02.em02t006 */ diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java index c8264e8f9631..abb771e30e79 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ * another method handle and so on. * The test verifies that arguments are correctly passed between native methods and MHs. * + * @requires vm.compMode != "Xcomp" * @library /vmTestbase * /test/lib * @@ -62,26 +63,32 @@ public class Test extends MultiThreadedTest { private static final String RETURN_VALUE = "test"; + private static final MethodType MT_calledFromNative = MethodType.methodType( + Object.class, + Object.class, Object.class, int.class, long.class, double.class, float.class); + + private static MethodHandle mh; + static { System.loadLibrary("nativeAndMH"); + try { + mh = MethodHandles.lookup().findStatic( + Test.class, + "calledFromNative", + MT_calledFromNative); + } catch (Exception ex) { + throw new RuntimeException("TEST FAILED - Unable to lookup \"calledFromNative\""); + } } private static native Object native01(Object a1, String a2, Object a3, Object a4, Object a5, Object a6, MethodHandle mh); - private static final MethodType MT_calledFromNative = MethodType.methodType( - Object.class, - Object.class, Object.class, int.class, long.class, double.class, float.class); - private static Object calledFromNative(Object s1, Object s2, int i, long l, double d, float f) { return RETURN_VALUE; } @Override protected boolean runThread(int threadNum) throws Throwable { - MethodHandle mh = MethodHandles.lookup().findStatic( - Test.class, - "calledFromNative", - MT_calledFromNative); Stresser stresser = createStresser(); stresser.start(1); diff --git a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java index 40fd0500816e..e238da8be014 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java +++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/StressTest.java @@ -44,6 +44,7 @@ import java.util.List; import java.util.Random; +import jdk.test.lib.thread.TestThreadFactory; import nsk.share.TestFailure; import nsk.share.test.StressOptions; import nsk.share.test.Stresser; @@ -82,16 +83,18 @@ public class StressTest implements Runnable { @Option(name="ignoreTestFailures", default_value="false", description="ignore failures of the executed tests") private boolean ignoreTestFailures; - class Worker extends Thread { + class Worker implements Runnable { private final Random rand; private volatile DefMethTest failedTest; private Throwable reason; private volatile long executedTests = 0; - public Worker(String id, long seed) { - setName(id); - this.rand = new Random(seed); + private final Thread thread; + + Worker(String id, long seed) { + this.rand = new Random(seed); + this.thread = TestThreadFactory.newThread(this, id); } @Override @@ -247,13 +250,13 @@ private void startWorkers() { } for (Worker worker : workers) { - worker.start(); + worker.thread.start(); } } private void interruptWorkers() { for (Worker worker : workers) { - worker.interrupt(); + worker.thread.interrupt(); } } @@ -261,14 +264,14 @@ private void joinWorkers() { boolean isFailed = false; for (Worker worker : workers) { - while (worker.isAlive()) { + while (worker.thread.isAlive()) { try { - worker.join(); + worker.thread.join(); } catch (InterruptedException e) {} } System.out.printf("%s: %s (executed: %d)\n", - worker.getName(), + worker.thread.getName(), worker.isFailed() ? "FAILED: " + worker.getFailedTest() : "PASSED", worker.getExecutedTests()); @@ -288,7 +291,7 @@ private void joinWorkers() { private boolean workersAlive() { for (Worker worker : workers) { - if (!worker.isAlive()) { + if (!worker.thread.isAlive()) { return false; } } diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml deleted file mode 100644 index e7ea712cdd96..000000000000 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/lexical.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - Publishers of the Music of New York Women Composers - The Publishers <![CDATA[<?xml>]]> - - - ACA - info@composers.com - http://www.composers.com/ -

- 170 West 74th St. - NY - NY - 10023 -
- 212-362-8900 - 212-874-8605 - - &familytree; - - - diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out deleted file mode 100644 index d4a9d98475f3..000000000000 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/out/doctypeGF.out +++ /dev/null @@ -1,21 +0,0 @@ - - - - Publishers of the Music of New York Women Composers - The Publishers - - ACA - info@composers.com - http://www.composers.com/ -
- 170 West 74th St. - NY - NY - 10023 -
- 212-362-8900 - 212-874-8605 - - -
-
diff --git a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml b/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml deleted file mode 100644 index 789983f79f31..000000000000 --- a/test/jaxp/javax/xml/jaxp/functional/javax/xml/transform/xmlfiles/publish2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - Publishers of the Music of New York Women Composers - The Publishers - - ACA - info@composers.com - http://www.composers.com/ -
- 170 West 74th St. - NY - NY - 10023 -
- 212-362-8900 - 212-874-8605 - - &familytree; -
-
- diff --git a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out b/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out deleted file mode 100644 index f4b4241dd397..000000000000 --- a/test/jaxp/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/DTDHandlerGF.out +++ /dev/null @@ -1,2 +0,0 @@ -In unparsedEntityDecl... name:logo publicId:null systemId:http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/images/tool.gif notationName:gif -In notationDecl... name:gif publicId:null systemId:http://sardinia/ diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/JDK8207760.java b/test/jaxp/javax/xml/jaxp/unittest/transform/JDK8207760.java index 1726aacdfb5b..c3c2f35d0f2e 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/transform/JDK8207760.java +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/JDK8207760.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,10 +43,10 @@ /* * @test + * @bug 8207760 8349699 + * @summary Verifies that a surrogate pair at the edge of a buffer is properly handled * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest * @run testng/othervm transform.JDK8207760 - * @summary Verifies that a surrogate pair at the edge of a buffer is properly handled - * @bug 8207760 */ @Listeners({jaxp.library.FilePolicy.class}) public class JDK8207760 { @@ -96,6 +96,14 @@ public class JDK8207760 { "\n" + ""; + final String xsl8349699 = """ + + + + + + """; + @DataProvider(name = "xsls") public Object[][] getDataBug8207760_cdata() { return new Object[][]{ @@ -104,6 +112,117 @@ public Object[][] getDataBug8207760_cdata() { }; } + /* + * Data for verifying the patch for JDK8349699 + * @see testBug8349699 + */ + @DataProvider(name = "surrogatePair") + public Object[][] getDataFor8349699() { + return new Object[][]{ + // a surrogate pair in an XML element placed anywhere in a string + {getXML(1024, 1024, "\uD835\uDF00"), getString(1024, 1024, "\uD835\uDF00")}, + {getXML(1023, 1023, "\uD835\uDF00"), getString(1023, 1023, "\uD835\uDF00")}, + {getXML(1023,0, "\uD835\uDF00"), getString(1023,0, "\uD835\uDF00")}, + {getXML(1023,120, "\uD835\uDF00"), getString(1023,120, "\uD835\uDF00")}, + // this is the original test as demonstrated in the bug report + {getXML(1017,1017, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uDF00\uD835\uDF00"), + getString(1017,1017, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uDF00\uD835\uDF00")}, + {getXML(1017,0, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uDF00\uD835\uDF00"), + getString(1017,0, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uDF00\uD835\uDF00")}, + {getXML(1017,120, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uDF00\uD835\uDF00"), + getString(1017,120, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uDF00\uD835\uDF00")}, + }; + } + + /* + * Data for verifying the patch for JDK8349699 + * @see testBug8349699N + */ + @DataProvider(name = "invalidSurrogatePair") + public Object[][] getDataFor8349699N() { + return new Object[][]{ + // invalid pair: high/high + {getXML(1024, 1024, "\uD835\uD835")}, + {getXML(1023, 1023, "\uD835\uD835")}, + {getXML(1023,0, "\uD835\uD835")}, + {getXML(1023,120, "\uD835\uD835")}, + // invalid pair: low/low + {getXML(1024, 1024, "\uDF00\uDF00")}, + {getXML(1023, 1023, "\uDF00\uDF00")}, + {getXML(1023,0, "\uDF00\uDF00")}, + {getXML(1023,120, "\uDF00\uDF00")}, + // invalid pair in the original test string + {getXML(1017,1017, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uD835\uD835\uDF00")}, + {getXML(1017,0, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uD835\uD835\uDF00")}, + {getXML(1017,120, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uD835\uD835\uD835\uDF00")}, + {getXML(1017,1017, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uDF00\uDF00\uD835\uDF00")}, + {getXML(1017,0, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uDF00\uDF00\uD835\uDF00")}, + {getXML(1017,120, "\uD835\uDF03\uD835\uDF00\uD835\uDF00\uDF00\uDF00\uD835\uDF00")}, + }; + } + + /* + * @bug 8349699 + * Verifies that a surrogate pair at the edge of a buffer is properly handled + * when serializing into a Character section. + */ + @Test(dataProvider = "surrogatePair") + public final void testBug8349699(String xml, String expected) throws Exception { + Transformer t = createTransformerFromInputstream( + new ByteArrayInputStream(xsl8349699.getBytes(StandardCharsets.UTF_8))); + StringWriter sw = new StringWriter(); + t.transform(new StreamSource(new StringReader(xml)), new StreamResult(sw)); + Assert.assertEquals(sw.toString(), expected); + } + + /* + * @bug 8349699 + * Verifies that invalid surrogate pairs are caught. + */ + @Test(dataProvider = "invalidSurrogatePair") + public final void testBug8349699N(String xml) throws Exception { + Assert.assertThrows(TransformerException.class, () -> { + Transformer t = createTransformerFromInputstream( + new ByteArrayInputStream(xsl8349699.getBytes(StandardCharsets.UTF_8))); + StringWriter sw = new StringWriter(); + t.transform(new StreamSource(new StringReader(xml)), new StreamResult(sw)); + }); + } + + /** + * Returns an XML with the input string inserted in a text of length 'len' at + * the position 'pos'. + * @param len the length of the text to be placed in the XML + * @param pos the position at which the input string will be inserted into the text + * @param input the input string + * @return an XML + */ + private String getXML(int len, int pos, String input) { + StringBuilder sb = new StringBuilder(""); + sb.append(getString(len, pos, input)); + sb.append(""); + return sb.toString(); + } + + /** + * Returns a text string with the input string inserted at the specified position. + * @param len the length of the text to be returned + * @param pos the position at which the input string will be inserted into the text + * @param input the input string + * @return a text string + */ + private String getString(int len, int pos, String input) { + StringBuilder sb = new StringBuilder(); + if (pos == 0) { + sb.append(input).append("x".repeat(len)); + } else if (pos == len) { + sb.append("x".repeat(len)).append(input); + } else { + sb.append("x".repeat(pos)).append(input).append("x".repeat(len - pos)); + } + return sb.toString(); + } + /* * @bug 8207760 * Verifies that a surrogate pair at the edge of a buffer is properly handled diff --git a/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java b/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java index 6ecbba3014d8..58e78f97fabd 100644 --- a/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java +++ b/test/jaxp/javax/xml/jaxp/unittest/validation/CR6740048.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,11 +62,9 @@ public final void testReusingDocumentBuilder() { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setNamespaceAware(true); - if (xsd != null) { - docBuilderFactory.setValidating(true); - docBuilderFactory.setAttribute(SCHEMA_LANGUAGE_URL, XML_SCHEMA_URL); - docBuilderFactory.setAttribute(SCHEMA_SOURCE_URL, xsd); - } + docBuilderFactory.setValidating(true); + docBuilderFactory.setAttribute(SCHEMA_LANGUAGE_URL, XML_SCHEMA_URL); + docBuilderFactory.setAttribute(SCHEMA_SOURCE_URL, xsd); final DocumentBuilder documentBuilder = docBuilderFactory.newDocumentBuilder(); documentBuilder.setErrorHandler(new ErrorHandler() { diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 92efc4ddaac7..f1767b07d903 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -120,6 +120,7 @@ java/awt/Focus/IconifiedFrameFocusChangeTest/IconifiedFrameFocusChangeTest.java java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java 6848406 generic-all java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java 6848407 generic-all java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java 8296972 macosx-all +java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java 8340374 macosx-all java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java 8022302 generic-all java/awt/Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java 8286840 linux-all java/awt/Frame/InitialIconifiedTest.java 7144049,8203920 macosx-all,linux-all @@ -127,8 +128,9 @@ java/awt/Frame/FocusTest.java 8341480 macosx-all java/awt/FileDialog/FileDialogIconTest/FileDialogIconTest.java 8160558 windows-all java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java 8060176 windows-all,macosx-all java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java 8060176 windows-all,macosx-all +java/awt/dnd/FileListBetweenJVMsTest/FileListBetweenJVMsTest.java 8353673 macosx-all java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java 8171510 macosx-all -java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java 8288839 windows-x64 +java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java 8288839 windows-x64,macosx-all java/awt/dnd/DragExitBeforeDropTest.java 8242805 macosx-all java/awt/dnd/DragThresholdTest.java 8076299 macosx-all java/awt/dnd/CustomDragCursorTest.java 8242805 macosx-all @@ -247,18 +249,19 @@ sun/awt/datatransfer/SuplementaryCharactersTransferTest.java 8011371 generic-all sun/awt/shell/ShellFolderMemoryLeak.java 8197794 windows-all sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java 8196102 generic-all sun/java2d/DirectX/RenderingToCachedGraphicsTest/RenderingToCachedGraphicsTest.java 8196180 windows-all,macosx-all +sun/java2d/OpenGL/MultiWindowFillTest.java 8378506 macosx-all +sun/java2d/OpenGL/OpaqueDest.java#id1 8367574 macosx-all +sun/java2d/OpenGL/ScaleParamsOOB.java#id0 8377908 linux-all sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java 8144029 macosx-all,linux-all sun/java2d/SunGraphics2D/DrawImageBilinear.java 8297175 linux-all sun/java2d/SunGraphics2D/PolyVertTest.java 6986565 generic-all sun/java2d/SunGraphics2D/SimplePrimQuality.java 6992007 generic-all sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java 8196185 generic-all -sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh 8221451 linux-all java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java 8169469,8273617 windows-all,macosx-aarch64 java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java 8273617 macosx-all java/awt/print/PrinterJob/PSQuestionMark.java 7003378 generic-all java/awt/print/PrinterJob/GlyphPositions.java 7003378 generic-all -java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 8366852 generic-all java/awt/Component/GetScreenLocTest/GetScreenLocTest.java 4753654 generic-all java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java 8165863 macosx-all java/awt/Clipboard/PasteNullToTextComponentsTest.java 8234140 macosx-all,windows-all @@ -269,6 +272,7 @@ java/awt/Clipboard/ClipboardSecurity.java 8054809 macosx-all java/awt/Clipboard/GetAltContentsTest/SystemClipboardTest.java 8234140 macosx-all java/awt/Clipboard/ImageTransferTest.java 8030710 generic-all java/awt/Clipboard/NoDataConversionFailureTest.java 8234140 macosx-all +java/awt/Dialog/ModalExcludedTest.java 7125054 macosx-all java/awt/Frame/MiscUndecorated/RepaintTest.java 8266244 macosx-aarch64 java/awt/Modal/FileDialog/FileDialogAppModal1Test.java 7186009 macosx-all java/awt/Modal/FileDialog/FileDialogAppModal2Test.java 7186009 macosx-all @@ -408,7 +412,6 @@ java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java 8005021 macosx-all java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java 8051455 macosx-all java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Standard.java 7124407,8302787 macosx-all,windows-all java/awt/Mouse/RemovedComponentMouseListener/RemovedComponentMouseListener.java 8157170 macosx-all -java/awt/Modal/ToFront/DialogToFrontModeless1Test.java 8213530 linux-all java/awt/Modal/ToFront/DialogToFrontNonModalTest.java 8221899 linux-all java/awt/Modal/ToBack/ToBackAppModal1Test.java 8196441 linux-all,macosx-all java/awt/Modal/ToBack/ToBackAppModal2Test.java 8196441 linux-all,macosx-all @@ -452,7 +455,6 @@ java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java 71 java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java 6848810 macosx-all,linux-all java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java 8194751 linux-all java/awt/image/VolatileImage/BitmaskVolatileImage.java 8133102 linux-all -java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.java 8203004 linux-all java/awt/ScrollPane/ScrollPaneEventType.java 8296516 macosx-all java/awt/Robot/AcceptExtraMouseButtons/AcceptExtraMouseButtons.java 7107528 linux-all,macosx-all java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java 8080676 linux-all @@ -486,13 +488,10 @@ java/awt/MenuBar/TestNoScreenMenuBar.java 8265987 macosx-all java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8266283 generic-all java/awt/Graphics2D/DrawString/RotTransText.java 8316878 linux-all -java/awt/Graphics2D/CopyAreaOOB.java 8343106 macosx-aarch64 java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java 8257529 windows-x64 java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeForModalDialogTest/ConsumeForModalDialogTest.java 8302787 windows-all java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.java 8302787 windows-all -java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java 8321303 linux-all -java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64 java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64 java/awt/Dialog/ChoiceModalDialogTest.java 8161475 macosx-all java/awt/Dialog/FileDialogUserFilterTest.java 8001142 generic-all @@ -612,7 +611,6 @@ java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java 7146541 linux-al java/rmi/registry/readTest/CodebaseTest.java 8173324 windows-all java/rmi/registry/multipleRegistries/MultipleRegistries.java 8268182 macosx-all - java/rmi/Naming/DefaultRegistryPort.java 8005619 windows-all java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java 8005619 windows-all @@ -686,7 +684,6 @@ javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-al javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all javax/swing/JFileChooser/8194044/FileSystemRootTest.java 8327236 windows-all javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all -javax/swing/JTabbedPane/4624207/bug4624207.java 8064922 macosx-all javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all javax/swing/JFileChooser/bug6798062.java 8146446 windows-all javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all @@ -802,19 +799,19 @@ jdk/jfr/api/consumer/recordingstream/TestOnEvent.java 8255404 linux-x6 javax/swing/JFileChooser/6698013/bug6698013.java 8024419 macosx-all javax/swing/JColorChooser/8065098/bug8065098.java 8065647 macosx-all javax/swing/JTabbedPane/bug4499556.java 8267500 macosx-all -javax/swing/JTabbedPane/bug4666224.java 8144124 macosx-all javax/swing/SwingUtilities/TestTextPosInPrint.java 8227025 windows-all +javax/swing/JInternalFrame/bug4134077.java 8184985 windows-all java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_1.java 7131438,8022539 generic-all java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_2.java 7131438,8022539 generic-all java/awt/Modal/WsDisabledStyle/CloseBlocker/CloseBlocker.java 7187741 linux-all,macosx-all java/awt/xembed/server/TestXEmbedServerJava.java 8001150,8004031 generic-all -java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java 8068378 generic-all java/awt/image/VolatileImage/VolatileImageConfigurationTest.java 8171069 macosx-all,linux-all java/awt/Modal/InvisibleParentTest/InvisibleParentTest.java 8172245 linux-all java/awt/Frame/FrameStateTest/FrameStateTest.java 8203920 macosx-all,linux-all java/awt/print/PrinterJob/ScaledText/ScaledText.java 8231226 macosx-all java/awt/print/PrinterJob/PrintTextTest.java 8148334 generic-all +java/awt/font/GlyphVector/TestGlyphVectorLayout.java 8354987 generic-all java/awt/font/TextLayout/TestJustification.java 8250791 macosx-all java/awt/TrayIcon/DragEventSource/DragEventSource.java 8252242 macosx-all java/awt/FileDialog/DefaultFocusOwner/DefaultFocusOwner.java 7187728 macosx-all,linux-all diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index d4d79144fc4d..6d461b195fe7 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -688,6 +688,7 @@ jdk_jfr_sanity = \ jdk/jfr/event/gc/collection/TestGCWithFasttime.java \ jdk/jfr/event/gc/configuration/TestGCConfigurationEvent.java \ jdk/jfr/event/metadata/TestDefaultConfigurations.java \ + jdk/jfr/event/oldobject/TestDFSWithSmallStack.java \ jdk/jfr/startupargs/TestDumpOnExit.java \ jdk/jfr/api/consumer/recordingstream/TestBasics.java @@ -1047,7 +1048,6 @@ jdk_awt_wayland = \ -java/awt/image/BufferStrategy/ExceptionAfterComponentDispose.java \ -java/awt/image/MemoryLeakTest/MemoryLeakTest.java \ -java/awt/image/OpaquePNGToGIFTest.java \ - -java/awt/image/VolatileImage/DrawBufImgOp.java \ -java/awt/image/VolatileImage/TransparentVImage.java \ -java/awt/image/mlib/MlibOpsTest.java \ -java/awt/image/multiresolution/MenuMultiresolutionIconTest.java \ diff --git a/test/jdk/com/sun/java/swing/SwingUtilities3/ApplyInsetsTest.java b/test/jdk/com/sun/java/swing/SwingUtilities3/ApplyInsetsTest.java new file mode 100644 index 000000000000..047eaff66d4a --- /dev/null +++ b/test/jdk/com/sun/java/swing/SwingUtilities3/ApplyInsetsTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Insets; +import java.awt.Rectangle; + +import com.sun.java.swing.SwingUtilities3; + +/* + * @test + * @bug 8365379 + * @summary Verify SwingUtilities3 insets return correct result + * independent of initial values + * @modules java.desktop/com.sun.java.swing + * @run main ApplyInsetsTest + */ + +public class ApplyInsetsTest { + public static void main(String[] args) { + Rectangle rect = new Rectangle(10, 20, 60, 60); + Insets insets = new Insets(5, 10, 15, 20); + Rectangle expected = + new Rectangle(rect.x + insets.left, + rect.y + insets.top, + rect.width - (insets.left + insets.right), + rect.height - (insets.top + insets.bottom)); + + SwingUtilities3.applyInsets(rect, insets); + if (!rect.equals(expected)) { + throw new RuntimeException("Test failed: expected " + expected + + " but got " + rect); + } + + // Right to left test + rect.setRect(10, 20, 60, 60); + expected.x = rect.x + insets.right; + SwingUtilities3.applyInsets(rect, insets, false); + if (!rect.equals(expected)) { + throw new RuntimeException("Right to left test failed: expected " + + expected + " but got " + rect); + } + + System.out.println("Test passed."); + } +} diff --git a/test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java b/test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java index cb90f374d847..7824b030d418 100644 --- a/test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java +++ b/test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,25 +26,25 @@ * @bug 4928019 * @key headful * @summary Makes sure all the basic classes can be created with GTK. - * @author Scott Violet + * @requires (os.family != "windows" & os.family != "mac") + * @library /test/lib + * @build jtreg.SkippedException + * @run main bug4928019 */ import javax.swing.*; import javax.swing.plaf.basic.*; +import jtreg.SkippedException; + public class bug4928019 { public static void main(String[] args) throws Throwable { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); - } catch (UnsupportedLookAndFeelException ex) { - System.err.println("GTKLookAndFeel is not supported on this platform." + - " Test is considered passed."); - return; - } catch (ClassNotFoundException ex) { - System.err.println("GTKLookAndFeel class is not found." + - " Test is considered passed."); - return; + } catch (Exception e) { + throw new SkippedException("GTKLookAndFeel isn't supported", e); } + new JButton() { public void updateUI() { setUI(new BasicButtonUI()); diff --git a/test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java b/test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java index ddf8363e2ee4..eb3e1e7ca62b 100644 --- a/test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java +++ b/test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,18 +21,28 @@ * questions. */ -/* @test - @bug 6635110 - @key headful - @summary GTK icons should not throw NPE when called by non-GTK UI - @author Peter Zhelezniakov - @run main Test6635110 +/* + * @test + * @bug 6635110 + * @key headful + * @summary GTK icons should not throw NPE when called by non-GTK UI + * @requires (os.family != "windows" & os.family != "mac") + * @library /test/lib + * @build jtreg.SkippedException + * @run main Test6635110 */ -import javax.swing.*; -import java.awt.*; +import java.awt.Component; import java.awt.image.BufferedImage; -import javax.swing.plaf.basic.*; + +import javax.swing.JMenu; +import javax.swing.JToolBar; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.plaf.basic.BasicMenuUI; +import javax.swing.plaf.basic.BasicToolBarUI; + +import jtreg.SkippedException; public class Test6635110 implements Runnable { @@ -53,7 +63,7 @@ public class Test6635110 implements Runnable { paint(tb); } - void paint(Component c) { + private void paint(Component c) { c.setSize(WIDTH, HEIGHT); c.paint(IMAGE.getGraphics()); } @@ -62,9 +72,9 @@ public static void main(String[] args) throws Exception { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch (Exception e) { - System.out.println("GTKLookAndFeel cannot be set, skipping this test"); - return; + throw new SkippedException("GTKLookAndFeel isn't supported", e); } + SwingUtilities.invokeAndWait(new Test6635110()); } } diff --git a/test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java b/test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java index 962a2d1a0aff..ea072419a594 100644 --- a/test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java +++ b/test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,23 +21,28 @@ * questions. */ -/* @test - @bug 6963870 - @key headful - @summary Tests that GTKPainter.ListTableFocusBorder.getBorderInsets() - doesn't return null - @author Peter Zhelezniakov - @run main Test6963870 -*/ +/* + * @test + * @bug 6963870 + * @key headful + * @summary Tests that GTKPainter.ListTableFocusBorder.getBorderInsets() + * doesn't return null + * @requires (os.family != "windows" & os.family != "mac") + * @library /test/lib + * @build jtreg.SkippedException + * @run main Test6963870 + */ import java.awt.Insets; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.border.Border; +import jtreg.SkippedException; + public class Test6963870 implements Runnable { - final static String[] UI_NAMES = { + static final String[] UI_NAMES = { "List.focusCellHighlightBorder", "List.focusSelectedCellHighlightBorder", "List.noFocusBorder", @@ -45,6 +50,7 @@ public class Test6963870 implements Runnable { "Table.focusSelectedCellHighlightBorder", }; + @Override public void run() { for (String uiName: UI_NAMES) { test(uiName); @@ -63,11 +69,9 @@ public static void main(String[] args) throws Exception { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch (Exception e) { - System.out.println("GTKLookAndFeel cannot be set, skipping this test"); - return; + throw new SkippedException("GTKLookAndFeel isn't supported", e); } SwingUtilities.invokeAndWait(new Test6963870()); } } - diff --git a/test/jdk/com/sun/java/swing/plaf/windows/MenuItem/MenuItemAcceleratorColor.java b/test/jdk/com/sun/java/swing/plaf/windows/MenuItem/MenuItemAcceleratorColor.java new file mode 100644 index 000000000000..f098be4fdbd6 --- /dev/null +++ b/test/jdk/com/sun/java/swing/plaf/windows/MenuItem/MenuItemAcceleratorColor.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; + +import javax.swing.Box; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.KeyStroke; +import javax.swing.UIManager; + +import static javax.swing.BorderFactory.createEmptyBorder; + +/* + * @test id=windows + * @bug 8348760 8365375 8365389 8365625 + * @requires (os.family == "windows") + * @summary Verify that Windows Look & Feel allows changing + * accelerator colors + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuItemAcceleratorColor + */ + +/* + * @test id=classic + * @bug 8348760 8365375 8365389 8365625 + * @requires (os.family == "windows") + * @summary Verify that Windows Classic Look & Feel allows changing + * accelerator colors + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuItemAcceleratorColor classic + */ +public final class MenuItemAcceleratorColor { + private static final String INSTRUCTIONS = + "Click the Menu to open it.\n" + + "\n" + + "Verify that the first and the last menu items render " + + "their accelerators using the default colors, the color " + + "should match that of the menu item itself in regular and " + + "selected states.\n" + + "\n" + + "Verify that the second menu item renders its accelerator " + + "with green and that the color changes to red when selected.\n" + + "\n" + + "Verify that the third menu item renders its accelerator " + + "with magenta and yellow correspondingly.\n" + + "\n" + + "Verify that only the fifth menu item renders its accelerator " + + "with blue; both the fourth and sixth should render their " + + "accelerator with a shade of gray.\n" + + "\n" + + "If the above conditions are satisfied, press the Pass button; " + + "otherwise, press the Fail button."; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel((args.length > 0 && "classic".equals(args[0])) + ? "com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel" + : "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .rows(20) + .columns(60) + .testUI(MenuItemAcceleratorColor::createUI) + .build() + .awaitAndCheck(); + } + + private static Box createInfoPanel() { + Box box = Box.createVerticalBox(); + box.add(new JLabel("Look and Feel: " + + UIManager.getLookAndFeel() + .getName())); + box.add(new JLabel("Java version: " + + System.getProperty("java.runtime.version"))); + return box; + } + + private static JFrame createUI() { + JPanel content = new JPanel(new BorderLayout()); + content.setBorder(createEmptyBorder(8, 8, 8, 8)); + content.add(createInfoPanel(), + BorderLayout.SOUTH); + + JFrame frame = new JFrame("Accelerator colors in Windows L&F"); + frame.setJMenuBar(createMenuBar()); + frame.add(content, BorderLayout.CENTER); + frame.setSize(350, 370); + return frame; + } + + private static JMenuBar createMenuBar() { + JMenuItem first = new JMenuItem("First menu item"); + first.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, + InputEvent.CTRL_DOWN_MASK)); + + // Modify colors for accelerator rendering + Color acceleratorForeground = UIManager.getColor("MenuItem.acceleratorForeground"); + Color acceleratorSelectionForeground = UIManager.getColor("MenuItem.acceleratorSelectionForeground"); + UIManager.put("MenuItem.acceleratorForeground", Color.GREEN); + UIManager.put("MenuItem.acceleratorSelectionForeground", Color.RED); + + JMenuItem second = new JMenuItem("Second menu item"); + second.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, + InputEvent.SHIFT_DOWN_MASK + | InputEvent.CTRL_DOWN_MASK)); + + UIManager.put("MenuItem.acceleratorForeground", Color.MAGENTA); + UIManager.put("MenuItem.acceleratorSelectionForeground", Color.YELLOW); + JMenuItem third = new JMenuItem("Third menu item"); + third.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, + InputEvent.ALT_DOWN_MASK)); + + // Restore colors + UIManager.put("MenuItem.acceleratorForeground", acceleratorForeground); + UIManager.put("MenuItem.acceleratorSelectionForeground", acceleratorSelectionForeground); + + + // Disabled foreground + JMenuItem fourth = new JMenuItem("Fourth menu item"); + fourth.setEnabled(false); + fourth.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, + InputEvent.CTRL_DOWN_MASK)); + + Color disabledForeground = UIManager.getColor("MenuItem.disabledForeground"); + UIManager.put("MenuItem.disabledForeground", Color.BLUE); + + JMenuItem fifth = new JMenuItem("Fifth menu item"); + fifth.setEnabled(false); + fifth.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, + InputEvent.CTRL_DOWN_MASK + | InputEvent.SHIFT_DOWN_MASK)); + + // Restore disabled foreground + UIManager.put("MenuItem.disabledForeground", disabledForeground); + + JMenuItem sixth = new JMenuItem("Sixth menu item"); + sixth.setEnabled(false); + sixth.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, + InputEvent.CTRL_DOWN_MASK + | InputEvent.ALT_DOWN_MASK)); + + + JMenuItem quit = new JMenuItem("Quit"); + quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, + InputEvent.CTRL_DOWN_MASK)); + + JMenu menu = new JMenu("Menu"); + menu.add(first); + menu.add(second); + menu.add(third); + menu.addSeparator(); + menu.add(fourth); + menu.add(fifth); + menu.add(sixth); + menu.addSeparator(); + menu.add(quit); + + JMenuBar menuBar = new JMenuBar(); + menuBar.add(menu); + + return menuBar; + } +} diff --git a/test/jdk/com/sun/net/httpserver/SANTest.java b/test/jdk/com/sun/net/httpserver/SANTest.java index dc7f5e7bdd53..948ebdce30b6 100644 --- a/test/jdk/com/sun/net/httpserver/SANTest.java +++ b/test/jdk/com/sun/net/httpserver/SANTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ */ public class SANTest implements HttpServerAdapters { - static SSLContext ctx; + private static SSLContext ctx; static HttpServer getHttpsServer(InetSocketAddress addr, Executor exec, SSLContext ctx) throws Exception { HttpsServer server = HttpsServer.create(addr, 0); @@ -99,6 +99,8 @@ static HttpTestServer initServer(boolean h2, InetAddress addr, SSLContext ctx, } public static void main (String[] args) throws Exception { + ctx = SimpleSSLContext.findSSLContext(); + // Http/1.1 servers HttpTestServer h1s1 = null; HttpTestServer h1s2 = null; @@ -110,7 +112,6 @@ public static void main (String[] args) throws Exception { ExecutorService executor=null; try { System.out.print ("SANTest: "); - ctx = new SimpleSSLContext().get(); executor = Executors.newCachedThreadPool(); InetAddress l1 = InetAddress.getByName("::1"); diff --git a/test/jdk/com/sun/net/httpserver/SelCacheTest.java b/test/jdk/com/sun/net/httpserver/SelCacheTest.java index 5104e88244e9..1417c3d8582e 100644 --- a/test/jdk/com/sun/net/httpserver/SelCacheTest.java +++ b/test/jdk/com/sun/net/httpserver/SelCacheTest.java @@ -62,9 +62,10 @@ public class SelCacheTest extends Test { private static final String TEMP_FILE_PREFIX = HttpServer.class.getPackageName() + '-' + SelCacheTest.class.getSimpleName() + '-'; - static SSLContext ctx; + private static SSLContext ctx; public static void main(String[] args) throws Exception { + ctx = SimpleSSLContext.findSSLContext(); HttpServer s1 = null; HttpsServer s2 = null; ExecutorService executor=null; @@ -87,7 +88,6 @@ public static void main(String[] args) throws Exception { executor = Executors.newCachedThreadPool(); s1.setExecutor(executor); s2.setExecutor(executor); - ctx = new SimpleSSLContext().get(); s2.setHttpsConfigurator(new HttpsConfigurator(ctx)); s1.start(); s2.start(); diff --git a/test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java b/test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java index 815611607258..e8f365b715b1 100644 --- a/test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java +++ b/test/jdk/com/sun/net/httpserver/ServerStopTerminationTest.java @@ -124,13 +124,16 @@ public void shouldAwaitActiveExchange() throws InterruptedException { // Complete the exchange one second into the future final Duration exchangeDuration = Duration.ofSeconds(1); + // taking start time before entering completeExchange to account for possible + // delays in reaching server.stop(). + final long startTime = System.nanoTime(); completeExchange(exchangeDuration); log("Complete Exchange triggered"); // Time the shutdown sequence - final Duration delayDuration = Duration.ofSeconds(Utils.adjustTimeout(5)); + final Duration delayDuration = Duration.ofSeconds(Utils.adjustTimeout(20)); log("Shutdown triggered with the delay of " + delayDuration.getSeconds()); - final long elapsed = timeShutdown(delayDuration); + final long elapsed = timeShutdown(delayDuration, startTime); log("Shutdown complete"); // The shutdown should take at least as long as the exchange duration @@ -151,31 +154,20 @@ public void shouldAwaitActiveExchange() throws InterruptedException { * @throws InterruptedException if an unexpected interruption occurs */ @Test - public void shouldCompeteAfterDelay() throws InterruptedException { + public void shouldCompleteAfterDelay() throws InterruptedException { // Initiate an exchange startExchange(); // Wait for the server to receive the exchange start.await(); log("Exchange started"); - // Complete the exchange 10 second into the future. - // Runs in parallel, so won't block the server stop - final Duration exchangeDuration = Duration.ofSeconds(Utils.adjustTimeout(10)); - completeExchange(exchangeDuration); - log("Complete Exchange triggered"); - - // Time the shutdown sequence final Duration delayDuration = Duration.ofSeconds(1); log("Shutdown triggered with the delay of " + delayDuration.getSeconds()); final long elapsed = timeShutdown(delayDuration); log("Shutdown complete"); - - - // The shutdown should not await the exchange to complete - if (elapsed >= exchangeDuration.toNanos()) { - fail("HttpServer.stop terminated too late"); - } + complete.countDown(); + log("Exchange completed"); // The shutdown delay should have expired if (elapsed < delayDuration.toNanos()) { @@ -277,7 +269,14 @@ public void shouldAllowRepeatedStop() { */ private long timeShutdown(Duration delayDuration) { final long startTime = System.nanoTime(); + return timeShutdown(delayDuration, startTime); + } + /** + * This allows passing a custom start time + */ + private long timeShutdown(Duration delayDuration, + long startTime) { server.stop((int) delayDuration.toSeconds()); return System.nanoTime() - startTime; } diff --git a/test/jdk/com/sun/net/httpserver/Test1.java b/test/jdk/com/sun/net/httpserver/Test1.java index 32bab4d91784..522e43a0b46b 100644 --- a/test/jdk/com/sun/net/httpserver/Test1.java +++ b/test/jdk/com/sun/net/httpserver/Test1.java @@ -69,9 +69,11 @@ public class Test1 extends Test { private static final String TEMP_FILE_PREFIX = HttpServer.class.getPackageName() + '-' + Test1.class.getSimpleName() + '-'; - static SSLContext ctx; + private static SSLContext ctx; public static void main (String[] args) throws Exception { + ctx = SimpleSSLContext.findSSLContext(); + HttpServer s1 = null; HttpsServer s2 = null; ExecutorService executor=null; @@ -94,7 +96,6 @@ public static void main (String[] args) throws Exception { executor = Executors.newCachedThreadPool(); s1.setExecutor (executor); s2.setExecutor (executor); - ctx = new SimpleSSLContext().get(); s2.setHttpsConfigurator(new HttpsConfigurator (ctx)); s1.start(); s2.start(); diff --git a/test/jdk/com/sun/net/httpserver/Test12.java b/test/jdk/com/sun/net/httpserver/Test12.java index 2a0ee1fc0a44..102b607f2129 100644 --- a/test/jdk/com/sun/net/httpserver/Test12.java +++ b/test/jdk/com/sun/net/httpserver/Test12.java @@ -56,9 +56,11 @@ public class Test12 extends Test { private static final String TEMP_FILE_PREFIX = HttpServer.class.getPackageName() + '-' + Test12.class.getSimpleName() + '-'; - static SSLContext ctx; + private static SSLContext ctx; public static void main (String[] args) throws Exception { + ctx = SimpleSSLContext.findSSLContext(); + HttpServer s1 = null; HttpsServer s2 = null; Path smallFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 23); @@ -77,7 +79,6 @@ public static void main (String[] args) throws Exception { HttpContext c2 = s2.createContext ("/", h); s1.setExecutor (executor); s2.setExecutor (executor); - ctx = new SimpleSSLContext().get(); s2.setHttpsConfigurator(new HttpsConfigurator (ctx)); s1.start(); s2.start(); diff --git a/test/jdk/com/sun/net/httpserver/Test13.java b/test/jdk/com/sun/net/httpserver/Test13.java index ead3ff95acd6..f7ade590f2cd 100644 --- a/test/jdk/com/sun/net/httpserver/Test13.java +++ b/test/jdk/com/sun/net/httpserver/Test13.java @@ -59,13 +59,15 @@ public class Test13 extends Test { private static final String TEMP_FILE_PREFIX = HttpServer.class.getPackageName() + '-' + Test13.class.getSimpleName() + '-'; - static SSLContext ctx; + private static SSLContext ctx; final static int NUM = 32; // was 32 static boolean fail = false; public static void main (String[] args) throws Exception { + ctx = SimpleSSLContext.findSSLContext(); + HttpServer s1 = null; HttpsServer s2 = null; ExecutorService executor=null; @@ -87,7 +89,6 @@ public static void main (String[] args) throws Exception { executor = Executors.newCachedThreadPool(); s1.setExecutor (executor); s2.setExecutor (executor); - ctx = new SimpleSSLContext().get(); s2.setHttpsConfigurator(new HttpsConfigurator (ctx)); s1.start(); s2.start(); diff --git a/test/jdk/com/sun/net/httpserver/Test6a.java b/test/jdk/com/sun/net/httpserver/Test6a.java index bbe107f5e2fd..21a4aebdc75a 100644 --- a/test/jdk/com/sun/net/httpserver/Test6a.java +++ b/test/jdk/com/sun/net/httpserver/Test6a.java @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 6270015 * @library /test/lib @@ -54,7 +54,7 @@ public static void main (String[] args) throws Exception { HttpsServer server = HttpsServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); - SSLContext ssl = new SimpleSSLContext().get(); + SSLContext ssl = SimpleSSLContext.findSSLContext(); server.setExecutor (executor); server.setHttpsConfigurator(new HttpsConfigurator (ssl)); server.start (); diff --git a/test/jdk/com/sun/net/httpserver/Test7a.java b/test/jdk/com/sun/net/httpserver/Test7a.java index 5ff01ade9a03..58d40bd8ddee 100644 --- a/test/jdk/com/sun/net/httpserver/Test7a.java +++ b/test/jdk/com/sun/net/httpserver/Test7a.java @@ -58,7 +58,7 @@ public static void main (String[] args) throws Exception { HttpsServer server = HttpsServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); ExecutorService executor = Executors.newCachedThreadPool(); - SSLContext ssl = new SimpleSSLContext().get(); + SSLContext ssl = SimpleSSLContext.findSSLContext(); server.setHttpsConfigurator(new HttpsConfigurator (ssl)); server.setExecutor (executor); server.start (); diff --git a/test/jdk/com/sun/net/httpserver/Test8a.java b/test/jdk/com/sun/net/httpserver/Test8a.java index 6c642f7c22aa..67f9c93172ab 100644 --- a/test/jdk/com/sun/net/httpserver/Test8a.java +++ b/test/jdk/com/sun/net/httpserver/Test8a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ public static void main (String[] args) throws Exception { server = HttpsServer.create (addr, 0); HttpContext ctx = server.createContext ("/test", handler); executor = Executors.newCachedThreadPool(); - SSLContext ssl = new SimpleSSLContext().get(); + SSLContext ssl = SimpleSSLContext.findSSLContext(); server.setHttpsConfigurator(new HttpsConfigurator (ssl)); server.setExecutor (executor); server.start (); diff --git a/test/jdk/com/sun/net/httpserver/Test9.java b/test/jdk/com/sun/net/httpserver/Test9.java index 6f7b1d4f5bc3..92489d88dd69 100644 --- a/test/jdk/com/sun/net/httpserver/Test9.java +++ b/test/jdk/com/sun/net/httpserver/Test9.java @@ -58,15 +58,19 @@ public class Test9 extends Test { private static final String TEMP_FILE_PREFIX = HttpServer.class.getPackageName() + '-' + Test9.class.getSimpleName() + '-'; - static SSLContext ctx; - static boolean error = false; + private static SSLContext ctx; + static volatile boolean error = false; public static void main (String[] args) throws Exception { + ctx = SimpleSSLContext.findSSLContext(); + HttpServer s1 = null; HttpsServer s2 = null; ExecutorService executor=null; Path smallFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 23); Path largeFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 2730088); + smallFilePath.toFile().deleteOnExit(); + largeFilePath.toFile().deleteOnExit(); try { System.out.print ("Test9: "); InetAddress loopback = InetAddress.getLoopbackAddress(); @@ -81,7 +85,6 @@ public static void main (String[] args) throws Exception { executor = Executors.newCachedThreadPool(); s1.setExecutor (executor); s2.setExecutor (executor); - ctx = new SimpleSSLContext().get(); s2.setHttpsConfigurator(new HttpsConfigurator (ctx)); s1.start(); s2.start(); @@ -122,20 +125,16 @@ public static void main (String[] args) throws Exception { s2.stop(0); if (executor != null) executor.shutdown (); - Files.delete(smallFilePath); - Files.delete(largeFilePath); } } - static int foo = 1; - static ClientThread test (boolean fixedLen, String protocol, int port, Path filePath) throws Exception { ClientThread t = new ClientThread (fixedLen, protocol, port, filePath); t.start(); return t; } - static Object fileLock = new Object(); + static final Object fileLock = new Object(); static class ClientThread extends Thread { @@ -203,9 +202,8 @@ public boolean verify (String s, SSLSession s1) { error = true; } assertFileContentsEqual(filePath, temp.toPath()); - temp.delete(); } catch (Exception e) { - e.printStackTrace(); + System.err.println("Error occurred: " + e); error = true; } } diff --git a/test/jdk/com/sun/net/httpserver/Test9a.java b/test/jdk/com/sun/net/httpserver/Test9a.java index 85acfd265187..290acd343570 100644 --- a/test/jdk/com/sun/net/httpserver/Test9a.java +++ b/test/jdk/com/sun/net/httpserver/Test9a.java @@ -56,11 +56,14 @@ public class Test9a extends Test { private static final String TEMP_FILE_PREFIX = HttpServer.class.getPackageName() + '-' + Test9a.class.getSimpleName() + '-'; - static SSLContext serverCtx; - static volatile SSLContext clientCtx = null; + private static SSLContext serverCtx; + private static SSLContext clientCtx; static volatile boolean error = false; public static void main (String[] args) throws Exception { + serverCtx = SimpleSSLContext.findSSLContext(); + clientCtx = SimpleSSLContext.findSSLContext(); + HttpsServer server = null; ExecutorService executor=null; Path smallFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 23); @@ -76,8 +79,6 @@ public static void main (String[] args) throws Exception { HttpContext c1 = server.createContext ("/", h); executor = Executors.newCachedThreadPool(); server.setExecutor (executor); - serverCtx = new SimpleSSLContext().get(); - clientCtx = new SimpleSSLContext().get(); server.setHttpsConfigurator(new HttpsConfigurator (serverCtx)); server.start(); diff --git a/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java b/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java index 89839e462c51..0d44d9677892 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java +++ b/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ public class HandlerConnectionClose { static final int ONEK = 1024; static final long POST_SIZE = ONEK * 1L; - SSLContext sslContext; + private static SSLContext sslContext; Logger logger; void test(String[] args) throws Exception { @@ -77,7 +77,6 @@ void test(String[] args) throws Exception { } finally { httpServer.stop(0); } - sslContext = new SimpleSSLContext().get(); HttpServer httpsServer = startHttpServer("https"); try { testHttpURLConnection(httpsServer, "https","/close/legacy/https/chunked"); @@ -425,6 +424,7 @@ public void handle(HttpExchange t) throws IOException { void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);} void debug(String message) {if(debug) { System.out.println(message); } } public static void main(String[] args) throws Throwable { + sslContext = SimpleSSLContext.findSSLContext(); Class k = new Object(){}.getClass().getEnclosingClass(); try {k.getMethod("instanceMain",String[].class) .invoke( k.newInstance(), (Object) args);} diff --git a/test/jdk/com/sun/net/httpserver/simpleserver/CustomFileSystemTest.java b/test/jdk/com/sun/net/httpserver/simpleserver/CustomFileSystemTest.java index d6ec3eb06955..0a46ac1ea8a5 100644 --- a/test/jdk/com/sun/net/httpserver/simpleserver/CustomFileSystemTest.java +++ b/test/jdk/com/sun/net/httpserver/simpleserver/CustomFileSystemTest.java @@ -256,63 +256,65 @@ public void testDirectoryWithIndexGET(String id, @Test public void testNotReadableFileGET() throws Exception { - if (!Platform.isWindows()) { // not applicable on Windows - var expectedBody = openHTML + """ -

File not found

-

/aFile.txt

- """ + closeHTML; - var expectedLength = Integer.toString(expectedBody.getBytes(UTF_8).length); - var root = createDirectoryInCustomFs("testNotReadableFileGET"); - var file = Files.writeString(root.resolve("aFile.txt"), "some text", CREATE); - - file.toFile().setReadable(false, false); - assert !Files.isReadable(file); - - var server = SimpleFileServer.createFileServer(LOOPBACK_ADDR, root, OutputLevel.VERBOSE); - server.start(); - try { - var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); - var request = HttpRequest.newBuilder(uri(server, "aFile.txt")).build(); - var response = client.send(request, BodyHandlers.ofString()); - assertEquals(response.statusCode(), 404); - assertEquals(response.headers().firstValue("content-length").get(), expectedLength); - assertEquals(response.body(), expectedBody); - } finally { - server.stop(0); - file.toFile().setReadable(true, false); - } + if (Platform.isWindows()) { + throw new SkipException("Not applicable on Windows"); + } + var expectedBody = openHTML + """ +

File not found

+

/aFile.txt

+ """ + closeHTML; + var expectedLength = Integer.toString(expectedBody.getBytes(UTF_8).length); + var root = createDirectoryInCustomFs("testNotReadableFileGET"); + var file = Files.writeString(root.resolve("aFile.txt"), "some text", CREATE); + + file.toFile().setReadable(false, false); + assert !Files.isReadable(file); + + var server = SimpleFileServer.createFileServer(LOOPBACK_ADDR, root, OutputLevel.VERBOSE); + server.start(); + try { + var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); + var request = HttpRequest.newBuilder(uri(server, "aFile.txt")).build(); + var response = client.send(request, BodyHandlers.ofString()); + assertEquals(response.statusCode(), 404); + assertEquals(response.headers().firstValue("content-length").get(), expectedLength); + assertEquals(response.body(), expectedBody); + } finally { + server.stop(0); + file.toFile().setReadable(true, false); } } @Test public void testNotReadableSegmentGET() throws Exception { - if (!Platform.isWindows()) { // not applicable on Windows - var expectedBody = openHTML + """ -

File not found

-

/dir/aFile.txt

- """ + closeHTML; - var expectedLength = Integer.toString(expectedBody.getBytes(UTF_8).length); - var root = createDirectoryInCustomFs("testNotReadableSegmentGET"); - var dir = Files.createDirectory(root.resolve("dir")); - var file = Files.writeString(dir.resolve("aFile.txt"), "some text", CREATE); - - dir.toFile().setReadable(false, false); - assert !Files.isReadable(dir); - assert Files.isReadable(file); - - var server = SimpleFileServer.createFileServer(LOOPBACK_ADDR, root, OutputLevel.VERBOSE); - server.start(); - try { - var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); - var request = HttpRequest.newBuilder(uri(server, "dir/aFile.txt")).build(); - var response = client.send(request, BodyHandlers.ofString()); - assertEquals(response.statusCode(), 404); - assertEquals(response.headers().firstValue("content-length").get(), expectedLength); - assertEquals(response.body(), expectedBody); - } finally { - server.stop(0); - dir.toFile().setReadable(true, false); - } + if (Platform.isWindows()) { + throw new SkipException("Not applicable on Windows"); + } + var expectedBody = openHTML + """ +

File not found

+

/dir/aFile.txt

+ """ + closeHTML; + var expectedLength = Integer.toString(expectedBody.getBytes(UTF_8).length); + var root = createDirectoryInCustomFs("testNotReadableSegmentGET"); + var dir = Files.createDirectory(root.resolve("dir")); + var file = Files.writeString(dir.resolve("aFile.txt"), "some text", CREATE); + + dir.toFile().setReadable(false, false); + assert !Files.isReadable(dir); + assert Files.isReadable(file); + + var server = SimpleFileServer.createFileServer(LOOPBACK_ADDR, root, OutputLevel.VERBOSE); + server.start(); + try { + var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); + var request = HttpRequest.newBuilder(uri(server, "dir/aFile.txt")).build(); + var response = client.send(request, BodyHandlers.ofString()); + assertEquals(response.statusCode(), 404); + assertEquals(response.headers().firstValue("content-length").get(), expectedLength); + assertEquals(response.body(), expectedBody); + } finally { + server.stop(0); + dir.toFile().setReadable(true, false); } } diff --git a/test/jdk/com/sun/net/httpserver/simpleserver/HttpsServerTest.java b/test/jdk/com/sun/net/httpserver/simpleserver/HttpsServerTest.java index 2227c4cd4379..37bba945fc9f 100644 --- a/test/jdk/com/sun/net/httpserver/simpleserver/HttpsServerTest.java +++ b/test/jdk/com/sun/net/httpserver/simpleserver/HttpsServerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,6 @@ import java.net.http.HttpResponse.BodyHandlers; import java.nio.charset.StandardCharsets; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.ConsoleHandler; import java.util.logging.Level; import java.util.logging.Logger; @@ -67,7 +66,14 @@ public class HttpsServerTest { static final boolean ENABLE_LOGGING = true; static final Logger LOGGER = Logger.getLogger("com.sun.net.httpserver"); - SSLContext sslContext; + private static SSLContext sslContext; + + static { + try { + sslContext = SimpleSSLContext.findSSLContext(); + } catch (IOException e) {} + SSLContext.setDefault(sslContext); + } @BeforeTest public void setup() throws IOException { @@ -77,8 +83,6 @@ public void setup() throws IOException { ch.setLevel(Level.ALL); LOGGER.addHandler(ch); } - sslContext = new SimpleSSLContext().get(); - SSLContext.setDefault(sslContext); } @Test diff --git a/test/jdk/com/sun/net/httpserver/simpleserver/SimpleFileServerTest.java b/test/jdk/com/sun/net/httpserver/simpleserver/SimpleFileServerTest.java index b31346409250..ab40b3c58ced 100644 --- a/test/jdk/com/sun/net/httpserver/simpleserver/SimpleFileServerTest.java +++ b/test/jdk/com/sun/net/httpserver/simpleserver/SimpleFileServerTest.java @@ -248,63 +248,65 @@ public void testDirectoryWithIndexGET(String id, @Test public void testNotReadableFileGET() throws Exception { - if (!Platform.isWindows()) { // not applicable on Windows - var expectedBody = openHTML + """ -

File not found

-

/aFile.txt

- """ + closeHTML; - var expectedLength = Integer.toString(expectedBody.getBytes(UTF_8).length); - var root = Files.createDirectory(TEST_DIR.resolve("testNotReadableFileGET")); - var file = Files.writeString(root.resolve("aFile.txt"), "some text", CREATE); - - file.toFile().setReadable(false, false); - assert !Files.isReadable(file); - - var server = SimpleFileServer.createFileServer(LOOPBACK_ADDR, root, OutputLevel.VERBOSE); - server.start(); - try { - var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); - var request = HttpRequest.newBuilder(uri(server, "aFile.txt")).build(); - var response = client.send(request, BodyHandlers.ofString()); - assertEquals(response.statusCode(), 404); - assertEquals(response.headers().firstValue("content-length").get(), expectedLength); - assertEquals(response.body(), expectedBody); - } finally { - server.stop(0); - file.toFile().setReadable(true, false); - } + if (Platform.isWindows()) { + throw new SkipException("Not applicable on Windows"); + } + var expectedBody = openHTML + """ +

File not found

+

/aFile.txt

+ """ + closeHTML; + var expectedLength = Integer.toString(expectedBody.getBytes(UTF_8).length); + var root = Files.createDirectory(TEST_DIR.resolve("testNotReadableFileGET")); + var file = Files.writeString(root.resolve("aFile.txt"), "some text", CREATE); + + file.toFile().setReadable(false, false); + assert !Files.isReadable(file); + + var server = SimpleFileServer.createFileServer(LOOPBACK_ADDR, root, OutputLevel.VERBOSE); + server.start(); + try { + var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); + var request = HttpRequest.newBuilder(uri(server, "aFile.txt")).build(); + var response = client.send(request, BodyHandlers.ofString()); + assertEquals(response.statusCode(), 404); + assertEquals(response.headers().firstValue("content-length").get(), expectedLength); + assertEquals(response.body(), expectedBody); + } finally { + server.stop(0); + file.toFile().setReadable(true, false); } } @Test public void testNotReadableSegmentGET() throws Exception { - if (!Platform.isWindows()) { // not applicable on Windows - var expectedBody = openHTML + """ -

File not found

-

/dir/aFile.txt

- """ + closeHTML; - var expectedLength = Integer.toString(expectedBody.getBytes(UTF_8).length); - var root = Files.createDirectory(TEST_DIR.resolve("testNotReadableSegmentGET")); - var dir = Files.createDirectory(root.resolve("dir")); - var file = Files.writeString(dir.resolve("aFile.txt"), "some text", CREATE); - - dir.toFile().setReadable(false, false); - assert !Files.isReadable(dir); - assert Files.isReadable(file); - - var server = SimpleFileServer.createFileServer(LOOPBACK_ADDR, root, OutputLevel.VERBOSE); - server.start(); - try { - var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); - var request = HttpRequest.newBuilder(uri(server, "dir/aFile.txt")).build(); - var response = client.send(request, BodyHandlers.ofString()); - assertEquals(response.statusCode(), 404); - assertEquals(response.headers().firstValue("content-length").get(), expectedLength); - assertEquals(response.body(), expectedBody); - } finally { - server.stop(0); - dir.toFile().setReadable(true, false); - } + if (Platform.isWindows()) { + throw new SkipException("Not applicable on Windows"); + } + var expectedBody = openHTML + """ +

File not found

+

/dir/aFile.txt

+ """ + closeHTML; + var expectedLength = Integer.toString(expectedBody.getBytes(UTF_8).length); + var root = Files.createDirectory(TEST_DIR.resolve("testNotReadableSegmentGET")); + var dir = Files.createDirectory(root.resolve("dir")); + var file = Files.writeString(dir.resolve("aFile.txt"), "some text", CREATE); + + dir.toFile().setReadable(false, false); + assert !Files.isReadable(dir); + assert Files.isReadable(file); + + var server = SimpleFileServer.createFileServer(LOOPBACK_ADDR, root, OutputLevel.VERBOSE); + server.start(); + try { + var client = HttpClient.newBuilder().proxy(NO_PROXY).build(); + var request = HttpRequest.newBuilder(uri(server, "dir/aFile.txt")).build(); + var response = client.send(request, BodyHandlers.ofString()); + assertEquals(response.statusCode(), 404); + assertEquals(response.headers().firstValue("content-length").get(), expectedLength); + assertEquals(response.body(), expectedBody); + } finally { + server.stop(0); + dir.toFile().setReadable(true, false); } } @@ -627,18 +629,22 @@ public void testIllegalPath() throws Exception { var iae = expectThrows(IAE, () -> SimpleFileServer.createFileServer(addr, p, OutputLevel.INFO)); assertTrue(iae.getMessage().contains("does not exist")); } - { // not readable - if (!Platform.isWindows()) { // not applicable on Windows - Path p = Files.createDirectory(TEST_DIR.resolve("aDir")); - p.toFile().setReadable(false, false); - assert !Files.isReadable(p); - try { - var iae = expectThrows(IAE, () -> SimpleFileServer.createFileServer(addr, p, OutputLevel.INFO)); - assertTrue(iae.getMessage().contains("not readable")); - } finally { - p.toFile().setReadable(true, false); - } - } + } + + @Test + public void testNonReadablePath() throws Exception { + if (Platform.isWindows()) { + throw new SkipException("Not applicable on Windows"); + } + var addr = LOOPBACK_ADDR; + Path p = Files.createDirectory(TEST_DIR.resolve("aDir")); + p.toFile().setReadable(false, false); + assert !Files.isReadable(p); + try { + var iae = expectThrows(IAE, () -> SimpleFileServer.createFileServer(addr, p, OutputLevel.INFO)); + assertTrue(iae.getMessage().contains("not readable")); + } finally { + p.toFile().setReadable(true, false); } } diff --git a/test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java b/test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java index c972f87dc180..385615ecd3d3 100644 --- a/test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java +++ b/test/jdk/com/sun/net/httpserver/simpleserver/jwebserver/MaxRequestTimeTest.java @@ -78,18 +78,16 @@ public class MaxRequestTimeTest { static final String LOOPBACK_ADDR = InetAddress.getLoopbackAddress().getHostAddress(); static final AtomicInteger PORT = new AtomicInteger(); - static SSLContext sslContext; + private static SSLContext sslContext; @BeforeTest public void setup() throws IOException { + sslContext = SimpleSSLContext.findSSLContext(); + if (Files.exists(TEST_DIR)) { FileUtils.deleteFileTreeWithRetry(TEST_DIR); } Files.createDirectories(TEST_DIR); - - sslContext = new SimpleSSLContext().get(); - if (sslContext == null) - throw new AssertionError("Unexpected null sslContext"); } @Test diff --git a/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java b/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java index 33b68fafd520..5d62b88f23e2 100644 --- a/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java +++ b/test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java @@ -24,6 +24,7 @@ /* * @test * @bug 8238274 + * @key intermittent * @summary Potential leak file descriptor for SCTP * @requires (os.family == "linux") * @library /test/lib diff --git a/test/jdk/java/awt/Checkbox/AppearanceIfLargeFont.java b/test/jdk/java/awt/Checkbox/AppearanceIfLargeFont.java new file mode 100644 index 000000000000..7995b43ed18d --- /dev/null +++ b/test/jdk/java/awt/Checkbox/AppearanceIfLargeFont.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.CheckboxMenuItem; +import java.awt.Frame; +import java.awt.PopupMenu; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 6401956 + * @summary The right mark of the CheckboxMenu item is broken + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual AppearanceIfLargeFont + */ + +public class AppearanceIfLargeFont extends Frame { + private static final String INSTRUCTIONS = """ + 1) Make sure that font-size is large. + You could change this using 'Appearance' dialog. + 2) Press button 'Press' + You will see a menu item with check-mark. + 3) If check-mark is correctly painted then the test passed. + Otherwise, test failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("AppearanceIfLargeFont") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(AppearanceIfLargeFont::new) + .build() + .awaitAndCheck(); + } + + public AppearanceIfLargeFont() { + createComponents(); + + setSize(200, 200); + validate(); + } + + void createComponents() { + final Button press = new Button("Press"); + final PopupMenu popup = new PopupMenu(); + press.add(popup); + add(press); + + CheckboxMenuItem item = new CheckboxMenuItem("CheckboxMenuItem", true); + popup.add(item); + + press.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent ae) { + popup.show(press, press.getSize().width, 0); + } + } + ); + } +} diff --git a/test/jdk/java/awt/Checkbox/CheckboxMenuItemEventsTest.java b/test/jdk/java/awt/Checkbox/CheckboxMenuItemEventsTest.java new file mode 100644 index 000000000000..425c24ba7ef4 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/CheckboxMenuItemEventsTest.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.CheckboxMenuItem; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/* + * @test + * @bug 4814163 5005195 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Tests events fired by CheckboxMenuItem + * @run main/manual CheckboxMenuItemEventsTest +*/ + +public class CheckboxMenuItemEventsTest extends Frame implements ActionListener { + Button trigger; + PopupMenu popup; + TextArea ta; + + class Listener implements ItemListener, ActionListener { + public void itemStateChanged(ItemEvent e) { + ta.append("CORRECT: ItemEvent fired\n"); + } + + public void actionPerformed(ActionEvent e) { + ta.append("ERROR: ActionEvent fired\n"); + } + } + + Listener listener = new Listener(); + + private static final String INSTRUCTIONS = """ + Press button to invoke popup menu + When you press checkbox menu item + Item state should toggle (on/off). + ItemEvent should be displayed in log below. + And ActionEvent should not be displayed + Press PASS if ItemEvents are generated + and ActionEvents are not, FAIL Otherwise. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("CheckboxMenuItemEventsTest") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(CheckboxMenuItemEventsTest::new) + .build() + .awaitAndCheck(); + } + + public CheckboxMenuItemEventsTest() { + CheckboxMenuItem i1 = new CheckboxMenuItem("CheckBoxMenuItem 1"); + CheckboxMenuItem i2 = new CheckboxMenuItem("CheckBoxMenuItem 2"); + Panel p1 = new Panel(); + Panel p2 = new Panel(); + + setLayout(new BorderLayout()); + ta = new TextArea(); + p2.add(ta); + + trigger = new Button("menu"); + trigger.addActionListener(this); + + popup = new PopupMenu(); + + i1.addItemListener(listener); + i1.addActionListener(listener); + popup.add(i1); + i2.addItemListener(listener); + i2.addActionListener(listener); + popup.add(i2); + + trigger.add(popup); + + p1.add(trigger); + + add(p1, BorderLayout.NORTH); + add(p2, BorderLayout.SOUTH); + + pack(); + validate(); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == (Object) trigger) { + popup.show(trigger, trigger.getSize().width, 0); + } + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java b/test/jdk/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java index 6426a3779108..3a94680b7237 100644 --- a/test/jdk/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java +++ b/test/jdk/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,58 +22,66 @@ */ /* - @test - @key headful - @bug 7050935 - @summary closed/java/awt/Choice/WheelEventsConsumed/WheelEventsConsumed.html fails on win32 - @library ../../regtesthelpers - @author Oleg Pekhovskiy: area=awt-choice - @build Util - @run main ChoiceMouseWheelTest -*/ + * @test + * @key headful + * @bug 7050935 + * @summary closed/java/awt/Choice/WheelEventsConsumed/WheelEventsConsumed.html fails on win32 + * @library /java/awt/regtesthelpers + * @build Util + * @run main ChoiceMouseWheelTest + */ import test.java.awt.regtesthelpers.Util; -import java.awt.*; -import java.awt.event.*; +import java.awt.Choice; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; public class ChoiceMouseWheelTest extends Frame { private volatile boolean itemChanged = false; private volatile boolean wheelMoved = false; private volatile boolean frameExited = false; + private final Choice choice; - public static void main(String[] args) { - new ChoiceMouseWheelTest(); + public static void main(String[] args) throws Exception { + ChoiceMouseWheelTest test = Util.invokeOnEDT(ChoiceMouseWheelTest::new); + try { + test.test(); + } finally { + EventQueue.invokeAndWait(test::dispose); + } } ChoiceMouseWheelTest() { super("ChoiceMouseWheelTest"); setLayout(new FlowLayout()); - Choice choice = new Choice(); - addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { - System.exit(0); + e.getWindow().dispose(); } }); - for(Integer i = 0; i < 50; i++) { - choice.add(i.toString()); + choice = new Choice(); + for(int i = 0; i < 50; i++) { + choice.add(Integer.toString(i)); } - choice.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent e) { - itemChanged = true; - } - }); - choice.addMouseWheelListener(new MouseWheelListener() { - public void mouseWheelMoved(MouseWheelEvent e) { - wheelMoved = true; - } - }); + choice.addItemListener(e -> itemChanged = true); + choice.addMouseWheelListener(e -> wheelMoved = true); addMouseListener(new MouseAdapter() { @Override @@ -84,71 +92,79 @@ public void mouseExited(MouseEvent e) { add(choice); setSize(200, 300); + setLocationRelativeTo(null); setVisible(true); toFront(); + } - try { - Robot robot = new Robot(); - robot.setAutoDelay(20); - Util.waitForIdle(robot); + private void test() throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(20); + robot.waitForIdle(); + robot.delay(500); + Rectangle choiceBounds = Util.invokeOnEDT(() -> { Point pt = choice.getLocationOnScreen(); Dimension size = choice.getSize(); - int x = pt.x + size.width / 3; - robot.mouseMove(x, pt.y + size.height / 2); + return new Rectangle(pt, size); + }); + + int x = choiceBounds.x + choiceBounds.width / 3; + robot.mouseMove(x, choiceBounds.y + choiceBounds.height / 2); - // Test mouse wheel over the choice - String name = Toolkit.getDefaultToolkit().getClass().getName(); + // Test mouse wheel over the choice + String name = Toolkit.getDefaultToolkit().getClass().getName(); + boolean isXtoolkit = name.equals("sun.awt.X11.XToolkit"); + boolean isLWCToolkit = name.equals("sun.lwawt.macosx.LWCToolkit"); - // mouse wheel doesn't work for the choice on X11 and Mac, so skip it - if(!name.equals("sun.awt.X11.XToolkit") - && !name.equals("sun.lwawt.macosx.LWCToolkit")) { - robot.mouseWheel(1); - Util.waitForIdle(robot); + // mouse wheel doesn't work for the choice on X11 and Mac, so skip it + if (!isXtoolkit && !isLWCToolkit) { + robot.mouseWheel(1); + robot.waitForIdle(); - if(!wheelMoved || !itemChanged) { - throw new RuntimeException("Mouse Wheel over the choice failed!"); - } + if (!wheelMoved || !itemChanged) { + throw new RuntimeException("Mouse Wheel over the choice failed!"); } + } - // Test mouse wheel over the drop-down list - robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); - Util.waitForIdle(robot); - robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); - Util.waitForIdle(robot); + // Test mouse wheel over the drop-down list + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); - int y = getLocationOnScreen().y + getSize().height; - while(!frameExited && y >= 0) { // move to the bottom of drop-down list - robot.mouseMove(x, --y); - Util.waitForIdle(robot); - } + frameExited = false; - if(x < 0) { - throw new RuntimeException("Could not enter drop-down list!"); - } + Rectangle frameBounds = Util.invokeOnEDT(this::getBounds); - y -= choice.getHeight() / 2; - robot.mouseMove(x, y); // move to the last visible item in the drop-down list - Util.waitForIdle(robot); + int y = frameBounds.y + frameBounds.height; + while (!frameExited && y >= frameBounds.y) { // move to the bottom of drop-down list + robot.mouseMove(x, --y); + robot.waitForIdle(); + } - robot.mouseWheel(choice.getItemCount()); // wheel to the last item - Util.waitForIdle(robot); + if (y < frameBounds.y) { + throw new RuntimeException("Could not enter drop-down list!"); + } - // click the last item - itemChanged = false; - robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); - Util.waitForIdle(robot); - robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); - Util.waitForIdle(robot); + y -= choiceBounds.height / 2; + robot.mouseMove(x, y); // move to the last visible item in the drop-down list + robot.waitForIdle(); - if(!itemChanged || choice.getSelectedIndex() != choice.getItemCount() - 1) { - throw new RuntimeException("Mouse Wheel scroll position error!"); - } + int scrollDirection = isLWCToolkit ? -1 : 1; + // wheel to the last item + robot.mouseWheel(scrollDirection * choice.getItemCount()); + robot.waitForIdle(); - dispose(); - } catch (AWTException e) { - throw new RuntimeException("AWTException occurred - problem creating robot!"); + // click the last item + itemChanged = false; + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + if (!itemChanged || choice.getSelectedIndex() != choice.getItemCount() - 1) { + throw new RuntimeException("Mouse Wheel scroll position error!"); } } } - diff --git a/test/jdk/java/awt/Choice/PaintArtefacts.java b/test/jdk/java/awt/Choice/PaintArtefacts.java new file mode 100644 index 000000000000..859525e8c943 --- /dev/null +++ b/test/jdk/java/awt/Choice/PaintArtefacts.java @@ -0,0 +1,122 @@ +/* + * 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 + * 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 6405689 + * @key headful + * @summary Reg: Painting is not happening properly, + * when Choice scrollbar gets disappeared after selected item + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PaintArtefacts +*/ + +import java.awt.Button; +import java.awt.Choice; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +public class PaintArtefacts { + + static boolean removeItems = true; + private static final String INSTRUCTIONS = """ + The problem is seen on XToolkit only. + Open the choice and press down or up key several times + until the scrollbar gets disappeared. + At that moment you may see a painting artefacts on dropdown menu + If you see them, press Fail. + If you don't see them press Add/Remove switch button and + again open the choice and press Up/Down key several times + until Scrollbar gets appeared back. + If you still don't see any painting artefacts press Pass. + """; + + private static Frame init() { + Frame frame = new Frame("Painting Frame"); + Button b = new Button ("Add/Remove switch"); + final Choice ch = new Choice(); + ch.add("Praveen"); + ch.add("Mohan"); + ch.add("Rakesh"); + ch.add("Menon"); + ch.add("Girish"); + ch.add("Ramachandran"); + ch.add("Elancheran"); + ch.add("Subramanian"); + ch.add("Raju"); + ch.add("Pallath"); + ch.add("Mayank"); + ch.add("Joshi"); + ch.add("Sundar"); + ch.add("Srinivas"); + ch.add("Mandalika"); + ch.add("Suresh"); + ch.add("Chandar"); + ch.select(1); + frame.setLayout(new FlowLayout()); + frame.add(ch); + frame.add(b); + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + PassFailJFrame.log(ae.toString()); + PassFailJFrame.log("selected index = " + ch.getSelectedIndex()); + removeItems = !removeItems; + } + }); + ch.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent ie) { + PassFailJFrame.log(ie.toString()); + PassFailJFrame.log("selected index = " + ch.getSelectedIndex()); + if (removeItems) { + PassFailJFrame.log("REMOVE : " + ch.getSelectedIndex()); + ch.remove(ch.getSelectedIndex()); + } else { + PassFailJFrame.log("ADD : "+ch.getSelectedIndex() + "/" + "new item"); + ch.add("new item"); + } + } + }); + frame.setSize(200, 200); + + for (int i = 0; i < 5; i++){ + ch.remove(ch.getSelectedIndex()); + } + + return frame; + } + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(PaintArtefacts::init) + .logArea() + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.java b/test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.java index b7a5cdea0720..220ddbd930c3 100644 --- a/test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.java +++ b/test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.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 @@ -95,6 +95,8 @@ public TestFrame() { pt.y + choice.getHeight()*3/4); // testing that ItemEvent doesn't generated on a simple // mouse click when the dropdown appears under mouse : 6425067 + robot.waitForIdle(); + robot.delay(250); stateChanged = false; openChoice(); closeChoice(); diff --git a/test/jdk/java/awt/Choice/SelectBetweenPressRelease.java b/test/jdk/java/awt/Choice/SelectBetweenPressRelease.java new file mode 100644 index 000000000000..21262c67922f --- /dev/null +++ b/test/jdk/java/awt/Choice/SelectBetweenPressRelease.java @@ -0,0 +1,146 @@ +/* + * 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 + * 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 6318746 + * @key headful + * @summary REG: File Selection is failing for every second selection made in the FileDlg drop-down, XToolkit +*/ + +import java.awt.Choice; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class SelectBetweenPressRelease { + static Frame frame; + static Choice ch; + static Robot r; + static volatile Point loc; + static volatile int selectedIndex; + + public static void main(final String[] args) throws Exception { + r = new Robot(); + try { + EventQueue.invokeAndWait(() -> init()); + r.waitForIdle(); + r.delay(1000); + test(); + } finally { + EventQueue.invokeAndWait(() -> frame.dispose()); + } + } + + private static void init() { + frame = new Frame("SelectBetweenPressRelease"); + ch = new Choice(); + ch.add("0"); + ch.add("1"); + frame.add(ch); + + frame.setLayout (new FlowLayout ()); + + addListener(); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.validate(); + } + + + private static void test() throws Exception { + EventQueue.invokeAndWait(() -> ch.select(0)); + + EventQueue.invokeAndWait(() -> { + loc = ch.getLocationOnScreen(); + }); + r.delay(1000); + r.waitForIdle(); + + r.mouseMove(loc.x+ch.getWidth()/2, loc.y+ch.getHeight()/2); + r.delay(10); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); + r.delay(100); + // This code leads to the bug + EventQueue.invokeAndWait(() -> ch.select(1)); + r.delay(100); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + r.delay(1000); + r.waitForIdle(); + + // 'selected' variable wich stored in the peer still equals 0 + // if the bug is reproducible + // so the next ISC to the first item by mouse will be ignored + + // try to hit the first item + if (System.getProperty("os.name").startsWith("Mac")) { + r.mouseMove(loc.x + ch.getWidth() / 2, loc.y + ch.getHeight() / 2); + } else { + r.mouseMove(loc.x + ch.getWidth() / 2, + loc.y + ch.getHeight() * 3 / 2); + } + r.delay(10); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); + r.delay(100); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + r.delay(1000); + r.waitForIdle(); + + EventQueue.invokeAndWait(() -> { + selectedIndex = ch.getSelectedIndex(); + }); + if (selectedIndex != 0){ + throw new RuntimeException("Test failed. ch.getSelectedIndex() = "+selectedIndex); + } + + } + + // just for logging + private static void addListener(){ + frame.addMouseListener( + new MouseAdapter(){ + public void mousePressed(MouseEvent me){ + System.out.println(me); + } + public void mouseReleased(MouseEvent me){ + System.out.println(me); + } + }); + ch.addMouseListener( + new MouseAdapter(){ + public void mousePressed(MouseEvent me){ + System.out.println(me); + } + public void mouseReleased(MouseEvent me){ + System.out.println(me); + } + }); + } + +} diff --git a/test/jdk/java/awt/Container/ActivateOnFocusTest.java b/test/jdk/java/awt/Container/ActivateOnFocusTest.java new file mode 100644 index 000000000000..ee60f985e989 --- /dev/null +++ b/test/jdk/java/awt/Container/ActivateOnFocusTest.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +/* + * @test + * @bug 4111098 + * @key headful + * @summary Test for no window activation on control requestFocus() + * @run main/timeout=30 ActivateOnFocusTest + */ + +public class ActivateOnFocusTest { + static MyFrame mf1; + static Point p; + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + mf1 = new MyFrame(); + mf1.setBounds(100, 100, 300, 300); + mf1.mc1.requestFocusInWindow(); + }); + + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + p = mf1.mb.getLocationOnScreen(); + }); + + robot.waitForIdle(); + + robot.mouseMove(p.x + 5, p.y + 5); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(250); + + } finally { + if (mf1 != null) { + EventQueue.invokeAndWait(mf1::dispose); + } + } + } +} + +class MyFrame extends Frame implements ActionListener { + public Button mb; + public MyComponent mc1; + public MyComponent mc2; + + public MyFrame() { + super(); + setTitle("ActivateOnFocusTest"); + setLayout(new FlowLayout()); + mb = new Button("Pull"); + mb.addActionListener(this); + add(mb); + mc1 = new MyComponent(Color.red); + add(mc1); + mc2 = new MyComponent(Color.blue); + add(mc2); + addWindowListener(new WindowAdapter() { + @Override + public void windowActivated(WindowEvent e) { + mc1.requestFocusInWindow(); + } + @Override + public void windowDeactivated(WindowEvent e) { + mc2.requestFocusInWindow(); + } + }); + setVisible(true); + } + + public void actionPerformed(ActionEvent e) { + MyFrame mf2 = new MyFrame(); + mf2.setBounds(200, 200, 300, 300); + mf2.setVisible(true); + mf2.mc1.requestFocusInWindow(); + } +} + +class MyComponent extends Component { + public MyComponent(Color c) { + super(); + setBackground(c); + } + + public void paint(Graphics g) { + Dimension d = getSize(); + g.setColor(getBackground()); + g.fillRect(0, 0, d.width, d.height); + } + + public boolean isFocusTraversable() { + return true; + } + + public Dimension getPreferredSize() { + return new Dimension(50, 50); + } +} diff --git a/test/jdk/java/awt/Container/MouseEnteredTest.java b/test/jdk/java/awt/Container/MouseEnteredTest.java new file mode 100644 index 000000000000..3bd5d3e4778e --- /dev/null +++ b/test/jdk/java/awt/Container/MouseEnteredTest.java @@ -0,0 +1,244 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Component; +import java.awt.EventQueue; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import javax.swing.ButtonGroup; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JTextArea; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +/* + * @test + * @bug 4159745 + * @key headful + * @summary Mediumweight popup dragging broken + * @run main MouseEnteredTest + */ + +public class MouseEnteredTest extends JFrame implements ActionListener { + static volatile MouseEnteredTest test; + static volatile Point p; + static volatile Point p2; + + static String strMotif = "Motif"; + static String motifClassName = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; + static char cMotif = 'o'; + + static String strWindows = "Windows"; + static String windowsClassName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; + static char cWindows = 'W'; + + static String strMetal = "Metal"; + static String metalClassName = "javax.swing.plaf.metal.MetalLookAndFeel"; + static char cMetal = 'M'; + + static JMenu m; + static JMenu menu; + + static MouseListener ml = new MouseEnteredTest.MouseEventListener(); + + public MouseEnteredTest() { + setTitle("MouseEnteredTest"); + JPopupMenu.setDefaultLightWeightPopupEnabled(false); + setJMenuBar(getMyMenuBar()); + getContentPane().add("Center", new JTextArea()); + setSize(400, 500); + setLocationRelativeTo(null); + setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + test = new MouseEnteredTest(); + }); + + Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + p = m.getLocationOnScreen(); + p2 = menu.getLocationOnScreen(); + }); + robot.waitForIdle(); + robot.delay(250); + robot.mouseMove(p.x + 5, p.y + 10); + robot.waitForIdle(); + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (int i = p.x; i < p2.x + 10; i = i + 2) { + robot.mouseMove(i, p2.y + 10); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(2000); + + if (m.isPopupMenuVisible()) { + throw new RuntimeException("First menu is showing. Test Failed."); + } + } finally { + if (test != null) { + EventQueue.invokeAndWait(test::dispose); + } + } + } + + public JMenuBar getMyMenuBar() { + JMenuBar menubar; + JMenuItem menuItem; + + menubar = GetLNFMenuBar(); + + menu = menubar.add(new JMenu("Test")); + menu.setName("Test"); + menu.addMouseListener(ml); + menu.setMnemonic('T'); + menuItem = menu.add(new JMenuItem("Menu Item")); + menuItem.addActionListener(this); + menuItem.setMnemonic('M'); + menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.ALT_MASK)); + + JRadioButtonMenuItem mi = new JRadioButtonMenuItem("Radio Button"); + mi.addActionListener(this); + mi.setMnemonic('R'); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.ALT_MASK)); + menu.add(mi); + + JCheckBoxMenuItem mi1 = new JCheckBoxMenuItem("Check Box"); + mi1.addActionListener(this); + mi1.setMnemonic('C'); + mi1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK)); + menu.add(mi1); + return menubar; + } + + public void actionPerformed(ActionEvent e) { + String str = e.getActionCommand(); + if (str.equals(metalClassName) || str.equals(windowsClassName) || str.equals(motifClassName)) { + changeLNF(str); + } else { + System.out.println("ActionEvent: " + str); + } + } + + public void changeLNF(String str) { + System.out.println("Changing LNF to " + str); + try { + UIManager.setLookAndFeel(str); + SwingUtilities.updateComponentTreeUI(this); + pack(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public JMenuBar GetLNFMenuBar() { + JMenuBar mbar = new JMenuBar(); + m = new JMenu("Look and Feel"); + m.setName("Look and Feel"); + m.addMouseListener(ml); + m.setMnemonic('L'); + ButtonGroup bg = new ButtonGroup(); + + JRadioButtonMenuItem mi; + + mi = new JRadioButtonMenuItem(strMetal); + mi.addActionListener(this); + mi.setActionCommand(metalClassName); + mi.setMnemonic(cMetal); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK)); + mi.setSelected(true); + bg.add(mi); + m.add(mi); + + mi = new JRadioButtonMenuItem(strWindows); + mi.addActionListener(this); + mi.setActionCommand(windowsClassName); + mi.setMnemonic(cWindows); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK)); + bg.add(mi); + m.add(mi); + + mi = new JRadioButtonMenuItem(strMotif); + mi.addActionListener(this); + mi.setActionCommand(motifClassName); + mi.setMnemonic(cMotif); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, ActionEvent.ALT_MASK)); + bg.add(mi); + m.add(mi); + + mbar.add(m); + return mbar; + } + + static class MouseEventListener implements MouseListener, MouseMotionListener { + public void mouseClicked(MouseEvent e) { + System.out.println("In mouseClicked for " + e.getComponent().getName()); + } + + public void mousePressed(MouseEvent e) { + Component c = e.getComponent(); + System.out.println("In mousePressed for " + c.getName()); + } + + public void mouseReleased(MouseEvent e) { + System.out.println("In mouseReleased for " + e.getComponent().getName()); + } + + public void mouseEntered(MouseEvent e) { + System.out.println("In mouseEntered for " + e.getComponent().getName()); + System.out.println("MouseEvent:" + e.getComponent()); + } + + public void mouseExited(MouseEvent e) { + System.out.println("In mouseExited for " + e.getComponent().getName()); + } + + public void mouseDragged(MouseEvent e) { + System.out.println("In mouseDragged for " + e.getComponent().getName()); + } + + public void mouseMoved(MouseEvent e) { + System.out.println("In mouseMoved for " + e.getComponent().getName()); + } + } +} diff --git a/test/jdk/java/awt/Container/ValidateTest.java b/test/jdk/java/awt/Container/ValidateTest.java new file mode 100644 index 000000000000..935766094cf7 --- /dev/null +++ b/test/jdk/java/awt/Container/ValidateTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; + +/* + * @test + * @bug 4136190 + * @requires (os.family == "windows") + * @summary Recursive validation calls would cause major USER resource leakage + * @key headful + * @run main/timeout=30 ValidateTest + */ + +public class ValidateTest { + static Frame frame; + + public static void main(String args[]) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + createGUI(); + }); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createGUI() { + frame = new Frame("Test for 4136190 : JVM and win95 resource leakage issues"); + frame.setLayout(new GridLayout(1, 1)); + MyPanel panel = new MyPanel(); + frame.add(panel); + frame.invalidate(); + frame.validate(); + frame.setSize(500, 400); + frame.setVisible(true); + } + + static class MyPanel extends Panel { + int recurseCounter = 0; + + public void validate() { + recurseCounter++; + if (recurseCounter >= 100) { + return; + } + getParent().validate(); + super.validate(); + } + } +} \ No newline at end of file diff --git a/test/jdk/java/awt/Dialog/ClosingParentTest.java b/test/jdk/java/awt/Dialog/ClosingParentTest.java new file mode 100644 index 000000000000..9b2750ab95fa --- /dev/null +++ b/test/jdk/java/awt/Dialog/ClosingParentTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowAdapter; + +/* + * @test + * @bug 4336913 + * @summary On Windows, disable parent window controls while modal dialog is being created. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ClosingParentTest + */ + +public class ClosingParentTest { + + static String instructions = """ + When the test starts, you will see a Frame with a Button + titled 'Show modal dialog with delay'. Press this button + and before the modal Dialog is shown, try to close the + Frame using X button or system menu for windowing systems + which don't provide X button in Window decorations. The + delay before Dialog showing is 5 seconds. + If in test output you see message about WINDOW_CLOSING + being dispatched, then test fails. If no such message + is printed, the test passes. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ClosingParentTest") + .instructions(instructions) + .testTimeOut(5) + .rows(10) + .columns(35) + .testUI(ClosingParentTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame frame = new Frame("Main Frame"); + Dialog dialog = new Dialog(frame, true); + + Button button = new Button("Show modal dialog with delay"); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + try { + Thread.currentThread().sleep(5000); + } catch (InterruptedException x) { + x.printStackTrace(); + } + + dialog.setVisible(true); + } + }); + frame.add(button); + frame.pack(); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.out.println("WINDOW_CLOSING dispatched on the frame"); + } + }); + + dialog.setSize(100, 100); + dialog.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + dialog.dispose(); + } + }); + + return frame; + } +} diff --git a/test/jdk/java/awt/Dialog/DefaultIconTest.java b/test/jdk/java/awt/Dialog/DefaultIconTest.java new file mode 100644 index 000000000000..8d2ec8c406f0 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DefaultIconTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; +import java.awt.Frame; + +/* + * @test + * @bug 4964237 + * @requires (os.family == "windows") + * @summary Win: Changing theme changes java dialogs title icon + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DefaultIconTest + */ + +public class DefaultIconTest { + static String instructions = """ + This test shows frame and two dialogs + Change windows theme. Resizable dialog should retain default icon + Non-resizable dialog should retain no icon + Press PASS if icons look correct, FAIL otherwise + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ShownModalDialogSerializationTest Instructions") + .instructions(instructions) + .testTimeOut(5) + .rows(10) + .columns(35) + .testUI(DefaultIconTest::createGUIs) + .build() + .awaitAndCheck(); + } + + public static Frame createGUIs() { + Frame f = new Frame("DefaultIconTest"); + f.setSize(200, 100); + Dialog d1 = new Dialog(f, "Resizable Dialog, should show default icon"); + d1.setSize(200, 100); + d1.setVisible(true); + d1.setLocation(0, 150); + Dialog d2 = new Dialog(f, "Non-resizable dialog, should have no icon"); + d2.setSize(200, 100); + d2.setVisible(true); + d2.setResizable(false); + d2.setLocation(0, 300); + return f; + } +} diff --git a/test/jdk/java/awt/Dialog/DialogDisposeLeak.java b/test/jdk/java/awt/Dialog/DialogDisposeLeak.java new file mode 100644 index 000000000000..9d581519de36 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogDisposeLeak.java @@ -0,0 +1,200 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTEvent; +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.Toolkit; +import java.awt.event.MouseEvent; +import java.awt.event.FocusEvent; +import java.awt.event.MouseAdapter; + +/* + * @test + * @bug 4193022 + * @summary Test for bug(s): 4193022, disposing dialog leaks memory + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogDisposeLeak + */ + +public class DialogDisposeLeak { + private static final String INSTRUCTIONS = """ + Click on the Dialog... button in the frame that appears. + Now dismiss the dialog by clicking on the label in the dialog. + + Repeat this around 10 times. At some point the label in the frame should change + to indicated that the dialog has been garbage collected and the test passed. + """; + + public static void main(String args[]) throws Exception { + Frame frame = new DisposeFrame(); + PassFailJFrame.builder() + .title("DialogDisposeLeak") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(frame) + .build() + .awaitAndCheck(); + } +} + +class DisposeFrame extends Frame { + Label label = new Label("Test not passed yet"); + + DisposeFrame() { + super("DisposeLeak test"); + setLayout(new FlowLayout()); + Button btn = new Button("Dialog..."); + add(btn); + btn.addActionListener(ev -> { + Dialog dlg = new DisposeDialog(DisposeFrame.this); + dlg.setVisible(true); + } + ); + add(label); + pack(); + } + + public void testOK() { + label.setText("Test has passed. Dialog finalized."); + } +} + +class DisposeDialog extends Dialog { + DisposeDialog(Frame frame) { + super(frame, "DisposeDialog", true); + setLocation(frame.getX(), frame.getY()); + + setLayout(new FlowLayout()); + LightweightComp lw = new LightweightComp("Click here to dispose"); + lw.addMouseListener( + new MouseAdapter() { + public void mouseEntered(MouseEvent ev) { + System.out.println("Entered lw"); + } + + public void mouseExited(MouseEvent ev) { + System.out.println("Exited lw"); + } + + public void mouseReleased(MouseEvent ev) { + System.out.println("Released lw"); + DisposeDialog.this.dispose(); + // try to force GC and finalization + for (int n = 0; n < 100; n++) { + byte[] bytes = new byte[1024 * 1024 * 8]; + System.gc(); + } + } + } + ); + add(lw); + pack(); + } + + public void finalize() { + ((DisposeFrame) getParent()).testOK(); + } +} + +// simple lightweight component, focus traversable, highlights upon focus +class LightweightComp extends Component { + FontMetrics fm; + String label; + private static final int FOCUS_GONE = 0; + private static final int FOCUS_TEMP = 1; + private static final int FOCUS_HAVE = 2; + int focusLevel = FOCUS_GONE; + public static int nameCounter = 0; + + public LightweightComp(String lwLabel) { + label = lwLabel; + enableEvents(AWTEvent.FOCUS_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK); + setName("lw" + nameCounter++); + } + + public Dimension getPreferredSize() { + if (fm == null) fm = Toolkit.getDefaultToolkit().getFontMetrics(getFont()); + return new Dimension(fm.stringWidth(label) + 2, fm.getHeight() + 2); + } + + public void paint(Graphics g) { + Dimension s = getSize(); + + // erase the background + g.setColor(getBackground()); + g.fillRect(0, 0, s.width, s.height); + + g.setColor(getForeground()); + + // draw the string + g.drawString(label, 2, fm.getHeight()); + + // draw a focus rectangle + if (focusLevel > FOCUS_GONE) { + if (focusLevel == FOCUS_TEMP) { + g.setColor(Color.gray); + } else { + g.setColor(Color.blue); + } + } else { + g.setColor(Color.black); + } + g.drawRect(1, 1, s.width - 2, s.height - 2); + } + + public boolean isFocusTraversable() { + return true; + } + + protected void processFocusEvent(FocusEvent e) { + super.processFocusEvent(e); + if (e.getID() == FocusEvent.FOCUS_GAINED) { + focusLevel = FOCUS_HAVE; + } else { + if (e.isTemporary()) { + focusLevel = FOCUS_TEMP; + } else { + focusLevel = FOCUS_GONE; + } + } + repaint(); + } + + protected void processMouseEvent(MouseEvent e) { + if (e.getID() == MouseEvent.MOUSE_PRESSED) { + requestFocus(); + } + super.processMouseEvent(e); + } +} + diff --git a/test/jdk/java/awt/Dialog/DialogInitialResizability.java b/test/jdk/java/awt/Dialog/DialogInitialResizability.java new file mode 100644 index 000000000000..7ecde39c4add --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogInitialResizability.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; + +/* + * @test + * @bug 4912551 + * @summary Checks that with resizable set to false before show() + * dialog can not be resized. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogInitialResizability + */ + +public class DialogInitialResizability { + static String instructions = """ + When this test is run a dialog will display (setResizable Test). + This dialog should not be resizable. + + Additionally ensure that there are NO componentResized events in the log section. + If the above conditions are true, then Press PASS else FAIL. + """; + + private static final Dimension INITIAL_SIZE = new Dimension(400, 150); + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("DialogInitialResizability") + .instructions(instructions) + .testTimeOut(5) + .rows((int) instructions.lines().count() + 2) + .columns(40) + .testUI(DialogInitialResizability::createGUI) + .logArea() + .build() + .awaitAndCheck(); + } + + public static MyDialog createGUI() { + Frame f = new Frame("invisible dialog owner"); + + MyDialog ld = new MyDialog(f); + ld.setBounds(100, 100, INITIAL_SIZE.width, INITIAL_SIZE.height); + ld.setResizable(false); + + PassFailJFrame.log("Dialog isResizable is set to: " + ld.isResizable()); + PassFailJFrame.log("Dialog Initial Size " + ld.getSize()); + return ld; + } + + private static class MyDialog extends Dialog implements ComponentListener { + public MyDialog(Frame f) { + super(f, "setResizable test", false); + this.addComponentListener(this); + } + + public void componentResized(ComponentEvent e) { + if (!e.getComponent().getSize().equals(INITIAL_SIZE)) { + PassFailJFrame.log("Component Resized. Test Failed!!"); + } + } + + public void componentMoved(ComponentEvent e) { + } + + public void componentShown(ComponentEvent e) { + } + + public void componentHidden(ComponentEvent e) { + } + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogEmptyTitleTest.java b/test/jdk/java/awt/Dialog/FileDialogEmptyTitleTest.java new file mode 100644 index 000000000000..d288a7c18f65 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogEmptyTitleTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.FileDialog; +import java.awt.Frame; + +/* + * @test + * @bug 4177831 + * @summary solaris: default FileDialog title is not empty + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogEmptyTitleTest + */ + +public class FileDialogEmptyTitleTest { + static String instructions = """ + Test passes if title of file dialog is empty, + otherwise test failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FileDialogEmptyTitleTest") + .instructions(instructions) + .testTimeOut(5) + .rows(10) + .columns(35) + .testUI(FileDialogEmptyTitleTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static FileDialog createGUI() { + Frame frame = new Frame("invisible dialog owner"); + FileDialog fileDialog = new FileDialog(frame); + return fileDialog; + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogTest.java b/test/jdk/java/awt/Dialog/FileDialogTest.java new file mode 100644 index 000000000000..4ac937d773d8 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogTest.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Container; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4105025 4153487 4177107 4146229 4119383 4181310 4152317 + * @summary Test: FileDialogTest + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogTest + */ + +public class FileDialogTest extends Panel implements ActionListener { + Button buttonShow, buttonNullShow, buttonShowHide, buttonShowDispose; + TextField fieldFile; + TextField fieldDir; + TextField fieldTitle; + private static final String INSTRUCTIONS = """ + 1. Set file, directory, and title fields to some real values + Title will not show on macos dialog + 2. Click the "Get File..." button. + 3. Verify that dialog is set to proper file and directory, and that + title is also set. + 4. Select a file and OK the dialog + (or whatever the selection button is). + 5. Verify that the file and directory fields reflect the file chosen. + 6. Now, click the "Get null File with null Directory..." button. + 7. Verify that the file list matches the listed directory. + 8. Cancel or OK the dialog. + 9. Verify that no NullPointerException is thrown. + 10. Now, click the "Show FileDialog, then hide() in 5 s..." button. + 11. Wait for 5 seconds. The FileDialog should then + disappear automatically. + 12. 12-14 are Windows specific. Set file to some invalid value, + like "/<>++". + 13. Click the "Get File..." button. + 14. Verify that FileDialog is shown with empty "file" field. + 15. Run the test on different locales. Verify that filter string + "All Files" is localized. + """; + + public static void main(String args[]) throws Exception { + Frame frame = new Frame("FileDialogTest"); + frame.setLayout(new GridLayout()); + frame.add(new FileDialogTest()); + frame.pack(); + + PassFailJFrame.builder() + .title("FileDialogTest") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(frame) + .build() + .awaitAndCheck(); + } + + public FileDialogTest() { + setLayout(new GridLayout(6, 2)); + + buttonShow = new Button("Get File..."); + add(buttonShow); + buttonNullShow = new Button("Get null File with null Directory..."); + add(buttonNullShow); + buttonShowHide = new Button("Show FileDialog, then hide() in 5 s..."); + add(buttonShowHide); + buttonShowDispose = + new Button("Show FileDialog, then dispose() in 5 s..."); + add(buttonShowDispose); + + add(new Label("")); + add(new Label("")); + + add(new Label("File:")); + fieldFile = new TextField(20); + add(fieldFile); + + add(new Label("Directory:")); + fieldDir = new TextField(20); + add(fieldDir); + + add(new Label("Title:")); + fieldTitle = new TextField(20); + fieldTitle.setText("TestTitle"); + add(fieldTitle); + + buttonShow.addActionListener(this); + buttonNullShow.addActionListener(this); + buttonShowHide.addActionListener(this); + buttonShowDispose.addActionListener(this); + } + + public void actionPerformed(ActionEvent evt) { + if (evt.getSource() == buttonShow) { + FileDialog fd = new FileDialog(getFrame(), fieldTitle.getText()); + fd.setFile(fieldFile.getText()); + fd.setDirectory(fieldDir.getText()); + fd.show(); + System.out.println("back from show"); + fieldFile.setText(fd.getFile()); + fieldDir.setText(fd.getDirectory()); + fd.dispose(); + } else if (evt.getSource() == buttonNullShow) { + FileDialog fd = new FileDialog(getFrame(), fieldTitle.getText()); + fd.setFile(null); + fd.setDirectory(null); + fd.show(); + System.out.println("back from show"); + fieldFile.setText(fd.getFile()); + fieldDir.setText(fd.getDirectory()); + fd.setFile(null); + fd.setDirectory(null); + fd.dispose(); + } else if (evt.getSource() == buttonShowHide) { + final FileDialog fd = new FileDialog(getFrame(), + fieldTitle.getText()); + fd.setFile(fieldFile.getText()); + fd.setDirectory(fieldDir.getText()); + new Thread(new Runnable() { + public void run() { + try { + Thread.currentThread().sleep(5000); + } catch (InterruptedException ex) { + } + fd.hide(); + } + }).start(); + fd.show(); + System.out.println("back from show"); + fd.dispose(); + } else if (evt.getSource() == buttonShowDispose) { + final FileDialog fd = new FileDialog(getFrame(), + fieldTitle.getText()); + fd.setFile(fieldFile.getText()); + fd.setDirectory(fieldDir.getText()); + new Thread(() -> { + try { + Thread.currentThread().sleep(5000); + } catch (InterruptedException ex) { + } + fd.dispose(); + }).start(); + fd.show(); + System.out.println("back from show"); + fd.dispose(); + } + } + + private Frame getFrame() { + Container cont = getParent(); + while (cont != null) { + if (cont instanceof Frame) { + return (Frame) cont; + } + cont = cont.getParent(); + } + return null; + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java b/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java new file mode 100644 index 000000000000..f97d947991b4 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogUIUpdate.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4859390 + * @requires (os.family == "windows") + * @summary Verify that FileDialog matches the look + of the native windows FileDialog + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogUIUpdate + */ + +public class FileDialogUIUpdate extends Frame { + static String instructions = """ + Click the button to show the FileDialog. Then open the Paint + application (usually found in Program Files->Accessories). + Select File->Open from Paint to display a native Open dialog. + Compare the native dialog to the AWT FileDialog. + Specifically, confirm that the Places Bar icons are along the left side (or + not, if the native dialog doesn't have them), and that the + dialogs are both resizable (or not). + If the file dialogs both look the same press Pass. If not, + press Fail. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FileDialogUIUpdate") + .instructions(instructions) + .testTimeOut(5) + .rows(12) + .columns(35) + .testUI(FileDialogUIUpdate::new) + .build() + .awaitAndCheck(); + } + + public FileDialogUIUpdate() { + final FileDialog fd = new FileDialog(new Frame("FileDialogUIUpdate frame"), + "Open FileDialog"); + Button showButton = new Button("Show FileDialog"); + setLayout(new BorderLayout()); + + fd.setDirectory("c:/"); + showButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + fd.setVisible(true); + } + }); + + add(showButton); + setSize(200, 200); + } +} diff --git a/test/jdk/java/awt/Dialog/MenuAndModalDialogTest.java b/test/jdk/java/awt/Dialog/MenuAndModalDialogTest.java new file mode 100644 index 000000000000..c22116ff8df1 --- /dev/null +++ b/test/jdk/java/awt/Dialog/MenuAndModalDialogTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4070085 + * @summary Java program locks up X server + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuAndModalDialogTest + */ + +public class MenuAndModalDialogTest { + static Frame frame; + static String instructions = """ + 1. Bring up the File Menu and leave it up. + 2. In a few seconds, the modal dialog will appear. + 3. Verify that your system does not lock up when you push the "OK" button. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame pf = PassFailJFrame.builder() + .title("MenuAndModalDialogTest") + .instructions(instructions) + .testTimeOut(5) + .rows(10) + .columns(35) + .testUI(MenuAndModalDialogTest::createFrame) + .build(); + + // Allow time to pop up the menu + try { + Thread.currentThread().sleep(5000); + } catch (InterruptedException exception) { + } + + createDialog(); + pf.awaitAndCheck(); + } + + public static Frame createFrame() { + frame = new Frame("MenuAndModalDialogTest frame"); + + MenuBar menuBar = new MenuBar(); + frame.setMenuBar(menuBar); + + Menu file = new Menu("File"); + menuBar.add(file); + + MenuItem menuItem = new MenuItem("A Menu Entry"); + file.add(menuItem); + + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + return frame; + } + + public static void createDialog() { + Dialog dialog = new Dialog(frame); + + Button button = new Button("OK"); + dialog.add(button); + button.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + dialog.dispose(); + } + } + ); + + dialog.setSize(200, 200); + dialog.setModal(true); + dialog.setVisible(true); + } +} diff --git a/test/jdk/java/awt/Dialog/ModalExcludedTest.java b/test/jdk/java/awt/Dialog/ModalExcludedTest.java new file mode 100644 index 000000000000..2531c26d3bc3 --- /dev/null +++ b/test/jdk/java/awt/Dialog/ModalExcludedTest.java @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.JobAttributes; +import java.awt.PageAttributes; +import java.awt.Panel; +import java.awt.PrintJob; +import java.awt.TextArea; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; + +import sun.awt.SunToolkit; + +/* + * @test + * @bug 4813288 4866704 + * @summary Test for "modal exclusion" functionality + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame + * @modules java.desktop/sun.awt + * @run main/manual ModalExcludedTest + */ + +public class ModalExcludedTest { + private static final String INSTRUCTIONS = """ + 1. Press 'Modal dialog w/o modal excluded' button below + A window, a modeless dialog and a modal dialog will appear + Make sure the frame and the modeless dialog are inaccessible, + i.e. receive no mouse and keyboard events. MousePressed and + KeyPressed events are logged in the text area - use it + to watch events + Close all 3 windows + + 2. Press 'Modal dialog w/ modal excluded' button below + Again, 3 windows will appear (frame, dialog, modal dialog), + but the frame and the dialog would be modal excluded, i.e. + behave the same way as there is no modal dialog shown. Verify + this by pressing mouse buttons and typing any keys. The + RootFrame would be modal blocked - verify this too + Close all 3 windows + + 3. Repeat step 2 for file and print dialogs using appropriate + buttons below + + Notes: if there is no printer installed in the system you may not + get any print dialogs + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ModalExcludedTest") + .instructions(INSTRUCTIONS) + .rows(10) + .columns(35) + .testUI(ModalExcludedTest::createGUIs) + .build() + .awaitAndCheck(); + } + + public static Frame createGUIs() { + final Frame f = new Frame("RootFrame"); + f.setBounds(0, 0, 480, 500); + f.setLayout(new BorderLayout()); + + final TextArea messages = new TextArea(); + + final WindowListener wl = new WindowAdapter() { + public void windowClosing(WindowEvent ev) { + if (ev.getSource() instanceof Window) { + ((Window) ev.getSource()).dispose(); + } + } + }; + final MouseListener ml = new MouseAdapter() { + public void mousePressed(MouseEvent ev) { + messages.append(ev + "\n"); + } + }; + final KeyListener kl = new KeyAdapter() { + public void keyPressed(KeyEvent ev) { + messages.append(ev + "\n"); + } + }; + + if (!SunToolkit.isModalExcludedSupported()) { + throw new jtreg.SkippedException("Modal exclude is not supported on this platform."); + } + + messages.addMouseListener(ml); + messages.addKeyListener(kl); + f.add(messages, BorderLayout.CENTER); + + Panel buttons = new Panel(); + buttons.setLayout(new GridLayout(6, 1)); + + Button b = new Button("Modal dialog w/o modal excluded"); + b.addActionListener(ev -> { + Frame ff = new Frame("Non-modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Non-modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + Dialog d = new Dialog(f, "Modal dialog", true); + d.setBounds(600, 200, 200, 100); + d.addWindowListener(wl); + d.addMouseListener(ml); + d.addKeyListener(kl); + d.setVisible(true); + }); + buttons.add(b); + + Button c = new Button("Modal dialog w/ modal excluded"); + c.addActionListener(ev -> { + JFrame ff = new JFrame("Modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + JMenuBar mb = new JMenuBar(); + JMenu m = new JMenu("Test menu"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + m.add("Test menu item"); + mb.add(m); + ff.setJMenuBar(mb); + // 1: set visible + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + // 2: set modal excluded + SunToolkit.setModalExcluded(ff); + + Dialog d = new Dialog(f, "Modal dialog", true); + d.setBounds(600, 200, 200, 100); + d.addWindowListener(wl); + d.addMouseListener(ml); + d.addKeyListener(kl); + d.setVisible(true); + }); + buttons.add(c); + + Button c1 = new Button("Modal dialog before modal excluded"); + c1.addActionListener(ev -> { + // 1: create dialog + Dialog d = new Dialog(f, "Modal dialog", true); + d.setBounds(600, 200, 200, 100); + d.addWindowListener(wl); + d.addMouseListener(ml); + d.addKeyListener(kl); + + // 2: create frame + Frame ff = new Frame("Modal-excluded frame"); + // 3: set modal excluded + SunToolkit.setModalExcluded(ff); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + // 4: show frame + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + // 5: show dialog + d.setVisible(true); + }); + buttons.add(c1); + + Button d = new Button("File dialog w/ modal excluded"); + d.addActionListener(ev -> { + Frame ff = new Frame("Modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + // 1: set modal excluded (peer is not created yet) + SunToolkit.setModalExcluded(ff); + // 2: set visible + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + SunToolkit.setModalExcluded(dd); + + Dialog d1 = new FileDialog(f, "File dialog"); + d1.setVisible(true); + }); + buttons.add(d); + + Button e = new Button("Native print dialog w/ modal excluded"); + e.addActionListener(ev -> { + Frame ff = new Frame("Modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + ff.setVisible(true); + SunToolkit.setModalExcluded(ff); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + JobAttributes jobAttributes = new JobAttributes(); + jobAttributes.setDialog(JobAttributes.DialogType.NATIVE); + PageAttributes pageAttributes = new PageAttributes(); + PrintJob job = Toolkit.getDefaultToolkit().getPrintJob(f, "Test", jobAttributes, pageAttributes); + }); + buttons.add(e); + + Button g = new Button("Common print dialog w/ modal excluded"); + g.addActionListener(ev -> { + Frame ff = new Frame("Modal-excluded frame"); + ff.setBounds(400, 0, 200, 100); + ff.addWindowListener(wl); + ff.addMouseListener(ml); + ff.addKeyListener(kl); + ff.setVisible(true); + SunToolkit.setModalExcluded(ff); + ff.dispose(); + // modal excluded must still be alive + ff.setVisible(true); + + Dialog dd = new Dialog(ff, "Modal-excluded dialog", false); + dd.setBounds(500, 100, 200, 100); + dd.addWindowListener(wl); + dd.addMouseListener(ml); + dd.addKeyListener(kl); + dd.setVisible(true); + + JobAttributes jobAttributes = new JobAttributes(); + jobAttributes.setDialog(JobAttributes.DialogType.COMMON); + PageAttributes pageAttributes = new PageAttributes(); + PrintJob job = Toolkit.getDefaultToolkit().getPrintJob(f, "Test", jobAttributes, pageAttributes); + }); + buttons.add(g); + + f.add(buttons, BorderLayout.SOUTH); + return f; + } +} diff --git a/test/jdk/java/awt/Dialog/NestedDialogTest.java b/test/jdk/java/awt/Dialog/NestedDialogTest.java new file mode 100644 index 000000000000..28fb1bc919e6 --- /dev/null +++ b/test/jdk/java/awt/Dialog/NestedDialogTest.java @@ -0,0 +1,312 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Choice; +import java.awt.Dialog; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.List; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Vector; +import java.util.Enumeration; + +/* + * @test + * @bug 4110094 4178930 4178390 + * @summary Test: Rewrite of Win modal dialogs + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual NestedDialogTest + */ + +public class NestedDialogTest { + private static Vector windows = new Vector(); + static String instructions = """ + To solve various race conditions, windows modal dialogs were rewritten. This + test exercises various modal dialog boundary conditions and checks that + previous fixes to modality are incorporated in the rewrite. + + Check the following: + - No IllegalMonitorStateException is thrown when a dialog closes + + - Open multiple nested dialogs and verify that all other windows + are disabled when modal dialog is active. + + - Check that the proper window is activated when a modal dialog closes. + + - Close nested dialogs out of order (e.g. close dialog1 before dialog2) + and verify that this works and no deadlock occurs. + + - Check that all other windows are disabled when a FileDialog is open. + + - Check that the proper window is activated when a FileDialog closes. + + - Verify that the active window nevers switches to another application + when closing dialogs, even temporarily. + + - Check that choosing Hide always sucessfully hides a dialog. You should + try this multiple times to catch any race conditions. + + - Check that the scrollbar on the Choice component in the dialog works, as opposed + to just using drag-scrolling or the cursor keys + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("NestedDialogTest") + .instructions(instructions) + .testTimeOut(5) + .rows((int) instructions.lines().count() + 2) + .columns(35) + .testUI(NestedDialogTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame frame1 = new NestedDialogTestFrame("frame0"); + Frame frame2 = new NestedDialogTestFrame("frame1"); + frame2.setLocation(100, 100); + return frame1; + } + + public static void addWindow(Window window) { + // System.out.println("Pushing window " + window); + windows.removeElement(window); + windows.addElement(window); + } + + public static void removeWindow(Window window) { + // System.out.println("Popping window " + window); + windows.removeElement(window); + } + + public static Window getWindow(int index) { + return (Window) windows.elementAt(index); + } + + public static Enumeration enumWindows() { + return windows.elements(); + } + + public static int getWindowIndex(Window win) { + return windows.indexOf(win); + } +} + +class NestedDialogTestFrame extends Frame { + NestedDialogTestFrame(String name) { + super(name); + setSize(200, 200); + show(); + + setLayout(new FlowLayout()); + Button btnDlg = new Button("Dialog..."); + add(btnDlg); + Button btnFileDlg = new Button("FileDialog..."); + add(btnFileDlg); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent ev) { + System.exit(0); + } + }); + + btnDlg.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + Dialog d1 = new SimpleDialog(NestedDialogTestFrame.this, null, true); + System.out.println("Returned from showing dialog: " + d1); + } + } + ); + + btnFileDlg.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + FileDialog dlg = new FileDialog(NestedDialogTestFrame.this); + dlg.show(); + } + } + ); + + validate(); + } + + public void show() { + if (!isVisible()) { + NestedDialogTest.addWindow(this); + } + super.show(); + } + + public void dispose() { + NestedDialogTest.removeWindow(this); + super.dispose(); + } +} + +class SimpleDialog extends Dialog { + Button btnNested; + Button btnFileDlg; + Button btnShow; + Button btnHide; + Button btnDispose; + Button btnExit; + List listWins; + Dialog dlgPrev; + + public SimpleDialog(Frame frame, Dialog prev, boolean isModal) { + super(frame, "", isModal); + + dlgPrev = prev; + + addWindowListener(new WindowAdapter() { + public void windowActivated(WindowEvent ev) { + populateListWin(); + } + }); + + setTitle(getName()); + + Panel panelNorth = new Panel(); + panelNorth.setLayout(new GridLayout(1, 1)); + listWins = new List(); + panelNorth.add(listWins); + + Panel panelSouth = new Panel(); + panelSouth.setLayout(new FlowLayout()); + btnNested = new Button("Dialog..."); + panelSouth.add(btnNested); + btnFileDlg = new Button("FileDialog..."); + panelSouth.add(btnFileDlg); + btnShow = new Button("Show"); + panelSouth.add(btnShow); + btnHide = new Button("Hide"); + panelSouth.add(btnHide); + btnDispose = new Button("Dispose"); + panelSouth.add(btnDispose); + + Choice cbox = new Choice(); + cbox.add("Test1"); + cbox.add("Test2"); + cbox.add("Test3"); + cbox.add("Test4"); + cbox.add("Test5"); + cbox.add("Test6"); + cbox.add("Test7"); + cbox.add("Test8"); + cbox.add("Test9"); + cbox.add("Test10"); + cbox.add("Test11"); + panelSouth.add(cbox); + + validate(); + + add("Center", panelNorth); + add("South", panelSouth); + + btnNested.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Dialog dlg = new SimpleDialog((Frame) getParent(), SimpleDialog.this, true); + System.out.println("Returned from showing dialog: " + dlg); + } + }); + + btnFileDlg.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + FileDialog dlg = new FileDialog((Frame) getParent()); + dlg.show(); + } + }); + + btnHide.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Window wnd = getSelectedWindow(); + System.out.println(wnd); + wnd.hide(); + } + }); + + btnShow.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + getSelectedWindow().show(); + } + }); + + btnDispose.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + getSelectedWindow().dispose(); + populateListWin(); + } + }); + + pack(); + setSize(getSize().width, getSize().height * 2); + if (dlgPrev != null) { + Point pt = dlgPrev.getLocation(); + setLocation(pt.x + 30, pt.y + 50); + } + show(); + } + + private Window getSelectedWindow() { + Window window; + int index = listWins.getSelectedIndex(); + + window = NestedDialogTest.getWindow(index); + return window; + } + + private void populateListWin() { + Enumeration enumWindows = NestedDialogTest.enumWindows(); + + listWins.removeAll(); + while (enumWindows.hasMoreElements()) { + Window win = (Window) enumWindows.nextElement(); + listWins.add(win.getName()); + } + listWins.select(NestedDialogTest.getWindowIndex(this)); + } + + public void show() { + if (!isVisible()) { + NestedDialogTest.addWindow(this); + } + super.show(); + } + + public void dispose() { + NestedDialogTest.removeWindow(this); + super.dispose(); + } +} diff --git a/test/jdk/java/awt/Dialog/ShownModalDialogSerializationTest.java b/test/jdk/java/awt/Dialog/ShownModalDialogSerializationTest.java new file mode 100644 index 000000000000..b57dd2cf8f23 --- /dev/null +++ b/test/jdk/java/awt/Dialog/ShownModalDialogSerializationTest.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Label; + +import java.awt.TextArea; +import java.io.File; +import java.io.FileOutputStream; +import java.io.ObjectOutputStream; + +/* + * @test + * @bug 4739757 + * @summary REGRESSION: Modal Dialog is not serializable after showing + * @key headful + * @run main ShownModalDialogSerializationTest + */ + +public class ShownModalDialogSerializationTest { + static volatile Frame frame; + static volatile Frame outputFrame; + static volatile Dialog dialog; + + public static void main(String[] args) throws Exception { + + EventQueue.invokeLater(ShownModalDialogSerializationTest::createTestUI); + + while (dialog == null || !dialog.isShowing()) { + Thread.sleep(500); + } + File file = new File("dialog.ser"); + FileOutputStream fos = new FileOutputStream(file); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(dialog); + oos.flush(); + file.delete(); + + EventQueue.invokeAndWait(ShownModalDialogSerializationTest::deleteTestUI); + } + + static void deleteTestUI() { + if (dialog != null) { + dialog.setVisible(false); + dialog.dispose(); + } + if (frame != null) { + frame.setVisible(false); + frame.dispose(); + } + if (outputFrame != null) { + outputFrame.setVisible(false); + outputFrame.dispose(); + } + } + + private static void createTestUI() { + outputFrame = new Frame("ShownModalDialogSerializationTest"); + TextArea output = new TextArea(40, 50); + outputFrame.add(output); + + frame = new Frame("invisible dialog owner"); + dialog = new Dialog(frame, "Dialog for Close", true); + dialog.add(new Label("Close This Dialog")); + outputFrame.setSize(200, 200); + outputFrame.setVisible(true); + dialog.pack(); + dialog.setVisible(true); + } +} diff --git a/test/jdk/java/awt/Dialog/TaskbarIconTest.java b/test/jdk/java/awt/Dialog/TaskbarIconTest.java new file mode 100644 index 000000000000..2ced3853a0c0 --- /dev/null +++ b/test/jdk/java/awt/Dialog/TaskbarIconTest.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Dialog; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.awt.print.PageFormat; +import java.awt.print.PrinterJob; + +/* + * @test + * @bug 6488834 + * @requires (os.family == "windows") + * @summary Tests that native dialogs (file, page, print) appear or + don't appear on the windows taskbar depending of their parent + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TaskbarIconTest +*/ + +public class TaskbarIconTest { + private static WindowListener wl = new WindowAdapter() { + public void windowClosing(WindowEvent we) { + Window w = we.getWindow(); + w.dispose(); + Window owner = w.getOwner(); + if (owner != null) { + owner.dispose(); + } + } + }; + + private static ActionListener al = new ActionListener() { + public void actionPerformed(ActionEvent ae) { + Button b = (Button) ae.getSource(); + + String bLabel = b.getLabel(); + boolean hasParent = (bLabel.indexOf("parentless") < 0); + Frame parent = hasParent ? new Frame("Parent") : null; + + if (bLabel.startsWith("Java")) { + Dialog d = new Dialog(parent, "Java dialog", true); + d.setBounds(0, 0, 160, 120); + d.addWindowListener(wl); + d.setVisible(true); + } else if (bLabel.startsWith("File")) { + FileDialog d = new FileDialog(parent, "File dialog"); + d.setVisible(true); + } else if (bLabel.startsWith("Print")) { + PrinterJob pj = PrinterJob.getPrinterJob(); + pj.printDialog(); + } else if (bLabel.startsWith("Page")) { + PrinterJob pj = PrinterJob.getPrinterJob(); + pj.pageDialog(new PageFormat()); + } + } + }; + + private static final String INSTRUCTIONS = """ + When the test starts a frame 'Main' is shown. It contains + several buttons, pressing each of them shows a dialog. + Some of the dialogs have a parent window, others are + parentless, according to the corresponding button's test. + + Press each button one after another. Make sure that all + parentless dialogs have an icon in the windows taskbar + and all the dialogs with parents don't. Press PASS or + FAIL button depending on the result. + + Note: as all the dialogs shown are modal, you have to close + them before showing the next dialog or PASS or FAIL buttons." + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("WindowInputBlock") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(TaskbarIconTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Button b; + + Frame mainFrame = new Frame("Main"); + mainFrame.setBounds(120, 240, 160, 240); + mainFrame.setLayout(new GridLayout(6, 1)); + + b = new Button("Java dialog, with parent"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("Java dialog, parentless"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("File dialog, with parent"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("File dialog, parentless"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("Print dialog, parentless"); + b.addActionListener(al); + mainFrame.add(b); + + b = new Button("Page dialog, parentless"); + b.addActionListener(al); + mainFrame.add(b); + + return mainFrame; + } +} diff --git a/test/jdk/java/awt/Dialog/WindowInputBlock.java b/test/jdk/java/awt/Dialog/WindowInputBlock.java new file mode 100644 index 000000000000..c38e8653ecc8 --- /dev/null +++ b/test/jdk/java/awt/Dialog/WindowInputBlock.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +/* + * @test + * @bug 4124096 + * @summary Modal JDialog is not modal on Solaris + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual WindowInputBlock + */ + +public class WindowInputBlock { + private static final String INSTRUCTIONS = """ + When the Window is up, you see a "Show Modal Dialog" button, a + "Test" button and a TextField. + Verify that the "Test" button is clickable, and the TextField can + receive focus. + + Now, click on "Show Modal Dialog" button to bring up a modal dialog + and verify that both "Test" button and TextField are not accessible. + Close the new dialog window. If the test behaved as described, pass + this test. Otherwise, fail this test. + + """; + + public static void main(String[] argv) throws Exception { + JFrame frame = new ModalDialogTest(); + PassFailJFrame.builder() + .title("WindowInputBlock") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(frame) + .build() + .awaitAndCheck(); + } +} + +class ModalDialogTest extends JFrame implements ActionListener { + JDialog dialog = new JDialog(new JFrame(), "Modal Dialog", true); + + public ModalDialogTest() { + setTitle("Modal Dialog Test"); + JPanel controlPanel = new JPanel(); + JPanel infoPanel = new JPanel(); + JButton showButton = new JButton("Show Modal Dialog"); + JButton testButton = new JButton("Test"); + JTextField textField = new JTextField("Test"); + + getContentPane().setLayout(new BorderLayout()); + infoPanel.setLayout(new GridLayout(0, 1)); + + showButton.setOpaque(true); + showButton.setBackground(Color.yellow); + + testButton.setOpaque(true); + testButton.setBackground(Color.pink); + + controlPanel.add(showButton); + controlPanel.add(testButton); + controlPanel.add(textField); + + infoPanel.add(new JLabel("Click the \"Show Modal Dialog\" button " + + "to display a modal JDialog.")); + infoPanel.add(new JLabel("Click the \"Test\" button to verify " + + "dialog modality.")); + + getContentPane().add(BorderLayout.NORTH, controlPanel); + getContentPane().add(BorderLayout.SOUTH, infoPanel); + dialog.setSize(200, 200); + + showButton.addActionListener(this); + testButton.addActionListener(this); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + } + + public void windowClosed(WindowEvent e) { + System.exit(0); + } + }); + + pack(); + setSize(450, 120); + } + + public void actionPerformed(ActionEvent evt) { + String command = evt.getActionCommand(); + + if (command == "Show Modal Dialog") { + System.out.println("*** Invoking JDialog.show() ***"); + dialog.setLocation(200, 200); + dialog.setVisible(true); + } else if (command == "Test") { + System.out.println("*** Test ***"); + } + } +} diff --git a/test/jdk/java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java b/test/jdk/java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java index 5d1012bd22b3..13b8a1de5111 100644 --- a/test/jdk/java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java +++ b/test/jdk/java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ public class ClearLwQueueBreakTest { JTextField tf1 = new JTextField(" "); JTextField tf2 = new JTextField(" "); JTextField tf3 = new JTextField(" "); - AtomicBoolean typed = new AtomicBoolean(false); + final AtomicBoolean typed = new AtomicBoolean(false); FocusListener listener1; FocusListener listener2; @@ -114,6 +114,7 @@ public void focusGained(FocusEvent e) { f1.setLocationRelativeTo(null); f1.setVisible(true); Util.waitForIdle(robot); + robot.delay(1000); /* * Break the sequence of LW requests in the middle. diff --git a/test/jdk/java/awt/Focus/InitialFocusTest/InitialFocusTest1.java b/test/jdk/java/awt/Focus/InitialFocusTest/InitialFocusTest1.java index 9edbcf8f71c1..602a376655c6 100644 --- a/test/jdk/java/awt/Focus/InitialFocusTest/InitialFocusTest1.java +++ b/test/jdk/java/awt/Focus/InitialFocusTest/InitialFocusTest1.java @@ -22,8 +22,10 @@ */ import java.awt.Button; +import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.Frame; +import java.awt.Robot; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; @@ -39,27 +41,36 @@ public class InitialFocusTest1 extends Frame implements FocusListener { Button button1 = new Button("Button1"); Button button2 = new Button("Button2"); private static volatile Object focused; + private static InitialFocusTest1 app; public static void main(final String[] args) throws Exception { - InitialFocusTest1 app = new InitialFocusTest1(); try { - app.setSize(200, 200); - app.setLocationRelativeTo(null); - app.setLayout(new FlowLayout()); + Robot robot = new Robot(); + EventQueue.invokeAndWait(() -> { + app = new InitialFocusTest1(); + app.setLayout(new FlowLayout()); - app.button1.addFocusListener(app); - app.button2.addFocusListener(app); - app.add(app.button1); - app.add(app.button2); - app.setVisible(true); - app.button2.requestFocus(); + app.button1.addFocusListener(app); + app.button2.addFocusListener(app); + app.add(app.button1); + app.add(app.button2); + + app.setSize(200, 200); + app.setLocationRelativeTo(null); + app.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + EventQueue.invokeAndWait(() -> { + app.button2.requestFocus(); + }); // wait for the very very last focus event - Thread.sleep(10000); + robot.delay(1000); if (app.button2 != focused) { throw new RuntimeException("Wrong focus owner: " + focused); } } finally { - app.dispose(); + EventQueue.invokeAndWait(() -> app.dispose()); } } diff --git a/test/jdk/java/awt/Focus/KeyStrokeTest.java b/test/jdk/java/awt/Focus/KeyStrokeTest.java index 7c462ce8f22d..668bc1216c89 100644 --- a/test/jdk/java/awt/Focus/KeyStrokeTest.java +++ b/test/jdk/java/awt/Focus/KeyStrokeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,9 @@ * @run main KeyStrokeTest */ -import java.awt.BorderLayout; import java.awt.Button; import java.awt.Dialog; +import java.awt.EventQueue; import java.awt.Frame; import java.awt.Robot; import java.awt.TextField; @@ -39,25 +39,53 @@ import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; public class KeyStrokeTest { static boolean keyTyped; static Frame frame; + static Robot robot; + static final CountDownLatch latch = new CountDownLatch(1); public static void main(String[] args) throws Exception { + robot = new Robot(); try { - KeyStrokeTest test = new KeyStrokeTest(); - test.doTest(); - } finally { - if (frame != null) { - frame.dispose(); + EventQueue.invokeAndWait(() -> { + KeyStrokeTest test = new KeyStrokeTest(); + test.initTest(); + }); + robot.waitForIdle(); + robot.delay(1000); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + + robot.delay(1000); + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SPACE); + + robot.delay(1000); + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_A); + try { + latch.await(3, TimeUnit.SECONDS); + } catch (InterruptedException e) {} + if (!keyTyped) { + throw new + RuntimeException("First keystroke after JDialog is closed is lost"); } + System.out.println("Test passed"); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); } } - private static void doTest() throws Exception { - final Object monitor = new Object(); - frame = new Frame(); + private static void initTest() { + frame = new Frame("KeyStrokeTest"); TextField textField = new TextField() { public void transferFocus() { System.err.println("transferFocus()"); @@ -71,6 +99,7 @@ public void actionPerformed(ActionEvent e) { }); dialog.add(btn); dialog.setSize(200, 200); + dialog.setLocationRelativeTo(null); dialog.setVisible(true); } }; @@ -81,38 +110,12 @@ public void keyTyped(KeyEvent e) { if (e.getKeyChar() == 'a') { keyTyped = true; } - - synchronized (monitor) { - monitor.notifyAll(); - } + latch.countDown(); } }); frame.add(textField); frame.setSize(400, 400); + frame.setLocationRelativeTo(null); frame.setVisible(true); - - Robot robot = new Robot(); - robot.waitForIdle(); - robot.delay(1000); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); - - robot.delay(1000); - robot.keyPress(KeyEvent.VK_SPACE); - robot.keyRelease(KeyEvent.VK_SPACE); - - robot.delay(1000); - synchronized (monitor) { - robot.keyPress(KeyEvent.VK_A); - robot.keyRelease(KeyEvent.VK_A); - monitor.wait(3000); - } - - if (!keyTyped) { - throw new RuntimeException("TEST FAILED"); - } - - System.out.println("Test passed"); } - } diff --git a/test/jdk/java/awt/Frame/DisposeTest.java b/test/jdk/java/awt/Frame/DisposeTest.java index 08c0def638e6..ea1b2428f5c0 100644 --- a/test/jdk/java/awt/Frame/DisposeTest.java +++ b/test/jdk/java/awt/Frame/DisposeTest.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 @@ -44,6 +44,7 @@ public class DisposeTest { private static Frame backgroundFrame; private static Frame testedFrame; + private static final int PIXEL_OFFSET = 4; private static final Rectangle backgroundFrameBounds = new Rectangle(100, 100, 200, 200); @@ -74,8 +75,8 @@ private static void test() { BufferedImage bi = robot.createScreenCapture(backgroundFrameBounds); int redPix = Color.RED.getRGB(); - for (int x = 0; x < bi.getWidth(); x++) { - for (int y = 0; y < bi.getHeight(); y++) { + for (int x = PIXEL_OFFSET; x < bi.getWidth() - PIXEL_OFFSET; x++) { + for (int y = PIXEL_OFFSET; y < bi.getHeight() - PIXEL_OFFSET; y++) { if (bi.getRGB(x, y) != redPix) { try { ImageIO.write(bi, "png", diff --git a/test/jdk/java/awt/Frame/FrameSetMinimumSizeTest.java b/test/jdk/java/awt/Frame/FrameSetMinimumSizeTest.java index 929a36e773e4..ff95fd514015 100644 --- a/test/jdk/java/awt/Frame/FrameSetMinimumSizeTest.java +++ b/test/jdk/java/awt/Frame/FrameSetMinimumSizeTest.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 @@ -24,6 +24,7 @@ import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Frame; +import java.awt.Robot; /* * @test @@ -35,57 +36,65 @@ public class FrameSetMinimumSizeTest { private static Frame f; - private static volatile boolean passed; - + private static Robot robot; public static void main(String[] args) throws Exception { - EventQueue.invokeAndWait(() -> { - try { - createAndShowUI(); - - f.setSize(200, 200); - passed = verifyFrameSize(new Dimension(300, 300)); - isFrameSizeOk(passed); + robot = new Robot(); + try { + EventQueue.invokeAndWait(FrameSetMinimumSizeTest::createAndShowUI); + robot.waitForIdle(); + robot.delay(500); - f.setSize(200, 400); - passed = verifyFrameSize(new Dimension(300, 400)); - isFrameSizeOk(passed); + test( + new Dimension(200, 200), + new Dimension(300, 300) + ); - f.setSize(400, 200); - passed = verifyFrameSize(new Dimension(400, 300)); - isFrameSizeOk(passed); + test( + new Dimension(200, 400), + new Dimension(300, 400) + ); - f.setMinimumSize(null); + test( + new Dimension(400, 200), + new Dimension(400, 300) + ); - f.setSize(200, 200); - passed = verifyFrameSize(new Dimension(200, 200)); - isFrameSizeOk(passed); - } finally { + EventQueue.invokeAndWait(() -> f.setMinimumSize(null)); + test( + new Dimension(200, 200), + new Dimension(200, 200) + ); + } finally { + EventQueue.invokeAndWait(() -> { if (f != null) { f.dispose(); } - } - }); + }); + } + } + + private static void test(Dimension size, Dimension expected) throws Exception { + robot.waitForIdle(); + robot.delay(250); + EventQueue.invokeAndWait(() -> f.setSize(size)); + robot.waitForIdle(); + EventQueue.invokeAndWait(() -> verifyFrameSize(expected)); } private static void createAndShowUI() { f = new Frame("Minimum Size Test"); f.setSize(300, 300); f.setMinimumSize(new Dimension(300, 300)); + f.setLocationRelativeTo(null); f.setVisible(true); } - private static boolean verifyFrameSize(Dimension expected) { - + private static void verifyFrameSize(Dimension expected) { if (f.getSize().width != expected.width || f.getSize().height != expected.height) { - return false; - } - return true; - } - - private static void isFrameSizeOk(boolean passed) { - if (!passed) { - throw new RuntimeException("Frame's setMinimumSize not honoured for the" + - " frame size: " + f.getSize()); + String message = + "Frame's setMinimumSize not honoured for the frame size: %s. Expected %s" + .formatted(f.getSize(), expected); + throw new RuntimeException(message); } } } diff --git a/test/jdk/java/awt/Frame/FrameVisualTest.java b/test/jdk/java/awt/Frame/FrameVisualTest.java index 767eb0a18965..39853822c446 100644 --- a/test/jdk/java/awt/Frame/FrameVisualTest.java +++ b/test/jdk/java/awt/Frame/FrameVisualTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,62 +46,71 @@ public class FrameVisualTest { private static GraphicsConfiguration[] gcs; private static volatile Frame[] frames; - private static volatile int index; - private static Frame f; private static Robot robot; + private static volatile int frameNum; private static volatile Point p; private static volatile Dimension d; private static final int TOLERANCE = 5; + private static final int MAX_FRAME_COUNT = 30; public static void main(String[] args) throws Exception { - gcs = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getConfigurations(); + gcs = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice().getConfigurations(); robot = new Robot(); robot.setAutoDelay(100); - try { - EventQueue.invokeAndWait(() -> { - createAndShowUI(); - }); - robot.delay(1000); - System.out.println("frames.length: "+frames.length); - for (index = 0; index < frames.length; index++) { + + // Limit the number of frames tested if needed + if (gcs.length > MAX_FRAME_COUNT) { + frames = new Frame[MAX_FRAME_COUNT]; + } else { + frames = new Frame[gcs.length]; + } + System.out.println(gcs.length + " gcs found. Testing " + + frames.length + " frame(s)."); + + for (frameNum = 0; frameNum < frames.length; frameNum++) { + try { + EventQueue.invokeAndWait(() -> { + frames[frameNum] = new Frame("Frame w/ gc " + + frameNum, gcs[frameNum]); + frames[frameNum].setSize(100, 100); + frames[frameNum].setUndecorated(true); + frames[frameNum].setBackground(Color.WHITE); + frames[frameNum].setVisible(true); + System.out.println("Frame " + frameNum + " created"); + }); + + robot.delay(1000); + EventQueue.invokeAndWait(() -> { - p = frames[index].getLocation(); - d = frames[index].getSize(); + p = frames[frameNum].getLocation(); + d = frames[frameNum].getSize(); }); + Rectangle rect = new Rectangle(p, d); BufferedImage img = robot.createScreenCapture(rect); if (chkImgBackgroundColor(img)) { try { - ImageIO.write(img, "png", new File("Frame_" + index + ".png")); + ImageIO.write(img, "png", + new File("Frame_" + + frameNum + ".png")); } catch (IOException ignored) {} - throw new RuntimeException("Frame visual test failed with non-white background color"); + throw new RuntimeException("Frame visual test " + + "failed with non-white background color"); } - } - } finally { - for (index = 0; index < frames.length; index++) { + } finally { EventQueue.invokeAndWait(() -> { - if (frames[index] != null) { - frames[index].dispose(); + if (frames[frameNum] != null) { + frames[frameNum].dispose(); + System.out.println("Frame " + frameNum + " disposed"); } }); } } } - private static void createAndShowUI() { - frames = new Frame[gcs.length]; - for (int i = 0; i < frames.length; i++) { - frames[i] = new Frame("Frame w/ gc " + i, gcs[i]); - frames[i].setSize(100, 100); - frames[i].setUndecorated(true); - frames[i].setBackground(Color.WHITE); - frames[i].setVisible(true); - } - } - private static boolean chkImgBackgroundColor(BufferedImage img) { - // scan for mid-line and if it is non-white color then return true. for (int x = 1; x < img.getWidth() - 1; ++x) { Color c = new Color(img.getRGB(x, img.getHeight() / 2)); diff --git a/test/jdk/java/awt/Frame/MultiScreenTest.java b/test/jdk/java/awt/Frame/MultiScreenTest.java index 845f601138b7..cbd781f94ddd 100644 --- a/test/jdk/java/awt/Frame/MultiScreenTest.java +++ b/test/jdk/java/awt/Frame/MultiScreenTest.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 @@ -43,6 +43,7 @@ import java.awt.RenderingHints; import java.awt.TextField; +import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -74,7 +75,7 @@ public static void main(String[] args) throws Exception { ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); gs = ge.getScreenDevices(); if (gs.length < 2) { - throw new SkippedException("You have only one monitor in your system - test passed"); + throw new SkippedException("You have only one monitor in your system"); } MultiScreenTest obj = new MultiScreenTest(); String INSTRUCTIONS = @@ -82,38 +83,42 @@ public static void main(String[] args) throws Exception { "You have " + gs.length + " monitors in your system.\n" + "Actively drag the DitherTest frames on the secondary screen and " + "if you see garbage appearing on your primary screen " + - "test failed otherwise it passed.";; + "test failed otherwise it passed."; PassFailJFrame.builder() - .title("MultiScreenTest Instruction") .instructions(INSTRUCTIONS) - .rows((int) INSTRUCTIONS.lines().count() + 2) .columns(40) .testUI(obj::init) + .positionTestUI(MultiScreenTest::positionTestWindows) .build() .awaitAndCheck(); } + private static void positionTestWindows(List windows, PassFailJFrame.InstructionUI instructionUI) { + // Do nothing - the location of each window is set when they're created + } + public List init() { List list = new ArrayList<>(); for (int j = 0; j < gs.length; j++) { GraphicsConfiguration[] gc = gs[j].getConfigurations(); if (gc.length > 0) { - for (int i = 0; i < gc.length / 2; i++) { - JFrame f = new JFrame(gc[i]); //test JFrame( gc ) - GCCanvas c = new GCCanvas(gc[i]);//test canvas( gc ) - Rectangle gcBounds = gc[i].getBounds(); //test getBounds() + for (int i = 0; i < gc.length && i < 10; i++) { + JFrame f = new JFrame(gc[i]); + GCCanvas c = new GCCanvas(gc[i]); + Rectangle gcBounds = gc[i].getBounds(); int xoffs = gcBounds.x; int yoffs = gcBounds.y; f.getContentPane().add(c); - f.setTitle("Screen# " + Integer.toString(j) + ", GC#" + Integer.toString(i)); + f.setTitle("Screen# " + j + ", GC#" + i); f.setSize(300, 200); - f.setLocation(400 + xoffs, (i * 150) + yoffs);//test displaying in right location + // test displaying in right location + f.setLocation(400 + xoffs, (i * 150) + yoffs); list.add(f); - Frame ditherfs = new Frame("DitherTest GC#" + Integer.toString(i), gc[i]); - ditherfs.setLayout(new BorderLayout()); //showDitherTest + Frame ditherfs = new Frame("DitherTest GC#" + i, gc[i]); + ditherfs.setLayout(new BorderLayout()); DitherTest ditherTest = new DitherTest(gc[i]); ditherfs.add("Center", ditherTest); ditherfs.setBounds(300, 200, 300, 200); @@ -126,360 +131,368 @@ public List init() { } return list; } -} - -class GCCanvas extends Canvas { - - GraphicsConfiguration gc; - Rectangle bounds; - Graphics g = this.getGraphics(); - Dimension size = getSize(); - - public GCCanvas(GraphicsConfiguration gc) { - super(gc); - this.gc = gc; - bounds = gc.getBounds(); - } - - public void paint( Graphics _g ) { - Graphics2D g = (Graphics2D) _g; - g.drawRect(0, 0, size.width-1, size.height-1); - g.setColor(Color.lightGray); - g.draw3DRect(1, 1, size.width-3, size.height-3, true); + static class GCCanvas extends Canvas { - g.setColor(Color.red); - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + GraphicsConfiguration gc; + Rectangle bounds; + Dimension size = getSize(); - g.drawString("HELLO!", 110, 10); + public GCCanvas(GraphicsConfiguration gc) { + super(gc); + this.gc = gc; + bounds = gc.getBounds(); + } - g.setColor(Color.blue); - g.drawString("ScreenSize="+Integer.toString(bounds.width)+"X"+ - Integer.toString(bounds.height), 10, 20); - g.setColor(Color.green); - g.drawString(gc.toString(), 10, 30); - g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + @Override + public void paint( Graphics _g ) { - g.setColor(Color.orange); - g.fillRect(40, 20, 50, 50); + Graphics2D g = (Graphics2D) _g; - g.setColor(Color.red); - g.drawRect(100, 20, 30, 30); + g.drawRect(0, 0, size.width-1, size.height-1); + g.setColor(Color.lightGray); + g.draw3DRect(1, 1, size.width-3, size.height-3, true); - g.setColor(Color.gray); - g.drawLine(220, 20, 280, 40); + g.setColor(Color.red); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g.setColor(Color.cyan); - g.fillArc(150, 30, 30, 30, 0, 200); - } + g.drawString("HELLO!", 110, 10); - public Dimension getPreferredSize(){ - return new Dimension(300, 200); - } -} + g.setColor(Color.blue); + g.drawString("ScreenSize="+Integer.toString(bounds.width)+"X"+ + Integer.toString(bounds.height), 10, 20); + g.setColor(Color.green); + g.drawString(gc.toString(), 10, 30); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); -class DitherCanvas extends Canvas { - Image img; - static String calcString = "Calculating..."; + g.setColor(Color.orange); + g.fillRect(40, 20, 50, 50); - GraphicsConfiguration mGC; + g.setColor(Color.red); + g.drawRect(100, 20, 30, 30); - public DitherCanvas(GraphicsConfiguration gc) { - super(gc); - mGC = gc; - } + g.setColor(Color.gray); + g.drawLine(220, 20, 280, 40); - public GraphicsConfiguration getGraphicsConfig() { - return mGC; - } + g.setColor(Color.cyan); + g.fillArc(150, 30, 30, 30, 0, 200); + } - public void paint(Graphics g) { - int w = getSize().width; - int h = getSize().height; - if (img == null) { - super.paint(g); - g.setColor(Color.black); - FontMetrics fm = g.getFontMetrics(); - int x = (w - fm.stringWidth(calcString)) / 2; - int y = h / 2; - g.drawString(calcString, x, y); - } else { - g.drawImage(img, 0, 0, w, h, this); + @Override + public Dimension getPreferredSize(){ + return new Dimension(300, 200); } } - public void update(Graphics g) { - paint(g); - } + static class DitherCanvas extends Canvas { + Image img; + static String calcString = "Calculating..."; - public Dimension getMinimumSize() { - return new Dimension(20, 20); - } + GraphicsConfiguration mGC; - public Dimension getPreferredSize() { - return new Dimension(200, 200); - } + public DitherCanvas(GraphicsConfiguration gc) { + super(gc); + mGC = gc; + } - public Image getImage() { - return img; - } + public GraphicsConfiguration getGraphicsConfig() { + return mGC; + } - public void setImage(Image img) { - this.img = img; - paint(getGraphics()); - } -} + @Override + public void paint(Graphics g) { + int w = getSize().width; + int h = getSize().height; + if (img == null) { + super.paint(g); + g.setColor(Color.black); + FontMetrics fm = g.getFontMetrics(); + int x = (w - fm.stringWidth(calcString)) / 2; + int y = h / 2; + g.drawString(calcString, x, y); + } else { + g.drawImage(img, 0, 0, w, h, this); + } + } -class DitherTest extends Panel implements Runnable { - final static int NOOP = 0; - final static int RED = 1; - final static int GREEN = 2; - final static int BLUE = 3; - final static int ALPHA = 4; - final static int SATURATION = 5; - - Thread runner; - - DitherControls XControls; - DitherControls YControls; - DitherCanvas canvas; - - public DitherTest(GraphicsConfiguration gc) { - String xspec, yspec; - int xvals[] = new int[2]; - int yvals[] = new int[2]; - - xspec = "red"; - yspec = "blue"; - int xmethod = colormethod(xspec, xvals); - int ymethod = colormethod(yspec, yvals); - - setLayout(new BorderLayout()); - XControls = new DitherControls(this, xvals[0], xvals[1], - xmethod, false); - YControls = new DitherControls(this, yvals[0], yvals[1], - ymethod, true); - YControls.addRenderButton(); - add("North", XControls); - add("South", YControls); - add("Center", canvas = new DitherCanvas(gc)); - } + @Override + public void update(Graphics g) { + paint(g); + } - public void start() { - runner = new Thread(this); - runner.start(); - } + @Override + public Dimension getMinimumSize() { + return new Dimension(20, 20); + } - int colormethod(String s, int vals[]) { - int method = NOOP; + @Override + public Dimension getPreferredSize() { + return new Dimension(200, 200); + } - if (s == null) { - s = ""; + public Image getImage() { + return img; } - String lower = s.toLowerCase(); - int len = 0; - if (lower.startsWith("red")) { - method = RED; - lower = lower.substring(3); - } else if (lower.startsWith("green")) { - method = GREEN; - lower = lower.substring(5); - } else if (lower.startsWith("blue")) { - method = BLUE; - lower = lower.substring(4); - } else if (lower.startsWith("alpha")) { - method = ALPHA; - lower = lower.substring(4); - } else if (lower.startsWith("saturation")) { - method = SATURATION; - lower = lower.substring(10); + public void setImage(Image img) { + this.img = img; + paint(getGraphics()); } + } - if (method == NOOP) { - vals[0] = 0; - vals[1] = 0; - return method; + static class DitherTest extends Panel implements Runnable { + final static int NOOP = 0; + final static int RED = 1; + final static int GREEN = 2; + final static int BLUE = 3; + final static int ALPHA = 4; + final static int SATURATION = 5; + + Thread runner; + + DitherControls XControls; + DitherControls YControls; + DitherCanvas canvas; + + public DitherTest(GraphicsConfiguration gc) { + String xspec, yspec; + int xvals[] = new int[2]; + int yvals[] = new int[2]; + + xspec = "red"; + yspec = "blue"; + int xmethod = colormethod(xspec, xvals); + int ymethod = colormethod(yspec, yvals); + + setLayout(new BorderLayout()); + XControls = new DitherControls(this, xvals[0], xvals[1], + xmethod, false); + YControls = new DitherControls(this, yvals[0], yvals[1], + ymethod, true); + YControls.addRenderButton(); + add("North", XControls); + add("South", YControls); + add("Center", canvas = new DitherCanvas(gc)); } - int begval = 0; - int endval = 255; + public void start() { + runner = new Thread(this); + runner.start(); + } - try { - int dash = lower.indexOf('-'); - if (dash < 0) { - begval = endval = Integer.parseInt(lower); - } else { - begval = Integer.parseInt(lower.substring(0, dash)); - endval = Integer.parseInt(lower.substring(dash + 1)); + int colormethod(String s, int vals[]) { + int method = NOOP; + + if (s == null) { + s = ""; } - } catch (Exception e) { - } - if (begval < 0) { - begval = 0; - } - if (endval < 0) { - endval = 0; - } - if (begval > 255) { - begval = 255; - } - if (endval > 255) { - endval = 255; - } + String lower = s.toLowerCase(); + int len = 0; + if (lower.startsWith("red")) { + method = RED; + lower = lower.substring(3); + } else if (lower.startsWith("green")) { + method = GREEN; + lower = lower.substring(5); + } else if (lower.startsWith("blue")) { + method = BLUE; + lower = lower.substring(4); + } else if (lower.startsWith("alpha")) { + method = ALPHA; + lower = lower.substring(4); + } else if (lower.startsWith("saturation")) { + method = SATURATION; + lower = lower.substring(10); + } - vals[0] = begval; - vals[1] = endval; + if (method == NOOP) { + vals[0] = 0; + vals[1] = 0; + return method; + } - return method; - } + int begval = 0; + int endval = 255; - void applymethod(int c[], int method, int step, int total, int vals[]) { - if (method == NOOP) - return; - int val = ((total < 2) - ? vals[0] - : vals[0] + ((vals[1] - vals[0]) * step / (total - 1))); - switch (method) { - case RED: - c[0] = val; - break; - case GREEN: - c[1] = val; - break; - case BLUE: - c[2] = val; - break; - case ALPHA: - c[3] = val; - break; - case SATURATION: - int max = Math.max(Math.max(c[0], c[1]), c[2]); - int min = max * (255 - val) / 255; - if (c[0] == 0) { - c[0] = min; - } - if (c[1] == 0) { - c[1] = min; - } - if (c[2] == 0) { - c[2] = min; + try { + int dash = lower.indexOf('-'); + if (dash < 0) { + begval = endval = Integer.parseInt(lower); + } else { + begval = Integer.parseInt(lower.substring(0, dash)); + endval = Integer.parseInt(lower.substring(dash + 1)); } - break; + } catch (Exception e) { + } + + if (begval < 0) { + begval = 0; + } + if (endval < 0) { + endval = 0; + } + if (begval > 255) { + begval = 255; + } + if (endval > 255) { + endval = 255; + } + + vals[0] = begval; + vals[1] = endval; + + return method; } - } - public void run() { - canvas.setImage(null); // Wipe previous image - Image img = calculateImage(); - synchronized (this) { - if (img != null && runner == Thread.currentThread()) { - canvas.setImage(img); + void applymethod(int c[], int method, int step, int total, int vals[]) { + if (method == NOOP) + return; + int val = ((total < 2) + ? vals[0] + : vals[0] + ((vals[1] - vals[0]) * step / (total - 1))); + switch (method) { + case RED: + c[0] = val; + break; + case GREEN: + c[1] = val; + break; + case BLUE: + c[2] = val; + break; + case ALPHA: + c[3] = val; + break; + case SATURATION: + int max = Math.max(Math.max(c[0], c[1]), c[2]); + int min = max * (255 - val) / 255; + if (c[0] == 0) { + c[0] = min; + } + if (c[1] == 0) { + c[1] = min; + } + if (c[2] == 0) { + c[2] = min; + } + break; } } - } - /** - * Calculates and returns the image. Halts the calculation and returns - * null if stopped during the calculation. - */ - Image calculateImage() { - Thread me = Thread.currentThread(); - - int width = canvas.getSize().width; - int height = canvas.getSize().height; - int xvals[] = new int[2]; - int yvals[] = new int[2]; - int xmethod = XControls.getParams(xvals); - int ymethod = YControls.getParams(yvals); - int pixels[] = new int[width * height]; - int c[] = new int[4]; - int index = 0; - - for (int j = 0; j < height; j++) { - for (int i = 0; i < width; i++) { - c[0] = c[1] = c[2] = 0; - c[3] = 255; - if (xmethod < ymethod) { - applymethod(c, xmethod, i, width, xvals); - applymethod(c, ymethod, j, height, yvals); - } else { - applymethod(c, ymethod, j, height, yvals); - applymethod(c, xmethod, i, width, xvals); + @Override + public void run() { + canvas.setImage(null); // Wipe previous image + Image img = calculateImage(); + synchronized (this) { + if (img != null && runner == Thread.currentThread()) { + canvas.setImage(img); } - pixels[index++] = ((c[3] << 24) | - (c[0] << 16) | - (c[1] << 8) | - (c[2] << 0)); - - } - // Poll once per row to see if we've been told to stop. - if (runner != me) { - return null; } } - return createImage(new MemoryImageSource(width, height, - ColorModel.getRGBdefault(), pixels, 0, width)); - } + /** + * Calculates and returns the image. Halts the calculation and returns + * null if stopped during the calculation. + */ + Image calculateImage() { + Thread me = Thread.currentThread(); + + int width = canvas.getSize().width; + int height = canvas.getSize().height; + int xvals[] = new int[2]; + int yvals[] = new int[2]; + int xmethod = XControls.getParams(xvals); + int ymethod = YControls.getParams(yvals); + int pixels[] = new int[width * height]; + int c[] = new int[4]; + int index = 0; + + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + c[0] = c[1] = c[2] = 0; + c[3] = 255; + if (xmethod < ymethod) { + applymethod(c, xmethod, i, width, xvals); + applymethod(c, ymethod, j, height, yvals); + } else { + applymethod(c, ymethod, j, height, yvals); + applymethod(c, xmethod, i, width, xvals); + } + pixels[index++] = ((c[3] << 24) | + (c[0] << 16) | + (c[1] << 8) | + (c[2] << 0)); - public String getInfo() { - return "An interactive demonstration of dithering."; - } + } + // Poll once per row to see if we've been told to stop. + if (runner != me) { + return null; + } + } - public String[][] getParameterInfo() { - String[][] info = { - {"xaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", - "The color of the Y axis. Default is RED."}, - {"yaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", - "The color of the X axis. Default is BLUE."} - }; - return info; - } -} + return createImage(new MemoryImageSource(width, height, + ColorModel.getRGBdefault(), pixels, 0, width)); + } -class DitherControls extends Panel implements ActionListener { - TextField start; - TextField end; - Button button; - Choice choice; - DitherTest dt; - - static LayoutManager dcLayout = new FlowLayout(FlowLayout.CENTER, 10, 5); - - public DitherControls(DitherTest app, int s, int e, int type, - boolean vertical) { - dt = app; - setLayout(dcLayout); - add(new Label(vertical ? "Vertical" : "Horizontal")); - add(choice = new Choice()); - choice.addItem("Noop"); - choice.addItem("Red"); - choice.addItem("Green"); - choice.addItem("Blue"); - choice.addItem("Alpha"); - choice.addItem("Saturation"); - choice.select(type); - add(start = new TextField(Integer.toString(s), 4)); - add(end = new TextField(Integer.toString(e), 4)); - } + public String getInfo() { + return "An interactive demonstration of dithering."; + } - public void addRenderButton() { - add(button = new Button("New Image")); - button.addActionListener(this); + public String[][] getParameterInfo() { + String[][] info = { + {"xaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", + "The color of the Y axis. Default is RED."}, + {"yaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", + "The color of the X axis. Default is BLUE."} + }; + return info; + } } - public int getParams(int vals[]) { - vals[0] = Integer.parseInt(start.getText()); - vals[1] = Integer.parseInt(end.getText()); - return choice.getSelectedIndex(); - } + static class DitherControls extends Panel implements ActionListener { + TextField start; + TextField end; + Button button; + Choice choice; + DitherTest dt; + + static LayoutManager dcLayout = new FlowLayout(FlowLayout.CENTER, 10, 5); + + public DitherControls(DitherTest app, int s, int e, int type, + boolean vertical) { + dt = app; + setLayout(dcLayout); + add(new Label(vertical ? "Vertical" : "Horizontal")); + add(choice = new Choice()); + choice.addItem("Noop"); + choice.addItem("Red"); + choice.addItem("Green"); + choice.addItem("Blue"); + choice.addItem("Alpha"); + choice.addItem("Saturation"); + choice.select(type); + add(start = new TextField(Integer.toString(s), 4)); + add(end = new TextField(Integer.toString(e), 4)); + } - public void actionPerformed(ActionEvent e) { - if (e.getSource() == button) { - dt.start(); + public void addRenderButton() { + add(button = new Button("New Image")); + button.addActionListener(this); + } + + public int getParams(int vals[]) { + vals[0] = Integer.parseInt(start.getText()); + vals[1] = Integer.parseInt(end.getText()); + return choice.getSelectedIndex(); + } + + @Override + public void actionPerformed(ActionEvent e) { + if (e.getSource() == button) { + dt.start(); + } } } } diff --git a/test/jdk/java/awt/FullScreen/DisplayModeNoRefreshTest.java b/test/jdk/java/awt/FullScreen/DisplayModeNoRefreshTest.java new file mode 100644 index 000000000000..a52990371221 --- /dev/null +++ b/test/jdk/java/awt/FullScreen/DisplayModeNoRefreshTest.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 5041225 + * @key headful + * @summary Tests that we can set a display mode with unknown refresh rate + * if corresponding system display mode (with equal w/h/d) is available. + * @run main DisplayModeNoRefreshTest + */ + +import java.awt.Color; +import java.awt.DisplayMode; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; + +public class DisplayModeNoRefreshTest extends Frame { + + private static DisplayModeNoRefreshTest fs; + + private static final GraphicsDevice gd = + GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice(); + + private static final DisplayMode origMode = gd.getDisplayMode(); + + public DisplayModeNoRefreshTest() { + super("DisplayModeNoRefreshTest"); + if (!gd.isFullScreenSupported()) { + System.out.println("Full Screen is not supported, test considered passed."); + return; + } + setBackground(Color.green); + gd.setFullScreenWindow(this); + DisplayMode dlMode = getNoRefreshDisplayMode(gd.getDisplayModes()); + if (dlMode != null) { + System.out.println("Selected Display Mode: " + + " Width " + dlMode.getWidth() + + " Height " + dlMode.getHeight() + + " BitDepth " + dlMode.getBitDepth() + + " Refresh Rate " + dlMode.getRefreshRate()); + try { + gd.setDisplayMode(dlMode); + } catch (IllegalArgumentException ex) { + throw new RuntimeException("Test Failed due to IAE", ex); + } + } else { + System.out.println("No suitable display mode available, test considered passed."); + return; + } + + try { Thread.sleep(2000); } catch (InterruptedException e) {} + + System.out.println("Test Passed."); + } + + public DisplayMode getNoRefreshDisplayMode(DisplayMode dm[]) { + DisplayMode mode = new DisplayMode(640, 480, 32, DisplayMode.REFRESH_RATE_UNKNOWN); + int i = 0; + for (i = 0; i < dm.length; i++) { + if (mode.getWidth() == dm[i].getWidth() + && mode.getHeight() == dm[i].getHeight() + && mode.getBitDepth() == dm[i].getBitDepth()) { + return mode; + } + } + if (dm.length > 0) { + return + new DisplayMode(dm[0].getWidth(), dm[0].getHeight(), + dm[0].getBitDepth(), + DisplayMode.REFRESH_RATE_UNKNOWN); + } + + return null; + } + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + System.setProperty("sun.java2d.noddraw", "true"); + fs = new DisplayModeNoRefreshTest(); + }); + } finally { + gd.setDisplayMode(origMode); + EventQueue.invokeAndWait(() -> { + if (fs != null) { + fs.dispose(); + } + }); + } + } +} diff --git a/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java b/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java index 8d218d9f1891..27a1a3a868a9 100644 --- a/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java +++ b/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,17 +26,75 @@ * @key headful * @bug 6430601 8198613 * @summary Verifies that copyArea() works properly when the - * destination parameters are outside the destination bounds. + * destination parameters are outside the destination bounds. * @run main/othervm CopyAreaOOB - * @author campbelc */ -import java.awt.*; -import java.awt.image.*; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.awt.image.MultiResolutionImage; +import java.awt.image.RenderedImage; +import java.io.File; +import java.io.IOException; +import java.util.List; + +import javax.imageio.ImageIO; public class CopyAreaOOB extends Canvas { + private static Frame frame; + private static Robot robot; + private static BufferedImage captureImg; - private static Robot robot = null; + private static StringBuffer errorLog = new StringBuffer(); + + private static final Point OFF_FRAME_LOC = new Point(50, 50); + private static final int SIZE = 400; + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + + // added to move mouse pointer away from test UI + // so that it is not captured in the screenshot + robot.mouseMove(OFF_FRAME_LOC.x, OFF_FRAME_LOC.y); + robot.waitForIdle(); + robot.delay(100); + + createTestUI(); + robot.delay(1000); + + if (!errorLog.isEmpty()) { + saveImages(); + throw new RuntimeException("Test failed: \n" + errorLog.toString()); + } + } finally { + if (frame != null) { + frame.dispose(); + } + } + } + + private static void createTestUI() { + CopyAreaOOB canvas = new CopyAreaOOB(); + frame = new Frame(); + frame.setUndecorated(true); + frame.add(canvas); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } public void paint(Graphics g) { int w = getWidth(); @@ -50,73 +108,69 @@ public void paint(Graphics g) { g2d.fillRect(0, 0, w, 10); g2d.setColor(Color.red); - g2d.fillRect(0, 10, 50, h-10); + g2d.fillRect(0, 10, 50, h - 10); // copy the region such that part of it goes below the bottom of the // destination surface - g2d.copyArea(0, 10, 50, h-10, 60, 10); + g2d.copyArea(0, 10, 50, h - 10, 60, 10); Toolkit.getDefaultToolkit().sync(); - BufferedImage capture = null; - try { - Thread.sleep(500); - if (robot == null) robot = new Robot(); - Point pt1 = getLocationOnScreen(); - Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400); - capture = robot.createScreenCapture(rect); - } catch (Exception e) { - throw new RuntimeException("Problems handling Robot"); - } + robot.delay(500); + + Point pt1 = this.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, SIZE, SIZE); + captureImg = robot.createScreenCapture(rect); + // Test pixels - testRegion(capture, "green", 0, 0, 400, 10, 0xff00ff00); - testRegion(capture, "original red", 0, 10, 50, 400, 0xffff0000); - testRegion(capture, "background", 50, 10, 60, 400, 0xff000000); - testRegion(capture, "in-between", 60, 10, 110, 20, 0xff000000); - testRegion(capture, "copied red", 60, 20, 110, 400, 0xffff0000); - testRegion(capture, "background", 110, 10, 400, 400, 0xff000000); + testRegion("green", 0, 0, 400, 10, 0xff00ff00); + testRegion("original-red", 0, 10, 50, 400, 0xffff0000); + testRegion("background", 50, 10, 60, 400, 0xff000000); + testRegion("in-between", 60, 10, 110, 20, 0xff000000); + testRegion("copied-red", 60, 20, 110, 400, 0xffff0000); + testRegion("background", 110, 10, 400, 400, 0xff000000); } public Dimension getPreferredSize() { - return new Dimension(400, 400); + return new Dimension(SIZE, SIZE); } - private static void testRegion(BufferedImage bi, String name, + private static void testRegion(String region, int x1, int y1, int x2, int y2, - int expected) - { + int expected) { + System.out.print("Test region: " + region); for (int y = y1; y < y2; y++) { for (int x = x1; x < x2; x++) { - int actual = bi.getRGB(x, y); + int actual = captureImg.getRGB(x, y); if (actual != expected) { - throw new RuntimeException("Test failed for " + name + - " region at x="+x+" y="+y+ - " (expected="+ - Integer.toHexString(expected) + - " actual="+ - Integer.toHexString(actual) + - ")"); + System.out.print(" Status: FAILED\n"); + errorLog.append("Test failed for " + region + + " region at x: " + x + " y: " + y + + " (expected: " + + Integer.toHexString(expected) + + " actual: " + + Integer.toHexString(actual) + ")\n"); + return; } } } + System.out.print(" Status: PASSED\n"); } - public static void main(String[] args) { - boolean show = (args.length == 1) && ("-show".equals(args[0])); + private static void saveImages() { + GraphicsConfiguration ge = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice() + .getDefaultConfiguration(); - CopyAreaOOB test = new CopyAreaOOB(); - Frame frame = new Frame(); - frame.setUndecorated(true); - frame.add(test); - frame.pack(); - frame.setLocationRelativeTo(null); - frame.setVisible(true); + MultiResolutionImage mrImage = robot.createMultiResolutionScreenCapture(ge.getBounds()); + List variants = mrImage.getResolutionVariants(); + RenderedImage screenCapture = (RenderedImage) variants.get(variants.size() - 1); try { - Thread.sleep(3000); - } catch (InterruptedException ex) {} - if (!show) { - frame.dispose(); + ImageIO.write(screenCapture, "png", new File("fullscreen.png")); + ImageIO.write(captureImg, "png", new File("canvas.png")); + } catch (IOException e) { + System.err.println("Can't write image " + e); } } } diff --git a/test/jdk/java/awt/GraphicsDevice/CheckDisplayModes.java b/test/jdk/java/awt/GraphicsDevice/CheckDisplayModes.java index ffc98dcda1ae..4ad168045c85 100644 --- a/test/jdk/java/awt/GraphicsDevice/CheckDisplayModes.java +++ b/test/jdk/java/awt/GraphicsDevice/CheckDisplayModes.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 @@ -35,20 +35,31 @@ public class CheckDisplayModes { public static void main(String[] args) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - for (GraphicsDevice graphicDevice : ge.getScreenDevices()) { + GraphicsDevice[] allDevices = ge.getScreenDevices(); + + for (GraphicsDevice gd : allDevices) { + System.out.println("Available screen device: " + gd.getIDstring()); + } + + for (GraphicsDevice graphicDevice : allDevices) { + System.out.println("On screen device " + graphicDevice.getIDstring()); if (!graphicDevice.isDisplayChangeSupported()) { System.err.println("Display mode change is not supported on this host. Test is considered passed."); continue; } DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode(); - System.out.println("Initial Display mode: " + defaultDisplayMode); + System.out.println("Default display mode: " + defaultDisplayMode); checkDisplayMode(defaultDisplayMode); graphicDevice.setDisplayMode(defaultDisplayMode); try { DisplayMode[] displayModes = graphicDevice.getDisplayModes(); + for (int i = 0; i < displayModes.length; i++) { + System.out.println("displayModes[" + i + "] = " + displayModes[i]); + } boolean isDefaultDisplayModeIncluded = false; for (DisplayMode displayMode : displayModes) { + System.out.println("Attempting display mode " + displayMode); checkDisplayMode(displayMode); graphicDevice.setDisplayMode(displayMode); System.out.println("\tDisplay mode changed to " + displayMode); diff --git a/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java b/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java index 5b2dc2844f17..60c05fb05a67 100644 --- a/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java +++ b/test/jdk/java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemonicKeyTypedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* @test @key headful - @bug 6346690 + @bug 6346690 8361606 8321303 @summary Tests that key_typed is consumed after mnemonic key_pressed is handled for a menu item. @library /test/lib @build jdk.test.lib.Platform diff --git a/test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java b/test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java index 7f9a07878f1b..52b7eeccd12d 100644 --- a/test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java +++ b/test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.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 @@ -31,9 +31,16 @@ @run main ButtonActionKeyTest */ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; +import java.awt.FlowLayout; +import java.awt.Robot; +import javax.swing.AbstractAction; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JTextField; +import javax.swing.KeyStroke; +import java.awt.event.ActionEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import java.util.concurrent.atomic.AtomicBoolean; import test.java.awt.regtesthelpers.Util; @@ -42,7 +49,7 @@ public class ButtonActionKeyTest { JFrame frame = new JFrame("Frame"); JButton button = new JButton("button"); JTextField text = new JTextField("text"); - AtomicBoolean gotEvent = new AtomicBoolean(false); + final AtomicBoolean gotEvent = new AtomicBoolean(false); public static void main(String[] args) { ButtonActionKeyTest app = new ButtonActionKeyTest(); @@ -82,9 +89,11 @@ public void keyTyped(KeyEvent e) { frame.setLocationRelativeTo(null); frame.setVisible(true); Util.waitForIdle(robot); + robot.delay(1000); Util.clickOnComp(button, robot); Util.waitForIdle(robot); + robot.delay(500); if (!button.isFocusOwner()) { throw new Error("Test error: a button didn't gain focus."); diff --git a/test/jdk/java/awt/LightweightComponent/LightWeightTabFocus/LightWeightTabFocus.java b/test/jdk/java/awt/LightweightComponent/LightWeightTabFocus/LightWeightTabFocus.java index 05889580fd42..2d0b742c3196 100644 --- a/test/jdk/java/awt/LightweightComponent/LightWeightTabFocus/LightWeightTabFocus.java +++ b/test/jdk/java/awt/LightweightComponent/LightWeightTabFocus/LightWeightTabFocus.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 @@ -97,6 +97,7 @@ public static void main(String[] args) throws Exception { } catch (Exception e) { e.printStackTrace(); } finally { + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); EventQueue.invokeAndWait(() -> { if (f != null) { f.dispose(); diff --git a/test/jdk/java/awt/MenuBar/8007006/bug8007006.java b/test/jdk/java/awt/MenuBar/8007006/bug8007006.java index cebf9cd8da9b..0bc9bdeefffe 100644 --- a/test/jdk/java/awt/MenuBar/8007006/bug8007006.java +++ b/test/jdk/java/awt/MenuBar/8007006/bug8007006.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 @@ -21,76 +21,86 @@ * questions. */ -/** +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Insets; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/* * @test * @key headful * @bug 8007006 * @requires (os.family == "mac") * @summary [macosx] Closing subwindow loses main window menus. - * @library /test/lib - * @build jdk.test.lib.Platform - * @run main bug8007006 */ -import java.awt.*; -import java.awt.event.*; - -import jdk.test.lib.Platform; - public class bug8007006 { - private static Frame frame1; - private static Frame frame2; - private static volatile boolean isActionPerformed; + private static Frame mainFrame; + private static Frame subFrame; + private static final CountDownLatch isActionPerformed = new CountDownLatch(1); public static void main(String[] args) throws Exception { - if (!Platform.isOSX()) { - System.out.println("This test is for MacOS only. Automatically passed on other platforms."); - return; - } - - System.setProperty("apple.laf.useScreenMenuBar", "true"); + try { + System.setProperty("apple.laf.useScreenMenuBar", "true"); + Robot robot = new Robot(); - Robot robot = new Robot(); - robot.setAutoDelay(300); + EventQueue.invokeAndWait(bug8007006::createAndShowGUI); + robot.waitForIdle(); + robot.delay(1000); - createAndShowGUI(); - robot.waitForIdle(); - frame2.dispose(); - robot.waitForIdle(); + EventQueue.invokeAndWait(() -> subFrame.dispose()); + robot.waitForIdle(); + robot.delay(300); - performMenuItemTest(robot); + performMenuItemTest(robot); - frame1.dispose(); - if (!isActionPerformed) { - throw new Exception("Test failed: menu item action was not performed"); + if (!isActionPerformed.await(1, TimeUnit.SECONDS)) { + throw new Exception("Test failed: menu item action was not performed"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (mainFrame != null) { + mainFrame.dispose(); + } + }); } } private static void createAndShowGUI() { - frame1 = new Frame("Frame 1"); - frame1.setMenuBar(createMenuBar()); - frame1.setSize(200, 200); - - frame2 = new Frame("Frame 2"); - frame2.setMenuBar(createMenuBar()); - frame2.setSize(200, 200); - - frame1.setVisible(true); - frame2.setVisible(true); + mainFrame = new Frame("Frame 1"); + mainFrame.setMenuBar(createMenuBar()); + mainFrame.setSize(200, 200); + mainFrame.setBackground(Color.GREEN); + mainFrame.setLocationRelativeTo(null); + + subFrame = new Frame("Frame 2"); + subFrame.setMenuBar(createMenuBar()); + subFrame.setSize(200, 200); + subFrame.setBackground(Color.RED); + subFrame.setLocationRelativeTo(null); + + mainFrame.setVisible(true); + subFrame.setVisible(true); } private static MenuBar createMenuBar() { - // A very long name makes it more likely that the robot will hit the - // menu + // A very long name makes it more likely + // that the robot will hit the menu Menu menu = new Menu("TestTestTestTestTestTestTestTestTestTest"); MenuItem item = new MenuItem("TestTestTestTestTestTestTestTestTestTest"); - item.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent ev) { - isActionPerformed = true; - } - }); menu.add(item); + item.addActionListener(ev -> isActionPerformed.countDown()); + MenuBar mb = new MenuBar(); mb.add(menu); return mb; @@ -102,29 +112,29 @@ private static void performMenuItemTest(Robot robot) { // of the first menu. // Unfortunately, the application name can vary based on how the // application is run. - // The work around is to make the menu and the menu item names very + // The workaround is to make the menu and the menu item names very // long. + Toolkit toolkit = Toolkit.getDefaultToolkit(); + GraphicsConfiguration gc = + GraphicsEnvironment.getLocalGraphicsEnvironment() + .getDefaultScreenDevice() + .getDefaultConfiguration(); + + Insets screenInsets = toolkit.getScreenInsets(gc); + System.out.println("Screen insets: " + screenInsets); + int menuBarX = 250; - int menuBarY = 11; + int menuBarY = screenInsets.top / 2; int menuItemX = menuBarX; - int menuItemY = 34; + int menuItemY = screenInsets.top + 10; robot.mouseMove(menuBarX, menuBarY); robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); - robot.mouseMove(menuItemX, menuItemY); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); - waitForAction(); - } - private static void waitForAction() { - try { - for (int i = 0; i < 10; i++) { - if (isActionPerformed) { - return; - } - Thread.sleep(100); - } - } catch (InterruptedException ex) { - } + robot.mouseMove(menuItemX, menuItemY); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); } } diff --git a/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.html b/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.html deleted file mode 100644 index a562b886ab0e..000000000000 --- a/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - PrintDialogsTest - - - - -Please select dialog modality type and parent; also select -the print auxiliary dialog to be displayed (Page Setup or Print dialog). -Then click "Start test" button. - -When the windows will appear check if modal blocking for Dialog works as expected. -Then push "Open" button on the Dialog to show the auxiliary dialog and check -if it blocks the rest of the application. Then close it and check correctness -of modal blocking behavior for the Dialog again. To close all the test -windows please push "Finish" button. - -To finish the overall test push "Pass" or "Fail" button depending on result. - - - diff --git a/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java b/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java index 989c48295b01..3e191fa0c4c0 100644 --- a/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java +++ b/test/jdk/java/awt/Modal/PrintDialogsTest/PrintDialogsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,21 +25,71 @@ /* * @test * @bug 8055836 8057694 8055752 - * @summary Check if Print and Page Setup dialogs lock other windows; + * @summary Check if Print and Page Setup dialogs block other windows; * check also correctness of modal behavior for other dialogs. - * - * @run applet/manual=yesno PrintDialogsTest.html + * @library /java/awt/regtesthelpers + * @run main/manual PrintDialogsTest */ -import java.applet.Applet; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.CheckboxGroup; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.EventQueue; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class PrintDialogsTest extends Applet implements ActionListener { +public class PrintDialogsTest extends Panel implements ActionListener { + + static final String INSTRUCTIONS = + "1. On the Test UI Select:\n" + + "\tThe dialog parent type. (e.g. Frame, Dialog, Hidden, Null)\n" + + "\tThe dialog modality type. (e.g. Modal, Non-Modal, Toolkit modal).\n" + + "\tThe print dialog type. (Print dialog or Page Setup dialog).\n\n" + + "2. Next, click on 'Start test' - Three windows will appear:\n" + + "\tWindow (1) -a Frame or Dialog (depending on selected parent type).\n" + + "\tWindow (2) -an undecorated top-level Window.\n" + + "\tWindow (3) -a Dialog containing two buttons: 'Open' and 'Finish'.\n" + + "\tWindows (1) & (2) have a Dummy button.\n\n" + + "3. Press the button on Window (1) & Window (2) \n" + + "Verification step:\n" + + "\tIf Modality is 'Non-modal' or 'Modeless', Button is pressed \n" + + "\tIf Modality is 'Document' & parent is not Frame/Dialog, Button is pressed \n" + + "\tIn all other cases, button is not pressed & Window (3) should \n" + + "\tblock input to Windows (1) & (2).\n\n" + + "4. Next, press the 'Open' button in Window (3) to open print dialog.\n\n" + + "5. Press the button on Window (1) & Window (2)\n" + + "Verification step:\n" + + "\tThe print dialog should block all three windows (1, 2, and 3).\n\n" + + "6. Cancel the print dialog, Check again if Window (3) " + + "blocks Windows (1) and (2) correctly.\n" + + "Verification step:\n" + + "\tConditions as seen in Verification step 3 " + + "should be seen, as before.\n" + + "To close all test windows, press 'Finish'.\n\n" + + "7. Repeat the steps for different combinations of Dialog Parent, Dialog Modality Type, Print Dialg Type.\n" + + "Try every dialog parent type and every dialog modality type.\n\n" + + "If any of the Verification step fails, note the combination and press 'Fail'.\n"; + + public static void main(String[] args) throws Exception { + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .rows(35) + .columns(60) + .testUI(PrintDialogsTest::createUI) + .testTimeOut(10) + .build() + .awaitAndCheck(); + } private Button btnTest; private Checkbox cbPage, cbPrint, @@ -48,6 +98,14 @@ public class PrintDialogsTest extends Applet implements ActionListener { private CheckboxGroup groupDialog, groupParent, groupModType; + private static Frame createUI() { + Frame frame = new Frame("Dialog Modality Testing"); + PrintDialogsTest test = new PrintDialogsTest(); + test.createGUI(); + frame.add(test); + frame.pack(); + return frame; + } public void actionPerformed(ActionEvent e) { @@ -99,13 +157,13 @@ private void createGUI() { setLayout(new BorderLayout()); - setSize(350, 200); Panel panel = new Panel(); - panel.setLayout(new GridLayout(18, 1)); + panel.setLayout(new GridLayout(21, 1)); btnTest = new Button("Start test"); btnTest.addActionListener(this); panel.add(btnTest); + panel.add(new Label(" ")); // spacing panel.add(new Label("Dialog parent:")); @@ -123,6 +181,7 @@ private void createGUI() { panel.add(cbHiddFrm); panel.add(cbDlg); panel.add(cbFrm); + panel.add(new Label(" ")); // spacing panel.add(new Label("Dialog modality type:")); groupModType = new CheckboxGroup(); @@ -139,7 +198,7 @@ private void createGUI() { panel.add(cbDocModal); panel.add(cbTKModal); panel.add(cbModeless); - add(panel); + panel.add(new Label(" ")); // spacing panel.add(new Label("Print dialog type:")); groupDialog = new CheckboxGroup(); @@ -148,13 +207,6 @@ private void createGUI() { panel.add(cbPage); panel.add(cbPrint); - validate(); - setVisible(true); - } - - public void start() { - try { - EventQueue.invokeAndWait(this::createGUI); - } catch (Exception e) {} + add(panel); } } diff --git a/test/jdk/java/awt/Modal/PrintDialogsTest/Test.java b/test/jdk/java/awt/Modal/PrintDialogsTest/Test.java index 3c8faceb3a9a..0f1909711862 100644 --- a/test/jdk/java/awt/Modal/PrintDialogsTest/Test.java +++ b/test/jdk/java/awt/Modal/PrintDialogsTest/Test.java @@ -191,6 +191,7 @@ private void createGUI() { break; case DIALOG: dialog = new CustomDialog(parent); + break; case FRAME: dialog = new CustomDialog(frame); break; diff --git a/test/jdk/java/awt/Modal/ToFront/DialogToFrontModeless1Test.java b/test/jdk/java/awt/Modal/ToFront/DialogToFrontModeless1Test.java index 4faea19db2f4..928bfd027eac 100644 --- a/test/jdk/java/awt/Modal/ToFront/DialogToFrontModeless1Test.java +++ b/test/jdk/java/awt/Modal/ToFront/DialogToFrontModeless1Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,12 +34,27 @@ * @build Flag * @build TestDialog * @build TestFrame + * @build jdk.test.lib.Platform * @run main DialogToFrontModeless1Test */ +import jdk.test.lib.Platform; +import jtreg.SkippedException; + public class DialogToFrontModeless1Test { public static void main(String[] args) throws Exception { + if (Platform.isOnWayland()) { + // Some tested systems are still use XTEST(X11 protocol) + // for key and mouse press emulation, but this will not work + // outside of X11. + // An emulated input event will reach X11 clients, but not the + // Wayland compositor, which is responsible for window restacking. + // + // This skip can be removed later once all systems switch to + // the default remote desktop XDG portal. + throw new SkippedException("SKIPPED: robot functionality is limited on the current platform."); + } (new DialogToFrontModelessTest()).doTest(); } } diff --git a/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java b/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java index 4f789668c4a5..2a77f294298d 100644 --- a/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java +++ b/test/jdk/java/awt/Mouse/EnterExitEvents/DragWindowTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,11 +26,8 @@ * @key headful * @bug 7154048 * @summary Window created under a mouse does not receive mouse enter event. - * Mouse Entered/Exited events are wrongly generated during dragging the window - * from one component to another - * @library ../../regtesthelpers - * @build Util - * @author alexandr.scherbatiy area=awt.event + * Mouse Entered/Exited events are wrongly generated during dragging the + * window from one component to another * @run main DragWindowTest */ @@ -50,76 +47,67 @@ import javax.swing.JPanel; import javax.swing.SwingUtilities; -import java.util.concurrent.Callable; - -import test.java.awt.regtesthelpers.Util; - public class DragWindowTest { - private static volatile int dragWindowMouseEnteredCount = 0; - private static volatile int dragWindowMouseReleasedCount = 0; private static volatile int buttonMouseEnteredCount = 0; private static volatile int labelMouseReleasedCount = 0; + + private static volatile Point pointToClick; + private static volatile Point pointToDrag; + private static MyDragWindow dragWindow; private static JLabel label; private static JButton button; + private static JFrame frame; public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(100); - Robot robot = new Robot(); - robot.setAutoDelay(100); - - SwingUtilities.invokeAndWait(new Runnable() { + SwingUtilities.invokeAndWait(DragWindowTest::createAndShowGUI); - @Override - public void run() { - createAndShowGUI(); - } - }); + robot.delay(250); + robot.waitForIdle(); - robot.delay(250); - robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + pointToClick = getCenterPoint(label); + pointToDrag = getCenterPoint(button); + }); - Point pointToClick = Util.invokeOnEDT(new Callable() { + robot.mouseMove(pointToClick.x, pointToClick.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(250); - @Override - public Point call() throws Exception { - return getCenterPoint(label); + if (dragWindowMouseEnteredCount != 1) { + throw new RuntimeException("No MouseEntered event on Drag Window!"); } - }); + // Reset entered count to check if mouse entered starting from here + buttonMouseEnteredCount = 0; + robot.mouseMove(pointToDrag.x, pointToDrag.y); + robot.waitForIdle(); + robot.delay(250); - robot.mouseMove(pointToClick.x, pointToClick.y); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); - - if (dragWindowMouseEnteredCount != 1) { - throw new RuntimeException("No MouseEntered event on Drag Window!"); - } - - Point pointToDrag = Util.invokeOnEDT(new Callable() { - - @Override - public Point call() throws Exception { - button.addMouseListener(new ButtonMouseListener()); - return getCenterPoint(button); + if (buttonMouseEnteredCount != 0) { + throw new RuntimeException("Extra MouseEntered event on button!"); } - }); - - robot.mouseMove(pointToDrag.x, pointToDrag.y); - robot.waitForIdle(); - - if (buttonMouseEnteredCount != 0) { - throw new RuntimeException("Extra MouseEntered event on button!"); - } - robot.mouseRelease(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(250); - if (labelMouseReleasedCount != 1) { - throw new RuntimeException("No MouseReleased event on label!"); + if (labelMouseReleasedCount != 1) { + throw new RuntimeException("No MouseReleased event on label!"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); } - } private static Point getCenterPoint(Component comp) { @@ -129,8 +117,7 @@ private static Point getCenterPoint(Component comp) { } private static void createAndShowGUI() { - - JFrame frame = new JFrame("Main Frame"); + frame = new JFrame("DragWindowTest"); frame.setSize(300, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -142,6 +129,7 @@ private static void createAndShowGUI() { button = new JButton("Button"); Panel panel = new Panel(new BorderLayout()); + button.addMouseListener(new ButtonMouseListener()); panel.add(label, BorderLayout.NORTH); panel.add(button, BorderLayout.CENTER); @@ -149,7 +137,6 @@ private static void createAndShowGUI() { frame.getContentPane().add(panel); frame.setLocationRelativeTo(null); frame.setVisible(true); - } private static Point getAbsoluteLocation(MouseEvent e) { @@ -157,7 +144,6 @@ private static Point getAbsoluteLocation(MouseEvent e) { } static class MyDragWindow extends Window { - static int d = 30; public MyDragWindow(Window parent, Point location) { @@ -176,8 +162,6 @@ void dragTo(Point point) { } static class LabelMouseListener extends MouseAdapter { - - Point origin; Window parent; public LabelMouseListener(Window parent) { @@ -210,20 +194,13 @@ public void mouseDragged(MouseEvent e) { } static class DragWindowMouseListener extends MouseAdapter { - @Override public void mouseEntered(MouseEvent e) { dragWindowMouseEnteredCount++; } - - @Override - public void mouseReleased(MouseEvent e) { - dragWindowMouseReleasedCount++; - } } static class ButtonMouseListener extends MouseAdapter { - @Override public void mouseEntered(MouseEvent e) { buttonMouseEnteredCount++; diff --git a/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java b/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java index 3aa437e48454..966ce30593e1 100644 --- a/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java +++ b/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,12 +20,13 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 6180413 6184485 6267144 * @summary test for popup menu visual bugs in XAWT - * @library /java/awt/regtesthelpers - * @build PassFailJFrame + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jdk.test.lib.Platform * @run main/manual PopupMenuVisuals */ @@ -40,16 +41,20 @@ import java.awt.event.ActionListener; import java.awt.event.KeyEvent; +import jdk.test.lib.Platform; + public class PopupMenuVisuals { private static final String INSTRUCTIONS = """ This test should show a button 'Popup'. Click on the button. A popup menu should be shown. If following conditions are met: - - Menu is disabled - - Menu has caption 'Popup menu' (only applicable for linux) - - Menu items don't show shortcuts + - Menu is disabled %s%s - Click Pass else click Fail."""; + Click Pass else click Fail.""" + .formatted( + Platform.isLinux() ? "\n - Menu has caption 'Popup menu'" : "", + !Platform.isOSX() ? "\n - Menu items don't show shortcuts" : "" + ); static PopupMenu pm; static Frame frame; @@ -58,7 +63,6 @@ public static void main(String[] args) throws Exception { PassFailJFrame.builder() .title("PopupMenu Instructions") .instructions(INSTRUCTIONS) - .rows((int) INSTRUCTIONS.lines().count() + 2) .columns(35) .testUI(PopupMenuVisuals::createTestUI) .build() @@ -79,9 +83,9 @@ private static Frame createTestUI() { CheckboxMenuItem mi3 = new CheckboxMenuItem("Item 3"); Menu sm = new Menu("Submenu"); - //Get things going. Request focus, set size, et cetera + // Get things going. Request focus, set size, et cetera frame = new Frame("PopupMenuVisuals"); - frame.setSize (200,200); + frame.setSize(200, 200); frame.validate(); frame.add(b); diff --git a/test/jdk/java/awt/PrintJob/TestPrintNoException.java b/test/jdk/java/awt/PrintJob/TestPrintNoException.java new file mode 100644 index 000000000000..b54ac8de56bd --- /dev/null +++ b/test/jdk/java/awt/PrintJob/TestPrintNoException.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.JobAttributes; +import java.awt.PrintJob; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.KeyEvent; + +/* + * @test + * @bug 8378417 + * @key headful printer + * @summary Verifies No Exception is thrown when Printing "All" pages + * @run main TestPrintNoException + */ + +public class TestPrintNoException { + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + Thread t = new Thread (() -> { + robot.delay(5000); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + robot.waitForIdle(); + }); + + Frame testFrame = new Frame("print"); + try { + t.start(); + PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(testFrame, null, null); + if (pj != null) { + pj.end(); + } + } finally { + testFrame.dispose(); + } + } +} diff --git a/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java b/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java index 1f2de081cce1..c0a9c90feba3 100644 --- a/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java +++ b/test/jdk/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,30 +22,25 @@ */ import java.awt.Color; -import java.awt.Dialog; import java.awt.Frame; import java.awt.Graphics; -import java.awt.Graphics2D; import java.awt.GraphicsEnvironment; -import java.awt.Panel; import java.awt.Rectangle; import java.awt.Robot; import java.awt.SplashScreen; import java.awt.TextField; -import java.awt.Window; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import java.io.File; -import javax.imageio.ImageIO; -import sun.java2d.SunGraphics2D; +import java.io.IOException; +import javax.imageio.ImageIO; -/** +/* * @test * @key headful * @bug 8043869 8075244 8078082 8145173 8151787 8212213 * @summary Tests the HiDPI splash screen support for windows and MAC - * @modules java.desktop/sun.java2d * @run main MultiResolutionSplashTest GENERATE_IMAGES * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0 * @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1 @@ -56,47 +51,54 @@ public class MultiResolutionSplashTest { private static final int IMAGE_WIDTH = 300; private static final int IMAGE_HEIGHT = 200; - private static boolean isMac; - static { - isMac = System.getProperty("os.name").contains("OS X"); - } + private static final boolean isMac = System.getProperty("os.name") + .contains("OS X"); + private static final ImageInfo[] tests = { - new ImageInfo("splash1.png", "splash1@2x.png", Color.BLUE, Color.GREEN), - new ImageInfo("splash2", "splash2@2x", Color.WHITE, Color.BLACK), - new ImageInfo("splash3.", "splash3@2x.", Color.YELLOW, Color.RED) + new ImageInfo("splash1", ".png", Color.BLUE, Color.GREEN), + new ImageInfo("splash2", "", Color.WHITE, Color.BLACK), + new ImageInfo("splash3", ".", Color.YELLOW, Color.RED) }; public static void main(String[] args) throws Exception { - - String test = args[0]; - switch (test) { + switch (args[0]) { case "GENERATE_IMAGES": generateImages(); break; case "TEST_SPLASH": - int index = Integer.parseInt(args[1]); - testSplash(tests[index]); + testSplash(tests[Integer.parseInt(args[1])]); break; case "TEST_FOCUS": testFocus(); break; default: - throw new RuntimeException("Unknown test: " + test); + throw new RuntimeException("Unknown test: " + args[0]); } } static void testSplash(ImageInfo test) throws Exception { SplashScreen splashScreen = SplashScreen.getSplashScreen(); - if (splashScreen == null) { throw new RuntimeException("Splash screen is not shown!"); } - Graphics2D g = splashScreen.createGraphics(); - Rectangle splashBounds = splashScreen.getBounds(); - int screenX = (int) splashBounds.getCenterX(); - int screenY = (int) splashBounds.getCenterY(); + final Rectangle splashBounds = splashScreen.getBounds(); + final double scaleFactor = getScreenScaleFactor(); + + final Robot robot = new Robot(); + // Allow time for the splash screen to show + robot.delay(100); + + BufferedImage splashCapture = robot.createScreenCapture(splashBounds); + String captureFileName = "splashscreen-%1.2f-%s.png" + .formatted(scaleFactor, test.name1x); + saveImageNoError(splashCapture, new File(captureFileName)); + + // Close the splash screen; this gives time for it to be fully removed + splashScreen.close(); + robot.waitForIdle(); + if (splashBounds.width != IMAGE_WIDTH) { throw new RuntimeException( "SplashScreen#getBounds has wrong width"); @@ -106,19 +108,19 @@ static void testSplash(ImageInfo test) throws Exception { "SplashScreen#getBounds has wrong height"); } - Robot robot = new Robot(); - Color splashScreenColor = robot.getPixelColor(screenX, screenY); - float scaleFactor = getScaleFactor(); + Color splashScreenColor = + new Color(splashCapture.getRGB(splashBounds.width / 2, + splashBounds.height / 2)); Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x; if (!compare(testColor, splashScreenColor)) { throw new RuntimeException( - "Image with wrong resolution is used for splash screen!"); + "Image with wrong resolution is used for splash screen! " + + "Refer to " + captureFileName); } } static void testFocus() throws Exception { - Robot robot = new Robot(); robot.setAutoWaitForIdle(true); robot.setAutoDelay(50); @@ -157,94 +159,85 @@ static boolean compare(int n, int m) { return Math.abs(n - m) <= 50; } - static float getScaleFactor() { - - final Dialog dialog = new Dialog((Window) null); - dialog.setSize(100, 100); - dialog.setModal(true); - final float[] scaleFactors = new float[1]; - Panel panel = new Panel() { - - @Override - public void paint(Graphics g) { - float scaleFactor = 1; - if (g instanceof SunGraphics2D) { - scaleFactor = getScreenScaleFactor(); - } - scaleFactors[0] = scaleFactor; - dialog.setVisible(false); - } - }; - - dialog.add(panel); - dialog.setVisible(true); - dialog.dispose(); - - return scaleFactors[0]; - } - static void generateImages() throws Exception { for (ImageInfo test : tests) { - generateImage(test.name1x, test.color1x, 1); - generateImage(test.name2x, test.color2x, getScreenScaleFactor()); + generateImage(test.name1x, test.color1x, 1.0); + + // Ensure the second image uses scale greater than 1.0 + double scale = getAdjustedScaleFactor(); + generateImage(test.name2x, test.color2x, scale); } } - static void generateImage(String name, Color color, float scale) throws Exception { + static void generateImage(final String name, + final Color color, + final double scale) throws Exception { File file = new File(name); if (file.exists()) { return; } - BufferedImage image = new BufferedImage((int) (scale * IMAGE_WIDTH), - (int) (scale * IMAGE_HEIGHT), BufferedImage.TYPE_INT_RGB); + + final int width = (int) (scale * IMAGE_WIDTH); + final int height = (int) (scale * IMAGE_HEIGHT); + BufferedImage image = new BufferedImage(width, + height, + BufferedImage.TYPE_INT_RGB); Graphics g = image.getGraphics(); g.setColor(color); - g.fillRect(0, 0, (int) (scale * IMAGE_WIDTH), (int) (scale * IMAGE_HEIGHT)); + g.fillRect(0, 0, width, height); + + saveImage(image, file); + } + + private static void saveImage(BufferedImage image, + File file) throws IOException { ImageIO.write(image, "png", file); } - static float getScreenScaleFactor() { - return (float) GraphicsEnvironment. - getLocalGraphicsEnvironment(). - getDefaultScreenDevice().getDefaultConfiguration(). - getDefaultTransform().getScaleX(); + private static void saveImageNoError(BufferedImage image, + File file) { + try { + saveImage(image, file); + } catch (IOException ignored) { + } } - static class ImageInfo { + static double getScreenScaleFactor() { + return GraphicsEnvironment + .getLocalGraphicsEnvironment() + .getDefaultScreenDevice() + .getDefaultConfiguration() + .getDefaultTransform() + .getScaleX(); + } + + // Ensure the second image uses scale greater than 1.0 + static double getAdjustedScaleFactor() { + double scale = getScreenScaleFactor(); + return scale < 1.25 ? 2.0 : scale; + } + static class ImageInfo { final String name1x; final String name2x; final Color color1x; final Color color2x; - public ImageInfo(String name1x, String name2x, Color color1x, Color color2x) { - this.name1x = name1x; - if (!isMac) { - float scale = getScreenScaleFactor(); - StringBuffer buff = new StringBuffer(); - if (scale - (int) scale > 0) { - buff.append("@").append((int) (scale * 100)).append("pct"); - } else { - buff.append("@").append((int) scale).append("x"); - } - StringBuffer buffer = new StringBuffer(); - String[] splitStr = name1x.split("\\."); - if (splitStr.length == 2) { - this.name2x = buffer.append(splitStr[0]).append(buff) - .append(".").append(splitStr[1]).toString(); - } else { - if (name1x.indexOf(".") > 0) { - this.name2x = buffer.append(splitStr[0]).append(buff).append(".").toString(); - } else { - this.name2x = buffer.append(splitStr[0]).append(buff).toString(); - } - } - } else { - this.name2x = name2x; - } + public ImageInfo(String baseName, String ext, + Color color1x, Color color2x) { + this.name1x = baseName + ext; + this.name2x = createName2x(baseName, ext); this.color1x = color1x; this.color2x = color2x; } + + private static String createName2x(String baseName, String ext) { + double scale = getAdjustedScaleFactor(); + if (!isMac && (((int) (scale * 100)) % 100 != 0)) { + return baseName + "@" + ((int) (scale * 100)) + "pct" + ext; + } else { + return baseName + "@" + ((int) scale) + "x" + ext; + } + } } } - diff --git a/test/jdk/java/awt/TextArea/PrintTextTest.java b/test/jdk/java/awt/TextArea/PrintTextTest.java new file mode 100644 index 000000000000..8cf147747328 --- /dev/null +++ b/test/jdk/java/awt/TextArea/PrintTextTest.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.Panel; +import java.awt.PrintJob; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4075786 + * @key printer + * @summary Test that container prints multiline text properly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PrintTextTest +*/ + +public class PrintTextTest extends Frame implements ActionListener { + Panel p; + + static final String INSTRUCTIONS = """ + Press "Print" button and check that multiline test + printed correctly. If so press Pass, otherwise Fail. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("PrintTextTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(PrintTextTest::new) + .build() + .awaitAndCheck(); + } + + public PrintTextTest() { + p = new Panel(); + p.setLayout(new BorderLayout()); + TextArea text_area = new TextArea("multi\nline\ntext\nfield\nis \nhere\n!!!!\n"); + + TextField text_field = new TextField("single line textfield"); + Button button = new Button("button"); + Label label = new Label("single line label"); + p.add("South", text_area); + p.add("North", new TextArea("one single line of textarea")); + p.add("Center", text_field); + p.add("West", button); + + add("North", p); + + Button b = new Button("Print"); + b.addActionListener(this); + add("South", b); + pack(); + } + + public void actionPerformed(ActionEvent e) { + PrintJob pjob = getToolkit().getPrintJob(this, "Print", null); + if (pjob != null) { + Graphics pg = pjob.getGraphics(); + + if (pg != null) { + p.printAll(pg); + pg.dispose(); //flush page + } + pjob.end(); + } + } +} diff --git a/test/jdk/java/awt/TextArea/ScrollBarArrowScrollTest.java b/test/jdk/java/awt/TextArea/ScrollBarArrowScrollTest.java new file mode 100644 index 000000000000..cf54bd575855 --- /dev/null +++ b/test/jdk/java/awt/TextArea/ScrollBarArrowScrollTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 6175401 + * @summary Keeping the left arrow pressedon horiz scrollbar + * does not scroll the text in TextArea, XToolkit + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ScrollBarArrowScrollTest +*/ + + +public class ScrollBarArrowScrollTest extends Frame { + private static final String INSTRUCTIONS = """ + 1) Make sure, that the TextArea component has focus. + 2) Press 'END' key in order to keep cursor at the end + of the text of the TextArea component. + 3) Click on the left arrow on the horizontal scrollbar + of the TextArea component and keep it pressed. + 4) If the text just scrolls once and stops, the test failed. + Otherwise, the test passed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ScrollBarArrowScrollTest") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(ScrollBarArrowScrollTest::new) + .build() + .awaitAndCheck(); + } + + public ScrollBarArrowScrollTest() { + TextArea textarea = new TextArea("Very very very long string !!!! ", 10, 3); + add(textarea); + pack(); + + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest.java b/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest.java new file mode 100644 index 000000000000..f506f54f6f14 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 5003402 + * @summary TextArea must scroll automatically when calling append and select, even when not in focus + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaAppendScrollTest + */ + +public class TextAreaAppendScrollTest extends Frame implements ActionListener { + int phase; + int pos1, pos2; + TextArea area; + private static final String INSTRUCTIONS = """ + Press "Click Here" button. + The word "First" should be visible in the TextArea. + + Press "Click Here" button again. + The word "Next" should be visible in the TextArea. + + Press "Click Here" button again. + The word "Last" should be visible in the TextArea. + If you have seen all three words, press Pass, else press Fail. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaAppendScrollTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaAppendScrollTest::new) + .build() + .awaitAndCheck(); + } + + public TextAreaAppendScrollTest() { + area = new TextArea(); + add("Center", area); + Button bt1 = new Button("Click Here"); + add("South", bt1); + String filler = ""; + for (int i = 0; i < 100; i++) { + filler = filler + i + "\n"; + } + String text = filler; + pos1 = text.length(); + text = text + "First\n" + filler; + pos2 = text.length(); + text = text + "Next\n" + filler; + area.setText(text); + phase = 0; + bt1.addActionListener(this); + pack(); + } + + public void actionPerformed(ActionEvent ev) { + if (phase == 0) { + area.select(pos1, pos1); + phase = 1; + } else if (phase == 1) { + area.select(pos2, pos2); + phase = 2; + } else { + area.append("Last\n"); + phase = 0; + } + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest2.java b/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest2.java new file mode 100644 index 000000000000..2f0e44b415e1 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaAppendScrollTest2.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 6192116 + * @summary Auto-scrolling does not work properly for TextArea when appending some text, on XToolkit + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaAppendScrollTest2 + */ + +public class TextAreaAppendScrollTest2 extends Frame { + TextArea area; + private static final String INSTRUCTIONS = """ + Press pass if you see exclamation marks in the bottom of textarea. + Press fail if you don't. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaAppendScrollTest2") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaAppendScrollTest2::new) + .build() + .awaitAndCheck(); + } + + public TextAreaAppendScrollTest2() { + setLayout(new BorderLayout()); + area = new TextArea("AWT is cool ", 3, 3, TextArea.SCROLLBARS_NONE); + add("Center", area); + setSize(200, 200); + StringBuilder coolStr = new StringBuilder(""); + // I count 15 lines with 12 cools per line + for (int i = 0; i < 12 * 15; i++) { + coolStr.append("cool "); + } + coolStr.append("!!!!!!!"); + area.append(coolStr.toString()); + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaAppendTest.java b/test/jdk/java/awt/TextArea/TextAreaAppendTest.java new file mode 100644 index 000000000000..c47d621e788a --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaAppendTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 4118915 + * @summary Test appending to a TextArea after the peer is created + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaAppendTest + */ + +public class TextAreaAppendTest { + private static final String INSTRUCTIONS = """ + If all four lines are visible in TextArea, the test passed. + If the last two lines have only one character visible, the test failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaAppendTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaAppendTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame f = new Frame("TextAreaAppendTest"); + TextArea ta = new TextArea(); + f.add(ta); + ta.append("line 1 (added before drawing)\n"); + ta.append("line 2 (added before drawing)\n"); + + f.pack(); + f.show(); + + ta.append("line 3 (added after drawing)\n"); + ta.append("line 4 (added after drawing)\n"); + + return f; + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectManualTest.java b/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectManualTest.java new file mode 100644 index 000000000000..c8c3f0662a5c --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectManualTest.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4800187 + * @summary REGRESSION:show the wrong selection when there are \r characters in the text + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaCRLFAutoDetectManualTest + */ + +public class TextAreaCRLFAutoDetectManualTest { + static int flag = 1; + + private static final String INSTRUCTIONS = """ + Please click the button several times. + If you see the text '679' selected on the left TextArea + and the same text on the right TextArea + each time you press the button, + the test passed, else failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaCRLFAutoDetectManualTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaCRLFAutoDetectManualTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame f = new Frame("TextAreaCRLFAutoDetectManualTest"); + + TextArea ta1 = new TextArea(5, 20); + TextArea ta2 = new TextArea(5, 20); + + TextField tf1 = new TextField("123", 20); + TextField tf2 = new TextField("567", 20); + TextField tf3 = new TextField("90", 20); + + Button b = new Button("Click Me Several Times"); + + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + ta1.setText(""); + ta2.setText(""); + flag++; + String eoln = ((flag % 2) != 0) ? "\r\n" : "\n"; + ta1.setText(eoln + tf1.getText() + eoln + tf2.getText() + eoln + tf3.getText() + eoln); + ta1.select(6, 10); + ta2.setText(ta1.getSelectedText()); + ta1.requestFocus(); + } + }); + + f.setLayout(new FlowLayout()); + + Panel tfpanel = new Panel(); + tfpanel.setLayout(new GridLayout(3, 1)); + tfpanel.add(tf1); + tfpanel.add(tf2); + tfpanel.add(tf3); + f.add(tfpanel); + + f.add(ta1); + f.add(ta2); + f.add(b); + + f.pack(); + return f; + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaCursorTest.java b/test/jdk/java/awt/TextArea/TextAreaCursorTest.java new file mode 100644 index 000000000000..ec342e38a155 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaCursorTest.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Cursor; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4060320 + * @summary Test TextArea cursor shape on its scrollbars + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaCursorTest + */ + +public class TextAreaCursorTest { + private static final String INSTRUCTIONS = """ + Move the cursor into textarea and on scrollbar. Verify that the shape of + cursor on scrollbar should not be I-beam. Also, when the cursor in textarea + is set to some other shape, it does not affect the cursor shape on the + scrollbars. + """; + + public static void main(String args[]) throws Exception { + PassFailJFrame.builder() + .title("TextAreaCursorTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaCursorTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI () { + Frame f = new Frame("TextAreaCursorTest"); + BorderLayout layout = new BorderLayout(); + f.setLayout(layout); + + TextArea ta = new TextArea("A test to make sure that cursor \n" + + "on scrollbars has the correct shape\n\n" + + "Press button to change the textarea\n" + + "cursor to Hand_Cursor\n" + + "Make sure that the cursor on scrollbars\n" + + "remains the same", 10, 30); + + Button bu = new Button("Change Cursor"); + + f.add(ta, BorderLayout.NORTH); + f.add(bu, BorderLayout.SOUTH); + bu.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Cursor curs1 = new Cursor(Cursor.HAND_CURSOR); + ta.setCursor(curs1); + } + }); + f.pack(); + return f; + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaHScrollbarTest.java b/test/jdk/java/awt/TextArea/TextAreaHScrollbarTest.java new file mode 100644 index 000000000000..3bf1c6997638 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaHScrollbarTest.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 4648702 + * @summary TextArea horizontal scrollbar behavior is incorrect + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaHScrollbarTest + */ + +public class TextAreaHScrollbarTest { + private static final String INSTRUCTIONS = """ + Please look at the frame. + If the vertical and horizontal scrollbars are visible + the test passed else failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaHScrollbarTest") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TextAreaHScrollbarTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame test = new Frame(); + test.add(new TextArea("TextAreaHScrollbarTest", 5, 60, + TextArea.SCROLLBARS_BOTH)); + test.setSize(200, 100); + return test; + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaKeypadTest.java b/test/jdk/java/awt/TextArea/TextAreaKeypadTest.java new file mode 100644 index 000000000000..24fabdd01ab8 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaKeypadTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 6240876 + * @summary Number pad up & down arrows don't work in XToolkit TextArea + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaKeypadTest + */ + +public class TextAreaKeypadTest { + private static final String INSTRUCTIONS = """ + Press pass if you can move the caret in the textarea with _number pad_ UP/DOWN keys. + Press fail if you don't. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaKeypadTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaKeypadTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame frame = new Frame("TextAreaKeypadTest"); + frame.setLayout(new BorderLayout()); + TextArea area = new TextArea("One\nTwo\nThree", 3, 3, TextArea.SCROLLBARS_NONE); + frame.add("Center", area); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaLimit.java b/test/jdk/java/awt/TextArea/TextAreaLimit.java new file mode 100644 index 000000000000..424305c90ead --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaLimit.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 4341196 + * @summary Tests that TextArea can handle more than 64K of text + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaLimit + */ + +public class TextAreaLimit extends Frame { + static TextArea text; + private static final String INSTRUCTIONS = """ + You will see a text area with 40000 lines of text + each with its own line number. If you see the caret after line 39999 + then test passes. Otherwise it fails. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaLimit") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaLimit::new) + .build() + .awaitAndCheck(); + } + + public TextAreaLimit() { + setLayout(new BorderLayout()); + + text = new TextArea(); + add(text); + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < 40000; i++) { + buf.append(i + "\n"); + } + text.setText(buf.toString()); + text.setCaretPosition(buf.length()); + text.requestFocus(); + setSize(200, 200); + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaLineScrollWrapTest.java b/test/jdk/java/awt/TextArea/TextAreaLineScrollWrapTest.java new file mode 100644 index 000000000000..72ec7c08a6ce --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaLineScrollWrapTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 4776535 + * @summary Regression: line should not wrap around into multi lines in TextArea. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaLineScrollWrapTest + */ + +public class TextAreaLineScrollWrapTest { + private static final String INSTRUCTIONS = """ + You should see a frame "TextAreaLineScrollWrapTest" with + a TextArea that contains a very long line. + If the line is wrapped the test is failed. + + Insert a lot of text lines and move a caret to the last one. + If a caret hides and a content of the TextArea + does not scroll the test is failed + else the test is passed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaLineScrollWrapTest") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TextAreaLineScrollWrapTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame f = new Frame("TextAreaLineScrollWrapTest"); + f.add(new TextArea("long long long long long long long line...........", + 3, 4)); + f.setSize(100, 100); + return f; + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaScrollbarTest.java b/test/jdk/java/awt/TextArea/TextAreaScrollbarTest.java new file mode 100644 index 000000000000..ee61922fdb16 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaScrollbarTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.TextArea; + +/* + * @test + * @bug 4158997 + * @key headful + * @summary Make sure that the TextArea has both horizontal and + * vertical scrollbars when bad scrollbar arguments are passed + * into the constructor. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaScrollbarTest + */ + +public class TextAreaScrollbarTest { + private static final String INSTRUCTIONS = """ + Check to see that each TextArea has the specified + number and placement of scrollbars, i.e., both scrollbars, + horizontal only, vertical only, or no scrollbars at all. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaScrollbarTest") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(TestFrame::new) + .build() + .awaitAndCheck(); + } +} + +class TestFrame extends Frame { + private String both = "Both Scrollbars Both Scrollbars Both Scrollbars\n"; + private String horiz = "Horizontal Scrollbar Only Horizontal Scrollbar Only\n"; + private String vert = "Vertical Scrollbar Only Vertical Scrollbar Only\n"; + private String none = "No Scrollbars No Scrollbars No Scrollbars No Scrollbars\n"; + + public TestFrame() { + super("Test frame"); + + // sets a GridLayout w/ 2 columns and an unspecified # of rows + setLayout(new GridLayout(0, 2, 15, 5)); + + TextArea t1 = new TextArea(both + both + both + both + both + both, 3, 8, 0); + add(new Label("TA should have both scrollbars: arg = 0")); + add(t1); + + TextArea t2 = new TextArea(both + both + both + both + both + both, 3, 8, -1); + add(new Label("TA should have both scrollbars: arg = -1")); + add(t2); + + TextArea t3 = new TextArea(both + both + both + both + both + both, 3, 8, 4); + add(new Label("TA should have both scrollbars: arg = 4")); + add(t3); + + TextArea t4 = new TextArea(horiz + horiz + horiz + horiz + horiz + horiz, 3, 8, 2); + add(new Label("TA should have horizontal scrollbar: arg = 2")); + add(t4); + + TextArea t5 = new TextArea(vert + vert + vert + vert + vert + vert, 3, 8, 1); + add(new Label("TA should have vertical scrollbar: arg = 1")); + add(t5); + + TextArea t6 = new TextArea(none + none + none + none + none + none, 3, 8, 3); + add(new Label("TA should have no scrollbars: arg = 3")); + add(t6); + + TextArea t7 = new TextArea(); + t7.setText(both + both + both + both + both + both); + add(new Label("Both scrollbars: TextArea()")); + add(t7); + + TextArea t8 = new TextArea(both + both + both + both + both + both); + add(new Label("Both scrollbars: TextArea(String text)")); + add(t8); + + TextArea t9 = new TextArea(3, 8); + t9.setText(both + both + both + both + both + both); + add(new Label("Both scrollbars: TextArea(int rows, int columns)")); + add(t9); + + TextArea t10 = new TextArea(both + both + both + both + both + both, 3, 8); + add(new Label("Both scrollbars: TextArea(text, rows, columns)")); + add(t10); + + setSize(600, 600); + } +} + diff --git a/test/jdk/java/awt/TextArea/TextAreaSelectionTest.java b/test/jdk/java/awt/TextArea/TextAreaSelectionTest.java new file mode 100644 index 000000000000..ed6ccb34fa25 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaSelectionTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.TextArea; +import java.awt.TextField; + +/* + * @test + * @bug 4095946 + * @summary 592677:TEXTFIELD TAB SELECTION CONFUSING; REMOVE ES_NOHIDESEL STYLE IN + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextAreaSelectionTest + */ + +public class TextAreaSelectionTest { + private static final String INSTRUCTIONS = """ + Please look at the 'TextAreaSelectionTest' frame. + + If you see that the all TextFields and TextAreas have + the highlighted selections, the test FAILED. Else, if + you see that the text of the focused component is + highlighted, it is ok. + + Try to traverse the focus through all components by + pressing CTRL+TAB. If the focused component highlights + its selection, the test is passed for a while. + + Please select the entire/part of the text of some component + by mouse and choose some menu item. If the highlighted + selection is hidden, the test FAILED. + + Please select the entire/part of the text of some component + by mouse and click right mouse button. A context menu + should appear. Please check its items. + Press ESC to hide the context menu. If the selection + of the text component is not visible, the test FAILED. + + Please double click on the word 'DoubleClickMe' in the + first text area. If there are several words selected, the + test FAILED, if the word 'DoubleClickMe' is selected only, + the test PASSED! + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextAreaSelectionTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(TextAreaSelectionTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame f = new Frame("TextAreaSelectionTest"); + f.setLayout(new FlowLayout()); + + MenuBar mb = new MenuBar(); + String name = "Submenu"; + Menu m = new Menu(name, false); + m.add(new MenuItem(name + " item 1")); + m.add(new MenuItem(name + " item 2")); + m.add(new MenuItem(name + " item 3")); + mb.add(m); + + TextField tf1, tf2; + TextArea ta1, ta2; + f.setMenuBar(mb); + f.add(tf1 = new TextField("some text")); + f.add(tf2 = new TextField("more text")); + String eoln = System.getProperty("line.separator", "\n"); + f.add(ta1 = new TextArea("some text" + eoln + eoln + "DoubleClickMe")); + f.add(ta2 = new TextArea("more text")); + + tf1.selectAll(); + tf2.selectAll(); + ta1.selectAll(); + ta2.selectAll(); + + f.pack(); + return f; + } + +} diff --git a/test/jdk/java/awt/TextArea/TextScrollTest.java b/test/jdk/java/awt/TextArea/TextScrollTest.java new file mode 100644 index 000000000000..4a92391e7af5 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextScrollTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.TextArea; + +/* + * @test + * @bug 4127272 + * @summary TextArea displays head of text when scrolling horizontal bar. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TextScrollTest + */ + +public class TextScrollTest extends Frame { + private static final String INSTRUCTIONS = """ + 1. A TextArea whose content starts with the text ", + 'Scroll till the' will appear on the applet ", + 2. Use the Horizontal thumb button of the TextArea to view the entire", + content of the TextArea", + 3. While scrolling, if the text 'Scroll till the' appears repeatedly, Click Fail ", + else Click Pass" + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("TextScrollTest") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TextScrollTest::new) + .build() + .awaitAndCheck(); + } + + public TextScrollTest() { + this.setLayout(new BorderLayout()); + + Panel p = new Panel(); + TextArea ta = new TextArea("Scroll till the right end of the " + + "TextArea is reached. Action Done?\n", 10, 20); + + p.add(ta); + add("Center", p); + setSize(200, 200); + } +} diff --git a/test/jdk/java/awt/TextArea/WordWrappingTest.java b/test/jdk/java/awt/TextArea/WordWrappingTest.java new file mode 100644 index 000000000000..7309bc510082 --- /dev/null +++ b/test/jdk/java/awt/TextArea/WordWrappingTest.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.TextArea; + +/* + * @test + * @bug 4992455 + * @summary REGRESSION: TextArea does not wrap text in JDK 1.5 as JDK 1.4.x + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual WordWrappingTest +*/ + +public class WordWrappingTest { + private static final String INSTRUCTIONS = """ + Please look at the frame 'WordWrappingTest' + It contains two TextAreas that have text 'This text should be wrapped.' + One of them has a vertical scrollbar only. Another has no + scrollbars at all. + If their text is not wrapped at word boundaries and you partially see + mentioned text, the test failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("WordWrappingTest") + .instructions(INSTRUCTIONS) + .testUI(WordWrappingTest::createGUI) + .build() + .awaitAndCheck(); + } + + public static Frame createGUI() { + Frame f = new Frame("WordWrappingTest"); + f.setLayout(new FlowLayout()); + f.add(new TextArea("This text should be wrapped.", 5, 10, + TextArea.SCROLLBARS_VERTICAL_ONLY)); + f.add(new TextArea("This text should be wrapped.", 5, 10, + TextArea.SCROLLBARS_NONE)); + f.pack(); + return f; + } +} diff --git a/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java b/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java index 2cd05b08fc51..207954c521b6 100644 --- a/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java +++ b/test/jdk/java/awt/Toolkit/ScreenInsetsTest/ScreenInsetsTest.java @@ -24,7 +24,7 @@ /* * @test * @key headful - * @bug 8020443 6899304 4737732 + * @bug 8020443 6899304 4737732 8357390 * @summary Tests that Toolkit.getScreenInsets() returns correct insets * @library /test/lib * @build jdk.test.lib.Platform @@ -44,7 +44,7 @@ public class ScreenInsetsTest { private static final int SIZE = 100; // Allow a margin tolerance of 1 pixel due to scaling - private static final int MARGIN_TOLERANCE = 1; + private static final int MARGIN_TOLERANCE = 2; public static void main(String[] args) throws InterruptedException { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); diff --git a/test/jdk/java/awt/font/BoldItalicFontTest.java b/test/jdk/java/awt/font/BoldItalicFontTest.java new file mode 100644 index 000000000000..7fdefcfe2b52 --- /dev/null +++ b/test/jdk/java/awt/font/BoldItalicFontTest.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; + +/* + * @test + * @bug 4935871 + * @summary Check that correct type faces are used regardless of bold/italic styles + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual/othervm -Duser.language=ja -Duser.country=JP BoldItalicFontTest + */ + +public class BoldItalicFontTest { + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + This test is reproduced with a non-English user locale only. + All the letters "X" in the first line should be in serif font. + All the letters "X" in the second line should be in sans-serif font. + + If so, press Pass, else press Fail."""; + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(BoldItalicFontTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + String[] faces = { Font.SERIF, Font.SANS_SERIF }; + int[] styles = { 0, Font.BOLD, Font.ITALIC, Font.BOLD | Font.ITALIC }; + + Frame f = new Frame("BoldItalicFontTest Test UI"); + f.setLayout(new GridLayout(faces.length, styles.length)); + for (int fn = 0; fn < faces.length; fn++) { + for (int sn = 0; sn < styles.length; sn++) { + Label l = new Label("X"); + Font f1 = new Font(faces[fn], styles[sn], 36); + l.setFont(f1); + f.add(l); + } + } + f.setSize(300, 300); + return f; + } +} diff --git a/test/jdk/java/awt/font/GlyphVector/TestGlyphVectorLayout.java b/test/jdk/java/awt/font/GlyphVector/TestGlyphVectorLayout.java new file mode 100644 index 000000000000..b183b6526421 --- /dev/null +++ b/test/jdk/java/awt/font/GlyphVector/TestGlyphVectorLayout.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.font.GlyphVector; +import java.awt.font.FontRenderContext; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; + +import javax.swing.JPanel; + +/* + * @test + * @bug 4615017 + * @summary Display two GlyphVectors, and ensure they are of the same length. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestGlyphVectorLayout + */ + +public class TestGlyphVectorLayout extends JPanel { + private final Font font; + private final FontRenderContext frc; + private final String text; + + private GlyphVector aftergv; + private Rectangle pbounds; + private Rectangle2D vbounds; + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + Two lines of text should appear, the top one with boxes + (red and blue) around it. + The two lines should be of the same length, and the boxes around the + top line should 'fit' the text with no empty space between the end + of the text and the box. + + Pass the test if this is true."""; + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(TestGlyphVectorLayout::new) + .build() + .awaitAndCheck(); + } + + private TestGlyphVectorLayout() { + setBackground(Color.WHITE); + font = new Font(Font.DIALOG, Font.PLAIN, 24); + frc = new FontRenderContext(null, false, false); + text = "this is a test of glyph vector"; + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(550, 150); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + + float x = 50; + float y = 50; + AffineTransform oldtx = g2d.getTransform(); + g2d.translate(x, y); + g2d.scale(1.5, 1.5); + + g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_OFF); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + + g2d.setColor(Color.BLACK); + + GlyphVector gv = font.createGlyphVector(frc, text); // new each time + g2d.drawGlyphVector(gv, 0, 0); + + if (vbounds == null) { + vbounds = gv.getVisualBounds(); + pbounds = gv.getPixelBounds(g2d.getFontRenderContext(), 0, 0); + aftergv = gv; + } + g2d.drawGlyphVector(aftergv, 0, 30); + + g2d.setColor(Color.BLUE); + g2d.draw(vbounds); + + g2d.setTransform(oldtx); + g2d.setColor(Color.RED); + g2d.draw(pbounds); + } +} diff --git a/test/jdk/java/awt/font/GlyphVector/TestSetGlyphPositions.java b/test/jdk/java/awt/font/GlyphVector/TestSetGlyphPositions.java new file mode 100644 index 000000000000..f56d82143950 --- /dev/null +++ b/test/jdk/java/awt/font/GlyphVector/TestSetGlyphPositions.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.font.GlyphVector; +import java.awt.font.FontRenderContext; +import java.awt.geom.Point2D; + +import javax.swing.JPanel; + +/* + * @test + * @bug 4180379 + * @summary set the positions of glyphs in the GlyphVector to other than + * their default x, y positions, and verify that the rendered glyphs are + * in the new positions, not the default positions. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestSetGlyphPositions + */ + +public class TestSetGlyphPositions extends JPanel { + GlyphVector gv = null; + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + 'TopLeft text and >' should appear towards the top left of the frame, + and '< and BottomRight text' should appear towards the bottom right. + + There should be some space between the '>' and '<' symbols, both vertically + and horizontally. + + Pass the test if this is true."""; + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(TestSetGlyphPositions::new) + .build() + .awaitAndCheck(); + } + + public TestSetGlyphPositions() { + setBackground(Color.WHITE); + setSize(550, 150); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(550, 150); + } + + @Override + public void paint(Graphics g) { + super.paint(g); + Graphics2D g2d = (Graphics2D) g; + + if (gv == null) { + Font font = new Font(Font.DIALOG, Font.PLAIN, 36); + FontRenderContext frc = g2d.getFontRenderContext(); + String str = "TopLeft> 0 && args[0].equalsIgnoreCase("verbose")); + + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .rows(20) + .columns(50) + .testTimeOut(15) + .screenCapture() + .testUI(RotFontBoundsTest::createUI) + .build() + .awaitAndCheck(); + } + + private static final int ROTATIONS = 8; + + private static JComponent createUI() { + final RotatedTextBounds rotatedText = new RotatedTextBounds(); + + final JPanel checkBoxes = new JPanel(new FlowLayout(FlowLayout.CENTER, + 4, 4)); + checkBoxes.setBorder(createEmptyBorder(0, 8, 8, 8)); + for (int i = 0; i < ROTATIONS; i++) { + checkBoxes.add(new JCheckBox(new SelectRotationAction(i, rotatedText))); + } + + JButton selectAll = new JButton("Select All"); + selectAll.addActionListener( + e -> selectAllCheckBoxes(checkBoxes.getComponents(), true)); + selectAll.setMnemonic('S'); + + JButton clearAll = new JButton("Clear All"); + clearAll.addActionListener( + e -> selectAllCheckBoxes(checkBoxes.getComponents(), false)); + clearAll.setMnemonic('C'); + + Box controls = Box.createHorizontalBox(); + controls.add(new JLabel("Visible Rotations:")); + controls.add(Box.createHorizontalGlue()); + controls.add(selectAll); + controls.add(Box.createHorizontalStrut(4)); + controls.add(clearAll); + controls.setBorder(createEmptyBorder(8, 8, 0, 8)); + + Box controlPanel = Box.createVerticalBox(); + controlPanel.add(controls); + controlPanel.add(checkBoxes); + + Box javaVersion = Box.createHorizontalBox(); + javaVersion.setBorder(createEmptyBorder(8, 8, 8, 8)); + javaVersion.add(new JLabel("Java version: " + + System.getProperty("java.runtime.version"))); + javaVersion.add(Box.createHorizontalGlue()); + + Box main = Box.createVerticalBox(); + main.setName("Rotated TextLayout Test"); + main.add(controlPanel); + main.add(rotatedText); + main.add(javaVersion); + + return main; + } + + private static final class RotatedTextBounds extends JComponent { + private final Font font = new Font(Font.DIALOG, Font.PLAIN, 24); + + private final boolean[] rotationVisible = new boolean[ROTATIONS]; + + private RotatedTextBounds() { + setBackground(Color.WHITE); + setPreferredSize(new Dimension(400, 400)); + Arrays.fill(rotationVisible, true); + } + + public void setRotationVisible(int rotation, boolean visible) { + rotationVisible[rotation] = visible; + repaint(); + } + + // Counts the number of paints + private int counter = 0; + + @Override + public void paintComponent(Graphics _g) { + Graphics2D g = (Graphics2D) _g; + Dimension d = getSize(); + + g.setColor(getBackground()); + g.fillRect(0, 0, d.width, d.height); + + counter++; + int x = d.width / 2; + int y = d.height / 2; + FontRenderContext frc = g.getFontRenderContext(); + + for (int i = 0; i < ROTATIONS; i++) { + if (!rotationVisible[i]) { + continue; + } + + double angle = -Math.PI / 4.0 * i; + AffineTransform flip = AffineTransform.getRotateInstance(angle); + Font flippedFont = font.deriveFont(flip); + TextLayout tl = new TextLayout(TEXT, flippedFont, frc); + Rectangle2D bb = tl.getBounds(); + g.setPaint(Color.BLACK); + tl.draw(g, x, y); + g.setPaint(Color.RED); + g.drawRect(x + (int) bb.getX(), y + (int) bb.getY(), + (int) bb.getWidth(), (int) bb.getHeight()); + + if (verbose) { + if (counter == 1) { + printDetails(angle, tl); + } else if (i == 0) { + System.out.println("Paint, counter=" + counter); + } + } + } + } + + private static void printDetails(double angle, TextLayout tl) { + System.out.println("Angle: " + angle); + System.out.println("getAscent: " + tl.getAscent()); + System.out.println("getAdvance: " + tl.getAdvance()); + System.out.println("getBaseline: " + tl.getBaseline()); + System.out.println("getBounds: " + tl.getBounds()); + System.out.println("getDescent: " + tl.getDescent()); + System.out.println("getLeading: " + tl.getLeading()); + System.out.println("getVisibleAdvance: " + tl.getVisibleAdvance()); + System.out.println("."); + } + } + + private static final class SelectRotationAction + extends AbstractAction + implements PropertyChangeListener { + private final int rotation; + private final RotatedTextBounds rotatedText; + + private SelectRotationAction(int rotation, + RotatedTextBounds rotatedText) { + super(rotation * (360 / ROTATIONS) + "\u00B0"); + this.rotation = rotation; + this.rotatedText = rotatedText; + + putValue(SELECTED_KEY, true); + + addPropertyChangeListener(this); + } + + private void updateRotationVisible() { + rotatedText.setRotationVisible(rotation, + (Boolean) getValue(SELECTED_KEY)); + } + + @Override + public void actionPerformed(ActionEvent e) { + updateRotationVisible(); + } + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getPropertyName().equals(SELECTED_KEY)) { + updateRotationVisible(); + } + } + } + + private static void selectAllCheckBoxes(Component[] checkBoxes, + boolean visible) { + Arrays.stream(checkBoxes) + .forEach(c -> ((JCheckBox) c).setSelected(visible)); + } +} diff --git a/test/jdk/java/awt/font/TextLayout/TestControls.java b/test/jdk/java/awt/font/TextLayout/TestControls.java new file mode 100644 index 000000000000..ee15038a8459 --- /dev/null +++ b/test/jdk/java/awt/font/TextLayout/TestControls.java @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Panel; +import java.awt.ScrollPane; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; + +/* + * @test + * @bug 4517298 + * @summary Display special control characters using both TextLayout.draw and + * Graphics.drawString. In no case should a missing glyph appear. + * Also display the advance of the control characters, in all cases + * these should be 0. The space character is also displayed as a reference. + * Note, the character is rendered between '><' but owing to the directional + * properties of two of the characters, the second '<' is rendered as '>'. + * This is correct behavior. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestControls + */ + +public class TestControls { + private static String fontName = Font.DIALOG; + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + A number of control characters are displayed, one per line. + Each line displays the hex value of the character, the character + between '><' as rendered by TextLayout, the character between '><' + as rendered by drawString, and the advance of the character. + The first line renders the space character, as a reference. + The following lines all render the controls. + All controls should not render (even as space) and report a zero advance. + + Pass the test if this is true. + + Note: two of the control characters have the effect of changing the '<' + following the control character so that it renders as '>'. + This is not an error."""; + + PassFailJFrame.builder() + .title("TestControls Instruction") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(TestControls::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("TestControls Test UI"); + Panel panel = new ControlPanel(fontName); + ScrollPane sp = new ScrollPane(); + sp.add("Center", panel); + f.add(sp); + f.setSize(450, 400); + return f; + } + + static class ControlPanel extends Panel { + + static final char[] chars = { + (char)0x0020, (char)0x0009, + (char)0x000A, (char)0x000D, (char)0x200C, (char)0x200D, (char)0x200E, + (char)0x200F, (char)0x2028, (char)0x2029, (char)0x202A, (char)0x202B, + (char)0x202C, (char)0x202D, (char)0x202E, (char)0x206A, (char)0x206B, + (char)0x206C, (char)0x206D, (char)0x206E, (char)0x206F + }; + + ControlPanel(String fontName) { + Font font = new Font(fontName, Font.PLAIN, 24); + System.out.println("using font: " + font); + setFont(font); + setForeground(Color.BLACK); + setBackground(Color.WHITE); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(400, 750); + } + + @Override + public Dimension getMaximumSize() { + return getPreferredSize(); + } + + @Override + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D)g; + FontRenderContext frc = g2d.getFontRenderContext(); + Font font = g2d.getFont(); + FontMetrics fm = g2d.getFontMetrics(); + Insets insets = getInsets(); + + String jvmString = System.getProperty("java.version"); + String osString = System.getProperty("os.name") + " / " + + System.getProperty("os.arch") + " / " + + System.getProperty("os.version"); + + int x = insets.left + 10; + int y = insets.top; + + y += 30; + g2d.drawString("jvm: " + jvmString, x, y); + + y += 30; + g2d.drawString("os: " + osString, x, y); + + y += 30; + g2d.drawString("font: " + font.getFontName(), x, y); + + for (int i = 0; i < chars.length; ++i) { + String s = ">" + chars[i] + "<"; + x = insets.left + 10; + y += 30; + + g2d.drawString(Integer.toHexString(chars[i]), x, y); + x += 100; + + new TextLayout(s, font, frc).draw(g2d, x, y); + x += 100; + + g2d.drawString(s, x, y); + x += 100; + + g2d.drawString(Integer.toString(fm.charWidth(chars[i])), x, y); + } + } + } +} diff --git a/test/jdk/java/awt/font/TextLayout/TestGraphicOutline.java b/test/jdk/java/awt/font/TextLayout/TestGraphicOutline.java new file mode 100644 index 000000000000..42efd4185f4c --- /dev/null +++ b/test/jdk/java/awt/font/TextLayout/TestGraphicOutline.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Shape; +import java.awt.font.FontRenderContext; +import java.awt.font.GraphicAttribute; +import java.awt.font.ShapeGraphicAttribute; +import java.awt.font.TextAttribute; +import java.awt.font.TextLayout; +import java.awt.geom.Ellipse2D; +import java.awt.geom.Rectangle2D; +import java.text.AttributedCharacterIterator; +import java.text.AttributedString; + +import javax.swing.JPanel; + +/* + * @test + * @bug 4915565 4920820 4920952 + * @summary Display graphics (circles) embedded in text, and draw both the outline (top) + * and black box bounds (bottom) of the result. The circles should each display at a + * different height. The outline and frames should approximately (within a pixel + * or two) surround each character. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestGraphicOutline + */ + +public class TestGraphicOutline { + + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + Display graphics (circles) embedded in text, and draw both the + outline (top) and black box bounds (bottom) of the result. + + The circles should each display at a different height. + The outline and frames should approximately (within a pixel or two) + surround each character. + + Pass the test if these conditions hold. + + 'Black box bounds' is a term that refers to the bounding rectangles + of each glyph, see the TextLayout API getBlackBoxBounds. It does not + mean that the rendered outlines in the test are supposed to be black. + The color of the outlines does not matter and is not part of the test + conditions. Since there is no API for embedded graphics to return an + outline that matches the shape of the graphics, the outlines of the + graphics are their visual bounding boxes, which are rectangles. + + This is not an error. These outlines, as stated, should surround each + character's graphic."""; + + PassFailJFrame.builder() + .title("TestGraphicOutline Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TestGraphicsPanel::new) + .build() + .awaitAndCheck(); + } + + private static final class TestGraphicsPanel extends JPanel { + + TextLayout tl; + + public TestGraphicsPanel() { + setBackground(Color.white); + setPreferredSize(new Dimension(650, 300)); + setName("2D Text"); + } + + @Override + public void paint(Graphics g) { + Graphics2D g2 = (Graphics2D) g; + int w = getSize().width; + int h = getSize().height; + + g2.setColor(getBackground()); + g2.fillRect(0, 0, w, h); + + Font f1 = new Font(Font.SANS_SERIF, Font.BOLD, 60); + Font f2 = new Font(Font.SERIF, Font.ITALIC, 80); + String str = "The Starry Night ok?"; + + AttributedString ats = new AttributedString(str); + + Shape s = new Ellipse2D.Float(0, -10, 12, 12); + GraphicAttribute iga1 = new ShapeGraphicAttribute(s, GraphicAttribute.TOP_ALIGNMENT, false); + GraphicAttribute iga2 = new ShapeGraphicAttribute(s, GraphicAttribute.HANGING_BASELINE, false); + GraphicAttribute iga3 = new ShapeGraphicAttribute(s, GraphicAttribute.CENTER_BASELINE, false); + GraphicAttribute iga4 = new ShapeGraphicAttribute(s, GraphicAttribute.ROMAN_BASELINE, false); + GraphicAttribute iga5 = new ShapeGraphicAttribute(s, GraphicAttribute.BOTTOM_ALIGNMENT, false); + + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga1, 1, 2); + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga2, 3, 4); + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga3, 7, 8); + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga4, 10, 11); + ats.addAttribute(TextAttribute.CHAR_REPLACEMENT, iga5, 14, 15); + ats.addAttribute(TextAttribute.FONT, f1, 0, 20); + ats.addAttribute(TextAttribute.FONT, f2, 4, 10); + AttributedCharacterIterator iter = ats.getIterator(); + + FontRenderContext frc = g2.getFontRenderContext(); + tl = new TextLayout(iter, frc); + Rectangle2D bounds = tl.getBounds(); + float sw = (float) bounds.getWidth(); + float sh = (float) bounds.getHeight(); + + g2.translate((w - sw) / 2f, h / 2f - sh + tl.getAscent() - 2); + + g2.setColor(Color.blue); + tl.draw(g2, 0, 0); + g2.draw(bounds); + + g2.setColor(Color.black); + Shape shape = tl.getOutline(null); + g2.draw(shape); + + g2.translate(0, sh + 5); + + g2.setColor(Color.blue); + tl.draw(g2, 0, 0); + g2.draw(bounds); + + g2.setColor(Color.red); + shape = tl.getBlackBoxBounds(0, tl.getCharacterCount()); + g2.draw(shape); + } + } +} diff --git a/test/jdk/java/awt/print/PrinterJob/ImagePrinting/BitmaskImage.java b/test/jdk/java/awt/print/PrinterJob/ImagePrinting/BitmaskImage.java new file mode 100644 index 000000000000..f6a19fb20703 --- /dev/null +++ b/test/jdk/java/awt/print/PrinterJob/ImagePrinting/BitmaskImage.java @@ -0,0 +1,142 @@ +/* + * 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 + * 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 6444688 + * @key printer + * @summary Print an image with an IndexedColorModel with transparent pixel. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual BitmaskImage + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.awt.image.DataBuffer; +import java.awt.image.IndexColorModel; +import java.awt.print.PageFormat; +import java.awt.print.PrinterJob; +import java.awt.print.Printable; +import java.awt.print.PrinterException; + +import static java.awt.print.Printable.NO_SUCH_PAGE; +import static java.awt.print.Printable.PAGE_EXISTS; + +public class BitmaskImage implements Printable, ActionListener { + + static int sz = 1000; + BufferedImage bi; + + public BitmaskImage() { + int i = 0; + int[] cmap = new int[256]; + for (int r = 0; r < 256; r += 51) { + for (int g = 0; g < 256; g += 51) { + for (int b = 0; b < 256; b += 51) { + cmap[i++] = (0xff << 24) | (r << 16) | (g << 8) | b; + } + } + } + + IndexColorModel icm = new + IndexColorModel(8, 256, cmap, 0, true, 253, DataBuffer.TYPE_BYTE); + bi = new BufferedImage(sz, sz, BufferedImage.TYPE_BYTE_INDEXED, icm); + Graphics g = bi.getGraphics(); + Graphics2D g2d = (Graphics2D)g; + g.setColor(Color.white); + g.fillRect(0, 0, sz, sz); + g.setColor(Color.black); + int off = sz / 20; + int wh = sz / 10; + for (int x = off; x < sz; x += wh * 2) { + for (int y = off; y < sz; y += wh * 2) { + g.fillRect(x, y, wh, wh); + } + } + } + + public int print(Graphics g, PageFormat pf, int page) throws + PrinterException { + + if (page > 0) { /* We have only one page, and 'page' is zero-based */ + return NO_SUCH_PAGE; + } + + Graphics2D g2d = (Graphics2D)g; + AffineTransform tx = g2d.getTransform(); + double sx = tx.getScaleX(); + double sy = tx.getScaleY(); + g2d.translate(pf.getImageableX(), pf.getImageableY()); + g2d.scale(1/sx, 1/sx); + g.drawImage(bi, 10, 10, null); + + /* tell the caller that this page is part of the printed document */ + return PAGE_EXISTS; + } + + public void actionPerformed(ActionEvent e) { + PrinterJob job = PrinterJob.getPrinterJob(); + job.setPrintable(this); + boolean ok = job.printDialog(); + if (ok) { + try { + job.print(); + } catch (PrinterException ex) { + /* The job did not successfully complete */ + } + } + System.out.println("done"); + } + + static String INSTRUCTIONS = """ + Press the "Print Simple ICM Image" button and if a printer is available, + choose one in the dialog and click OK to start printing. + This test will print an image which contains a grid of black squares. + If it prints so, press Pass otherwise press Fail."""; + + public static Frame initTest() { + Frame f = new Frame("Image Printer"); + Button printButton = new Button("Print Simple ICM image..."); + printButton.addActionListener(new BitmaskImage()); + f.add(printButton); + f.pack(); + return f; + } + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .testUI(BitmaskImage::initTest) + .columns(35) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/print/PrinterJob/PageDialogTest.java b/test/jdk/java/awt/print/PrinterJob/PageDialogTest.java index eea118733de4..ed02c64b48eb 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageDialogTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PageDialogTest.java @@ -22,11 +22,12 @@ */ /* - @test - @bug 6302514 - @key printer - @run main/manual PageDialogTest - @summary A toolkit modal dialog should not be blocked by Page/Print dialog. + * @test + * @bug 6302514 + * @key printer + * @requires (os.family != "mac") + * @run main/manual PageDialogTest + * @summary A toolkit modal dialog should not be blocked by Page/Print dialog. */ import java.awt.BorderLayout; diff --git a/test/jdk/java/awt/print/PrinterJob/PageRanges.java b/test/jdk/java/awt/print/PrinterJob/PageRanges.java index accde99ae956..c5d05cbce354 100644 --- a/test/jdk/java/awt/print/PrinterJob/PageRanges.java +++ b/test/jdk/java/awt/print/PrinterJob/PageRanges.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,58 +21,63 @@ * questions. */ -/** +/* * @test - * @bug 6575331 + * @bug 6575331 8297191 8373239 8378417 * @key printer * @summary The specified pages should be printed. - * @run main/manual=yesno PageRanges + * @library /java/awt/regtesthelpers + * @library /test/lib + * @build PassFailJFrame + * @build jtreg.SkippedException + * @run main/manual PageRanges */ -import java.awt.*; -import java.awt.print.*; +import java.awt.Graphics; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import jtreg.SkippedException; public class PageRanges implements Printable { - - static String[] instr = { - "This test prints two jobs, and tests that the specified range", - "of pages is printed. You must have a printer installed for this test.", - "In the first dialog, select a page range of 2 to 3, and press OK", - "In the second dialog, select ALL, to print all pages (in total 5 pages).", - "Collect the two print outs and confirm the jobs printed correctly", - }; + private static final String INSTRUCTIONS = """ + This test prints two jobs and tests that the specified range + of pages is printed. + In the first dialog, select a page range of 2 to 3, and press OK. + In the second dialog, select ALL, to print all pages (in total 5 pages). + Collect the two print outs and confirm the jobs are printed correctly. + """; public static void main(String args[]) throws Exception { - for (int i=0;i= 5) { return NO_SUCH_PAGE; } g.drawString("Page : " + (pi+1), 200, 200); - return PAGE_EXISTS; } } diff --git a/test/jdk/java/awt/print/PrinterJob/PageRangesAuto.java b/test/jdk/java/awt/print/PrinterJob/PageRangesAuto.java new file mode 100644 index 000000000000..8d50ef9c2c22 --- /dev/null +++ b/test/jdk/java/awt/print/PrinterJob/PageRangesAuto.java @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2007, 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Font; +import java.awt.Graphics; +import java.awt.print.PageFormat; +import java.awt.print.Pageable; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.BitSet; +import java.util.List; +import java.util.stream.IntStream; + +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.standard.Destination; +import javax.print.attribute.standard.PageRanges; + +/* + * @test + * @bug 6575331 8297191 + * @key printer + * @summary Automatically verifies all the pages in a range are printed + * @run main PageRangesAuto + */ +public class PageRangesAuto implements Pageable, Printable { + + private static final Font font = new Font(Font.SERIF, Font.PLAIN, 50); + + private static final int MAX_PAGE = 10; + + private static final int[][] ranges = { + {1, 1}, + {1, MAX_PAGE}, + {2, 3}, + {3, 6}, + {4, 7}, + {7, 7}, + {9, MAX_PAGE}, + {MAX_PAGE, MAX_PAGE}, + }; + + private enum Type { + PRINTABLE, + PAGEABLE + } + + private final BitSet printedPages = new BitSet(); + + /** + * Configures a printer job and prints it. + * @param type the type of the interface tested + * ({@code Printable} or {@code Pageable}) + * @param pageRange the range of pages to print; + * if {@code null}, print all pages + * @return a bit set of printed page numbers + */ + private static BitSet printJob(final Type type, + final PageRanges pageRange) + throws PrinterException { + final PageRangesAuto test = new PageRangesAuto(); + + final PrinterJob job = PrinterJob.getPrinterJob(); + final String baseName = type.name().toLowerCase(); + + switch (type) { + case PRINTABLE -> job.setPrintable(test); + case PAGEABLE -> job.setPageable(test); + } + + String fileName = pageRange == null + ? baseName + "-all.pdf" + : String.format("%s-%d-%d.pdf", + baseName, + pageRange.getMembers()[0][0], + pageRange.getMembers()[0][1]); + + PrintRequestAttributeSet set = new HashPrintRequestAttributeSet(); + set.add(new Destination(new File(fileName) + .toURI())); + if (pageRange != null) { + set.add(pageRange); + } + + job.print(set); + + return test.printedPages; + } + + public static void main(String[] args) throws Exception { + final List errors = new ArrayList<>(); + + for (Type type : Type.values()) { + BitSet pages; // Printed pages + + // Print all pages + System.out.println(type + " - all pages"); + pages = printJob(type, null); + if (!IntStream.range(0, MAX_PAGE) + .allMatch(pages::get)) { + errors.add(new Error("Not all pages printed in " + type + ": " + + pages)); + } + + // Print page range + for (int[] range : ranges) { + System.out.println(type + " - " + Arrays.toString(range)); + pages = printJob(type, new PageRanges(range[0], range[1])); + if (!IntStream.range(range[0] - 1, range[1]) + .allMatch(pages::get)) { + errors.add(new Error("Not all pages printed in " + type + + " within the range " + + Arrays.toString(range) + + ": " + pages)); + } + } + } + + if (!errors.isEmpty()) { + errors.forEach(System.err::println); + throw new RuntimeException("Errors detected: " + errors.size() + + ". - " + errors.getFirst()); + } + } + + @Override + public int print(Graphics g, PageFormat format, int pageIndex) + throws PrinterException { + printedPages.set(pageIndex); + + final int pageNo = pageIndex + 1; + System.out.println(" test.printPage " + pageNo); + if (pageIndex >= MAX_PAGE) { + return NO_SUCH_PAGE; + } + + g.setFont(font); + g.drawString("Page: " + pageNo, + 100, 150); + + return PAGE_EXISTS; + } + + @Override + public int getNumberOfPages() { + System.out.println(" test.getNumberOfPages = " + MAX_PAGE); + return MAX_PAGE; + } + + @Override + public PageFormat getPageFormat(int pageIndex) + throws IndexOutOfBoundsException { + checkPageIndex(pageIndex); + return new PageFormat(); + } + + @Override + public Printable getPrintable(int pageIndex) + throws IndexOutOfBoundsException { + checkPageIndex(pageIndex); + System.out.println(" test.getPrintable(" + (pageIndex + 1) + ")"); + return this; + } + + private static void checkPageIndex(int pageIndex) + throws IndexOutOfBoundsException { + if (pageIndex < 0) { + throw new IndexOutOfBoundsException("pageIndex < 0"); + } + + if (pageIndex >= MAX_PAGE) { + throw new IndexOutOfBoundsException("pageIndex >= " + MAX_PAGE); + } + } +} diff --git a/test/jdk/java/awt/print/PrinterJob/PolylinePrintingTest.java b/test/jdk/java/awt/print/PrinterJob/PolylinePrintingTest.java index 7d8568c01f98..c9dcdfdd450f 100644 --- a/test/jdk/java/awt/print/PrinterJob/PolylinePrintingTest.java +++ b/test/jdk/java/awt/print/PrinterJob/PolylinePrintingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,31 +21,56 @@ * questions. */ -/** +/* + * @test * @bug 8041902 * @key printer * @summary Test printing of wide poly lines. - * @run main/manual=yesno PolylinePrintingTest + * @library /java/awt/regtesthelpers + * @library /test/lib + * @build PassFailJFrame + * @build jtreg.SkippedException + * @run main/manual PolylinePrintingTest */ -import java.awt.Dialog; -import java.awt.Frame; -import java.awt.TextArea; import java.awt.BasicStroke; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Path2D; 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 jtreg.SkippedException; public class PolylinePrintingTest implements Printable { + private static final String INSTRUCTIONS = """ + Press OK in the print dialog and collect the printed page. + Passing test : Output should show two identical chevrons. + Failing test : The line joins will appear different. + """; + + public static void main(String[] args) throws Exception { + PrinterJob job = PrinterJob.getPrinterJob(); + if (job.getPrintService() == null) { + throw new SkippedException("Printer not configured or available."); + } + + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(45) + .build(); + + job.setPrintable(new PolylinePrintingTest()); + if (job.printDialog()) { + job.print(); + } + + passFailJFrame.awaitAndCheck(); + } public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { - if (pageIndex > 0) { return NO_SUCH_PAGE; } @@ -66,7 +91,6 @@ public int print(Graphics graphics, PageFormat pageFormat, private void drawPolylineGOOD(Graphics2D g2d, int[] x2Points, int[] y2Points) { - Path2D polyline = new Path2D.Float(Path2D.WIND_EVEN_ODD, x2Points.length); @@ -83,141 +107,4 @@ private void drawPolylineBAD(Graphics2D g, int[] xp, int[] yp) { g.translate(0, offset); g.drawPolyline(xp, yp, xp.length); } - - public PolylinePrintingTest() throws PrinterException { - PrinterJob job = PrinterJob.getPrinterJob(); - PageFormat pf = job.defaultPage(); - Paper p = pf.getPaper(); - p.setImageableArea(0,0,p.getWidth(), p.getHeight()); - pf.setPaper(p); - job.setPrintable(this, pf); - if (job.printDialog()) { - job.print(); - } - } - - public static void main(String[] args) throws PrinterException { - String[] instructions = { - "You must have a printer available to perform this test.", - "OK the print dialog, and collect the printed page.", - "Passing test : Output should show two identical chevrons.", - "Failing test : The line joins will appear different." - }; - Sysout.createDialog(); - Sysout.printInstructions(instructions); - new PolylinePrintingTest(); - } } - -class Sysout { - private static TestDialog dialog; - - public static void createDialogWithInstructions( String[] instructions ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - dialog.printInstructions( instructions ); - dialog.show(); - println( "Any messages for the tester will display here." ); - } - - public static void createDialog( ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - String[] defInstr = { "Instructions will appear here. ", "" } ; - dialog.printInstructions( defInstr ); - dialog.show(); - println( "Any messages for the tester will display here." ); - } - - - public static void printInstructions( String[] instructions ) - { - dialog.printInstructions( instructions ); - } - - - public static void println( String messageIn ) - { - dialog.displayMessage( messageIn ); - } - -}// Sysout class - -/** - This is part of the standard test machinery. It provides a place for the - test instructions to be displayed, and a place for interactive messages - to the user to be displayed. - To have the test instructions displayed, see Sysout. - To have a message to the user be displayed, see Sysout. - Do not call anything in this dialog directly. - */ -class TestDialog extends Dialog { - TextArea instructionsText; - TextArea messageText; - int maxStringLength = 80; - - //DO NOT call this directly, go through Sysout - public TestDialog( Frame frame, String name ) - { - super( frame, name ); - int scrollBoth = TextArea.SCROLLBARS_BOTH; - instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); - add( "North", instructionsText ); - - messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); - add("Center", messageText); - - pack(); - - show(); - }// TestDialog() - - //DO NOT call this directly, go through Sysout - public void printInstructions( String[] instructions ) - { - //Clear out any current instructions - instructionsText.setText( "" ); - - //Go down array of instruction strings - - String printStr, remainingStr; - for( int i=0; i < instructions.length; i++ ) - { - //chop up each into pieces maxSringLength long - remainingStr = instructions[ i ]; - while( remainingStr.length() > 0 ) - { - //if longer than max then chop off first max chars to print - if( remainingStr.length() >= maxStringLength ) - { - //Try to chop on a word boundary - int posOfSpace = remainingStr. - lastIndexOf( ' ', maxStringLength - 1 ); - if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; - - printStr = remainingStr.substring( 0, posOfSpace + 1 ); - remainingStr = remainingStr.substring( posOfSpace + 1 ); - } - //else just print - else - { - printStr = remainingStr; - remainingStr = ""; - } - - instructionsText.append( printStr + "\n" ); - - }// while - - }// for - - }//printInstructions() - - //DO NOT call this directly, go through Sysout - public void displayMessage( String messageIn ) - { - messageText.append( messageIn + "\n" ); - } - -}// TestDialog class - diff --git a/test/jdk/java/awt/print/PrinterJob/SwingUIText.java b/test/jdk/java/awt/print/PrinterJob/SwingUIText.java index 5fcd5e391581..6ef5064fc306 100644 --- a/test/jdk/java/awt/print/PrinterJob/SwingUIText.java +++ b/test/jdk/java/awt/print/PrinterJob/SwingUIText.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,44 +21,70 @@ * questions. */ -/** +/* * @test * @bug 6488219 6560738 7158350 8017469 * @key printer * @summary Test that text printed in Swing UI measures and looks OK. - * @run main/manual=yesno PrintTextTest + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException + * @run main/manual SwingUIText */ -import java.awt.*; -import javax.swing.*; -import java.awt.print.*; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterJob; +import javax.swing.JButton; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import jtreg.SkippedException; public class SwingUIText implements Printable { + private static JFrame frame; + private static final String INSTRUCTIONS = """ + This test checks that when a Swing UI is printed, + the text in each component aligns with the component’s length as seen on-screen. + It also ensures the text spacing is reasonably even, though this is subjective. + The comparison should be made with JDK 1.5 GA or JDK 1.6 GA. + + Steps: + 1. Press the "Print" or "OK" button on the Print dialog. + This will print the content of the "Swing UI Text Printing Test" JFrame. + 2. Compare the printout with the content of the JFrame. + 3. If they match, press Pass; otherwise, press Fail. + """; + + public static void main(String args[]) throws Exception { + PrinterJob job = PrinterJob.getPrinterJob(); + if (job.getPrintService() == null) { + throw new SkippedException("Printer not configured or available."); + } - static String[] instructions = { - "This tests that when a Swing UI is printed, that the text", - "in each component properly matches the length of the component", - "as seen on-screen, and that the spacing of the text is of", - "reasonable even-ness. This latter part is very subjective and", - "the comparison has to be with JDK1.5 GA, or JDK 1.6 GA", - }; + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(SwingUIText::createTestUI) + .build(); - static JFrame frame; + job.setPrintable(new SwingUIText()); + if (job.printDialog()) { + job.print(); + } - public static void main(String args[]) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - createUI(); - } - }); + passFailJFrame.awaitAndCheck(); } - public static void createUI() { - - Sysout.createDialogWithInstructions(instructions); - + public static JFrame createTestUI() { + frame = new JFrame(); JPanel panel = new JPanel(); - panel.setLayout(new GridLayout(4,1)); + panel.setLayout(new GridLayout(4, 1)); String text = "marvelous suspicious solving"; displayText(panel, text); @@ -89,24 +115,12 @@ public static void createUI() { frame = new JFrame("Swing UI Text Printing Test"); frame.getContentPane().add(panel); frame.pack(); - frame.setVisible(true); - - PrinterJob job = PrinterJob.getPrinterJob(); - PageFormat pf = job.defaultPage(); - job.setPrintable(new SwingUIText(), pf); - if (job.printDialog()) { - try { job.print(); } - catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } + return frame; } - static void displayText(JPanel p, String text) { JPanel panel = new JPanel(); - panel.setLayout(new GridLayout(2,1)); + panel.setLayout(new GridLayout(2, 1)); JPanel row = new JPanel(); Font font = new Font("Dialog", Font.PLAIN, 12); @@ -114,7 +128,7 @@ static void displayText(JPanel p, String text) { label.setFont(font); row.add(label); - JButton button = new JButton("Print "+text); + JButton button = new JButton("Print " + text); button.setMnemonic('P'); button.setFont(font); row.add(button); @@ -133,132 +147,14 @@ static void displayText(JPanel p, String text) { p.add(panel); } - public int print(Graphics g, PageFormat pf, int pageIndex) - throws PrinterException { - + public int print(Graphics g, PageFormat pf, int pageIndex) { if (pageIndex >= 1) { return Printable.NO_SUCH_PAGE; } + g.translate((int)pf.getImageableX(), (int)pf.getImageableY()); frame.printAll(g); - return Printable.PAGE_EXISTS; } } - -class Sysout - { - private static TestDialog dialog; - - public static void createDialogWithInstructions( String[] instructions ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - dialog.printInstructions( instructions ); - dialog.show(); - println( "Any messages for the tester will display here." ); - } - - public static void createDialog( ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - String[] defInstr = { "Instructions will appear here. ", "" } ; - dialog.printInstructions( defInstr ); - dialog.show(); - println( "Any messages for the tester will display here." ); - } - - - public static void printInstructions( String[] instructions ) - { - dialog.printInstructions( instructions ); - } - - - public static void println( String messageIn ) - { - dialog.displayMessage( messageIn ); - } - - }// Sysout class - -/** - This is part of the standard test machinery. It provides a place for the - test instructions to be displayed, and a place for interactive messages - to the user to be displayed. - To have the test instructions displayed, see Sysout. - To have a message to the user be displayed, see Sysout. - Do not call anything in this dialog directly. - */ -class TestDialog extends Dialog - { - - TextArea instructionsText; - TextArea messageText; - int maxStringLength = 80; - - //DO NOT call this directly, go through Sysout - public TestDialog( Frame frame, String name ) - { - super( frame, name ); - int scrollBoth = TextArea.SCROLLBARS_BOTH; - instructionsText = new TextArea( "", 10, maxStringLength, scrollBoth ); - add( "North", instructionsText ); - - messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); - add("South", messageText); - - pack(); - - show(); - }// TestDialog() - - //DO NOT call this directly, go through Sysout - public void printInstructions( String[] instructions ) - { - //Clear out any current instructions - instructionsText.setText( "" ); - - //Go down array of instruction strings - - String printStr, remainingStr; - for( int i=0; i < instructions.length; i++ ) - { - //chop up each into pieces maxSringLength long - remainingStr = instructions[ i ]; - while( remainingStr.length() > 0 ) - { - //if longer than max then chop off first max chars to print - if( remainingStr.length() >= maxStringLength ) - { - //Try to chop on a word boundary - int posOfSpace = remainingStr. - lastIndexOf( ' ', maxStringLength - 1 ); - - if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; - - printStr = remainingStr.substring( 0, posOfSpace + 1 ); - remainingStr = remainingStr.substring( posOfSpace + 1 ); - } - //else just print - else - { - printStr = remainingStr; - remainingStr = ""; - } - - instructionsText.append( printStr + "\n" ); - - }// while - - }// for - - }//printInstructions() - - //DO NOT call this directly, go through Sysout - public void displayMessage( String messageIn ) - { - messageText.append( messageIn + "\n" ); - } - -}// TestDialog class diff --git a/test/jdk/java/io/FileDescriptor/Sharing.java b/test/jdk/java/io/FileDescriptor/Sharing.java index 24f4fb70b02b..e4ceb2d69065 100644 --- a/test/jdk/java/io/FileDescriptor/Sharing.java +++ b/test/jdk/java/io/FileDescriptor/Sharing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,14 @@ * @run main/othervm Sharing */ -import java.io.*; +import java.io.File; +import java.io.FileDescriptor; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.io.Writer; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import java.util.concurrent.CountDownLatch; @@ -71,7 +78,7 @@ private static void TestFinalizer() throws Exception { // encourage gc System.gc(); // read from fis2 - when fis1 is gc'ed and finalizer is run, read will fail - System.out.print("."); + System.err.print("."); ret = fis2.read(); } } @@ -93,7 +100,7 @@ private static void TestFinalizer() throws Exception { * read from fis3 - when raf is gc'ed and finalizer is run, * fd should still be valid. */ - System.out.print("."); + System.err.print("."); ret = fis3.read(); } } finally { @@ -290,7 +297,7 @@ private static void TestCloseAll() throws Exception { FileInputStream fis = new FileInputStream(raf.getFD()); fis.close(); if (raf.getFD().valid()) { - throw new RuntimeException("FD should not be valid."); + throw new RuntimeException("FD should not be valid."); } // Test the suppressed exception handling - FileInputStream @@ -308,7 +315,7 @@ private static void TestCloseAll() throws Exception { ioe.printStackTrace(); if (ioe.getSuppressed().length != 2) { throw new RuntimeException("[FIS]Incorrect number of suppressed " + - "exceptions received : " + ioe.getSuppressed().length); + "exceptions received : " + ioe.getSuppressed().length); } } if (raf.getFD().valid()) { @@ -332,7 +339,7 @@ private static void TestCloseAll() throws Exception { ioe.printStackTrace(); if (ioe.getSuppressed().length != 2) { throw new RuntimeException("[FOS]Incorrect number of suppressed " + - "exceptions received : " + ioe.getSuppressed().length); + "exceptions received : " + ioe.getSuppressed().length); } } if (raf.getFD().valid()) { @@ -347,10 +354,8 @@ private static void TestCloseAll() throws Exception { * FileOutputStreams referencing the same native file descriptor. */ private static class OpenClose extends Thread { - private FileDescriptor fd = null; - private CountDownLatch done; - FileInputStream[] fisArray = new FileInputStream[numFiles]; - FileOutputStream[] fosArray = new FileOutputStream[numFiles]; + private final FileDescriptor fd; + private final CountDownLatch done; OpenClose(FileDescriptor filedescriptor, CountDownLatch done) { this.fd = filedescriptor; @@ -358,29 +363,32 @@ private static class OpenClose extends Thread { } public void run() { - try { - for(int i=0;i clazz, Object expectedXValue) throws Exception { @@ -93,7 +97,7 @@ public void testWithDifferentTypes(Class clazz, Object expectedXValue) Object obj = deserialize(bytes); out.println("deserialized: " + obj); Object actualXValue = clazz.getDeclaredMethod("x").invoke(obj); - assertEquals(actualXValue, expectedXValue); + assertEquals(expectedXValue, actualXValue); } // --- all together @@ -108,18 +112,18 @@ public void testWithAllTogether() throws Exception { R15 obj = (R15)deserialize(bytes); out.println("deserialized: " + obj); - assertEquals(obj.a, false); - assertEquals(obj.b, 0); - assertEquals(obj.c, 0); - assertEquals(obj.d, '\u0000'); - assertEquals(obj.e, 0); - assertEquals(obj.f, 0l); - assertEquals(obj.g, 0f); - assertEquals(obj.h, 0d); - assertEquals(obj.i, null); - assertEquals(obj.j, null); - assertEquals(obj.k, null); - assertEquals(obj.l, null); + assertEquals(false, obj.a); + assertEquals(0, obj.b); + assertEquals(0, obj.c); + assertEquals('\u0000', obj.d); + assertEquals(0, obj.e); + assertEquals(0l, obj.f); + assertEquals(0f, obj.g); + assertEquals(0d, obj.h); + assertEquals(null, obj.i); + assertEquals(null, obj.j); + assertEquals(null, obj.k); + assertEquals(null, obj.l); } // --- generic type @@ -133,8 +137,8 @@ public void testGenericType() throws Exception { R16 obj = (R16)deserialize(bytes); out.println("deserialized: " + obj); - assertEquals(obj.t, null); - assertEquals(obj.u, null); + assertEquals(null, obj.t); + assertEquals(null, obj.u); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java b/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java index 8b0a1ae625bc..2d3ec8ce4ecf 100644 --- a/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java +++ b/test/jdk/java/io/Serializable/records/BadCanonicalCtrTest.java @@ -28,7 +28,7 @@ * cannot be found during deserialization. * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm - * @run testng BadCanonicalCtrTest + * @run junit BadCanonicalCtrTest */ import java.io.ByteArrayInputStream; @@ -44,20 +44,23 @@ import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.ByteCodeLoader; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; import static jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES; import static jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_MAXS; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Checks that an InvalidClassException is thrown when the canonical * constructor cannot be found during deserialization. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class BadCanonicalCtrTest { // ClassLoader for creating instances of the records to test with. @@ -74,7 +77,7 @@ public class BadCanonicalCtrTest { * the initial bytecode for the record classes using javac, then removes or * modifies the generated canonical constructor. */ - @BeforeTest + @BeforeAll public void setup() { { byte[] byteCode = InMemoryJavaCompiler.compile("R1", @@ -131,7 +134,6 @@ Object newR3(long l) throws Exception { return c.getConstructor(long.class).newInstance(l); } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() throws Exception { return new Object[][] { new Object[] { newR1() }, @@ -146,13 +148,14 @@ public Object[][] recordInstances() throws Exception { * Tests that InvalidClassException is thrown when no constructor is * present. */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void missingConstructorTest(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); byte[] bytes = serialize(objToSerialize); out.println("deserializing"); - InvalidClassException ice = expectThrows(ICE, () -> deserialize(bytes, missingCtrClassLoader)); + InvalidClassException ice = Assertions.assertThrows(ICE, () -> deserialize(bytes, missingCtrClassLoader)); out.println("caught expected ICE: " + ice); assertTrue(ice.getMessage().contains("record canonical constructor not found")); } @@ -162,13 +165,14 @@ public void missingConstructorTest(Object objToSerialize) throws Exception { * constructor is not present. ( a non-canonical constructor is * present ). */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void nonCanonicalConstructorTest(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); byte[] bytes = serialize(objToSerialize); out.println("deserializing"); - InvalidClassException ice = expectThrows(ICE, () -> deserialize(bytes, nonCanonicalCtrClassLoader)); + InvalidClassException ice = Assertions.assertThrows(ICE, () -> deserialize(bytes, nonCanonicalCtrClassLoader)); out.println("caught expected ICE: " + ice); assertTrue(ice.getMessage().contains("record canonical constructor not found")); } diff --git a/test/jdk/java/io/Serializable/records/BadValues.java b/test/jdk/java/io/Serializable/records/BadValues.java index 4e3dbaa200f8..9d5e0c7be827 100644 --- a/test/jdk/java/io/Serializable/records/BadValues.java +++ b/test/jdk/java/io/Serializable/records/BadValues.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @summary Basic test for ClassNotFoundException - * @run testng BadValues + * @run junit BadValues */ import java.io.ByteArrayInputStream; @@ -32,10 +32,11 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.ObjectInputStream; -import org.testng.annotations.Test; import static java.io.ObjectStreamConstants.*; import static java.lang.System.out; -import static org.testng.Assert.*; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; /** * Not directly related to records but provokes surrounding code, and ensures @@ -73,7 +74,7 @@ static byte[] byteStreamFor(String className, long uid, byte flags) public void testNotFoundSer() throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor("XxYyZz", 0L, (byte)SC_SERIALIZABLE); - Throwable t = expectThrows(CNFE, () -> deserialize(bytes)); + Throwable t = assertThrows(CNFE, () -> deserialize(bytes)); out.println("caught expected CNFE: " + t); } @@ -81,7 +82,7 @@ public void testNotFoundSer() throws Exception { public void testNotFoundSerWr() throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor("XxYyZz", 0L, (byte)(SC_SERIALIZABLE | SC_WRITE_METHOD)); - Throwable t = expectThrows(CNFE, () -> deserialize(bytes)); + Throwable t = assertThrows(CNFE, () -> deserialize(bytes)); out.println("caught expected CNFE: " + t); } @@ -89,7 +90,7 @@ public void testNotFoundSerWr() throws Exception { public void testNotFoundExt() throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor("AaBbCc", 0L, (byte)SC_EXTERNALIZABLE); - Throwable t = expectThrows(CNFE, () -> deserialize(bytes)); + Throwable t = assertThrows(CNFE, () -> deserialize(bytes)); out.println("caught expected CNFE: " + t); } @@ -97,7 +98,7 @@ public void testNotFoundExt() throws Exception { public void testNotFoundExtWr() throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor("AaBbCc", 0L, (byte)(SC_SERIALIZABLE | SC_WRITE_METHOD)); - Throwable t = expectThrows(CNFE, () -> deserialize(bytes)); + Throwable t = assertThrows(CNFE, () -> deserialize(bytes)); out.println("caught expected CNFE: " + t); } diff --git a/test/jdk/java/io/Serializable/records/BasicRecordSer.java b/test/jdk/java/io/Serializable/records/BasicRecordSer.java index ee50f630351e..81e54b39c100 100644 --- a/test/jdk/java/io/Serializable/records/BasicRecordSer.java +++ b/test/jdk/java/io/Serializable/records/BasicRecordSer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic test that serializes and deserializes a number of records - * @run testng BasicRecordSer - * @run testng/othervm/java.security.policy=empty_security.policy BasicRecordSer + * @run junit BasicRecordSer + * @run junit/othervm/java.security.policy=empty_security.policy BasicRecordSer */ import java.io.ByteArrayInputStream; @@ -40,19 +40,24 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.math.BigInteger; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.String.format; import static java.lang.System.out; import static java.net.InetAddress.getLoopbackAddress; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; -import static org.testng.Assert.fail; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Basic test that serializes and deserializes a number of simple records. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class BasicRecordSer { // a mix of a few record and non-record classes @@ -102,7 +107,6 @@ record Wobble (Foo foo) implements ThrowingExternalizable { } record Wubble (Wobble wobble, Wibble wibble, String s) implements ThrowingExternalizable { } - @DataProvider(name = "serializable") public Object[][] serializable() { Foo foo = new Foo(23); return new Object[][] { @@ -122,14 +126,20 @@ public Object[][] serializable() { } /** Tests serializing and deserializing a number of records. */ - @Test(dataProvider = "serializable") + @ParameterizedTest + @MethodSource("serializable") public void testSerializable(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); var objDeserialized = serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); - assertEquals(objDeserialized, objToSerialize); + if (objToSerialize.getClass().isArray()) { + assertArrayEquals((Object[]) objDeserialized, (Object[]) objToSerialize); + assertArrayEquals((Object[]) objToSerialize, (Object[]) objDeserialized); + } else { + assertEquals(objDeserialized, objToSerialize); + assertEquals(objToSerialize, objDeserialized); + } } /** Tests serializing and deserializing of local records. */ @@ -155,8 +165,8 @@ public void testSerializableBackRefs() throws Exception { out.println("serializing : " + objToSerialize); Foo[] objDeserialized = (Foo[])serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); - assertEquals(objDeserialized, objToSerialize); + Assertions.assertArrayEquals(objDeserialized, objToSerialize); + Assertions.assertArrayEquals(objToSerialize, objDeserialized); for (Foo f : objDeserialized) assertTrue(objDeserialized[0] == f); @@ -172,8 +182,8 @@ public void testExternalizableBackRefs() throws Exception { out.println("serializing : " + objToSerialize); Wobble[] objDeserialized = (Wobble[])serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); - assertEquals(objDeserialized, objToSerialize); + Assertions.assertArrayEquals(objDeserialized, objToSerialize); + Assertions.assertArrayEquals(objToSerialize, objDeserialized); for (Wobble w : objDeserialized) { assertTrue(objDeserialized[0] == w); @@ -193,7 +203,6 @@ static class A implements Serializable { final NotSer notSer = new NotSer(7); } - @DataProvider(name = "notSerializable") public Object[][] notSerializable() { return new Object[][] { new Object[] { new NotSerEmpty() }, @@ -210,11 +219,12 @@ public Object[][] notSerializable() { static final Class NSE = NotSerializableException.class; /** Tests that non-Serializable record objects throw NotSerializableException. */ - @Test(dataProvider = "notSerializable") + @ParameterizedTest + @MethodSource("notSerializable") public void testNotSerializable(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); - NotSerializableException expected = expectThrows(NSE, () -> serialize(objToSerialize)); + NotSerializableException expected = Assertions.assertThrows(NSE, () -> serialize(objToSerialize)); out.println("caught expected NSE:" + expected); } @@ -236,9 +246,9 @@ public void testCtrCalledOnlyOnce() throws Exception { out.println("serializing : " + objToSerialize); var objDeserialized = serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); assertEquals(objDeserialized, objToSerialize); - assertEquals(e_ctrInvocationCount, 1); + assertEquals(objToSerialize, objDeserialized); + assertEquals(1, e_ctrInvocationCount); } // --- @@ -259,9 +269,9 @@ public void testCtrNotCalled() { var objToSerialize = new G(); g_ctrInvocationCount = 0; // reset out.println("serializing : " + objToSerialize); - NotSerializableException expected = expectThrows(NSE, () -> serialize(objToSerialize)); + NotSerializableException expected = Assertions.assertThrows(NSE, () -> serialize(objToSerialize)); out.println("caught expected NSE:" + expected); - assertEquals(g_ctrInvocationCount, 0); + assertEquals(0, g_ctrInvocationCount); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/ConstructorAccessTest.java b/test/jdk/java/io/Serializable/records/ConstructorAccessTest.java index c9f2be0e18f8..293489d845ec 100644 --- a/test/jdk/java/io/Serializable/records/ConstructorAccessTest.java +++ b/test/jdk/java/io/Serializable/records/ConstructorAccessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,8 @@ * @bug 8246774 * @summary Ensures that the serialization implementation can *always* access * the record constructor - * @run testng ConstructorAccessTest - * @run testng/othervm/java.security.policy=empty_security.policy ConstructorAccessTest + * @run junit ConstructorAccessTest + * @run junit/othervm/java.security.policy=empty_security.policy ConstructorAccessTest */ import java.io.ByteArrayInputStream; @@ -39,16 +39,19 @@ import java.io.ObjectOutputStream; import java.io.Externalizable; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /*implicit*/ record Aux1 (int x) implements Serializable { } /*implicit*/ record Aux2 (int x) implements Serializable { } +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ConstructorAccessTest { public record A (int x) implements Serializable { } @@ -76,7 +79,6 @@ protected static record F (long l) implements ThrowingExternalizable { } private record H (double d) implements ThrowingExternalizable { } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { new A(34) }, @@ -92,7 +94,8 @@ public Object[][] recordInstances() { }; } - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void roundTrip(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); diff --git a/test/jdk/java/io/Serializable/records/CycleTest.java b/test/jdk/java/io/Serializable/records/CycleTest.java index 9df703c3bc10..79db38707999 100644 --- a/test/jdk/java/io/Serializable/records/CycleTest.java +++ b/test/jdk/java/io/Serializable/records/CycleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Ensures basic behavior of cycles from record components - * @run testng CycleTest - * @run testng/othervm/java.security.policy=empty_security.policy CycleTest + * @run junit CycleTest + * @run junit/othervm/java.security.policy=empty_security.policy CycleTest */ import java.io.ByteArrayInputStream; @@ -35,10 +35,11 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; public class CycleTest { @@ -62,10 +63,10 @@ public void testCycle1() throws Exception { out.println("serializing : " + r); R deserializedObj = serializeDeserialize(r); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj.x(), 1); // sanity - assertEquals(deserializedObj.y(), 2); // sanity + assertEquals(1, deserializedObj.x()); // sanity + assertEquals(2, deserializedObj.y()); // sanity assertTrue(deserializedObj.c() instanceof C); // sanity - assertEquals(deserializedObj.c().obj, null); // cycle, expect null + assertEquals(null, deserializedObj.c().obj); // cycle, expect null } /** @@ -85,8 +86,8 @@ public void testCycle2() throws Exception { out.println("deserialized: " + deserializedObj); assertTrue(deserializedObj instanceof C); // sanity assertTrue(deserializedObj.obj != null); // expect non-null, r - assertEquals(((R)deserializedObj.obj).x(), 3); // sanity - assertEquals(((R)deserializedObj.obj).y(), 4); // sanity + assertEquals(3, ((R)deserializedObj.obj).x()); // sanity + assertEquals(4, ((R)deserializedObj.obj).y()); // sanity } record R2 (int x, int y, C c1, C c2) implements Serializable { } @@ -106,8 +107,8 @@ public void testCycle3() throws Exception { out.println("serializing : " + r); R2 deserializedObj = serializeDeserialize(r); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj.x(), 5); // sanity - assertEquals(deserializedObj.y(), 6); // sanity + assertEquals(5, deserializedObj.x()); // sanity + assertEquals(6, deserializedObj.y()); // sanity c1 = deserializedObj.c1(); c2 = deserializedObj.c2(); @@ -133,11 +134,11 @@ public void testCycle4() throws Exception { R3 deserializedObj = serializeDeserialize(r3); out.println("deserialized: " + deserializedObj); assertTrue(deserializedObj.r() != null); - assertEquals(deserializedObj.l(), 9); // sanity - assertEquals(deserializedObj.r().x(), 7); // sanity - assertEquals(deserializedObj.r().y(), 8); // sanity + assertEquals(9, deserializedObj.l()); // sanity + assertEquals(7, deserializedObj.r().x()); // sanity + assertEquals(8, deserializedObj.r().y()); // sanity assertTrue(deserializedObj.r().c() instanceof C); // sanity - assertEquals(deserializedObj.r().c().obj, null); // cycle, expect null + assertEquals(null, deserializedObj.r().c().obj); // cycle, expect null } // --- infra diff --git a/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java b/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java index d4101f9894b2..dc22b1def0a9 100644 --- a/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java +++ b/test/jdk/java/io/Serializable/records/DifferentStreamFieldsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,8 @@ * @bug 8246774 * @summary Checks that the appropriate value is given to the canonical ctr * @library /test/lib - * @run testng DifferentStreamFieldsTest - * @run testng/othervm/java.security.policy=empty_security.policy DifferentStreamFieldsTest + * @run junit DifferentStreamFieldsTest + * @run junit/othervm/java.security.policy=empty_security.policy DifferentStreamFieldsTest */ import java.io.ByteArrayInputStream; @@ -39,14 +39,19 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import jdk.test.lib.serial.SerialObjectBuilder; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Checks that the appropriate value is given to the canonical ctr. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class DifferentStreamFieldsTest { record R01(boolean x) implements Serializable {} @@ -77,7 +82,6 @@ record R13(R12 x) implements Serializable {} record R14(R13[]x) implements Serializable {} - @DataProvider(name = "recordTypeAndExpectedValue") public Object[][] recordTypeAndExpectedValue() { return new Object[][]{ new Object[]{R01.class, false}, @@ -97,7 +101,8 @@ public Object[][] recordTypeAndExpectedValue() { }; } - @Test(dataProvider = "recordTypeAndExpectedValue") + @ParameterizedTest + @MethodSource("recordTypeAndExpectedValue") public void testWithDifferentTypes(Class clazz, Object expectedXValue) throws Exception { out.println("\n---"); @@ -109,7 +114,7 @@ public void testWithDifferentTypes(Class clazz, Object expectedXValue) Object obj = deserialize(bytes); out.println("deserialized: " + obj); Object actualXValue = clazz.getDeclaredMethod("x").invoke(obj); - assertEquals(actualXValue, expectedXValue); + assertEquals(expectedXValue, actualXValue); bytes = SerialObjectBuilder .newBuilder(clazz.getName()) @@ -119,7 +124,7 @@ public void testWithDifferentTypes(Class clazz, Object expectedXValue) obj = deserialize(bytes); out.println("deserialized: " + obj); actualXValue = clazz.getDeclaredMethod("x").invoke(obj); - assertEquals(actualXValue, expectedXValue); + assertEquals(expectedXValue, actualXValue); } // --- all together @@ -138,18 +143,18 @@ record R15(boolean a, byte b, short c, char d, int e, long f, float g, R15 obj = deserialize(bytes); out.println("deserialized: " + obj); - assertEquals(obj.a, false); - assertEquals(obj.b, 0); - assertEquals(obj.c, 0); - assertEquals(obj.d, '\u0000'); - assertEquals(obj.e, 0); - assertEquals(obj.f, 0l); - assertEquals(obj.g, 0f); - assertEquals(obj.h, 0d); - assertEquals(obj.i, null); - assertEquals(obj.j, null); - assertEquals(obj.k, null); - assertEquals(obj.l, null); + assertEquals(false, obj.a); + assertEquals(0, obj.b); + assertEquals(0, obj.c); + assertEquals('\u0000', obj.d); + assertEquals(0, obj.e); + assertEquals(0l, obj.f); + assertEquals(0f, obj.g); + assertEquals(0d, obj.h); + assertEquals(null, obj.i); + assertEquals(null, obj.j); + assertEquals(null, obj.k); + assertEquals(null, obj.l); } @Test @@ -167,9 +172,9 @@ record R(int x) implements Serializable {} .build(); var deser1 = deserialize(OOSBytes); - assertEquals(deser1, r); + assertEquals(r, deser1); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); } { record R(int x, int y) implements Serializable {} @@ -177,7 +182,7 @@ record R(int x, int y) implements Serializable {} var r = new R(7, 8); byte[] OOSBytes = serialize(r); var deser1 = deserialize(OOSBytes); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) @@ -186,7 +191,7 @@ record R(int x, int y) implements Serializable {} .build(); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) @@ -194,7 +199,7 @@ record R(int x, int y) implements Serializable {} .addPrimitiveField("x", int.class, 7) .build(); deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) @@ -204,12 +209,12 @@ record R(int x, int y) implements Serializable {} .addPrimitiveField("z", int.class, 9) // additional fields .build(); deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); r = new R(0, 0); OOSBytes = serialize(r); deser1 = deserialize(OOSBytes); - assertEquals(deser1, r); + assertEquals(r, deser1); builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) @@ -217,13 +222,13 @@ record R(int x, int y) implements Serializable {} .addPrimitiveField("x", int.class, 0) .build(); deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); builderBytes = SerialObjectBuilder .newBuilder(R.class.getName()) // no field values .build(); deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); } } @@ -235,7 +240,7 @@ record Str(String part1, String part2) implements Serializable {} var r = new Str("Hello", "World!"); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(Str.class.getName()) @@ -244,7 +249,7 @@ record Str(String part1, String part2) implements Serializable {} .build(); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); builderBytes = SerialObjectBuilder .newBuilder(Str.class.getName()) @@ -255,7 +260,7 @@ record Str(String part1, String part2) implements Serializable {} .build(); var deser3 = deserialize(builderBytes); - assertEquals(deser3, deser1); + assertEquals(deser1, deser3); } @Test @@ -265,8 +270,8 @@ public void testArrays() throws Exception { record IntArray(int[]ints, long[]longs) implements Serializable {} IntArray r = new IntArray(new int[]{5, 4, 3, 2, 1}, new long[]{9L}); IntArray deser1 = deserialize(serialize(r)); - assertEquals(deser1.ints(), r.ints()); - assertEquals(deser1.longs(), r.longs()); + Assertions.assertArrayEquals(r.ints(), deser1.ints()); + Assertions.assertArrayEquals(r.longs(), deser1.longs()); byte[] builderBytes = SerialObjectBuilder .newBuilder(IntArray.class.getName()) @@ -275,14 +280,14 @@ record IntArray(int[]ints, long[]longs) implements Serializable {} .build(); IntArray deser2 = deserialize(builderBytes); - assertEquals(deser2.ints(), deser1.ints()); - assertEquals(deser2.longs(), deser1.longs()); + Assertions.assertArrayEquals(deser1.ints(), deser2.ints()); + Assertions.assertArrayEquals(deser1.longs(), deser2.longs()); } { record StrArray(String[]stringArray) implements Serializable {} StrArray r = new StrArray(new String[]{"foo", "bar"}); StrArray deser1 = deserialize(serialize(r)); - assertEquals(deser1.stringArray(), r.stringArray()); + Assertions.assertArrayEquals(r.stringArray(), deser1.stringArray()); byte[] builderBytes = SerialObjectBuilder .newBuilder(StrArray.class.getName()) @@ -290,7 +295,7 @@ record StrArray(String[]stringArray) implements Serializable {} .build(); StrArray deser2 = deserialize(builderBytes); - assertEquals(deser2.stringArray(), deser1.stringArray()); + Assertions.assertArrayEquals(deser1.stringArray(), deser2.stringArray()); } } @@ -303,7 +308,7 @@ record NumberHolder(Number n) implements Serializable {} var r = new NumberHolder(123); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(NumberHolder.class.getName()) @@ -311,7 +316,7 @@ record NumberHolder(Number n) implements Serializable {} .build(); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); } { @@ -319,7 +324,7 @@ record IntegerHolder(Integer i) implements Serializable {} var r = new IntegerHolder(123); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(IntegerHolder.class.getName()) @@ -327,7 +332,7 @@ record IntegerHolder(Integer i) implements Serializable {} .build(); var deser2 = deserialize(builderBytes); - assertEquals(deser2, deser1); + assertEquals(deser1, deser2); } } @@ -339,7 +344,7 @@ record StringHolder(String s) implements Serializable {} var r = new StringHolder("123"); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(StringHolder.class.getName()) @@ -363,7 +368,7 @@ record IntHolder(int i) implements Serializable {} var r = new IntHolder(123); var deser1 = deserialize(serialize(r)); - assertEquals(deser1, r); + assertEquals(r, deser1); byte[] builderBytes = SerialObjectBuilder .newBuilder(IntHolder.class.getName()) diff --git a/test/jdk/java/io/Serializable/records/ProhibitedMethods.java b/test/jdk/java/io/Serializable/records/ProhibitedMethods.java index 099008b4306e..7465c80e4533 100644 --- a/test/jdk/java/io/Serializable/records/ProhibitedMethods.java +++ b/test/jdk/java/io/Serializable/records/ProhibitedMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @summary Basic tests for prohibited magic serialization methods * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm - * @run testng ProhibitedMethods + * @run junit ProhibitedMethods */ import java.io.ByteArrayInputStream; @@ -51,23 +51,27 @@ import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.ByteCodeLoader; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; import static jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_FRAMES; import static jdk.internal.org.objectweb.asm.ClassWriter.COMPUTE_MAXS; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; -import static org.testng.Assert.fail; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Checks that the various prohibited Serialization magic methods, and * Externalizable methods, are not invoked ( effectively ignored ) for * record objects. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ProhibitedMethods { public interface ThrowingExternalizable extends Externalizable { @@ -101,7 +105,7 @@ record Wubble (Wobble wobble, Wibble wibble, String s) implements ThrowingExtern * fail("readObjectNoData should not be invoked"); } * } */ - @BeforeTest + @BeforeAll public void setup() { { byte[] byteCode = InMemoryJavaCompiler.compile("Foo", @@ -166,7 +170,6 @@ Object newBaz(Object u, Object v) { } } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { newFoo() }, @@ -178,7 +181,8 @@ public Object[][] recordInstances() { }; } - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void roundTrip(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); @@ -271,7 +275,8 @@ public void visitEnd() { MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, WRITE_OBJECT_NAME, WRITE_OBJECT_DESC, null, null); mv.visitCode(); mv.visitLdcInsn(WRITE_OBJECT_NAME + " should not be invoked"); - mv.visitMethodInsn(INVOKESTATIC, "org/testng/Assert", "fail", "(Ljava/lang/String;)V", false); + mv.visitMethodInsn(INVOKESTATIC, "org/junit/jupiter/api/Assertions", "fail", + "(Ljava/lang/String;)Ljava/lang/Object;", false); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -332,38 +337,38 @@ public void wellFormedGeneratedClasses() throws Exception { Method m = obj.getClass().getDeclaredMethod("writeObject", ObjectOutputStream.class); assertTrue((m.getModifiers() & Modifier.PRIVATE) != 0); m.setAccessible(true); - ReflectiveOperationException t = expectThrows(ROE, () -> + ReflectiveOperationException t = Assertions.assertThrows(ROE, () -> m.invoke(obj, new ObjectOutputStream(OutputStream.nullOutputStream()))); Throwable assertionError = t.getCause(); out.println("caught expected AssertionError: " + assertionError); assertTrue(assertionError instanceof AssertionError, "Expected AssertionError, got:" + assertionError); - assertEquals(assertionError.getMessage(), "writeObject should not be invoked"); + assertEquals("writeObject should not be invoked", assertionError.getMessage()); } { // readObject Method m = obj.getClass().getDeclaredMethod("readObject", ObjectInputStream.class); assertTrue((m.getModifiers() & Modifier.PRIVATE) != 0); m.setAccessible(true); - ReflectiveOperationException t = expectThrows(ROE, () -> + ReflectiveOperationException t = Assertions.assertThrows(ROE, () -> m.invoke(obj, new ObjectInputStream() { })); Throwable assertionError = t.getCause(); out.println("caught expected AssertionError: " + assertionError); assertTrue(assertionError instanceof AssertionError, "Expected AssertionError, got:" + assertionError); - assertEquals(assertionError.getMessage(), "readObject should not be invoked"); + assertEquals("readObject should not be invoked", assertionError.getMessage()); } { // readObjectNoData Method m = obj.getClass().getDeclaredMethod("readObjectNoData"); assertTrue((m.getModifiers() & Modifier.PRIVATE) != 0); m.setAccessible(true); - ReflectiveOperationException t = expectThrows(ROE, () -> m.invoke(obj)); + ReflectiveOperationException t = Assertions.assertThrows(ROE, () -> m.invoke(obj)); Throwable assertionError = t.getCause(); out.println("caught expected AssertionError: " + assertionError); assertTrue(assertionError instanceof AssertionError, "Expected AssertionError, got:" + assertionError); - assertEquals(assertionError.getMessage(), "readObjectNoData should not be invoked"); + assertEquals("readObjectNoData should not be invoked", assertionError.getMessage()); } } } -} +} \ No newline at end of file diff --git a/test/jdk/java/io/Serializable/records/ReadResolveTest.java b/test/jdk/java/io/Serializable/records/ReadResolveTest.java index 725f2cb49eab..cb36e3821fea 100644 --- a/test/jdk/java/io/Serializable/records/ReadResolveTest.java +++ b/test/jdk/java/io/Serializable/records/ReadResolveTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic tests for readResolve - * @run testng ReadResolveTest - * @run testng/othervm/java.security.policy=empty_security.policy ReadResolveTest + * @run junit ReadResolveTest + * @run junit/othervm/java.security.policy=empty_security.policy ReadResolveTest */ import java.io.ByteArrayInputStream; @@ -36,15 +36,19 @@ import java.io.ObjectOutputStream; import java.io.Serial; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.String.format; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Tests records being used as a serial proxy. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ReadResolveTest { static class C1 implements Serializable { @@ -95,7 +99,6 @@ private Object writeReplace() { } } - @DataProvider(name = "objectsToSerialize") public Object[][] objectsToSerialize() { return new Object[][] { new Object[] { new C1(3,4) }, @@ -104,13 +107,14 @@ public Object[][] objectsToSerialize() { }; } - @Test(dataProvider = "objectsToSerialize") + @ParameterizedTest + @MethodSource("objectsToSerialize") public void testSerialize(Object objectToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objectToSerialize); Object deserializedObj = serializeDeserialize(objectToSerialize); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj, objectToSerialize); + assertEquals(objectToSerialize, deserializedObj); } // -- null replacement @@ -129,7 +133,7 @@ public void testNull() throws Exception { out.println("serializing : " + objectToSerialize); Object deserializedObj = serializeDeserialize(objectToSerialize); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj, null); + assertEquals(null, deserializedObj); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/RecordClassTest.java b/test/jdk/java/io/Serializable/records/RecordClassTest.java index 6506f9f85e43..b6e35d13626e 100644 --- a/test/jdk/java/io/Serializable/records/RecordClassTest.java +++ b/test/jdk/java/io/Serializable/records/RecordClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic tests for serializing and deserializing record classes - * @run testng RecordClassTest - * @run testng/othervm/java.security.policy=empty_security.policy RecordClassTest + * @run junit RecordClassTest + * @run junit/othervm/java.security.policy=empty_security.policy RecordClassTest */ import java.io.ByteArrayInputStream; @@ -39,15 +39,18 @@ import java.io.ObjectOutputStream; import java.io.ObjectStreamClass; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Serializes and deserializes record classes. Ensures that the SUID is 0. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class RecordClassTest { record Foo () implements Serializable { } @@ -75,7 +78,6 @@ record Wobble (long l) implements ThrowingExternalizable { } record Wubble (Wobble wobble, Wibble wibble, String s) implements ThrowingExternalizable { } - @DataProvider(name = "recordClasses") public Object[][] recordClasses() { return new Object[][] { new Object[] { Foo.class , 0L }, @@ -88,7 +90,8 @@ public Object[][] recordClasses() { } /** Tests that the serialized and deserialized instances are equal. */ - @Test(dataProvider = "recordClasses") + @ParameterizedTest + @MethodSource("recordClasses") public void testClassSerialization(Class recordClass, long unused) throws Exception { @@ -96,21 +99,22 @@ public void testClassSerialization(Class recordClass, long unused) out.println("serializing : " + recordClass); var deserializedClass = serializeDeserialize(recordClass); out.println("deserialized: " + deserializedClass); - assertEquals(recordClass, deserializedClass); assertEquals(deserializedClass, recordClass); + assertEquals(recordClass, deserializedClass); } /** Tests that the SUID is always 0 unless explicitly declared. */ - @Test(dataProvider = "recordClasses") + @ParameterizedTest + @MethodSource("recordClasses") public void testSerialVersionUID(Class recordClass, long expectedUID) { out.println("\n---"); ObjectStreamClass osc = ObjectStreamClass.lookup(recordClass); out.println("ObjectStreamClass::lookup : " + osc); - assertEquals(osc.getSerialVersionUID(), expectedUID); + assertEquals(expectedUID, osc.getSerialVersionUID()); osc = ObjectStreamClass.lookupAny(recordClass); out.println("ObjectStreamClass::lookupAny: " + osc); - assertEquals(osc.getSerialVersionUID(), expectedUID); + assertEquals(expectedUID, osc.getSerialVersionUID()); } // --- not Serializable @@ -121,7 +125,6 @@ record NotSerializable2(int x) { } record NotSerializable3(T t) { } - @DataProvider(name = "notSerRecordClasses") public Object[][] notSerRecordClasses() { return new Object[][] { new Object[] { NotSerializable1.class }, @@ -131,16 +134,17 @@ public Object[][] notSerRecordClasses() { } /** Tests that the generated SUID is always 0 for all non-Serializable record classes. */ - @Test(dataProvider = "notSerRecordClasses") + @ParameterizedTest + @MethodSource("notSerRecordClasses") public void testSerialVersionUIDNonSer(Class recordClass) { out.println("\n---"); ObjectStreamClass osc = ObjectStreamClass.lookup(recordClass); out.println("ObjectStreamClass::lookup : " + osc); - assertEquals(osc, null); + assertEquals(null, osc); osc = ObjectStreamClass.lookupAny(recordClass); out.println("ObjectStreamClass::lookupAny: " + osc); - assertEquals(osc.getSerialVersionUID(), 0L); + assertEquals(0L, osc.getSerialVersionUID()); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java b/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java index 0d88074bdbcc..13d81ee3c49e 100644 --- a/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java +++ b/test/jdk/java/io/Serializable/records/SerialPersistentFieldsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @summary Basic tests for prohibited magic serialPersistentFields * @library /test/lib * @modules java.base/jdk.internal.org.objectweb.asm - * @run testng SerialPersistentFieldsTest + * @run junit SerialPersistentFieldsTest */ import java.io.ByteArrayInputStream; @@ -49,18 +49,21 @@ import jdk.internal.org.objectweb.asm.Type; import jdk.test.lib.ByteCodeLoader; import jdk.test.lib.compiler.InMemoryJavaCompiler; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; import static jdk.internal.org.objectweb.asm.ClassWriter.*; import static jdk.internal.org.objectweb.asm.Opcodes.*; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Checks that the serialPersistentFields declaration is effectively ignored. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SerialPersistentFieldsTest { ClassLoader serializableRecordLoader; @@ -78,7 +81,7 @@ public class SerialPersistentFieldsTest { * }; * } */ - @BeforeTest + @BeforeAll public void setup() { { // R1 byte[] byteCode = InMemoryJavaCompiler.compile("R1", @@ -164,7 +167,6 @@ Object newR5(int x) { return newRecord("R5", new Class[]{int.class}, new Object[]{x}); } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { newR1() }, @@ -175,14 +177,15 @@ public Object[][] recordInstances() { }; } - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void roundTrip(Object objToSerialize) throws Exception { out.println("\n---"); out.println("serializing : " + objToSerialize); var objDeserialized = serializeDeserialize(objToSerialize); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize, objDeserialized); assertEquals(objDeserialized, objToSerialize); + assertEquals(objToSerialize, objDeserialized); } byte[] serialize(T obj) throws IOException { @@ -323,7 +326,8 @@ static String getPrimitiveBoxClass(final Class clazz) { // -- infra sanity -- /** Checks to ensure correct operation of the test's generation logic. */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void wellFormedGeneratedClasses(Object obj) throws Exception { out.println("\n---"); out.println(obj); @@ -336,4 +340,4 @@ public void wellFormedGeneratedClasses(Object obj) throws Exception { assertTrue(fv != null, "Unexpected null value"); assertTrue(fv.length >= 0, "Unexpected negative length:" + fv.length); } -} +} \ No newline at end of file diff --git a/test/jdk/java/io/Serializable/records/SerialVersionUIDTest.java b/test/jdk/java/io/Serializable/records/SerialVersionUIDTest.java index d1018c125542..ae0c3b9af14c 100644 --- a/test/jdk/java/io/Serializable/records/SerialVersionUIDTest.java +++ b/test/jdk/java/io/Serializable/records/SerialVersionUIDTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic tests for SUID in the serial stream - * @run testng SerialVersionUIDTest - * @run testng/othervm/java.security.policy=empty_security.policy SerialVersionUIDTest + * @run junit SerialVersionUIDTest + * @run junit/othervm/java.security.policy=empty_security.policy SerialVersionUIDTest */ import java.io.ByteArrayInputStream; @@ -40,13 +40,16 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.LongStream; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.io.ObjectStreamConstants.*; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SerialVersionUIDTest { record R1 () implements Serializable { @@ -65,7 +68,6 @@ record R5 (long l) implements Serializable { private static final long serialVersionUID = 5678L; } - @DataProvider(name = "recordObjects") public Object[][] recordObjects() { return new Object[][] { new Object[] { new R1(), 1L }, @@ -79,7 +81,8 @@ public Object[][] recordObjects() { /** * Tests that a declared SUID for a record class is inserted into the stream. */ - @Test(dataProvider = "recordObjects") + @ParameterizedTest + @MethodSource("recordObjects") public void testSerialize(Object objectToSerialize, long expectedUID) throws Exception { @@ -91,17 +94,16 @@ public void testSerialize(Object objectToSerialize, long expectedUID) DataInputStream dis = new DataInputStream(bais); // sanity - assertEquals(dis.readShort(), STREAM_MAGIC); - assertEquals(dis.readShort(), STREAM_VERSION); - assertEquals(dis.readByte(), TC_OBJECT); - assertEquals(dis.readByte(), TC_CLASSDESC); - assertEquals(dis.readUTF(), objectToSerialize.getClass().getName()); + assertEquals(STREAM_MAGIC, dis.readShort()); + assertEquals(STREAM_VERSION, dis.readShort()); + assertEquals(TC_OBJECT, dis.readByte()); + assertEquals(TC_CLASSDESC, dis.readByte()); + assertEquals(objectToSerialize.getClass().getName(), dis.readUTF()); // verify that the UID is as expected - assertEquals(dis.readLong(), expectedUID); + assertEquals(expectedUID, dis.readLong()); } - @DataProvider(name = "recordClasses") public Object[][] recordClasses() { List list = new ArrayList<>(); List> recordClasses = List.of(R1.class, R2.class, R3.class, R4.class, R5.class); @@ -116,14 +118,15 @@ public Object[][] recordClasses() { * Tests that matching of the serialVersionUID values ( stream value * and runtime class value ) is waived for record classes. */ - @Test(dataProvider = "recordClasses") + @ParameterizedTest + @MethodSource("recordClasses") public void testSerializeFromClass(Class cl, long suid) throws Exception { out.println("\n---"); byte[] bytes = byteStreamFor(cl.getName(), suid); Object obj = deserialize(bytes); - assertEquals(obj.getClass(), cl); + assertEquals(cl, obj.getClass()); assertTrue(obj.getClass().isRecord()); } diff --git a/test/jdk/java/io/Serializable/records/StreamRefTest.java b/test/jdk/java/io/Serializable/records/StreamRefTest.java index b0c72ec8a966..d0d3e353bdb5 100644 --- a/test/jdk/java/io/Serializable/records/StreamRefTest.java +++ b/test/jdk/java/io/Serializable/records/StreamRefTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8246774 * @summary Tests for stream references - * @run testng StreamRefTest + * @run junit StreamRefTest */ import java.io.ByteArrayInputStream; @@ -36,11 +36,12 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; /** * Tests for stream references. @@ -123,14 +124,14 @@ public void basicRefWithInvalidA() throws Exception { updateIntValue(3, -3, bytes, 40); var byteStream = new ObjectInputStream(new ByteArrayInputStream(bytes)); - InvalidObjectException ioe = expectThrows(IOE, () -> deserializeOne(byteStream)); + InvalidObjectException ioe = Assertions.assertThrows(IOE, () -> deserializeOne(byteStream)); out.println("caught expected IOE: " + ioe); Throwable t = ioe.getCause(); assertTrue(t instanceof IllegalArgumentException, "Expected IAE, got:" + t); out.println("expected cause IAE: " + t); B b1 = (B)deserializeOne(byteStream); - assertEquals(b1.a, null); + assertEquals(null, b1.a); } @Test @@ -144,14 +145,14 @@ public void reverseBasicRefWithInvalidA() throws Exception { updateIntValue(3, -3, bytes, 96); var byteStream = new ObjectInputStream(new ByteArrayInputStream(bytes)); - InvalidObjectException ioe = expectThrows(IOE, () -> deserializeOne(byteStream)); + InvalidObjectException ioe = Assertions.assertThrows(IOE, () -> deserializeOne(byteStream)); out.println("caught expected IOE: " + ioe); Throwable t = ioe.getCause(); assertTrue(t instanceof IllegalArgumentException, "Expected IAE, got:" + t); out.println("expected cause IAE: " + t); A a1 = (A)deserializeOne(byteStream); - assertEquals(a1, null); + assertEquals(null, a1); } // --- @@ -211,7 +212,7 @@ static void assertExpectedIntValue(int expectedValue, byte[] bytes, int offset) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream(bytes, offset, 4); DataInputStream dis = new DataInputStream(bais); - assertEquals(dis.readInt(), expectedValue); + assertEquals(expectedValue, dis.readInt()); } static void updateIntValue(int expectedValue, int newValue, byte[] bytes, int offset) diff --git a/test/jdk/java/io/Serializable/records/ThrowingConstructorTest.java b/test/jdk/java/io/Serializable/records/ThrowingConstructorTest.java index feb148f5d5ce..247837bb963c 100644 --- a/test/jdk/java/io/Serializable/records/ThrowingConstructorTest.java +++ b/test/jdk/java/io/Serializable/records/ThrowingConstructorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Tests constructor invocation exceptions are handled appropriately - * @run testng ThrowingConstructorTest - * @run testng/othervm/java.security.policy=empty_security.policy ThrowingConstructorTest + * @run junit ThrowingConstructorTest + * @run junit/othervm/java.security.policy=empty_security.policy ThrowingConstructorTest */ import java.io.ByteArrayInputStream; @@ -36,17 +36,20 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * If the constructor invocation throws an exception, an * `InvalidObjectException` is thrown with that exception as its cause. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ThrowingConstructorTest { /** "big switch" that can be used to allow/disallow record construction @@ -85,7 +88,6 @@ static class C implements Serializable { static final Class IOE = InvalidObjectException.class; - @DataProvider(name = "exceptionInstances") public Object[][] exceptionInstances() { Object[][] objs = new Object[][] { new Object[] { new R1(), NullPointerException.class, "thrown from R1" }, @@ -99,7 +101,8 @@ public Object[][] exceptionInstances() { return objs; } - @Test(dataProvider = "exceptionInstances") + @ParameterizedTest + @MethodSource("exceptionInstances") public void testExceptions(Object objectToSerialize, Class expectedExType, String expectedExMessage) @@ -108,13 +111,13 @@ public void testExceptions(Object objectToSerialize, out.println("\n---"); out.println("serializing: " + objectToSerialize); byte[] bytes = serialize(objectToSerialize); - InvalidObjectException ioe = expectThrows(IOE, () -> deserialize(bytes)); + InvalidObjectException ioe = Assertions.assertThrows(IOE, () -> deserialize(bytes)); out.println("caught expected IOE: " + ioe); Throwable t = ioe.getCause(); assertTrue(t.getClass().equals(expectedExType), "Expected:" + expectedExType + ", got:" + t); out.println("expected cause " + expectedExType +" : " + t); - assertEquals(t.getMessage(), expectedExMessage); + assertEquals(expectedExMessage, t.getMessage()); } // -- errors ( pass through unwrapped ) @@ -144,7 +147,6 @@ public R6(int x, int y) { } } - @DataProvider(name = "errorInstances") public Object[][] errorInstances() { Object[][] objs = new Object[][] { new Object[] { new R4(), OutOfMemoryError.class, "thrown from R4" }, @@ -158,7 +160,8 @@ public Object[][] errorInstances() { return objs; } - @Test(dataProvider = "errorInstances") + @ParameterizedTest + @MethodSource("errorInstances") public void testErrors(Object objectToSerialize, Class expectedExType, String expectedExMessage) @@ -167,11 +170,11 @@ public void testErrors(Object objectToSerialize, out.println("\n---"); out.println("serializing: " + objectToSerialize); byte[] bytes = serialize(objectToSerialize); - Throwable t = expectThrows(expectedExType, () -> deserialize(bytes)); + Throwable t = Assertions.assertThrows(expectedExType, () -> deserialize(bytes)); assertTrue(t.getClass().equals(expectedExType), "Expected:" + expectedExType + ", got:" + t); out.println("caught expected " + expectedExType +" : " + t); - assertEquals(t.getMessage(), expectedExMessage); + assertEquals(expectedExMessage, t.getMessage()); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/UnsharedTest.java b/test/jdk/java/io/Serializable/records/UnsharedTest.java index c96010c83ab9..114e2dc6e10d 100644 --- a/test/jdk/java/io/Serializable/records/UnsharedTest.java +++ b/test/jdk/java/io/Serializable/records/UnsharedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8238763 8246774 * @summary ObjectInputStream readUnshared method handling of Records - * @run testng UnsharedTest + * @run junit UnsharedTest */ import java.io.ByteArrayInputStream; @@ -35,10 +35,11 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; +import org.junit.jupiter.api.Assertions; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; /** * Tests OOS::writeUnshared and OIS::readUnshared to verify that records @@ -56,16 +57,16 @@ public void testReadUnshared() throws Exception { { // shared - sanity to ensure the second foo is a ref var byteStream = serialize(foo, foo); var foo1 = (Foo) deserializeOne(byteStream); - assertEquals(foo1.x, foo.x); + assertEquals(foo.x, foo1.x); var foo2 = (Foo) deserializeOne(byteStream); - assertEquals(foo2.x, foo.x); + assertEquals(foo.x, foo2.x); assertTrue(foo2 == foo1); } { // unshared var byteStream = serialize(foo, foo); var foo1 = (Foo) deserializeOneUnshared(byteStream); - assertEquals(foo1.x, foo.x); - var expected = expectThrows(IOE, () -> deserializeOne(byteStream)); + assertEquals(foo.x, foo1.x); + var expected = Assertions.assertThrows(IOE, () -> deserializeOne(byteStream)); assertTrue(expected.getMessage().contains("cannot read back reference to unshared object")); } } @@ -76,17 +77,17 @@ public void testWriteUnshared() throws Exception { { // shared - sanity to ensure the second foo is NOT a ref var byteStream = serializeUnshared(foo, foo); var foo1 = (Foo) deserializeOne(byteStream); - assertEquals(foo1.x, foo.x); + assertEquals(foo.x, foo1.x); var foo2 = (Foo) deserializeOne(byteStream); - assertEquals(foo2.x, foo.x); + assertEquals(foo.x, foo2.x); assertTrue(foo2 != foo1); } { // unshared var byteStream = serializeUnshared(foo, foo); var foo1 = (Foo) deserializeOneUnshared(byteStream); - assertEquals(foo1.x, foo.x); + assertEquals(foo.x, foo1.x); var foo2 = (Foo) deserializeOneUnshared(byteStream); - assertEquals(foo2.x, foo.x); + assertEquals(foo.x, foo2.x); assertTrue(foo2 != foo1); } } diff --git a/test/jdk/java/io/Serializable/records/WriteReplaceTest.java b/test/jdk/java/io/Serializable/records/WriteReplaceTest.java index 8dda381e6713..1c3990078c21 100644 --- a/test/jdk/java/io/Serializable/records/WriteReplaceTest.java +++ b/test/jdk/java/io/Serializable/records/WriteReplaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ * @test * @bug 8246774 * @summary Basic tests for writeReplace - * @run testng WriteReplaceTest - * @run testng/othervm/java.security.policy=empty_security.policy WriteReplaceTest + * @run junit WriteReplaceTest + * @run junit/othervm/java.security.policy=empty_security.policy WriteReplaceTest */ import java.io.ByteArrayInputStream; @@ -35,11 +35,15 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class WriteReplaceTest { record R1 () implements Serializable { @@ -72,7 +76,6 @@ static class Replacement implements Serializable { } } - @DataProvider(name = "recordObjects") public Object[][] recordObjects() { return new Object[][] { new Object[] { new R1(), R1.class }, @@ -82,7 +85,8 @@ public Object[][] recordObjects() { }; } - @Test(dataProvider = "recordObjects") + @ParameterizedTest + @MethodSource("recordObjects") public void testSerialize(Object objectToSerialize, Class expectedType) throws Exception { @@ -91,9 +95,9 @@ public void testSerialize(Object objectToSerialize, Class expectedType) Object deserializedObj = serializeDeserialize(objectToSerialize); out.println("deserialized: " + deserializedObj); if (objectToSerialize.getClass().equals(expectedType)) - assertEquals(deserializedObj, objectToSerialize); + assertEquals(objectToSerialize, deserializedObj); else - assertEquals(deserializedObj.getClass(), expectedType); + assertEquals(expectedType, deserializedObj.getClass()); } // -- null replacement @@ -109,7 +113,7 @@ public void testNull() throws Exception { out.println("serializing : " + objectToSerialize); Object deserializedObj = serializeDeserialize(objectToSerialize); out.println("deserialized: " + deserializedObj); - assertEquals(deserializedObj, null); + assertEquals(null, deserializedObj); } // --- infra diff --git a/test/jdk/java/io/Serializable/records/migration/AbstractTest.java b/test/jdk/java/io/Serializable/records/migration/AbstractTest.java index e0bbc5745005..488f4a33acda 100644 --- a/test/jdk/java/io/Serializable/records/migration/AbstractTest.java +++ b/test/jdk/java/io/Serializable/records/migration/AbstractTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,8 +34,9 @@ import java.net.URLClassLoader; import java.nio.file.Path; import jdk.test.lib.compiler.CompilerUtils; -import org.testng.annotations.BeforeTest; -import static org.testng.Assert.*; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeAll; /** * An abstract superclass for tests that require to serialize and deserialize @@ -54,7 +55,7 @@ public class AbstractTest { static final Path RECORD_SRC_DIR = Path.of(TEST_SRC, "record"); static final Path RECORD_DEST_DIR = Path.of("record"); - @BeforeTest + @BeforeAll public void setup() throws IOException { assertTrue(CompilerUtils.compile(PLAIN_SRC_DIR, PLAIN_DEST_DIR, "--class-path", TEST_CLASSES_DIR.toString())); diff --git a/test/jdk/java/io/Serializable/records/migration/AssignableFromTest.java b/test/jdk/java/io/Serializable/records/migration/AssignableFromTest.java index 6097e2477df2..117a8474c678 100644 --- a/test/jdk/java/io/Serializable/records/migration/AssignableFromTest.java +++ b/test/jdk/java/io/Serializable/records/migration/AssignableFromTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,24 +29,26 @@ * @modules jdk.compiler * @compile AssignableFrom.java Point.java * DefaultValues.java SuperStreamFields.java - * @run testng AssignableFromTest + * @run junit AssignableFromTest */ import java.math.BigDecimal; import java.math.BigInteger; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Basic test to check that stream field values that are not the exact * declared param/field type, but assignable to a declared supertype, * are bound/assigned correctly. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class AssignableFromTest extends AbstractTest { - @DataProvider(name = "plainInstances") public Object[][] plainInstances() { return new Object[][] { new Object[] { newPlainAssignableFrom(Byte.valueOf((byte)11)) }, @@ -59,7 +61,8 @@ public Object[][] plainInstances() { } /** Serialize non-record (plain) instances, deserialize as a record. */ - @Test(dataProvider = "plainInstances") + @ParameterizedTest + @MethodSource("plainInstances") public void testPlainToRecord(AssignableFrom objToSerialize) throws Exception { assert !objToSerialize.getClass().isRecord(); out.println("serialize : " + objToSerialize); @@ -68,13 +71,12 @@ public void testPlainToRecord(AssignableFrom objToSerialize) throws Exception { assert objDeserialized.getClass().isRecord(); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize.number(), objDeserialized.number()); assertEquals(objDeserialized.number(), objToSerialize.number()); + assertEquals(objToSerialize.number(), objDeserialized.number()); assertEquals(objDeserialized.number().getClass(), objDeserialized.number().getClass()); } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { newRecordAssignableFrom(Byte.valueOf((byte)21)) }, @@ -87,7 +89,8 @@ public Object[][] recordInstances() { } /** Serialize record instances, deserialize as non-record (plain). */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void testRecordToPlain(AssignableFrom objToSerialize) throws Exception { assert objToSerialize.getClass().isRecord(); out.println("serialize : " + objToSerialize); @@ -96,8 +99,8 @@ public void testRecordToPlain(AssignableFrom objToSerialize) throws Exception { assert !objDeserialized.getClass().isRecord(); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize.number(), objDeserialized.number()); assertEquals(objDeserialized.number(), objToSerialize.number()); + assertEquals(objToSerialize.number(), objDeserialized.number()); assertEquals(objDeserialized.number().getClass(), objDeserialized.number().getClass()); } diff --git a/test/jdk/java/io/Serializable/records/migration/DefaultValuesTest.java b/test/jdk/java/io/Serializable/records/migration/DefaultValuesTest.java index 4af684156c65..357c94007777 100644 --- a/test/jdk/java/io/Serializable/records/migration/DefaultValuesTest.java +++ b/test/jdk/java/io/Serializable/records/migration/DefaultValuesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,21 +28,24 @@ * @library /test/lib * @modules jdk.compiler * @compile AssignableFrom.java Point.java DefaultValues.java SuperStreamFields.java - * @run testng DefaultValuesTest + * @run junit DefaultValuesTest */ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; -import org.testng.annotations.Test; import static java.io.ObjectStreamConstants.*; import static java.lang.System.out; -import static org.testng.Assert.*; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; /** * Basic test to check that default primitive / reference values are * presented to the record's canonical constructor, for fields not in * the stream. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class DefaultValuesTest extends AbstractTest { /** @@ -77,13 +80,13 @@ public void testPoint() throws Exception { Point point = deserializeAsPlain(bytes); out.println("deserialized: " + point); - assertEquals(point.x(), 0); - assertEquals(point.y(), 0); + assertEquals(0, point.x()); + assertEquals(0, point.y()); point = deserializeAsRecord(bytes); out.println("deserialized: " + point); - assertEquals(point.x(), 0); - assertEquals(point.y(), 0); + assertEquals(0, point.x()); + assertEquals(0, point.y()); } // --- @@ -115,8 +118,8 @@ public void testAllDefaults() throws Exception { DefaultValues o1 = deserializeAsRecord(bytes); out.println("deserialized: " + o1); - assertEquals(o1.point().x(), point.x()); // sanity - assertEquals(o1.point().y(), point.y()); // sanity + assertEquals(point.x(), o1.point().x()); // sanity + assertEquals(point.y(), o1.point().y()); // sanity assertTrue(o1.bool() == Defaults.bool); assertTrue(o1.by() == Defaults.by); assertTrue(o1.ch() == Defaults.ch); diff --git a/test/jdk/java/io/Serializable/records/migration/SuperStreamFieldsTest.java b/test/jdk/java/io/Serializable/records/migration/SuperStreamFieldsTest.java index 6090d71003e6..35e75341dbff 100644 --- a/test/jdk/java/io/Serializable/records/migration/SuperStreamFieldsTest.java +++ b/test/jdk/java/io/Serializable/records/migration/SuperStreamFieldsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,20 +28,23 @@ * @library /test/lib * @modules jdk.compiler * @compile AssignableFrom.java Point.java DefaultValues.java SuperStreamFields.java - * @run testng SuperStreamFieldsTest + * @run junit SuperStreamFieldsTest */ -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.System.out; -import static org.testng.Assert.assertEquals; + +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * Tests that superclass fields in the stream are discarded. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SuperStreamFieldsTest extends AbstractTest { - @DataProvider(name = "plainInstances") public Object[][] plainInstances() { return new Object[][] { new Object[] { newPlainSuperStreamFields("cat", new int[] { 1 }, 1) }, @@ -51,7 +54,8 @@ public Object[][] plainInstances() { } /** Serializes non-record (plain) instance, deserializes as a record. */ - @Test(dataProvider = "plainInstances") + @ParameterizedTest + @MethodSource("plainInstances") public void testPlainToRecord(SuperStreamFields objToSerialize) throws Exception { assert !objToSerialize.getClass().isRecord(); out.println("serialize : " + objToSerialize); @@ -60,12 +64,11 @@ public void testPlainToRecord(SuperStreamFields objToSerialize) throws Exception assert objDeserialized.getClass().isRecord(); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize.str(), objDeserialized.str()); - assertEquals(objToSerialize.x(), objDeserialized.x()); - assertEquals(objToSerialize.y(), objDeserialized.y()); + assertEquals(objDeserialized.str(), objToSerialize.str()); + Assertions.assertArrayEquals(objDeserialized.x(), objToSerialize.x()); + assertEquals(objDeserialized.y(), objToSerialize.y()); } - @DataProvider(name = "recordInstances") public Object[][] recordInstances() { return new Object[][] { new Object[] { newRecordSuperStreamFields("goat", new int[] { 56 }, 66) }, @@ -75,7 +78,8 @@ public Object[][] recordInstances() { } /** Serializes record instance, deserializes as non-record (plain). */ - @Test(dataProvider = "recordInstances") + @ParameterizedTest + @MethodSource("recordInstances") public void testRecordToPlain(SuperStreamFields objToSerialize) throws Exception { assert objToSerialize.getClass().isRecord(); out.println("serialize : " + objToSerialize); @@ -84,9 +88,9 @@ public void testRecordToPlain(SuperStreamFields objToSerialize) throws Exception assert !objDeserialized.getClass().isRecord(); out.println("deserialized: " + objDeserialized); - assertEquals(objToSerialize.str(), objDeserialized.str()); - assertEquals(objToSerialize.x(), objDeserialized.x()); - assertEquals(objToSerialize.y(), objDeserialized.y()); + assertEquals(objDeserialized.str(), objToSerialize.str()); + Assertions.assertArrayEquals(objDeserialized.x(), objToSerialize.x()); + assertEquals(objDeserialized.y(), objToSerialize.y()); } diff --git a/test/jdk/java/io/pathNames/GeneralSolaris.java b/test/jdk/java/io/pathNames/GeneralSolaris.java index 5b3c3d7f7ae4..6aae15b4468d 100644 --- a/test/jdk/java/io/pathNames/GeneralSolaris.java +++ b/test/jdk/java/io/pathNames/GeneralSolaris.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* @test @bug 4035924 4095767 @summary General exhaustive test of solaris pathname handling + @requires (os.family != "windows") @author Mark Reinhold @build General GeneralSolaris @@ -65,10 +66,6 @@ private static void checkPaths() throws Exception { } public static void main(String[] args) throws Exception { - if (File.separatorChar != '/') { - /* This test is only valid on Unix systems */ - return; - } if (args.length > 0) debug = true; initTestData(3); diff --git a/test/jdk/java/io/pathNames/GeneralWin32.java b/test/jdk/java/io/pathNames/GeneralWin32.java index 6ee64fd86f0e..e7594816680a 100644 --- a/test/jdk/java/io/pathNames/GeneralWin32.java +++ b/test/jdk/java/io/pathNames/GeneralWin32.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* @test @bug 4032066 4039597 4046914 4054511 4065189 4109131 4875229 6983520 8009258 @summary General exhaustive test of win32 pathname handling + @requires (os.family == "windows") @author Mark Reinhold @build General GeneralWin32 @@ -162,10 +163,6 @@ private static void checkUncPaths(int depth) throws Exception { public static void main(String[] args) throws Exception { - if (File.separatorChar != '\\') { - /* This test is only valid on win32 systems */ - return; - } if (args.length > 0) debug = true; initTestData(3); diff --git a/test/jdk/java/io/pathNames/unix/TrailingSlash.java b/test/jdk/java/io/pathNames/unix/TrailingSlash.java index b787cd0ef9d0..bfab177b2cfd 100644 --- a/test/jdk/java/io/pathNames/unix/TrailingSlash.java +++ b/test/jdk/java/io/pathNames/unix/TrailingSlash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* @test * @bug 4427862 * @summary Ensure that trailing slashes are ignored when opening files + * @requires (os.family != "windows") */ import java.io.*; @@ -107,11 +108,6 @@ static void go(String fn, String fns) throws Exception { } public static void main(String[] args) throws Exception { - if (File.separatorChar != '/') { - // This test is only valid on Unix systems - return; - } - go("xyzzy", "xyzzy"); go("xyzzy", "xyzzy/"); go("xyzzy", "xyzzy//"); diff --git a/test/jdk/java/io/pathNames/win32/DriveOnly.java b/test/jdk/java/io/pathNames/win32/DriveOnly.java index 4281200f0c7d..96aba22a408c 100644 --- a/test/jdk/java/io/pathNames/win32/DriveOnly.java +++ b/test/jdk/java/io/pathNames/win32/DriveOnly.java @@ -24,6 +24,7 @@ /* @test @bug 4096648 @summary Make sure that isDirectory and lastModified work on "x:" + @requires (os.family == "windows") */ import java.io.File; @@ -32,7 +33,6 @@ public class DriveOnly { public static void main(String[] args) throws Exception { - if (File.separatorChar != '\\') return; File f = new File("").getCanonicalFile(); while (f.getParent() != null) f = f.getParentFile(); String p = f.getPath().substring(0, 2); diff --git a/test/jdk/java/io/pathNames/win32/DriveRelativePath.java b/test/jdk/java/io/pathNames/win32/DriveRelativePath.java index 43fa2175e092..3f8e225ab3f5 100644 --- a/test/jdk/java/io/pathNames/win32/DriveRelativePath.java +++ b/test/jdk/java/io/pathNames/win32/DriveRelativePath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* @test @bug 4070044 4164823 @summary Check getCanonicalPath's treatment of drive-relative paths (win32) + @requires (os.family == "windows") */ import java.io.*; @@ -37,11 +38,6 @@ static void fail(String s) { public static void main(String[] args) throws IOException { - if (File.separatorChar != '\\') { - /* This test is only valid on win32 systems */ - return; - } - File f = new File("foo"); String c = f.getCanonicalPath(); System.err.println(c); diff --git a/test/jdk/java/io/pathNames/win32/DriveSlash.java b/test/jdk/java/io/pathNames/win32/DriveSlash.java index feb651204d0c..32777ad83d46 100644 --- a/test/jdk/java/io/pathNames/win32/DriveSlash.java +++ b/test/jdk/java/io/pathNames/win32/DriveSlash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ @bug 4065189 @summary Check that win32 pathnames of the form "C:\\" can be listed by the File.list method + @requires (os.family == "windows") @author Mark Reinhold */ @@ -35,9 +36,6 @@ public class DriveSlash { public static void main(String[] args) throws Exception { - /* This test is only valid on win32 systems */ - if (File.separatorChar != '\\') return; - File f = new File("c:\\"); System.err.println(f.getCanonicalPath()); String[] fs = f.list(); diff --git a/test/jdk/java/io/pathNames/win32/RenameDelete.java b/test/jdk/java/io/pathNames/win32/RenameDelete.java index a6cfffade4bd..4b674ddea919 100644 --- a/test/jdk/java/io/pathNames/win32/RenameDelete.java +++ b/test/jdk/java/io/pathNames/win32/RenameDelete.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /* * @test * @bug 4042592 4042593 + @requires (os.family == "windows") * @summary Test operation of rename and delete on win32 */ @@ -40,11 +41,6 @@ public class RenameDelete { public static void main(String[] args) throws Exception { boolean success = false; - if (File.separatorChar != '\\') { - System.err.println("Not a win32 platform -- test inapplicable"); - return; - } - //construct a test file in this location File f1 = new File("."); StringBuffer location = new StringBuffer("\\"); diff --git a/test/jdk/java/io/pathNames/win32/SJIS.java b/test/jdk/java/io/pathNames/win32/SJIS.java index 580f06330a6e..11c69dca8dfa 100644 --- a/test/jdk/java/io/pathNames/win32/SJIS.java +++ b/test/jdk/java/io/pathNames/win32/SJIS.java @@ -25,6 +25,7 @@ @bug 4039597 @summary Check that pathnames containing double-byte characters are not corrupted by win32 path processing + @requires (os.family == "windows") @author Mark Reinhold @library /test/lib */ @@ -52,7 +53,6 @@ public static void main(String[] args) throws Exception { /* This test is only valid on win32 systems that use the SJIS encoding */ - if (File.separatorChar != '\\') return; String enc = System.getProperty("native.encoding"); if ((enc == null) || !enc.equals("MS932")) { throw new SkippedException( diff --git a/test/jdk/java/io/pathNames/win32/bug6344646.java b/test/jdk/java/io/pathNames/win32/bug6344646.java index a89d72fe165b..ecb4bc2bc661 100644 --- a/test/jdk/java/io/pathNames/win32/bug6344646.java +++ b/test/jdk/java/io/pathNames/win32/bug6344646.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @bug 6344646 * @summary tests that WinNTFileSystem.hashCode() uses * locale independent case mapping. + * @requires (os.family == "windows") */ import java.io.*; @@ -34,11 +35,6 @@ public class bug6344646 { public static void main(String[] s) { Locale reservedLocale = Locale.getDefault(); try { - /* This test is only valid on win32 systems */ - if (File.separatorChar != '\\') { - return; - } - Locale.setDefault(Locale.of("lt")); File f1 = new File("J\u0301"); File f2 = new File("j\u0301"); diff --git a/test/jdk/java/lang/Character/Latin1CaseConversion.java b/test/jdk/java/lang/Character/Latin1CaseConversion.java index a176bd4b002e..436193c5f168 100644 --- a/test/jdk/java/lang/Character/Latin1CaseConversion.java +++ b/test/jdk/java/lang/Character/Latin1CaseConversion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,17 +21,16 @@ * questions. */ -import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; /** * @test * @bug 8302877 * @summary Provides exhaustive verification of Character.toUpperCase and Character.toLowerCase * for all code points in the latin1 range 0-255. - * @run testng Latin1CaseConversion + * @run junit Latin1CaseConversion */ public class Latin1CaseConversion { @@ -44,41 +43,41 @@ public void shouldUpperCaseAndLowerCaseLatin1() { if (c < 0x41) { // Before A assertUnchanged(upper, lower, c); } else if (c <= 0x5A) { // A-Z - assertEquals(upper, c); - assertEquals(lower, c + 32); + assertEquals(c, upper); + assertEquals(c + 32, lower); } else if (c < 0x61) { // Between Z and a assertUnchanged(upper, lower, c); } else if (c <= 0x7A) { // a-z - assertEquals(upper, c - 32); - assertEquals(lower, c); + assertEquals(c - 32, upper); + assertEquals(c, lower); } else if (c < 0xB5) { // Between z and Micro Sign assertUnchanged(upper, lower, c); } else if (c == 0xB5) { // Special case for Micro Sign - assertEquals(upper, 0x39C); - assertEquals(lower, c); + assertEquals(0x39C, upper); + assertEquals(c, lower); } else if (c < 0xC0) { // Between my and A-grave assertUnchanged(upper, lower, c); } else if (c < 0xD7) { // A-grave - O with Diaeresis - assertEquals(upper, c); - assertEquals(lower, c + 32); + assertEquals(c, upper); + assertEquals(c + 32, lower); } else if (c == 0xD7) { // Multiplication assertUnchanged(upper, lower, c); } else if (c <= 0xDE) { // O with slash - Thorn - assertEquals(upper, c); - assertEquals(lower, c + 32); + assertEquals(c, upper); + assertEquals(c + 32, lower); } else if (c == 0xDF) { // Sharp s assertUnchanged(upper, lower, c); } else if (c < 0xF7) { // a-grave - divsion - assertEquals(upper, c - 32); - assertEquals(lower, c); + assertEquals(c - 32, upper); + assertEquals(c, lower); } else if (c == 0xF7) { // Division assertUnchanged(upper, lower, c); } else if (c < 0xFF) { // o with slash - thorn - assertEquals(upper, c - 32); - assertEquals(lower, c); + assertEquals(c - 32, upper); + assertEquals(c, lower); } else if (c == 0XFF) { // Special case for y with Diaeresis - assertEquals(upper, 0x178); - assertEquals(lower, c); + assertEquals(0x178, upper); + assertEquals(c, lower); } else { fail("Uncovered code point: " + Integer.toHexString(c)); } @@ -86,7 +85,7 @@ public void shouldUpperCaseAndLowerCaseLatin1() { } private static void assertUnchanged(int upper, int lower, int c) { - assertEquals(upper, c); - assertEquals(lower, c); + assertEquals(c, upper); + assertEquals(c, lower); } } diff --git a/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java b/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java index 30382c3cfe39..86b9fe6ea692 100644 --- a/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java +++ b/test/jdk/java/lang/Character/UnicodeBlock/NumberEntities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,17 +28,17 @@ * of Character.UnicodeBlock constants. Also checks the size of * Character.UnicodeScript's "aliases" map. * @modules java.base/java.lang:open - * @run testng NumberEntities + * @run junit NumberEntities */ -import static org.testng.Assert.assertEquals; -import org.testng.annotations.Test; - import java.lang.reflect.Field; import java.util.Map; -@Test +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + public class NumberEntities { + @Test public void test_UnicodeBlock_NumberEntities() throws Throwable { // The number of entries in Character.UnicodeBlock.map. // See src/java.base/share/classes/java/lang/Character.java @@ -46,13 +46,14 @@ public void test_UnicodeBlock_NumberEntities() throws Throwable { Field m = Character.UnicodeBlock.class.getDeclaredField("map"); n.setAccessible(true); m.setAccessible(true); - assertEquals(((Map)m.get(null)).size(), n.getInt(null)); + assertEquals(n.getInt(null), ((Map)m.get(null)).size()); } + @Test public void test_UnicodeScript_aliases() throws Throwable { // The number of entries in Character.UnicodeScript.aliases. // See src/java.base/share/classes/java/lang/Character.java Field aliases = Character.UnicodeScript.class.getDeclaredField("aliases"); aliases.setAccessible(true); - assertEquals(((Map)aliases.get(null)).size(), Character.UnicodeScript.UNKNOWN.ordinal() + 1); + assertEquals(Character.UnicodeScript.UNKNOWN.ordinal() + 1, ((Map)aliases.get(null)).size()); } } diff --git a/test/jdk/java/lang/StringBuilder/HugeCapacity.java b/test/jdk/java/lang/StringBuilder/HugeCapacity.java index a584ce1f07a9..bd6eb51f53bc 100644 --- a/test/jdk/java/lang/StringBuilder/HugeCapacity.java +++ b/test/jdk/java/lang/StringBuilder/HugeCapacity.java @@ -27,8 +27,8 @@ * @summary Capacity should not get close to Integer.MAX_VALUE unless * necessary * @requires (sun.arch.data.model == "64" & os.maxMemory >= 8G) - * @run main/othervm -Xms6G -Xmx6G -XX:+CompactStrings HugeCapacity true - * @run main/othervm -Xms6G -Xmx6G -XX:-CompactStrings HugeCapacity false + * @run main/othervm -Xms8G -Xmx8G -XX:-CompactStrings -Xlog:gc HugeCapacity false + * @run main/othervm -Xms8G -Xmx8G -XX:+CompactStrings -Xlog:gc HugeCapacity true */ public class HugeCapacity { diff --git a/test/jdk/java/lang/Thread/virtual/JfrEvents.java b/test/jdk/java/lang/Thread/virtual/JfrEvents.java index f731702990f0..1cad7fa42028 100644 --- a/test/jdk/java/lang/Thread/virtual/JfrEvents.java +++ b/test/jdk/java/lang/Thread/virtual/JfrEvents.java @@ -27,7 +27,8 @@ * @requires vm.continuations & vm.hasJFR * @modules jdk.jfr java.base/java.lang:+open * @library /test/lib - * @run junit/othervm --enable-native-access=ALL-UNNAMED JfrEvents + * @compile --enable-preview -source ${jdk.version} JfrEvents.java + * @run junit/othervm --enable-preview --enable-native-access=ALL-UNNAMED JfrEvents */ import java.io.IOException; @@ -44,6 +45,7 @@ import java.util.concurrent.locks.LockSupport; import java.util.function.Consumer; import java.util.stream.Collectors; +import java.util.stream.IntStream; import java.util.stream.Stream; import jdk.jfr.EventType; @@ -72,12 +74,13 @@ void testVirtualThreadStartAndEnd() throws Exception { // execute 100 tasks, each in their own virtual thread recording.start(); - ThreadFactory factory = Thread.ofVirtual().factory(); - try (var executor = Executors.newThreadPerTaskExecutor(factory)) { - for (int i = 0; i < 100; i++) { - executor.submit(() -> { }); + try { + List threads = IntStream.range(0, 100) + .mapToObj(_ -> Thread.startVirtualThread(() -> { })) + .toList(); + for (Thread t : threads) { + t.join(); } - Thread.sleep(1000); // give time for thread end events to be recorded } finally { recording.stop(); } diff --git a/test/jdk/java/lang/Thread/virtual/stress/Skynet.java b/test/jdk/java/lang/Thread/virtual/stress/Skynet.java index ee45fc827b00..d4678ce39d0a 100644 --- a/test/jdk/java/lang/Thread/virtual/stress/Skynet.java +++ b/test/jdk/java/lang/Thread/virtual/stress/Skynet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,14 @@ * @summary Stress test virtual threads with a variation of the Skynet 1M benchmark * @requires vm.continuations * @requires !vm.debug | vm.gc != "Z" - * @run main/othervm/timeout=300 -Xmx1500m Skynet + * @run main/othervm/timeout=400 -Xmx1500m Skynet */ /* * @test id=ZSinglegen * @requires vm.debug == true & vm.continuations * @requires vm.gc.ZSinglegen - * @run main/othervm/timeout=300 -XX:+UnlockDiagnosticVMOptions + * @run main/othervm/timeout=400 -XX:+UnlockDiagnosticVMOptions * -XX:+UseZGC -XX:-ZGenerational * -XX:+ZVerifyOops -XX:ZCollectionInterval=0.01 -Xmx1500m Skynet */ @@ -42,7 +42,7 @@ * @test id=ZGenerational * @requires vm.debug == true & vm.continuations * @requires vm.gc.ZGenerational - * @run main/othervm/timeout=300 -XX:+UnlockDiagnosticVMOptions + * @run main/othervm/timeout=400 -XX:+UnlockDiagnosticVMOptions * -XX:+UseZGC -XX:+ZGenerational * -XX:+ZVerifyOops -XX:ZCollectionInterval=0.01 -Xmx1500m Skynet */ diff --git a/test/jdk/java/lang/instrument/RetransformBigClassTest.java b/test/jdk/java/lang/instrument/RetransformBigClassTest.java new file mode 100644 index 000000000000..c4788217be16 --- /dev/null +++ b/test/jdk/java/lang/instrument/RetransformBigClassTest.java @@ -0,0 +1,161 @@ +/* + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* + * @test + * @bug 8277444 + * + * @library /test/lib + * @compile SimpleIdentityTransformer.java + * @run shell MakeJAR.sh retransformAgent + * @run main/othervm -javaagent:retransformAgent.jar RetransformBigClassTest + */ + +import jdk.test.lib.compiler.InMemoryJavaCompiler; + +/* + * JvmtiClassFileReconstituter::copy_bytecodes restores bytecodes rewritten + * by the linking process. It is used by RetransformClasses. + * JDK-8277444 is a data race between copy_bytecodes and the linking process. + * This test puts the linking process in one thread and the retransforming process + * in another thread. The test uses Class.forName("BigClass", false, classLoader) + * which does not link the class. When the class is used, the linking process starts. + * In another thread retransforming of the class is happening. + * We generate a class with big methods. A number of methods and their size are + * chosen to make the linking and retransforming processes run concurrently. + * We delay the retransforming process to follow the linking process. + * If there is no synchronization between the processes, a data race will happen. + */ +public class RetransformBigClassTest extends AInstrumentationTestCase { + + private static final Object LOCK = new Object(); + private static final int COUNTER_INC_COUNT = 2000; // A number of 'c+=1;' statements in methods of a class. + private static final int MIN_LINK_TIME_MS = 60; // Large enough so the linking and retransforming processes run in parallel. + private static final int RETRANSFORM_CLASSES_DELAY_MS = 37; // We manage to create a data race when a delay is in the range 0.52x - 0.62x of MIN_LINK_TIME_MS. + + private static Class bigClass; + private static byte[] bigClassBytecode; + + private Thread retransformThread; + + RetransformBigClassTest() { + super("RetransformBigClassTest"); + } + + public static void main(String[] args) throws Throwable { + new RetransformBigClassTest().runTest(); + } + + protected final void doRunTest() throws Throwable { + ClassLoader classLoader = new ClassLoader() { + @Override + protected Class findClass(String name) throws ClassNotFoundException { + if (name.equals("BigClass")) { + return defineClass(name, bigClassBytecode, 0, bigClassBytecode.length); + } + + return super.findClass(name); + } + }; + synchronized (LOCK) { + bigClass = Class.forName("BigClass", false, classLoader); + LOCK.notify(); + } + // Make a use of the BigClass + assertTrue(bigClass.getConstructor().newInstance().hashCode() != 0); + retransformThread.join(); + } + + private byte[] createClassBytecode(String className, int methodCount) throws Exception { + String methodBody = ""; + for (int j = 0; j < COUNTER_INC_COUNT; j++) { + methodBody += "c+=1;"; + } + + String classSrc = "public class " + className + " { int c;"; + + for (int i = 0; i < methodCount; i++) { + classSrc += "\npublic void m" + i + "(){"; + classSrc += methodBody; + classSrc += "\n}"; + } + classSrc += "\n}"; + + return InMemoryJavaCompiler.compile(className, classSrc); + } + + // We need a number of methods such that the linking time is greater than + // or equal to MIN_LINK_TIME_MS. + // We create a class having 5 methods and trigger the linking process. + // We measure the time taken and use it to calculate the needed number. + private int findMethodCount() throws Exception { + int methodCount = 5; + final String className = "BigClass" + methodCount; + final byte[] bytecode = createClassBytecode(className, methodCount); + ClassLoader classLoader = new ClassLoader() { + @Override + protected Class findClass(String name) throws ClassNotFoundException { + if (name.equals(className)) { + return defineClass(name, bytecode, 0, bytecode.length); + } + + return super.findClass(name); + } + }; + var bigClass = Class.forName(className, false, classLoader); + long startTime = System.nanoTime(); + assertTrue(bigClass.getConstructor().newInstance().hashCode() != 0); + double linkTimeMs = (System.nanoTime() - startTime) / 1000000.0; + System.out.println("Link time for a class with " + methodCount + " methods each having " + COUNTER_INC_COUNT + " counter increments: " + Math.round(linkTimeMs)); + if (linkTimeMs < MIN_LINK_TIME_MS) { + methodCount = (int)Math.round((MIN_LINK_TIME_MS * methodCount) / linkTimeMs); + } + System.out.println("The number of methods to exceed " + MIN_LINK_TIME_MS + " ms linking time: " + methodCount); + return methodCount; + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + bigClassBytecode = createClassBytecode("BigClass", findMethodCount()); + fInst.addTransformer(new SimpleIdentityTransformer()); + retransformThread = new Thread(() -> { + try { + synchronized (LOCK) { + while (bigClass == null) { + System.out.println("[retransformThread]: Waiting for bigClass"); + LOCK.wait(); + } + } + Thread.sleep(RETRANSFORM_CLASSES_DELAY_MS); + fInst.retransformClasses(bigClass); + } catch (Exception e) { + e.printStackTrace(); + } + }); + retransformThread.start(); + Thread.sleep(100); + } +} diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java b/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java index 6acd4fb30e1d..0e9c708e8e9f 100644 --- a/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java +++ b/test/jdk/java/lang/invoke/MethodHandleProxies/Driver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,12 +21,12 @@ * questions. */ -/** +/* * @test * @bug 8280377 * @build m1/* m2/* Unnamed * @run testng/othervm m1/p1.Main - * @run testng/othervm Unnamed + * @run main/othervm Unnamed * @summary Test MethodHandleProxies::asInterfaceInstance with a default * method with varargs */ diff --git a/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java b/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java index f42071f04275..f60f36ca9de7 100644 --- a/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java +++ b/test/jdk/java/lang/invoke/MethodHandleProxies/Unnamed.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ public static void main(String... args) throws Throwable { // verify that the caller has no access to the proxy created on an // inaccessible interface - Method m = intf.getMethod("test", Object[].class); - assertFalse(m.canAccess(null)); + Method m = intf.getMethod("test"); + assertFalse(m.canAccess(t)); } } diff --git a/test/jdk/java/lang/invoke/TestVHInvokerCaching.java b/test/jdk/java/lang/invoke/TestVHInvokerCaching.java index ccd97f82e9b4..0a1ae5914ca0 100644 --- a/test/jdk/java/lang/invoke/TestVHInvokerCaching.java +++ b/test/jdk/java/lang/invoke/TestVHInvokerCaching.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ import java.util.List; import static java.lang.invoke.MethodHandles.lookup; -import static org.testng.Assert.assertSame; +import static org.testng.Assert.*; public class TestVHInvokerCaching { @@ -74,7 +74,7 @@ class Holder { MethodHandles.Lookup lookup = lookup(); - for (Field field : Holder.class.getFields()) { + for (Field field : Holder.class.getDeclaredFields()) { String fieldName = field.getName(); Class fieldType = field.getType(); @@ -82,6 +82,8 @@ class Holder { testHandles.add(lookup.findVarHandle(Holder.class, fieldName, fieldType)); } + assertFalse(testHandles.isEmpty()); + return testHandles.stream().map(vh -> new Object[]{ vh }).toArray(Object[][]::new); } } diff --git a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java index de1b22c4075a..b093f086ba44 100644 --- a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java +++ b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,18 +35,14 @@ * @test * @bug 4982128 * @summary Test low memory detection of non-heap memory pool - * - * @run main/othervm/timeout=600 -Xnoclassgc -XX:MaxMetaspaceSize=32m - * LowMemoryTest2 - */ - -/* - * @test - * @bug 4982128 - * @summary Test low memory detection of non-heap memory pool - * - * @run main/othervm/timeout=600 -Xnoclassgc -XX:MaxMetaspaceSize=16m - * -XX:CompressedClassSpaceSize=4m LowMemoryTest2 + * @library /test/lib + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xnoclassgc -XX:MaxMetaspaceSize=32m LowMemoryTest2 + * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xnoclassgc -XX:MaxMetaspaceSize=16m + * -XX:CompressedClassSpaceSize=4m LowMemoryTest2 */ import java.lang.management.*; @@ -54,6 +50,8 @@ import javax.management.openmbean.CompositeData; import java.util.*; +import jdk.test.whitebox.WhiteBox; + public class LowMemoryTest2 { private static volatile boolean listenerInvoked = false; @@ -177,7 +175,7 @@ public void run() { // If we don't force a GC we may get an // OutOfMemoryException before the counters are updated. System.out.println("Force GC"); - System.gc(); + WhiteBox.getWhiteBox().fullGC(); } isThresholdCountSet = isAnyThresholdCountSet(pools); } diff --git a/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java b/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java index 801f2e5fca6c..e023a3a5839b 100644 --- a/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java +++ b/test/jdk/java/lang/module/customfs/ModulesInCustomFileSystem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ * @library /test/lib * @build ModulesInCustomFileSystem m1/* m2/* * jdk.test.lib.util.JarUtils - * @run testng/othervm ModulesInCustomFileSystem + * @run testng/othervm -Djava.io.tmpdir=. ModulesInCustomFileSystem * @summary Test ModuleFinder to find modules in a custom file system */ diff --git a/test/jdk/java/lang/ref/FinalizerHistogramTest.java b/test/jdk/java/lang/ref/FinalizerHistogramTest.java index 66cf76ea7f22..192c229c7b58 100644 --- a/test/jdk/java/lang/ref/FinalizerHistogramTest.java +++ b/test/jdk/java/lang/ref/FinalizerHistogramTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,9 @@ * questions. */ -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; +import jdk.test.whitebox.WhiteBox; + +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.ReentrantLock; import java.lang.reflect.Method; @@ -32,37 +33,49 @@ * @test * @summary Unit test for FinalizerHistogram * @modules java.base/java.lang.ref:open - * @run main FinalizerHistogramTest + * @library /test/lib + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm + * -Xbootclasspath/a:. + * -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * FinalizerHistogramTest */ public class FinalizerHistogramTest { static ReentrantLock lock = new ReentrantLock(); - static volatile int wasInitialized = 0; - static volatile int wasTrapped = 0; - static final int objectsCount = 1000; + static final AtomicInteger initializedCount = new AtomicInteger(0); + static final int OBJECTS_COUNT = 1000; + + static WhiteBox wb; static class MyObject { public MyObject() { // Make sure object allocation/deallocation is not optimized out - wasInitialized += 1; + initializedCount.incrementAndGet(); } protected void finalize() { // Trap the object in a finalization queue - wasTrapped += 1; lock.lock(); } } - public static void main(String[] argvs) { + public static void main(String[] argvs) throws InterruptedException { try { lock.lock(); - for(int i = 0; i < objectsCount; ++i) { + for(int i = 0; i < OBJECTS_COUNT; ++i) { new MyObject(); } - System.out.println("Objects intialized: " + objectsCount); - System.gc(); - while(wasTrapped < 1); + System.out.println("Objects intialized: " + initializedCount.get()); + wb = WhiteBox.getWhiteBox(); + wb.fullGC(); + boolean refProResult; + do { + refProResult = wb.waitForReferenceProcessing(); + System.out.println("waitForReferenceProcessing returned: " + refProResult); + } while (refProResult); Class klass = Class.forName("java.lang.ref.FinalizerHistogram"); diff --git a/test/jdk/java/net/URL/EarlyOrDelayedParsing.java b/test/jdk/java/net/URL/EarlyOrDelayedParsing.java index 57fa76c23bb8..e286631be6b3 100644 --- a/test/jdk/java/net/URL/EarlyOrDelayedParsing.java +++ b/test/jdk/java/net/URL/EarlyOrDelayedParsing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,10 @@ import java.io.IOException; import java.net.ConnectException; import java.net.MalformedURLException; +import java.net.Proxy; +import java.net.ProxySelector; +import java.net.SocketAddress; +import java.net.URI; import java.net.URL; import java.net.UnknownHostException; import java.util.ArrayList; @@ -57,6 +61,19 @@ public class EarlyOrDelayedParsing { { String value = System.getProperty("jdk.net.url.delayParsing", "false"); EARLY_PARSING = !value.isEmpty() && !Boolean.parseBoolean(value); + if (!EARLY_PARSING) { + // we will open the connection in that case. + // make sure no proxy is selected + ProxySelector.setDefault(new ProxySelector() { + @Override + public List select(URI uri) { + return List.of(Proxy.NO_PROXY); + } + @Override + public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { + } + }); + } } // Some characters that when included at the wrong place diff --git a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java index 4079bd81e3e1..265c661b81b6 100644 --- a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java +++ b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java @@ -25,15 +25,6 @@ import com.sun.net.httpserver.HttpsConfigurator; import com.sun.net.httpserver.HttpsServer; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.ITestContext; -import org.testng.ITestResult; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import javax.net.ssl.SSLContext; import java.io.IOException; @@ -52,7 +43,6 @@ import java.net.http.HttpResponse.BodyHandlers; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.util.Arrays; import java.util.EnumSet; import java.util.List; import java.util.Set; @@ -80,24 +70,31 @@ import static java.net.http.HttpClient.Version.HTTP_1_1; import static java.net.http.HttpClient.Version.HTTP_2; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import org.junit.jupiter.api.AfterAll; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.extension.TestWatcher; public abstract class AbstractThrowingPublishers implements HttpServerAdapters { - SSLContext sslContext; - HttpTestServer httpTestServer; // HTTP/1.1 [ 4 servers ] - HttpTestServer httpsTestServer; // HTTPS/1.1 - HttpTestServer http2TestServer; // HTTP/2 ( h2c ) - HttpTestServer https2TestServer; // HTTP/2 ( h2 ) - String httpURI_fixed; - String httpURI_chunk; - String httpsURI_fixed; - String httpsURI_chunk; - String http2URI_fixed; - String http2URI_chunk; - String https2URI_fixed; - String https2URI_chunk; + static SSLContext sslContext; + static HttpTestServer httpTestServer; // HTTP/1.1 [ 4 servers ] + static HttpTestServer httpsTestServer; // HTTPS/1.1 + static HttpTestServer http2TestServer; // HTTP/2 ( h2c ) + static HttpTestServer https2TestServer; // HTTP/2 ( h2 ) + static String httpURI_fixed; + static String httpURI_chunk; + static String httpsURI_fixed; + static String httpsURI_chunk; + static String http2URI_fixed; + static String http2URI_chunk; + static String https2URI_fixed; + static String https2URI_chunk; static final int ITERATION_COUNT = 1; // a shared executor helps reduce the amount of threads created by the test @@ -115,8 +112,34 @@ public static String now() { return String.format("[%d s, %d ms, %d ns] ", secs, mill, nan); } - final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; - private volatile HttpClient sharedClient; + final static class TestStopper implements TestWatcher, BeforeEachCallback { + final AtomicReference failed = new AtomicReference<>(); + TestStopper() { } + @Override + public void testFailed(ExtensionContext context, Throwable cause) { + if (stopAfterFirstFailure()) { + String msg = "Aborting due to: " + cause; + failed.compareAndSet(null, msg); + FAILURES.putIfAbsent(context.getDisplayName(), cause); + System.out.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n", + now(), context.getDisplayName(), cause); + System.err.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n", + now(), context.getDisplayName(), cause); + } + } + + @Override + public void beforeEach(ExtensionContext context) { + String msg = failed.get(); + Assumptions.assumeTrue(msg == null, msg); + } + } + + @RegisterExtension + static final TestStopper stopper = new TestStopper(); + + static final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; + private static volatile HttpClient sharedClient; static class TestExecutor implements Executor { final AtomicLong tasks = new AtomicLong(); @@ -142,34 +165,12 @@ public void execute(Runnable command) { } } - protected boolean stopAfterFirstFailure() { + protected static boolean stopAfterFirstFailure() { return Boolean.getBoolean("jdk.internal.httpclient.debug"); } - final AtomicReference skiptests = new AtomicReference<>(); - void checkSkip() { - var skip = skiptests.get(); - if (skip != null) throw skip; - } - static String name(ITestResult result) { - var params = result.getParameters(); - return result.getName() - + (params == null ? "()" : Arrays.toString(result.getParameters())); - } - - @BeforeMethod - void beforeMethod(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - if (skiptests.get() == null) { - SkipException skip = new SkipException("some tests failed"); - skip.setStackTrace(new StackTraceElement[0]); - skiptests.compareAndSet(null, skip); - } - } - } - - @AfterClass - static final void printFailedTests(ITestContext context) { + @AfterAll + static final void printFailedTests() { out.println("\n========================="); try { // Exceptions should already have been added to FAILURES @@ -193,7 +194,7 @@ static final void printFailedTests(ITestContext context) { } } - private String[] uris() { + private static String[] uris() { return new String[] { httpURI_fixed, httpURI_chunk, @@ -206,8 +207,7 @@ private String[] uris() { }; } - @DataProvider(name = "sanity") - public Object[][] sanity() { + public static Object[][] sanity() { String[] uris = uris(); Object[][] result = new Object[uris.length * 2][]; //Object[][] result = new Object[uris.length][]; @@ -238,7 +238,7 @@ public void accept(Where where) { } } - private Object[][] variants(List throwers, Set whereValues) { + private static Object[][] variants(List throwers, Set whereValues) { String[] uris = uris(); Object[][] result = new Object[uris.length * 2 * throwers.size()][]; //Object[][] result = new Object[(uris.length/2) * 2 * 2][]; @@ -257,80 +257,52 @@ private Object[][] variants(List throwers, Set whereValues) { return result; } - @DataProvider(name = "subscribeProvider") - public Object[][] subscribeProvider(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] subscribeProvider() { return variants(List.of( new UncheckedCustomExceptionThrower(), new UncheckedIOExceptionThrower()), EnumSet.of(Where.BEFORE_SUBSCRIBE, Where.AFTER_SUBSCRIBE)); } - @DataProvider(name = "requestProvider") - public Object[][] requestProvider(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] requestProvider() { return variants(List.of( new UncheckedCustomExceptionThrower(), new UncheckedIOExceptionThrower()), EnumSet.of(Where.BEFORE_REQUEST, Where.AFTER_REQUEST)); } - @DataProvider(name = "nextRequestProvider") - public Object[][] nextRequestProvider(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] nextRequestProvider() { return variants(List.of( new UncheckedCustomExceptionThrower(), new UncheckedIOExceptionThrower()), EnumSet.of(Where.BEFORE_NEXT_REQUEST, Where.AFTER_NEXT_REQUEST)); } - @DataProvider(name = "beforeCancelProviderIO") - public Object[][] beforeCancelProviderIO(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] beforeCancelProviderIO() { return variants(List.of( new UncheckedIOExceptionThrower()), EnumSet.of(Where.BEFORE_CANCEL)); } - @DataProvider(name = "afterCancelProviderIO") - public Object[][] afterCancelProviderIO(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] afterCancelProviderIO() { return variants(List.of( new UncheckedIOExceptionThrower()), EnumSet.of(Where.AFTER_CANCEL)); } - @DataProvider(name = "beforeCancelProviderCustom") - public Object[][] beforeCancelProviderCustom(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] beforeCancelProviderCustom() { return variants(List.of( new UncheckedCustomExceptionThrower()), EnumSet.of(Where.BEFORE_CANCEL)); } - @DataProvider(name = "afterCancelProviderCustom") - public Object[][] afterCancelProvider(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] afterCancelProviderCustom() { return variants(List.of( new UncheckedCustomExceptionThrower()), EnumSet.of(Where.AFTER_CANCEL)); } - private HttpClient makeNewClient() { + private static HttpClient makeNewClient() { clientCount.incrementAndGet(); return TRACKER.track(HttpClient.newBuilder() .proxy(HttpClient.Builder.NO_PROXY) @@ -339,11 +311,11 @@ private HttpClient makeNewClient() { .build()); } - HttpClient newHttpClient(boolean share) { + static HttpClient newHttpClient(boolean share) { if (!share) return makeNewClient(); HttpClient shared = sharedClient; if (shared != null) return shared; - synchronized (this) { + synchronized (AbstractThrowingPublishers.class) { shared = sharedClient; if (shared == null) { shared = sharedClient = makeNewClient(); @@ -387,7 +359,7 @@ protected void testSanityImpl(String uri, boolean sameClient) CompletableFuture> response = client.sendAsync(req, handler); String body = response.join().body(); - assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining())); + assertEquals(Stream.of(BODY.split("\\|")).collect(Collectors.joining()), body); if (!sameClient) { // Wait for the client to be garbage collected. // we use the ReferenceTracker API rather than HttpClient::close here, @@ -431,7 +403,6 @@ private void testThrowing(String name, String uri, boolean sameClient, boolean async, Set whereValues) throws Exception { - checkSkip(); out.printf("%n%s%s%n", now(), name); try { testThrowing(uri, sameClient, publishers, finisher, thrower, async, whereValues); @@ -721,8 +692,11 @@ public void onError(Throwable throwable) { } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + public static void setup() throws Exception { + System.out.println(now() + "setup"); + System.err.println(now() + "setup"); + sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); @@ -765,8 +739,11 @@ public void setup() throws Exception { https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + public static void teardown() throws Exception { + System.out.println(now() + "teardown"); + System.err.println(now() + "teardown"); + String sharedClientName = sharedClient == null ? null : sharedClient.toString(); sharedClient = null; diff --git a/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java b/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java index b5230d48d104..50200c86b430 100644 --- a/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java +++ b/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java @@ -35,18 +35,10 @@ * ReferenceTracker AbstractThrowingPushPromises * jdk.httpclient.test.lib.common.HttpServerAdapters * - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true */ import jdk.test.lib.net.SimpleSSLContext; -import org.testng.ITestContext; -import org.testng.ITestResult; -import org.testng.SkipException; -import org.testng.annotations.AfterTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; import javax.net.ssl.SSLContext; import java.io.BufferedReader; @@ -95,18 +87,29 @@ import static java.lang.String.format; import static java.net.http.HttpClient.Version.HTTP_2; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - +import org.junit.jupiter.api.AfterAll; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.extension.TestWatcher; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public abstract class AbstractThrowingPushPromises implements HttpServerAdapters { - SSLContext sslContext; - HttpTestServer http2TestServer; // HTTP/2 ( h2c ) - HttpTestServer https2TestServer; // HTTP/2 ( h2 ) - String http2URI_fixed; - String http2URI_chunk; - String https2URI_fixed; - String https2URI_chunk; + static SSLContext sslContext; + static HttpTestServer http2TestServer; // HTTP/2 ( h2c ) + static HttpTestServer https2TestServer; // HTTP/2 ( h2 ) + static String http2URI_fixed; + static String http2URI_chunk; + static String https2URI_fixed; + static String https2URI_chunk; static final int ITERATION_COUNT = 1; // a shared executor helps reduce the amount of threads created by the test @@ -124,8 +127,34 @@ public static String now() { return String.format("[%d s, %d ms, %d ns] ", secs, mill, nan); } - final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; - private volatile HttpClient sharedClient; + static final class TestStopper implements TestWatcher, BeforeEachCallback { + final AtomicReference failed = new AtomicReference<>(); + TestStopper() { } + @Override + public void testFailed(ExtensionContext context, Throwable cause) { + if (stopAfterFirstFailure()) { + String msg = "Aborting due to: " + cause; + failed.compareAndSet(null, msg); + FAILURES.putIfAbsent(context.getDisplayName(), cause); + System.out.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n", + now(), context.getDisplayName(), cause); + System.err.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n", + now(), context.getDisplayName(), cause); + } + } + + @Override + public void beforeEach(ExtensionContext context) { + String msg = failed.get(); + Assumptions.assumeTrue(msg == null, msg); + } + } + + @RegisterExtension + static final TestStopper stopper = new TestStopper(); + + static final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; + private static volatile HttpClient sharedClient; static class TestExecutor implements Executor { final AtomicLong tasks = new AtomicLong(); @@ -151,34 +180,13 @@ public void execute(Runnable command) { } } - protected boolean stopAfterFirstFailure() { + protected static boolean stopAfterFirstFailure() { return Boolean.getBoolean("jdk.internal.httpclient.debug"); } - final AtomicReference skiptests = new AtomicReference<>(); - void checkSkip() { - var skip = skiptests.get(); - if (skip != null) throw skip; - } - static String name(ITestResult result) { - var params = result.getParameters(); - return result.getName() - + (params == null ? "()" : Arrays.toString(result.getParameters())); - } - @BeforeMethod - void beforeMethod(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - if (skiptests.get() == null) { - SkipException skip = new SkipException("some tests failed"); - skip.setStackTrace(new StackTraceElement[0]); - skiptests.compareAndSet(null, skip); - } - } - } - - @AfterClass - static final void printFailedTests(ITestContext context) { + @AfterAll + static final void printFailedTests() { out.println("\n========================="); try { // Exceptions should already have been added to FAILURES @@ -203,7 +211,7 @@ static final void printFailedTests(ITestContext context) { } } - private String[] uris() { + private static String[] uris() { return new String[] { http2URI_fixed, http2URI_chunk, @@ -212,8 +220,7 @@ private String[] uris() { }; } - @DataProvider(name = "sanity") - public Object[][] sanity() { + public static Object[][] sanity() { String[] uris = uris(); Object[][] result = new Object[uris.length * 2][]; @@ -242,7 +249,7 @@ public void accept(Where where) { } } - private Object[][] variants(List throwers) { + private static Object[][] variants(List throwers) { String[] uris = uris(); // reduce traces by always using the same client if // stopAfterFirstFailure is requested. @@ -262,25 +269,17 @@ private Object[][] variants(List throwers) { return result; } - @DataProvider(name = "ioVariants") - public Object[][] ioVariants(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] ioVariants() { return variants(List.of( new UncheckedIOExceptionThrower())); } - @DataProvider(name = "customVariants") - public Object[][] customVariants(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] customVariants() { return variants(List.of( new UncheckedCustomExceptionThrower())); } - private HttpClient makeNewClient() { + private static HttpClient makeNewClient() { clientCount.incrementAndGet(); return TRACKER.track(HttpClient.newBuilder() .proxy(HttpClient.Builder.NO_PROXY) @@ -289,11 +288,11 @@ private HttpClient makeNewClient() { .build()); } - HttpClient newHttpClient(boolean share) { + static HttpClient newHttpClient(boolean share) { if (!share) return makeNewClient(); HttpClient shared = sharedClient; if (shared != null) return shared; - synchronized (this) { + synchronized (AbstractThrowingPushPromises.class) { shared = sharedClient; if (shared == null) { shared = sharedClient = makeNewClient(); @@ -331,13 +330,13 @@ public void applyPushPromise(HttpRequest initiatingRequest, HttpResponse> response = client.sendAsync(req, BodyHandlers.ofLines(), pushHandler).get(); String body = response.body().collect(Collectors.joining("|")); - assertEquals(URI.create(body).getPath(), URI.create(uri).getPath()); + assertEquals(URI.create(uri).getPath(), URI.create(body).getPath()); for (HttpRequest promised : pushPromises.keySet()) { out.printf("%s Received promise: %s%n\tresponse: %s%n", now(), promised, pushPromises.get(promised).get()); String promisedBody = pushPromises.get(promised).get().body() .collect(Collectors.joining("|")); - assertEquals(promisedBody, promised.uri().toASCIIString()); + assertEquals(promised.uri().toASCIIString(), promisedBody); } assertEquals(3, pushPromises.size()); if (!sameClient) { @@ -402,7 +401,6 @@ private void testThrowing(String name, String uri, boolean sameClient, Finisher finisher, Thrower thrower) throws Exception { - checkSkip(); out.printf("%n%s%s%n", now(), name); try { testThrowing(uri, sameClient, handlers, finisher, thrower); @@ -577,9 +575,9 @@ private final List check(Where w, URI reqURI, default: expectedCount = 3; } - assertEquals(promises.size(), expectedCount, + assertEquals(expectedCount, promises.size(), "bad promise count for " + reqURI + " with " + w); - assertEquals(result, List.of(reqURI.toASCIIString())); + assertEquals(List.of(reqURI.toASCIIString()), result); return result; } @@ -732,8 +730,8 @@ public CompletionStage getBody() { } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + public static void setup() throws Exception { sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); @@ -759,8 +757,8 @@ public void setup() throws Exception { https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + public static void teardown() throws Exception { String sharedClientName = sharedClient == null ? null : sharedClient.toString(); sharedClient = null; diff --git a/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java b/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java index dc7ca3fe9d54..6ae8f3a90f67 100644 --- a/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java +++ b/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java @@ -22,14 +22,6 @@ */ import jdk.test.lib.net.SimpleSSLContext; -import org.testng.ITestContext; -import org.testng.ITestResult; -import org.testng.SkipException; -import org.testng.annotations.AfterTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; import javax.net.ssl.SSLContext; import java.io.BufferedReader; @@ -47,7 +39,6 @@ import java.net.http.HttpResponse.BodySubscriber; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.util.Arrays; import java.util.EnumSet; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -71,24 +62,33 @@ import static java.net.http.HttpClient.Version.HTTP_1_1; import static java.net.http.HttpClient.Version.HTTP_2; import static java.nio.charset.StandardCharsets.UTF_8; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import org.junit.jupiter.api.AfterAll; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.extension.TestWatcher; public abstract class AbstractThrowingSubscribers implements HttpServerAdapters { - SSLContext sslContext; - HttpTestServer httpTestServer; // HTTP/1.1 [ 4 servers ] - HttpTestServer httpsTestServer; // HTTPS/1.1 - HttpTestServer http2TestServer; // HTTP/2 ( h2c ) - HttpTestServer https2TestServer; // HTTP/2 ( h2 ) - String httpURI_fixed; - String httpURI_chunk; - String httpsURI_fixed; - String httpsURI_chunk; - String http2URI_fixed; - String http2URI_chunk; - String https2URI_fixed; - String https2URI_chunk; + static SSLContext sslContext; + static HttpTestServer httpTestServer; // HTTP/1.1 [ 4 servers ] + static HttpTestServer httpsTestServer; // HTTPS/1.1 + static HttpTestServer http2TestServer; // HTTP/2 ( h2c ) + static HttpTestServer https2TestServer; // HTTP/2 ( h2 ) + static String httpURI_fixed; + static String httpURI_chunk; + static String httpsURI_fixed; + static String httpsURI_chunk; + static String http2URI_fixed; + static String http2URI_chunk; + static String https2URI_fixed; + static String https2URI_chunk; static final int ITERATION_COUNT = 1; static final int REPEAT_RESPONSE = 3; @@ -107,8 +107,34 @@ public static String now() { return String.format("[%d s, %d ms, %d ns] ", secs, mill, nan); } - final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; - private volatile HttpClient sharedClient; + static final class TestStopper implements TestWatcher, BeforeEachCallback { + final AtomicReference failed = new AtomicReference<>(); + TestStopper() { } + @Override + public void testFailed(ExtensionContext context, Throwable cause) { + if (stopAfterFirstFailure()) { + String msg = "Aborting due to: " + cause; + failed.compareAndSet(null, msg); + FAILURES.putIfAbsent(context.getDisplayName(), cause); + System.out.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n", + now(), context.getDisplayName(), cause); + System.err.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n", + now(), context.getDisplayName(), cause); + } + } + + @Override + public void beforeEach(ExtensionContext context) { + String msg = failed.get(); + Assumptions.assumeTrue(msg == null, msg); + } + } + + @RegisterExtension + static final TestStopper stopper = new TestStopper(); + + static final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; + private static volatile HttpClient sharedClient; static class TestExecutor implements Executor { final AtomicLong tasks = new AtomicLong(); @@ -134,34 +160,12 @@ public void execute(Runnable command) { } } - protected boolean stopAfterFirstFailure() { + protected static boolean stopAfterFirstFailure() { return Boolean.getBoolean("jdk.internal.httpclient.debug"); } - final AtomicReference skiptests = new AtomicReference<>(); - void checkSkip() { - var skip = skiptests.get(); - if (skip != null) throw skip; - } - static String name(ITestResult result) { - var params = result.getParameters(); - return result.getName() - + (params == null ? "()" : Arrays.toString(result.getParameters())); - } - - @BeforeMethod - void beforeMethod(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - if (skiptests.get() == null) { - SkipException skip = new SkipException("some tests failed"); - skip.setStackTrace(new StackTraceElement[0]); - skiptests.compareAndSet(null, skip); - } - } - } - - @AfterClass - static final void printFailedTests(ITestContext context) { + @AfterAll + static final void printFailedTests() { out.println("\n========================="); try { // Exceptions should already have been added to FAILURES @@ -186,7 +190,7 @@ static final void printFailedTests(ITestContext context) { } } - private String[] uris() { + private static String[] uris() { return new String[] { httpURI_fixed, httpURI_chunk, @@ -199,10 +203,9 @@ private String[] uris() { }; } - static AtomicLong URICOUNT = new AtomicLong(); + static final AtomicLong URICOUNT = new AtomicLong(); - @DataProvider(name = "sanity") - public Object[][] sanity() { + public static Object[][] sanity() { String[] uris = uris(); Object[][] result = new Object[uris.length * 2][]; int i = 0; @@ -215,11 +218,7 @@ public Object[][] sanity() { return result; } - @DataProvider(name = "variants") - public Object[][] variants(ITestContext context) { - if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) { - return new Object[0][]; - } + public static Object[][] variants() { String[] uris = uris(); Object[][] result = new Object[uris.length * 2 * 2][]; int i = 0; @@ -236,7 +235,7 @@ public Object[][] variants(ITestContext context) { return result; } - private HttpClient makeNewClient() { + private static HttpClient makeNewClient() { clientCount.incrementAndGet(); HttpClient client = HttpClient.newBuilder() .proxy(HttpClient.Builder.NO_PROXY) @@ -246,11 +245,11 @@ private HttpClient makeNewClient() { return TRACKER.track(client); } - HttpClient newHttpClient(boolean share) { + static HttpClient newHttpClient(boolean share) { if (!share) return makeNewClient(); HttpClient shared = sharedClient; if (shared != null) return shared; - synchronized (this) { + synchronized (AbstractThrowingSubscribers.class) { shared = sharedClient; if (shared == null) { shared = sharedClient = makeNewClient(); @@ -307,7 +306,7 @@ protected void testSanityImpl(String uri, boolean sameClient) HttpResponse response = client.send(req, handler); String body = response.body(); Stream.of(body.split("\n")).forEach(u -> - assertEquals(URI.create(u).getPath(), URI.create(uri2).getPath())); + assertEquals(URI.create(uri2).getPath(), URI.create(u).getPath())); if (!sameClient) { // Wait for the client to be garbage collected. // we use the ReferenceTracker API rather than HttpClient::close here, @@ -419,7 +418,6 @@ private void testThrowing(String name, String uri, boolean sameClient, boolean async, EnumSet excludes) throws Exception { - checkSkip(); out.printf("%n%s%s%n", now(), name); try { testThrowing(uri, sameClient, handlers, finisher, thrower, async, excludes); @@ -498,7 +496,6 @@ private void testThrowing(String uri, boolean sameClient, if (error != null) throw error; System.out.println(now() + "operation finished normally: " + tracker.getName()); System.err.println(now() + "operation finished normally: " + tracker.getName()); - } } } @@ -758,8 +755,11 @@ public CompletionStage getBody() { } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + public static void setup() throws Exception { + System.out.println(now() + "setup"); + System.err.println(now() + "setup"); + sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); @@ -802,8 +802,11 @@ public void setup() throws Exception { https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + public static void teardown() throws Exception { + System.out.println(now() + "teardown"); + System.err.println(now() + "teardown"); + String sharedClientName = sharedClient == null ? null : sharedClient.toString(); sharedClient = null; diff --git a/test/jdk/java/net/httpclient/CancelledResponse2.java b/test/jdk/java/net/httpclient/CancelledResponse2.java new file mode 100644 index 000000000000..263620acf81d --- /dev/null +++ b/test/jdk/java/net/httpclient/CancelledResponse2.java @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestExchange; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.test.lib.RandomFactory; +import jdk.test.lib.net.SimpleSSLContext; +import org.testng.annotations.AfterTest; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import javax.net.ssl.SSLContext; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpClient.Version; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandler; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Random; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.Flow; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import static java.lang.System.out; +import static java.net.http.HttpClient.Version.*; +import static jdk.httpclient.test.lib.common.HttpServerAdapters.*; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + +/* + * @test + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * @run testng/othervm -Djdk.internal.httpclient.debug=true CancelledResponse2 + */ + +public class CancelledResponse2 { + + + HttpTestServer h2TestServer; + URI h2TestServerURI; + private SSLContext sslContext; + private static final Random random = RandomFactory.getRandom(); + private static final int MAX_CLIENT_DELAY = 160; + + @DataProvider(name = "versions") + public Object[][] positive() { + return new Object[][]{ + { HTTP_2, h2TestServerURI }, + }; + } + + private static void delay() { + int delay = random.nextInt(MAX_CLIENT_DELAY); + try { + System.out.println("client delay: " + delay); + Thread.sleep(delay); + } catch (InterruptedException x) { + out.println("Unexpected exception: " + x); + } + } + + @Test(dataProvider = "versions") + public void test(Version version, URI uri) throws Exception { + for (int i = 0; i < 5; i++) { + HttpClient httpClient = HttpClient.newBuilder().sslContext(sslContext).version(version).build(); + HttpRequest httpRequest = HttpRequest.newBuilder(uri) + .version(version) + .GET() + .build(); + AtomicBoolean cancelled = new AtomicBoolean(); + BodyHandler bh = ofString(response, cancelled); + CompletableFuture> cf = httpClient.sendAsync(httpRequest, bh); + try { + cf.get(); + } catch (Exception e) { + e.printStackTrace(); + assertTrue(e.getCause() instanceof IOException, "HTTP/2 should cancel with an IOException when the Subscription is cancelled."); + } + assertTrue(cf.isCompletedExceptionally()); + assertTrue(cancelled.get()); + } + } + + @BeforeTest + public void setup() throws IOException { + sslContext = new SimpleSSLContext().get(); + h2TestServer = HttpTestServer.create(HTTP_2, sslContext); + h2TestServer.addHandler(new CancelledResponseHandler(), "/h2"); + h2TestServerURI = URI.create("https://" + h2TestServer.serverAuthority() + "/h2"); + + h2TestServer.start(); + } + + @AfterTest + public void teardown() { + h2TestServer.stop(); + } + + BodyHandler ofString(String expected, AtomicBoolean cancelled) { + return new CancellingHandler(expected, cancelled); + } + + static class CancelledResponseHandler implements HttpTestHandler { + + @Override + public void handle(HttpTestExchange t) throws IOException { + + byte[] resp = response.getBytes(StandardCharsets.UTF_8); + + t.sendResponseHeaders(200, resp.length); + System.err.println(resp.length); + try (InputStream is = t.getRequestBody(); + OutputStream os = t.getResponseBody()) { + for (byte b : resp) { + // This can be used to verify that varying amounts of the response data are sent. + System.err.print((char) b); + os.write(b); + os.flush(); + try { + Thread.sleep(1); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + } + } + } + + static final String response = "Lorem ipsum dolor sit amet consectetur adipiscing elit, sed do eiusmod tempor quis" + + " nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."; + + record CancellingHandler(String expected, AtomicBoolean cancelled) implements BodyHandler { + @Override + public HttpResponse.BodySubscriber apply(HttpResponse.ResponseInfo rinfo) { + assert !cancelled.get(); + return new CancellingBodySubscriber(expected, cancelled); + } + } + + + static class CancellingBodySubscriber implements HttpResponse.BodySubscriber { + private final String expected; + private final CompletableFuture result; + private Flow.Subscription subscription; + final AtomicInteger index = new AtomicInteger(); + final AtomicBoolean cancelled; + CancellingBodySubscriber(String expected, AtomicBoolean cancelled) { + this.cancelled = cancelled; + this.expected = expected; + result = new CompletableFuture<>(); + } + + @Override + public CompletionStage getBody() { + return result; + } + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.subscription = subscription; + subscription.request(1); + } + + @Override + public void onNext(List item) { + //if (result.isDone()) + // Max Delay is 180ms as there is 160 characters in response which gives at least 160ms in some test cases and + // allows a response to complete fully with a lee-way of 20ms in other cases. Otherwise, response body is + // usually partial. Each character is written by the server handler with a 1ms delay. + delay(); + for (ByteBuffer b : item) { + while (b.hasRemaining() && !result.isDone()) { + int i = index.getAndIncrement(); + char at = expected.charAt(i); + byte[] data = new byte[b.remaining()]; + b.get(data); // we know that the server writes 1 char + String s = new String(data); + char c = s.charAt(0); + System.err.print(c); + if (c != at) { + Throwable x = new IllegalStateException("char at " + + i + " is '" + c + "' expected '" + + at + "' for \"" + expected +"\""); + out.println("unexpected char received, cancelling"); + subscription.cancel(); + result.completeExceptionally(x); + return; + } + } + System.err.println(); + } + if (index.get() > 0 && !result.isDone()) { + // we should complete the result here, but let's + // see if we get something back... + out.println("Cancelling subscription after reading " + index.get()); + cancelled.set(true); + subscription.cancel(); + result.completeExceptionally(new CancelException()); + return; + } + if (!result.isDone()) { + out.println("requesting 1 more"); + subscription.request(1); + } + } + + @Override + public void onError(Throwable throwable) { + result.completeExceptionally(throwable); + } + + @Override + public void onComplete() { + int len = index.get(); + if (len == expected.length()) { + result.complete(expected); + } else { + Throwable x = new IllegalStateException("received only " + + len + " chars, expected " + expected.length() + + " for \"" + expected +"\""); + result.completeExceptionally(x); + } + } + } + + static class CancelException extends IOException { + } +} diff --git a/test/jdk/java/net/httpclient/EmptyAuthenticate.java b/test/jdk/java/net/httpclient/EmptyAuthenticate.java index 2e80e1bdc813..ca5c41594e80 100644 --- a/test/jdk/java/net/httpclient/EmptyAuthenticate.java +++ b/test/jdk/java/net/httpclient/EmptyAuthenticate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,55 +24,120 @@ /* * @test * @bug 8263899 - * @summary HttpClient throws NPE in AuthenticationFilter when parsing www-authenticate head - * - * @run main/othervm EmptyAuthenticate + * @summary Verifies that empty `WWW-Authenticate` header is correctly parsed + * @library /test/jdk/java/net/httpclient/lib + * /test/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.net.SimpleSSLContext + * @run junit EmptyAuthenticate */ -import com.sun.net.httpserver.HttpServer; + +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.test.lib.net.SimpleSSLContext; +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.OutputStream; -import java.net.InetSocketAddress; import java.net.URI; -import java.net.URISyntaxException; import java.net.http.HttpClient; +import java.net.http.HttpClient.Version; +import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.stream.Stream; -public class EmptyAuthenticate { - - public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException { - int port = 0; - - //start server: - HttpServer server = HttpServer.create(new InetSocketAddress(port), 0); - port = server.getAddress().getPort(); - server.createContext("/", exchange -> { - String response = "test body"; - //this empty header will make the HttpClient throw NPE - exchange.getResponseHeaders().add("www-authenticate", ""); - exchange.sendResponseHeaders(401, response.length()); - OutputStream os = exchange.getResponseBody(); - os.write(response.getBytes()); - os.close(); - }); - server.start(); +import static java.net.http.HttpClient.Builder.NO_PROXY; +import static org.junit.jupiter.api.Assertions.assertEquals; - HttpResponse response = null; - //run client: +class EmptyAuthenticate { + + private static final SSLContext SSL_CONTEXT = createSslContext(); + + private static final String WWW_AUTH_HEADER_NAME = "WWW-Authenticate"; + + private static SSLContext createSslContext() { try { - HttpClient httpClient = HttpClient.newHttpClient(); - HttpRequest request = HttpRequest.newBuilder(new URI("http://localhost:" + port + "/")).GET().build(); - //this line will throw NPE (wrapped by IOException) when parsing empty www-authenticate response header in AuthenticationFilter: - response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); - boolean ok = !response.headers().firstValue("WWW-Authenticate").isEmpty(); - if (!ok) { - throw new RuntimeException("WWW-Authenicate missing"); - } - } catch (IOException e) { - e.printStackTrace(); - throw new RuntimeException("Test failed"); + return new SimpleSSLContext().get(); + } catch (IOException exception) { + throw new RuntimeException(exception); + } + } + + @ParameterizedTest + @MethodSource("args") + void test(Version version, boolean secure) throws Exception { + String handlerPath = "/%s/%s/".formatted(EmptyAuthenticate.class.getSimpleName(), version); + String uriPath = handlerPath + (secure ? 's' : 'c'); + HttpTestServer server = createServer(version, secure, handlerPath); + try (HttpClient client = createClient(version, secure)) { + HttpRequest request = createRequest(server, secure, uriPath); + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.discarding()); + HttpHeaders responseHeaders = response.headers(); + assertEquals( + "", + responseHeaders.firstValue(WWW_AUTH_HEADER_NAME).orElse(null), + () -> "was expecting empty `%s` header in: %s".formatted( + WWW_AUTH_HEADER_NAME, responseHeaders.map())); } finally { - server.stop(0); + server.stop(); } } + + static Stream args() { + return Stream + .of(Version.HTTP_1_1, Version.HTTP_2) + .flatMap(version -> Stream + .of(true, false) + .map(secure -> Arguments.of(version, secure))); + } + + private static HttpTestServer createServer(Version version, boolean secure, String uriPath) + throws IOException { + HttpTestServer server = secure + ? HttpTestServer.create(version, SSL_CONTEXT) + : HttpTestServer.create(version); + HttpTestHandler handler = new ServerHandlerRespondingWithEmptyWwwAuthHeader(); + server.addHandler(handler, uriPath); + server.start(); + return server; + } + + private static final class ServerHandlerRespondingWithEmptyWwwAuthHeader implements HttpTestHandler { + + private int responseIndex = 0; + + @Override + public synchronized void handle(HttpServerAdapters.HttpTestExchange exchange) throws IOException { + try (exchange) { + exchange.getResponseHeaders().addHeader(WWW_AUTH_HEADER_NAME, ""); + byte[] responseBodyBytes = "test body %d" + .formatted(responseIndex) + .getBytes(StandardCharsets.US_ASCII); + exchange.sendResponseHeaders(401, responseBodyBytes.length); + exchange.getResponseBody().write(responseBodyBytes); + } finally { + responseIndex++; + } + } + + } + + private static HttpClient createClient(Version version, boolean secure) { + HttpClient.Builder clientBuilder = HttpClient.newBuilder().version(version).proxy(NO_PROXY); + if (secure) { + clientBuilder.sslContext(SSL_CONTEXT); + } + return clientBuilder.build(); + } + + private static HttpRequest createRequest(HttpTestServer server, boolean secure, String uriPath) { + URI uri = URI.create("%s://%s%s".formatted(secure ? "https" : "http", server.serverAuthority(), uriPath)); + return HttpRequest.newBuilder(uri).version(server.getVersion()).GET().build(); + } + } diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java index 796c0b8df024..2c1aa2fd9b48 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,18 +29,20 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomAfterCancel * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersCustomAfterCancel */ -import org.testng.annotations.Test; import java.util.Set; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPublishersCustomAfterCancel extends AbstractThrowingPublishers { - @Test(dataProvider = "afterCancelProviderCustom") + @ParameterizedTest + @MethodSource("afterCancelProviderCustom") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower, Set whereValues) throws Exception diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java index 06343d222b8e..ba7341854647 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,18 +29,20 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomBeforeCancel * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersCustomBeforeCancel */ -import org.testng.annotations.Test; import java.util.Set; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPublishersCustomBeforeCancel extends AbstractThrowingPublishers { - @Test(dataProvider = "beforeCancelProviderCustom") + @ParameterizedTest + @MethodSource("beforeCancelProviderCustom") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower, Set whereValues) throws Exception diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java index 7ed649b25463..a5e819942b44 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,18 +29,20 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOAfterCancel * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersIOAfterCancel */ -import org.testng.annotations.Test; import java.util.Set; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPublishersIOAfterCancel extends AbstractThrowingPublishers { - @Test(dataProvider = "afterCancelProviderIO") + @ParameterizedTest + @MethodSource("afterCancelProviderIO") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower, Set whereValues) throws Exception diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java index 3be2eb061cc4..e68f83052bde 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,18 +29,20 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOBeforeCancel * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersIOBeforeCancel */ -import org.testng.annotations.Test; import java.util.Set; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPublishersIOBeforeCancel extends AbstractThrowingPublishers { - @Test(dataProvider = "beforeCancelProviderIO") + @ParameterizedTest + @MethodSource("beforeCancelProviderIO") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower, Set whereValues) throws Exception diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java b/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java index eb07b359fc96..62d06fd60191 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,18 +29,20 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInNextRequest * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersInNextRequest */ -import org.testng.annotations.Test; import java.util.Set; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPublishersInNextRequest extends AbstractThrowingPublishers { - @Test(dataProvider = "nextRequestProvider") + @ParameterizedTest + @MethodSource("nextRequestProvider") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower, Set whereValues) throws Exception diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java b/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java index ef05e4e0da6f..f863f3598edf 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,18 +29,20 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInRequest * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersInRequest */ -import org.testng.annotations.Test; import java.util.Set; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPublishersInRequest extends AbstractThrowingPublishers { - @Test(dataProvider = "requestProvider") + @ParameterizedTest + @MethodSource("requestProvider") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower, Set whereValues) throws Exception diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java b/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java index f14c51670247..ce1ad89dc056 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,18 +29,20 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInSubscribe * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersInSubscribe */ -import org.testng.annotations.Test; import java.util.Set; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPublishersInSubscribe extends AbstractThrowingPublishers { - @Test(dataProvider = "subscribeProvider") + @ParameterizedTest + @MethodSource("subscribeProvider") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower, Set whereValues) throws Exception diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java b/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java index 305490833104..eee2f9ab7fb7 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,16 +29,18 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersSanity * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersSanity */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPublishersSanity extends AbstractThrowingPublishers { - @Test(dataProvider = "sanity") + @ParameterizedTest + @MethodSource("sanity") public void testSanity(String uri, boolean sameClient) throws Exception { super.testSanityImpl(uri,sameClient); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java index 0b66a8e913ec..797507ac7ada 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamCustom * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamCustom + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamCustom */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsInputStreamCustom extends AbstractThrowingPushPromises { - @Test(dataProvider = "customVariants") + @ParameterizedTest + @MethodSource("customVariants") public void testThrowingAsInputStream(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsInputStreamImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java index 89cf1162bc34..309f60c0f22f 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamIO * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamIO + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamIO */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsInputStreamIO extends AbstractThrowingPushPromises { - @Test(dataProvider = "ioVariants") + @ParameterizedTest + @MethodSource("ioVariants") public void testThrowingAsInputStream(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsInputStreamImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java index d1fb7d342587..77c87151e194 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesCustom * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesCustom + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesCustom */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsLinesCustom extends AbstractThrowingPushPromises { - @Test(dataProvider = "customVariants") + @ParameterizedTest + @MethodSource("customVariants") public void testThrowingAsLines(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsLinesImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java index 88afaf3dbd55..69deeec533a9 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesIO * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesIO + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesIO */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsLinesIO extends AbstractThrowingPushPromises { - @Test(dataProvider = "ioVariants") + @ParameterizedTest + @MethodSource("ioVariants") public void testThrowingAsLines(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsLinesImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java index c40af0ab0b06..de38cf4f7826 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringCustom * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringCustom + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringCustom */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsStringCustom extends AbstractThrowingPushPromises { - @Test(dataProvider = "customVariants") + @ParameterizedTest + @MethodSource("customVariants") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsStringImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java index 6485e82af8f5..ec4d682d73ff 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringIO * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringIO + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringIO */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesAsStringIO extends AbstractThrowingPushPromises { - @Test(dataProvider = "ioVariants") + @ParameterizedTest + @MethodSource("ioVariants") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsStringImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java index 7fdb6dcb19db..92f2ab3726dd 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesSanity * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesSanity + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesSanity */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingPushPromisesSanity extends AbstractThrowingPushPromises { - @Test(dataProvider = "sanity") + @ParameterizedTest + @MethodSource("sanity") public void testSanity(String uri, boolean sameClient) throws Exception { super.testSanityImpl(uri, sameClient); diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java index 35ac1fd3f9c3..a4c0fc72004b 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker ThrowingSubscribersAsInputStream AbstractThrowingSubscribers * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStream + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStream */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingSubscribersAsInputStream extends AbstractThrowingSubscribers { - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") public void testThrowingAsInputStream(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsInputStreamImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java index db25ebaca3e8..aec4641917cd 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker ThrowingSubscribersAsInputStreamAsync AbstractThrowingSubscribers * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStreamAsync + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStreamAsync */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingSubscribersAsInputStreamAsync extends AbstractThrowingSubscribers { - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") public void testThrowingAsInputStreamAsync(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsInputStreamAsyncImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java index f303ef12b54b..ba594166b725 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker ThrowingSubscribersAsLines AbstractThrowingSubscribers * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLines + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLines */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingSubscribersAsLines extends AbstractThrowingSubscribers { - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") public void testThrowingAsLines(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsLinesImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java index 2e1fc942a736..a76ff8824630 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker ThrowingSubscribersAsLinesAsync AbstractThrowingSubscribers * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLinesAsync + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLinesAsync */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingSubscribersAsLinesAsync extends AbstractThrowingSubscribers { - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") public void testThrowingAsLinesAsync(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsLinesAsyncImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java index 56e444f09c2b..ba5506750964 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker ThrowingSubscribersAsString AbstractThrowingSubscribers * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsString + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsString */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingSubscribersAsString extends AbstractThrowingSubscribers { - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") public void testThrowingAsString(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsStringImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java index 563fe39bd69b..304d98e69392 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker ThrowingSubscribersAsStringAsync AbstractThrowingSubscribers * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsStringAsync + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsStringAsync */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingSubscribersAsStringAsync extends AbstractThrowingSubscribers { - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") public void testThrowingAsStringAsync(String uri, boolean sameClient, Thrower thrower) throws Exception { super.testThrowingAsStringAsyncImpl(uri, sameClient, thrower); diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java b/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java index c480d55e1479..296e9151c9ee 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,16 @@ * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker ThrowingSubscribersSanity AbstractThrowingSubscribers * jdk.httpclient.test.lib.common.HttpServerAdapters - * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersSanity + * @run junit/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersSanity */ -import org.testng.annotations.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class ThrowingSubscribersSanity extends AbstractThrowingSubscribers { - @Test(dataProvider = "sanity") + @ParameterizedTest + @MethodSource("sanity") public void testSanity(String uri, boolean sameClient) throws Exception { super.testSanityImpl(uri, sameClient); diff --git a/test/jdk/java/net/httpclient/http2/BadHeadersTest.java b/test/jdk/java/net/httpclient/http2/BadHeadersTest.java index 062b4c89e09b..12270d41818a 100644 --- a/test/jdk/java/net/httpclient/http2/BadHeadersTest.java +++ b/test/jdk/java/net/httpclient/http2/BadHeadersTest.java @@ -26,7 +26,7 @@ * @bug 8303965 * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext - * @run testng/othervm -Djdk.internal.httpclient.debug=true BadHeadersTest + * @run junit/othervm -Djdk.internal.httpclient.debug=true BadHeadersTest */ import jdk.internal.net.http.common.HttpHeadersBuilder; @@ -35,10 +35,10 @@ import jdk.internal.net.http.frame.HeadersFrame; import jdk.internal.net.http.frame.Http2Frame; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import java.io.IOException; @@ -57,6 +57,7 @@ import java.util.Map.Entry; import java.util.concurrent.ExecutionException; import java.util.function.BiFunction; + import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.httpclient.test.lib.http2.Http2TestExchange; import jdk.httpclient.test.lib.http2.Http2TestExchangeImpl; @@ -65,8 +66,9 @@ import jdk.httpclient.test.lib.http2.Http2TestServerConnection; import static java.util.List.of; import static java.util.Map.entry; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; // Code copied from ContinuationFrameTest public class BadHeadersTest { @@ -79,11 +81,11 @@ public class BadHeadersTest { of(entry("hello", "world!"), entry(":status", "200")) // Pseudo header is not the first one ); - SSLContext sslContext; - Http2TestServer http2TestServer; // HTTP/2 ( h2c ) - Http2TestServer https2TestServer; // HTTP/2 ( h2 ) - String http2URI; - String https2URI; + private static SSLContext sslContext; + private static Http2TestServer http2TestServer; // HTTP/2 ( h2c ) + private static Http2TestServer https2TestServer; // HTTP/2 ( h2 ) + private static String http2URI; + private static String https2URI; /** * A function that returns a list of 1) a HEADERS frame ( with an empty @@ -121,8 +123,7 @@ public class BadHeadersTest { return frames; }; - @DataProvider(name = "variants") - public Object[][] variants() { + static Object[][] variants() { return new Object[][] { { http2URI, false, oneContinuation }, { https2URI, false, oneContinuation }, @@ -136,8 +137,8 @@ public Object[][] variants() { }; } - - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") void test(String uri, boolean sameClient, BiFunction,List> headerFramesSupplier) @@ -166,7 +167,8 @@ void test(String uri, } } - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") void testAsync(String uri, boolean sameClient, BiFunction,List> headerFramesSupplier) @@ -204,8 +206,7 @@ void testAsync(String uri, // sync with implementation. static void assertDetailMessage(Throwable throwable, int iterationIndex) { try { - assertTrue(throwable instanceof IOException, - "Expected IOException, got, " + throwable); + assertInstanceOf(IOException.class, throwable, "Expected IOException, got " + throwable); assertTrue(throwable.getMessage().contains("malformed response"), "Expected \"malformed response\" in: " + throwable.getMessage()); @@ -226,8 +227,8 @@ static void assertDetailMessage(Throwable throwable, int iterationIndex) { } } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + static void setup() throws Exception { sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); @@ -251,8 +252,8 @@ public void setup() throws Exception { https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + static void teardown() throws Exception { http2TestServer.stop(); https2TestServer.stop(); } diff --git a/test/jdk/java/net/httpclient/http2/BasicTest.java b/test/jdk/java/net/httpclient/http2/BasicTest.java index 9d54c8c39e0b..0c64be84926c 100644 --- a/test/jdk/java/net/httpclient/http2/BasicTest.java +++ b/test/jdk/java/net/httpclient/http2/BasicTest.java @@ -32,7 +32,7 @@ * jdk.test.lib.Asserts * jdk.test.lib.Utils * jdk.test.lib.net.SimpleSSLContext - * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors BasicTest + * @run junit/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors BasicTest */ import java.io.IOException; @@ -53,14 +53,13 @@ import jdk.httpclient.test.lib.http2.Http2TestExchange; import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; import static java.net.http.HttpClient.Version.HTTP_2; import static jdk.test.lib.Asserts.assertFileContentsEqual; import static jdk.test.lib.Utils.createTempFile; import static jdk.test.lib.Utils.createTempFileOfSize; -@Test public class BasicTest { private static final String TEMP_FILE_PREFIX = @@ -127,7 +126,7 @@ public void handle(Http2TestExchange exchange) throws IOException { } @Test - public static void test() throws Exception { + void test() throws Exception { try { initialize(); warmup(false); diff --git a/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java b/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java index 30cc9122d9dc..1eaf331c2610 100644 --- a/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java +++ b/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @summary checks connection flow control * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext - * @run testng/othervm -Djdk.internal.httpclient.debug=true + * @run junit/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.connectionWindowSize=65535 * -Djdk.httpclient.windowsize=16384 * ConnectionFlowControlTest @@ -43,23 +43,13 @@ import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; -import java.net.http.HttpResponse.BodyHandler; import java.net.http.HttpResponse.BodyHandlers; -import java.net.http.HttpResponse.BodySubscriber; -import java.net.http.HttpResponse.ResponseInfo; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; -import java.util.Map.Entry; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; -import java.util.concurrent.Flow.Subscription; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BiFunction; import java.util.function.Consumer; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; @@ -72,44 +62,34 @@ import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.httpclient.test.lib.http2.Http2TestServerConnection; import jdk.internal.net.http.common.HttpHeadersBuilder; -import jdk.internal.net.http.frame.ContinuationFrame; -import jdk.internal.net.http.frame.HeaderFrame; -import jdk.internal.net.http.frame.HeadersFrame; -import jdk.internal.net.http.frame.Http2Frame; import jdk.internal.net.http.frame.SettingsFrame; import jdk.test.lib.Utils; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -import static java.util.List.of; -import static java.util.Map.entry; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; public class ConnectionFlowControlTest { - SSLContext sslContext; - HttpTestServer http2TestServer; // HTTP/2 ( h2c ) - HttpTestServer https2TestServer; // HTTP/2 ( h2 ) - String http2URI; - String https2URI; - final AtomicInteger reqid = new AtomicInteger(); + private static SSLContext sslContext; + private static HttpTestServer http2TestServer; // HTTP/2 ( h2c ) + private static HttpTestServer https2TestServer; // HTTP/2 ( h2 ) + private static String http2URI; + private static String https2URI; + private final AtomicInteger reqid = new AtomicInteger(); - - @DataProvider(name = "variants") - public Object[][] variants() { + static Object[][] variants() { return new Object[][] { { http2URI }, { https2URI }, }; } - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") void test(String uri) throws Exception { System.out.printf("%ntesting %s%n", uri); ConcurrentHashMap> responseSent = new ConcurrentHashMap<>(); @@ -148,7 +128,7 @@ void test(String uri) throws Exception { if (i < max - 1) { // the connection window might be exceeded at i == max - 2, which // means that the last request could go on a new connection. - assertEquals(ckey, label, "Unexpected key for " + query); + assertEquals(label, ckey, "Unexpected key for " + query); } } catch (AssertionError ass) { // since we won't pull all responses, the client @@ -174,7 +154,7 @@ void test(String uri) throws Exception { if (i < max - 1) { // the connection window might be exceeded at i == max - 2, which // means that the last request could go on a new connection. - assertEquals(ckey, label, "Unexpected key for " + query); + assertEquals(label, ckey, "Unexpected key for " + query); } int wait = uri.startsWith("https://") ? 500 : 250; try (InputStream is = response.body()) { @@ -227,7 +207,7 @@ void test(String uri) throws Exception { var response = client.send(request, BodyHandlers.ofString()); if (label != null) { String ckey = response.headers().firstValue("X-Connection-Key").get(); - assertNotEquals(ckey, label); + assertNotEquals(label, ckey); System.out.printf("last request %s sent on different connection as expected:" + "\n\tlast: %s\n\tprevious: %s%n", query, ckey, label); } @@ -258,33 +238,33 @@ static void assertDetailMessage(Throwable throwable, int iterationIndex) { } } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + static void setup() throws Exception { sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); - var http2TestServer = new Http2TestServer("localhost", false, 0); - http2TestServer.addHandler(new Http2TestHandler(), "/http2/"); - this.http2TestServer = HttpTestServer.of(http2TestServer); - http2URI = "http://" + this.http2TestServer.serverAuthority() + "/http2/x"; + var http2TestServerLocal = new Http2TestServer("localhost", false, 0); + http2TestServerLocal.addHandler(new Http2TestHandler(), "/http2/"); + http2TestServer = HttpTestServer.of(http2TestServerLocal); + http2URI = "http://" + http2TestServer.serverAuthority() + "/http2/x"; - var https2TestServer = new Http2TestServer("localhost", true, sslContext); - https2TestServer.addHandler(new Http2TestHandler(), "/https2/"); - this.https2TestServer = HttpTestServer.of(https2TestServer); - https2URI = "https://" + this.https2TestServer.serverAuthority() + "/https2/x"; + var https2TestServerLocal = new Http2TestServer("localhost", true, sslContext); + https2TestServerLocal.addHandler(new Http2TestHandler(), "/https2/"); + https2TestServer = HttpTestServer.of(https2TestServerLocal); + https2URI = "https://" + https2TestServer.serverAuthority() + "/https2/x"; // Override the default exchange supplier with a custom one to enable // particular test scenarios - http2TestServer.setExchangeSupplier(FCHttp2TestExchange::new); - https2TestServer.setExchangeSupplier(FCHttp2TestExchange::new); + http2TestServerLocal.setExchangeSupplier(FCHttp2TestExchange::new); + https2TestServerLocal.setExchangeSupplier(FCHttp2TestExchange::new); - this.http2TestServer.start(); - this.https2TestServer.start(); + http2TestServer.start(); + https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + static void teardown() throws Exception { http2TestServer.stop(); https2TestServer.stop(); } @@ -364,6 +344,5 @@ public void responseSent(String query) { System.out.println("Server: response sent for " + query); responseSentCB.accept(query); } - } } diff --git a/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java b/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java index 04ce8f4f4a41..22b7f414126d 100644 --- a/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java +++ b/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @compile ../ReferenceTracker.java - * @run testng/othervm ContinuationFrameTest + * @run junit/othervm ContinuationFrameTest */ import java.io.IOException; @@ -59,25 +59,24 @@ import jdk.httpclient.test.lib.http2.Http2TestServerConnection; import jdk.test.lib.net.SimpleSSLContext; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import static java.lang.System.out; import static java.net.http.HttpClient.Version.HTTP_2; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ContinuationFrameTest { - SSLContext sslContext; - Http2TestServer http2TestServer; // HTTP/2 ( h2c ) - Http2TestServer https2TestServer; // HTTP/2 ( h2 ) - String http2URI; - String https2URI; - String noBodyhttp2URI; - String noBodyhttps2URI; - final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; + private static SSLContext sslContext; + private static Http2TestServer http2TestServer; // HTTP/2 ( h2c ) + private static Http2TestServer https2TestServer; // HTTP/2 ( h2 ) + private static String http2URI; + private static String https2URI; + private static String noBodyhttp2URI; + private static String noBodyhttps2URI; + private final static ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; /** * A function that returns a list of 1) a HEADERS frame ( with an empty @@ -132,8 +131,7 @@ public class ContinuationFrameTest { return frames; }; - @DataProvider(name = "variants") - public Object[][] variants() { + static Object[][] variants() { return new Object[][] { { http2URI, false, oneContinuation }, { https2URI, false, oneContinuation }, @@ -154,7 +152,8 @@ public Object[][] variants() { static final int ITERATION_COUNT = 20; - @Test(dataProvider = "variants") + @ParameterizedTest + @MethodSource("variants") void test(String uri, boolean sameClient, BiFunction,List> headerFramesSupplier) @@ -184,22 +183,20 @@ void test(String uri, if(uri.contains("nobody")) { out.println("Got response: " + resp); - assertTrue(resp.statusCode() == 204, - "Expected 204, got:" + resp.statusCode()); - assertEquals(resp.version(), HTTP_2); + assertEquals(204, resp.statusCode(), "Expected 204, got:" + resp.statusCode()); + assertEquals(HTTP_2, resp.version()); continue; } out.println("Got response: " + resp); out.println("Got body: " + resp.body()); - assertTrue(resp.statusCode() == 200, - "Expected 200, got:" + resp.statusCode()); - assertEquals(resp.body(), "Hello there!"); - assertEquals(resp.version(), HTTP_2); + assertEquals(200, resp.statusCode(), "Expected 200, got:" + resp.statusCode()); + assertEquals("Hello there!", resp.body()); + assertEquals(HTTP_2, resp.version()); } } - @BeforeTest - public void setup() throws Exception { + @BeforeAll + static void setup() throws Exception { sslContext = new SimpleSSLContext().get(); if (sslContext == null) throw new AssertionError("Unexpected null sslContext"); @@ -227,8 +224,8 @@ public void setup() throws Exception { https2TestServer.start(); } - @AfterTest - public void teardown() throws Exception { + @AfterAll + static void teardown() throws Exception { AssertionError fail = TRACKER.check(500); try { http2TestServer.stop(); diff --git a/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java b/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java index 176634d69077..5df14bff9d28 100644 --- a/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java +++ b/test/jdk/java/net/httpclient/websocket/DummyWebSocketServer.java @@ -265,7 +265,14 @@ URI getURI() { if (!started.get()) { throw new IllegalStateException("Not yet started"); } - return URI.create("ws://localhost:" + address.getPort()); + String ip = address.getAddress().isAnyLocalAddress() + ? InetAddress.getLoopbackAddress().getHostAddress() + : address.getAddress().getHostAddress(); + if (ip.indexOf(':') >= 0) { + ip = String.format("[%s]", ip); + } + + return URI.create("ws://" + ip + ":" + address.getPort()); } private boolean readRequest(SocketChannel channel, StringBuilder request) diff --git a/test/jdk/java/net/httpclient/whitebox/RawChannelTestDriver.java b/test/jdk/java/net/httpclient/whitebox/RawChannelTestDriver.java index 77b1c3db8a53..6ca6fe47b59c 100644 --- a/test/jdk/java/net/httpclient/whitebox/RawChannelTestDriver.java +++ b/test/jdk/java/net/httpclient/whitebox/RawChannelTestDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,12 @@ * @test * @bug 8151299 8164704 * @modules java.net.http/jdk.internal.net.http - * @run testng java.net.http/jdk.internal.net.http.RawChannelTest + * @run testng/othervm java.net.http/jdk.internal.net.http.RawChannelTest */ +// use +// @run testng/othervm -Dseed=6434511950803022575 +// java.net.http/jdk.internal.net.http.RawChannelTest +// to reproduce a failure with a particular seed (e.g. 6434511950803022575) +// if this test is observed failing with that seed //-Djdk.internal.httpclient.websocket.debug=true diff --git a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/RawChannelTest.java b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/RawChannelTest.java index 6619eff008a0..01aafd916dd4 100644 --- a/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/RawChannelTest.java +++ b/test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/RawChannelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ package jdk.internal.net.http; +import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -43,8 +44,9 @@ import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.util.concurrent.atomic.AtomicReference; + import jdk.internal.net.http.websocket.RawChannel; -import jdk.internal.net.http.websocket.WebSocketRequest; import org.testng.annotations.Test; import static java.net.http.HttpResponse.BodyHandlers.discarding; import static java.util.concurrent.TimeUnit.SECONDS; @@ -57,6 +59,20 @@ */ public class RawChannelTest { + // can't use jdk.test.lib when injected in java.net.httpclient + // Seed can be specified on the @run line with -Dseed= + private static class RandomFactory { + private static long getSeed() { + long seed = Long.getLong("seed", new Random().nextLong()); + System.out.println("Seed from RandomFactory = "+seed+"L"); + return seed; + } + public static Random getRandom() { + return new Random(getSeed()); + } + } + + private static final Random RANDOM = RandomFactory.getRandom(); private final AtomicLong clientWritten = new AtomicLong(); private final AtomicLong serverWritten = new AtomicLong(); private final AtomicLong clientRead = new AtomicLong(); @@ -90,7 +106,8 @@ public void test() throws Exception { server.setReuseAddress(false); server.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); int port = server.getLocalPort(); - new TestServer(server).start(); + TestServer testServer = new TestServer(server); + testServer.start(); final RawChannel chan = channelOf(port); print("RawChannel is %s", String.valueOf(chan)); @@ -129,6 +146,7 @@ public void handle() { } catch (IOException e) { outputCompleted.completeExceptionally(e); e.printStackTrace(); + closeChannel(chan); } return; } @@ -145,6 +163,9 @@ public void handle() { chan.registerEvent(this); writeStall.countDown(); // signal send buffer is full } catch (IOException e) { + print("OP_WRITE failed: " + e); + outputCompleted.completeExceptionally(e); + closeChannel(chan); throw new UncheckedIOException(e); } } @@ -168,6 +189,7 @@ public void handle() { read = chan.read(); } catch (IOException e) { inputCompleted.completeExceptionally(e); + closeChannel(chan); e.printStackTrace(); } if (read == null) { @@ -179,7 +201,10 @@ public void handle() { try { chan.registerEvent(this); } catch (IOException e) { - e.printStackTrace(); + print("OP_READ failed to register event: " + e); + inputCompleted.completeExceptionally(e); + closeChannel(chan); + throw new UncheckedIOException(e); } readStall.countDown(); break; @@ -191,21 +216,33 @@ public void handle() { print("OP_READ read %s bytes (%s total)", total, clientRead.get()); } }); + CompletableFuture.allOf(outputCompleted,inputCompleted) .whenComplete((r,t) -> { - try { - print("closing channel"); - chan.close(); - } catch (IOException x) { - x.printStackTrace(); - } + closeChannel(chan); }); exit.await(); // All done, we need to compare results: assertEquals(clientRead.get(), serverWritten.get()); assertEquals(serverRead.get(), clientWritten.get()); + Throwable serverError = testServer.failed.get(); + if (serverError != null) { + throw new AssertionError("TestServer failed: " + + serverError, serverError); + } } } + private static void closeChannel(RawChannel chan) { + print("closing channel"); + try { + chan.close(); + } catch (IOException x) { + print("Failed to close channel: " + x); + x.printStackTrace(); + } + } + + private static RawChannel channelOf(int port) throws Exception { URI uri = URI.create("http://localhost:" + port + "/"); print("raw channel to %s", uri.toString()); @@ -238,11 +275,24 @@ private static RawChannel channelOf(int port) throws Exception { private class TestServer extends Thread { // Powered by Slowpokes private final ServerSocket server; + private final AtomicReference failed = new AtomicReference<>(); TestServer(ServerSocket server) throws IOException { this.server = server; } + private void fail(Closeable s, String actor, Throwable t) { + failed.compareAndSet(null, t); + print("Server %s got exception: %s", actor, t); + t.printStackTrace(); + try { + s.close(); + } catch (Exception x) { + print("Server %s failed to close socket: %s", actor, t); + } + + } + @Override public void run() { try (Socket s = server.accept()) { @@ -253,21 +303,23 @@ public void run() { Thread reader = new Thread(() -> { try { + print("Server reader started"); long n = readSlowly(is); print("Server read %s bytes", n); s.shutdownInput(); } catch (Exception e) { - e.printStackTrace(); + fail(s, "reader", e); } }); Thread writer = new Thread(() -> { try { + print("Server writer started"); long n = writeSlowly(os); print("Server written %s bytes", n); s.shutdownOutput(); } catch (Exception e) { - e.printStackTrace(); + fail(s, "writer", e); } }); @@ -277,7 +329,7 @@ public void run() { reader.join(); writer.join(); } catch (Exception e) { - e.printStackTrace(); + fail(server,"acceptor", e); } finally { exit.countDown(); } @@ -366,6 +418,8 @@ private static void print(String format, Object... args) { } private static byte[] byteArrayOfSize(int bound) { - return new byte[new Random().nextInt(1 + bound)]; + // bound must be > 1; No need to check it, + // nextInt will throw IllegalArgumentException if needed + return new byte[RANDOM.nextInt(1, bound + 1)]; } } diff --git a/test/jdk/java/nio/Buffer/LimitDirectMemory.java b/test/jdk/java/nio/Buffer/LimitDirectMemory.java index d34221712e20..a941b7b506e9 100644 --- a/test/jdk/java/nio/Buffer/LimitDirectMemory.java +++ b/test/jdk/java/nio/Buffer/LimitDirectMemory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 4627316 6743526 * @summary Test option to limit direct memory allocation - * @requires (os.arch == "x86_64") | (os.arch == "amd64") | (os.arch == "aarch64") * @library /test/lib * * @summary Test: memory is properly limited using multiple buffers diff --git a/test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java b/test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java index 0d6666cc2e39..9b0fc9fec0d8 100644 --- a/test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java +++ b/test/jdk/java/nio/Buffer/LimitDirectMemoryNegativeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ * @bug 4627316 6743526 * @summary Test option to limit direct memory allocation, * various bad values fail to launch the VM - * @requires (os.arch == "x86_64") | (os.arch == "amd64") * @library /test/lib * @build jdk.test.lib.Utils * jdk.test.lib.Asserts diff --git a/test/jdk/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java b/test/jdk/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java index 7abbf064b403..962d7728a551 100644 --- a/test/jdk/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java +++ b/test/jdk/java/nio/channels/AsynchronousSocketChannel/CompletionHandlerRelease.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* @test * @bug 8202252 - * @run testng CompletionHandlerRelease + * @run junit CompletionHandlerRelease * @summary Verify that reference to CompletionHandler is cleared after use */ @@ -44,10 +44,12 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; public class CompletionHandlerRelease { @Test @@ -132,16 +134,16 @@ public void testRead() throws Exception { } } - private AsynchronousChannelGroup GROUP; + private static AsynchronousChannelGroup GROUP; - @BeforeTest - void setup() throws IOException { + @BeforeAll + static void setup() throws IOException { GROUP = AsynchronousChannelGroup.withFixedThreadPool(2, Executors.defaultThreadFactory()); } - @AfterTest - void cleanup() throws IOException { + @AfterAll + static void cleanup() throws IOException { GROUP.shutdownNow(); } @@ -199,13 +201,13 @@ public void failed(Throwable exc, A attachment) { } } - private void waitForRefToClear(Reference ref, ReferenceQueue queue) + private static void waitForRefToClear(Reference ref, ReferenceQueue queue) throws InterruptedException { Reference r; while ((r = queue.remove(20)) == null) { System.gc(); } - assertEquals(r, ref); + assertSame(ref, r); assertNull(r.get()); } } diff --git a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java index f50d1345b4db..130e32ac3791 100644 --- a/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java +++ b/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java @@ -40,7 +40,6 @@ * @key intermittent */ -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -99,7 +98,7 @@ public Object[][] testCases() { }; } - @Test(dataProvider = "testCases", timeOut=30000) + @Test(dataProvider = "testCases") public void test(String desc, List opts) throws Throwable { String pathVar = Platform.sharedLibraryPathVariableName(); System.out.println(pathVar + "=" + libraryPath); diff --git a/test/jdk/java/nio/file/spi/fs.policy b/test/jdk/java/nio/file/spi/fs.policy index 15032c70ba8d..0dcfe8b2789a 100644 --- a/test/jdk/java/nio/file/spi/fs.policy +++ b/test/jdk/java/nio/file/spi/fs.policy @@ -1,3 +1,3 @@ grant codeBase "file:${test.classes}${/}-" { - permission java.io.FilePermission "${java.io.tmpdir}${/}-", "write"; + permission java.io.FilePermission "${user.dir}${/}-", "write"; }; diff --git a/test/jdk/java/nio/file/spi/m/p/Main.java b/test/jdk/java/nio/file/spi/m/p/Main.java index 4704c6790216..9f80d08347c4 100644 --- a/test/jdk/java/nio/file/spi/m/p/Main.java +++ b/test/jdk/java/nio/file/spi/m/p/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ public static void main(String[] args) throws Exception { throw new RuntimeException("FileSystemProvider not overridden"); // exercise the file system - Path dir = Files.createTempDirectory("tmp"); + Path dir = Files.createTempDirectory(Path.of(""), "tmp"); if (dir.getFileSystem() != fs) throw new RuntimeException("'dir' not in default file system"); System.out.println("created: " + dir); diff --git a/test/jdk/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java b/test/jdk/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java index 4de6598a0f46..f40502601d27 100644 --- a/test/jdk/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java +++ b/test/jdk/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java @@ -59,10 +59,13 @@ import java.lang.reflect.*; import java.rmi.registry.*; import sun.rmi.transport.*; +import java.util.concurrent.CountDownLatch; public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak { public CheckLeaseLeak() throws RemoteException { } - public void ping () throws RemoteException { } + public void ping () throws RemoteException { + remoteCallsComplete.countDown(); + } /** * Id to fake the DGC_ID, so we can later get a reference to the @@ -74,6 +77,9 @@ public void ping () throws RemoteException { } private final static int numberPingCalls = 0; private final static int CHECK_INTERVAL = 400; private final static int LEASE_VALUE = 20; + private static final int NO_OF_CLIENTS = ITERATIONS; + private static final int GOOD_LUCK_FACTOR = 2; + private static CountDownLatch remoteCallsComplete = new CountDownLatch(NO_OF_CLIENTS); public static void main (String[] args) { CheckLeaseLeak leakServer = null; @@ -113,8 +119,14 @@ public static void main (String[] args) { jvm.destroy(); } } + try { + remoteCallsComplete.await(); + System.out.println("remoteCallsComplete . . . "); + } catch (InterruptedException intEx) { + System.out.println("remoteCallsComplete.await interrupted . . . "); + } + Thread.sleep(NO_OF_CLIENTS * LEASE_VALUE * GOOD_LUCK_FACTOR); numLeft = getDGCLeaseTableSize(); - Thread.sleep(3000); } catch(Exception e) { TestLibrary.bomb("CheckLeaseLeak Error: ", e); @@ -125,8 +137,8 @@ public static void main (String[] args) { } } - /* numLeft should be 4 - if 11 there is a problem. */ - if (numLeft > 4) { + /* numLeft should not be greater than 2 - if 11 there is a problem. */ + if (numLeft > 2) { TestLibrary.bomb("Too many objects in DGCImpl.leaseTable: "+ numLeft); } else { @@ -204,8 +216,9 @@ private static int getDGCLeaseTableSize () { * objects if the LeaseInfo memory leak is not fixed. */ leaseTable = (Map) f.get(dgcImpl[0]); - - numLeaseInfosLeft = leaseTable.size(); + synchronized (leaseTable) { + numLeaseInfosLeft = leaseTable.size(); + } } catch(Exception e) { TestLibrary.bomb(e); diff --git a/test/jdk/java/security/KeyStore/DisabledKnownType.java b/test/jdk/java/security/KeyStore/DisabledKnownType.java new file mode 100644 index 000000000000..70b7228f4c2e --- /dev/null +++ b/test/jdk/java/security/KeyStore/DisabledKnownType.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8373690 + * @summary verify that the exception message indicates the keystore type + * when the type is disabled instead of being unrecognized + * @run main/othervm -Djdk.crypto.disabledAlgorithms=KeyStore.PKCS12 DisabledKnownType + */ + +import java.security.KeyStore; +import java.security.KeyStoreException; + +public class DisabledKnownType { + public static void main(String[] args) throws Exception { + String cacertsPath = System.getProperty("java.home") + + "/lib/security/cacerts"; + try { + KeyStore ks = KeyStore.getInstance(new java.io.File(cacertsPath), + "changeit".toCharArray()); + throw new RuntimeException("Expected KeyStoreException not thrown"); + } catch (KeyStoreException kse) { + if (kse.getMessage().contains("PKCS12")) { + System.out.println("Passed: expected ex thrown: " + kse); + } else { + // pass it up + throw kse; + } + } + } +} + diff --git a/test/jdk/java/security/Provider/NewInstance.java b/test/jdk/java/security/Provider/NewInstance.java index ad69f468925c..547b9111682b 100644 --- a/test/jdk/java/security/Provider/NewInstance.java +++ b/test/jdk/java/security/Provider/NewInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,21 +26,34 @@ * @bug 8039853 * @summary Provider.Service.newInstance() does not work with current JDK JGSS Mechanisms + * @library /test/lib */ -import java.security.*; -import java.util.*; + +import jtreg.SkippedException; + +import java.security.InvalidAlgorithmParameterException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; public class NewInstance { public static void main(String[] args) throws Exception { - for (Provider p : Security.getProviders()) { + + System.out.println("Removing SunPCSC provider from the list (A smartcard might not be installed)."); + final List providers = Arrays.stream(Security.getProviders()) + .filter(provider -> !provider.getName().equals("SunPCSC")) + .collect(Collectors.toList()); + + for (Provider p : providers) { System.out.println("---------"); System.out.println(p.getName() + ":" + p.getInfo()); - if (p.getName().equals("SunPCSC")) { - System.out.println("A smartcard might not be installed. Skip test."); - continue; - } Set set = p.getServices(); Iterator i = set.iterator(); diff --git a/test/jdk/java/security/cert/CertStore/NoLDAP.java b/test/jdk/java/security/cert/CertStore/NoLDAP.java index 868411e63c45..812a978931d9 100644 --- a/test/jdk/java/security/cert/CertStore/NoLDAP.java +++ b/test/jdk/java/security/cert/CertStore/NoLDAP.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,20 +25,23 @@ * @bug 8004502 * @summary Sanity check that NoSuchAlgorithmException is thrown when requesting * a CertStore of type "LDAP" and LDAP is not available. + * @library /test/lib */ import java.security.NoSuchAlgorithmException; import java.security.cert.CertStore; import java.security.cert.LDAPCertStoreParameters; +import jtreg.SkippedException; public class NoLDAP { public static void main(String[] args) throws Exception { try { Class.forName("javax.naming.ldap.LdapName"); - System.out.println("LDAP is present, test skipped"); - return; - } catch (ClassNotFoundException ignore) { } + throw new SkippedException("LDAP is present"); + } catch (ClassNotFoundException ignore) { + System.err.println("Expected: class not found exception " + ignore.getMessage()); + } try { CertStore.getInstance("LDAP", new LDAPCertStoreParameters()); diff --git a/test/jdk/java/text/Collator/RuleBasedCollatorTest.java b/test/jdk/java/text/Collator/RuleBasedCollatorTest.java index 429768b6bf1b..cd1e8ca69c00 100644 --- a/test/jdk/java/text/Collator/RuleBasedCollatorTest.java +++ b/test/jdk/java/text/Collator/RuleBasedCollatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,40 +26,45 @@ * @bug 4406815 8222969 8266784 * @summary RuleBasedCollatorTest uses very limited but selected test data * to test basic functionalities provided by RuleBasedCollator. - * @run testng/othervm RuleBasedCollatorTest + * @run junit/othervm RuleBasedCollatorTest */ +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.CollationElementIterator; import java.text.CollationKey; -import java.text.RuleBasedCollator; import java.text.Collator; import java.text.ParseException; +import java.text.RuleBasedCollator; import java.util.Arrays; import java.util.Locale; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import org.testng.SkipException; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeFalse; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class RuleBasedCollatorTest { - static RuleBasedCollator USC; - static String US_RULES; + private static RuleBasedCollator USC; + private static String US_RULES; - @BeforeClass - public void setup() { + @BeforeAll + void setup() { Collator c = Collator.getInstance(Locale.US); - if (!(c instanceof RuleBasedCollator)) { - throw new SkipException("skip tests."); - } + assumeFalse(!(c instanceof RuleBasedCollator), "skip tests."); USC = (RuleBasedCollator) c; US_RULES = USC.getRules(); } - @DataProvider(name = "rulesData") Object[][] rulesData() { //Basic Tailor String BASIC_TAILOR_RULES = "< b=c<\u00e6;A,a"; @@ -91,15 +96,15 @@ Object[][] rulesData() { }; } - @Test(dataProvider = "rulesData") - public void testRules(String rules, String[] testData, String[] expected) + @ParameterizedTest + @MethodSource("rulesData") + void testRules(String rules, String[] testData, String[] expected) throws ParseException { Arrays.sort(testData, new RuleBasedCollator(rules)); - assertEquals(testData, expected); + assertArrayEquals(expected, testData); } - @DataProvider(name = "FrenchSecondarySort") Object[][] FrenchSecondarySort() { return new Object[][] { { "\u0061\u00e1\u0061", "\u00e1\u0061\u0061", 1 }, @@ -111,8 +116,9 @@ Object[][] FrenchSecondarySort() { { "a", "\u1ea1", -1 } }; } - @Test(dataProvider = "FrenchSecondarySort") - public void testFrenchSecondarySort(String sData, String tData, + @ParameterizedTest + @MethodSource("FrenchSecondarySort") + void testFrenchSecondarySort(String sData, String tData, int expected) throws ParseException { String french_rule = "@"; String rules = US_RULES + french_rule; @@ -121,7 +127,6 @@ public void testFrenchSecondarySort(String sData, String tData, assertEquals(expected, result); } - @DataProvider(name = "ThaiLaoVowelConsonantSwapping") Object[][] ThaiLaoVowelConsonantSwapping() { return new Object[][] {{"\u0e44\u0e01", "\u0e40\u0e2e", -1},//swap {"\u0e2e\u0e40", "\u0e01\u0e44", 1},//no swap @@ -129,8 +134,9 @@ Object[][] ThaiLaoVowelConsonantSwapping() { }; } - @Test(dataProvider = "ThaiLaoVowelConsonantSwapping") - public void testThaiLaoVowelConsonantSwapping(String sData, String tData, + @ParameterizedTest + @MethodSource("ThaiLaoVowelConsonantSwapping") + void testThaiLaoVowelConsonantSwapping(String sData, String tData, int expected) throws ParseException { String thai_rule = "& Z < \u0e01 < \u0e2e <\u0e40 < \u0e44!"; String rules = US_RULES + thai_rule; @@ -140,16 +146,15 @@ public void testThaiLaoVowelConsonantSwapping(String sData, String tData, } @Test - public void testIgnorableCharacter() throws ParseException { + void testIgnorableCharacter() throws ParseException { String rule = "=f new RuleBasedCollator(rule)); } - @Test(expectedExceptions = NullPointerException.class) - public void testNullParseException() throws ParseException{ - new RuleBasedCollator(null); + @Test + void testNullParseException() { + assertThrows(NullPointerException.class, () -> new RuleBasedCollator(null)); } } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/CompactFormatAndParseHelper.java b/test/jdk/java/text/Format/CompactNumberFormat/CompactFormatAndParseHelper.java index 3f3f1932e51e..4d410f97b5d9 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/CompactFormatAndParseHelper.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/CompactFormatAndParseHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,15 @@ import java.text.NumberFormat; import java.text.ParseException; import java.text.ParsePosition; -import static org.testng.Assert.assertEquals; + +import static org.junit.jupiter.api.Assertions.assertEquals; class CompactFormatAndParseHelper { static void testFormat(NumberFormat cnf, Object number, String expected) { String result = cnf.format(number); - assertEquals(result, expected, "Incorrect formatting of the number '" + assertEquals(expected, result, "Incorrect formatting of the number '" + number + "'"); } @@ -46,11 +47,11 @@ static void testParse(NumberFormat cnf, String parseString, } if (returnType != null) { - assertEquals(number.getClass(), returnType, + assertEquals(returnType, number.getClass(), "Incorrect return type for string '" + parseString + "'"); } - assertEquals(number, expected, "Incorrect parsing of the string '" + assertEquals(expected, number, "Incorrect parsing of the string '" + parseString + "'"); } } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestCNFRounding.java b/test/jdk/java/text/Format/CompactNumberFormat/TestCNFRounding.java index b4dddfa1df77..0ba9587a3443 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestCNFRounding.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestCNFRounding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,21 +20,28 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @summary Checks the rounding of formatted number in compact number formatting - * @run testng/othervm TestCNFRounding + * @run junit/othervm TestCNFRounding */ +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.RoundingMode; import java.text.NumberFormat; import java.util.List; import java.util.Locale; -import static org.testng.Assert.*; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestCNFRounding { private static final List MODES = List.of( @@ -46,7 +53,6 @@ public class TestCNFRounding { RoundingMode.CEILING, RoundingMode.FLOOR); - @DataProvider(name = "roundingData") Object[][] roundingData() { return new Object[][]{ // Number, half_even, half_up, half_down, up, down, ceiling, floor @@ -70,7 +76,6 @@ Object[][] roundingData() { {-4500, new String[]{"-4K", "-5K", "-4K", "-5K", "-4K", "-4K", "-5K"}},}; } - @DataProvider(name = "roundingFract") Object[][] roundingFract() { return new Object[][]{ // Number, half_even, half_up, half_down, up, down, ceiling, floor @@ -94,7 +99,6 @@ Object[][] roundingFract() { {-4500, new String[]{"-4.5K", "-4.5K", "-4.5K", "-4.5K", "-4.5K", "-4.5K", "-4.5K"}},}; } - @DataProvider(name = "rounding2Fract") Object[][] rounding2Fract() { return new Object[][]{ // Number, half_even, half_up, half_down @@ -118,37 +122,42 @@ Object[][] rounding2Fract() { {4686, new String[]{"4.69K", "4.69K", "4.69K"}},}; } - @Test(expectedExceptions = NullPointerException.class) - public void testNullMode() { - NumberFormat fmt = NumberFormat - .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); - fmt.setRoundingMode(null); + @Test + void testNullMode() { + assertThrows(NullPointerException.class, () -> { + NumberFormat fmt = NumberFormat + .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); + fmt.setRoundingMode(null); + }); } @Test - public void testDefaultRoundingMode() { + void testDefaultRoundingMode() { NumberFormat fmt = NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); - assertEquals(fmt.getRoundingMode(), RoundingMode.HALF_EVEN, + assertEquals(RoundingMode.HALF_EVEN, fmt.getRoundingMode(), "Default RoundingMode should be " + RoundingMode.HALF_EVEN); } - @Test(dataProvider = "roundingData") - public void testRounding(Object number, String[] expected) { + @ParameterizedTest + @MethodSource("roundingData") + void testRounding(Object number, String[] expected) { for (int index = 0; index < MODES.size(); index++) { testRoundingMode(number, expected[index], 0, MODES.get(index)); } } - @Test(dataProvider = "roundingFract") - public void testRoundingFract(Object number, String[] expected) { + @ParameterizedTest + @MethodSource("roundingFract") + void testRoundingFract(Object number, String[] expected) { for (int index = 0; index < MODES.size(); index++) { testRoundingMode(number, expected[index], 1, MODES.get(index)); } } - @Test(dataProvider = "rounding2Fract") - public void testRounding2Fract(Object number, String[] expected) { + @ParameterizedTest + @MethodSource("rounding2Fract") + void testRounding2Fract(Object number, String[] expected) { List rModes = List.of(RoundingMode.HALF_EVEN, RoundingMode.HALF_UP, RoundingMode.HALF_DOWN); for (int index = 0; index < rModes.size(); index++) { @@ -161,12 +170,12 @@ private void testRoundingMode(Object number, String expected, NumberFormat fmt = NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); fmt.setRoundingMode(rounding); - assertEquals(fmt.getRoundingMode(), rounding, + assertEquals(rounding, fmt.getRoundingMode(), "RoundingMode set is not returned by getRoundingMode"); fmt.setMinimumFractionDigits(fraction); String result = fmt.format(number); - assertEquals(result, expected, "Incorrect formatting of number " + assertEquals(expected, result, "Incorrect formatting of number " + number + " using rounding mode: " + rounding); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestCompactNumber.java b/test/jdk/java/text/Format/CompactNumberFormat/TestCompactNumber.java index 82577c26fc1a..03f0e9c2faeb 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestCompactNumber.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestCompactNumber.java @@ -25,8 +25,14 @@ * @bug 8177552 8217721 8222756 8295372 * @summary Checks the functioning of compact number format * @modules jdk.localedata - * @run testng/othervm TestCompactNumber + * @run junit/othervm TestCompactNumber */ + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.FieldPosition; @@ -36,10 +42,11 @@ import java.text.ParsePosition; import java.util.Locale; import java.util.stream.Stream; -import static org.testng.Assert.*; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestCompactNumber { private static final NumberFormat FORMAT_DZ_LONG = NumberFormat @@ -96,7 +103,6 @@ public class TestCompactNumber { FORMAT_PT_LONG_FD4.setMaximumFractionDigits(4); } - @DataProvider(name = "format") Object[][] compactFormatData() { return new Object[][]{ // compact number format instance, number to format, formatted output @@ -362,7 +368,6 @@ Object[][] compactFormatData() { }; } - @DataProvider(name = "parse") Object[][] compactParseData() { return new Object[][]{ // compact number format instance, string to parse, parsed number, return type @@ -469,7 +474,6 @@ Object[][] compactParseData() { }; } - @DataProvider(name = "exceptionParse") Object[][] exceptionParseData() { return new Object[][]{ // compact number instance, string to parse, null (no o/p; must throw exception) @@ -487,7 +491,6 @@ Object[][] exceptionParseData() { {FORMAT_SE_SHORT, "-8\u00a0mn", null},}; } - @DataProvider(name = "invalidParse") Object[][] invalidParseData() { return new Object[][]{ // compact number instance, string to parse, parsed number @@ -517,7 +520,6 @@ Object[][] invalidParseData() { }; } - @DataProvider(name = "fieldPosition") Object[][] formatFieldPositionData() { return new Object[][]{ //compact number instance, number to format, field, start position, end position, formatted string @@ -563,7 +565,6 @@ Object[][] formatFieldPositionData() { {FORMAT_SE_SHORT, new BigDecimal("-48982865901234567890.98"), NumberFormat.Field.INTEGER, 1, 9, "\u221248982866\u00a0bn"},}; } - @DataProvider(name = "varParsePosition") Object[][] varParsePosition() { return new Object[][]{ // compact number instance, parse string, parsed number, @@ -591,73 +592,82 @@ Object[][] varParsePosition() { } @Test - public void testInstanceCreation() { + void testInstanceCreation() { Stream.of(NumberFormat.getAvailableLocales()).forEach(l -> NumberFormat .getCompactNumberInstance(l, NumberFormat.Style.SHORT).format(10000)); Stream.of(NumberFormat.getAvailableLocales()).forEach(l -> NumberFormat .getCompactNumberInstance(l, NumberFormat.Style.LONG).format(10000)); } - @Test(expectedExceptions = IllegalArgumentException.class) - public void testFormatWithNullParam() { - FORMAT_EN_US_SHORT.format(null); + @Test + void testFormatWithNullParam() { + assertThrows(IllegalArgumentException.class, () -> { + FORMAT_EN_US_SHORT.format(null); + }); } - @Test(dataProvider = "format") - public void testFormat(NumberFormat cnf, Object number, + @ParameterizedTest + @MethodSource("compactFormatData") + void testFormat(NumberFormat cnf, Object number, String expected) { CompactFormatAndParseHelper.testFormat(cnf, number, expected); } - @Test(dataProvider = "parse") - public void testParse(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("compactParseData") + void testParse(NumberFormat cnf, String parseString, Number expected, Class returnType) throws ParseException { CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, returnType); } - @Test(dataProvider = "parse") - public void testParsePosition(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("compactParseData") + void testParsePosition(NumberFormat cnf, String parseString, Number expected, Class returnType) throws ParseException { ParsePosition pos = new ParsePosition(0); CompactFormatAndParseHelper.testParse(cnf, parseString, expected, pos, returnType); - assertEquals(pos.getIndex(), parseString.length()); - assertEquals(pos.getErrorIndex(), -1); + assertEquals(parseString.length(), pos.getIndex()); + assertEquals(-1, pos.getErrorIndex()); } - @Test(dataProvider = "varParsePosition") - public void testVarParsePosition(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("varParsePosition") + void testVarParsePosition(NumberFormat cnf, String parseString, Number expected, int startPosition, int indexPosition, int errPosition) throws ParseException { ParsePosition pos = new ParsePosition(startPosition); CompactFormatAndParseHelper.testParse(cnf, parseString, expected, pos, null); - assertEquals(pos.getIndex(), indexPosition); - assertEquals(pos.getErrorIndex(), errPosition); + assertEquals(indexPosition, pos.getIndex()); + assertEquals(errPosition, pos.getErrorIndex()); } - @Test(dataProvider = "exceptionParse", expectedExceptions = ParseException.class) - public void throwsParseException(NumberFormat cnf, String parseString, - Number expected) throws ParseException { - CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, null); + @ParameterizedTest + @MethodSource("exceptionParseData") + void throwsParseException(NumberFormat cnf, String parseString, + Number expected) { + assertThrows(ParseException.class, () -> CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, null)); } - @Test(dataProvider = "invalidParse") - public void testInvalidParse(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("invalidParseData") + void testInvalidParse(NumberFormat cnf, String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, null); } - @Test(dataProvider = "fieldPosition") - public void testFormatWithFieldPosition(NumberFormat nf, + @ParameterizedTest + @MethodSource("formatFieldPositionData") + void testFormatWithFieldPosition(NumberFormat nf, Object number, Format.Field field, int posStartExpected, int posEndExpected, String expected) { FieldPosition pos = new FieldPosition(field); StringBuffer buf = new StringBuffer(); StringBuffer result = nf.format(number, buf, pos); - assertEquals(result.toString(), expected, "Incorrect formatting of the number '" + assertEquals(expected, result.toString(), "Incorrect formatting of the number '" + number + "'"); - assertEquals(pos.getBeginIndex(), posStartExpected, "Incorrect start position" + assertEquals(posStartExpected, pos.getBeginIndex(), "Incorrect start position" + " while formatting the number '" + number + "', for the field " + field); - assertEquals(pos.getEndIndex(), posEndExpected, "Incorrect end position" + assertEquals(posEndExpected, pos.getEndIndex(), "Incorrect end position" + " while formatting the number '" + number + "', for the field " + field); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java b/test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java index 8476b568ba01..1f8f1041e9e1 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,13 @@ * @bug 8177552 8217254 8251499 8281317 * @summary Checks the validity of compact number patterns specified through * CompactNumberFormat constructor - * @run testng/othervm TestCompactPatternsValidity + * @run junit/othervm TestCompactPatternsValidity */ +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.CompactNumberFormat; @@ -35,9 +39,10 @@ import java.text.ParseException; import java.util.List; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestCompactPatternsValidity { // Max range 10^4 @@ -74,7 +79,6 @@ public class TestCompactPatternsValidity { private static final String[] COMPACT_PATTERN14 = new String[]{"", "", "", "{one:Kun other:0' 'Kun}"}; // from Somali in CLDR 38 - @DataProvider(name = "invalidPatterns") Object[][] invalidCompactPatterns() { return new Object[][] { // compact patterns @@ -90,7 +94,6 @@ Object[][] invalidCompactPatterns() { }; } - @DataProvider(name = "validPatternsFormat") Object[][] validPatternsFormat() { return new Object[][] { // compact patterns, numbers, expected output @@ -116,7 +119,6 @@ Object[][] validPatternsFormat() { }; } - @DataProvider(name = "validPatternsParse") Object[][] validPatternsParse() { return new Object[][] { // compact patterns, parse string, expected output @@ -136,7 +138,6 @@ Object[][] validPatternsParse() { }; } - @DataProvider(name = "validPatternsFormatWithPluralRules") Object[][] validPatternsFormatWithPluralRules() { return new Object[][] { // compact patterns, plural rules, numbers, expected output @@ -144,7 +145,6 @@ Object[][] validPatternsFormatWithPluralRules() { }; } - @DataProvider(name = "validPatternsParseWithPluralRules") Object[][] validPatternsParseWithPluralRules() { return new Object[][] { // compact patterns, plural rules, parse string, expected output @@ -152,15 +152,18 @@ Object[][] validPatternsParseWithPluralRules() { }; } - @Test(dataProvider = "invalidPatterns", - expectedExceptions = IllegalArgumentException.class) - public void testInvalidCompactPatterns(String[] compactPatterns) { - new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols - .getInstance(Locale.US), compactPatterns); + @ParameterizedTest + @MethodSource("invalidCompactPatterns") + void testInvalidCompactPatterns(String[] compactPatterns) { + assertThrows(IllegalArgumentException.class, () -> { + new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols + .getInstance(Locale.US), compactPatterns); + }); } - @Test(dataProvider = "validPatternsFormat") - public void testValidPatternsFormat(String[] compactPatterns, + @ParameterizedTest + @MethodSource("validPatternsFormat") + void testValidPatternsFormat(String[] compactPatterns, List numbers, List expected) { CompactNumberFormat fmt = new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), compactPatterns); @@ -170,8 +173,9 @@ public void testValidPatternsFormat(String[] compactPatterns, } } - @Test(dataProvider = "validPatternsParse") - public void testValidPatternsParse(String[] compactPatterns, + @ParameterizedTest + @MethodSource("validPatternsParse") + void testValidPatternsParse(String[] compactPatterns, List parseString, List numbers) throws ParseException { CompactNumberFormat fmt = new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), compactPatterns); @@ -181,8 +185,9 @@ public void testValidPatternsParse(String[] compactPatterns, } } - @Test(dataProvider = "validPatternsFormatWithPluralRules") - public void testValidPatternsFormatWithPluralRules(String[] compactPatterns, String pluralRules, + @ParameterizedTest + @MethodSource("validPatternsFormatWithPluralRules") + void testValidPatternsFormatWithPluralRules(String[] compactPatterns, String pluralRules, List numbers, List expected) { CompactNumberFormat fmt = new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), compactPatterns, pluralRules); @@ -192,8 +197,9 @@ public void testValidPatternsFormatWithPluralRules(String[] compactPatterns, Str } } - @Test(dataProvider = "validPatternsParseWithPluralRules") - public void testValidPatternsParsewithPluralRules(String[] compactPatterns, String pluralRules, + @ParameterizedTest + @MethodSource("validPatternsParseWithPluralRules") + void testValidPatternsParsewithPluralRules(String[] compactPatterns, String pluralRules, List parseString, List numbers) throws ParseException { CompactNumberFormat fmt = new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), compactPatterns, pluralRules); diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestEquality.java b/test/jdk/java/text/Format/CompactNumberFormat/TestEquality.java index b5d0ae860ed9..2c889656ce0f 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestEquality.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestEquality.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,25 +20,26 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 8222756 * @summary Checks the equals and hashCode method of CompactNumberFormat * @modules jdk.localedata - * @run testng/othervm TestEquality - * + * @run junit/othervm TestEquality */ +import org.junit.jupiter.api.Test; + import java.text.CompactNumberFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.Locale; -import org.testng.annotations.Test; public class TestEquality { @Test - public void testEquality() { + void testEquality() { CompactNumberFormat cnf1 = (CompactNumberFormat) NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); @@ -148,7 +149,7 @@ private void checkEquals(CompactNumberFormat cnf1, CompactNumberFormat cnf2, } @Test - public void testHashCode() { + void testHashCode() { NumberFormat cnf1 = NumberFormat .getCompactNumberInstance(Locale.JAPAN, NumberFormat.Style.SHORT); NumberFormat cnf2 = NumberFormat @@ -163,7 +164,7 @@ public void testHashCode() { // Test the property of equals and hashCode i.e. two equal object must // always have the same hashCode @Test - public void testEqualsAndHashCode() { + void testEqualsAndHashCode() { NumberFormat cnf1 = NumberFormat .getCompactNumberInstance(Locale.of("hi", "IN"), NumberFormat.Style.SHORT); cnf1.setMinimumIntegerDigits(5); diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestFormatToCharacterIterator.java b/test/jdk/java/text/Format/CompactNumberFormat/TestFormatToCharacterIterator.java index fb18fa256ab8..beb6c38aca88 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestFormatToCharacterIterator.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestFormatToCharacterIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,14 +20,20 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @summary Checks the functioning of * CompactNumberFormat.formatToCharacterIterator method * @modules jdk.localedata - * @run testng/othervm TestFormatToCharacterIterator + * @run junit/othervm TestFormatToCharacterIterator */ + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.AttributedCharacterIterator; @@ -36,10 +42,10 @@ import java.text.NumberFormat; import java.util.Locale; import java.util.Set; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestFormatToCharacterIterator { private static final NumberFormat FORMAT_DZ = NumberFormat @@ -54,7 +60,6 @@ public class TestFormatToCharacterIterator { .getCompactNumberInstance(Locale.ENGLISH, NumberFormat.Style.LONG); - @DataProvider(name = "fieldPositions") Object[][] compactFieldPositionData() { return new Object[][]{ // compact format instance, number, resulted string, attributes/fields, attribute positions @@ -149,22 +154,23 @@ Object[][] compactFieldPositionData() { }; } - @Test(dataProvider = "fieldPositions") - public void testFormatToCharacterIterator(NumberFormat fmt, Object number, + @ParameterizedTest + @MethodSource("compactFieldPositionData") + void testFormatToCharacterIterator(NumberFormat fmt, Object number, String expected, Format.Field[] expectedFields, int[] positions) { AttributedCharacterIterator iterator = fmt.formatToCharacterIterator(number); - assertEquals(getText(iterator), expected, "Incorrect formatting of the number '" + assertEquals(expected, getText(iterator), "Incorrect formatting of the number '" + number + "'"); iterator.first(); // Check start and end index of the formatted string - assertEquals(iterator.getBeginIndex(), 0, "Incorrect start index: " + assertEquals(0, iterator.getBeginIndex(), "Incorrect start index: " + iterator.getBeginIndex() + " of the formatted string: " + expected); - assertEquals(iterator.getEndIndex(), expected.length(), "Incorrect end index: " + assertEquals(expected.length(), iterator.getEndIndex(), "Incorrect end index: " + iterator.getEndIndex() + " of the formatted string: " + expected); // Check the attributes returned by the formatToCharacterIterator - assertEquals(iterator.getAllAttributeKeys(), Set.of(expectedFields), + assertEquals(Set.of(expectedFields), iterator.getAllAttributeKeys(), "Attributes do not match while formatting number: " + number); // Check the begin and end index for attributes @@ -173,10 +179,10 @@ public void testFormatToCharacterIterator(NumberFormat fmt, Object number, do { int start = iterator.getRunStart(); int end = iterator.getRunLimit(); - assertEquals(start, positions[currentPosition], + assertEquals(positions[currentPosition], start, "Incorrect start position for the attribute(s): " + iterator.getAttributes().keySet()); - assertEquals(end, positions[currentPosition + 1], + assertEquals(positions[currentPosition + 1], end, "Incorrect end position for the attribute(s): " + iterator.getAttributes().keySet()); currentPosition = currentPosition + 2; diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java b/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java index 47b176692fd1..4cf5ce12f161 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 @@ -27,8 +28,14 @@ * formatting parameters. For example, min fraction digits, grouping * size etc. * @modules jdk.localedata - * @run testng/othervm TestMutatingInstance + * @run junit/othervm TestMutatingInstance */ + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.CompactNumberFormat; @@ -36,10 +43,8 @@ import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestMutatingInstance { private static final NumberFormat FORMAT_FRACTION = NumberFormat @@ -61,8 +66,8 @@ public class TestMutatingInstance { "#,##0.0#", DecimalFormatSymbols.getInstance(Locale.US), new String[]{"", "", "", "", "00K", "", "", "", "", "", "", "", "", "", ""}); - @BeforeTest - public void mutateInstances() { + @BeforeAll + void mutateInstances() { FORMAT_FRACTION.setMinimumFractionDigits(2); FORMAT_GROUPING.setGroupingSize(3); FORMAT_GROUPING.setGroupingUsed(true); @@ -75,7 +80,6 @@ public void mutateInstances() { FORMAT_NO_PATTERNS.setMinimumFractionDigits(2); } - @DataProvider(name = "format") Object[][] compactFormatData() { return new Object[][]{ {FORMAT_FRACTION, 1900, "1.90 thousand"}, @@ -95,7 +99,6 @@ Object[][] compactFormatData() { {FORMAT_NO_PATTERNS, new BigDecimal(12346567890987654.32), "12,346,567,890,987,654"},}; } - @DataProvider(name = "parse") Object[][] compactParseData() { return new Object[][]{ {FORMAT_FRACTION, "190 thousand", 190000L}, @@ -106,14 +109,16 @@ Object[][] compactParseData() { {FORMAT_PARSEINTONLY, "12.345 thousand", 12000L},}; } - @Test(dataProvider = "format") - public void formatCompactNumber(NumberFormat nf, + @ParameterizedTest + @MethodSource("compactFormatData") + void formatCompactNumber(NumberFormat nf, Object number, String expected) { CompactFormatAndParseHelper.testFormat(nf, number, expected); } - @Test(dataProvider = "parse") - public void parseCompactNumber(NumberFormat nf, + @ParameterizedTest + @MethodSource("compactParseData") + void parseCompactNumber(NumberFormat nf, String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(nf, parseString, expected, null, null); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestParseBigDecimal.java b/test/jdk/java/text/Format/CompactNumberFormat/TestParseBigDecimal.java index 1a3c429470a6..e8cc11f68769 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestParseBigDecimal.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestParseBigDecimal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,17 +20,19 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @summary Checks CNF.parse() when parseBigDecimal is set to true * @modules jdk.localedata - * @run testng/othervm TestParseBigDecimal + * @run junit/othervm TestParseBigDecimal */ -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.math.BigDecimal; import java.text.CompactNumberFormat; @@ -38,6 +40,7 @@ import java.text.ParseException; import java.util.Locale; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestParseBigDecimal { private static final CompactNumberFormat FORMAT_DZ_LONG = (CompactNumberFormat) NumberFormat @@ -64,8 +67,8 @@ public class TestParseBigDecimal { private static final CompactNumberFormat FORMAT_SE_SHORT = (CompactNumberFormat) NumberFormat .getCompactNumberInstance(Locale.of("se"), NumberFormat.Style.SHORT); - @BeforeTest - public void mutateInstances() { + @BeforeAll + void mutateInstances() { FORMAT_DZ_LONG.setParseBigDecimal(true); FORMAT_EN_US_SHORT.setParseBigDecimal(true); FORMAT_EN_LONG.setParseBigDecimal(true); @@ -76,7 +79,6 @@ public void mutateInstances() { FORMAT_SE_SHORT.setParseBigDecimal(true); } - @DataProvider(name = "parse") Object[][] compactParseData() { return new Object[][]{ // compact number format instance, string to parse, parsed number @@ -165,8 +167,9 @@ Object[][] compactParseData() { {FORMAT_SE_SHORT, "\u221212345679,89\u00a0bn", new BigDecimal("-12345679890000000000.00")},}; } - @Test(dataProvider = "parse") - public void testParse(NumberFormat cnf, String parseString, + @ParameterizedTest + @MethodSource("compactParseData") + void testParse(NumberFormat cnf, String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, BigDecimal.class); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestPlurals.java b/test/jdk/java/text/Format/CompactNumberFormat/TestPlurals.java index bbaaa701d234..b8beb6135dd9 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestPlurals.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestPlurals.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,21 +20,27 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8222756 * @summary Tests plurals support in CompactNumberFormat - * @run testng/othervm TestPlurals + * @run junit/othervm TestPlurals */ +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.CompactNumberFormat; import java.text.DecimalFormatSymbols; import java.util.Locale; -import static org.testng.Assert.*; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestPlurals { private final static DecimalFormatSymbols DFS = DecimalFormatSymbols.getInstance(Locale.ROOT); @@ -45,7 +51,6 @@ public class TestPlurals { private final static String RULE_3 = "one:n%2=0andn/3=2;"; - @DataProvider Object[][] pluralRules() { return new Object[][]{ // rules, number, expected @@ -78,7 +83,6 @@ Object[][] pluralRules() { }; } - @DataProvider Object[][] invalidRules() { return new Object [][] { {"one:a = 1"}, @@ -92,27 +96,34 @@ Object[][] invalidRules() { }; } - @Test(expectedExceptions = NullPointerException.class) - public void testNullPluralRules() { - String[] pattern = {""}; - new CompactNumberFormat("#", DFS, PATTERN, null); + @Test + void testNullPluralRules() { + assertThrows(NullPointerException.class, () -> { + String[] pattern = {""}; + new CompactNumberFormat("#", DFS, PATTERN, null); + }); } - @Test(dataProvider = "pluralRules") - public void testPluralRules(String rules, Number n, String expected) { + @ParameterizedTest + @MethodSource("pluralRules") + void testPluralRules(String rules, Number n, String expected) { var cnp = new CompactNumberFormat("#", DFS, PATTERN, rules); - assertEquals(cnp.format(n), expected); + assertEquals(expected, cnp.format(n)); } - @Test(dataProvider = "invalidRules", expectedExceptions = IllegalArgumentException.class) - public void testInvalidRules(String rules) { - new CompactNumberFormat("#", DFS, PATTERN, rules); + @ParameterizedTest + @MethodSource("invalidRules") + void testInvalidRules(String rules) { + assertThrows(IllegalArgumentException.class, + () -> new CompactNumberFormat("#", DFS, PATTERN, rules)); } - @Test(expectedExceptions = IllegalArgumentException.class) - public void testLimitExceedingRules() { - String andCond = " and n = 1"; - String invalid = "one: n = 1" + andCond.repeat(2_048 / andCond.length()); - new CompactNumberFormat("#", DFS, PATTERN, invalid); + @Test + void testLimitExceedingRules() { + assertThrows(IllegalArgumentException.class, () -> { + String andCond = " and n = 1"; + String invalid = "one: n = 1" + andCond.repeat(2_048 / andCond.length()); + new CompactNumberFormat("#", DFS, PATTERN, invalid); + }); } } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestSpecialValues.java b/test/jdk/java/text/Format/CompactNumberFormat/TestSpecialValues.java index e8ac2489fafc..9bd0ef738309 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestSpecialValues.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestSpecialValues.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,25 +20,29 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @summary Checks the formatting and parsing of special values * @modules jdk.localedata - * @run testng/othervm TestSpecialValues + * @run junit/othervm TestSpecialValues */ + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestSpecialValues { private static final NumberFormat FORMAT = NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); - @DataProvider(name = "formatSpecialValues") Object[][] formatSpecialValues() { return new Object[][]{ // number , formatted ouput @@ -53,7 +57,6 @@ Object[][] formatSpecialValues() { {Long.MAX_VALUE, "9223372T"},}; } - @DataProvider(name = "parseSpecialValues") Object[][] parseSpecialValues() { return new Object[][]{ // parse string, parsed number @@ -65,13 +68,15 @@ Object[][] parseSpecialValues() { {"-\u221E", Double.NEGATIVE_INFINITY},}; } - @Test(dataProvider = "formatSpecialValues") - public void testFormatSpecialValues(Object number, String expected) { + @ParameterizedTest + @MethodSource("formatSpecialValues") + void testFormatSpecialValues(Object number, String expected) { CompactFormatAndParseHelper.testFormat(FORMAT, number, expected); } - @Test(dataProvider = "parseSpecialValues") - public void testParseSpecialValues(String parseString, Number expected) + @ParameterizedTest + @MethodSource("parseSpecialValues") + void testParseSpecialValues(String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(FORMAT, parseString, expected, null, null); } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestUExtensionOverride.java b/test/jdk/java/text/Format/CompactNumberFormat/TestUExtensionOverride.java index 099e6978b0b0..f77908d84c46 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestUExtensionOverride.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestUExtensionOverride.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,23 +20,27 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 8221432 * @summary Checks the behaviour of Unicode BCP 47 U Extension with * compact number format * @modules jdk.localedata - * @run testng/othervm TestUExtensionOverride + * @run junit/othervm TestUExtensionOverride */ + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestUExtensionOverride { - @DataProvider(name = "compactFormatData") Object[][] compactFormatData() { return new Object[][]{ // locale, number, formatted string @@ -61,7 +65,6 @@ Object[][] compactFormatData() { "\u0967\u0968\u00a0k"},}; } - @DataProvider(name = "compactParseData") Object[][] compactParseData() { return new Object[][]{ // locale, parse string, parsed number @@ -87,16 +90,18 @@ Object[][] compactParseData() { "\u0967\u0968\u00a0k", 12000L},}; } - @Test(dataProvider = "compactFormatData") - public void testFormat(Locale locale, double num, + @ParameterizedTest + @MethodSource("compactFormatData") + void testFormat(Locale locale, double num, String expected) { NumberFormat cnf = NumberFormat.getCompactNumberInstance(locale, NumberFormat.Style.SHORT); CompactFormatAndParseHelper.testFormat(cnf, num, expected); } - @Test(dataProvider = "compactParseData") - public void testParse(Locale locale, String parseString, + @ParameterizedTest + @MethodSource("compactParseData") + void testParse(Locale locale, String parseString, Number expected) throws ParseException { NumberFormat cnf = NumberFormat.getCompactNumberInstance(locale, NumberFormat.Style.SHORT); diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestWithCompatProvider.java b/test/jdk/java/text/Format/CompactNumberFormat/TestWithCompatProvider.java index 510d3d9062f4..884a973226a7 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestWithCompatProvider.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestWithCompatProvider.java @@ -28,16 +28,19 @@ * as a provider should always use the default patterns added in the * FormatData.java resource bundle * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=COMPAT TestWithCompatProvider + * @run junit/othervm -Djava.locale.providers=COMPAT TestWithCompatProvider */ +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestWithCompatProvider { private static final NumberFormat FORMAT_DZ_SHORT = NumberFormat @@ -46,7 +49,6 @@ public class TestWithCompatProvider { private static final NumberFormat FORMAT_EN_US_SHORT = NumberFormat .getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT); - @DataProvider(name = "format") Object[][] compactFormatData() { return new Object[][]{ {FORMAT_DZ_SHORT, 1000.09, "1K"}, @@ -61,7 +63,6 @@ Object[][] compactFormatData() { {FORMAT_EN_US_SHORT, new BigDecimal("12345678901234567890.89"), "12345679T"},}; } - @DataProvider(name = "parse") Object[][] compactParseData() { return new Object[][]{ {FORMAT_DZ_SHORT, "1K", 1000L}, @@ -72,13 +73,15 @@ Object[][] compactParseData() { {FORMAT_EN_US_SHORT, "12345679T", 1.2345679E19},}; } - @Test(dataProvider = "format") + @ParameterizedTest + @MethodSource("compactFormatData") public void testFormat(NumberFormat cnf, Object number, String expected) { CompactFormatAndParseHelper.testFormat(cnf, number, expected); } - @Test(dataProvider = "parse") + @ParameterizedTest + @MethodSource("compactParseData") public void testParse(NumberFormat cnf, String parseString, Number expected) throws ParseException { CompactFormatAndParseHelper.testParse(cnf, parseString, expected, null, null); diff --git a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java index 0b4710f0086c..563ae307762c 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,11 +28,12 @@ * @summary Checks deserialization of compact number format * @library /java/text/testlib * @build TestDeserializeCNF HexDumpReader - * @run testng/othervm TestDeserializeCNF + * @run junit/othervm TestDeserializeCNF */ -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import java.io.IOException; import java.io.InputStream; @@ -41,8 +42,10 @@ import java.text.CompactNumberFormat; import java.text.DecimalFormatSymbols; import java.util.Locale; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestDeserializeCNF { // This object is serialized in cnf1.ser.txt with HALF_UP @@ -60,8 +63,8 @@ public class TestDeserializeCNF { private static final String FILE_COMPACT_FORMAT1 = "cnf1.ser.txt"; private static final String FILE_COMPACT_FORMAT2 = "cnf2.ser.txt"; - @BeforeTest - public void mutateInstances() { + @BeforeAll + void mutateInstances() { COMPACT_FORMAT1.setRoundingMode(RoundingMode.HALF_UP); COMPACT_FORMAT1.setGroupingSize(3); COMPACT_FORMAT1.setParseBigDecimal(true); @@ -71,18 +74,18 @@ public void mutateInstances() { } @Test - public void testDeserialization() throws IOException, ClassNotFoundException { + void testDeserialization() throws IOException, ClassNotFoundException { try (InputStream istream1 = HexDumpReader.getStreamFromHexDump(FILE_COMPACT_FORMAT1); ObjectInputStream ois1 = new ObjectInputStream(istream1); InputStream istream2 = HexDumpReader.getStreamFromHexDump(FILE_COMPACT_FORMAT2); ObjectInputStream ois2 = new ObjectInputStream(istream2);) { CompactNumberFormat obj1 = (CompactNumberFormat) ois1.readObject(); - assertEquals(obj1, COMPACT_FORMAT1, "Deserialized instance is not" + assertEquals(COMPACT_FORMAT1, obj1, "Deserialized instance is not" + " equal to the instance serialized in " + FILE_COMPACT_FORMAT1); CompactNumberFormat obj2 = (CompactNumberFormat) ois2.readObject(); - assertEquals(obj2, COMPACT_FORMAT2, "Deserialized instance is not" + assertEquals(COMPACT_FORMAT2, obj2, "Deserialized instance is not" + " equal to the instance serialized in " + FILE_COMPACT_FORMAT2); } } diff --git a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestSerialization.java b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestSerialization.java index 55f950bd6745..f2039deb2322 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestSerialization.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestSerialization.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,16 +20,18 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8177552 * @modules jdk.localedata * @summary Checks the serialization feature of CompactNumberFormat - * @run testng/othervm TestSerialization + * @run junit/othervm TestSerialization */ -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -40,8 +42,10 @@ import java.text.CompactNumberFormat; import java.text.NumberFormat; import java.util.Locale; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestSerialization { private static final NumberFormat FORMAT_HI = NumberFormat.getCompactNumberInstance( @@ -57,8 +61,8 @@ public class TestSerialization { private static final NumberFormat FORMAT_KO_KR = NumberFormat.getCompactNumberInstance( Locale.KOREA, NumberFormat.Style.SHORT); - @BeforeTest - public void mutateInstances() { + @BeforeAll + void mutateInstances() { FORMAT_HI.setMinimumFractionDigits(2); FORMAT_HI.setMinimumIntegerDigits(5); @@ -80,7 +84,7 @@ public void mutateInstances() { } @Test - public void testSerialization() throws IOException, ClassNotFoundException { + void testSerialization() throws IOException, ClassNotFoundException { // Serialize serialize("cdf.ser", FORMAT_HI, FORMAT_EN_US, FORMAT_JA_JP, FORMAT_FR_FR, FORMAT_DE_DE, FORMAT_KO_KR); // Deserialize @@ -103,13 +107,13 @@ private static void deserialize(String fileName, NumberFormat... formats) new FileInputStream(fileName))) { for (NumberFormat fmt : formats) { NumberFormat obj = (NumberFormat) os.readObject(); - assertEquals(fmt, obj, "Serialized and deserialized" + assertEquals(obj, fmt, "Serialized and deserialized" + " objects do not match"); long number = 123456789789L; String expected = fmt.format(number); String actual = obj.format(number); - assertEquals(actual, expected, "Serialized and deserialized" + assertEquals(expected, actual, "Serialized and deserialized" + " objects are expected to return same formatted" + " output for number: " + number); } diff --git a/test/jdk/java/text/Format/DateFormat/Bug8193444.java b/test/jdk/java/text/Format/DateFormat/Bug8193444.java index 6c5007bc851e..b2fac85dd8a0 100644 --- a/test/jdk/java/text/Format/DateFormat/Bug8193444.java +++ b/test/jdk/java/text/Format/DateFormat/Bug8193444.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,29 +20,32 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8193444 * @summary Checks SimpleDateFormat.format/parse for the AIOOB exception when * formatting/parsing dates through a pattern string that contains a * sequence of 256 or more non-ASCII unicode characters. - * @run testng/othervm Bug8193444 + * @run junit/othervm Bug8193444 */ -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class Bug8193444 { private static final String NON_ASCII_CHAR = "\u263A"; - @DataProvider(name = "dateFormat") Object[][] dateFormatData() { return new Object[][]{ // short_length (between 0 and 254) @@ -53,8 +56,9 @@ Object[][] dateFormatData() { {257},}; } - @Test(dataProvider = "dateFormat") - public void testDateFormatAndParse(int length) + @ParameterizedTest + @MethodSource("dateFormatData") + void testDateFormatAndParse(int length) throws ParseException { String pattern = NON_ASCII_CHAR.repeat(length); @@ -66,7 +70,7 @@ public void testDateFormatAndParse(int length) // Since the tested format patterns do not contain any character // representing date/time field, those characters are not interpreted, // they are simply copied into the output string during formatting - assertEquals(result, pattern, "Failed to format the date using" + assertEquals(pattern, result, "Failed to format the date using" + " pattern of length: " + length); // The format pattern used by this SimpleDateFormat diff --git a/test/jdk/java/text/Format/DateFormat/CaseInsensitiveParseTest.java b/test/jdk/java/text/Format/DateFormat/CaseInsensitiveParseTest.java index 2331e36b2f9e..51473710dbbb 100644 --- a/test/jdk/java/text/Format/DateFormat/CaseInsensitiveParseTest.java +++ b/test/jdk/java/text/Format/DateFormat/CaseInsensitiveParseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,14 +21,18 @@ * questions. */ -/** +/* * @test * @bug 8248434 * @modules jdk.localedata - * @run testng/othervm CaseInsensitiveParseTest * @summary Checks format/parse round trip in case-insensitive manner. + * @run junit/othervm CaseInsensitiveParseTest */ +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -37,36 +41,36 @@ import java.util.Locale; import java.util.stream.Stream; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class CaseInsensitiveParseTest { private final static String PATTERN = "GGGG/yyyy/MMMM/dddd/hhhh/mmmm/ss/aaaa"; private final static Date EPOCH = new Date(0L); - @DataProvider - private Object[][] locales() { + Object[][] locales() { return (Object[][])Arrays.stream(DateFormat.getAvailableLocales()) .map(Stream::of) .map(Stream::toArray) .toArray(Object[][]::new); } - @Test(dataProvider = "locales") - public void testUpperCase(Locale loc) throws ParseException { + @ParameterizedTest + @MethodSource("locales") + void testUpperCase(Locale loc) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(PATTERN, loc); String formatted = sdf.format(EPOCH); - assertEquals(sdf.parse(formatted.toUpperCase(Locale.ROOT)), EPOCH, + assertEquals(EPOCH, sdf.parse(formatted.toUpperCase(Locale.ROOT)), "roundtrip failed for string '" + formatted + "', locale: " + loc); } - @Test(dataProvider = "locales") - public void testLowerCase(Locale loc) throws ParseException { + @ParameterizedTest + @MethodSource("locales") + void testLowerCase(Locale loc) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(PATTERN, loc); String formatted = sdf.format(EPOCH); - assertEquals(sdf.parse(formatted.toLowerCase(Locale.ROOT)), EPOCH, + assertEquals(EPOCH, sdf.parse(formatted.toLowerCase(Locale.ROOT)), "roundtrip failed for string '" + formatted + "', locale: " + loc); } } diff --git a/test/jdk/java/text/Format/DateFormat/LocaleDateFormats.java b/test/jdk/java/text/Format/DateFormat/LocaleDateFormats.java index 6e58cef5c4b4..a02dc4ecac67 100644 --- a/test/jdk/java/text/Format/DateFormat/LocaleDateFormats.java +++ b/test/jdk/java/text/Format/DateFormat/LocaleDateFormats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,34 +21,38 @@ * questions. */ -/** +/* * @test * @bug 8080774 * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=JRE,CLDR LocaleDateFormats * @summary This file contains tests for JRE locales date formats + * @run junit/othervm -Djava.locale.providers=JRE,CLDR LocaleDateFormats */ +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.DateFormat; import java.util.Calendar; import java.util.Locale; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class LocaleDateFormats { - @Test(dataProvider = "dateFormats") - public void testDateFormat(Locale loc, int style, int year, int month, int date, String expectedString) { + @ParameterizedTest + @MethodSource("dateFormats") + void testDateFormat(Locale loc, int style, int year, int month, int date, String expectedString) { Calendar cal = Calendar.getInstance(loc); cal.set(year, month-1, date); // Create date formatter based on requested style and test locale DateFormat df = DateFormat.getDateInstance(style, loc); // Test the date format - assertEquals(df.format(cal.getTime()), expectedString); + assertEquals(expectedString, df.format(cal.getTime())); } - @DataProvider(name = "dateFormats" ) private Object[][] dateFormats() { return new Object[][] { //8080774 diff --git a/test/jdk/java/text/Format/DateFormat/SimpleDateFormatPatternTest.java b/test/jdk/java/text/Format/DateFormat/SimpleDateFormatPatternTest.java index bcf0022b092f..e8ff262e0abd 100644 --- a/test/jdk/java/text/Format/DateFormat/SimpleDateFormatPatternTest.java +++ b/test/jdk/java/text/Format/DateFormat/SimpleDateFormatPatternTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,21 +21,25 @@ * questions. */ -/** +/* * @test * @bug 4326988 6990146 8231213 * @summary test SimpleDateFormat, check its pattern in the constructor - * @run testng/othervm SimpleDateFormatPatternTest + * @run junit/othervm SimpleDateFormatPatternTest */ -import java.lang.IllegalArgumentException; + +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.DateFormat; import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertThrows; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SimpleDateFormatPatternTest { private static String[] validPat = { "yyyy-MM-dd h.mm.ss.a z", @@ -136,90 +140,104 @@ private static Object[][] createPatternObj(String[] pattern){ return objArray; } - @DataProvider(name = "dfAllLocalesObj") Object[][] dfAllLocalesObj() { return dfAllLocalesObj; } - @DataProvider(name = "invalidPatternObj") Object[][] invalidPatternObj() { return invalidPatObj; } - @DataProvider(name = "validPatternObj") Object[][] validPatternObj() { return validPatObj; } //check Constructors for invalid pattern - @Test(dataProvider = "invalidPatternObj", - expectedExceptions = IllegalArgumentException.class) - public void testIllegalArgumentException1(String pattern, Locale loc) + @ParameterizedTest + @MethodSource("invalidPatternObj") + void testIllegalArgumentException1(String pattern, Locale loc) throws IllegalArgumentException { - Locale.setDefault(loc); - new SimpleDateFormat(pattern); + assertThrows(IllegalArgumentException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(pattern); + }); } - @Test(dataProvider = "invalidPatternObj", - expectedExceptions = IllegalArgumentException.class) - public void testIllegalArgumentException2(String pattern, Locale loc) + @ParameterizedTest + @MethodSource("invalidPatternObj") + void testIllegalArgumentException2(String pattern, Locale loc) throws IllegalArgumentException { - Locale.setDefault(loc); - new SimpleDateFormat(pattern, new DateFormatSymbols()); + assertThrows(IllegalArgumentException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(pattern, new DateFormatSymbols()); + }); } - @Test(dataProvider = "invalidPatternObj", - expectedExceptions = IllegalArgumentException.class) - public void testIllegalArgumentException3 (String pattern, Locale loc) + @ParameterizedTest + @MethodSource("invalidPatternObj") + void testIllegalArgumentException3 (String pattern, Locale loc) throws IllegalArgumentException { - Locale.setDefault(loc); - new SimpleDateFormat(pattern, Locale.getDefault()); + assertThrows(IllegalArgumentException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(pattern, Locale.getDefault()); + }); } - @Test(dataProvider = "invalidPatternObj", - expectedExceptions = IllegalArgumentException.class) - public void testIllegalArgumentException4(String pattern, Locale loc) + @ParameterizedTest + @MethodSource("invalidPatternObj") + void testIllegalArgumentException4(String pattern, Locale loc) throws IllegalArgumentException { - Locale.setDefault(loc); - new SimpleDateFormat().applyPattern(pattern); + assertThrows(IllegalArgumentException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat().applyPattern(pattern); + }); } //check Constructors for null pattern - @Test(dataProvider = "dfAllLocalesObj", - expectedExceptions = NullPointerException.class) - public void testNullPointerException1(Locale loc) + @ParameterizedTest + @MethodSource("dfAllLocalesObj") + void testNullPointerException1(Locale loc) throws NullPointerException { - Locale.setDefault(loc); - new SimpleDateFormat(null); + assertThrows(NullPointerException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(null); + }); } - @Test(dataProvider = "dfAllLocalesObj", - expectedExceptions = NullPointerException.class) - public void testNullPointerException2(Locale loc) + @ParameterizedTest + @MethodSource("dfAllLocalesObj") + void testNullPointerException2(Locale loc) throws NullPointerException { - Locale.setDefault(loc); - new SimpleDateFormat(null, new DateFormatSymbols()); + assertThrows(NullPointerException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(null, new DateFormatSymbols()); + }); } - @Test(dataProvider = "dfAllLocalesObj", - expectedExceptions = NullPointerException.class) - public void testNullPointerException3(Locale loc) + @ParameterizedTest + @MethodSource("dfAllLocalesObj") + void testNullPointerException3(Locale loc) throws NullPointerException { - Locale.setDefault(loc); - new SimpleDateFormat(null, Locale.getDefault()); + assertThrows(NullPointerException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat(null, Locale.getDefault()); + }); } - @Test(dataProvider = "dfAllLocalesObj", - expectedExceptions = NullPointerException.class) - public void testNullPointerException4(Locale loc) + @ParameterizedTest + @MethodSource("dfAllLocalesObj") + void testNullPointerException4(Locale loc) throws NullPointerException { - Locale.setDefault(loc); - new SimpleDateFormat().applyPattern(null); + assertThrows(NullPointerException.class, () -> { + Locale.setDefault(loc); + new SimpleDateFormat().applyPattern(null); + }); } - @Test(dataProvider = "validPatternObj") + @ParameterizedTest //check Constructors for valid pattern - public void testValidPattern(String pattern, Locale loc) { + @MethodSource("validPatternObj") + void testValidPattern(String pattern, Locale loc) { Locale.setDefault(loc); new SimpleDateFormat(pattern); new SimpleDateFormat(pattern, new DateFormatSymbols()); diff --git a/test/jdk/java/text/Format/DecimalFormat/SetGroupingSizeTest.java b/test/jdk/java/text/Format/DecimalFormat/SetGroupingSizeTest.java index 07982b453c90..950443412902 100644 --- a/test/jdk/java/text/Format/DecimalFormat/SetGroupingSizeTest.java +++ b/test/jdk/java/text/Format/DecimalFormat/SetGroupingSizeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,28 +26,27 @@ * @bug 8212749 * @summary test whether input value check for * DecimalFormat.setGroupingSize(int) works correctly. - * @run testng/othervm SetGroupingSizeTest + * @run junit/othervm SetGroupingSizeTest */ +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.text.DecimalFormat; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; -@Test public class SetGroupingSizeTest { - @DataProvider - public static Object[][] validGroupingSizes() { + static Object[][] validGroupingSizes() { return new Object[][] { { 0 }, { Byte.MAX_VALUE }, }; } - @DataProvider - public static Object[][] invalidGroupingSizes() { + static Object[][] invalidGroupingSizes() { return new Object[][] { { Byte.MIN_VALUE - 1 }, { Byte.MIN_VALUE }, @@ -58,17 +57,20 @@ public static Object[][] invalidGroupingSizes() { }; } - @Test(dataProvider = "validGroupingSizes") - public void test_validGroupingSize(int newVal) { + @ParameterizedTest + @MethodSource("validGroupingSizes") + void test_validGroupingSize(int newVal) { DecimalFormat df = new DecimalFormat(); df.setGroupingSize(newVal); - assertEquals(df.getGroupingSize(), newVal); + assertEquals(newVal, df.getGroupingSize()); } - @Test(dataProvider = "invalidGroupingSizes", - expectedExceptions = IllegalArgumentException.class) - public void test_invalidGroupingSize(int newVal) { - DecimalFormat df = new DecimalFormat(); - df.setGroupingSize(newVal); + @ParameterizedTest + @MethodSource("invalidGroupingSizes") + void test_invalidGroupingSize(int newVal) { + assertThrows(IllegalArgumentException.class, () -> { + DecimalFormat df = new DecimalFormat(); + df.setGroupingSize(newVal); + }); } } diff --git a/test/jdk/java/text/Format/NumberFormat/Bug4944439.java b/test/jdk/java/text/Format/NumberFormat/Bug4944439.java index 561052e9a95d..a13a36733e2f 100644 --- a/test/jdk/java/text/Format/NumberFormat/Bug4944439.java +++ b/test/jdk/java/text/Format/NumberFormat/Bug4944439.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,22 +23,19 @@ /* * @test - * @bug 4944439 + * @bug 4944439 8372609 * @summary Confirm that numbers where all digits after the decimal separator are 0 * and which are between Long.MIN_VALUE and Long.MAX_VALUE are returned * as Long(not double). * @run junit Bug4944439 */ -import java.text.DecimalFormat; +import java.text.NumberFormat; import java.util.ArrayList; import java.util.Locale; import java.util.stream.Stream; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -47,21 +44,7 @@ public class Bug4944439 { - // Save JVM default locale - private static final Locale savedLocale = Locale.getDefault(); - private static final DecimalFormat df = new DecimalFormat(); - - // Set JVM default locale to US for testing - @BeforeAll - static void initAll() { - Locale.setDefault(Locale.US); - } - - // Restore JVM default locale - @AfterAll - static void tearDownAll() { - Locale.setDefault(savedLocale); - } + private static final NumberFormat df = NumberFormat.getInstance(Locale.US); // Check return type and value returned by DecimalFormat.parse() for longs @ParameterizedTest diff --git a/test/jdk/java/text/Format/NumberFormat/DFSMinusPerCentMill.java b/test/jdk/java/text/Format/NumberFormat/DFSMinusPerCentMill.java index a36eaf5f14fe..418802261ff4 100644 --- a/test/jdk/java/text/Format/NumberFormat/DFSMinusPerCentMill.java +++ b/test/jdk/java/text/Format/NumberFormat/DFSMinusPerCentMill.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8220309 8230284 * @library /java/text/testlib @@ -29,17 +29,26 @@ * This test assumes CLDR has numbering systems for "arab" and * "arabext", and their minus/percent representations include * BiDi formatting control characters. - * @run testng/othervm DFSMinusPerCentMill + * @run junit/othervm DFSMinusPerCentMill */ -import java.io.*; -import java.util.*; -import java.text.*; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.util.Locale; -import static org.testng.Assert.*; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class DFSMinusPerCentMill { private enum Type { NUMBER, PERCENT, CURRENCY, INTEGER, COMPACT, PERMILL @@ -49,7 +58,6 @@ private enum Type { private static final Locale US_ARABEXT = Locale.forLanguageTag("en-US-u-nu-arabext"); private static final double SRC_NUM = -1234.56; - @DataProvider Object[][] formatData() { return new Object[][] { // Locale, FormatStyle, expected format, expected single char symbol @@ -69,7 +77,6 @@ Object[][] formatData() { }; } - @DataProvider Object[][] charSymbols() { return new Object[][]{ // Locale, percent, per mille, minus sign @@ -78,8 +85,9 @@ Object[][] charSymbols() { }; } - @Test(dataProvider="formatData") - public void testFormatData(Locale l, Type style, String expected) { + @ParameterizedTest + @MethodSource("formatData") + void testFormatData(Locale l, Type style, String expected) { NumberFormat nf = null; switch (style) { case NUMBER: @@ -102,19 +110,20 @@ public void testFormatData(Locale l, Type style, String expected) { break; } - assertEquals(nf.format(SRC_NUM), expected); + assertEquals(expected, nf.format(SRC_NUM)); } - @Test(dataProvider="charSymbols") - public void testCharSymbols(Locale l, char percent, char permill, char minus) { + @ParameterizedTest + @MethodSource("charSymbols") + void testCharSymbols(Locale l, char percent, char permill, char minus) { DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(l); - assertEquals(dfs.getPercent(), percent); - assertEquals(dfs.getPerMill(), permill); - assertEquals(dfs.getMinusSign(), minus); + assertEquals(percent, dfs.getPercent()); + assertEquals(permill, dfs.getPerMill()); + assertEquals(minus, dfs.getMinusSign()); } @Test - public void testSerialization() throws Exception { + void testSerialization() throws Exception { DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); new ObjectOutputStream(bos).writeObject(dfs); @@ -122,7 +131,7 @@ public void testSerialization() throws Exception { new ByteArrayInputStream(bos.toByteArray()) ).readObject(); - assertEquals(dfs, dfsSerialized); + assertEquals(dfsSerialized, dfs); // set minus/percent/permille dfs.setMinusSign('a'); @@ -134,6 +143,6 @@ public void testSerialization() throws Exception { new ByteArrayInputStream(bos.toByteArray()) ).readObject(); - assertEquals(dfs, dfsSerialized); + assertEquals(dfsSerialized, dfs); } } diff --git a/test/jdk/java/text/Normalizer/SquareEraCharacterTest.java b/test/jdk/java/text/Normalizer/SquareEraCharacterTest.java index 7367badd811e..9b669880fe9b 100644 --- a/test/jdk/java/text/Normalizer/SquareEraCharacterTest.java +++ b/test/jdk/java/text/Normalizer/SquareEraCharacterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,20 +25,20 @@ * @test * @bug 8221431 * @summary Tests decomposition of Japanese square era characters. - * @run testng/othervm SquareEraCharacterTest + * @run junit/othervm SquareEraCharacterTest */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.Normalizer; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SquareEraCharacterTest { - @DataProvider Object[][] squareEras() { return new Object[][] { @@ -51,12 +51,10 @@ Object[][] squareEras() { }; } - @Test(dataProvider="squareEras") - public void test_normalize(char squareChar, String expected) { - - assertEquals( - Normalizer.normalize(Character.toString(squareChar), Normalizer.Form.NFKD), - expected, + @ParameterizedTest + @MethodSource("squareEras") + void test_normalize(char squareChar, String expected) { + assertEquals(expected, Normalizer.normalize(Character.toString(squareChar), Normalizer.Form.NFKD), "decomposing " + Character.getName(squareChar) + "."); } } diff --git a/test/jdk/java/util/Calendar/CalendarDisplayNamesTest.java b/test/jdk/java/util/Calendar/CalendarDisplayNamesTest.java index d5293a296bb1..61a32c67bb23 100644 --- a/test/jdk/java/util/Calendar/CalendarDisplayNamesTest.java +++ b/test/jdk/java/util/Calendar/CalendarDisplayNamesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,21 +21,21 @@ * questions. */ -import org.testng.Assert; -import org.testng.annotations.Test; import java.util.Calendar; import java.util.Locale; import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; /** * @test * @bug 8262108 * @summary Verify the results returned by Calendar.getDisplayNames() API * @comment Locale providers: COMPAT,SPI - * @run testng/othervm -Djava.locale.providers=COMPAT,SPI CalendarDisplayNamesTest + * @run junit/othervm -Djava.locale.providers=COMPAT,SPI CalendarDisplayNamesTest * @comment Locale providers: CLDR - * @run testng/othervm -Djava.locale.providers=CLDR CalendarDisplayNamesTest + * @run junit/othervm -Djava.locale.providers=CLDR CalendarDisplayNamesTest */ public class CalendarDisplayNamesTest { @@ -55,7 +55,7 @@ public void testAM_PMDisplayNameValues() { continue; } for (final Integer fieldValue : names.values()) { - Assert.assertTrue(fieldValue == Calendar.AM || fieldValue == Calendar.PM, + Assertions.assertTrue(fieldValue == Calendar.AM || fieldValue == Calendar.PM, "Invalid field value " + fieldValue + " for calendar field AM_PM, in locale " + locale + " with style " + style); } diff --git a/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java b/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java index 6a909a23a18a..ca726afc29b7 100644 --- a/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java +++ b/test/jdk/java/util/Calendar/JapaneseLenientEraTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8206120 * @summary Test whether lenient era is accepted in JapaneseImperialCalendar - * @run testng/othervm JapaneseLenientEraTest + * @run junit/othervm JapaneseLenientEraTest */ import java.text.DateFormat; @@ -34,15 +34,15 @@ import java.util.Date; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class JapaneseLenientEraTest { - @DataProvider(name="lenientEra") - Object[][] names() { + Object[][] lenientEra() { return new Object[][] { // lenient era/year, strict era/year { "Meiji 123", "Heisei 2" }, @@ -51,7 +51,8 @@ Object[][] names() { }; } - @Test(dataProvider="lenientEra") + @ParameterizedTest + @MethodSource("lenientEra") public void testLenientEra(String lenient, String strict) throws Exception { Calendar c = new Calendar.Builder() .setCalendarType("japanese") @@ -61,6 +62,6 @@ public void testLenientEra(String lenient, String strict) throws Exception { Date lenDate = df.parse(lenient + "-01-01"); df.setLenient(false); Date strDate = df.parse(strict + "-01-01"); - assertEquals(lenDate, strDate); + assertEquals(strDate, lenDate); } } diff --git a/test/jdk/java/util/Calendar/SupplementalJapaneseEraTestRun.java b/test/jdk/java/util/Calendar/SupplementalJapaneseEraTestRun.java index 5383d0d12405..e8c0863157a5 100644 --- a/test/jdk/java/util/Calendar/SupplementalJapaneseEraTestRun.java +++ b/test/jdk/java/util/Calendar/SupplementalJapaneseEraTestRun.java @@ -27,7 +27,7 @@ * @summary Test for jdk.calendar.japanese.supplemental.era support * @library /test/lib * @build SupplementalJapaneseEraTest - * @run testng/othervm SupplementalJapaneseEraTestRun + * @run junit/othervm SupplementalJapaneseEraTestRun */ import java.util.Calendar; @@ -45,11 +45,12 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.Utils; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SupplementalJapaneseEraTestRun { - @DataProvider(name = "validprop") Object[][] validPropertyData() { return new Object[][] { //Tests with valid property values @@ -58,7 +59,6 @@ Object[][] validPropertyData() { }; } - @DataProvider(name = "invalidprop") Object[][] invalidPropertyData() { return new Object[][] { //Tests with invalid property values @@ -76,7 +76,8 @@ Object[][] invalidPropertyData() { }; } - @Test(dataProvider = "validprop") + @ParameterizedTest + @MethodSource("validPropertyData") public void ValidPropertyValuesTest(String prop) throws Throwable { //get the start time of the fictional next era @@ -84,7 +85,8 @@ public void ValidPropertyValuesTest(String prop) testRun(prop + startTime, List.of("-t")); } - @Test(dataProvider = "invalidprop") + @ParameterizedTest + @MethodSource("invalidPropertyData") public void InvalidPropertyValuesTest(String prop) throws Throwable { //get the start time of the fictional next era diff --git a/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java b/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java index 12f5a96d3fb5..07cc7a412b6a 100644 --- a/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java +++ b/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java @@ -25,9 +25,9 @@ * @test * @bug 8025703 8040211 8191404 8203872 8222980 8225435 8241082 8242010 8247432 * 8258795 8267038 8287180 8302512 8304761 8306031 8308021 8313702 8318322 - * 8327631 8332424 8334418 8344589 8348328 + * 8327631 8332424 8334418 8344589 8348328 8362428 * @summary Checks the IANA language subtag registry data update - * (LSR Revision: 2025-05-15) with Locale and Locale.LanguageRange + * (LSR Revision: 2025-08-25) with Locale and Locale.LanguageRange * class methods. * @run main LanguageSubtagRegistryTest */ diff --git a/test/jdk/java/util/Locale/LocaleMatchingTest.java b/test/jdk/java/util/Locale/LocaleMatchingTest.java index 975e4567e18b..4509968b4e48 100644 --- a/test/jdk/java/util/Locale/LocaleMatchingTest.java +++ b/test/jdk/java/util/Locale/LocaleMatchingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,13 @@ * @test * @bug 7069824 8042360 8032842 8175539 8210443 8242010 8276302 * @summary Verify implementation for Locale matching. - * @run testng/othervm LocaleMatchingTest + * @run junit/othervm LocaleMatchingTest */ +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -40,15 +44,14 @@ import static java.util.Locale.FilteringMode.*; import static java.util.Locale.LanguageRange.*; -import static org.testng.Assert.*; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; public class LocaleMatchingTest { - @DataProvider(name = "LRConstructorData") - Object[][] LRConstructorData() { + static Object[][] LRConstructorData() { return new Object[][] { // Range, Weight {"elvish", MAX_WEIGHT}, @@ -62,8 +65,7 @@ Object[][] LRConstructorData() { }; } - @DataProvider(name = "LRConstructorNPEData") - Object[][] LRConstructorNPEData() { + static Object[][] LRConstructorNPEData() { return new Object[][] { // Range, Weight {null, MAX_WEIGHT}, @@ -71,8 +73,7 @@ Object[][] LRConstructorNPEData() { }; } - @DataProvider(name = "LRConstructorIAEData") - Object[][] LRConstructorIAEData() { + static Object[][] LRConstructorIAEData() { return new Object[][] { // Range, Weight {"ja", -0.8}, @@ -93,8 +94,7 @@ Object[][] LRConstructorIAEData() { }; } - @DataProvider(name = "LRParseData") - Object[][] LRParseData() { + static Object[][] LRParseData() { return new Object[][] { // Ranges, Expected result {"Accept-Language: fr-FX, de-DE;q=0.5, fr-tp-x-FOO;q=0.1, " @@ -139,8 +139,7 @@ Object[][] LRParseData() { }; } - @DataProvider(name = "LRParseIAEData") - Object[][] LRParseIAEData() { + static Object[][] LRParseIAEData() { return new Object[][] { // Ranges {""}, @@ -148,8 +147,7 @@ Object[][] LRParseIAEData() { }; } - @DataProvider(name = "LRMapEquivalentsData") - Object[][] LRMapEquivalentsData() { + static Object[][] LRMapEquivalentsData() { return new Object[][] { // Ranges, Map, Expected result {LanguageRange.parse("zh, zh-TW;q=0.8, ar;q=0.9, EN, zh-HK, ja-JP;q=0.2, es;q=0.4"), @@ -181,8 +179,7 @@ Object[][] LRMapEquivalentsData() { }; } - @DataProvider(name = "LFilterData") - Object[][] LFilterData() { + static Object[][] LFilterData() { return new Object[][] { // Range, LanguageTags, FilteringMode, Expected locales {"ja-JP, fr-FR", "de-DE, en, ja-JP-hepburn, fr, he, ja-Latn-JP", @@ -203,8 +200,7 @@ Object[][] LFilterData() { }; } - @DataProvider(name = "LFilterNPEData") - Object[][] LFilterNPEData() { + static Object[][] LFilterNPEData() { return new Object[][] { // Range, LanguageTags, FilteringMode {"en;q=0.2, ja-*-JP, fr-JP", null, REJECT_EXTENDED_RANGES}, @@ -212,8 +208,7 @@ Object[][] LFilterNPEData() { }; } - @DataProvider(name = "LFilterTagsData") - Object[][] LFilterTagsData() { + static Object[][] LFilterTagsData() { return new Object[][] { // Range, LanguageTags, FilteringMode, Expected language tags {"fr-FR, fr-BG;q=0.8, *;q=0.5, en;q=0", "en-US, fr-FR, fr-CA, fr-BG", @@ -274,8 +269,7 @@ Object[][] LFilterTagsData() { }; } - @DataProvider(name = "LLookupData") - Object[][] LLookupData() { + static Object[][] LLookupData() { return new Object[][] { // Range, LanguageTags, Expected locale {"en;q=0.2, *-JP;q=0.6, iw", "de-DE, en, ja-JP-hepburn, fr-JP, he", "he"}, @@ -284,8 +278,7 @@ Object[][] LLookupData() { }; } - @DataProvider(name = "LLookupTagData") - Object[][] LLookupTagData() { + static Object[][] LLookupTagData() { return new Object[][] { // Range, LanguageTags, Expected language tag {"en, *", "es, de, ja-JP", null}, @@ -298,117 +291,135 @@ Object[][] LLookupTagData() { } @Test - public void testLRConstants() { - assertEquals(MIN_WEIGHT, 0.0, " MIN_WEIGHT should be 0.0 but got " + void testLRConstants() { + assertEquals(0.0, MIN_WEIGHT, " MIN_WEIGHT should be 0.0 but got " + MIN_WEIGHT); - assertEquals(MAX_WEIGHT, 1.0, " MAX_WEIGHT should be 1.0 but got " + assertEquals(1.0, MAX_WEIGHT, " MAX_WEIGHT should be 1.0 but got " + MAX_WEIGHT); } - @Test(dataProvider = "LRConstructorData") - public void testLRConstructors(String range, double weight) { + @MethodSource("LRConstructorData") + @ParameterizedTest + void testLRConstructors(String range, double weight) { LanguageRange lr; if (weight == MAX_WEIGHT) { lr = new LanguageRange(range); } else { lr = new LanguageRange(range, weight); } - assertEquals(lr.getRange(), range.toLowerCase(Locale.ROOT), + assertEquals(range.toLowerCase(Locale.ROOT), lr.getRange(), " LR.getRange() returned unexpected value. Expected: " + range.toLowerCase(Locale.ROOT) + ", got: " + lr.getRange()); - assertEquals(lr.getWeight(), weight, + assertEquals(weight, lr.getWeight(), " LR.getWeight() returned unexpected value. Expected: " + weight + ", got: " + lr.getWeight()); } - @Test(dataProvider = "LRConstructorNPEData", expectedExceptions = NullPointerException.class) - public void testLRConstructorNPE(String range, double weight) { + @MethodSource("LRConstructorNPEData") + @ParameterizedTest + void testLRConstructorNPE(String range, double weight) { if (weight == MAX_WEIGHT) { - new LanguageRange(range); + assertThrows(NullPointerException.class, () -> new LanguageRange(range)); } else { - new LanguageRange(range, weight); + assertThrows(NullPointerException.class, () -> new LanguageRange(range, weight)); } } - @Test(dataProvider = "LRConstructorIAEData", expectedExceptions = IllegalArgumentException.class) - public void testLRConstructorIAE(String range, double weight) { + @MethodSource("LRConstructorIAEData") + @ParameterizedTest + void testLRConstructorIAE(String range, double weight) { if (weight == MAX_WEIGHT) { - new LanguageRange(range); + assertThrows(IllegalArgumentException.class, () -> new LanguageRange(range)); } else { - new LanguageRange(range, weight); + assertThrows(IllegalArgumentException.class, () -> new LanguageRange(range, weight)); } } @Test - public void testLREquals() { + void testLREquals() { LanguageRange lr1 = new LanguageRange("ja", 1.0); LanguageRange lr2 = new LanguageRange("ja"); LanguageRange lr3 = new LanguageRange("ja", 0.1); LanguageRange lr4 = new LanguageRange("en", 1.0); - assertEquals(lr1, lr2, " LR(ja, 1.0).equals(LR(ja)) should return true."); - assertNotEquals(lr1, lr3, " LR(ja, 1.0).equals(LR(ja, 0.1)) should return false."); - assertNotEquals(lr1, lr4, " LR(ja, 1.0).equals(LR(en, 1.0)) should return false."); + assertEquals(lr2, lr1, " LR(ja, 1.0).equals(LR(ja)) should return true."); + assertNotEquals(lr3, lr1, " LR(ja, 1.0).equals(LR(ja, 0.1)) should return false."); + assertNotEquals(lr4, lr1, " LR(ja, 1.0).equals(LR(en, 1.0)) should return false."); assertNotNull(lr1, " LR(ja, 1.0).equals(null) should return false."); - assertNotEquals(lr1, "", " LR(ja, 1.0).equals(\"\") should return false."); + assertNotEquals("", lr1, " LR(ja, 1.0).equals(\"\") should return false."); } - @Test(dataProvider = "LRParseData") - public void testLRParse(String ranges, List expected) { - assertEquals(LanguageRange.parse(ranges), expected, + @MethodSource("LRParseData") + @ParameterizedTest + void testLRParse(String ranges, List expected) { + assertEquals(expected, LanguageRange.parse(ranges), " LR.parse(" + ranges + ") test failed."); } - @Test(expectedExceptions = NullPointerException.class) - public void testLRParseNPE() { - LanguageRange.parse(null); + @Test + void testLRParseNPE() { + assertThrows(NullPointerException.class, () -> LanguageRange.parse(null)); } - @Test(dataProvider = "LRParseIAEData", expectedExceptions = IllegalArgumentException.class) - public void testLRParseIAE(String ranges) { - LanguageRange.parse(ranges); + @MethodSource("LRParseIAEData") + @ParameterizedTest + void testLRParseIAE(String ranges) { + assertThrows(IllegalArgumentException.class, () -> LanguageRange.parse(ranges)); } - @Test(dataProvider = "LRMapEquivalentsData") - public void testLRMapEquivalents(List priorityList, + @MethodSource("LRMapEquivalentsData") + @ParameterizedTest + void testLRMapEquivalents(List priorityList, Map> map, List expected) { - assertEquals(LanguageRange.mapEquivalents(priorityList, map), expected, + assertEquals(expected, LanguageRange.mapEquivalents(priorityList, map), " LR.mapEquivalents() test failed."); } - @Test(expectedExceptions = NullPointerException.class) - public void testLRMapEquivalentsNPE() { - LanguageRange.mapEquivalents(null, Map.of("ja", List.of("ja", "ja-Hira"))); + @Test + void testLRMapEquivalentsNPE() { + assertThrows(NullPointerException.class, + () -> LanguageRange.mapEquivalents(null, Map.of("ja", List.of("ja", "ja-Hira")))); } - @Test(dataProvider = "LFilterData") - public void testLFilter(String ranges, String tags, FilteringMode mode, String expectedLocales) { + @MethodSource("LFilterData") + @ParameterizedTest + void testLFilter(String ranges, String tags, FilteringMode mode, String expectedLocales) { List priorityList = LanguageRange.parse(ranges); List tagList = generateLocales(tags); String actualLocales = showLocales(Locale.filter(priorityList, tagList, mode)); - assertEquals(actualLocales, expectedLocales, showErrorMessage(" L.Filter(" + mode + ")", + assertEquals(expectedLocales, actualLocales, showErrorMessage(" L.Filter(" + mode + ")", ranges, tags, expectedLocales, actualLocales)); } - @Test(dataProvider = "LFilterNPEData", expectedExceptions = NullPointerException.class) - public void testLFilterNPE(String ranges, String tags, FilteringMode mode) { - List priorityList = LanguageRange.parse(ranges); - List tagList = generateLocales(tags); - showLocales(Locale.filter(priorityList, tagList, mode)); + @MethodSource("LFilterNPEData") + @ParameterizedTest + void testLFilterNPE(String ranges, String tags, FilteringMode mode) { + if (ranges == null) { + // Ranges are null + assertThrows(NullPointerException.class, () -> LanguageRange.parse(ranges)); + } else { + // Tags are null + List priorityList = LanguageRange.parse(ranges); + List tagList = generateLocales(tags); + assertThrows(NullPointerException.class, + () -> showLocales(Locale.filter(priorityList, tagList, mode))); + } } - @Test(expectedExceptions = IllegalArgumentException.class) - public void testLFilterIAE() { + @Test + void testLFilterIAE() { String ranges = "en;q=0.2, ja-*-JP, fr-JP"; String tags = "de-DE, en, ja-JP-hepburn, fr, he, ja-Latn-JP"; List priorityList = LanguageRange.parse(ranges); List tagList = generateLocales(tags); - showLocales(Locale.filter(priorityList, tagList, REJECT_EXTENDED_RANGES)); + assertThrows(IllegalArgumentException.class, + () -> showLocales(Locale.filter(priorityList, tagList, REJECT_EXTENDED_RANGES))); } - @Test(dataProvider = "LFilterTagsData") - public void testLFilterTags(String ranges, String tags, FilteringMode mode, String expectedTags) { + @MethodSource("LFilterTagsData") + @ParameterizedTest + void testLFilterTags(String ranges, String tags, FilteringMode mode, String expectedTags) { List priorityList = LanguageRange.parse(ranges); List tagList = generateLanguageTags(tags); String actualTags; @@ -417,36 +428,39 @@ public void testLFilterTags(String ranges, String tags, FilteringMode mode, Stri } else { actualTags = showLanguageTags(Locale.filterTags(priorityList, tagList, mode)); } - assertEquals(actualTags, expectedTags, + assertEquals(expectedTags, actualTags, showErrorMessage(" L.FilterTags(" + (mode != null ? mode : "") + ")", ranges, tags, expectedTags, actualTags)); } - @Test(expectedExceptions = IllegalArgumentException.class) - public void testLFilterTagsIAE() { + @Test + void testLFilterTagsIAE() { String ranges = "de-*-DE"; String tags = "de-DE, de-de, de-Latn-DE, de-Latf-DE, de-DE-x-goethe, " + "de-Latn-DE-1996, de-Deva-DE, de, de-x-DE, de-Deva"; List priorityList = LanguageRange.parse(ranges); - showLanguageTags(Locale.filterTags(priorityList, generateLanguageTags(tags), REJECT_EXTENDED_RANGES)); + assertThrows(IllegalArgumentException.class, + () -> showLanguageTags(Locale.filterTags(priorityList, generateLanguageTags(tags), REJECT_EXTENDED_RANGES))); } - @Test(dataProvider = "LLookupData") - public void testLLookup(String ranges, String tags, String expectedLocale) { + @MethodSource("LLookupData") + @ParameterizedTest + void testLLookup(String ranges, String tags, String expectedLocale) { List priorityList = LanguageRange.parse(ranges); List localeList = generateLocales(tags); String actualLocale = Locale.lookup(priorityList, localeList).toLanguageTag(); - assertEquals(actualLocale, expectedLocale, showErrorMessage(" L.Lookup()", + assertEquals(expectedLocale, actualLocale, showErrorMessage(" L.Lookup()", ranges, tags, expectedLocale, actualLocale)); } - @Test(dataProvider = "LLookupTagData") - public void testLLookupTag(String ranges, String tags, String expectedTag) { + @MethodSource("LLookupTagData") + @ParameterizedTest + void testLLookupTag(String ranges, String tags, String expectedTag) { List priorityList = LanguageRange.parse(ranges); List tagList = generateLanguageTags(tags); String actualTag = Locale.lookupTag(priorityList, tagList); - assertEquals(actualTag, expectedTag, showErrorMessage(" L.LookupTag()", + assertEquals(expectedTag, actualTag, showErrorMessage(" L.LookupTag()", ranges, tags, expectedTag, actualTag)); } diff --git a/test/jdk/java/util/Locale/RequiredAvailableLocalesTest.java b/test/jdk/java/util/Locale/RequiredAvailableLocalesTest.java index 2fcba9b9366b..7d229913a844 100644 --- a/test/jdk/java/util/Locale/RequiredAvailableLocalesTest.java +++ b/test/jdk/java/util/Locale/RequiredAvailableLocalesTest.java @@ -20,34 +20,42 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -/** + +/* * @test * @bug 8276186 * @summary Checks whether getAvailableLocales() returns at least Locale.ROOT and * Locale.US instances. - * @run testng/othervm -Djava.locale.providers=COMPAT RequiredAvailableLocalesTest - * @run testng/othervm -Djava.locale.providers=CLDR RequiredAvailableLocalesTest + * @run junit/othervm -Djava.locale.providers=COMPAT RequiredAvailableLocalesTest + * @run junit/othervm -Djava.locale.providers=CLDR RequiredAvailableLocalesTest */ import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import java.text.*; +import java.text.BreakIterator; +import java.text.Collator; +import java.text.DateFormat; +import java.text.DateFormatSymbols; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; import java.time.format.DecimalStyle; -import java.util.*; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Locale; +import java.util.Set; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; -@Test public class RequiredAvailableLocalesTest { private static final Set REQUIRED_LOCALES = Set.of(Locale.ROOT, Locale.US); private static final MethodType ARRAY_RETURN_TYPE = MethodType.methodType(Locale.class.arrayType()); private static final MethodType SET_RETURN_TYPE = MethodType.methodType(Set.class); - @DataProvider - public Object[][] availableLocalesClasses() { + static Object[][] availableLocalesClasses() { return new Object[][] { {BreakIterator.class, ARRAY_RETURN_TYPE}, {Calendar.class, ARRAY_RETURN_TYPE}, @@ -61,8 +69,9 @@ public Object[][] availableLocalesClasses() { }; } - @Test (dataProvider = "availableLocalesClasses") - public void checkRequiredLocales(Class c, MethodType mt) throws Throwable { + @MethodSource("availableLocalesClasses") + @ParameterizedTest + void checkRequiredLocales(Class c, MethodType mt) throws Throwable { var ret = MethodHandles.lookup().findStatic(c, "getAvailableLocales", mt).invoke(); if (ret instanceof Locale[] a) { diff --git a/test/jdk/java/util/Locale/TestOf.java b/test/jdk/java/util/Locale/TestOf.java index c923da832bf0..3e0e5e742075 100644 --- a/test/jdk/java/util/Locale/TestOf.java +++ b/test/jdk/java/util/Locale/TestOf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,29 +20,30 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -/** + +/* * @test * @bug 8282819 * @summary Unit tests for Locale.of() method. Those tests check the equality * of obtained objects with ones that are gotten from other means with both * well-formed and ill-formed arguments. Also checks the possible NPEs * for error cases. - * @run testng TestOf + * @run junit TestOf */ -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertThrows; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.util.Locale; -import org.testng.annotations.Test; -import org.testng.annotations.DataProvider; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; @SuppressWarnings("deprecation") -@Test public class TestOf { - @DataProvider - public Object[][] data_1Arg() { + static Object[][] data_1Arg() { return new Object[][]{ // well-formed {Locale.ENGLISH, "en"}, @@ -55,8 +56,7 @@ public Object[][] data_1Arg() { }; } - @DataProvider - public Object[][] data_2Args() { + static Object[][] data_2Args() { return new Object[][]{ // well-formed {Locale.US, "en", "US"}, @@ -69,8 +69,7 @@ public Object[][] data_2Args() { }; } - @DataProvider - public Object[][] data_3Args() { + static Object[][] data_3Args() { return new Object[][]{ // well-formed {Locale.forLanguageTag("en-US-POSIX"), "en", "US", "POSIX"}, @@ -87,23 +86,26 @@ public Object[][] data_3Args() { }; } - @Test (dataProvider = "data_1Arg") - public void test_1Arg(Locale expected, String lang) { - assertEquals(Locale.of(lang), expected); + @MethodSource("data_1Arg") + @ParameterizedTest + void test_1Arg(Locale expected, String lang) { + assertEquals(expected, Locale.of(lang)); } - @Test (dataProvider = "data_2Args") - public void test_2Args(Locale expected, String lang, String ctry) { - assertEquals(Locale.of(lang, ctry), expected); + @MethodSource("data_2Args") + @ParameterizedTest + void test_2Args(Locale expected, String lang, String ctry) { + assertEquals(expected, Locale.of(lang, ctry)); } - @Test (dataProvider = "data_3Args") - public void test_3Args(Locale expected, String lang, String ctry, String vrnt) { - assertEquals(Locale.of(lang, ctry, vrnt), expected); + @MethodSource("data_3Args") + @ParameterizedTest + void test_3Args(Locale expected, String lang, String ctry, String vrnt) { + assertEquals(expected, Locale.of(lang, ctry, vrnt)); } @Test - public void test_NPE() { + void test_NPE() { assertThrows(NullPointerException.class, () -> Locale.of(null)); assertThrows(NullPointerException.class, () -> Locale.of("", null)); assertThrows(NullPointerException.class, () -> Locale.of("", "", null)); diff --git a/test/jdk/java/util/Locale/bcp47u/CalendarTests.java b/test/jdk/java/util/Locale/bcp47u/CalendarTests.java index 92cfc6581c5f..f04c4a4b1ff4 100644 --- a/test/jdk/java/util/Locale/bcp47u/CalendarTests.java +++ b/test/jdk/java/util/Locale/bcp47u/CalendarTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,25 +28,24 @@ * @summary Tests Calendar class deals with Unicode extensions * correctly. * @modules jdk.localedata - * @run testng/othervm CalendarTests + * @run junit/othervm CalendarTests */ -import static org.testng.Assert.assertEquals; - import java.text.DateFormat; import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test Calendar with BCP47 U extensions */ -@Test public class CalendarTests { private static TimeZone defaultTZ; @@ -64,19 +63,18 @@ public class CalendarTests { private static final Locale FW_FRI = Locale.forLanguageTag("en-US-u-fw-fri"); private static final Locale FW_SAT = Locale.forLanguageTag("en-US-u-fw-sat"); - @BeforeTest - public void beforeTest() { + @BeforeAll + static void beforeTest() { defaultTZ = TimeZone.getDefault(); TimeZone.setDefault(AMLA); } - @AfterTest - public void afterTest() { + @AfterAll + static void afterTest() { TimeZone.setDefault(defaultTZ); } - @DataProvider(name="tz") - Object[][] tz() { + static Object[][] tz() { return new Object[][] { // Locale, Expected Zone, {JPTYO, ASIATOKYO}, @@ -87,8 +85,7 @@ Object[][] tz() { }; } - @DataProvider(name="firstDayOfWeek") - Object[][] firstDayOfWeek () { + static Object[][] firstDayOfWeek () { return new Object[][] { // Locale, Expected DayOfWeek, {Locale.US, Calendar.SUNDAY}, @@ -114,8 +111,7 @@ Object[][] firstDayOfWeek () { }; } - @DataProvider(name="minDaysInFirstWeek") - Object[][] minDaysInFrstWeek () { + static Object[][] minDaysInFirstWeek () { return new Object[][] { // Locale, Expected minDay, {Locale.US, 1}, @@ -126,33 +122,36 @@ Object[][] minDaysInFrstWeek () { }; } - @Test(dataProvider="tz") - public void test_tz(Locale locale, TimeZone zoneExpected) { + @MethodSource("tz") + @ParameterizedTest + void test_tz(Locale locale, TimeZone zoneExpected) { DateFormat df = DateFormat.getTimeInstance(DateFormat.FULL, locale); - assertEquals(df.getTimeZone(), zoneExpected); + assertEquals(zoneExpected, df.getTimeZone()); Calendar c = Calendar.getInstance(locale); - assertEquals(c.getTimeZone(), zoneExpected); + assertEquals(zoneExpected, c.getTimeZone()); c = new Calendar.Builder().setLocale(locale).build(); - assertEquals(c.getTimeZone(), zoneExpected); + assertEquals(zoneExpected, c.getTimeZone()); } - @Test(dataProvider="firstDayOfWeek") - public void test_firstDayOfWeek(Locale locale, int dowExpected) { + @MethodSource("firstDayOfWeek") + @ParameterizedTest + void test_firstDayOfWeek(Locale locale, int dowExpected) { Calendar c = Calendar.getInstance(locale); - assertEquals(c.getFirstDayOfWeek(), dowExpected); + assertEquals(dowExpected, c.getFirstDayOfWeek()); c = new Calendar.Builder().setLocale(locale).build(); - assertEquals(c.getFirstDayOfWeek(), dowExpected); + assertEquals(dowExpected, c.getFirstDayOfWeek()); } - @Test(dataProvider="minDaysInFirstWeek") - public void test_minDaysInFirstWeek(Locale locale, int minDaysExpected) { + @MethodSource("minDaysInFirstWeek") + @ParameterizedTest + void test_minDaysInFirstWeek(Locale locale, int minDaysExpected) { Calendar c = Calendar.getInstance(locale); - assertEquals(c.getMinimalDaysInFirstWeek(), minDaysExpected); + assertEquals(minDaysExpected, c.getMinimalDaysInFirstWeek()); c = new Calendar.Builder().setLocale(locale).build(); - assertEquals(c.getMinimalDaysInFirstWeek(), minDaysExpected); + assertEquals(minDaysExpected, c.getMinimalDaysInFirstWeek()); } } diff --git a/test/jdk/java/util/Locale/bcp47u/CurrencyFormatTests.java b/test/jdk/java/util/Locale/bcp47u/CurrencyFormatTests.java index d3e14fb0d5a6..1ca251b6add5 100644 --- a/test/jdk/java/util/Locale/bcp47u/CurrencyFormatTests.java +++ b/test/jdk/java/util/Locale/bcp47u/CurrencyFormatTests.java @@ -27,26 +27,24 @@ * @bug 8215181 8230284 8231273 8284840 * @summary Tests the "u-cf" extension * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=CLDR CurrencyFormatTests + * @run junit/othervm -Djava.locale.providers=CLDR CurrencyFormatTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.NumberFormat; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test NumberFormat with BCP47 u-cf extensions. Note that this test depends * on the particular CLDR release. Results may vary on other CLDR releases. */ -@Test public class CurrencyFormatTests { - @DataProvider(name="getInstanceData") - Object[][] getInstanceData() { + static Object[][] getInstanceData() { return new Object[][] { // Locale, amount, expected // US dollar @@ -97,8 +95,9 @@ Object[][] getInstanceData() { }; } - @Test(dataProvider="getInstanceData") - public void test_getInstance(Locale locale, int amount, String expected) { - assertEquals(NumberFormat.getCurrencyInstance(locale).format(amount), expected); + @MethodSource("getInstanceData") + @ParameterizedTest + void test_getInstance(Locale locale, int amount, String expected) { + assertEquals(expected, NumberFormat.getCurrencyInstance(locale).format(amount)); } } diff --git a/test/jdk/java/util/Locale/bcp47u/CurrencyTests.java b/test/jdk/java/util/Locale/bcp47u/CurrencyTests.java index d807a0e4da3c..a89aed4b0c55 100644 --- a/test/jdk/java/util/Locale/bcp47u/CurrencyTests.java +++ b/test/jdk/java/util/Locale/bcp47u/CurrencyTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,28 +28,26 @@ * @summary Tests Currency class instantiates correctly with Unicode * extensions * @modules jdk.localedata - * @run testng/othervm CurrencyTests + * @run junit/othervm CurrencyTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.util.Currency; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test Currency with BCP47 U extensions */ -@Test public class CurrencyTests { private static final Currency USD = Currency.getInstance("USD"); private static final Currency CAD = Currency.getInstance("CAD"); private static final Currency JPY = Currency.getInstance("JPY"); - @DataProvider(name="getInstanceData") - Object[][] getInstanceData() { + static Object[][] getInstanceData() { return new Object[][] { // Locale, Expected Currency // "cu" @@ -76,8 +74,7 @@ Object[][] getInstanceData() { }; } - @DataProvider(name="getSymbolData") - Object[][] getSymbolData() { + static Object[][] getSymbolData() { return new Object[][] { // Currency, DisplayLocale, expected Symbol {USD, Locale.forLanguageTag("en-US-u-rg-jpzzzz"), "$"}, @@ -94,13 +91,15 @@ Object[][] getSymbolData() { }; } - @Test(dataProvider="getInstanceData") - public void test_getInstance(Locale locale, Currency currencyExpected) { - assertEquals(Currency.getInstance(locale), currencyExpected); + @MethodSource("getInstanceData") + @ParameterizedTest + void test_getInstance(Locale locale, Currency currencyExpected) { + assertEquals(currencyExpected, Currency.getInstance(locale)); } - @Test(dataProvider="getSymbolData") - public void test_getSymbol(Currency c, Locale locale, String expected) { - assertEquals(c.getSymbol(locale), expected); + @MethodSource("getSymbolData") + @ParameterizedTest + void test_getSymbol(Currency c, Locale locale, String expected) { + assertEquals(expected, c.getSymbol(locale)); } } diff --git a/test/jdk/java/util/Locale/bcp47u/DisplayNameTests.java b/test/jdk/java/util/Locale/bcp47u/DisplayNameTests.java index 11c4272f1609..bf35fe152a77 100644 --- a/test/jdk/java/util/Locale/bcp47u/DisplayNameTests.java +++ b/test/jdk/java/util/Locale/bcp47u/DisplayNameTests.java @@ -27,21 +27,20 @@ * @bug 8176841 8202537 * @summary Tests the display names for BCP 47 U extensions * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=CLDR DisplayNameTests + * @run junit/othervm -Djava.locale.providers=CLDR DisplayNameTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test Locale.getDisplayName() with BCP47 U extensions. Note that the * result may change depending on the CLDR releases. */ -@Test public class DisplayNameTests { private static final Locale loc1 = Locale.forLanguageTag("en-Latn-US-u" + "-ca-japanese" + @@ -75,8 +74,7 @@ public class DisplayNameTests { .build(); private static final Locale loc6 = Locale.forLanguageTag( "zh-CN-u-ca-dddd-nu-ddd-cu-ddd-fw-moq-tz-unknown-rg-twzz"); - @DataProvider(name="locales") - Object[][] tz() { + static Object[][] locales() { return new Object[][] { // Locale for display, Test Locale, Expected output, {Locale.US, loc1, @@ -101,9 +99,10 @@ Object[][] tz() { }; } - @Test(dataProvider="locales") - public void test_locales(Locale inLocale, Locale testLocale, String expected) { + @MethodSource("locales") + @ParameterizedTest + void test_locales(Locale inLocale, Locale testLocale, String expected) { String result = testLocale.getDisplayName(inLocale); - assertEquals(result, expected); + assertEquals(expected, result); } } diff --git a/test/jdk/java/util/Locale/bcp47u/FormatTests.java b/test/jdk/java/util/Locale/bcp47u/FormatTests.java index c23c1cb81807..977010ee27f5 100644 --- a/test/jdk/java/util/Locale/bcp47u/FormatTests.java +++ b/test/jdk/java/util/Locale/bcp47u/FormatTests.java @@ -28,10 +28,13 @@ * @summary Tests *Format class deals with Unicode extensions * correctly. * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=CLDR FormatTests + * @run junit/othervm -Djava.locale.providers=CLDR FormatTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.DateFormat; import java.text.NumberFormat; @@ -40,15 +43,11 @@ import java.util.Locale; import java.util.TimeZone; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test *Format classes with BCP47 U extensions */ -@Test public class FormatTests { private static TimeZone defaultTZ; @@ -80,19 +79,18 @@ public class FormatTests { .build() .getTime(); - @BeforeTest - public void beforeTest() { + @BeforeAll + static void beforeTest() { defaultTZ = TimeZone.getDefault(); TimeZone.setDefault(AMLA); } - @AfterTest - public void afterTest() { + @AfterAll + static void afterTest() { TimeZone.setDefault(defaultTZ); } - @DataProvider(name="dateFormatData") - Object[][] dateFormatData() { + static Object[][] dateFormatData() { return new Object[][] { // Locale, Expected calendar, Expected timezone, Expected formatted string @@ -116,8 +114,7 @@ Object[][] dateFormatData() { }; } - @DataProvider(name="numberFormatData") - Object[][] numberFormatData() { + static Object[][] numberFormatData() { return new Object[][] { // Locale, number, expected format @@ -136,33 +133,35 @@ Object[][] numberFormatData() { }; } - @Test(dataProvider="dateFormatData") - public void test_DateFormat(Locale locale, String calClass, TimeZone tz, + @MethodSource("dateFormatData") + @ParameterizedTest + void test_DateFormat(Locale locale, String calClass, TimeZone tz, String formatExpected) throws Exception { DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale); if (calClass != null) { try { Class expected = Class.forName(calClass); - assertEquals(df.getCalendar().getClass(), expected); + assertEquals(expected, df.getCalendar().getClass()); } catch (Exception e) { throw e; } } if (tz != null) { - assertEquals(df.getTimeZone(), tz); + assertEquals(tz, df.getTimeZone()); } String formatted = df.format(testDate); - assertEquals(formatted, formatExpected); - assertEquals(df.parse(formatted), testDate); + assertEquals(formatExpected, formatted); + assertEquals(testDate, df.parse(formatted)); } - @Test(dataProvider="numberFormatData") - public void test_NumberFormat(Locale locale, double num, + @MethodSource("numberFormatData") + @ParameterizedTest + void test_NumberFormat(Locale locale, double num, String formatExpected) throws Exception { NumberFormat nf = NumberFormat.getNumberInstance(locale); nf.setMaximumFractionDigits(4); String formatted = nf.format(num); - assertEquals(nf.format(num), formatExpected); - assertEquals(nf.parse(formatted), num); + assertEquals(formatExpected, nf.format(num)); + assertEquals(num, nf.parse(formatted)); } } diff --git a/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java b/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java index 2a8e8bf8e1eb..9baf61b24040 100644 --- a/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java +++ b/test/jdk/java/util/Locale/bcp47u/SymbolsTests.java @@ -28,30 +28,28 @@ * @summary Tests *FormatSymbols class deals with Unicode extensions * correctly. * @modules jdk.localedata - * @run testng/othervm -Djava.locale.providers=CLDR SymbolsTests + * @run junit/othervm -Djava.locale.providers=CLDR SymbolsTests */ -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import java.text.DateFormatSymbols; import java.text.DecimalFormatSymbols; import java.util.Locale; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test *FormatSymbols classes with BCP47 U extensions */ -@Test public class SymbolsTests { private static final Locale RG_GB = Locale.forLanguageTag("en-US-u-rg-gbzzzz"); private static final Locale RG_IE = Locale.forLanguageTag("en-US-u-rg-iezzzz"); private static final Locale RG_AT = Locale.forLanguageTag("en-US-u-rg-atzzzz"); - @DataProvider(name="dateFormatSymbolsData") - Object[][] dateFormatSymbolsData() { + static Object[][] dateFormatSymbolsData() { return new Object[][] { // Locale, expected AM string, expected PM string @@ -61,8 +59,7 @@ Object[][] dateFormatSymbolsData() { }; } - @DataProvider(name="decimalFormatSymbolsData") - Object[][] decimalFormatSymbolsData() { + static Object[][] decimalFormatSymbolsData() { return new Object[][] { // Locale, expected decimal separator, expected grouping separator @@ -74,18 +71,20 @@ Object[][] decimalFormatSymbolsData() { }; } - @Test(dataProvider="dateFormatSymbolsData") - public void test_DateFormatSymbols(Locale locale, String amExpected, String pmExpected) { + @MethodSource("dateFormatSymbolsData") + @ParameterizedTest + void test_DateFormatSymbols(Locale locale, String amExpected, String pmExpected) { DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); String[] ampm = dfs.getAmPmStrings(); - assertEquals(ampm[0], amExpected); - assertEquals(ampm[1], pmExpected); + assertEquals(amExpected, ampm[0]); + assertEquals(pmExpected, ampm[1]); } - @Test(dataProvider="decimalFormatSymbolsData") - public void test_DecimalFormatSymbols(Locale locale, char decimal, char grouping) { + @MethodSource("decimalFormatSymbolsData") + @ParameterizedTest + void test_DecimalFormatSymbols(Locale locale, char decimal, char grouping) { DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale); - assertEquals(dfs.getDecimalSeparator(), decimal); - assertEquals(dfs.getGroupingSeparator(), grouping); + assertEquals(decimal, dfs.getDecimalSeparator()); + assertEquals(grouping, dfs.getGroupingSeparator()); } } diff --git a/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java b/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java index 905fc9a79c8e..3c34d74337d9 100644 --- a/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java +++ b/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,30 +28,26 @@ * @summary Tests the system properties * @modules jdk.localedata * @build DefaultLocaleTest - * @run testng/othervm SystemPropertyTests + * @run junit/othervm SystemPropertyTests */ -import static jdk.test.lib.process.ProcessTools.executeTestJava; -import static org.testng.Assert.assertTrue; - -import java.util.Locale; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static jdk.test.lib.process.ProcessTools.executeTestJava; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Test Locale.getDefault() reflects the system property. Note that the * result may change depending on the CLDR releases. */ -@Test public class SystemPropertyTests { private static String LANGPROP = "-Duser.language=en"; private static String SCPTPROP = "-Duser.script="; private static String CTRYPROP = "-Duser.country=US"; - @DataProvider(name="data") - Object[][] data() { + static Object[][] data() { return new Object[][] { // system property, expected default, expected format, expected display {"-Duser.extensions=u-ca-japanese", @@ -86,8 +82,9 @@ Object[][] data() { }; } - @Test(dataProvider="data") - public void runTest(String extprop, String defLoc, + @MethodSource("data") + @ParameterizedTest + void runTest(String extprop, String defLoc, String defFmtLoc, String defDspLoc) throws Exception { int exitValue = executeTestJava(LANGPROP, SCPTPROP, CTRYPROP, extprop, "DefaultLocaleTest", defLoc, defFmtLoc, defDspLoc) @@ -95,6 +92,6 @@ public void runTest(String extprop, String defLoc, .errorTo(System.out) .getExitValue(); - assertTrue(exitValue == 0); + assertEquals(0, exitValue); } } diff --git a/test/jdk/java/util/Properties/CompatibilityTest.java b/test/jdk/java/util/Properties/CompatibilityTest.java index 29c7be6fbcd2..839680806c14 100644 --- a/test/jdk/java/util/Properties/CompatibilityTest.java +++ b/test/jdk/java/util/Properties/CompatibilityTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,19 +24,19 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Properties; -import org.testng.Assert; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /* * @test * @bug 8252354 - * @run testng CompatibilityTest + * @run junit CompatibilityTest * @summary Verify compatibility. */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class CompatibilityTest { - @DataProvider(name = "entries") public Object[][] getEntries() throws IOException { return new Object[][]{ {8, 238923}, @@ -53,9 +53,10 @@ public Object[][] getEntries() throws IOException { * @param value the value * @throws IOException */ - @Test(dataProvider = "entries") + @ParameterizedTest + @MethodSource("getEntries") void testThrows(Object key, Object value) throws IOException { - Assert.assertThrows(ClassCastException.class, () -> storeToXML(key, value)); + Assertions.assertThrows(ClassCastException.class, () -> storeToXML(key, value)); } void storeToXML(Object key, Object value) throws IOException { diff --git a/test/jdk/java/util/Properties/EncodingTest.java b/test/jdk/java/util/Properties/EncodingTest.java index d97730a37c7b..069d16155f0c 100644 --- a/test/jdk/java/util/Properties/EncodingTest.java +++ b/test/jdk/java/util/Properties/EncodingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,19 +27,20 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Properties; -import org.testng.Assert; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * @test * @bug 8183743 * @summary Test to verify the new overload method with Charset functions the * same as the existing method that takes a charset name. - * @run testng EncodingTest + * @run junit EncodingTest */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class EncodingTest { - @DataProvider(name = "parameters") public Object[][] getParameters() throws IOException { return new Object[][]{ {StandardCharsets.UTF_8.name(), null}, @@ -51,7 +52,8 @@ public Object[][] getParameters() throws IOException { * encoding name or a charset can be read with Properties#loadFromXML that * returns the same Properties object. */ - @Test(dataProvider = "parameters") + @ParameterizedTest + @MethodSource("getParameters") void testLoadAndStore(String encoding, Charset charset) throws IOException { Properties props = new Properties(); props.put("k0", "\u6C34"); @@ -74,6 +76,6 @@ void testLoadAndStore(String encoding, Charset charset) throws IOException { } } - Assert.assertEquals(props, p); + Assertions.assertEquals(p, props); } } diff --git a/test/jdk/java/util/Properties/InitialCapacity.java b/test/jdk/java/util/Properties/InitialCapacity.java index 81e5421bbef8..d684c37adf46 100644 --- a/test/jdk/java/util/Properties/InitialCapacity.java +++ b/test/jdk/java/util/Properties/InitialCapacity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,18 +22,22 @@ */ import java.util.Properties; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; /* * @test * @bug 8189319 * @summary Test that Properties(int initialCapacity) throws exceptions (or doesn't) as expected - * @run testng InitialCapacity + * @run junit InitialCapacity */ public class InitialCapacity { - @Test(expectedExceptions = IllegalArgumentException.class) - public void negativeInitCap() { Properties p = new Properties(-1); } + @Test + public void negativeInitCap() { Assertions.assertThrows(IllegalArgumentException.class, () -> { + Properties p = new Properties(-1); + }); +} @Test public void positiveInitCap() { Properties p = new Properties(10); } diff --git a/test/jdk/java/util/Properties/PropertiesEntrySetTest.java b/test/jdk/java/util/Properties/PropertiesEntrySetTest.java index d7d58be44dda..f3262f734e30 100644 --- a/test/jdk/java/util/Properties/PropertiesEntrySetTest.java +++ b/test/jdk/java/util/Properties/PropertiesEntrySetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,17 +26,17 @@ * @bug 8245694 * @summary tests the entrySet() method of Properties class * @author Yu Li - * @run testng PropertiesEntrySetTest + * @run junit PropertiesEntrySetTest */ -import org.testng.annotations.Test; import java.util.Properties; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertThrows; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; public class PropertiesEntrySetTest { @@ -99,13 +99,13 @@ public void testEquals() { public void testToString() { Properties a = new Properties(); var aEntrySet = a.entrySet(); - assertEquals(aEntrySet.toString(), "[]"); + assertEquals("[]", aEntrySet.toString()); a.setProperty("p1", "1"); - assertEquals(aEntrySet.toString(), "[p1=1]"); + assertEquals("[p1=1]", aEntrySet.toString()); a.setProperty("p2", "2"); - assertEquals(aEntrySet.size(), 2); + assertEquals(2, aEntrySet.size()); assertTrue(aEntrySet.toString().trim().startsWith("[")); assertTrue(aEntrySet.toString().contains("p1=1")); assertTrue(aEntrySet.toString().contains("p2=2")); @@ -115,18 +115,18 @@ public void testToString() { b.setProperty("p2", "2"); b.setProperty("p1", "1"); var bEntrySet = b.entrySet(); - assertEquals(bEntrySet.size(), 2); + assertEquals(2, bEntrySet.size()); assertTrue(bEntrySet.toString().trim().startsWith("[")); assertTrue(bEntrySet.toString().contains("p1=1")); assertTrue(bEntrySet.toString().contains("p2=2")); assertTrue(bEntrySet.toString().trim().endsWith("]")); b.setProperty("p0", "0"); - assertEquals(bEntrySet.size(), 3); + assertEquals(3, bEntrySet.size()); assertTrue(bEntrySet.toString().contains("p0=0")); b.remove("p1"); - assertEquals(bEntrySet.size(), 2); + assertEquals(2, bEntrySet.size()); assertFalse(bEntrySet.toString().contains("p1=1")); assertTrue(bEntrySet.toString().trim().startsWith("[")); assertTrue(bEntrySet.toString().contains("p0=0")); @@ -134,7 +134,7 @@ public void testToString() { assertTrue(bEntrySet.toString().trim().endsWith("]")); b.remove("p0", "0"); - assertEquals(bEntrySet.size(), 1); + assertEquals(1, bEntrySet.size()); assertFalse(bEntrySet.toString().contains("p0=0")); assertTrue(bEntrySet.toString().trim().startsWith("[")); assertTrue(bEntrySet.toString().contains("p2=2")); @@ -151,13 +151,13 @@ public void testEntrySetWithoutException() { a.setProperty("p1", "1"); a.setProperty("p2", "2"); var aEntrySet = a.entrySet(); - assertEquals(aEntrySet.size(), 2); + assertEquals(2, aEntrySet.size()); var i = aEntrySet.iterator(); var e1 = i.next(); i.remove(); assertFalse(aEntrySet.contains(e1)); - assertEquals(aEntrySet.size(), 1); + assertEquals(1, aEntrySet.size()); var e2 = i.next(); aEntrySet.remove(e2); @@ -172,14 +172,14 @@ public void testEntrySetWithoutException() { var bEntrySet = b.entrySet(); assertFalse(bEntrySet.containsAll(aEntrySet)); - assertEquals(bEntrySet.size(), 2); + assertEquals(2, bEntrySet.size()); assertTrue(bEntrySet.removeAll(aEntrySet)); - assertEquals(bEntrySet.size(), 1); + assertEquals(1, bEntrySet.size()); assertTrue(bEntrySet.retainAll(aEntrySet)); assertTrue(bEntrySet.isEmpty()); - assertEquals(aEntrySet.size(), 2); + assertEquals(2, aEntrySet.size()); aEntrySet.clear(); assertTrue(aEntrySet.isEmpty()); diff --git a/test/jdk/java/util/Properties/PropertiesStoreTest.java b/test/jdk/java/util/Properties/PropertiesStoreTest.java index b5a5b5a45aa0..88c24698a144 100644 --- a/test/jdk/java/util/Properties/PropertiesStoreTest.java +++ b/test/jdk/java/util/Properties/PropertiesStoreTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,9 +21,6 @@ * questions. */ -import org.testng.Assert; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import java.io.BufferedReader; import java.io.IOException; @@ -45,13 +42,18 @@ import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /* * @test * @summary tests the order in which the Properties.store() method writes out the properties * @bug 8231640 8282023 - * @run testng/othervm PropertiesStoreTest + * @run junit/othervm PropertiesStoreTest */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class PropertiesStoreTest { private static final String DATE_FORMAT_PATTERN = "EEE MMM dd HH:mm:ss zzz uuuu"; @@ -60,7 +62,6 @@ public class PropertiesStoreTest { private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern(DATE_FORMAT_PATTERN, Locale.US); private static final Locale PREV_LOCALE = Locale.getDefault(); - @DataProvider(name = "propsProvider") private Object[][] createProps() { final Properties simple = new Properties(); simple.setProperty("1", "one"); @@ -101,7 +102,6 @@ private Object[][] createProps() { /** * Returns a {@link Locale} to use for testing */ - @DataProvider(name = "localeProvider") private Object[][] provideLocales() { // pick a non-english locale for testing Set locales = Arrays.stream(Locale.getAvailableLocales()) @@ -122,7 +122,8 @@ private Object[][] provideLocales() { * Tests that the {@link Properties#store(Writer, String)} API writes out the properties * in the expected order */ - @Test(dataProvider = "propsProvider") + @ParameterizedTest + @MethodSource("createProps") public void testStoreWriterKeyOrder(final Properties props, final String[] expectedOrder) throws Exception { // Properties.store(...) to a temp file final Path tmpFile = Files.createTempFile("8231640", "props"); @@ -136,7 +137,8 @@ public void testStoreWriterKeyOrder(final Properties props, final String[] expec * Tests that the {@link Properties#store(OutputStream, String)} API writes out the properties * in the expected order */ - @Test(dataProvider = "propsProvider") + @ParameterizedTest + @MethodSource("createProps") public void testStoreOutputStreamKeyOrder(final Properties props, final String[] expectedOrder) throws Exception { // Properties.store(...) to a temp file final Path tmpFile = Files.createTempFile("8231640", "props"); @@ -161,7 +163,7 @@ private void testStoreKeyOrder(final Properties props, final Path storedProps, try (final InputStream is = Files.newInputStream(storedProps)) { loaded.load(is); } - Assert.assertEquals(loaded, props, "Unexpected properties loaded from stored state"); + Assertions.assertEquals(props, loaded, "Unexpected properties loaded from stored state"); // now read lines from the stored file and keep track of the order in which the keys were // found in that file. Compare that order with the expected store order of the keys. @@ -169,10 +171,10 @@ private void testStoreKeyOrder(final Properties props, final Path storedProps, try (final BufferedReader reader = Files.newBufferedReader(storedProps)) { actualOrder = readInOrder(reader); } - Assert.assertEquals(actualOrder.size(), expectedOrder.length, + Assertions.assertEquals(expectedOrder.length, actualOrder.size(), "Unexpected number of keys read from stored properties"); if (!Arrays.equals(actualOrder.toArray(new String[0]), expectedOrder)) { - Assert.fail("Unexpected order of stored property keys. Expected order: " + Arrays.toString(expectedOrder) + Assertions.fail("Unexpected order of stored property keys. Expected order: " + Arrays.toString(expectedOrder) + ", found order: " + actualOrder); } } @@ -180,7 +182,8 @@ private void testStoreKeyOrder(final Properties props, final Path storedProps, /** * Tests that {@link Properties#store(Writer, String)} writes out a proper date comment */ - @Test(dataProvider = "localeProvider") + @ParameterizedTest + @MethodSource("provideLocales") public void testStoreWriterDateComment(final Locale testLocale) throws Exception { // switch the default locale to the one being tested Locale.setDefault(testLocale); @@ -202,7 +205,8 @@ public void testStoreWriterDateComment(final Locale testLocale) throws Exception /** * Tests that {@link Properties#store(OutputStream, String)} writes out a proper date comment */ - @Test(dataProvider = "localeProvider") + @ParameterizedTest + @MethodSource("provideLocales") public void testStoreOutputStreamDateComment(final Locale testLocale) throws Exception { // switch the default locale to the one being tested Locale.setDefault(testLocale); @@ -232,19 +236,19 @@ private void testDateComment(Path file) throws Exception { while ((line = reader.readLine()) != null) { if (line.startsWith("#")) { if (comment != null) { - Assert.fail("More than one comment line found in the stored properties file " + file); + Assertions.fail("More than one comment line found in the stored properties file " + file); } comment = line.substring(1); } } } if (comment == null) { - Assert.fail("No comment line found in the stored properties file " + file); + Assertions.fail("No comment line found in the stored properties file " + file); } try { FORMATTER.parse(comment); } catch (DateTimeParseException pe) { - Assert.fail("Unexpected date comment: " + comment, pe); + Assertions.fail("Unexpected date comment: " + comment, pe); } } diff --git a/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java b/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java index 69f0db832583..c17c4622ecbd 100644 --- a/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java +++ b/test/jdk/java/util/ResourceBundle/modules/basic/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ * jdk.test.lib.compiler.CompilerUtils * jdk.test.lib.process.ProcessTools * ModuleTestUtil - * @run testng BasicTest + * @run junit BasicTest */ import java.nio.file.Path; @@ -54,13 +54,15 @@ import jdk.test.lib.Utils; import jdk.test.lib.compiler.CompilerUtils; import jdk.test.lib.process.ProcessTools; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static jdk.test.lib.Asserts.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class BasicTest { private static final String SRC_DIR_APPBASIC = "srcAppbasic"; private static final String SRC_DIR_APPBASIC2 = "srcAppbasic2"; @@ -92,7 +94,6 @@ public class BasicTest { private static final String MAIN = "test/jdk.test.Main"; - @DataProvider(name = "basicTestData") Object[][] basicTestData() { return new Object[][] { // Named module "test" contains resource bundles for root and en, @@ -122,7 +123,8 @@ Object[][] basicTestData() { }; } - @Test(dataProvider = "basicTestData") + @ParameterizedTest + @MethodSource("basicTestData") public void runBasicTest(String src, String mod, List moduleList, List localeList, String resFormat) throws Throwable { Path srcPath = Paths.get(Utils.TEST_SRC, src); diff --git a/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java b/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java index 5655eb5de2d0..df72af388552 100644 --- a/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java +++ b/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @library /test/lib * @modules jdk.compiler * @build CacheTest jdk.test.lib.compiler.CompilerUtils - * @run testng CacheTest + * @run junit CacheTest */ import java.nio.file.Files; @@ -37,11 +37,12 @@ import static jdk.test.lib.process.ProcessTools.*; import jdk.test.lib.compiler.CompilerUtils; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class CacheTest { private static final String TEST_SRC = System.getProperty("test.src"); @@ -55,7 +56,7 @@ public class CacheTest { private static final String MAIN = "test/jdk.test.Main"; private static final String MAIN_CLASS = "jdk.test.Main"; - @BeforeTest + @BeforeAll public void compileTestModules() throws Exception { for (String mn : new String[] {MAIN_BUNDLES_MODULE, TEST_MODULE}) { diff --git a/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java b/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java index 914ebf6bbf0b..45f52b512c8b 100644 --- a/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java +++ b/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ * @modules jdk.compiler * @build jdk.test.lib.compiler.CompilerUtils * jdk.test.lib.process.ProcessTools CaseInsensitiveNameClash - * @run testng CaseInsensitiveNameClash + * @run junit CaseInsensitiveNameClash */ import java.nio.file.Files; @@ -37,10 +37,12 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.compiler.CompilerUtils; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class CaseInsensitiveNameClash { private static final String TEST_SRC = System.getProperty("test.src"); @@ -54,7 +56,7 @@ public class CaseInsensitiveNameClash { /** * Compiles the module used by the test */ - @BeforeTest + @BeforeAll public void compileAll() throws Exception { Path msrc = SRC_DIR.resolve(MODULE); assertTrue(CompilerUtils.compile(msrc, MODS_DIR, diff --git a/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java b/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java index e0fdb9a93abb..ee9da88d705b 100644 --- a/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java +++ b/test/jdk/java/util/ResourceBundle/modules/visibility/VisibilityTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ * jdk.test.lib.compiler.CompilerUtils * jdk.test.lib.process.ProcessTools * ModuleTestUtil - * @run testng VisibilityTest + * @run junit VisibilityTest */ import java.nio.file.Path; @@ -46,13 +46,13 @@ import jdk.test.lib.Utils; import jdk.test.lib.process.ProcessTools; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -import static org.testng.Assert.assertEquals; - -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class VisibilityTest { private static final Path SRC_DIR = Paths.get(Utils.TEST_SRC, "src"); private static final Path MODS_DIR = Paths.get(Utils.TEST_CLASSES, "mods"); @@ -63,7 +63,7 @@ public class VisibilityTest { private static final List MODULE_LIST = List.of("embargo", "exported.named.bundles", "named.bundles", "test"); - @BeforeTest + @BeforeAll public void prepareTestEnv() throws Throwable { MODULE_LIST.forEach(mn -> ModuleTestUtil.prepareModule(SRC_DIR, MODS_DIR, mn, ".properties")); @@ -93,7 +93,6 @@ public void prepareTestEnv() throws Throwable { * "exported.named.bundle" are exported to unnamed modules. */ - @DataProvider(name = "RunWithTestResData") Object[][] RunWithTestResData() { return new Object[][] { // Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg. @@ -188,7 +187,6 @@ Object[][] RunWithTestResData() { }; } - @DataProvider(name = "RunWithExportedResData") Object[][] RunWithExportedResData() { return new Object[][] { // Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg @@ -285,7 +283,6 @@ Object[][] RunWithExportedResData() { }; } - @DataProvider(name = "RunWithPkgResData") Object[][] RunWithPkgResData() { return new Object[][] { // jdk.pkg.resources.* are in an unnamed module. @@ -300,10 +297,11 @@ Object[][] RunWithPkgResData() { /** * Test cases with jdk.test.resources.* */ - @Test(dataProvider = "RunWithTestResData") + @ParameterizedTest + @MethodSource("RunWithTestResData") public void RunWithTestRes(List argsList) throws Throwable { int exitCode = runCmd(argsList); - assertEquals(exitCode, 0, "Execution of the tests with " + assertEquals(0, exitCode, "Execution of the tests with " + "jdk.test.resources.* failed. " + "Unexpected exit code: " + exitCode); } @@ -311,10 +309,11 @@ public void RunWithTestRes(List argsList) throws Throwable { /** * Test cases with jdk.test.resources.exported.* */ - @Test(dataProvider = "RunWithExportedResData") + @ParameterizedTest + @MethodSource("RunWithExportedResData") public void RunWithExportedRes(List argsList) throws Throwable { int exitCode = runCmd(argsList); - assertEquals(exitCode, 0, "Execution of the tests with " + assertEquals(0, exitCode, "Execution of the tests with " + "jdk.test.resources.exported.* failed. " + "Unexpected exit code: " + exitCode); } @@ -322,10 +321,11 @@ public void RunWithExportedRes(List argsList) throws Throwable { /** * Test cases with jdk.pkg.resources.* */ - @Test(dataProvider = "RunWithPkgResData") + @ParameterizedTest + @MethodSource("RunWithPkgResData") public void RunWithPkgRes(List argsList) throws Throwable { int exitCode = runCmd(argsList); - assertEquals(exitCode, 0, "Execution of the tests with " + assertEquals(0, exitCode, "Execution of the tests with " + "jdk.pkg.resources.* failed. " + "Unexpected exit code: " + exitCode); } diff --git a/test/jdk/java/util/ServiceLoader/BadProvidersTest.java b/test/jdk/java/util/ServiceLoader/BadProvidersTest.java index 58613c7b5e35..39c90824e4c9 100644 --- a/test/jdk/java/util/ServiceLoader/BadProvidersTest.java +++ b/test/jdk/java/util/ServiceLoader/BadProvidersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @modules java.base/jdk.internal.org.objectweb.asm * jdk.compiler * @build jdk.test.lib.compiler.CompilerUtils - * @run testng/othervm BadProvidersTest + * @run junit/othervm BadProvidersTest * @summary Basic test of ServiceLoader with bad provider and bad provider * factories deployed on the module path */ @@ -51,15 +51,16 @@ import jdk.test.lib.compiler.CompilerUtils; -import org.testng.annotations.Test; -import org.testng.annotations.DataProvider; -import static org.testng.Assert.*; +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; /** * Basic test of `provides S with PF` and `provides S with P` where the provider * factory or provider */ - public class BadProvidersTest { private static final String TEST_SRC = System.getProperty("test.src"); @@ -132,21 +133,10 @@ public void sanityTest2() throws Exception { } - @DataProvider(name = "badfactories") - public Object[][] createBadFactories() { - return new Object[][] { - { "classnotpublic", null }, - { "methodnotpublic", null }, - { "badreturntype", null }, - { "returnsnull", null }, - { "throwsexception", null }, - }; - } - - - @Test(dataProvider = "badfactories", - expectedExceptions = ServiceConfigurationError.class) - public void testBadFactory(String testName, String ignore) throws Exception { + @ParameterizedTest + @ValueSource(strings = { "classnotpublic", "methodnotpublic", "badreturntype", + "returnsnull", "throwsexception" }) + public void testBadFactory(String testName) throws Exception { Path mods = compileTest(TEST1_MODULE); // compile the bad factory @@ -158,28 +148,18 @@ public void testBadFactory(String testName, String ignore) throws Exception { // copy the compiled class into the module Path classFile = Paths.get("p", "ProviderFactory.class"); Files.copy(output.resolve(classFile), - mods.resolve(TEST1_MODULE).resolve(classFile), - StandardCopyOption.REPLACE_EXISTING); + mods.resolve(TEST1_MODULE).resolve(classFile), + StandardCopyOption.REPLACE_EXISTING); - // load providers and instantiate each one - loadProviders(mods, TEST1_MODULE).forEach(Provider::get); + Assertions.assertThrows(ServiceConfigurationError.class, + // load providers and instantiate each one + () -> loadProviders(mods, TEST1_MODULE).forEach(Provider::get) + ); } - - @DataProvider(name = "badproviders") - public Object[][] createBadProviders() { - return new Object[][] { - { "notpublic", null }, - { "ctornotpublic", null }, - { "notasubtype", null }, - { "throwsexception", null } - }; - } - - - @Test(dataProvider = "badproviders", - expectedExceptions = ServiceConfigurationError.class) - public void testBadProvider(String testName, String ignore) throws Exception { + @ParameterizedTest + @ValueSource(strings = { "notpublic", "ctornotpublic", "notasubtype", "throwsexception" }) + public void testBadProvider(String testName) throws Exception { Path mods = compileTest(TEST2_MODULE); // compile the bad provider @@ -191,11 +171,13 @@ public void testBadProvider(String testName, String ignore) throws Exception { // copy the compiled class into the module Path classFile = Paths.get("p", "Provider.class"); Files.copy(output.resolve(classFile), - mods.resolve(TEST2_MODULE).resolve(classFile), - StandardCopyOption.REPLACE_EXISTING); + mods.resolve(TEST2_MODULE).resolve(classFile), + StandardCopyOption.REPLACE_EXISTING); - // load providers and instantiate each one - loadProviders(mods, TEST2_MODULE).forEach(Provider::get); + Assertions.assertThrows(ServiceConfigurationError.class, + // load providers and instantiate each one + () -> loadProviders(mods, TEST2_MODULE).forEach(Provider::get) + ); } @@ -203,7 +185,7 @@ public void testBadProvider(String testName, String ignore) throws Exception { * Test a service provider that defines more than one no-args * public static "provider" method. */ - @Test(expectedExceptions = ServiceConfigurationError.class) + @Test public void testWithTwoFactoryMethods() throws Exception { Path mods = compileTest(TEST1_MODULE); @@ -257,8 +239,10 @@ public void testWithTwoFactoryMethods() throws Exception { .resolve("ProviderFactory.class"); Files.write(classFile, cw.toByteArray()); - // load providers and instantiate each one - loadProviders(mods, TEST1_MODULE).forEach(Provider::get); + Assertions.assertThrows(ServiceConfigurationError.class, + // load providers and instantiate each one + () -> loadProviders(mods, TEST1_MODULE).forEach(Provider::get) + ); } } diff --git a/test/jdk/java/util/ServiceLoader/CachingTest.java b/test/jdk/java/util/ServiceLoader/CachingTest.java index 264c646b5af0..138b6b6862ff 100644 --- a/test/jdk/java/util/ServiceLoader/CachingTest.java +++ b/test/jdk/java/util/ServiceLoader/CachingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /** * @test * @summary Test ServiceLoader caches - * @run testng CachingTest + * @run junit CachingTest */ import java.nio.file.Files; @@ -38,9 +38,9 @@ import java.util.Spliterator; import java.util.stream.Collectors; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class CachingTest { @@ -52,17 +52,17 @@ public static class S1 implements S { } public static class S2 implements S { } - private ClassLoader testClassLoader; + private static ClassLoader testClassLoader; // creates the services configuration file and sets the ClassLoader - @BeforeClass - void setup() throws Exception { + @BeforeAll + static void setup() throws Exception { String classes = System.getProperty("test.classes"); Path dir = Paths.get(classes, "META-INF", "services"); Files.createDirectories(dir); Path config = dir.resolve(S.class.getName()); Files.write(config, List.of(S1.class.getName(), S2.class.getName())); - this.testClassLoader = CachingTest.class.getClassLoader(); + testClassLoader = CachingTest.class.getClassLoader(); } private void checkLists(List list1, List list2) { diff --git a/test/jdk/java/util/ServiceLoader/ModulesTest.java b/test/jdk/java/util/ServiceLoader/ModulesTest.java index 002b8458865d..d265ce18f60b 100644 --- a/test/jdk/java/util/ServiceLoader/ModulesTest.java +++ b/test/jdk/java/util/ServiceLoader/ModulesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ * @build jdk.test.lib.util.JarUtils * @compile classpath/pearscript/org/pear/PearScriptEngineFactory.java * classpath/pearscript/org/pear/PearScript.java - * @run testng/othervm ModulesTest + * @run junit/othervm ModulesTest * @summary Basic test for ServiceLoader with a provider deployed as a module. */ @@ -55,9 +55,10 @@ import jdk.test.lib.util.JarUtils; -import org.testng.annotations.Test; -import org.testng.annotations.BeforeTest; -import static org.testng.Assert.*; +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; /** * Basic test for ServiceLoader. The test make use of two service providers: @@ -67,12 +68,11 @@ * 2. PearScriptEngine - a ScriptEngineFactory deployed on the class path * with a service configuration file. */ - public class ModulesTest { // Copy the services configuration file for "pearscript" into place. - @BeforeTest - public void setup() throws Exception { + @BeforeAll + public static void setup() throws Exception { Path src = Paths.get(System.getProperty("test.src")); Path classes = Paths.get(System.getProperty("test.classes")); String st = ScriptEngineFactory.class.getName(); @@ -428,30 +428,36 @@ public void testWithCustomLayer3() { // -- nulls -- - @Test(expectedExceptions = { NullPointerException.class }) + @Test public void testLoadNull1() { - ServiceLoader.load(null); + Assertions.assertThrows(NullPointerException.class, + () -> ServiceLoader.load(null)); } - @Test(expectedExceptions = { NullPointerException.class }) + @Test public void testLoadNull2() { - ServiceLoader.load((Class) null, ClassLoader.getSystemClassLoader()); + Assertions.assertThrows(NullPointerException.class, + () -> ServiceLoader.load((Class) null, ClassLoader.getSystemClassLoader())); } - @Test(expectedExceptions = { NullPointerException.class }) + @Test public void testLoadNull3() { class S { } - ServiceLoader.load((ModuleLayer) null, S.class); + Assertions.assertThrows(NullPointerException.class, () -> { + ServiceLoader.load((ModuleLayer) null, S.class); + }); } - @Test(expectedExceptions = { NullPointerException.class }) + @Test public void testLoadNull4() { - ServiceLoader.load(ModuleLayer.empty(), null); + Assertions.assertThrows(NullPointerException.class, + () -> ServiceLoader.load(ModuleLayer.empty(), null)); } - @Test(expectedExceptions = { NullPointerException.class }) + @Test public void testLoadNull5() { - ServiceLoader.loadInstalled(null); + Assertions.assertThrows(NullPointerException.class, + () -> ServiceLoader.loadInstalled(null)); } /** diff --git a/test/jdk/java/util/ServiceLoader/NoInterferenceTest.java b/test/jdk/java/util/ServiceLoader/NoInterferenceTest.java index ff83b836e200..d91bc9c759f4 100644 --- a/test/jdk/java/util/ServiceLoader/NoInterferenceTest.java +++ b/test/jdk/java/util/ServiceLoader/NoInterferenceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @library /test/lib * @modules jdk.compiler * @build jdk.test.lib.compiler.CompilerUtils - * @run testng NoInterferenceTest + * @run junit NoInterferenceTest * @summary Basic test of ServiceLoader that ensures there is no interference * when there are two service interfaces of the same name in a layer * or overridden in a child layer. @@ -46,9 +46,9 @@ import jdk.test.lib.compiler.CompilerUtils; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class NoInterferenceTest { @@ -57,8 +57,8 @@ public class NoInterferenceTest { private static final Path MODS_DIR = Paths.get("mods"); private static final List MODULES = Arrays.asList("s1", "p1", "s2", "p2"); - @BeforeTest - void compile() throws Exception { + @BeforeAll + static void compile() throws Exception { Files.createDirectory(MODS_DIR); for (String name : MODULES) { Path src = SRC_DIR.resolve(name); diff --git a/test/jdk/java/util/ServiceLoader/ReloadTest.java b/test/jdk/java/util/ServiceLoader/ReloadTest.java index d48b5c29f4d6..be2c0d687732 100644 --- a/test/jdk/java/util/ServiceLoader/ReloadTest.java +++ b/test/jdk/java/util/ServiceLoader/ReloadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @modules java.scripting * @library modules classpath/pearscript * @build ReloadTest org.pear.PearScript org.pear.PearScriptEngineFactory bananascript/* - * @run testng/othervm ReloadTest + * @run junit/othervm ReloadTest * @summary Basic test of ServiceLoader.reload */ @@ -40,12 +40,14 @@ import java.util.stream.Stream; import static java.util.ServiceLoader.*; import javax.script.ScriptEngineFactory; -import org.testng.annotations.Test; -import static org.testng.Assert.*; -@Test +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; + public class ReloadTest { + @Test public void testReload() { ServiceLoader sl = load(ScriptEngineFactory.class); List names1 = sl.stream() @@ -58,41 +60,42 @@ public void testReload() { .map(Provider::get) .map(ScriptEngineFactory::getEngineName) .collect(Collectors.toList()); - assertEquals(names1, names2); + assertEquals(names2, names1); } - @Test(expectedExceptions = { ConcurrentModificationException.class }) + @Test public void testIteratorHasNext() { ServiceLoader sl = load(ScriptEngineFactory.class); Iterator iterator = sl.iterator(); sl.reload(); - iterator.hasNext(); + Assertions.assertThrows(ConcurrentModificationException.class, iterator::hasNext); } - @Test(expectedExceptions = { ConcurrentModificationException.class }) + @Test public void testIteratorNext() { ServiceLoader sl = load(ScriptEngineFactory.class); Iterator iterator = sl.iterator(); assertTrue(iterator.hasNext()); sl.reload(); - iterator.next(); + Assertions.assertThrows(ConcurrentModificationException.class, iterator::next); } - @Test(expectedExceptions = { ConcurrentModificationException.class }) + @Test public void testStreamFindAny() { ServiceLoader sl = load(ScriptEngineFactory.class); Stream> stream = sl.stream(); sl.reload(); - stream.findAny(); + Assertions.assertThrows(ConcurrentModificationException.class, stream::findAny); } - @Test(expectedExceptions = { ConcurrentModificationException.class }) + @Test public void testSpliteratorTryAdvance() { ServiceLoader sl = load(ScriptEngineFactory.class); Stream> stream = sl.stream(); Spliterator> spliterator = stream.spliterator(); sl.reload(); - spliterator.tryAdvance(System.out::println); + Assertions.assertThrows(ConcurrentModificationException.class, + () -> spliterator.tryAdvance(System.out::println)); } } diff --git a/test/jdk/java/util/ServiceLoader/TwoIterators.java b/test/jdk/java/util/ServiceLoader/TwoIterators.java index ddb9cc09508b..b86cc45f17f9 100644 --- a/test/jdk/java/util/ServiceLoader/TwoIterators.java +++ b/test/jdk/java/util/ServiceLoader/TwoIterators.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @summary Test ServiceLoader with two iterators, interleaving their use * to test that they don't interfere with each other - * @run testng TwoIterators + * @run junit TwoIterators */ import java.nio.file.Files; @@ -35,9 +35,9 @@ import java.util.Iterator; import java.util.ServiceLoader; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; public class TwoIterators { @@ -48,18 +48,17 @@ public static interface S { } public static class S1 implements S { } public static class S2 implements S { } - private ClassLoader testClassLoader; + private static ClassLoader testClassLoader; // creates the services configuration file and sets the ClassLoader - @BeforeClass - void setup() throws Exception { + @BeforeAll + static void setup() throws Exception { String classes = System.getProperty("test.classes"); Path dir = Paths.get(classes, "META-INF", "services"); Files.createDirectories(dir); Path config = dir.resolve(S.class.getName()); Files.write(config, Arrays.asList(S1.class.getName(), S2.class.getName())); - - this.testClassLoader = TwoIterators.class.getClassLoader(); + testClassLoader = TwoIterators.class.getClassLoader(); } @Test diff --git a/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java b/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java index 91aba564cd18..4a9bc8088512 100644 --- a/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java +++ b/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ * @build jdk.test.lib.process.* * jdk.test.lib.util.JarUtils * Basic Load FooService FooProvider1 FooProvider2 FooProvider3 BarProvider - * @run testng ServiceLoaderBasicTest + * @run junit ServiceLoaderBasicTest */ @@ -44,14 +44,16 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.util.JarUtils; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.nio.file.StandardOpenOption.CREATE; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import static java.util.Arrays.asList; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; + public class ServiceLoaderBasicTest { private static final String METAINFO = "META-INF/services/FooService"; @@ -79,8 +81,8 @@ public class ServiceLoaderBasicTest { private static final String XTESTXMETA_CP = XTEST_CP + XMETA; private static final String XTESTXMETAP2_CP = XTESTXMETA_CP + P2; - @BeforeClass - public void initialize() throws Exception { + @BeforeAll + public static void initialize() throws Exception { createProviderConfig(XTEST_CONFIG, "FooProvider1"); createProviderConfig(XMETA_CONFIG, "FooProvider42"); createJar(P2JAR, "FooProvider2", List.of("FooProvider2")); @@ -88,8 +90,7 @@ public void initialize() throws Exception { Files.copy(P2JAR, P2DUPJAR, REPLACE_EXISTING); } - @DataProvider - public Object[][] testCases() { + private static Object[][] testCases() { return new Object[][]{ // CLI options, Test, Runtime arguments // Success cases @@ -110,23 +111,14 @@ public Object[][] testCases() { }; } - @DataProvider - public Object[][] negativeTestCases() { - return new Object[][]{ - {"blah blah"}, - {"9234"}, - {"X!"}, - {"BarProvider"}, - {"FooProvider42"} - }; - } - - @Test(dataProvider = "testCases") + @ParameterizedTest + @MethodSource("testCases") public void testProvider(List args) throws Throwable { runJava(args); } - @Test(dataProvider = "negativeTestCases") + @ParameterizedTest // negative test cases + @ValueSource(strings = { "blah blah", "9234", "X!", "BarProvider", "FooProvider42" }) public void testBadProvider(String providerName) throws Throwable { Files.write(XMETA_CONFIG, providerName.getBytes()); runJava(List.of("-cp", XMETA_CP, "Load", "fail")); @@ -144,12 +136,12 @@ private void runJava(List opts) throws Throwable { .shouldHaveExitValue(0); } - private void createProviderConfig(Path config, String providerName) throws Exception { + private static void createProviderConfig(Path config, String providerName) throws Exception { Files.createDirectories(config.getParent()); Files.write(config, providerName.getBytes(), CREATE); } - private void createJar(Path jar, String provider, List files) throws Exception { + private static void createJar(Path jar, String provider, List files) throws Exception { Path xdir = Path.of(provider); createProviderConfig(xdir.resolve(METAINFO), provider); diff --git a/test/jdk/java/util/StringJoiner/MergeTest.java b/test/jdk/java/util/StringJoiner/MergeTest.java index f47ed3ee094a..574124b9bdde 100644 --- a/test/jdk/java/util/StringJoiner/MergeTest.java +++ b/test/jdk/java/util/StringJoiner/MergeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,17 +27,18 @@ * @summary test StringJoiner::merge * @modules java.base/jdk.internal.util * @requires vm.bits == "64" & os.maxMemory > 4G - * @run testng/othervm -Xmx4g -XX:+CompactStrings MergeTest + * @run junit/othervm -Xmx4g -XX:+CompactStrings MergeTest */ import java.util.StringJoiner; import java.util.stream.Stream; -import org.testng.annotations.Test; import static jdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; -@Test +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; + public class MergeTest { private static final String[] PREFIXES = {"", "{", "@#$%"}; private static final String[] SUFFIXES = {"", "}", "*&%$"}; @@ -69,12 +70,13 @@ private static Stream fixesStream() { return builder.build(); } - @Test(expectedExceptions = {NullPointerException.class}) + @Test public void testNull() { StringJoiner sj = new StringJoiner(",", "{", "}"); - sj.merge(null); + Assertions.assertThrows(NullPointerException.class, () -> sj.merge(null)); } + @Test public void testSimple() { fixesStream().forEach(fixes -> { StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0); @@ -83,10 +85,11 @@ public void testSimple() { Stream.of("d", "e", "f").forEachOrdered(other::add); sj.merge(other); - assertEquals(sj.toString(), fixes.pre0 + "a,b,c,d,e,f" + fixes.suf0); + assertEquals(fixes.pre0 + "a,b,c,d,e,f" + fixes.suf0, sj.toString()); }); } + @Test public void testEmptyOther() { fixesStream().forEach(fixes -> { StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0); @@ -94,14 +97,15 @@ public void testEmptyOther() { Stream.of("a", "b", "c").forEachOrdered(sj::add); sj.merge(other); - assertEquals(sj.toString(), fixes.pre0 + "a,b,c" + fixes.suf0); + assertEquals(fixes.pre0 + "a,b,c" + fixes.suf0, sj.toString()); other.setEmptyValue("EMPTY"); sj.merge(other); - assertEquals(sj.toString(), fixes.pre0 + "a,b,c" + fixes.suf0); + assertEquals(fixes.pre0 + "a,b,c" + fixes.suf0, sj.toString()); }); } + @Test public void testEmptyThis() { fixesStream().forEach(fixes -> { StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0); @@ -109,34 +113,36 @@ public void testEmptyThis() { Stream.of("d", "e", "f").forEachOrdered(other::add); sj.merge(other); - assertEquals(sj.toString(), fixes.pre0 + "d:e:f" + fixes.suf0); + assertEquals(fixes.pre0 + "d:e:f" + fixes.suf0, sj.toString()); sj = new StringJoiner(",", fixes.pre0, fixes.suf0).setEmptyValue("EMPTY"); - assertEquals(sj.toString(), "EMPTY"); + assertEquals("EMPTY", sj.toString()); sj.merge(other); - assertEquals(sj.toString(), fixes.pre0 + "d:e:f" + fixes.suf0); + assertEquals(fixes.pre0 + "d:e:f" + fixes.suf0, sj.toString()); }); } + @Test public void testEmptyBoth() { fixesStream().forEach(fixes -> { StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0); StringJoiner other = new StringJoiner(":", fixes.pre1, fixes.suf1); sj.merge(other); - assertEquals(sj.toString(), fixes.pre0 + fixes.suf0); + assertEquals(fixes.pre0 + fixes.suf0, sj.toString()); other.setEmptyValue("NOTHING"); sj.merge(other); - assertEquals(sj.toString(), fixes.pre0 + fixes.suf0); + assertEquals(fixes.pre0 + fixes.suf0, sj.toString()); sj = new StringJoiner(",", fixes.pre0, fixes.suf0).setEmptyValue("EMPTY"); - assertEquals(sj.toString(), "EMPTY"); + assertEquals("EMPTY", sj.toString()); sj.merge(other); - assertEquals(sj.toString(), "EMPTY"); + assertEquals("EMPTY", sj.toString()); }); } + @Test public void testCascadeEmpty() { fixesStream().forEach(fixes -> { StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0); @@ -144,13 +150,14 @@ public void testCascadeEmpty() { StringJoiner o2 = new StringJoiner(",", "<", ">").setEmptyValue("Empty2"); o1.merge(o2); - assertEquals(o1.toString(), "Empty1"); + assertEquals("Empty1", o1.toString()); sj.merge(o1); - assertEquals(sj.toString(), fixes.pre0 + fixes.suf0); + assertEquals(fixes.pre0 + fixes.suf0, sj.toString()); }); } + @Test public void testDelimiter() { fixesStream().forEach(fixes -> { StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0); @@ -159,18 +166,20 @@ public void testDelimiter() { Stream.of("d", "e", "f").forEachOrdered(other::add); sj.merge(other); - assertEquals(sj.toString(), fixes.pre0 + "a,b,c,d:e:f" + fixes.suf0); + assertEquals(fixes.pre0 + "a,b,c,d:e:f" + fixes.suf0, sj.toString()); }); } + @Test public void testMergeSelf() { fixesStream().forEach(fixes -> { final StringJoiner sj = new StringJoiner(",", fixes.pre0, fixes.suf0).add("a").add("b"); - assertEquals(sj.merge(sj).toString(), fixes.pre0 + "a,b,a,b" + fixes.suf0); - assertEquals(sj.merge(sj).toString(), fixes.pre0 + "a,b,a,b,a,b,a,b" + fixes.suf0); + assertEquals(fixes.pre0 + "a,b,a,b" + fixes.suf0, sj.merge(sj).toString()); + assertEquals(fixes.pre0 + "a,b,a,b,a,b,a,b" + fixes.suf0, sj.merge(sj).toString()); }); } + @Test public void OOM() { String maxString = "*".repeat(SOFT_MAX_ARRAY_LENGTH); diff --git a/test/jdk/java/util/StringJoiner/StringJoinerOomUtf16Test.java b/test/jdk/java/util/StringJoiner/StringJoinerOomUtf16Test.java index b45e66b4d8bd..7fde8b36ffa1 100644 --- a/test/jdk/java/util/StringJoiner/StringJoinerOomUtf16Test.java +++ b/test/jdk/java/util/StringJoiner/StringJoinerOomUtf16Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,18 +26,23 @@ * @summary tests StringJoiner OOME when joining sub-max-length Strings * @modules java.base/jdk.internal.util * @requires vm.bits == "64" & os.maxMemory > 4G - * @run testng/othervm -Xmx4g -XX:+CompactStrings StringJoinerOomUtf16Test + * @run junit/othervm -Xmx4g -XX:+CompactStrings StringJoinerOomUtf16Test */ -import org.testng.annotations.Test; import static jdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH; -import static org.testng.Assert.fail; + +import static org.junit.jupiter.api.Assertions.fail; import java.util.StringJoiner; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; -@Test(groups = {"unit","string","util","libs"}) +@Tag("unit") +@Tag("string") +@Tag("util") +@Tag("libs") public class StringJoinerOomUtf16Test { // the sum of lengths of the following two strings is way less than @@ -48,6 +53,7 @@ public class StringJoinerOomUtf16Test { private static final String OVERFLOW_UTF16_STRING = "\u017D".repeat(((Integer.MAX_VALUE - SOFT_MAX_ARRAY_LENGTH) >> 1) + 1); + @Test public void OOM1() { try { new StringJoiner("") @@ -60,6 +66,7 @@ public void OOM1() { } } + @Test public void OOM2() { try { new StringJoiner(HALF_MAX_LATIN1_STRING) @@ -72,6 +79,7 @@ public void OOM2() { } } + @Test public void OOM3() { try { new StringJoiner(OVERFLOW_UTF16_STRING) @@ -84,6 +92,7 @@ public void OOM3() { } } + @Test public void OOM4() { try { new StringJoiner("", HALF_MAX_LATIN1_STRING, OVERFLOW_UTF16_STRING) diff --git a/test/jdk/java/util/StringJoiner/StringJoinerTest.java b/test/jdk/java/util/StringJoiner/StringJoinerTest.java index 25948fb8e55d..aa25623dbc39 100644 --- a/test/jdk/java/util/StringJoiner/StringJoinerTest.java +++ b/test/jdk/java/util/StringJoiner/StringJoinerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,18 +26,25 @@ * @summary tests StringJoinerTest * @modules java.base/jdk.internal.util * @requires vm.bits == "64" & os.maxMemory > 4G - * @run testng/othervm -Xmx4g -XX:+CompactStrings StringJoinerTest + * @run junit/othervm -Xmx4g -XX:+CompactStrings StringJoinerTest * @author Jim Gish */ + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + import java.util.ArrayList; import java.util.StringJoiner; -import org.testng.annotations.Test; -import static jdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; +import static jdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; -@Test(groups = {"unit","string","util","libs"}) +@Tag("unit") +@Tag("string") +@Tag("util") +@Tag("libs") public class StringJoinerTest { private static final String EMPTY = "EMPTY"; @@ -51,6 +58,7 @@ public class StringJoinerTest { private static final String DASH = "-"; private static final String MAX_STRING = "*".repeat(SOFT_MAX_ARRAY_LENGTH); + @Test public void addAddAll() { StringJoiner sj = new StringJoiner(DASH, "{", "}"); sj.add(ONE); @@ -61,7 +69,7 @@ public void addAddAll() { nextOne.stream().forEachOrdered(sj::add); String expected = "{"+ONE+DASH+TWO+DASH+THREE+"}"; - assertEquals(sj.toString(), expected); + assertEquals(expected, sj.toString()); } void addAlladd() { @@ -75,10 +83,11 @@ void addAlladd() { sj.add(THREE); String expected = "{"+ONE+DASH+TWO+DASH+THREE+"}"; - assertEquals(sj.toString(), expected); + assertEquals(expected, sj.toString()); } // The following tests do two successive adds of different types + @Test public void addAlladdAll() { StringJoiner sj = new StringJoiner(DASH, "{", "}"); ArrayList firstOne = new ArrayList<>(); @@ -93,9 +102,10 @@ public void addAlladdAll() { nextOne.stream().forEachOrdered(sj::add); String expected = "{"+ONE+DASH+TWO+DASH+THREE+DASH+FOUR+DASH+FIVE+"}"; - assertEquals(sj.toString(), expected); + assertEquals(expected, sj.toString()); } + @Test public void addCharSequence() { StringJoiner sj = new StringJoiner(","); CharSequence cs_one = ONE; @@ -104,13 +114,13 @@ public void addCharSequence() { sj.add(cs_one); sj.add(cs_two); - assertEquals(sj.toString(), ONE + "," + TWO); + assertEquals(ONE + "," + TWO, sj.toString()); sj = new StringJoiner(DASH, "{", "}"); sj.add(cs_one); sj.add(cs_two); - assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}"); + assertEquals("{" + ONE + DASH + TWO + "}", sj.toString()); StringBuilder builder = new StringBuilder(ONE); StringBuffer buffer = new StringBuffer(THREE); @@ -118,13 +128,14 @@ public void addCharSequence() { sj.add(builder).add(buffer); builder.append(TWO); buffer.append(FOUR); - assertEquals(sj.toString(), "{ " + ONE + ", " + THREE + " }", + assertEquals("{ " + ONE + ", " + THREE + " }", sj.toString(), "CharSequence is copied when add"); sj.add(builder); - assertEquals(sj.toString(), "{ " + ONE + ", " + THREE + ", " + ONE + - TWO + " }"); + assertEquals("{ " + ONE + ", " + THREE + ", " + ONE + + TWO + " }", sj.toString()); } + @Test public void addCharSequenceWithEmptyValue() { StringJoiner sj = new StringJoiner(",").setEmptyValue(EMPTY); CharSequence cs_one = ONE; @@ -133,189 +144,200 @@ public void addCharSequenceWithEmptyValue() { sj.add(cs_one); sj.add(cs_two); - assertEquals(sj.toString(), ONE + "," + TWO); + assertEquals(ONE + "," + TWO, sj.toString()); sj = new StringJoiner(DASH, "{", "}"); sj.add(cs_one); sj.add(cs_two); - assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}"); + assertEquals("{" + ONE + DASH + TWO + "}", sj.toString()); sj = new StringJoiner(DASH, "{", "}"); - assertEquals(sj.toString(), "{}"); + assertEquals("{}", sj.toString()); sj = new StringJoiner("=", "{", "}").setEmptyValue(""); - assertEquals(sj.toString(), ""); + assertEquals("", sj.toString()); sj = new StringJoiner(DASH, "{", "}").setEmptyValue(EMPTY); - assertEquals(sj.toString(), EMPTY); + assertEquals(EMPTY, sj.toString()); sj.add(cs_one); sj.add(cs_two); - assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}"); + assertEquals("{" + ONE + DASH + TWO + "}", sj.toString()); } + @Test public void addString() { StringJoiner sj = new StringJoiner(DASH); sj.add(ONE); - assertEquals(sj.toString(), ONE); + assertEquals(ONE, sj.toString()); sj = new StringJoiner(DASH, "{", "}"); sj.add(ONE); - assertEquals(sj.toString(), "{" + ONE + "}"); + assertEquals("{" + ONE + "}", sj.toString()); sj.add(TWO); - assertEquals(sj.toString(), "{" + ONE + DASH + TWO + "}"); + assertEquals("{" + ONE + DASH + TWO + "}", sj.toString()); } + @Test public void lengthWithCustomEmptyValue() { StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY); - assertEquals(sj.length(), EMPTY.length()); + assertEquals(EMPTY.length(), sj.length()); sj.add(""); - assertEquals(sj.length(), "<>".length()); + assertEquals("<>".length(), sj.length()); sj.add(""); - assertEquals(sj.length(), "<->".length()); + assertEquals("<->".length(), sj.length()); sj.add(ONE); - assertEquals(sj.length(), 4 + ONE_LEN); - assertEquals(sj.toString().length(), sj.length()); + assertEquals(4 + ONE_LEN, sj.length()); + assertEquals(sj.length(), sj.toString().length()); sj.add(TWO); - assertEquals(sj.length(), 5 + ONE_LEN + TWO_LEN); - assertEquals(sj.toString().length(), sj.length()); + assertEquals(5 + ONE_LEN + TWO_LEN, sj.length()); + assertEquals(sj.length(), sj.toString().length()); sj = new StringJoiner("||", "<", "-->"); - assertEquals(sj.length(), 4); - assertEquals(sj.toString().length(), sj.length()); + assertEquals(4, sj.length()); + assertEquals(sj.length(), sj.toString().length()); sj.add("abcdef"); - assertEquals(sj.length(), 10); - assertEquals(sj.toString().length(), sj.length()); + assertEquals(10, sj.length()); + assertEquals(sj.length(), sj.toString().length()); sj.add("xyz"); - assertEquals(sj.length(), 15); - assertEquals(sj.toString().length(), sj.length()); + assertEquals(15, sj.length()); + assertEquals(sj.length(), sj.toString().length()); } + @Test public void noAddAndEmptyValue() { StringJoiner sj = new StringJoiner(DASH, "", "").setEmptyValue(EMPTY); - assertEquals(sj.toString(), EMPTY); + assertEquals(EMPTY, sj.toString()); sj = new StringJoiner(DASH, "<..", ""); - assertEquals(sj.toString(), "<.."); + assertEquals("<..", sj.toString()); sj = new StringJoiner(DASH, "<..", ""); - assertEquals(sj.toString(), "<.."); + assertEquals("<..", sj.toString()); sj = new StringJoiner(DASH, "", "==>"); - assertEquals(sj.toString(), "==>"); + assertEquals("==>", sj.toString()); sj = new StringJoiner(DASH, "{", "}"); - assertEquals(sj.toString(), "{}"); + assertEquals("{}", sj.toString()); } - @Test(expectedExceptions = {NullPointerException.class}) + @Test public void setEmptyValueNull() { - new StringJoiner(DASH, "{", "}").setEmptyValue(null); + Assertions.assertThrows(NullPointerException.class, + () -> new StringJoiner(DASH, "{", "}").setEmptyValue(null)); } - @Test(expectedExceptions = {NullPointerException.class}) + @Test public void setDelimiterNull() { - new StringJoiner(null); + Assertions.assertThrows(NullPointerException.class, + () -> new StringJoiner(null)); } - @Test(expectedExceptions = {NullPointerException.class}) + @Test public void setPrefixNull() { - new StringJoiner(DASH, null, "}"); + Assertions.assertThrows(NullPointerException.class, + () -> new StringJoiner(DASH, null, "}")); } - @Test(expectedExceptions = {NullPointerException.class}) + @Test public void setSuffixNull() { - new StringJoiner(DASH, "{", null); + Assertions.assertThrows(NullPointerException.class, + () -> new StringJoiner(DASH, "{", null)); } + @Test public void stringFromtoString() { StringJoiner sj = new StringJoiner(", "); - assertEquals(sj.toString(), ""); + assertEquals("", sj.toString()); sj = new StringJoiner(",", "{", "}"); - assertEquals(sj.toString(), "{}"); + assertEquals("{}", sj.toString()); sj = new StringJoiner(","); sj.add(ONE); - assertEquals(sj.toString(), ONE); + assertEquals(ONE, sj.toString()); sj.add(TWO); - assertEquals(sj.toString(), ONE + "," + TWO); + assertEquals(ONE + "," + TWO, sj.toString()); sj = new StringJoiner(",", "{--", "--}"); sj.add(ONE); sj.add(TWO); - assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}"); + assertEquals("{--" + ONE + "," + TWO + "--}", sj.toString()); } + @Test public void stringFromtoStringWithEmptyValue() { StringJoiner sj = new StringJoiner(" ", "", ""); - assertEquals(sj.toString(), ""); + assertEquals("", sj.toString()); sj = new StringJoiner(", "); - assertEquals(sj.toString(), ""); + assertEquals("", sj.toString()); sj = new StringJoiner(",", "{", "}"); - assertEquals(sj.toString(), "{}"); + assertEquals("{}", sj.toString()); sj = new StringJoiner(",", "{", "}").setEmptyValue(""); - assertEquals(sj.toString(), ""); + assertEquals("", sj.toString()); sj = new StringJoiner(","); sj.add(ONE); - assertEquals(sj.toString(), ONE); + assertEquals(ONE, sj.toString()); sj.add(TWO); - assertEquals(sj.toString(), ONE + "," + TWO); + assertEquals(ONE + "," + TWO, sj.toString()); sj = new StringJoiner(",", "{--", "--}"); sj.add(ONE); - assertEquals(sj.toString(), "{--" + ONE + "--}" ); + assertEquals("{--" + ONE + "--}", sj.toString() ); sj.add(TWO); - assertEquals(sj.toString(), "{--" + ONE + "," + TWO + "--}"); + assertEquals("{--" + ONE + "," + TWO + "--}", sj.toString()); } + @Test public void toStringWithCustomEmptyValue() { StringJoiner sj = new StringJoiner(DASH, "<", ">").setEmptyValue(EMPTY); - assertEquals(sj.toString(), EMPTY); + assertEquals(EMPTY, sj.toString()); sj.add(""); - assertEquals(sj.toString(), "<>"); + assertEquals("<>", sj.toString()); sj.add(""); - assertEquals(sj.toString(), "<->"); + assertEquals("<->", sj.toString()); } private void testCombos(String infix, String prefix, String suffix) { StringJoiner sj = new StringJoiner(infix, prefix, suffix); - assertEquals(sj.toString(), prefix + suffix); - assertEquals(sj.toString().length(), sj.length()); + assertEquals(prefix + suffix, sj.toString()); + assertEquals(sj.length(), sj.toString().length()); // EmptyValue sj = new StringJoiner(infix, prefix, suffix).setEmptyValue(""); - assertEquals(sj.toString(), ""); - assertEquals(sj.toString().length(), sj.length()); + assertEquals("", sj.toString()); + assertEquals(sj.length(), sj.toString().length()); // empty in front sj.add(""); - assertEquals(sj.toString(), prefix + suffix); + assertEquals(prefix + suffix, sj.toString()); // empty in middle sj.add(""); - assertEquals(sj.toString(), prefix + infix + suffix); + assertEquals(prefix + infix + suffix, sj.toString()); sj.add("1"); - assertEquals(sj.toString(), prefix + infix + infix + "1" + suffix); + assertEquals(prefix + infix + infix + "1" + suffix, sj.toString()); // empty at end sj.add(""); - assertEquals(sj.toString(), prefix + infix + infix + "1" + infix + suffix); + assertEquals(prefix + infix + infix + "1" + infix + suffix, sj.toString()); sj = new StringJoiner(infix, prefix, suffix).setEmptyValue(""); sj.add("1"); - assertEquals(sj.toString(), prefix + "1" + suffix); + assertEquals(prefix + "1" + suffix, sj.toString()); sj.add("2"); - assertEquals(sj.toString(), prefix + "1" + infix + "2" + suffix); + assertEquals(prefix + "1" + infix + "2" + suffix, sj.toString()); sj.add(""); - assertEquals(sj.toString(), prefix + "1" + infix + "2" + infix + suffix); + assertEquals(prefix + "1" + infix + "2" + infix + suffix, sj.toString()); sj.add("3"); - assertEquals(sj.toString(), prefix + "1" + infix + "2" + infix + infix + "3" + suffix); + assertEquals(prefix + "1" + infix + "2" + infix + infix + "3" + suffix, sj.toString()); } + @Test public void testDelimiterCombinations() { testCombos("", "", ""); testCombos("", "<", ""); @@ -327,6 +349,7 @@ public void testDelimiterCombinations() { testCombos(",", "<", ">"); } + @Test public void OOM1() { try { new StringJoiner(MAX_STRING, MAX_STRING, MAX_STRING).toString(); @@ -336,6 +359,7 @@ public void OOM1() { } } + @Test public void OOM2() { try { new StringJoiner(MAX_STRING, MAX_STRING, "").toString(); @@ -345,6 +369,7 @@ public void OOM2() { } } + @Test public void OOM3() { try { new StringJoiner(MAX_STRING, "", MAX_STRING).toString(); @@ -354,6 +379,7 @@ public void OOM3() { } } + @Test public void OOM4() { try { new StringJoiner("", MAX_STRING, MAX_STRING).toString(); diff --git a/test/jdk/java/util/TimeZone/NegativeDSTTest.java b/test/jdk/java/util/TimeZone/NegativeDSTTest.java index eb46b8d4b29f..ab9438f23887 100644 --- a/test/jdk/java/util/TimeZone/NegativeDSTTest.java +++ b/test/jdk/java/util/TimeZone/NegativeDSTTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.Instant; import java.time.LocalDate; @@ -31,18 +31,19 @@ import java.util.Date; import java.util.TimeZone; -import org.testng.annotations.Test; -import org.testng.annotations.DataProvider; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * @test * @bug 8212970 8324065 * @summary Test whether the savings are positive in time zones that have * negative savings in the source TZ files. - * @run testng NegativeDSTTest + * @run junit NegativeDSTTest */ -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class NegativeDSTTest { private static final TimeZone DUBLIN = TimeZone.getTimeZone("Europe/Dublin"); @@ -51,7 +52,6 @@ public class NegativeDSTTest { private static final TimeZone CASABLANCA = TimeZone.getTimeZone("Africa/Casablanca"); private static final int ONE_HOUR = 3600_000; - @DataProvider private Object[][] negativeDST () { return new Object[][] { // TimeZone, localDate, offset, isDaylightSavings @@ -88,10 +88,11 @@ private Object[][] negativeDST () { }; } - @Test(dataProvider="negativeDST") + @ParameterizedTest + @MethodSource("negativeDST") public void test_NegativeDST(TimeZone tz, LocalDate ld, int offset, boolean isDST) { Date d = Date.from(Instant.from(ZonedDateTime.of(ld, LocalTime.MIN, tz.toZoneId()))); - assertEquals(tz.getOffset(d.getTime()), offset); - assertEquals(tz.inDaylightTime(d), isDST); + assertEquals(offset, tz.getOffset(d.getTime())); + assertEquals(isDST, tz.inDaylightTime(d)); } } diff --git a/test/jdk/java/util/TimeZone/TimeZoneData/VERSION b/test/jdk/java/util/TimeZone/TimeZoneData/VERSION index 2f72d7dbcb24..7ae8c6f5c484 100644 --- a/test/jdk/java/util/TimeZone/TimeZoneData/VERSION +++ b/test/jdk/java/util/TimeZone/TimeZoneData/VERSION @@ -1 +1 @@ -tzdata2026a +tzdata2026b diff --git a/test/jdk/java/util/TimeZone/ZoneIdRoundTripTest.java b/test/jdk/java/util/TimeZone/ZoneIdRoundTripTest.java index 0f1eeb883287..16e24f7cb276 100644 --- a/test/jdk/java/util/TimeZone/ZoneIdRoundTripTest.java +++ b/test/jdk/java/util/TimeZone/ZoneIdRoundTripTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,20 +25,20 @@ import java.time.ZoneOffset; import java.util.TimeZone; -import org.testng.annotations.Test; -import org.testng.annotations.DataProvider; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** * @test * @bug 8285844 * @summary Checks round-trips between TimeZone and ZoneId are consistent - * @run testng ZoneIdRoundTripTest + * @run junit ZoneIdRoundTripTest */ -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ZoneIdRoundTripTest { - @DataProvider private Object[][] testZoneIds() { return new Object[][] { {ZoneId.of("Z"), 0}, @@ -60,11 +60,12 @@ private Object[][] testZoneIds() { }; } - @Test(dataProvider="testZoneIds") + @ParameterizedTest + @MethodSource("testZoneIds") public void test_ZoneIdRoundTrip(ZoneId zid, int offset) { var tz = TimeZone.getTimeZone(zid); - assertEquals(tz.getRawOffset(), offset); - assertEquals(tz.toZoneId().normalized(), zid.normalized()); + assertEquals(offset, tz.getRawOffset()); + assertEquals(zid.normalized(), tz.toZoneId().normalized()); } } diff --git a/test/jdk/java/util/Vector/ArrayManagement.java b/test/jdk/java/util/Vector/ArrayManagement.java index ce4e695487c8..c1fa6d1c9bcb 100644 --- a/test/jdk/java/util/Vector/ArrayManagement.java +++ b/test/jdk/java/util/Vector/ArrayManagement.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. * Copyright 2016 Google, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -25,7 +26,7 @@ * @test * @bug 8148174 * @summary brittle white box test of internal array management - * @run testng ArrayManagement + * @run junit ArrayManagement */ import java.lang.reflect.Field; @@ -35,8 +36,8 @@ import java.util.List; import java.util.SplittableRandom; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; public class ArrayManagement { @@ -61,9 +62,9 @@ public void ensureCapacity(int minCapacity) { super.ensureCapacity(minCapacity); assertTrue(capacity() >= minCapacity); if (minCapacity <= oldCapacity) - assertEquals(capacity(), oldCapacity); + assertEquals(oldCapacity, capacity()); if (minCapacity > 0) - assertEquals(modCount(), oldModCount + 1); + assertEquals(oldModCount + 1, modCount()); } } @@ -89,117 +90,117 @@ static void addOneElement(PublicVector list) { case 3: assertTrue(list.addAll(size, singletonList())); break; default: throw new AssertionError(); } - assertEquals(list.modCount(), modCount + 1); - assertEquals(list.size(), size + 1); + assertEquals(modCount + 1, list.modCount()); + assertEquals(size + 1, list.size()); } @Test public void defaultCapacity() { PublicVector list = new PublicVector<>(); - assertEquals(new PublicVector().capacity(), DEFAULT_CAPACITY); + assertEquals(DEFAULT_CAPACITY, new PublicVector().capacity()); for (int i = 0; i < DEFAULT_CAPACITY; i++) { addOneElement(list); - assertEquals(list.capacity(), DEFAULT_CAPACITY); + assertEquals(DEFAULT_CAPACITY, list.capacity()); } addOneElement(list); - assertEquals(list.capacity(), newCapacity(DEFAULT_CAPACITY)); + assertEquals(newCapacity(DEFAULT_CAPACITY), list.capacity()); } @Test public void defaultCapacityEnsureCapacity() { PublicVector list = new PublicVector<>(); for (int i = 0; i <= DEFAULT_CAPACITY; i++) { list.ensureCapacity(i); // no-op! - assertEquals(list.capacity(), DEFAULT_CAPACITY); + assertEquals(DEFAULT_CAPACITY, list.capacity()); } for (int i = 0; i < DEFAULT_CAPACITY; i++) { addOneElement(list); - assertEquals(list.capacity(), DEFAULT_CAPACITY); + assertEquals(DEFAULT_CAPACITY, list.capacity()); } addOneElement(list); - assertEquals(list.capacity(), newCapacity(DEFAULT_CAPACITY)); + assertEquals(newCapacity(DEFAULT_CAPACITY), list.capacity()); { int capacity = list.capacity(); list.ensureCapacity(capacity + 1); - assertEquals(list.capacity(), newCapacity(capacity)); + assertEquals(newCapacity(capacity), list.capacity()); } { int capacity = list.capacity(); list.ensureCapacity(3 * capacity); - assertEquals(list.capacity(), 3 * capacity); + assertEquals(3 * capacity, list.capacity()); } } @Test public void ensureCapacityBeyondDefaultCapacity() { PublicVector list = new PublicVector<>(); list.ensureCapacity(DEFAULT_CAPACITY + 1); - assertEquals(list.capacity(), newCapacity(DEFAULT_CAPACITY)); + assertEquals(newCapacity(DEFAULT_CAPACITY), list.capacity()); } @Test public void explicitZeroCapacity() { PublicVector list = new PublicVector<>(0); - assertEquals(list.capacity(), 0); + assertEquals(0, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 1); + assertEquals(1, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 2); + assertEquals(2, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 4); + assertEquals(4, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 4); + assertEquals(4, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 8); + assertEquals(8, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 8); + assertEquals(8, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 8); + assertEquals(8, list.capacity()); list.clear(); - assertEquals(list.capacity(), 8); + assertEquals(8, list.capacity()); } @Test public void explicitZeroCapacityWithCapacityIncrement() { PublicVector list = new PublicVector<>(0, 2); - assertEquals(list.capacity(), 0); + assertEquals(0, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 2); + assertEquals(2, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 2); + assertEquals(2, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 4); + assertEquals(4, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 4); + assertEquals(4, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 6); + assertEquals(6, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 6); + assertEquals(6, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), 8); + assertEquals(8, list.capacity()); list.clear(); - assertEquals(list.capacity(), 8); + assertEquals(8, list.capacity()); } @Test public void explicitLargeCapacity() { int n = DEFAULT_CAPACITY * 3; PublicVector list = new PublicVector<>(n); - assertEquals(list.capacity(), n); + assertEquals(n, list.capacity()); list.ensureCapacity(0); list.ensureCapacity(n); for (int i = 0; i < n; i++) addOneElement(list); - assertEquals(list.capacity(), n); + assertEquals(n, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), newCapacity(n)); + assertEquals(newCapacity(n), list.capacity()); } @Test public void explicitLargeCapacityWithCapacityIncrement() { int n = DEFAULT_CAPACITY * 3; PublicVector list = new PublicVector<>(n, 2); - assertEquals(list.capacity(), n); + assertEquals(n, list.capacity()); list.ensureCapacity(0); list.ensureCapacity(n); for (int i = 0; i < n; i++) addOneElement(list); - assertEquals(list.capacity(), n); + assertEquals(n, list.capacity()); addOneElement(list); - assertEquals(list.capacity(), n + 2); + assertEquals(n + 2, list.capacity()); } @Test public void emptyArraysAreNotShared() { diff --git a/test/jdk/java/util/logging/LoggingDeadlock2.java b/test/jdk/java/util/logging/LoggingDeadlock2.java index e8a0bb49d87d..dbb804940e2a 100644 --- a/test/jdk/java/util/logging/LoggingDeadlock2.java +++ b/test/jdk/java/util/logging/LoggingDeadlock2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -309,7 +309,7 @@ private static ProcessResults run(Process p) { errAccumulator.join(); out = outAccumulator.result(); - err = errAccumulator.result(); + err = errAccumulator.result().replaceAll(".* VM warning:.* deprecated.*\\R", ""); } catch (Throwable t) { throwable = t; } diff --git a/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java b/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java new file mode 100644 index 000000000000..12c98c951104 --- /dev/null +++ b/test/jdk/javax/accessibility/JSpinner/CustomSpinnerAccessibilityTest.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.GridLayout; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JSpinner; +import javax.swing.SpinnerListModel; + +/* + * @test + * @bug 8286258 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @requires (os.family == "mac") + * @summary Checks that JSpinner with custom model announces + * the value every time it is changed + * @run main/manual CustomSpinnerAccessibilityTest + */ + +public class CustomSpinnerAccessibilityTest extends JPanel { + private static final String INSTRUCTIONS = """ + 1. Turn on VoiceOver + 2. In the window named "Test UI" click on the text editor inside the + spinner component + 3. Using up and down arrows change current month + 4. Wait for the VoiceOver to finish speaking + 5. Repeat steps 3 and 4 couple more times + + If every time value of the spinner is changed VoiceOver + announces the new value click "Pass". + If instead the value is narrated only partially + and the new value is never fully narrated press "Fail". + """; + + public CustomSpinnerAccessibilityTest() { + super(new GridLayout(0, 2)); + String[] monthStrings = new java.text.DateFormatSymbols().getMonths(); + int lastIndex = monthStrings.length - 1; + if (monthStrings[lastIndex] == null + || monthStrings[lastIndex].length() <= 0) { + String[] tmp = new String[lastIndex]; + System.arraycopy(monthStrings, 0, + tmp, 0, lastIndex); + monthStrings = tmp; + } + + SpinnerListModel model = new SpinnerListModel(monthStrings); + JLabel label = new JLabel("Month: "); + add(label); + JSpinner spinner = new JSpinner(model); + label.setLabelFor(spinner); + add(spinner); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Custom Spinner Accessibility Test") + .instructions(INSTRUCTIONS) + .testUI(CustomSpinnerAccessibilityTest::new) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/javax/imageio/ReadAbortTest.java b/test/jdk/javax/imageio/ReadAbortTest.java index 7476dbe0de85..bda17aa42046 100644 --- a/test/jdk/javax/imageio/ReadAbortTest.java +++ b/test/jdk/javax/imageio/ReadAbortTest.java @@ -30,16 +30,17 @@ * calling IIOReadProgressListener.readAborted() for all readers. * @run main ReadAbortTest */ +import java.awt.Color; +import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; +import java.nio.file.Files; import java.util.Iterator; + import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.event.IIOReadProgressListener; import javax.imageio.stream.ImageInputStream; -import java.awt.Color; -import java.awt.Graphics2D; -import java.nio.file.Files; public class ReadAbortTest implements IIOReadProgressListener { @@ -103,7 +104,9 @@ public ReadAbortTest(String format) throws Exception { } catch (Exception e) { throw e; } finally { - Files.delete(file.toPath()); + if (file != null && file.exists()) { + Files.delete(file.toPath()); + } } } diff --git a/test/jdk/javax/imageio/WriteAbortTest.java b/test/jdk/javax/imageio/WriteAbortTest.java index 624ce16c94e4..43abd703d7da 100644 --- a/test/jdk/javax/imageio/WriteAbortTest.java +++ b/test/jdk/javax/imageio/WriteAbortTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,15 +30,16 @@ * calling IIOWriteProgressListener.readAborted() for all readers. * @run main WriteAbortTest */ -import java.awt.image.BufferedImage; -import java.io.File; -import javax.imageio.ImageIO; -import javax.imageio.stream.ImageInputStream; import java.awt.Color; import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; import java.nio.file.Files; + +import javax.imageio.ImageIO; import javax.imageio.ImageWriter; import javax.imageio.event.IIOWriteProgressListener; +import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageOutputStream; public class WriteAbortTest implements IIOWriteProgressListener { @@ -98,7 +99,9 @@ public WriteAbortTest(String format) throws Exception { + format); } } finally { - Files.delete(file.toPath()); + if (file != null && file.exists()) { + Files.delete(file.toPath()); + } } } diff --git a/test/jdk/javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java b/test/jdk/javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java new file mode 100644 index 000000000000..2def2f69d6e9 --- /dev/null +++ b/test/jdk/javax/net/ssl/HttpsURLConnection/SubjectAltNameIP.java @@ -0,0 +1,379 @@ +/* + * 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 8369950 + * @summary Test that the HttpsURLConnection does not set IP address literals for + * SNI hostname during TLS handshake + * @library /test/lib + * @modules java.base/sun.net.util + * @comment Insert -Djavax.net.debug=all into the following lines to enable SSL debugging + * @run main/othervm SubjectAltNameIP 127.0.0.1 + * @run main/othervm SubjectAltNameIP [::1] + */ + +import javax.net.ssl.HandshakeCompletedListener; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLParameters; +import javax.net.ssl.SSLServerSocket; +import javax.net.ssl.SSLServerSocketFactory; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.net.InetAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.URI; +import java.util.concurrent.CountDownLatch; +import java.util.function.Consumer; + +import jdk.test.lib.Asserts; +import jdk.test.lib.net.IPSupport; +import jdk.test.lib.net.SimpleSSLContext; +import jtreg.SkippedException; +import sun.net.util.IPAddressUtil; + +public class SubjectAltNameIP { + + // Is the server ready to serve? + private final CountDownLatch serverReady = new CountDownLatch(1); + + // Use any free port by default. + volatile int serverPort = 0; + + // Stores an exception thrown by server in a separate thread. + volatile Exception serverException = null; + + // SSLSocket object created by HttpsClient internally. + SSLSocket clientSSLSocket = null; + + // The hostname the server socket is bound to. + String hostName; + + static final byte[] requestEnd = new byte[] {'\r', '\n', '\r', '\n' }; + + // Read until the end of the request. + void readOneRequest(InputStream is) throws IOException { + int requestEndCount = 0, r; + while ((r = is.read()) != -1) { + if (r == requestEnd[requestEndCount]) { + requestEndCount++; + if (requestEndCount == 4) { + break; + } + } else { + requestEndCount = 0; + } + } + } + + /* + * Define the server side of the test. + * + * If the server prematurely exits, serverReady will be set to true + * to avoid infinite hangs. + */ + void doServerSide() throws Exception { + SSLServerSocketFactory sslssf = + new SimpleSSLContext().get().getServerSocketFactory(); + SSLServerSocket sslServerSocket = + (SSLServerSocket) sslssf.createServerSocket( + serverPort, 0, + InetAddress.getByName(hostName)); + sslServerSocket.setEnabledProtocols(new String[]{"TLSv1.3"}); + serverPort = sslServerSocket.getLocalPort(); + + /* + * Signal the client, the server is ready to accept connection. + */ + serverReady.countDown(); + + SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept(); + OutputStream sslOS = sslSocket.getOutputStream(); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(sslOS)); + bw.write("HTTP/1.1 200 OK\r\n\r\n"); + bw.flush(); + readOneRequest(sslSocket.getInputStream()); + sslSocket.close(); + } + + /* + * Define the client side of the test. + * + * If the server prematurely exits, serverReady will be set to true + * to avoid infinite hangs. + */ + void doClientSide() throws Exception { + + /* + * Wait for server to get started. + */ + serverReady.await(); + if (serverException != null) { + throw new RuntimeException("Server failed to start.", serverException); + } + + SSLSocketFactory sf = new SimpleSSLContext().get().getSocketFactory(); + URI uri = new URI("https://" + hostName + ":" + serverPort + "/index.html"); + HttpsURLConnection conn = (HttpsURLConnection)uri.toURL().openConnection(); + + /* + * Simulate an external JSSE implementation and store the client SSLSocket + * used internally. + */ + conn.setSSLSocketFactory(wrapSocketFactory(sf, + sslSocket -> { + Asserts.assertEquals(null, clientSSLSocket, "clientSSLSocket is"); + clientSSLSocket = sslSocket; + })); + conn.getInputStream(); + + var sniSN = clientSSLSocket.getSSLParameters().getServerNames(); + if (sniSN != null && !sniSN.isEmpty()) { + throw new RuntimeException("SNI server name '" + + sniSN.getFirst() + "' must not be set."); + } + + if (conn.getResponseCode() == -1) { + throw new RuntimeException("getResponseCode() returns -1"); + } + } + + public static void main(String[] args) throws Exception { + + if (IPAddressUtil.isIPv6LiteralAddress(args[0]) && !IPSupport.hasIPv6()) { + throw new SkippedException("Skipping test - IPv6 is not supported"); + } + /* + * Start the tests. + */ + new SubjectAltNameIP(args[0]); + } + + Thread serverThread = null; + + /* + * Primary constructor, used to drive remainder of the test. + * + * Fork off the other side, then do your work. + */ + SubjectAltNameIP(String host) throws Exception { + hostName = host; + startServer(); + doClientSide(); + + /* + * Wait for other side to close down. + */ + serverThread.join(); + + if (serverException != null) + throw serverException; + } + + void startServer() { + serverThread = new Thread(() -> { + try { + doServerSide(); + } catch (Exception e) { + /* + * Our server thread just died. + * + * Store the exception and release the client. + */ + serverException = e; + serverReady.countDown(); + } + }); + serverThread.start(); + } + + /* + * Wraps SSLSocketImpl to simulate a different JSSE implementation + */ + private static SSLSocketFactory wrapSocketFactory(final SSLSocketFactory wrap, final Consumer store) { + return new SSLSocketFactory() { + @Override + public String[] getDefaultCipherSuites() { + return wrap.getDefaultCipherSuites(); + } + @Override + public String[] getSupportedCipherSuites() { + return wrap.getSupportedCipherSuites(); + } + @Override + public Socket createSocket(Socket s, String host, int port, boolean autoClose) + throws IOException { + final SSLSocket so = + (SSLSocket) wrap.createSocket(s, host, port, autoClose); + + // store the underlying SSLSocket for later use + store.accept(so); + + return new SSLSocket() { + @Override + public void connect(SocketAddress endpoint, + int timeout) throws IOException { + so.connect(endpoint, timeout); + } + @Override + public String[] getSupportedCipherSuites() { + return so.getSupportedCipherSuites(); + } + @Override + public String[] getEnabledCipherSuites() { + return so.getEnabledCipherSuites(); + } + @Override + public void setEnabledCipherSuites(String[] suites) { + so.setEnabledCipherSuites(suites); + } + @Override + public String[] getSupportedProtocols() { + return so.getSupportedProtocols(); + } + @Override + public String[] getEnabledProtocols() { + return so.getEnabledProtocols(); + } + @Override + public void setEnabledProtocols(String[] protocols) { + so.setEnabledProtocols(protocols); + } + @Override + public SSLSession getSession() { + return so.getSession(); + } + @Override + public SSLSession getHandshakeSession() { + return so.getHandshakeSession(); + } + @Override + public void addHandshakeCompletedListener(HandshakeCompletedListener listener) { + so.addHandshakeCompletedListener(listener); + } + @Override + public void removeHandshakeCompletedListener(HandshakeCompletedListener listener) { + so.removeHandshakeCompletedListener(listener); + } + @Override + public void startHandshake() throws IOException { + so.startHandshake(); + } + @Override + public void setUseClientMode(boolean mode) { + so.setUseClientMode(mode); + } + @Override + public boolean getUseClientMode() { + return so.getUseClientMode(); + } + @Override + public void setNeedClientAuth(boolean need) { + } + @Override + public boolean getNeedClientAuth() { + return false; + } + @Override + public void setWantClientAuth(boolean want) { + } + @Override + public boolean getWantClientAuth() { + return false; + } + @Override + public void setEnableSessionCreation(boolean flag) { + so.setEnableSessionCreation(flag); + } + @Override + public boolean getEnableSessionCreation() { + return so.getEnableSessionCreation(); + } + @Override + public void close() throws IOException { + so.close(); + } + @Override + public boolean isClosed() { + return so.isClosed(); + } + @Override + public void shutdownInput() throws IOException { + so.shutdownInput(); + } + @Override + public boolean isInputShutdown() { + return so.isInputShutdown(); + } + @Override + public void shutdownOutput() throws IOException { + so.shutdownOutput(); + } + @Override + public boolean isOutputShutdown() { + return so.isOutputShutdown(); + } + @Override + public InputStream getInputStream() throws IOException { + return so.getInputStream(); + } + @Override + public OutputStream getOutputStream() throws IOException { + return so.getOutputStream(); + } + @Override + public SSLParameters getSSLParameters() { + return so.getSSLParameters(); + } + @Override + public void setSSLParameters(SSLParameters params) { + so.setSSLParameters(params); + } + }; + } + @Override + public Socket createSocket(String h, int p) { + return null; + } + @Override + public Socket createSocket(String h, int p, InetAddress ipa, int lp) { + return null; + } + @Override + public Socket createSocket(InetAddress h, int p) { + return null; + } + @Override + public Socket createSocket(InetAddress a, int p, InetAddress l, int lp) { + return null; + } + }; + } +} diff --git a/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java b/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java index 0e34f4865ab8..16e009ed5895 100644 --- a/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java +++ b/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java @@ -107,5 +107,10 @@ protected void runClientApplication(SSLSocket socket) throws Exception { throw new Exception( "Server record plaintext exceeds 2^14 octets: " + extra); } + + int drained = 1; + while (drained < appData.length) { + drained += sslIS.read(appData, drained, appData.length - drained); + } } } diff --git a/test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java b/test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java index 79476cbb81eb..eb6ecbb12b82 100644 --- a/test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java +++ b/test/jdk/javax/net/ssl/TLSCommon/interop/JdkClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ import java.net.InetSocketAddress; import java.net.SocketException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.net.ssl.SNIHostName; @@ -86,6 +87,16 @@ protected void configClientSocket(Builder builder) throws SocketException { if (builder.getAppProtocols() != null) { sslParams.setApplicationProtocols(builder.getAppProtocols()); } + + NamedGroup[] namedGroups = builder.getNamedGroups(); + if (namedGroups != null + && namedGroups.length > 0) { + String[] namedGroupStrs = Arrays.stream(namedGroups) + .map(NamedGroup::name) + .toArray(String[]::new); + sslParams.setNamedGroups(namedGroupStrs); + } + socket.setSSLParameters(sslParams); } diff --git a/test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java b/test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java index 1521325b65ac..20bfffbac7d9 100644 --- a/test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java +++ b/test/jdk/javax/net/ssl/TLSCommon/interop/JdkServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ import java.io.IOException; -import java.net.InetAddress; import java.net.SocketException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.net.ssl.SNIHostName; @@ -85,6 +85,16 @@ protected void configServerSocket(Builder builder) throws SocketException { System.out.println("appProtocol: " + appProtocol); } } + + NamedGroup[] namedGroups = builder.getNamedGroups(); + if (namedGroups != null + && namedGroups.length > 0) { + String[] namedGroupStrs = Arrays.stream(namedGroups) + .map(NamedGroup::name) + .toArray(String[]::new); + sslParams.setNamedGroups(namedGroupStrs); + } + serverSocket.setSSLParameters(sslParams); } diff --git a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java index 0891523ac11f..51706cec9270 100644 --- a/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java +++ b/test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java @@ -190,6 +190,7 @@ protected void doServerSide() throws Exception { try { sslServerSocket.setSoTimeout(30000); sslSocket = (SSLSocket)sslServerSocket.accept(); + System.out.println("Connection established on port : " +serverPort); } catch (SocketTimeoutException ste) { // Ignore the test case if no connection within 30 seconds. System.out.println( @@ -228,6 +229,7 @@ protected void doServerSide() throws Exception { } } finally { sslSocket.close(); + System.out.println("Connection closed on port : " +serverPort); } } diff --git a/test/jdk/javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java b/test/jdk/javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java index 27290738a0cc..afac39b83fbf 100644 --- a/test/jdk/javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java +++ b/test/jdk/javax/sound/midi/MidiDeviceConnectors/TestAllDevices.java @@ -24,6 +24,7 @@ /** * @test * @bug 4933700 + * @key sound * @summary Tests that default devices return MidiDeviceTransmitter/Receiver and returned objects return correct MidiDevice * @compile TestAllDevices.java * @run main TestAllDevices diff --git a/test/jdk/javax/sound/midi/Sequencer/Looping.java b/test/jdk/javax/sound/midi/Sequencer/Looping.java index 9bcc9254653d..9a5a89c64723 100644 --- a/test/jdk/javax/sound/midi/Sequencer/Looping.java +++ b/test/jdk/javax/sound/midi/Sequencer/Looping.java @@ -36,7 +36,7 @@ * @test * @bug 4204105 * @summary RFE: add loop() method(s) to Sequencer - * @key intermittent + * @key sound */ public class Looping { diff --git a/test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java b/test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java index 2a33d28b3f53..e258b4cb53ad 100644 --- a/test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java +++ b/test/jdk/javax/sound/midi/SysexMessage/SendRawSysexMessage.java @@ -35,6 +35,7 @@ /** * @test * @bug 8237495 8301310 + * @key sound * @summary fail with memory errors when asked to send a sysex message starting * with 0xF7 */ diff --git a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java index efb57eeeae2d..05ba16cded56 100644 --- a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java +++ b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/ExpectedNPEOnNull.java @@ -32,6 +32,7 @@ /** * @test * @bug 8143909 + * @key sound * @author Sergey Bylokhov */ public final class ExpectedNPEOnNull { diff --git a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java index 8eabb992bca9..71d27c4943c0 100644 --- a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java +++ b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/FakeInfo.java @@ -35,6 +35,7 @@ /** * @test * @bug 8059743 + * @key sound * @summary MidiDeviceProvider shouldn't returns incorrect results in case of * some unknown MidiDevice.Info * @author Sergey Bylokhov diff --git a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java index 685a5e8af629..5d37759fbad7 100644 --- a/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java +++ b/test/jdk/javax/sound/midi/spi/MidiDeviceProvider/UnsupportedInfo.java @@ -30,6 +30,7 @@ /** * @test * @bug 8058115 + * @key sound * @summary MidiDeviceProvider shouldn't returns incorrect results in case of * unsupported MidiDevice.Info * @author Sergey Bylokhov diff --git a/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java b/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java index 940124b244ba..ecf958d4a291 100644 --- a/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java +++ b/test/jdk/javax/sound/sampled/Clip/AutoCloseTimeCheck.java @@ -39,6 +39,7 @@ /** * @test + * @key sound * @bug 8202264 */ public final class AutoCloseTimeCheck { diff --git a/test/jdk/javax/sound/sampled/Clip/IsRunningHang.java b/test/jdk/javax/sound/sampled/Clip/IsRunningHang.java index c417c5ad8d0b..8ffd760b08ac 100644 --- a/test/jdk/javax/sound/sampled/Clip/IsRunningHang.java +++ b/test/jdk/javax/sound/sampled/Clip/IsRunningHang.java @@ -36,6 +36,7 @@ /** * @test * @bug 8156169 + * @key sound * @run main/othervm/timeout=300 IsRunningHang */ public final class IsRunningHang { diff --git a/test/jdk/javax/sound/sampled/Clip/bug5070081.java b/test/jdk/javax/sound/sampled/Clip/bug5070081.java index e7bf7e30de2a..89e9d591d28d 100644 --- a/test/jdk/javax/sound/sampled/Clip/bug5070081.java +++ b/test/jdk/javax/sound/sampled/Clip/bug5070081.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,8 @@ /* * @test - * @bug 5070081 + * @key sound + * @bug 5070081 8376152 * @summary Tests that javax.sound.sampled.Clip does not loses position through * stop/start */ diff --git a/test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java b/test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java index 079a785de8bd..42e70521b2b6 100644 --- a/test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java +++ b/test/jdk/javax/sound/sampled/DataLine/LongFramePosition.java @@ -29,6 +29,7 @@ /** * @test * @bug 5049129 + * @key sound * @summary DataLine.getLongFramePosition */ public class LongFramePosition { diff --git a/test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java b/test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java index 177ebce85a01..a99caeea0552 100644 --- a/test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java +++ b/test/jdk/javax/sound/sampled/DirectAudio/bug6372428.java @@ -31,6 +31,7 @@ /* * @test * @bug 6372428 + * @key sound * @summary playback and capture doesn't interrupt after terminating thread that * calls start() * @run main bug6372428 diff --git a/test/jdk/javax/swing/AbstractButton/bug4133768.java b/test/jdk/javax/swing/AbstractButton/bug4133768.java new file mode 100644 index 000000000000..4ccec98c6ec3 --- /dev/null +++ b/test/jdk/javax/swing/AbstractButton/bug4133768.java @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4133768 4363569 + * @summary Tests how button displays its icons + * @key headful + * @run main bug4133768 + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.image.BufferedImage; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.swing.AbstractButton; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; + +public class bug4133768 { + private static Icon RED; + private static Icon GREEN; + private static JFrame f; + private static AbstractButton[] buttons; + private static volatile Point buttonLocation; + private static volatile int buttonWidth; + private static volatile int buttonHeight; + private static Robot robot; + private static int ROLLOVER_Y_OFFSET = 4; + private static CountDownLatch frameGainedFocusLatch = + new CountDownLatch(1); + + public static void main(String[] args) throws Exception { + try { + createTestImages(); + createUI(); + f.requestFocus(); + if (!frameGainedFocusLatch.await(5, TimeUnit.SECONDS)) { + throw new RuntimeException("Waited too long, but can't gain" + + " focus for frame"); + } + robot = new Robot(); + for (AbstractButton b : buttons) { + testEnabledButton(b); + } + for (AbstractButton b : buttons) { + b.setEnabled(false); + robot.delay(1000); + testDisabledButton(b); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static void createTestImages() { + int imageWidth = 100; + int imageHeight = 100; + BufferedImage redImg = new BufferedImage(imageWidth, imageHeight, + BufferedImage.TYPE_INT_RGB); + Graphics2D g = redImg.createGraphics(); + g.setColor(Color.RED); + g.fillRect(0, 0, imageWidth, imageHeight); + g.dispose(); + RED = new ImageIcon(redImg); + BufferedImage greenImg = new BufferedImage(imageWidth, imageHeight, + BufferedImage.TYPE_INT_RGB); + g = greenImg.createGraphics(); + g.setColor(Color.GREEN); + g.fillRect(0, 0, imageWidth, imageHeight); + g.dispose(); + GREEN = new ImageIcon(greenImg); + } + + private static void createUI() throws Exception { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("ButtonIconsTest"); + buttons = new AbstractButton[] { + new JToggleButton(), + new JRadioButton(), + new JCheckBox() + }; + + JPanel buttonPanel = new JPanel(); + for (int i = 0; i < buttons.length; i++) { + AbstractButton b = buttons[i]; + b.setIcon(RED); + b.setSelected(true); + b.setRolloverSelectedIcon(GREEN); + buttonPanel.add(b); + } + f.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + frameGainedFocusLatch.countDown(); + } + }); + f.setLayout(new GridLayout(2, 1)); + f.add(buttonPanel); + f.pack(); + f.setLocationRelativeTo(null); + f.setAlwaysOnTop(true); + f.setVisible(true); + }); + } + + private static void testEnabledButton(AbstractButton button) + throws Exception { + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + buttonLocation = button.getLocationOnScreen(); + buttonWidth = button.getWidth(); + buttonHeight = button.getHeight(); + }); + robot.mouseMove(buttonLocation.x + buttonWidth / 2, + buttonLocation.y + ROLLOVER_Y_OFFSET); + robot.delay(1000); + Color buttonColor = robot.getPixelColor(buttonLocation.x + + buttonWidth / 2, buttonLocation.y + buttonHeight / 2); + if (!buttonColor.equals(Color.GREEN)) { + throw new RuntimeException("Button roll over color is : " + + buttonColor + " but it should be : " + Color.GREEN); + } + } + + private static void testDisabledButton(AbstractButton button) + throws Exception { + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + buttonLocation = button.getLocationOnScreen(); + buttonWidth = button.getWidth(); + buttonHeight = button.getHeight(); + }); + robot.delay(200); + Color buttonColor = robot.getPixelColor(buttonLocation.x + + buttonWidth / 2, buttonLocation.y + buttonHeight / 2); + if (buttonColor.equals(Color.GREEN) || + buttonColor.equals(Color.RED)) { + throw new RuntimeException("Disabled button color should not be : " + + buttonColor); + } + } +} diff --git a/test/jdk/javax/swing/AbstractButton/bug4391622.java b/test/jdk/javax/swing/AbstractButton/bug4391622.java new file mode 100644 index 000000000000..7d3e8588f175 --- /dev/null +++ b/test/jdk/javax/swing/AbstractButton/bug4391622.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.image.BufferedImage; +import java.io.IOException; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JToolBar; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4391622 + * @summary The toolbar's button which is added as action should ignore text + * @key headful + * @run main bug4391622 + */ + +public class bug4391622 { + private static Icon RED, GREEN; + private static JButton bt; + private static JFrame f; + private static volatile Point buttonLocation; + private static volatile int buttonWidth; + private static volatile int buttonHeight; + + public static void main(String[] args) throws Exception { + try { + createTestImages(); + createUI(); + runTest(); + verifyTest(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static void createTestImages() throws IOException { + int imageWidth = 32; + int imageHeight = 32; + BufferedImage redImg = new BufferedImage(imageWidth, imageHeight, + BufferedImage.TYPE_INT_RGB); + Graphics2D g = redImg.createGraphics(); + g.setColor(Color.RED); + g.fillRect(0, 0, imageWidth, imageHeight); + g.dispose(); + RED = new ImageIcon(redImg); + BufferedImage greenImg = new BufferedImage(imageWidth, imageHeight, + BufferedImage.TYPE_INT_RGB); + g = greenImg.createGraphics(); + g.setColor(Color.GREEN); + g.fillRect(0, 0, imageWidth, imageHeight); + g.dispose(); + GREEN = new ImageIcon(greenImg); + } + + private static void createUI() throws Exception { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("bug4391622"); + Action changeIt = new ChangeIt(); + + JToolBar toolbar = new JToolBar(); + bt = toolbar.add(changeIt); + f.add(bt); + f.pack(); + f.setLocationRelativeTo(null); + f.setVisible(true); + }); + } + + private static void runTest() throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(500); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + buttonLocation = bt.getLocationOnScreen(); + buttonWidth = bt.getWidth(); + buttonHeight = bt.getHeight(); + }); + robot.mouseMove(buttonLocation.x + buttonWidth / 2, + buttonLocation.y + buttonHeight / 2 ); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + } + + private static void verifyTest() { + if (bt.getText() != null) { + throw new RuntimeException("The toolbar's button shouldn't" + + " have any text."); + } + } + + public static class ChangeIt extends AbstractAction { + private boolean c = true; + + public ChangeIt() { + putValue(Action.NAME, "Red"); + putValue(Action.SMALL_ICON, RED); + } + + public void actionPerformed(ActionEvent event) { + c = !c; + putValue(Action.NAME, c ? "Red" : "Green"); + putValue(Action.SMALL_ICON, c ? RED : GREEN); + } + } +} diff --git a/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java b/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java new file mode 100644 index 000000000000..5b21c07f71e3 --- /dev/null +++ b/test/jdk/javax/swing/JButton/SwingButtonResizeTestWithOpenGL.java @@ -0,0 +1,352 @@ +/* + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.Raster; +import java.io.File; +import java.io.IOException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import javax.imageio.ImageIO; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 8338103 + * @key headful + * @summary Verifies that the OpenGL pipeline does not create artifacts + * with swing components after window is zoomed to maximum size and then + * resized back to normal. The test case simulates this operation using + * a JButton. A file image of the component will be saved before and after + * the window resize if the test fails. The test passes if both the button + * images are the same. + * @run main/othervm -Dsun.java2d.opengl=true -Dsun.java2d.opengl.fbobject=false SwingButtonResizeTestWithOpenGL + * @run main/othervm -Dsun.java2d.opengl=true -Dsun.java2d.opengl.fbobject=true SwingButtonResizeTestWithOpenGL + * @run main/othervm -Dsun.java2d.opengl=false SwingButtonResizeTestWithOpenGL + * @run main/othervm SwingButtonResizeTestWithOpenGL + */ +/* + * @test + * @key headful + * @requires (os.family == "windows") + * @run main/othervm -Dsun.java2d.d3d=false SwingButtonResizeTestWithOpenGL + * @run main/othervm -Dsun.java2d.d3d=true SwingButtonResizeTestWithOpenGL + */ +/* + * @test + * @key headful + * @requires (os.family == "linux") + * @run main/othervm -Dsun.java2d.xrender=false SwingButtonResizeTestWithOpenGL + * @run main/othervm -Dsun.java2d.xrender=true SwingButtonResizeTestWithOpenGL + */ +/* + * @test + * @key headful + * @requires (os.family == "mac") + * @run main/othervm -Dsun.java2d.metal=false SwingButtonResizeTestWithOpenGL + * @run main/othervm -Dsun.java2d.metal=true SwingButtonResizeTestWithOpenGL + */ +public class SwingButtonResizeTestWithOpenGL { + private static Robot robot; + private static CountDownLatch focusGainedLatch; + private JFrame frame; + private JButton button; + + public SwingButtonResizeTestWithOpenGL() { + + try { + SwingUtilities.invokeAndWait(() -> createGUI()); + } catch (Exception e) { + throw new RuntimeException("Problems creating GUI"); + } + } + + private void createGUI() { + frame = new JFrame("SwingButtonResizeTestWithOpenGL"); + button = new JButton("Button A"); + frame.setLocation(200, 200); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + button.setPreferredSize(new Dimension(300, 300)); + button.setFocusPainted(false); + button.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent fe) { + focusGainedLatch.countDown(); + } + }); + frame.getContentPane().setLayout(new FlowLayout()); + frame.getContentPane().add(button); + frame.pack(); + frame.setVisible(true); + frame.toFront(); + } + + public static void main(String[] args) throws Exception { + focusGainedLatch = new CountDownLatch(1); + SwingButtonResizeTestWithOpenGL test = + new SwingButtonResizeTestWithOpenGL(); + test.runTest(); + } + + public void runTest() throws Exception { + BufferedImage bimage1; + BufferedImage bimage2; + + try { + robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + if (focusGainedLatch.await(3, TimeUnit.SECONDS)) { + System.out.println("Button focus gained..."); + } else { + System.out.println("Button focus not gained..."); + throw new RuntimeException( + "Can't gain focus on button even after waiting " + + "too long.."); + } + + System.out.println("Getting initial button image..image1"); + bimage1 = getButtonImage(); + + // some platforms may not support maximize frame + if (frame.getToolkit().isFrameStateSupported( + JFrame.MAXIMIZED_BOTH)) { + // maximize frame from normal size + frame.setExtendedState(JFrame.MAXIMIZED_BOTH); + System.out.println("Frame is maximized"); + robot.waitForIdle(); + robot.delay(100); + + if (frame.getToolkit().isFrameStateSupported(JFrame.NORMAL)) { + System.out.println("Frame is back to normal"); + // resize from maximum size to normal + frame.setExtendedState(JFrame.NORMAL); + robot.waitForIdle(); + robot.delay(100); + // capture image of JButton after resize + System.out.println( + "Getting image of JButton after resize..image2"); + bimage2 = getButtonImage(); + + // compare button images from before and after frame resize + DiffImage di = new DiffImage(bimage1.getWidth(), + bimage1.getHeight()); + System.out.println( + "Taking the diff of two images, image1 and image2"); + if (!di.compare(bimage1, bimage2)) { + throw new RuntimeException( + "Button renderings are different after window " + + "resize, num of Diff Pixels=" + + di.getNumDiffPixels()); + } else { + System.out.println("Test passed..."); + } + + } else { + System.out.println( + "Test skipped: JFrame.NORMAL resize is " + + "not supported"); + } + + } else { + System.out.println( + "Test skipped: JFrame.MAXIMIZED_BOTH resize is " + + "not supported"); + } + } finally { + SwingUtilities.invokeAndWait(() -> disposeFrame()); + } + } + + // Capture button rendering as a BufferedImage + private BufferedImage getButtonImage() { + try { + robot.waitForIdle(); + robot.delay(500); + + AtomicReference buttonLocRef = new AtomicReference<>(); + SwingUtilities.invokeAndWait( + () -> buttonLocRef.set(button.getLocationOnScreen())); + Point buttonLoc = buttonLocRef.get(); + System.out.println("Button loc: " + buttonLoc); + return robot.createScreenCapture( + new Rectangle(buttonLoc.x, buttonLoc.y, button.getWidth(), + button.getHeight())); + } catch (Exception e) { + throw new RuntimeException( + "Problems capturing button image from Robot", e); + } + } + + private void disposeFrame() { + if(frame != null) { + frame.dispose(); + } + } + + // Save BufferedImage to PNG file + private void saveButtonImage(BufferedImage image, File file) { + if (image != null) { + try { + System.out.println( + "Saving button image to " + file.getAbsolutePath()); + ImageIO.write(image, "PNG", file); + } catch (Exception e) { + throw new RuntimeException("Could not write image file"); + } + } else { + throw new RuntimeException("BufferedImage was set to null"); + } + } + + private class DiffImage extends BufferedImage { + + public boolean diff = false; + public int nDiff = -1; + + Color bgColor; + + int threshold = 0; + + public DiffImage(int w, int h) { + super(w, h, BufferedImage.TYPE_INT_ARGB); + bgColor = Color.LIGHT_GRAY; + } + + public int getNumDiffPixels() { + return nDiff; + } + + public boolean compare(BufferedImage img1, BufferedImage img2) + throws IOException { + + int minx1 = img1.getMinX(); + int minx2 = img2.getMinX(); + int miny1 = img1.getMinY(); + int miny2 = img2.getMinY(); + + int w1 = img1.getWidth(); + int w2 = img2.getWidth(); + int h1 = img1.getHeight(); + int h2 = img2.getHeight(); + + if ((minx1 != minx2) || (miny1 != miny2) || (w1 != w2) + || (h1 != h2)) { + // image sizes are different + throw new RuntimeException( + "img1: <" + minx1 + "," + miny1 + "," + w1 + "x" + h1 + + ">" + " img2: " + minx2 + "," + miny2 + "," + w2 + "x" + + h2 + ">" + " are different sizes"); + } + // Get the actual data behind the images + Raster ras1 = img1.getData(); + Raster ras2 = img2.getData(); + + ColorModel cm1 = img1.getColorModel(); + ColorModel cm2 = img2.getColorModel(); + + int r1, r2; // red + int g1, g2; // green + int b1, b2; // blue + + Object o1 = null; + Object o2 = null; + nDiff = 0; + for (int x = minx1; x < (minx1 + w1); x++) { + for (int y = miny1; y < (miny1 + h1); y++) { + // Causes rasters to allocate data + o1 = ras1.getDataElements(x, y, o1); + // and we reuse the data on every loop + o2 = ras2.getDataElements(x, y, o2); + + r1 = cm1.getRed(o1); + r2 = cm2.getRed(o2); + g1 = cm1.getGreen(o1); + g2 = cm2.getGreen(o2); + b1 = cm1.getBlue(o1); + b2 = cm2.getBlue(o2); + + int redAbs = Math.abs(r1 - r2); + int greenAbs = Math.abs(g1 - g2); + int blueAbs = Math.abs(b1 - b2); + if ((redAbs > threshold) + || (greenAbs > threshold) + || (blueAbs > threshold)) { + // pixel is different + setDiffPixel(x, y, redAbs, greenAbs, blueAbs); + nDiff++; + } else { + setSamePixel(x, y); + } + + } + } + if (nDiff != 0) { + ImageIO.write(this, "png", + new File("diffImage.png")); + saveButtonImage(img1, new File("image1.png")); + saveButtonImage(img2, new File("image2.png")); + } + return nDiff == 0; + } + + void setDiffPixel(int x, int y, int r, int g, int b) { + diff = true; + setPixelValue(x, y, 255, r, g, b); + } + + void setSamePixel(int x, int y) { + if (bgColor != null) { + setPixelValue(x, y, 255, bgColor.getRed(), + bgColor.getGreen(), + bgColor.getBlue()); + } else { + setPixelValue(x, y, 255, Color.black.getRed(), + Color.black.getGreen(), Color.black.getBlue()); + } + } + + void setPixelValue(int x, int y, int a, int r, int g, int b) { + // setRGB uses BufferedImage.TYPE_INT_ARGB format + int pixel = + ((a & 0xff) << 24) + ((r & 0xff) << 16) + ((g & 0xff) << 8) + + ((b & 0xff)); + setRGB(x, y, pixel); + } + + } + +} + + diff --git a/test/jdk/javax/swing/JColorChooser/Test4234761.java b/test/jdk/javax/swing/JColorChooser/Test4234761.java index c2b2d9ed7b9b..fb55ca37feb7 100644 --- a/test/jdk/javax/swing/JColorChooser/Test4234761.java +++ b/test/jdk/javax/swing/JColorChooser/Test4234761.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, 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 @@ -23,10 +23,12 @@ /* * @test - * @key headful * @bug 4234761 + * @key headful * @summary RGB values sholdn't be changed in transition to HSB tab - * @author Oleg Mokhovikov + * @library /test/lib + * @build jtreg.SkippedException + * @run main Test4234761 */ import java.awt.Color; @@ -35,11 +37,17 @@ import javax.swing.JColorChooser; import javax.swing.JDialog; import javax.swing.JTabbedPane; +import javax.swing.UIManager; + +import jtreg.SkippedException; public class Test4234761 implements PropertyChangeListener { private static final Color COLOR = new Color(51, 51, 51); public static void main(String[] args) { + if (UIManager.getLookAndFeel().getName().contains("GTK")) { + throw new SkippedException("Test skipped for GTK"); + } JColorChooser chooser = new JColorChooser(COLOR); JDialog dialog = Test4177735.show(chooser); diff --git a/test/jdk/javax/swing/JComboBox/bug4135833.java b/test/jdk/javax/swing/JComboBox/bug4135833.java new file mode 100644 index 000000000000..3b2888c862d0 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4135833.java @@ -0,0 +1,62 @@ +/* + * 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 + * 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.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JPanel; + +/* + * @test + * @bug 4135833 + * @summary Tests that JComboBox draws correctly if the first item in list is an empty string + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4135833 + */ + +public class bug4135833 { + private static final String INSTRUCTIONS = """ + Press the combo box. If the popup is readable and appears to be sized properly, + then it passes. The First item is blank intentionally. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(bug4135833::createTestUI) + .build() + .awaitAndCheck(); + } + + public static JFrame createTestUI() { + JFrame frame = new JFrame("bug4135833"); + JPanel panel = new JPanel(); + JComboBox comboBox = new JComboBox(new Object[]{"", "Bob", "Hank", "Joe", "Fred"}); + panel.add(comboBox); + frame.add(panel); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4171819.java b/test/jdk/javax/swing/JComboBox/bug4171819.java new file mode 100644 index 000000000000..108512edf7e8 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4171819.java @@ -0,0 +1,89 @@ +/* + * 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 + * 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.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.UIManager; + +/* + * @test + * @bug 4171819 + * @summary Tests that JComboBox uses a lower bevel border in windows + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4171819 + */ + +public class bug4171819 { + static boolean lafOk = true; + + private static final String INSTRUCTIONS = """ + This test is for Windows L&F only. If you see + "No Windows L&F installed" label just press "Pass". + + Look at the combo box. If the border around it looks like it's + lowered rather than raised, it passes the test. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(bug4171819::createTestUI) + .build() + .awaitAndCheck(); + } + + public static JFrame createTestUI() { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + System.out.println("succeeded"); + } catch (Exception e) { + System.err.println("Couldn't load the Windows Look and Feel"); + lafOk = false; + } + + JFrame frame = new JFrame("bug4171819"); + JPanel panel = new JPanel(); + JComboBox comboBox; + + if (lafOk) { + comboBox = new JComboBox(new Object[]{ + "Coma Berenices", + "Triangulum", + "Camelopardis", + "Cassiopea"}); + panel.add(comboBox); + } else { + JLabel label = new JLabel("No Windows L&F installed"); + panel.add(label); + } + frame.add(panel); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4248128.java b/test/jdk/javax/swing/JComboBox/bug4248128.java new file mode 100644 index 000000000000..311cae4b61a3 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4248128.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Robot; +import java.awt.event.KeyEvent; +import javax.swing.BoxLayout; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4248128 7148092 + * @summary Tests that alt+down arrow pulls down JComboBox popup + * @key headful + * @run main bug4248128 + */ + +public class bug4248128 { + static JFrame frame; + static volatile JComboBox combo; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(250); + SwingUtilities.invokeAndWait(() -> createTestUI()); + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_ALT); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + if (!combo.isPopupVisible()) { + throw new RuntimeException("Popup did not appear."); + } + }); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createTestUI() { + frame = new JFrame("4248128 Test"); + Object[] fruits = {"Banana", "Pear", "Apple"}; + combo = new JComboBox(fruits); + frame.setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.X_AXIS)); + frame.add(combo); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4436376.java b/test/jdk/javax/swing/JComboBox/bug4436376.java new file mode 100644 index 000000000000..064efe8c9586 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4436376.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.FlowLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.awt.event.InputEvent; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4436376 + * @key headful + * @summary Tests that ComboBox items can't be deselected with Ctrl+click + * @run main bug4436376 + */ + +public class bug4436376 { + static JFrame frame; + static volatile Point p; + static volatile JComboBox combo; + + final static int SELECTED_INDEX = 2; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(250); + SwingUtilities.invokeAndWait(() -> createTestUI()); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> p = combo.getLocationOnScreen()); + robot.waitForIdle(); + + robot.mouseMove(p.x + 10, p.y + 10); + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + if (combo.getSelectedIndex() != SELECTED_INDEX) { + throw new RuntimeException("Failed: selected index has been changed"); + } + }); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createTestUI() { + frame = new JFrame("bug4436376"); + String[] items = new String[]{"One", "Two", "Three", "Four"}; + combo = new JComboBox(items); + combo.setSelectedIndex(SELECTED_INDEX); + + frame.setLayout(new FlowLayout()); + frame.add(combo); + frame.setLocationRelativeTo(null); + frame.pack(); + frame.setVisible(true); + } +} diff --git a/test/jdk/javax/swing/JEditorPane/TestBrowserBGColor.java b/test/jdk/javax/swing/JEditorPane/TestBrowserBGColor.java index bff0f7c4aaaa..9abe286a75db 100644 --- a/test/jdk/javax/swing/JEditorPane/TestBrowserBGColor.java +++ b/test/jdk/javax/swing/JEditorPane/TestBrowserBGColor.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,94 +23,79 @@ /* * @test - * @key headful * @bug 8213781 * @summary Verify webpage background color renders correctly in JEditorPane */ -import java.awt.Toolkit; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.io.File; import java.io.IOException; -import java.net.MalformedURLException; -import javax.swing.JDialog; +import java.util.Objects; +import java.util.stream.IntStream; + +import javax.imageio.ImageIO; import javax.swing.JEditorPane; -import javax.swing.JFrame; -import javax.swing.JScrollPane; -import javax.swing.SwingUtilities; -import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkListener; -import javax.swing.text.html.HTMLFrameHyperlinkEvent; -import javax.swing.text.html.HTMLDocument; -import java.awt.Color; -import java.awt.Insets; -import java.awt.Point; -import java.awt.Robot; +import javax.swing.text.StyleConstants; +import javax.swing.text.View; + +import static java.awt.image.BufferedImage.TYPE_INT_RGB; +import static java.lang.Integer.toHexString; + +public final class TestBrowserBGColor { -public class TestBrowserBGColor extends JFrame implements HyperlinkListener { + private static final String HTML_DOC = + "" + + "" + + "" + + "Title" + + " "; - private static TestBrowserBGColor b; - private static JEditorPane browser; + private static final int SIZE = 300; public static void main(final String[] args) throws Exception { - Robot r = new Robot(); - SwingUtilities.invokeAndWait(() -> { - try { - b = new TestBrowserBGColor(); - } catch (Exception e) { - throw new RuntimeException(e); - } - b.setSize(Toolkit.getDefaultToolkit().getScreenSize()); - b.setVisible(true); - b.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - b.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - b.dispose(); - b = null; - } - }); - }); + JEditorPane browser = new JEditorPane("text/html", HTML_DOC); + browser.setEditable(false); + browser.setSize(SIZE, SIZE); - r.waitForIdle(); - r.delay(500); + BufferedImage image = new BufferedImage(SIZE, SIZE, TYPE_INT_RGB); + Graphics g = image.getGraphics(); + browser.paint(g); + g.dispose(); - SwingUtilities.invokeAndWait(() -> { - Insets insets = browser.getInsets(); - Point loc = browser.getLocationOnScreen(); - Color c = r.getPixelColor( loc.x + insets.left+100, - loc.y + insets.top + 100); - b.dispose(); - if (!c.equals(Color.WHITE)) { - throw new RuntimeException("webpage background color wrong"); - } - }); + Color bgColor = StyleConstants.getBackground( + getBodyView(browser.getUI() + .getRootView(browser)) + .getAttributes()); + if (!bgColor.equals(Color.WHITE)) { + saveImage(image); + throw new RuntimeException("Wrong background color: " + + toHexString(bgColor.getRGB()) + + " vs " + + toHexString(Color.WHITE.getRGB())); + } } + private static View getBodyView(final View view) { + if ("body".equals(view.getElement() + .getName())) { + return view; + } - String htmlDoc = " Title "; - - public TestBrowserBGColor() throws IOException, MalformedURLException { - browser = new JEditorPane("text/html", htmlDoc); - browser.setEditable(false); - browser.addHyperlinkListener(this); - JScrollPane scroll = new JScrollPane(browser); - getContentPane().add(scroll); + return IntStream.range(0, view.getViewCount()) + .mapToObj(view::getView) + .map(TestBrowserBGColor::getBodyView) + .filter(Objects::nonNull) + .findFirst() + .orElse(null); } - public void hyperlinkUpdate(final HyperlinkEvent e) { - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { - JEditorPane pane = (JEditorPane) e.getSource(); - if (e instanceof HTMLFrameHyperlinkEvent) { - HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; - HTMLDocument doc = (HTMLDocument) pane.getDocument(); - doc.processHTMLFrameHyperlinkEvent(evt); - } else { - try { - pane.setPage(e.getURL()); - } catch (Throwable t) { - t.printStackTrace(); - } - } + private static void saveImage(BufferedImage image) { + try { + ImageIO.write(image, "png", + new File("html-rendering.png")); + } catch (IOException ignored) { } } } diff --git a/test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java b/test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java index f3b3ba684e6d..27f26d570bed 100644 --- a/test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java +++ b/test/jdk/javax/swing/JFileChooser/4966171/bug4966171.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,8 +50,8 @@ public static void main(String[] args) throws Exception { } private static void test() { - // Will run the test no more than 10 seconds per L&F - long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(10); + // Will run the test no more than 5 seconds per L&F + long endtime = System.nanoTime() + TimeUnit.SECONDS.toNanos(5); while (System.nanoTime() < endtime) { try { var byteOut = new ByteArrayOutputStream(); diff --git a/test/jdk/javax/swing/JFileChooser/FileSizeCheck.java b/test/jdk/javax/swing/JFileChooser/FileSizeCheck.java index 056ce38a0989..6d92032e0d13 100644 --- a/test/jdk/javax/swing/JFileChooser/FileSizeCheck.java +++ b/test/jdk/javax/swing/JFileChooser/FileSizeCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,6 @@ import java.util.Arrays; import java.util.Locale; import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Predicate; import javax.swing.AbstractButton; import javax.swing.JFileChooser; @@ -52,6 +51,8 @@ * @requires (os.family == "linux") * @summary Verifies if the size of an empty file is shown as 0.0 KB * as well as checks the displayed file sizes are rounded up + * @library /javax/swing/regtesthelpers + * @build Util * @run main FileSizeCheck */ public class FileSizeCheck { @@ -228,31 +229,15 @@ private static void clickDetails() { } private static AbstractButton findDetailsButton(final Container container) { - Component result = findComponent(container, + Component result = Util.findComponent(container, c -> c instanceof JToggleButton button && "Details".equals(button.getToolTipText())); return (AbstractButton) result; } private static JTable findTable(final Container container) { - Component result = findComponent(container, - c -> c instanceof JTable); + Component result = Util.findComponent(container, + c -> c instanceof JTable); return (JTable) result; } - - private static Component findComponent(final Container container, - final Predicate predicate) { - for (Component child : container.getComponents()) { - if (predicate.test(child)) { - return child; - } - if (child instanceof Container cont && cont.getComponentCount() > 0) { - Component result = findComponent(cont, predicate); - if (result != null) { - return result; - } - } - } - return null; - } } diff --git a/test/jdk/javax/swing/JFileChooser/bug4759934.java b/test/jdk/javax/swing/JFileChooser/bug4759934.java index 08ccdebfb2be..c7f340ccdd0b 100644 --- a/test/jdk/javax/swing/JFileChooser/bug4759934.java +++ b/test/jdk/javax/swing/JFileChooser/bug4759934.java @@ -31,10 +31,11 @@ * @run main bug4759934 */ +import java.awt.Component; +import java.awt.Container; import java.awt.Dialog; import java.awt.Point; import java.awt.Robot; -import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JDialog; @@ -72,8 +73,10 @@ public static void main(String[] args) throws Exception { robot.mouseRelease(MouseEvent.BUTTON1_DOWN_MASK); robot.delay(500); - robot.keyPress(KeyEvent.VK_ESCAPE); - robot.keyRelease(KeyEvent.VK_ESCAPE); + SwingUtilities.invokeAndWait(() -> { + JButton cancelBtn = findCancelButton(jfc); + cancelBtn.doClick(); + }); robot.delay(500); SwingUtilities.invokeAndWait(() -> { @@ -121,4 +124,11 @@ private static void createDialog() { dlg.setLocation(fr.getX() + fr.getWidth() + 10, fr.getY()); dlg.setVisible(true); } + + private static JButton findCancelButton(final Container container) { + Component result = Util.findComponent(container, + c -> c instanceof JButton button + && "Cancel".equals(button.getText())); + return (JButton) result; + } } diff --git a/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/ClientDecoratedIconTest.java b/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/ClientDecoratedIconTest.java new file mode 100644 index 000000000000..95098984f720 --- /dev/null +++ b/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/ClientDecoratedIconTest.java @@ -0,0 +1,186 @@ +/* + * 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 + * 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 6436437 + * @requires (os.family == "windows") + * @summary Test setIconImages() for client-decorated JFrame + * @library ../../regtesthelpers + * @run main/manual ClientDecoratedIconTest + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JRootPane; +import javax.swing.JTextArea; + +public class ClientDecoratedIconTest extends SwingTestHelper implements ActionListener { + JButton passed; + JButton failed; + + java.util.List icons1; + java.util.List icons2; + IconFrame frame1; + IconFrame frame2; + + Object lock = new Object(); + boolean done = false; + + protected String getInstructions() { + StringBuilder instructionsStr = new StringBuilder(); + instructionsStr.append("This tests the functionality of the setIconImages() API\n"); + instructionsStr.append("You will see two JFrames with custom icons1. Both JFrames should have the same icon: a colored box.\n"); + instructionsStr.append("If either of the JFrames has the default, coffe-cup icon, the test fails.\n"); + instructionsStr.append("If the JFrames DO NOT both have the same colored box as their icon, the test fails.\n"); + instructionsStr.append("If both JFrames DO have the same colored box as their icon, then the test passes."); + return instructionsStr.toString(); + } + + protected Component createContentPane() { + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + JTextArea instructions = new JTextArea(getInstructions()); + panel.add(instructions, BorderLayout.CENTER); + + passed = new JButton("Icons match (PASS)"); + passed.addActionListener(this); + failed = new JButton("Icons don't match (FAIL)"); + failed.addActionListener(this); + JPanel btnPanel = new JPanel(); + btnPanel.setLayout(new FlowLayout()); + btnPanel.add(passed); + btnPanel.add(failed); + panel.add(btnPanel, BorderLayout.SOUTH); + + return panel; + } + + public void onEDT10() throws IOException { + Image img1 = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); + Graphics g = img1.getGraphics(); + g.setColor(Color.green); + g.fillRect(0, 0, 16, 16); + g.dispose(); + Image img2 = new BufferedImage(24, 24, BufferedImage.TYPE_INT_ARGB); + g = img2.getGraphics(); + g.setColor(Color.magenta); + g.fillRect(0, 0, 24, 24); + g.dispose(); + Image img3 = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); + g = img3.getGraphics(); + g.setColor(Color.red); + g.fillRect(0, 0, 32, 32); + g.dispose(); + Image img4 = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); + g = img4.getGraphics(); + g.setColor(Color.blue); + g.fillRect(0, 0, 64, 64); + g.dispose(); + + icons1 = new ArrayList(4); + icons1.add(img1); + icons1.add(img2); + icons1.add(img3); + icons1.add(img4); + + icons2 = new ArrayList(4); + icons2.add(img4); + icons2.add(img3); + icons2.add(img2); + icons2.add(img1); + + frame1 = new IconFrame(icons1); + frame2 = new IconFrame(icons2); + + frame1.setLocation(50, 250); + frame2.setLocation(275, 250); + + frame1.setVisible(true); + frame2.setVisible(true); + } + + public void onEDT20() { + waitForCondition(new Runnable() { + public void run() { + while (true) { + synchronized(lock) { + if (done) { + return; + } + } + try { + Thread.sleep(250); + } + catch(InterruptedException e) {} + } + } + }); + System.out.println("done waiting"); + } + + public void onEDT30() { + // Needed so waitForCondition() has something to wait for :) + } + + public void actionPerformed(ActionEvent e) { + System.out.println("actionPerformed()"); + if (e.getSource() == passed) { + synchronized(lock) { + done = true; + } + } + if (e.getSource() == failed) { + throw new RuntimeException("Test Failed"); + } + } + + class IconFrame extends JFrame { + public IconFrame(java.util.List icons) { + super("Custom Icon Frame"); + setUndecorated(true); + getRootPane().setWindowDecorationStyle(JRootPane.FRAME); + setIconImages(icons); + setSize(200, 200); + } + } + + public static void main(String[] args) throws Throwable { + new ClientDecoratedIconTest().run(args); + System.out.println("end of main()"); + } +} diff --git a/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/DialogIconTest.java b/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/DialogIconTest.java new file mode 100644 index 000000000000..a129e38d39ab --- /dev/null +++ b/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/DialogIconTest.java @@ -0,0 +1,173 @@ +/* + * 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 + * 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 6436437 + * @requires (os.family == "windows") + * @summary Test setIconImages() for client-decorated JDialog + * @library ../../regtesthelpers + * @run main/manual DialogIconTest + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Frame; +import java.awt.Image; +import java.awt.image.BufferedImage; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JRootPane; +import javax.swing.JTextArea; + +public class DialogIconTest extends SwingTestHelper implements ActionListener { + JButton passed; + JButton failed; + + java.util.List icons1; + IconDialog dialog1; + + Object lock = new Object(); + boolean done = false; + + protected String getInstructions() { + StringBuilder instructionsStr = new StringBuilder(); + instructionsStr.append("This tests the functionality of the setIconImages() API\n"); + instructionsStr.append("You will see a client-decorated JDialog. The JDialog should have a custom icon: a solid-colored box.\n"); + instructionsStr.append("If the JDialog has a colored box for an icon, then the test passes.\n"); + instructionsStr.append("If the JDialog has the default icon, then the test fails.\n"); + return instructionsStr.toString(); + } + + protected Component createContentPane() { + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + JTextArea instructions = new JTextArea(getInstructions()); + panel.add(instructions, BorderLayout.CENTER); + + passed = new JButton("Solid-color Icon (PASS)"); + passed.addActionListener(this); + failed = new JButton("Default Icon (FAIL)"); + failed.addActionListener(this); + JPanel btnPanel = new JPanel(); + btnPanel.setLayout(new FlowLayout()); + btnPanel.add(passed); + btnPanel.add(failed); + panel.add(btnPanel, BorderLayout.SOUTH); + + return panel; + } + + public void onEDT10() throws IOException { + Image img1 = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); + Graphics g = img1.getGraphics(); + g.setColor(Color.green); + g.fillRect(0, 0, 16, 16); + g.dispose(); + Image img2 = new BufferedImage(24, 24, BufferedImage.TYPE_INT_ARGB); + g = img2.getGraphics(); + g.setColor(Color.magenta); + g.fillRect(0, 0, 24, 24); + g.dispose(); + Image img3 = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); + g = img3.getGraphics(); + g.setColor(Color.red); + g.fillRect(0, 0, 32, 32); + g.dispose(); + Image img4 = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); + g = img4.getGraphics(); + g.setColor(Color.blue); + g.fillRect(0, 0, 64, 64); + g.dispose(); + + icons1 = new ArrayList(4); + icons1.add(img1); + icons1.add(img2); + icons1.add(img3); + icons1.add(img4); + + dialog1 = new IconDialog(icons1); + dialog1.setLocation(50, 250); + dialog1.setVisible(true); + } + + public void onEDT20() { + waitForCondition(new Runnable() { + public void run() { + while (true) { + synchronized(lock) { + if (done) { + return; + } + } + try { + Thread.sleep(250); + } + catch(InterruptedException e) {} + } + } + }); + System.out.println("done waiting"); + } + + public void onEDT30() { + // Needed so waitForCondition() has something to wait for :) + } + + public void actionPerformed(ActionEvent e) { + System.out.println("actionPerformed()"); + if (e.getSource() == passed) { + synchronized(lock) { + done = true; + } + } + if (e.getSource() == failed) { + throw new RuntimeException("Test Failed"); + } + } + + class IconDialog extends JDialog { + public IconDialog(java.util.List icons) { + super((Frame)null, "Custom Icon Frame", false); + setUndecorated(true); + getRootPane().setWindowDecorationStyle(JRootPane.FRAME); + setIconImages(icons); + setSize(200, 200); + } + } + + public static void main(String[] args) throws Throwable { + new DialogIconTest().run(args); + System.out.println("end of main()"); + } +} diff --git a/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/DialogInheritIcon.java b/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/DialogInheritIcon.java new file mode 100644 index 000000000000..908f83a6af43 --- /dev/null +++ b/test/jdk/javax/swing/JFrame/ClientDecoratedIcon/DialogInheritIcon.java @@ -0,0 +1,71 @@ +/* + * 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 + * 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 6425606 + * @requires (os.family == "windows") + * @summary Test JDialog's inheritance of icons set with JFrame.setIconImages() + * @library ../../regtesthelpers + * @run main/manual DialogInheritIcon + */ + +import javax.swing.JDialog; + +public class DialogInheritIcon extends ClientDecoratedIconTest { + JDialog dialog1; + JDialog dialog2; + + /* + * @Override + */ + protected String getInstructions() { + StringBuilder instructionsStr = new StringBuilder(); + instructionsStr.append("This tests the functionality of JDialog-inherited icons set using the setIconImages() API.\n"); + instructionsStr.append("You will see two JFrames with custom icons, each with a child JDialog below it.\n"); + instructionsStr.append("Both JDialogs should have the same icon: a colored box.\n"); + instructionsStr.append("If either of the JDialogs has the default, coffe-cup icon, the test fails.\n"); + instructionsStr.append("If the JDialogs DO NOT both have the same colored box as their icon, the test fails.\n"); + instructionsStr.append("If both JDialogs DO have the same colored box as their icon, then the test passes.\n"); + instructionsStr.append("Note: If the JDialog icons don't match the icons of the parent JFrame, that is OK."); + return instructionsStr.toString(); + } + + public void onEDT15() { + createDialogs(); + dialog1.setVisible(true); + dialog2.setVisible(true); + } + + protected void createDialogs() { + dialog1 = new JDialog(frame1, "Child JDialog 1", false); + dialog1.setBounds(frame1.getLocation().x, frame1.getLocation().y + frame1.getSize().height + 5, 200, 200); + dialog2 = new JDialog(frame2, "Child JDialog 2", false); + dialog2.setBounds(frame2.getLocation().x, frame2.getLocation().y + frame2.getSize().height + 5, 200, 200); + } + + public static void main(String[] args) throws Throwable { + new DialogInheritIcon().run(args); + System.out.println("end of main()"); + } +} diff --git a/test/jdk/javax/swing/JInternalFrame/bug4130806.java b/test/jdk/javax/swing/JInternalFrame/bug4130806.java new file mode 100644 index 000000000000..10814740b2e4 --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/bug4130806.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4130806 + * @summary JInternalFrame's setIcon(true) works correctly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4130806 + */ + +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import java.beans.PropertyVetoException; + +public class bug4130806 { + + private static final String INSTRUCTIONS = """ + If an icon is visible for the iconified internalframe, the test passes. + Otherwise, the test fails."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4130806 Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(bug4130806::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("bug4130806"); + JDesktopPane mDesktop = new JDesktopPane(); + frame.add(mDesktop); + frame.pack(); + JInternalFrame jif = new JInternalFrame("My Frame"); + jif.setIconifiable(true); + mDesktop.add(jif); + jif.setBounds(50,50,100,100); + try { + jif.setIcon(true); + } catch (PropertyVetoException e) { + throw new RuntimeException("PropertyVetoException received"); + } + jif.setVisible(true); + frame.setSize(200, 200); + return frame; + } +} diff --git a/test/jdk/javax/swing/JInternalFrame/bug4134077.java b/test/jdk/javax/swing/JInternalFrame/bug4134077.java new file mode 100644 index 000000000000..db609d5a425d --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/bug4134077.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4134077 + * @requires (os.family == "windows") + * @summary Metal,Window:If JInternalFrame's title text is long last must be ellipsis + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4134077 + */ + +import java.awt.BorderLayout; +import java.awt.ComponentOrientation; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + +public class bug4134077 { + + private static JFrame frame; + + private static final String INSTRUCTIONS = """ + Try to resize internal frame with diferrent combinations of + LookAndFeels and title pane's buttons and orientation. + + The internal frame's title should clip if its too long to + be entierly visible (ends by "...") + and window can never be + smaller than the width of the first two letters of the title + plus "..."."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4134077 Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(bug4134077::createTestUI) + .build() + .awaitAndCheck(); + } + + private static void setLF(ActionEvent e) { + try { + UIManager.setLookAndFeel(((JButton)e.getSource()).getActionCommand()); + SwingUtilities.updateComponentTreeUI(frame); + } catch (ClassNotFoundException | InstantiationException + | UnsupportedLookAndFeelException + | IllegalAccessException ex) { + throw new RuntimeException(ex); + } + } + + private static JFrame createTestUI() { + frame = new JFrame("bug4134077"); + JDesktopPane jdp = new JDesktopPane(); + frame.add(jdp); + + final JInternalFrame jif = + new JInternalFrame("Very Long Title For Internal Frame", true); + jdp.add(jif); + jif.setSize(150,150); + jif.setLocation(150, 50); + jif.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); + jif.setVisible(true); + + JPanel p = new JPanel(); + + JButton metal = new JButton("Metal"); + metal.setActionCommand("javax.swing.plaf.metal.MetalLookAndFeel"); + metal.addActionListener((ActionEvent e) -> setLF(e)); + p.add(metal); + + JButton windows = new JButton("Windows"); + windows.setActionCommand("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + windows.addActionListener((ActionEvent e) -> setLF(e)); + p.add(windows); + + JButton orientation = new JButton("Change orientation"); + orientation.addActionListener(e -> { + jif.setComponentOrientation( + jif.getComponentOrientation() == ComponentOrientation.LEFT_TO_RIGHT + ? ComponentOrientation.RIGHT_TO_LEFT + : ComponentOrientation.LEFT_TO_RIGHT); + }); + p.add(orientation); + + JButton clo = new JButton("Closable"); + clo.addActionListener(e -> jif.setClosable(!jif.isClosable())); + p.add(clo); + + JButton ico = new JButton("Iconifiable"); + ico.addActionListener(e -> jif.setIconifiable(!jif.isIconifiable())); + p.add(ico); + + JButton max = new JButton("Maximizable"); + max.addActionListener(e -> jif.setMaximizable(!jif.isMaximizable())); + p.add(max); + + frame.add(p, BorderLayout.SOUTH); + frame.setSize(700, 300); + return frame; + } +} diff --git a/test/jdk/javax/swing/JInternalFrame/bug4193070.java b/test/jdk/javax/swing/JInternalFrame/bug4193070.java new file mode 100644 index 000000000000..320b2e6e5633 --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/bug4193070.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4193070 + * @summary Tests correct mouse pointer shape + * @requires (os.family != "mac") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4193070 + */ + +import java.awt.Dimension; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; + +public class bug4193070 { + + private static final String INSTRUCTIONS = """ + Two internal frame will be shown. Select any internal frame; + Move mouse pointer inside the selected internal frame, + then to border of internal frame. + Mouse pointer should take the shape of resize cursor. + Now slowly move the mouse back inside the internal frame. + If mouse pointer shape does not change back to + normal shape of mouse pointer, then test failed. + Now try fast resizing an internal frame. + Check that mouse pointer always has resize shape, + even when it goes over other internal frame. + If during resizing mouse pointer shape changes, + then test failed. Otherwise test succeded."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4193070 Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(bug4193070::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame f = new JFrame("bug4193070"); + JDesktopPane dp = new JDesktopPane(); + + JInternalFrame intFrm1 = new JInternalFrame(); + intFrm1.setResizable(true); + dp.add(intFrm1); + + JInternalFrame intFrm2 = new JInternalFrame(); + intFrm2.setResizable(true); + dp.add(intFrm2); + + f.setContentPane(dp); + f.setSize(new Dimension(500, 275)); + + intFrm1.setBounds(25, 25, 200, 200); + intFrm1.show(); + + intFrm2.setBounds(275, 25, 200, 200); + intFrm2.show(); + return f; + } +} diff --git a/test/jdk/javax/swing/JInternalFrame/bug4225701.java b/test/jdk/javax/swing/JInternalFrame/bug4225701.java new file mode 100644 index 000000000000..808ebb503baf --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/bug4225701.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4225701 + * @summary Verifies MetalInternalFrameUI.installKeyboardActions + * doesn't install listener + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4225701 + */ + +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; + +public class bug4225701 { + + private static final String INSTRUCTIONS = """ + Give a focus to the internal frame "Frame 4" and press Ctrl-F4. + The "Frame 4" should be closed. Give a focus to the internal + frame "Frame 1" and press Ctrl-F4. + If "Frame 4" and "Frame 1" is not closed, then press Fail else press Pass."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4225701 Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(bug4225701::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + + JFrame frame = new JFrame("bug4225701"); + JInternalFrame jif1 = new JInternalFrame("Frame 1", true, true, true, true); + JInternalFrame jif2 = new JInternalFrame("Frame 2", false); + JInternalFrame jif3 = new JInternalFrame("Frame 3", false); + JInternalFrame jif4 = new JInternalFrame("Frame 4", true, true, true, true); + JDesktopPane jdp = new JDesktopPane(); + + frame.setContentPane(jdp); + + jdp.add(jif1); + jif1.setBounds(0, 150, 150, 150); + jif1.setVisible(true); + + jdp.add(jif2); + jif2.setBounds(100, 100, 150, 150); + jif2.setVisible(true); + + jdp.add(jif3); + jif3.setBounds(200, 50, 150, 150); + jif3.setVisible(true); + + jdp.add(jif4); + jif4.setBounds(300, 0, 150, 150); + jif4.setVisible(true); + + frame.setSize(500, 500); + return frame; + } + +} diff --git a/test/jdk/javax/swing/JList/bug4183379.java b/test/jdk/javax/swing/JList/bug4183379.java new file mode 100644 index 000000000000..784b92a6f16f --- /dev/null +++ b/test/jdk/javax/swing/JList/bug4183379.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4183379 + * @summary JList has wrong scrolling behavior when you click in the "troth" + * of a scrollbar, in a scrollpane. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4183379 + */ + +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JScrollPane; + +public class bug4183379 { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Click mouse several times in the "troth" of a scrollbars + in a scrollpane containing a list. + The list should scrolls by one block, i.e.: + + For vertical scrolling: + - if scrolling down the last visible element should become the + first completely visible element + - if scrolling up, the first visible element should become the + last completely visible element + + For horizontal scrolling: + - for scrolling left if the beginning of the first column is not + visible it should become visible, otherwise the beginning of the + previous column should become visible; + - for scrolling right the next colunm after first visible column + should become visible. + """; + PassFailJFrame.builder() + .title("bug4183379 Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(bug4183379::initialize) + .build() + .awaitAndCheck(); + } + + private static JFrame initialize() { + JFrame fr = new JFrame("bug4183379"); + + String[] data = new String[90]; + for (int i=0; i<90; i++) { + data[i] = "item number "+i; + } + + JList lst = new JList(data); + lst.setLayoutOrientation(JList.VERTICAL_WRAP); + lst.setVisibleRowCount(20); + + JScrollPane jsp = new JScrollPane(lst); + fr.add(jsp); + fr.setSize(210,200); + fr.setAlwaysOnTop(true); + return fr; + } +} diff --git a/test/jdk/javax/swing/JList/bug4251306.java b/test/jdk/javax/swing/JList/bug4251306.java new file mode 100644 index 000000000000..ec5309460885 --- /dev/null +++ b/test/jdk/javax/swing/JList/bug4251306.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4251306 + * @summary Test that Shift-Space keybinding works properly in JList. + * @key headful + * @run main bug4251306 + */ + +import java.awt.Robot; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.KeyEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; + +public class bug4251306 { + private static JFrame f; + private static JList lst; + private static CountDownLatch listGainedFocusLatch; + private static volatile boolean failed; + public static void main(String[] args) throws Exception { + try { + listGainedFocusLatch = new CountDownLatch(1); + createUI(); + runTest(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static void createUI() throws Exception { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("bug4251306"); + lst = new JList<>(new String[]{"anaheim", "bill", + "chicago", "dingo"}); + lst.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + listGainedFocusLatch.countDown(); + } + }); + JScrollPane sp = new JScrollPane(lst); + f.add(sp); + f.pack(); + f.setLocationRelativeTo(null); + f.setAlwaysOnTop(true); + f.setVisible(true); + }); + } + + private static void runTest() throws Exception { + if (!listGainedFocusLatch.await(3, TimeUnit.SECONDS)) { + throw new RuntimeException("Waited too long, but can't gain focus for list"); + } + Robot robot = new Robot(); + robot.setAutoDelay(500); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_A); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_SHIFT); + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SHIFT); + + SwingUtilities.invokeAndWait(() -> { + if (!lst.isSelectedIndex(0) || + !lst.isSelectedIndex(1) || + !lst.isSelectedIndex(2) || + !lst.isSelectedIndex(3)) { + failed = true; + } + }); + if (failed) { + throw new RuntimeException("Required list items are not selected"); + } + } +} diff --git a/test/jdk/javax/swing/JMenu/bug4624845.java b/test/jdk/javax/swing/JMenu/bug4624845.java new file mode 100644 index 000000000000..54524b7a42e7 --- /dev/null +++ b/test/jdk/javax/swing/JMenu/bug4624845.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4624845 + * @requires (os.family == "windows") + * @summary Tests how submenus in WinLAF are painted + * @key headful + * @run main bug4624845 + */ + +import java.awt.Color; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +public class bug4624845 { + private static JFrame f; + private static JMenu menu, subMenu; + private static JMenuItem menuItem; + private static volatile Point menuLocation; + private static volatile Point subMenuLocation; + private static volatile Point menuItemLocation; + private static volatile int menuWidth; + private static volatile int menuHeight; + private static volatile int subMenuWidth; + private static volatile int subMenuHeight; + private static volatile int menuItemWidth; + private static volatile int menuItemHeight; + private static Color menuItemColor; + private static Color subMenuColor; + private static boolean passed; + private final static int OFFSET = 2; + private static final int COLOR_TOLERANCE = 10; + + public static void main(String[] args) throws Exception { + try { + UIManager.setLookAndFeel + ("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (Exception e) { + throw new RuntimeException("Failed to set Windows LAF"); + } + try { + bug4624845 test = new bug4624845(); + SwingUtilities.invokeAndWait(() -> test.createUI()); + runTest(); + verifyColor(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + if (!passed) { + throw new RuntimeException("Nested MenuItem color : " + + menuItemColor + " is not similar to sub Menu color : " + + subMenuColor); + } + } + private void createUI() { + f = new JFrame("bug4624845"); + menu = new JMenu("Menu"); + menu.add(new JMenuItem("Item 1")); + + subMenu = new JMenu("Submenu"); + menuItem = new JMenuItem("This"); + subMenu.add(menuItem); + subMenu.add(new JMenuItem("That")); + menu.add(subMenu); + + JMenuBar mBar = new JMenuBar(); + mBar.add(menu); + f.add(mBar); + f.pack(); + f.setLocationRelativeTo(null); + f.setVisible(true); + } + + private static void runTest() throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(200); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + menuLocation = menu.getLocationOnScreen(); + menuWidth = menu.getWidth(); + menuHeight = menu.getHeight(); + }); + robot.mouseMove(menuLocation.x + menuWidth / 2, + menuLocation.y + menuHeight / 2 ); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + subMenuLocation = subMenu.getLocationOnScreen(); + subMenuWidth = subMenu.getWidth(); + subMenuHeight = subMenu.getHeight(); + }); + robot.mouseMove(subMenuLocation.x + subMenuWidth / 2, + subMenuLocation.y + subMenuHeight / 2 ); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + subMenuColor = robot. + getPixelColor(subMenuLocation.x + OFFSET, + subMenuLocation.y + OFFSET); + SwingUtilities.invokeAndWait(() -> { + menuItemLocation = menuItem.getLocationOnScreen(); + menuItemWidth = subMenu.getWidth(); + menuItemHeight = subMenu.getHeight(); + }); + robot.mouseMove(menuItemLocation.x + menuItemWidth / 2, + menuItemLocation.y + menuItemHeight / 2 ); + robot.waitForIdle(); + menuItemColor = robot. + getPixelColor(menuItemLocation.x + OFFSET, + menuItemLocation.y + OFFSET); + } + + private static void verifyColor() { + + int red1 = subMenuColor.getRed(); + int blue1 = subMenuColor.getBlue(); + int green1 = subMenuColor.getGreen(); + + int red2 = menuItemColor.getRed(); + int blue2 = menuItemColor.getBlue(); + int green2 = menuItemColor.getGreen(); + + passed = true; + if ((Math.abs(red1 - red2) > COLOR_TOLERANCE) + || (Math.abs(green1 - green2) > COLOR_TOLERANCE) + || (Math.abs(blue1 - blue2) > COLOR_TOLERANCE)) { + passed = false; + } + } +} diff --git a/test/jdk/javax/swing/JMenuBar/TestMenuMnemonic.java b/test/jdk/javax/swing/JMenuBar/TestMenuMnemonic.java new file mode 100644 index 000000000000..500d3ca3408a --- /dev/null +++ b/test/jdk/javax/swing/JMenuBar/TestMenuMnemonic.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8326458 + * @key headful + * @requires (os.family == "windows") + * @modules java.desktop/com.sun.java.swing.plaf.windows + * @summary Verifies if menu mnemonics toggle on F10 press in Windows LAF + * @run main TestMenuMnemonic + */ + +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.util.concurrent.atomic.AtomicInteger; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.MenuElement; +import javax.swing.MenuSelectionManager; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; + +public class TestMenuMnemonic { + + private static JFrame frame; + private static JMenuBar menuBar; + private static JMenu fileMenu; + + private static final AtomicInteger mnemonicHideCount = new AtomicInteger(0); + private static final AtomicInteger mnemonicShowCount = new AtomicInteger(0); + + private static final int EXPECTED = 5; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + Robot robot = new Robot(); + robot.setAutoDelay(100); + + try { + SwingUtilities.invokeAndWait(TestMenuMnemonic::createAndShowUI); + robot.waitForIdle(); + robot.delay(1000); + + for (int i = 0; i < EXPECTED * 2; i++) { + robot.keyPress(KeyEvent.VK_F10); + robot.waitForIdle(); + robot.delay(50); + robot.keyRelease(KeyEvent.VK_F10); + robot.waitForIdle(); + robot.delay(50); + SwingUtilities.invokeAndWait(TestMenuMnemonic::verifyMnemonicsState); + } + + if (mnemonicShowCount.get() != EXPECTED + && mnemonicHideCount.get() != EXPECTED) { + throw new RuntimeException("Mismatch in Mnemonic show/hide on F10 press"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void verifyMnemonicsState() { + MenuSelectionManager msm = + MenuSelectionManager.defaultManager(); + MenuElement[] selectedPath = msm.getSelectedPath(); + if (WindowsLookAndFeel.isMnemonicHidden()) { + mnemonicHideCount.getAndIncrement(); + // Check if selection is cleared when mnemonics are hidden + if (selectedPath.length != 0) { + throw new RuntimeException("Menubar is active after" + + " mnemonics are hidden"); + } + } else { + mnemonicShowCount.getAndIncrement(); + if (selectedPath.length != 2 + && (selectedPath[0] != menuBar || selectedPath[1] != fileMenu)) { + throw new RuntimeException("No Menu and Menubar is active when" + + " mnemonics are shown"); + } + } + } + + private static void createAndShowUI() { + frame = new JFrame("Test Menu Mnemonic Show/Hide"); + menuBar = new JMenuBar(); + fileMenu = new JMenu("File"); + JMenu editMenu = new JMenu("Edit"); + fileMenu.setMnemonic(KeyEvent.VK_F); + editMenu.setMnemonic(KeyEvent.VK_E); + JMenuItem item1 = new JMenuItem("Item 1"); + JMenuItem item2 = new JMenuItem("Item 2"); + fileMenu.add(item1); + fileMenu.add(item2); + menuBar.add(fileMenu); + menuBar.add(editMenu); + frame.setJMenuBar(menuBar); + frame.setSize(250, 200); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + } +} diff --git a/test/jdk/javax/swing/JMenuItem/LargeMenuTextArrowIconPosition.java b/test/jdk/javax/swing/JMenuItem/LargeMenuTextArrowIconPosition.java new file mode 100644 index 000000000000..72512560cffa --- /dev/null +++ b/test/jdk/javax/swing/JMenuItem/LargeMenuTextArrowIconPosition.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8374506 + * @summary Verify if arrow icon positioning is correct in + * parent JMenu in Windows L&F + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual LargeMenuTextArrowIconPosition + */ + +import java.awt.BorderLayout; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.UIManager; + +public class LargeMenuTextArrowIconPosition { + + private static final String INSTRUCTIONS = """ + A frame will be shown with a label. + Right click on the label. + + Check the arrow icon at the end of + "Really long Menu-Text" text. + If it overlaps with the menu text, + press Fail else press Pass."""; + + public static void main(String[] args) throws Throwable { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(LargeMenuTextArrowIconPosition::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + + JFrame frame = new JFrame("LargeMenuTextArrowIcon"); + frame.setSize(300, 150); + frame.setLayout(new BorderLayout()); + + JPopupMenu popupMenu = new JPopupMenu(); + popupMenu.add(new JCheckBoxMenuItem("CheckBox On", true)); + popupMenu.add(new JCheckBoxMenuItem("CheckBox Icon On", + UIManager.getIcon("FileView.floppyDriveIcon"), true)); + popupMenu.add(new JCheckBoxMenuItem("CheckBox Icon Off", + UIManager.getIcon("FileView.floppyDriveIcon"), false)); + + JMenu menu = new JMenu("Really long Menu-Text"); + menu.add(new JMenuItem("Sub-MenuItem")); + menu.add(new JCheckBoxMenuItem("Sub-CheckBox On", true)); + + popupMenu.add(menu); + + JLabel lbl = new JLabel("Right click to invoke popupMenu"); + lbl.setComponentPopupMenu(popupMenu); + frame.add(lbl, BorderLayout.CENTER); + + return frame; + } + +} diff --git a/test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java b/test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java index afb1c7bb33f9..5a30e202d9da 100644 --- a/test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java +++ b/test/jdk/javax/swing/JMenuItem/MenuItemTest/bug6197830.java @@ -49,6 +49,7 @@ public static void main(String[] args) throws Exception { .columns(35) .testUI(bug6197830::createTestUI) .positionTestUIBottomRowCentered() + .logArea() .build() .awaitAndCheck(); } diff --git a/test/jdk/javax/swing/JRootPane/bug4403624.java b/test/jdk/javax/swing/JRootPane/bug4403624.java new file mode 100644 index 000000000000..1c3ba3ddd2a8 --- /dev/null +++ b/test/jdk/javax/swing/JRootPane/bug4403624.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4403624 + * @summary Tests JRootPane layout with invisible menubar + * @key headful + * @run main bug4403624 + */ + +import java.awt.Color; +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.SwingUtilities; + +public class bug4403624 { + private static JFrame f; + private static Container c; + private static JButton b; + private static volatile Point p; + private static volatile int bWidth; + private static volatile int bHeight; + private static final int OFFSET = 2; + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(() -> { + f = new JFrame("bug4403624 Test"); + JMenuBar mbar; + mbar = new JMenuBar(); + mbar.add(new JMenu("Menu")); + f.setJMenuBar(mbar); + b = new JButton("Hide Menu"); + b.addActionListener(e -> mbar.setVisible(false)); + c = f.getContentPane(); + c.setLayout(new FlowLayout()); + c.setBackground(Color.GREEN); + c.add(b); + f.pack(); + f.setLocationRelativeTo(null); + f.setAlwaysOnTop(true); + f.setVisible(true); + }); + + Robot r = new Robot(); + r.setAutoDelay(200); + r.waitForIdle(); + r.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + p = b.getLocationOnScreen(); + bWidth = b.getWidth(); + bHeight = b.getHeight(); + }); + + r.mouseMove(p.x + (bWidth / 2), p.y + (bHeight / 2)); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + SwingUtilities.invokeAndWait(() -> p = c.getLocationOnScreen()); + + Color c = r.getPixelColor(p.x + OFFSET, p.y + OFFSET); + + if (c.getGreen() < 240 && c.getBlue() > 10 && c.getRed() > 10) { + System.out.println("EXPECTED: " + Color.GREEN); + System.out.println("ACTUAL: " + c); + throw new RuntimeException("Failure to hide menu bar."); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java b/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java index 96b1034c943d..d68f1bff5971 100644 --- a/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java +++ b/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java @@ -24,14 +24,16 @@ /* * @test * @bug 4865918 - * @requires (os.family != "mac") + * @key headful * @summary REGRESSION:JCK1.4a-runtime api/javax_swing/interactive/JScrollBarTests.html#JScrollBar * @run main bug4865918 */ import java.awt.Dimension; +import java.awt.Robot; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import javax.swing.JFrame; import javax.swing.JScrollBar; import javax.swing.SwingUtilities; import java.util.concurrent.CountDownLatch; @@ -41,24 +43,33 @@ public class bug4865918 { + private static JFrame frame; private static TestScrollBar sbar; private static final CountDownLatch mousePressLatch = new CountDownLatch(1); public static void main(String[] argv) throws Exception { - String osName = System.getProperty("os.name"); - if (osName.toLowerCase().contains("os x")) { - System.out.println("This test is not for MacOS, considered passed."); - return; - } - SwingUtilities.invokeAndWait(() -> setupTest()); + try { + Robot robot = new Robot(); + SwingUtilities.invokeAndWait(() -> createAndShowGUI()); - SwingUtilities.invokeAndWait(() -> sbar.pressMouse()); - if (!mousePressLatch.await(2, TimeUnit.SECONDS)) { - throw new RuntimeException("Timed out waiting for mouse press"); - } + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> sbar.pressMouse()); + if (!mousePressLatch.await(2, TimeUnit.SECONDS)) { + throw new RuntimeException("Timed out waiting for mouse press"); + } - if (getValue() != 9) { - throw new RuntimeException("The scrollbar block increment is incorrect"); + if (getValue() != 9) { + throw new RuntimeException("The scrollbar block increment " + + getValue() + " is incorrect"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); } } @@ -73,8 +84,8 @@ private static int getValue() throws Exception { return result[0]; } - private static void setupTest() { - + private static void createAndShowGUI() { + frame = new JFrame("bug4865918"); sbar = new TestScrollBar(JScrollBar.HORIZONTAL, -1, 10, -100, 100); sbar.setPreferredSize(new Dimension(200, 20)); sbar.setBlockIncrement(10); @@ -83,7 +94,11 @@ public void mousePressed(MouseEvent e) { mousePressLatch.countDown(); } }); - + frame.getContentPane().add(sbar); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.toFront(); } static class TestScrollBar extends JScrollBar { diff --git a/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/HorizScrollers.java b/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/HorizScrollers.java new file mode 100644 index 000000000000..61124ea1e973 --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/HorizScrollers.java @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 5078454 + * @summary Test horizontal wheel scroll behavior of (including RTL) + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual HorizScrollers + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; + +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; + +public class HorizScrollers { + private static final String INSTRUCTIONS = """ + This is a semi-automatic test with three phases. + For each phase, you will need to change the mouse setting, as + directed by a dialog. Once the correct setting is confirmed, + the next test phase will run automatically. + DO NOT TOUCH ANYTHING DURING TESTING! + + The test will automatically FAIL during testing if something + fails. Otherwise, the test will automatically PASS after the + third testing phase. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("HorizScrollers Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testTimeOut(10) + .splitUIRight(ConfigPanel::new) + .logArea(6) + .build() + .awaitAndCheck(); + } + + private static final int[] SCROLLAMTS = {1, 30, 3}; + private static final String[] CONFIG_MSGS = { + "Set the scrolling speed to the slowest value (1 line).", + "Set the scrolling speed to the fastest value (30 lines).", + "Set the scrolling speed to two ticks above the slowest value (3 lines)." + }; + + private static int current = 0; + private static final String MW_TEXT = "Rotate the mouse wheel here"; + private static final String CONFIG_INSTRUCTION_TEMPLATE = """ + Configure Mouse Wheel for Phase %d + + Open the Mouse Control Panel and go to the 'Wheel' tab. + If 'Wheel' tab is not available just press Pass. + + %s + + Test the setting on the area below. + Once the mouse is setup correctly, the area will turn green. + When you're ready for the next part of the test to run, press GO! + """; + + static class ConfigPanel extends JPanel + implements ActionListener, MouseWheelListener { + JTextArea msg; + JButton goBtn; + JLabel mwArea; + int scrollAmount; + + private final Color defaultBg; + + ConfigPanel() { + this.scrollAmount = SCROLLAMTS[current]; + Container content = this; + content.setLayout(new BorderLayout()); + msg = new JTextArea(); + msg.setMargin(new Insets(5, 5, 5, 5)); + msg.setEditable(false); + msg.setLineWrap(true); + msg.setWrapStyleWord(true); + content.add(msg, BorderLayout.NORTH); + + mwArea = new JLabel(MW_TEXT, SwingConstants.CENTER); + mwArea.setPreferredSize(new Dimension(200, 250)); + mwArea.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + mwArea.setOpaque(true); + mwArea.addMouseWheelListener(this); + content.add(mwArea, BorderLayout.CENTER); + + defaultBg = mwArea.getBackground(); + setPhase(current); + + goBtn = new JButton("GO!"); + goBtn.setEnabled(false); + goBtn.addActionListener(this); + JPanel flowPanel = new JPanel(); + flowPanel.setLayout(new FlowLayout()); + flowPanel.add(goBtn); + content.add(flowPanel, BorderLayout.SOUTH); + + setPreferredSize(new Dimension(600, 400)); + } + + public void setPhase(int phase) { + if (phase < 3) { + setVisible(true); + PassFailJFrame.log("Phase %d scroll speed %d" + .formatted(phase + 1, SCROLLAMTS[phase])); + PassFailJFrame.log(CONFIG_MSGS[phase]); + + scrollAmount = SCROLLAMTS[phase]; + msg.setText(CONFIG_INSTRUCTION_TEMPLATE + .formatted(phase + 1, CONFIG_MSGS[phase])); + mwArea.setBackground(defaultBg); + mwArea.setText(MW_TEXT); + } else { + // all cases passed + showFinalReminderIfNeeded(false); + } + } + + private void showFinalReminderIfNeeded(boolean isFailure) { + if (scrollAmount != 3) { + JOptionPane.showMessageDialog( + ConfigPanel.this.getTopLevelAncestor(), + ("Test %s. Please make sure you have restored " + + "the original scrolling speed in the " + + "Mouse settings.") + .formatted(isFailure + ? "failed" + : "passed"), + isFailure + ? "Failure" + : "Success", + isFailure + ? JOptionPane.WARNING_MESSAGE + : JOptionPane.INFORMATION_MESSAGE + ); + } + + if (isFailure) { + PassFailJFrame.forceFail(); + } else { + PassFailJFrame.forcePass(); + } + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == goBtn) { + goBtn.setEnabled(false); + + new Thread(() -> { // new thread to avoid running robot on EDT + boolean passed; + try { + passed = RTLScrollers.runTest(SCROLLAMTS[current]); + } catch (Exception ex) { + PassFailJFrame.log("Failure: " + ex); + SwingUtilities.invokeLater(() -> + showFinalReminderIfNeeded(true)); + return; + } + + PassFailJFrame.log("Phase %d passed: %b\n" + .formatted(current + 1, passed)); + if (passed) { + SwingUtilities.invokeLater(() -> { + goBtn.setEnabled(true); + setPhase(++current); + }); + } else { + SwingUtilities.invokeLater(() -> + showFinalReminderIfNeeded(true)); + } + }).start(); + } + } + + public void mouseWheelMoved(MouseWheelEvent e) { + int eventScrollAmt = e.getScrollAmount(); + if (eventScrollAmt == scrollAmount) { + mwArea.setBackground(Color.GREEN); + mwArea.setText("Mouse wheel configured - press Go"); + goBtn.setEnabled(true); + goBtn.requestFocusInWindow(); + PassFailJFrame.log("Proceed to the test with go button"); + return; + } + if (eventScrollAmt < scrollAmount) { + mwArea.setText("Increase the scroll speed. (Want:" + + scrollAmount + " Got:" + eventScrollAmt + ")"); + } else { + mwArea.setText("Decrease the scroll speed. (Want:" + + scrollAmount + " Got:" + eventScrollAmt + ")"); + } + } + } +} diff --git a/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/RTLScrollers.java b/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/RTLScrollers.java new file mode 100644 index 000000000000..da395282bf5b --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/AcceleratedWheelScrolling/RTLScrollers.java @@ -0,0 +1,680 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// A few Swing components which use the mouse wheel to scroll + +import java.awt.AWTException; +import java.awt.Color; +import java.awt.ComponentOrientation; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import java.awt.image.BufferedImage; +import java.lang.reflect.InvocationTargetException; + +import javax.swing.DefaultListModel; +import javax.swing.ImageIcon; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JScrollBar; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.ListModel; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingUtilities; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; + +public class RTLScrollers extends JDialog + implements MouseWheelListener, ActionListener { + private static final int ROWS = 5; + private static final int COLUMNS = 150; + private static final int WINWIDTH = 1000; + + static RTLScrollers rtl; + static volatile RTLScrollers f; + static volatile boolean retVal; + static volatile JScrollPane jsp; + static volatile JScrollBar hsb; + static volatile JScrollBar sb; + static volatile Point loc; + static volatile Dimension size; + TestList list; + JScrollPane listScroller; + JTextArea text; + JScrollPane textScroller; + TestTable table; + JScrollPane tableScroller; + JCheckBoxMenuItem rightToLeft; + ImageIcon photoIcon; + int scrollAmount; + + private static Robot robot; + private static BufferedImage logo = genIcon(166, 39, Color.PINK); + private static BufferedImage photo = genIcon(59, 80, Color.MAGENTA); + private static BufferedImage photo2 = genIcon(80, 53, Color.ORANGE); + + private static BufferedImage genIcon(int width, int height, Color color) { + BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + Graphics g = image.getGraphics(); + g.setColor(color); + g.fillRect(0, 0, width, height); + + return image; + } + + public RTLScrollers() { + this(0); + } + + public RTLScrollers(int scrollAmount) { + super(new JFrame(), "RTLScrollers", false); + + this.scrollAmount = scrollAmount; + Container content = getContentPane(); + content.setLayout(new GridBagLayout()); + + DefaultListModel listModel = new DefaultListModel<>(); + + photoIcon = new ImageIcon(photo); + for (int i = 0; i < COLUMNS / 4 ; i++) { + for (int j = 0; j < ROWS; j++) { + listModel.addElement(new ImageIcon(logo)); + } + for (int j = 0; j < ROWS; j++) { + listModel.addElement(photoIcon); + } + for (int j = 0; j < ROWS; j++) { + listModel.addElement(new ImageIcon(photo2)); + } + for (int j = 0; j < ROWS; j++) { + listModel.addElement("Text Item " + ((1 + i) * 3)); + } + } + + list = new TestList(listModel); + list.setVisibleRowCount(ROWS); + list.setLayoutOrientation(JList.VERTICAL_WRAP); + listScroller = new JScrollPane(list); + listScroller.addMouseWheelListener(this); + + text = new JTextArea(); + for (int j = 0; j < ROWS ; j++) { + for (int i = 0; i < COLUMNS ; i++) { + text.append(i + " some text, some more text, a really long line of text "); + } + text.append("\n"); + } + + textScroller = new JScrollPane(text); + textScroller.addMouseWheelListener(this); + + DefaultTableModel model = new DefaultTableModel(ROWS, COLUMNS); + table = new TestTable(model); + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + for (int i = 0; i < COLUMNS; i++) { + for (int j = 0; j < ROWS; j++) { + table.setValueAt(j + ", " + i, j, i); + } + + TableColumn column = table.getColumnModel().getColumn(i); + + if (i % 4 == 0) { + column.setMinWidth(0); + column.setPreferredWidth(0); + column.setMaxWidth(0); + } + else if ((i + 1) % 4 == 0) { + column.setMinWidth(95); + column.setPreferredWidth(95); + column.setMaxWidth(95); + } + else if ((i + 2) % 4 == 0) { + column.setMinWidth(26); + column.setPreferredWidth(26); + column.setMaxWidth(26); + } + else { + column.setMinWidth(50); + column.setPreferredWidth(50); + column.setMaxWidth(50); + } + } + tableScroller = new JScrollPane(table); + tableScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + tableScroller.addMouseWheelListener(this); + + GridBagConstraints tableGBC = new GridBagConstraints(0, + 0, + 1, + 1, + 1.0, + 0.3, + GridBagConstraints.CENTER, + GridBagConstraints.BOTH, + new Insets(0,0,0,0), + 0, + 0); + content.add(tableScroller, tableGBC); + GridBagConstraints textGBC = new GridBagConstraints(0, + 1, + 1, + 1, + 1.0, + 0.3, + GridBagConstraints.CENTER, + GridBagConstraints.BOTH, + new Insets(0,0,0,0), + 0, + 0); + content.add(textScroller, textGBC); + + GridBagConstraints listGBC = new GridBagConstraints(0, + 2, + 1, + 5, + 1.0, + 1.2, + GridBagConstraints.CENTER, + GridBagConstraints.BOTH, + new Insets(0,0,0,0), + 0, + 0); + + content.add(listScroller, listGBC); + + rightToLeft = new JCheckBoxMenuItem("Right-To-Left", false); + rightToLeft.addActionListener(this); + JMenu menu = new JMenu("Component Orientation"); + menu.add(rightToLeft); + + JMenuItem close = new JMenuItem("Close"); + close.addActionListener(e -> RTLScrollers.this.setVisible(false)); + menu.add(close); + + JMenuBar mb = new JMenuBar(); + mb.add(menu); + setJMenuBar(mb); + setBounds(0, 0, WINWIDTH, 760); + setLocationRelativeTo(null); + } + + public void actionPerformed(ActionEvent e) { + if (rightToLeft.getState()) { + applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); + } + else { + applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); + } + } + public void mouseWheelMoved(MouseWheelEvent e) { + System.out.println("Rotation: " + e.getWheelRotation()); + } + + public static boolean runTest(int scrollAmount) + throws InterruptedException, InvocationTargetException { + System.out.println("RTLS.runTest()"); + if (robot == null) { + try { + robot = new Robot(); + robot.setAutoDelay(150); + robot.setAutoWaitForIdle(true); + } + catch (AWTException e) { + e.printStackTrace(); + return false; + } + } + + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + rtl = new RTLScrollers(scrollAmount); + rtl.setVisible(true); + }); + robot.delay(100); + + try { + retVal = rtl.runTests(scrollAmount); + } finally { + SwingUtilities.invokeAndWait(() -> { + rtl.setVisible(false); + rtl.dispose(); + }); + } + + robot.delay(100); + System.out.println("RTLS.runTest(): " + retVal); + return retVal; + } + + private boolean runTests(int scrollAmount) + throws InterruptedException, InvocationTargetException { + if (robot == null) { + try { + robot = new Robot(); + robot.setAutoDelay(150); + robot.setAutoWaitForIdle(true); + } + catch (AWTException e) { + e.printStackTrace(); + return false; + } + } + + // + // run robot tests + // + robot.delay(500); + + System.out.println("Testing Table"); + testComp(table, scrollAmount); + + System.out.println("Testing List"); + testComp(list, scrollAmount); + + SwingUtilities.invokeAndWait(() -> + applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT)); + robot.delay(100); + + System.out.println("Testing RTL Table"); + testComp(table, scrollAmount); + + System.out.println("Testing RTL List"); + testComp(list, scrollAmount); + + return true; + } + + public boolean testComp(TestTools comp, int scrollAmount) + throws InterruptedException, InvocationTargetException { + // Make sure we start from the beginning + SwingUtilities.invokeAndWait(() -> { + jsp = (JScrollPane)((JComponent)comp).getParent().getParent(); + hsb = jsp.getHorizontalScrollBar(); + hsb.setValue(hsb.getMinimum()); + + loc = jsp.getLocationOnScreen(); + size = jsp.getSize(); + }); + int midx = loc.x + size.width / 2; + int midy = loc.y + size.height / 2; + int maxIdx = 0; + robot.mouseMove(midx, midy); + + // Don't bother for max scroll w/ RTL JList, because the block increment is broken + if (scrollAmount != 30 || !(comp instanceof TestList) + || getComponentOrientation().isLeftToRight()) { + scrollToMiddle(jsp, robot); + + // check that we're lined up + comp.checkTopCellIsLinedUp(); + + int startVal = hsb.getValue(); + int leadingCell = comp.getLeadingCell().y; + System.out.println("leadingCell is " + leadingCell); + + // become unaligned + int width = comp.getLeadingCellWidth(); + int midVal = startVal + width / 2; + System.out.println("becoming unaligned: startVal is " + + startVal + ", midVal is " + midVal); + SwingUtilities.invokeAndWait(() -> hsb.setValue(midVal)); + + // + // Check partial inc up + // + robot.mouseWheel(-1); + + if (scrollAmount == 30) { // hack for max scroll amount + comp.checkTopCellIsMax(maxIdx++); + } + else { + comp.checkTopCellIs(leadingCell, -scrollAmount + 1); + } + comp.checkTopCellIsLinedUp(); + + // + // Check partial inc down + // + SwingUtilities.invokeAndWait(() -> hsb.setValue(midVal)); + robot.delay(100); + robot.mouseWheel(1); + + if (scrollAmount == 30) { // hack for max scroll amount + comp.checkTopCellIsMax(maxIdx++); + } + else { + comp.checkTopCellIs(leadingCell, scrollAmount); + } + comp.checkTopCellIsLinedUp(); + + // + // Check full inc down (3 times) + // + SwingUtilities.invokeAndWait(() -> hsb.setValue(startVal)); + leadingCell = comp.getLeadingCell().y; + + // Once... + robot.mouseWheel(1); + if (scrollAmount == 30) { // hack for max scroll amount + comp.checkTopCellIsMax(maxIdx++); + } + else { + comp.checkTopCellIs(leadingCell, scrollAmount); + } + comp.checkTopCellIsLinedUp(); + + // Twice... + robot.mouseWheel(1); + if (scrollAmount == 30) { // hack for max scroll amount + comp.checkTopCellIsMax(maxIdx++); + } + else { + comp.checkTopCellIs(leadingCell, (2 * scrollAmount)); + } + + comp.checkTopCellIsLinedUp(); + + // Thrice... + robot.mouseWheel(1); + if (scrollAmount == 30) { // hack for max scroll amount + comp.checkTopCellIsMax(maxIdx++); + } + else { + comp.checkTopCellIs(leadingCell, (3 * scrollAmount)); + + } + comp.checkTopCellIsLinedUp(); + + // + // Check full inc up (3 times) + // + leadingCell = comp.getLeadingCell().y; + + // Once... + robot.mouseWheel(-1); + if (scrollAmount == 30) { // hack for max scroll amount + comp.checkTopCellIsMax(maxIdx++); + } + else { + comp.checkTopCellIs(leadingCell, -scrollAmount); + } + comp.checkTopCellIsLinedUp(); + + // Twice... + robot.mouseWheel(-1); + if (scrollAmount == 30) { // hack for max scroll amount + comp.checkTopCellIsMax(maxIdx++); + } + else { + comp.checkTopCellIs(leadingCell, -(2 * scrollAmount)); + } + comp.checkTopCellIsLinedUp(); + + // Thrice... + robot.mouseWheel(-1); + if (scrollAmount == 30) { // hack for max scroll amount + comp.checkTopCellIsMax(maxIdx++); + } + else { + comp.checkTopCellIs(leadingCell, -(3 * scrollAmount)); + } + comp.checkTopCellIsLinedUp(); + } + + // + // Test acceleration for max scrolling + // (this part should still work for RTL JList) + if (scrollAmount == 30) { + SwingUtilities.invokeAndWait(() -> hsb.setValue(hsb.getMinimum())); + robot.delay(100); + robot.mouseWheel(2); + robot.mouseWheel(2); + robot.mouseWheel(2); + if (hsb.getValue() < hsb.getMaximum() - hsb.getVisibleAmount()) { + throw new RuntimeException("Wheel acceleration for max " + + "scrolling doesn't work: hsb value (" + hsb.getValue() + + " < hsb max (" + hsb.getMaximum() + + ") - hsb vis (" + hsb.getVisibleAmount() + ")"); + } + robot.delay(100); + robot.mouseWheel(-2); + robot.mouseWheel(-2); + robot.mouseWheel(-2); + if (hsb.getValue() > hsb.getMinimum()) { + throw new RuntimeException("Wheel acceleration for max " + + "scrolling doesn't work: hsb value (" + + hsb.getValue() + " > hsb min (" + hsb.getMinimum() + ")"); + } + } + + return true; + } + + class TestTable extends JTable implements TestTools { + final int[] MAXVALS = {23, 67, 67, 89, 111, 89, 66, 45}; //Lookup table + public TestTable(TableModel model) { + super(model); + } + + public void checkTopCellIsLinedUp() { + boolean isLeftToRight = getComponentOrientation().isLeftToRight(); + Point leading = getLeadingCell(); + Rectangle visRect = getVisibleRect(); + Rectangle cellRect = getCellRect(leading.x, leading.y, true); + + if (isLeftToRight) { + if (cellRect.x != visRect.x) { + throw new RuntimeException("leading cell is not aligned!"); + } + } + else { + if (cellRect.x + cellRect.width != visRect.x + visRect.width) { + throw new RuntimeException("leading cell is not aligned!"); + } + } + } + + public void checkTopCellIs(int col) { + Point cell = getLeadingCell(); + if (cell.y != col) { + throw new RuntimeException("leading cell (" + cell.y + + ") is not " + col); + } + } + + /* + * Account for 0-width cells + * + * shift is a non-0 number of visible cells to shift. The shift is + * augmented for zero-width cells, and the new sum is passed into + * checkTopCellIs(). + */ + public void checkTopCellIs(int col, int shift) { + if (shift == 0) { + checkTopCellIs(col); + return; + } + + int row = getLeadingCell().x; + int newShift = 0; + int foundCells = 0; + int direction = shift > 0 ? 1 : -1; + int index = col; + Rectangle cellRect; + + while (foundCells < Math.abs(shift)) { + index += direction; + cellRect = getCellRect(row, index, true); + if (cellRect.width > 0) { + foundCells++; + } + newShift++; + } + + checkTopCellIs(col + (direction*newShift)); + } + + public void checkTopCellIsMax(int idx) { + checkTopCellIs(MAXVALS[idx]); + } + + public int getLeadingCellWidth() { + Point leading = getLeadingCell(); + Rectangle cellRect = getCellRect(leading.x, leading.y, true); + return cellRect.width; + } + + public Point getLeadingCell() { + boolean isLeftToRight = getComponentOrientation().isLeftToRight(); + Rectangle visRect = getVisibleRect(); + int row = rowAtPoint(visRect.getLocation()); + int column; + if (isLeftToRight) { + column = columnAtPoint(visRect.getLocation()); + } + else { + column = columnAtPoint(new Point(visRect.x + visRect.width - 1, visRect.y)); + } + return new Point(row, column); + } + } + + class TestList extends JList implements TestTools { + final int[] MAXVALS = {5, 16, 15, 20, 25, 20, 15, 10 }; + public TestList(ListModel model) { + super(model); + } + + // Note - implemented in terms of columns + public Point getLeadingCell() { + System.out.println("TL.gLC(): first vis index is " + + getFirstVisibleIndex()); + return new Point(getFirstVisibleIndex() / ROWS, + getFirstVisibleIndex() / ROWS); + } + public void checkTopCellIsLinedUp() { + boolean isLeftToRight = getComponentOrientation().isLeftToRight(); + int visIdx = getFirstVisibleIndex(); + Rectangle cellRect = getCellBounds(visIdx, visIdx); + Rectangle visRect = getVisibleRect(); + if (isLeftToRight) { + if (cellRect.x != visRect.x) { + throw new RuntimeException("leading cell is not aligned!"); + } + } + else { + if (cellRect.x + cellRect.width != visRect.x + visRect.width) { + throw new RuntimeException("leading cell is not aligned!"); + } + } + } + public void checkTopCellIs(int col) { + int firstVis = getLeadingCell().y; + if (firstVis != col) { + throw new RuntimeException("leading cell (" + + firstVis + ") is not " + col); + } + } + public void checkTopCellIs(int idx, int shift) { + checkTopCellIs(idx + shift); + + } + public void checkTopCellIsMax(int idx) { + checkTopCellIs(MAXVALS[idx]); + } + public int getLeadingCellWidth() { + int visIdx = getFirstVisibleIndex(); + Rectangle cellRect = getCellBounds(visIdx, visIdx); + System.out.println("TL.gLCW(): leading cell width is " + cellRect.width); + return cellRect.width; + } + } + + private interface TestTools { + /** + * Throws a runtime exception if the top cell isn't lined up + */ + void checkTopCellIsLinedUp(); + void checkTopCellIs(int col); + void checkTopCellIs(int col, int shift); + int getLeadingCellWidth(); + Point getLeadingCell(); + + void checkTopCellIsMax(int idx); + } + + public void scrollToMiddle(JScrollPane jsp, Robot robot) + throws InterruptedException, InvocationTargetException { + SwingUtilities.invokeAndWait(() -> { + sb = jsp.getHorizontalScrollBar(); + loc = sb.getLocationOnScreen(); + size = sb.getSize(); + }); + robot.setAutoDelay(250); + + robot.mouseMove(loc.x + size.width / 2, + loc.y + size.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + SwingUtilities.invokeAndWait(() -> { + if (jsp == listScroller) { + int idx = list.getFirstVisibleIndex(); + list.ensureIndexIsVisible(idx); + } + }); + } + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(() -> f = new RTLScrollers()); + } finally { + SwingUtilities.invokeAndWait(() -> { + f.setVisible(true); + f.dispose(); + }); + } + } +} diff --git a/test/jdk/javax/swing/JScrollPane/bug4166037.java b/test/jdk/javax/swing/JScrollPane/bug4166037.java new file mode 100644 index 000000000000..e2ce75867a70 --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/bug4166037.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4166037 + * @summary Tests if changes to JScrollPane propagate to ScrollPaneLayout + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4166037 + */ + +import java.awt.Color; + +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ScrollPaneLayout; + +public class bug4166037 { + static final String INSTRUCTIONS = """ + Press button "Never". Scroll bars should disappear. + Press button "Always". Scroll bars should appear. + Press button "Colhead". Label ColumnHeader should + get replaced with yellow rectangles. + Press button "Corner". You should see 4 green + rectangles in the corners of the scroll pane. + Press button "Rowhead". Label RowHeader should get + replaced with yellow rectangles. + Press button "Viewport". Viewport (the rest of the + area except scrollbars) should get replaced with yellow + rectangles. + If the behavior is as described, the test PASSES. + Otherwise, this test FAILS. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4166037 Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4166037::createUI) + .logArea() + .build() + .awaitAndCheck(); + } + + static JFrame createUI() { + JFrame f = new JFrame("JScrollPane in JScrollLayout Test"); + JScrollPane scroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + JPanel p = new JPanel(); + scroll.setSize(200, 200); + f.add(scroll); + f.setLayout(new BoxLayout(f.getContentPane(), BoxLayout.Y_AXIS)); + JButton bn = new JButton("Never"); + bn.addActionListener(e -> { + PassFailJFrame.log("pane before: " + + scroll.getVerticalScrollBarPolicy() + + scroll.getHorizontalScrollBarPolicy()); + PassFailJFrame.log("layout before: " + + ((ScrollPaneLayout) scroll.getLayout()).getVerticalScrollBarPolicy() + + ((ScrollPaneLayout) scroll.getLayout()).getHorizontalScrollBarPolicy()); + scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); + scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + PassFailJFrame.log("pane after: " + + scroll.getVerticalScrollBarPolicy() + + scroll.getHorizontalScrollBarPolicy()); + PassFailJFrame.log("layout after: " + + ((ScrollPaneLayout) scroll.getLayout()).getVerticalScrollBarPolicy() + + ((ScrollPaneLayout) scroll.getLayout()).getHorizontalScrollBarPolicy()); + }); + JButton ba = new JButton("Always"); + ba.addActionListener(e -> { + PassFailJFrame.log("pane before: " + + scroll.getVerticalScrollBarPolicy() + + scroll.getHorizontalScrollBarPolicy()); + PassFailJFrame.log("layout before: " + + ((ScrollPaneLayout) scroll.getLayout()).getVerticalScrollBarPolicy() + + ((ScrollPaneLayout) scroll.getLayout()).getHorizontalScrollBarPolicy()); + scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + PassFailJFrame.log("pane after: " + + scroll.getVerticalScrollBarPolicy() + + scroll.getHorizontalScrollBarPolicy()); + PassFailJFrame.log("layout after: " + + ((ScrollPaneLayout) scroll.getLayout()).getVerticalScrollBarPolicy() + + ((ScrollPaneLayout) scroll.getLayout()).getHorizontalScrollBarPolicy()); + }); + JLabel ch = new JLabel("ColumnHeader"); + scroll.setColumnHeaderView(ch); + JButton b1 = new JButton("Colhead"); + b1.addActionListener(e -> { + JPanel filler = new JPanel(); + filler.setSize(150, 150); + filler.setBackground(Color.yellow); + scroll.getColumnHeader().add(filler); + }); + JButton b2 = new JButton("Corners"); + b2.addActionListener(e -> { + JPanel filler1 = new JPanel(); + filler1.setSize(150, 150); + filler1.setBackground(Color.green); + scroll.setCorner(JScrollPane.LOWER_RIGHT_CORNER, filler1); + JPanel filler2 = new JPanel(); + filler2.setSize(150, 150); + filler2.setBackground(Color.green); + scroll.setCorner(JScrollPane.LOWER_LEFT_CORNER, filler2); + JPanel filler3 = new JPanel(); + filler3.setSize(150, 150); + filler3.setBackground(Color.green); + scroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, filler3); + JPanel filler4 = new JPanel(); + filler4.setSize(150, 150); + filler4.setBackground(Color.green); + scroll.setCorner(JScrollPane.UPPER_LEFT_CORNER, filler4); + }); + JLabel rh = new JLabel("RowHeader"); + scroll.setRowHeaderView(rh); + JButton b3 = new JButton("Rowhead"); + b3.addActionListener(e -> { + JPanel filler = new JPanel(); + filler.setSize(150, 150); + filler.setBackground(Color.yellow); + scroll.getRowHeader().add(filler); + }); + JButton b4 = new JButton("Viewport"); + b4.addActionListener(e -> { + JPanel filler = new JPanel(); + filler.setSize(150, 150); + filler.setBackground(Color.yellow); + scroll.getViewport().add(filler); + }); + + p.add(bn); + p.add(ba); + p.add(b1); + p.add(b2); + p.add(b3); + p.add(b4); + f.add(p); + f.setSize(300, 300); + return f; + } +} diff --git a/test/jdk/javax/swing/JScrollPane/bug4237517.java b/test/jdk/javax/swing/JScrollPane/bug4237517.java new file mode 100644 index 000000000000..4e1d13561998 --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/bug4237517.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4237517 + * @summary Tests that scrolling with blit draws the right thing + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4237517 + */ + +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JScrollPane; + +public class bug4237517 { + static final String INSTRUCTIONS = """ + Select the first item in the list and hit PageDown + key two times. If the list is redrawn correctly, + i.e. if the digits go in order, then the test PASSES. + Otherwise, the test FAILS. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4237517 Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4237517::createUI) + .build() + .awaitAndCheck(); + } + + static JFrame createUI() { + JFrame f = new JFrame("Scrolling Window Blit Test"); + String[] data = new String[100]; + + for (int counter = 0; counter < data.length; counter++) { + data[counter] = Integer.toString(counter); + } + JList list = new JList(data); + JScrollPane sp = new JScrollPane(list); + sp.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE); + f.add(sp); + f.setSize(200, 200); + return f; + } +} diff --git a/test/jdk/javax/swing/JScrollPane/bug4237560.java b/test/jdk/javax/swing/JScrollPane/bug4237560.java new file mode 100644 index 000000000000..4f8f27683e54 --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/bug4237560.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4237560 + * @summary Tests that JScrollPane do not distort TAB order in an HTML page + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4237560 + */ + +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JScrollPane; + +public class bug4237560 { + static final String INSTRUCTIONS = """ + A JEditorPane contains 10 input fields and is inserted into + JScrollPane. Click text field #8 so that it is selected. Press + TAB three times (even if text field #9 and #10 are not visible in + the ScrollPane). If this gives focus to the first text field (#1) + the test PASSES, else it FAILS. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4237560 Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4237560::createUI) + .build() + .awaitAndCheck(); + } + + private static final String TEXT = "
\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
"; + + private static JFrame createUI() { + JFrame frame = new JFrame("JScrollPane HTML TAB Test"); + JEditorPane viewer = new JEditorPane("text/html", TEXT); + viewer.setEditable(false); + frame.add(new JScrollPane(viewer)); + frame.setSize(300, 300); + return frame; + } +} diff --git a/test/jdk/javax/swing/JScrollPane/bug4244899.java b/test/jdk/javax/swing/JScrollPane/bug4244899.java new file mode 100644 index 000000000000..4cb5367f4f54 --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/bug4244899.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4244899 + * @summary Tests whether scrolling with blit has artifacts + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4244899 + */ + +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.table.AbstractTableModel; + +public class bug4244899 { + static final String INSTRUCTIONS = """ + Widen the first column of the table, so that + you get a horizontal scrollbar. Click in the + scrollbar (not on the thumb, but in the track). + If you notice some artifacts/flashing at + the bottom of the frame, the test FAILS. + Otherwise, the test PASSES. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4244899 Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4244899::createUI) + .build() + .awaitAndCheck(); + } + + static class TestModel extends AbstractTableModel { + private final int rows = 20; + private final int cols = 5; + + private Integer[][] data; + + public TestModel() { + data = new Integer[rows][]; + int realCount = 0; + for (int counter = 0; counter < rows; counter++) { + data[counter] = new Integer[cols]; + for (int y = 0; y < cols; y++) { + data[counter][y] = Integer.valueOf(realCount); + realCount = (realCount + 1) % 23; + } + } + } + + public int getRowCount() { + return data.length; + } + + public int getColumnCount() { + return data[0].length; + } + + public Object getValueAt(int row, int column) { + return data[row][column]; + } + } + + static JFrame createUI() { + JFrame f = new JFrame("Scrolling Blit Artifact Test"); + JTable table = new JTable(new TestModel()); + JScrollPane sp = new JScrollPane(table); + sp.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE); + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + f.add(sp); + f.setSize(400, 400); + return f; + } +} diff --git a/test/jdk/javax/swing/JSlider/bug4382876.java b/test/jdk/javax/swing/JSlider/bug4382876.java index b9ec64aab216..b0988de3cabd 100644 --- a/test/jdk/javax/swing/JSlider/bug4382876.java +++ b/test/jdk/javax/swing/JSlider/bug4382876.java @@ -48,8 +48,8 @@ public class bug4382876 { private static Robot r; private static JFrame f; private static JSlider slider; - private static boolean upFail; - private static boolean downFail; + private static volatile boolean upFail; + private static volatile boolean downFail; public static void main(String[] args) throws Exception { try { @@ -70,23 +70,30 @@ public static void main(String[] args) throws Exception { r.delay(1000); r.keyPress(KeyEvent.VK_PAGE_UP); + r.keyRelease(KeyEvent.VK_PAGE_UP); + SwingUtilities.invokeAndWait(() -> { if (slider.getValue() < -1000) { System.out.println("PAGE_UP VAL: " + slider.getValue()); upFail = true; } }); + if (upFail) { writeFailImage(); throw new RuntimeException("Slider value did NOT change with PAGE_UP"); } + r.keyPress(KeyEvent.VK_PAGE_DOWN); + r.keyRelease(KeyEvent.VK_PAGE_DOWN); + SwingUtilities.invokeAndWait(() -> { if (slider.getValue() > -1000) { System.out.println("PAGE_DOWN VAL: " + slider.getValue()); downFail = true; } }); + if (downFail) { writeFailImage(); throw new RuntimeException("Slider value did NOT change with PAGE_DOWN"); diff --git a/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java b/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java index 4060042ca4f7..994a03959b2b 100644 --- a/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java +++ b/test/jdk/javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ public static void main(String args[]) throws Exception { robot.setAutoDelay(50); SwingUtilities.invokeAndWait(() -> { - frame = new JFrame(); + frame = new JFrame("JSpinnerButtonFocusTest"); spinner1 = new JSpinner(); spinner2 = new JSpinner(); @@ -72,6 +72,15 @@ public static void main(String args[]) throws Exception { frame.getContentPane().add(spinner2, BorderLayout.SOUTH); editor1 = ((DefaultEditor)spinner1.getEditor()); + editor1.getTextField().addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + super.focusGained(e); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + latch1.countDown(); + } + }); editor1.setFocusable(false); spinner1.setFocusable(false); @@ -84,26 +93,18 @@ public static void main(String args[]) throws Exception { frame.setFocusTraversalPolicyProvider(true); frame.setAlwaysOnTop(true); - frame.pack(); + frame.setSize(100, 100); + frame.setLocationRelativeTo(null); frame.setVisible(true); }); robot.waitForIdle(); - - editor1.getTextField().addFocusListener(new FocusAdapter() { - @Override - public void focusGained(FocusEvent e) { - super.focusGained(e); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); - latch1.countDown(); - } - }); + robot.delay(1000); SwingUtilities.invokeAndWait(() -> { editor1.getTextField().requestFocusInWindow(); }); - if (!latch1.await(15, TimeUnit.MINUTES)) { + if (!latch1.await(1, TimeUnit.MINUTES)) { throw new RuntimeException(LF.getClassName() + ": Timeout waiting for editor1 to gain focus."); } diff --git a/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java b/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java index 10de2ab221ad..4d2fdcf030cd 100644 --- a/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java +++ b/test/jdk/javax/swing/JTabbedPane/4624207/bug4624207.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,25 +25,26 @@ * @test * @key headful * @bug 4624207 + * @requires (os.family != "mac") * @summary JTabbedPane mnemonics don't work from outside the tabbed pane - * @author Oleg Mokhovikov - * @library /test/lib - * @library ../../regtesthelpers - * @build Util jdk.test.lib.Platform * @run main bug4624207 */ -import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.*; + +import java.awt.BorderLayout; +import java.awt.Robot; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyEvent; -import jdk.test.lib.Platform; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JTabbedPane; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; public class bug4624207 implements ChangeListener, FocusListener { - private static volatile boolean stateChanged = false; private static volatile boolean focusGained = false; private static JTextField txtField; @@ -71,51 +72,39 @@ public static void main(String[] args) throws Exception { Robot robot = new Robot(); robot.setAutoDelay(50); - SwingUtilities.invokeAndWait(new Runnable() { - - public void run() { - createAndShowGUI(); - } - }); - + SwingUtilities.invokeAndWait(() -> createAndShowGUI()); robot.waitForIdle(); - - SwingUtilities.invokeAndWait(new Runnable() { - - public void run() { - txtField.requestFocus(); - } - }); - + SwingUtilities.invokeAndWait(() -> txtField.requestFocus()); robot.waitForIdle(); if (!focusGained) { throw new RuntimeException("Couldn't gain focus for text field"); } - SwingUtilities.invokeAndWait(new Runnable() { - - public void run() { - tab.addChangeListener((ChangeListener) listener); - txtField.removeFocusListener((FocusListener) listener); - } + SwingUtilities.invokeAndWait(() -> { + tab.addChangeListener((ChangeListener) listener); + txtField.removeFocusListener((FocusListener) listener); }); robot.waitForIdle(); - if (Platform.isOSX()) { - Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_B); - } else { - Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_B); - } + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_B); + robot.keyRelease(KeyEvent.VK_B); + robot.keyRelease(KeyEvent.VK_ALT); robot.waitForIdle(); if (!stateChanged || tab.getSelectedIndex() != 1) { - throw new RuntimeException("JTabbedPane mnemonics don't work from outside the tabbed pane"); + throw new RuntimeException("JTabbedPane mnemonics don't " + + "work from outside the tabbed pane"); } } finally { - if (frame != null) SwingUtilities.invokeAndWait(() -> frame.dispose()); + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); } } diff --git a/test/jdk/javax/swing/plaf/motif/bug4150591.java b/test/jdk/javax/swing/plaf/motif/bug4150591.java index 66c668a441c3..f3614908cfff 100644 --- a/test/jdk/javax/swing/plaf/motif/bug4150591.java +++ b/test/jdk/javax/swing/plaf/motif/bug4150591.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 @@ -23,6 +23,7 @@ import com.sun.java.swing.plaf.motif.MotifInternalFrameTitlePane; import javax.swing.JInternalFrame; +import javax.swing.UIManager; /* * @test @@ -36,7 +37,8 @@ */ public class bug4150591 { - public static void main(String[] args) { + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); MotifInternalFrameTitlePane mtp = new MotifInternalFrameTitlePane(new JInternalFrame()); } } diff --git a/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java b/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java index 19d6d6a86079..c02fcfcfb907 100644 --- a/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java +++ b/test/jdk/javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -222,11 +222,11 @@ public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.draw(new Line2D.Float(c, cy, c, cy + ch)); - g2d.draw(new Line2D.Float(cx, cy, cx + cw, cy)); - g2d.draw(new Line2D.Float(cx, cy + ch, cx + cw, cy + ch)); } void repaint(Rectangle r) { + r.width += 1; + r.height += 1; component.repaint(r); } @@ -424,6 +424,8 @@ protected void adjustVisibility(Rectangle nloc) { protected synchronized void damage(Rectangle r) { if (r != null && component != null) { + r.width += 1; + r.height += 1; component.repaint(r); } } diff --git a/test/jdk/javax/swing/text/JTextComponent/bug4532590.java b/test/jdk/javax/swing/text/JTextComponent/bug4532590.java new file mode 100644 index 000000000000..d317a33fdea2 --- /dev/null +++ b/test/jdk/javax/swing/text/JTextComponent/bug4532590.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4532590 + * @summary Tests that selection is not painted when highlighter is set to null + * @run main bug4532590 + */ + +import java.awt.Color; +import java.awt.image.BufferedImage; +import javax.swing.JTextArea; +import javax.swing.JTextPane; +import javax.swing.text.BadLocationException; +import javax.swing.text.DefaultStyledDocument; +import javax.swing.text.JTextComponent; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.SwingUtilities; + +public class bug4532590 { + + static final int SELECTION_START = 5; + static final int SELECTION_END = 10; + static final String TEXT = "Typein the missing word."; + + static final Color TEXT_FG = Color.BLACK; + static final Color TEXT_BG = Color.WHITE; + static final Color SELECTION_FG = Color.RED; + static final Color SELECTION_BG = Color.YELLOW; + + JTextComponent[] comps; + JTextPane pane; + JTextArea area, warea; + + int selFG = SELECTION_FG.getRGB(); + int selBG = SELECTION_BG.getRGB(); + + public bug4532590() throws BadLocationException { + // text pane + pane = new JTextPane(); + pane.setContentType("text/plain"); + + // populate the pane + DefaultStyledDocument dsd = new DefaultStyledDocument(); + dsd.insertString(0, "\n" + TEXT + "\n\n", new SimpleAttributeSet()); + pane.setDocument(dsd); + + // text area + area = new JTextArea(); + area.setText("\n" + TEXT); + + // wrapped text area + warea = new JTextArea(); + warea.setText("\n" + TEXT); + + comps = new JTextComponent[3]; + comps[0] = pane; + comps[1] = area; + comps[2] = warea; + } + + void initComp(JTextComponent comp) { + comp.setEditable(false); + comp.setForeground(TEXT_FG); + comp.setBackground(TEXT_BG); + comp.setSelectedTextColor(SELECTION_FG); + comp.setSelectionColor(SELECTION_BG); + comp.setHighlighter(null); + comp.setSize(comp.getPreferredSize()); + + comp.setSelectionStart(SELECTION_START); + comp.setSelectionEnd(SELECTION_END); + comp.getCaret().setSelectionVisible(true); + } + + /** + * Paint given component on an offscreen buffer + */ + BufferedImage drawComp(JTextComponent comp) { + int w = comp.getWidth(); + int h = comp.getHeight(); + + BufferedImage img = + new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); + comp.paint(img.createGraphics()); + return img; + } + + void testComp(JTextComponent comp) { + initComp(comp); + BufferedImage img = drawComp(comp); + int w = img.getWidth(null); + int h = img.getHeight(null); + + // scan the image + // there should be no SELECTION_FG or SELECTION_BG pixels + for (int i = 0; i < w; i++) { + for (int j = 0; j < h; j++) { + int rgb = img.getRGB(i, j); + if (rgb == selFG) { + throw new RuntimeException( + "Failed: selection foreground painted"); + } else if (rgb == selBG) { + throw new RuntimeException( + "Failed: selection background painted"); + } + } + } + } + + void test() { + for (int i = 0; i < comps.length; i++) { + testComp(comps[i]); + } + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(() -> { + try { + new bug4532590().test(); + } catch (BadLocationException e) { + throw new RuntimeException(e); + } + }); + } +} diff --git a/test/jdk/jbA11yProblemList.txt b/test/jdk/jbA11yProblemList.txt index b2fea0aa3e6e..7fd64580cdba 100644 --- a/test/jdk/jbA11yProblemList.txt +++ b/test/jdk/jbA11yProblemList.txt @@ -195,7 +195,6 @@ java/awt/FullScreen/MultimonFullscreenTest/MultimonDeadlockTest.java JBR-5505 wi java/awt/hidpi/DrawOnFrameGraphicsTest.java JBR-5505 windows-all java/awt/im/4959409/bug4959409.java JBR-5505 windows-all java/awt/im/memoryleak/InputContextMemoryLeakTest.java JBR-5505 windows-all -java/awt/image/VolatileImage/DrawBufImgOp.java java/awt/LightweightComponent/MultipleAddNotifyTest/MultipleAddNotifyTest.java JBR-9252 windows-all java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java JBR-5505 windows-all java/awt/List/ItemEventTest/ItemEventTest.java JBR-5711,JBR-5505 windows-all,linux-all diff --git a/test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java b/test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java index ff5d52d95a65..62549e7b5183 100644 --- a/test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java +++ b/test/jdk/jdk/internal/platform/docker/MetricsCpuTester.java @@ -145,9 +145,13 @@ private static void testCpuSetMemNodes(String cpusetMems) { private static void testCpuShares(long shares) { Metrics metrics = Metrics.systemMetrics(); if ("cgroupv2".equals(metrics.getProvider()) && shares < 1024) { - // Adjust input shares for < 1024 cpu shares as the - // impl. rounds up to the next multiple of 1024 - shares = 1024; + // Don't assert for shares values less than 1024 as we don't + // have a 1-to-1 mapping from the cgroup v2 value to the OCI + // value. + System.out.println("Debug: cgv2 - Got CPU shares of: " + + metrics.getCpuShares() + " - Skipping assert."); + System.out.println("TEST PASSED!!!"); + return; } long newShares = metrics.getCpuShares(); if (newShares != shares) { diff --git a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java index 2afb5ed93b1e..8d63e76c141e 100644 --- a/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java +++ b/test/jdk/jdk/internal/platform/docker/TestDockerMemoryMetrics.java @@ -82,9 +82,7 @@ public static void main(String[] args) throws Exception { testMemorySoftLimit("500m","200m"); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java index b9d031f03090..5a89c04796aa 100644 --- a/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java +++ b/test/jdk/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java @@ -53,9 +53,7 @@ public static void main(String[] args) throws Exception { "150M", Integer.toString(0) ); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java b/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java index 31e90e8802a9..ee9e7f41ab0e 100644 --- a/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java +++ b/test/jdk/jdk/internal/platform/docker/TestLimitsUpdating.java @@ -64,9 +64,7 @@ public static void main(String[] args) throws Exception { try { testLimitUpdates(); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java b/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java index 6b19bb475f13..04c172b13b8f 100644 --- a/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java +++ b/test/jdk/jdk/internal/platform/docker/TestPidsLimit.java @@ -60,9 +60,7 @@ public static void main(String[] args) throws Exception { testPidsLimit("2000"); testPidsLimit("Unlimited"); } finally { - if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { - DockerTestUtils.removeDockerImage(imageName); - } + DockerTestUtils.removeDockerImage(imageName); } } diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java index 18bfa57a4b18..903df39628c4 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestFilledChunks.java @@ -26,6 +26,7 @@ import java.util.Random; import jdk.jfr.Event; +import jdk.jfr.StackTrace; import jdk.jfr.consumer.RecordingStream; /** @@ -38,6 +39,7 @@ */ public class TestFilledChunks { + @StackTrace(false) static class FillEvent extends Event { String message; int value; diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestMetadataReconstructionWithRetainedStringPool.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestMetadataReconstructionWithRetainedStringPool.java new file mode 100644 index 000000000000..8bbadc6db290 --- /dev/null +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestMetadataReconstructionWithRetainedStringPool.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.jfr.api.consumer.streaming; + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.CountDownLatch; + +import jdk.jfr.Event; +import jdk.jfr.consumer.RecordingStream; + +/** + * @test + * @summary Test that it is possible to register new metadata in a new segment while retaining the string pool. + * @requires vm.flagless + * @requires vm.hasJFR + * @library /test/lib + * @run main/othervm jdk.jfr.api.consumer.streaming.TestMetadataReconstructionWithRetainedStringPool + */ +public class TestMetadataReconstructionWithRetainedStringPool { + /// Minimum string length required to trigger StringPool usage. + /// Mirrors `jdk.jfr.internal.StringPool.MIN_LIMIT`. + private static final int STRING_POOL_MIN_LIMIT = 16; + private static final int EXPECTED_EVENTS = 3; + + // Condition 1: String length > STRING_POOL_MIN_LIMIT triggers CONSTANT_POOL encoding. + private static final String TEXT = "a".repeat(STRING_POOL_MIN_LIMIT + 1);; + + static final class EventA extends Event { + String text = TEXT; + } + + static final class EventB extends Event { + String text = TEXT; + } + + public static void main(String... args) throws InterruptedException { + var aEventsPosted = new CountDownLatch(1); + var readyToPostEventB = new CountDownLatch(1); + var remaining = new CountDownLatch(EXPECTED_EVENTS); + + try (var rs = new RecordingStream()) { + rs.onEvent(e -> { + String textValue = e.getValue("text"); + if (textValue == null) { + throw new RuntimeException("e.getValue(\"text\") returned null"); + } + remaining.countDown(); + System.out.printf("Event #%d [%s]: text=%s%n", + EXPECTED_EVENTS - remaining.getCount(), + e.getEventType().getName(), + textValue); + }); + + rs.onFlush(() -> { + if (aEventsPosted.getCount() == 0) { + readyToPostEventB.countDown(); + } + }); + + rs.startAsync(); + + // Condition 2: Two distinct event types are required. + // First, load EventA as the initial event type and emit its first event. + // This first event looks into the StringPool pre-cache. Although the + // string length qualifies for pooling, because it isn't pre-cached, + // the first event encodes the string inline. + // The second event finds the string in the pre-cache and adds it to the + // pool. A constant pool ID to the pooled string is encoded in the event. + // + new EventA().commit(); + new EventA().commit(); + aEventsPosted.countDown(); + + // Condition 3: Wait for JFR flush. + // The default flush period is ~1 second. + readyToPostEventB.await(); + + // Load the second event type, EventB, AFTER the flush segment containing the two events of type EventA. + // A new metadata description will be constructed, and we verify that the StringPool added in the previous + // segment is still available for the EventB string pool reference to be resolved correctly. + new EventB().commit(); + remaining.await(); + } + } +} diff --git a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java index baae06b8ec71..c9265d21023b 100644 --- a/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java +++ b/test/jdk/jdk/jfr/api/consumer/streaming/TestStartMultiChunk.java @@ -44,7 +44,7 @@ */ public class TestStartMultiChunk { - @Period("10 s") + @Period("2 s") @Name("Zebra") static class ZebraEvent extends Event { } @@ -65,7 +65,7 @@ public static void main(String... args) throws Exception { CountDownLatch dogLatch = new CountDownLatch(1); CountDownLatch catLatch = new CountDownLatch(1); CountDownLatch mouseLatch = new CountDownLatch(1); - CountDownLatch zebraLatch = new CountDownLatch(3); + CountDownLatch zebraLatch = new CountDownLatch(2); FlightRecorder.addPeriodicEvent(ZebraEvent.class, () -> { ZebraEvent ze = new ZebraEvent(); diff --git a/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java b/test/jdk/jdk/jfr/event/gc/detailed/TestZAllocationStallEvent.java index 3222559554eb..2e4ed916770d 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, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,8 @@ * @requires vm.hasJFR & vm.gc.ZSinglegen * @key jfr * @library /test/lib /test/jdk /test/hotspot/jtreg - * @run main/othervm -XX:+UseZGC -XX:-ZGenerational -Xmx32M jdk.jfr.event.gc.detailed.TestZAllocationStallEvent + * @run main/othervm -XX:+UseZGC -XX:-ZGenerational -Xmx32M + * jdk.jfr.event.gc.detailed.TestZAllocationStallEvent */ /** @@ -44,7 +45,8 @@ * @requires vm.hasJFR & vm.gc.ZGenerational * @key jfr * @library /test/lib /test/jdk /test/hotspot/jtreg - * @run main/othervm -XX:+UseZGC -XX:+ZGenerational -Xmx32M jdk.jfr.event.gc.detailed.TestZAllocationStallEvent + * @run main/othervm -XX:+UseZGC -XX:+ZGenerational -Xmx32M + * jdk.jfr.event.gc.detailed.TestZAllocationStallEvent */ public class TestZAllocationStallEvent { @@ -55,7 +57,7 @@ public static void main(String[] args) throws Exception { recording.start(); // Allocate many large objects quickly, to outrun the GC - for (int i = 0; i < 100; i++) { + for (int i = 0; i < 1000; i++) { blackHole(new byte[16 * 1024 * 1024]); } diff --git a/test/jdk/jdk/jfr/event/oldobject/OldObjects.java b/test/jdk/jdk/jfr/event/oldobject/OldObjects.java index ba90bb10a9ee..bb0ca27836ea 100644 --- a/test/jdk/jdk/jfr/event/oldobject/OldObjects.java +++ b/test/jdk/jdk/jfr/event/oldobject/OldObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -276,4 +276,16 @@ public static void validateReferenceChainLimit(RecordedEvent e, int maxLength) { throw new RuntimeException("Reference chain max length not respected. Found a chain of length " + length); } } + + public static int countChains(List events) throws IOException { + int found = 0; + for (RecordedEvent e : events) { + RecordedObject ro = e.getValue("object"); + if (ro.getValue("referrer") != null) { + found++; + } + } + System.out.println("Found chains: " + found); + return found; + } } diff --git a/test/jdk/jdk/jfr/event/oldobject/TestDFSWithSmallStack.java b/test/jdk/jdk/jfr/event/oldobject/TestDFSWithSmallStack.java new file mode 100644 index 000000000000..d25a6cd5f67e --- /dev/null +++ b/test/jdk/jdk/jfr/event/oldobject/TestDFSWithSmallStack.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2026, IBM Corp. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jfr.event.oldobject; + +import java.util.LinkedList; +import java.util.List; + +import jdk.jfr.Recording; +import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.internal.test.WhiteBox; +import jdk.test.lib.jfr.EventNames; +import jdk.test.lib.jfr.Events; + +/** + * @test id=dfsonly + * @summary Tests that DFS works with a small stack + * @library /test/lib /test/jdk + * @requires vm.hasJFR + * @modules jdk.jfr/jdk.jfr.internal.test + * @run main/othervm -Xmx2g -XX:VMThreadStackSize=512 jdk.jfr.event.oldobject.TestDFSWithSmallStack dfsonly + */ + +/** + * @test id=bfsdfs + * @summary Tests that DFS works with a small stack + * @library /test/lib /test/jdk + * @requires vm.hasJFR + * @modules jdk.jfr/jdk.jfr.internal.test + * @run main/othervm -Xmx2g -XX:VMThreadStackSize=512 jdk.jfr.event.oldobject.TestDFSWithSmallStack bfsdfs + */ +public class TestDFSWithSmallStack { + + // Tests depth first search with a small stack. + + // An non-zero exit code, together with a missing hs-err file or possibly a missing jfr file, + // indicates a native stack overflow happened and is a fail condition for this test. + + // We build up an array of linked lists, each containing enough entries for DFS search to + // max out max_dfs_depth (but not greatly surpass it). + + private static final int TOTAL_OBJECTS = 10_000_000; + private static final int OBJECTS_PER_LIST = 5_000; + public static LinkedList[] leak; + + public static void main(String... args) throws Exception { + + switch (args[0]) { + case "dfsonly" -> WhiteBox.setSkipBFS(true); + case "bfsdfs" -> {} /* ignored */ + default -> throw new RuntimeException("Invalid argument"); + } + + WhiteBox.setWriteAllObjectSamples(true); + int count = 10; + + while (count > 0) { + try (Recording r = new Recording()) { + r.enable(EventNames.OldObjectSample).with("cutoff", "infinity"); + r.start(); + leak = new LinkedList[TOTAL_OBJECTS / OBJECTS_PER_LIST]; + for (int i = 0; i < leak.length; i++) { + leak[i] = new LinkedList(); + for (int j = 0; j < OBJECTS_PER_LIST; j++) { + leak[i].add(new Object()); + } + } + System.gc(); + r.stop(); + List events = Events.fromRecording(r); + Events.hasEvents(events); + if (OldObjects.countChains(events) >= 30) { + return; + } + System.out.println("Not enough chains found, retrying."); + } + count--; + leak = null; + } + } +} diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java b/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java index 6a07c57ff787..62d22c821713 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestEnableDisable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ /** * @test * @key jfr - * @summary Tests that event settings for a RemoteRecordingStream can be changed + * @summary Tests that the enabled setting can be configured for a RemoteRecordingStream * @requires vm.hasJFR * @library /test/lib /test/jdk * @run main/othervm jdk.jfr.jmx.streaming.TestEnableDisable diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java b/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java index 7bf389c75ad8..69f36b2ec2a3 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestMaxSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ import javax.management.MBeanServerConnection; import jdk.jfr.Event; +import jdk.jfr.StackTrace; import jdk.management.jfr.RemoteRecordingStream; /** @@ -45,6 +46,7 @@ */ public class TestMaxSize { + @StackTrace(false) static class Monkey extends Event { } @@ -92,7 +94,7 @@ private static void emitEvents(int count) throws InterruptedException { m.commit(); } System.out.println("Emitted " + count + " events"); - Thread.sleep(1000); + Thread.sleep(100); } private static int fileCount(Path dir) throws IOException { diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java b/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java index 51e0c815dc0b..7a2b52b9deb7 100644 --- a/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java +++ b/test/jdk/jdk/jfr/jmx/streaming/TestRemoteDump.java @@ -97,7 +97,7 @@ private static void testClosed() throws Exception { } } - private static List recordWithPolicy(String filename, Consumer policy) throws Exception { + private static List recordWithPolicy(String filename, boolean awaitEvents, Consumer policy) throws Exception { CountDownLatch latch1 = new CountDownLatch(1); CountDownLatch latch2 = new CountDownLatch(2); CountDownLatch latch3 = new CountDownLatch(3); @@ -111,14 +111,18 @@ private static List recordWithPolicy(String filename, Consumer recordWithPolicy(String filename, Consumer { + var events = recordWithPolicy("max-size.jfr", false, rs -> { // keeps all events for the dump rs.setMaxSize(100_000_000); }); @@ -140,7 +144,7 @@ private static void testSetMaxSize() throws Exception { } private static void testSetMaxAge() throws Exception { - var events = recordWithPolicy("max-age.jfr", rs -> { + var events = recordWithPolicy("max-age.jfr", false, rs -> { // keeps all events for the dump rs.setMaxAge(Duration.ofDays(1)); }); @@ -151,7 +155,7 @@ private static void testSetMaxAge() throws Exception { } private static void testSetNoPolicy() throws Exception { - var events = recordWithPolicy("no-policy.jfr", rs -> { + var events = recordWithPolicy("no-policy.jfr", true, rs -> { // use default policy, remove after consumption }); // Since latch3 have been triggered at least two events/chunks diff --git a/test/jdk/jdk/jfr/jmx/streaming/TestWithers.java b/test/jdk/jdk/jfr/jmx/streaming/TestWithers.java new file mode 100644 index 000000000000..933337ef76b9 --- /dev/null +++ b/test/jdk/jdk/jfr/jmx/streaming/TestWithers.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jfr.jmx.streaming; + +import java.lang.management.ManagementFactory; +import java.time.Duration; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.function.Consumer; +import java.util.function.Predicate; + +import javax.management.MBeanServerConnection; + +import jdk.jfr.Event; +import jdk.jfr.EventSettings; +import jdk.jfr.FlightRecorder; +import jdk.jfr.Name; +import jdk.jfr.Period; +import jdk.jfr.StackTrace; +import jdk.jfr.Threshold; +import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.consumer.RecordedStackTrace; +import jdk.management.jfr.RemoteRecordingStream; + +/** + * @test + * @requires vm.flagless + * @summary Tests that event settings for a RemoteRecordingStream can be changed + * @requires vm.hasJFR + * @library /test/lib /test/jdk + * @run main/othervm jdk.jfr.jmx.streaming.TestWithers + */ +public class TestWithers { + private static final Set RESULT = Collections.synchronizedSet(new HashSet<>()); + + @Name("AA") + @StackTrace(false) + static class A extends Event { + } + + @Name("BB") + @StackTrace(true) + static class B extends Event { + } + + @Name("CC") + @Threshold("10 h") + static class C extends Event { + } + + @Name("DD") + @Threshold("10 h") + static class D extends Event { + } + + @Name("EE") + @StackTrace(false) + static class E extends Event { + } + + @Name("FF") + @Period("10 h") + static class F extends Event { + } + + public static void main(String... args) throws Exception { + MBeanServerConnection conn = ManagementFactory.getPlatformMBeanServer(); + try (RemoteRecordingStream stream = new RemoteRecordingStream(conn)) { + addCheck(stream, es -> es.withStackTrace(), "AA", TestWithers::hasStackTrace); + addCheck(stream, es -> es.withoutStackTrace(), "BB", e -> !hasStackTrace(e)); + addCheck(stream, es -> es.withThreshold(Duration.ofMillis(0)), "CC", e -> true); + addCheck(stream, es -> es.withoutThreshold(), "DD", e -> true); + addCheck(stream, es -> es.with("stackTrace", "true"), "EE", TestWithers::hasStackTrace); + addCheck(stream, es -> es.withPeriod(Duration.ofMillis(700)), "FF", e -> true); + FlightRecorder.addPeriodicEvent(F.class, () -> { + F f = new F(); + f.commit(); + }); + stream.onFlush(() -> { + System.out.println(RESULT); + if (RESULT.size() == 6) { + stream.close(); + } + }); + + stream.startAsync(); + A a = new A(); + a.commit(); + + B b = new B(); + b.commit(); + + C c = new C(); + c.commit(); + + D d = new D(); + d.commit(); + + E e = new E(); + e.commit(); + + stream.awaitTermination(); + } + } + + private static void addCheck(RemoteRecordingStream stream, Consumer es, String eventName, Predicate validator) { + es.accept(stream.enable(eventName)); + stream.onEvent(eventName, e -> { + System.out.println(e); + if (validator.test(e)) { + RESULT.add(eventName); + } + }); + } + + private static boolean hasStackTrace(RecordedEvent e) { + RecordedStackTrace rs = e.getStackTrace(); + return rs != null && !rs.getFrames().isEmpty(); + } +} \ No newline at end of file diff --git a/test/jdk/jdk/jfr/jvm/TestWaste.java b/test/jdk/jdk/jfr/jvm/TestWaste.java index 0cc1010765eb..c460fe90a1d5 100644 --- a/test/jdk/jdk/jfr/jvm/TestWaste.java +++ b/test/jdk/jdk/jfr/jvm/TestWaste.java @@ -61,7 +61,7 @@ public static void main(String... args) throws Exception { try (Recording r = new Recording(c)) { // Old objects that are cleared out should not create waste r.enable("jdk.OldObjectSample") - .with("cutoff", "infinity") + .with("cutoff", "2 s") .withStackTrace(); // No stack trace waste from allocation sample r.enable("jdk.ObjectAllocationSample") diff --git a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java index 24be874a87f6..391a456962c4 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java +++ b/test/jdk/jdk/jfr/startupargs/TestMultipleStartupRecordings.java @@ -74,13 +74,6 @@ private static void launchTernary(String options1, String options2, String optio test(pb, "Started recording 1", "Started recording 2", "Started recording 3"); } - private static void testDefault() throws Exception { - System.out.println("testDefault"); - launchUnary(null); - launchBinary(null, null); - launchTernary(null, null, null); - } - private static void testColonDelimited() throws Exception { launchBinary(":name=myrecording1,filename=myrecording1.jfr", ":filename=myrecording2.jfr,name=myrecording2"); } @@ -99,7 +92,6 @@ private static void testWithFlightRecorderOptions() throws Exception { } public static void main(String[] args) throws Exception { - testDefault(); testColonDelimited(); testMixed(); testWithFlightRecorderOptions(); diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java index bdc294aeb229..e2581683aed9 100644 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -543,6 +543,34 @@ * sectigotlsroote46 CRL */ +/* + * @test id=wisekeyglobalrootgbca + * @bug 8372351 + * @summary Interoperability tests with OISTE WISeKey Global Root GB CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp CAInterop + * wisekeyglobalrootgbca OCSP + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp + * -Dcom.sun.security.ocsp.useget=false CAInterop wisekeyglobalrootgbca OCSP + * @run main/othervm/manual -Djava.security.debug=certpath CAInterop + * wisekeyglobalrootgbca CRL + */ + +/* + * @test id=wisekeyglobalrootgcca + * @bug 8372351 + * @summary Interoperability tests with OISTE WISeKey Global Root GC CA + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp CAInterop + * wisekeyglobalrootgcca OCSP + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp + * -Dcom.sun.security.ocsp.useget=false CAInterop wisekeyglobalrootgcca OCSP + * @run main/othervm/manual -Djava.security.debug=certpath CAInterop + * wisekeyglobalrootgcca CRL + */ + /** * Collection of certificate validation tests for interoperability with external CAs. * These tests are marked as manual as they depend on external infrastructure and may fail @@ -721,6 +749,13 @@ private CATestURLs getTestURLs(String alias) { new CATestURLs("https://sectigopublicserverauthenticationroote46-ev.sectigo.com", "https://sectigopublicserverauthenticationroote46-ev.sectigo.com:444"); + case "wisekeyglobalrootgbca" -> + new CATestURLs("https://gbvalidssl.hightrusted.com", + "https://gbrevokedssl.hightrusted.com"); + case "wisekeyglobalrootgcca" -> + new CATestURLs("https://gcvalidssl.hightrusted.com", + "https://gcrevokedssl.hightrusted.com"); + default -> throw new RuntimeException("No test setup found for: " + alias); }; } diff --git a/test/jdk/sun/java2d/OpenGL/DrawBitmaskImage.java b/test/jdk/sun/java2d/OpenGL/DrawBitmaskImage.java new file mode 100644 index 000000000000..d2730593b5b1 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/DrawBitmaskImage.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6248561 6264014 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that bitmask image copies work properly with the + * OGL pipeline when a SrcOver composite with extra alpha is involved. + * @run main/othervm -Dsun.java2d.opengl=True DrawBitmaskImage + * @run main/othervm DrawBitmaskImage + */ + +/* + * @test + * @bug 6248561 6264014 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that bitmask image copies work properly with the + * OGL pipeline when a SrcOver composite with extra alpha is involved. + * @run main/othervm -Dsun.java2d.opengl=True DrawBitmaskImage + * @run main/othervm DrawBitmaskImage + */ + +import java.awt.AlphaComposite; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Transparency; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.IndexColorModel; +import java.io.File; +import javax.imageio.ImageIO; + +public class DrawBitmaskImage extends Panel { + + static final int TESTW = 200, TESTH = 200; + private static volatile DrawBitmaskImage test; + private static volatile Frame frame; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + g2d.setColor(Color.black); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.setComposite(AlphaComposite.SrcOver.derive(0.50f)); + + BufferedImage img = getGraphicsConfiguration().createCompatibleImage(50, 50, + Transparency.BITMASK); + Graphics2D gimg = img.createGraphics(); + gimg.setComposite(AlphaComposite.Src); + gimg.setColor(new Color(0, 0, 0, 0)); + gimg.fillRect(0, 0, 50, 50); + gimg.setColor(Color.red); + gimg.fillRect(10, 10, 30, 30); + gimg.dispose(); + + + g2d.drawImage(img, 10, 10, null); + + // draw a second time to ensure that the cached copy is used + g2d.drawImage(img, 80, 10, null); + } + + public Dimension getPreferredSize() { + return new Dimension(TESTW, TESTH); + } + + static void createUI() { + test = new DrawBitmaskImage(); + frame = new Frame("OpenGL DrawBitmaskImage Test"); + Panel p = new Panel(); + p.add(test); + frame.add(p); + frame.setSize(TESTW+100, TESTH+100); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(DrawBitmaskImage::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + BufferedImage capture = null; + try { + GraphicsConfiguration gc = frame.getGraphicsConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.out.println("IndexColorModel detected: " + + "test considered PASSED"); + return; + } + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, TESTW, TESTH); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test background color + int pixel = capture.getRGB(5, 10); + if (pixel != 0xff000000) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "background (actual=" + + Integer.toHexString(pixel) + ")"); + } + + // Test pixels (allow for small error in the actual red value) + pixel = capture.getRGB(25, 25); + System.out.println("pixel1 is " + Integer.toHexString(pixel)); + + if ((pixel < 0xff7e0000) || (pixel > 0xff900000)) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "first pixel (actual=" + + Integer.toHexString(pixel) + ")"); + } + + pixel = capture.getRGB(95, 25); + System.out.println("pixel2 is " + Integer.toHexString(pixel)); + if ((pixel < 0xff7e0000) || (pixel > 0xff900000)) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "second pixel (actual=" + + Integer.toHexString(pixel) + ")"); + } + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/java/awt/image/VolatileImage/DrawBufImgOp.java b/test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java similarity index 85% rename from test/jdk/java/awt/image/VolatileImage/DrawBufImgOp.java rename to test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java index 011b5e661678..5d60eb7e792a 100644 --- a/test/jdk/java/awt/image/VolatileImage/DrawBufImgOp.java +++ b/test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,20 +20,54 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* + * @test + * @bug 6514990 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that calling + * Graphics2D.drawImage(BufferedImage, BufferedImageOp, x, y) to an + * OpenGL-accelerated destination produces the same results when performed + * in software via BufferedImageOp.filter(). + * @run main/othervm -Dsun.java2d.opengl=True DrawBufImgOp -ignore + */ + /* * @test + * @bug 6514990 * @key headful - * @bug 6514990 8198613 + * @requires (os.family == "mac") * @summary Verifies that calling * Graphics2D.drawImage(BufferedImage, BufferedImageOp, x, y) to an - * accelerated destination produces the same results when performed + * OpenGL-accelerated destination produces the same results when performed * in software via BufferedImageOp.filter(). - * @run main/othervm DrawBufImgOp -ignore - * @author campbelc + * @run main/othervm -Dsun.java2d.opengl=True DrawBufImgOp -ignore */ -import java.awt.*; -import java.awt.image.*; +import java.awt.AlphaComposite; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.ByteLookupTable; +import java.awt.image.ColorModel; +import java.awt.image.ConvolveOp; +import java.awt.image.IndexColorModel; +import java.awt.image.Kernel; +import java.awt.image.LookupOp; +import java.awt.image.RescaleOp; +import java.awt.image.ShortLookupTable; +import java.awt.image.VolatileImage; import java.io.File; import javax.imageio.ImageIO; @@ -51,14 +85,16 @@ * any exceptions/crashes in the OGL code. When we fix all of the * outstanding bugs with the software codepaths, we can remove the * "-ignore" flag and maybe even restore the "-compare" flag. In the - * meantime, it stil functions well as a manual testcase (with either + * meantime, it also functions well as a manual testcase (with either * the "-show" or "-dump" options). */ public class DrawBufImgOp extends Canvas { private static final int TESTW = 600; private static final int TESTH = 500; - private static boolean done; + + private static volatile DrawBufImgOp test; + private static volatile Frame frame; /* * If true, skips tests that are known to trigger bugs (which in @@ -184,11 +220,6 @@ public class DrawBufImgOp extends Canvas { } public void paint(Graphics g) { - synchronized (this) { - if (done) { - return; - } - } VolatileImage vimg = createVolatileImage(TESTW, TESTH); vimg.validate(getGraphicsConfiguration()); @@ -198,13 +229,6 @@ public void paint(Graphics g) { g2d.dispose(); g.drawImage(vimg, 0, 0, null); - - Toolkit.getDefaultToolkit().sync(); - - synchronized (this) { - done = true; - notifyAll(); - } } /* @@ -379,6 +403,8 @@ private static void compareImages(BufferedImage refImg, Color expected = new Color(refImg.getRGB(x, y)); Color actual = new Color(testImg.getRGB(x, y)); if (!isSameColor(expected, actual, tolerance)) { + saveImage("referenceimage", refImg); + saveImage("testimage", testImg); throw new RuntimeException("Test failed at x="+x+" y="+y+ " (expected="+expected+ " actual="+actual+ @@ -410,7 +436,20 @@ private static boolean isSameColor(Color c1, Color c2, int e) { return false; } + + static void createUI() { + test = new DrawBufImgOp(); + Panel panel = new Panel(); + panel.add(test); + frame = new Frame("OpenGL DrawBufImgOp Test"); + frame.add(panel); + frame.setSize(TESTW+100, TESTH+100); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + public static void main(String[] args) throws Exception { + boolean show = false; boolean dump = false; boolean compare = false; @@ -427,43 +466,27 @@ public static void main(String[] args) throws Exception { } } - DrawBufImgOp test = new DrawBufImgOp(); - Frame frame = new Frame(); - frame.add(test); - frame.pack(); - frame.setVisible(true); + Robot robot = new Robot(); - // Wait until the component's been painted - synchronized (test) { - while (!done) { - try { - test.wait(); - } catch (InterruptedException e) { - throw new RuntimeException("Failed: Interrupted"); - } - } - } + EventQueue.invokeAndWait(DrawBufImgOp::createUI); - GraphicsConfiguration gc = frame.getGraphicsConfiguration(); - if (gc.getColorModel() instanceof IndexColorModel) { - System.out.println("IndexColorModel detected: " + - "test considered PASSED"); - frame.dispose(); - return; - } + robot.waitForIdle(); + robot.delay(2000); - // Grab the screen region BufferedImage capture = null; try { - Robot robot = new Robot(); + GraphicsConfiguration gc = frame.getGraphicsConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.out.println("IndexColorModel detected: " + + "test considered PASSED"); + return; + } Point pt1 = test.getLocationOnScreen(); Rectangle rect = new Rectangle(pt1.x, pt1.y, TESTW, TESTH); capture = robot.createScreenCapture(rect); - } catch (Exception e) { - throw new RuntimeException("Problems creating Robot"); } finally { - if (!show) { - frame.dispose(); + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); } } @@ -471,14 +494,21 @@ public static void main(String[] args) throws Exception { if (dump || compare) { BufferedImage ref = test.makeReferenceImage(); if (dump) { - ImageIO.write(ref, "png", - new File("DrawBufImgOp.ref.png")); - ImageIO.write(capture, "png", - new File("DrawBufImgOp.cap.png")); + saveImage("DrawBufImgOp_ref", ref); + saveImage("DrawBufImgOp_cap", capture); } if (compare) { test.compareImages(ref, capture, 1); } } } + + static void saveImage(String name, BufferedImage img) { + try { + File file = new File(name + ".png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/test/jdk/sun/java2d/OpenGL/DrawImageBg.java b/test/jdk/sun/java2d/OpenGL/DrawImageBg.java new file mode 100644 index 000000000000..7fc38d91b06e --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/DrawImageBg.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4993274 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that managed image copies and transforms work properly + * with the OGL pipeline when a background color is specified. + * @run main/othervm -Dsun.java2d.opengl=True DrawImageBg + * @run main/othervm DrawImageBg + */ + +/* + * @test + * @bug 4993274 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that managed image copies and transforms work properly + * with the OGL pipeline when a background color is specified. + * @run main/othervm -Dsun.java2d.opengl=True DrawImageBg + * @run main/othervm DrawImageBg + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Transparency; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class DrawImageBg extends Panel { + + static volatile Frame frame; + static volatile DrawImageBg test; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + g2d.setColor(Color.black); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + BufferedImage img = getGraphicsConfiguration().createCompatibleImage(50, 50, + Transparency.BITMASK); + Graphics2D gimg = img.createGraphics(); + gimg.setComposite(AlphaComposite.Src); + gimg.setColor(new Color(0, 0, 0, 0)); + gimg.fillRect(0, 0, 50, 50); + gimg.setColor(Color.red); + gimg.fillRect(10, 10, 30, 30); + gimg.dispose(); + + g2d.drawImage(img, 10, 10, Color.blue, null); + + // draw a second time to ensure that the cached copy is used + g2d.drawImage(img, 80, 10, Color.blue, null); + } + + static void createUI() { + frame = new Frame("OpenGL DrawImageBg Test"); + test = new DrawImageBg(); + frame.add(test); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + + BufferedImage capture = null; + Robot robot = new Robot(); + try { + EventQueue.invokeAndWait(DrawImageBg::createUI); + robot.waitForIdle(); + robot.delay(3000); + + // Grab the screen region + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x+80, pt1.y, 80, 80); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + if (capture == null) { + throw new RuntimeException("Screen capture is null"); + } + + // Test inner and outer pixels + int pixel1 = capture.getRGB(5, 10); + if (pixel1 != 0xff0000ff) { + saveImage(capture); + throw new RuntimeException(getMsg("outer", pixel1)); + } + int pixel2 = capture.getRGB(25, 25); + if (pixel2 != 0xffff0000) { + saveImage(capture); + throw new RuntimeException(getMsg("inner", pixel2)); + } + } + + static String getMsg(String r, int p1) { + return "Failed: Incorrect color for " + r + " pixel: got " + Integer.toHexString(p1); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/FlipCoexistTest.java b/test/jdk/sun/java2d/OpenGL/FlipCoexistTest.java new file mode 100644 index 000000000000..beb5da887b4b --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/FlipCoexistTest.java @@ -0,0 +1,134 @@ +/* + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferStrategy; +import java.awt.image.BufferedImage; +import java.io.File; + +import javax.imageio.ImageIO; + +/** + * @test + * @bug 8378201 + * @key headful + * @summary Verifies that WINDOW and FLIP_BACKBUFFER surfaces sharing the same X + * Window render and flip correctly + * @run main/othervm FlipCoexistTest + * @run main/othervm -Dsun.java2d.opengl=True FlipCoexistTest + */ +public final class FlipCoexistTest { + + private static final int SIZE = 200; + private static final int TOLERANCE = 10; + + public static void main(String[] args) throws Exception { + Frame f = new Frame("FlipCoexistTest"); + try { + f.setUndecorated(true); + f.setSize(SIZE, SIZE); + f.setLocation(100, 100); + f.setVisible(true); + + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + + int w = f.getWidth(); + int h = f.getHeight(); + + // Fill window RED via direct render (WINDOW surface) + Graphics g = f.getGraphics(); + g.setColor(Color.RED); + g.fillRect(0, 0, w, h); + g.dispose(); + robot.waitForIdle(); + robot.delay(500); + + // Request flip if available, blit is also useful to cover + f.createBufferStrategy(2); + BufferStrategy bs = f.getBufferStrategy(); + + // Render BLUE to back buffer, do not flip yet + Graphics bg = bs.getDrawGraphics(); + bg.setColor(Color.BLUE); + bg.fillRect(0, 0, w, h); + bg.dispose(); + + // Paint small GREEN rect via direct render + g = f.getGraphics(); + g.setColor(Color.GREEN); + g.fillRect(0, 0, 10, 10); + g.dispose(); + robot.waitForIdle(); + robot.delay(500); + + // GREEN rect must be visible + check(robot, f, 5, 5, Color.GREEN, "small rect"); + + // RED must survive the context round-trip + check(robot, f, w / 2, h / 2, Color.RED, "survived"); + + // Show back buffer, BLUE must appear + bs.show(); + + robot.waitForIdle(); + robot.delay(500); + check(robot, f, w / 2, h / 2, Color.BLUE, "flip"); + } finally { + f.dispose(); + } + } + + private static void check(Robot robot, Frame frame, int x, int y, Color exp, + String desc) + { + Point loc = frame.getLocationOnScreen(); + Color c = robot.getPixelColor(loc.x + x, loc.y + y); + if (!isAlmostEqual(c, exp)) { + saveImage(robot, frame, desc); + throw new RuntimeException("%s: %s != %s".formatted(desc, exp, c)); + } + } + + private static void saveImage(Robot r, Frame f, String name) { + try { + Rectangle rect = f.getBounds(); + BufferedImage img = r.createScreenCapture(rect); + ImageIO.write(img, "png", new File(name + ".png")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static boolean isAlmostEqual(Color c1, Color c2) { + return Math.abs(c1.getRed() - c2.getRed()) <= TOLERANCE + && Math.abs(c1.getGreen() - c2.getGreen()) <= TOLERANCE + && Math.abs(c1.getBlue() - c2.getBlue()) <= TOLERANCE; + } +} diff --git a/test/jdk/sun/java2d/OpenGL/LargeOps.java b/test/jdk/sun/java2d/OpenGL/LargeOps.java new file mode 100644 index 000000000000..ace60b7a3c49 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/LargeOps.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6219284 6358147 6274813 6578452 + * @key headful + * @summary Verifies that OGLRenderer.drawPoly(), + * OGLTextRenderer.drawGlyphList(), and OGLMaskFill work properly when the + * operation parameters exceed the capacity of the render queue. With the + * single-threaded OpenGL pipeline, there are some operations that require + * a separate buffer to be spawned if the parameters cannot fit entirely on + * the standard buffer. This test exercises this special case. + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.lcdshader=true LargeOps + */ + +import java.awt.Canvas; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Robot; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class LargeOps extends Canvas { + + private static final int NUM_POINTS = 8000; + private int[] xPoints, yPoints; + private String str; + + public LargeOps() { + xPoints = new int[NUM_POINTS]; + yPoints = new int[NUM_POINTS]; + for (int i = 0; i < NUM_POINTS; i++) { + xPoints[i] = (i % 2 == 0) ? 10 : 400; + yPoints[i] = (i % 2 == 1) ? i+3 : i; + } + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < NUM_POINTS; i+=11) { + sb.append("ThisIsATest"); + } + str = sb.toString(); + } + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D)g; + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + // draw large polyline + g2d.setColor(Color.green); + g2d.drawPolyline(xPoints, yPoints, NUM_POINTS); + + // draw long string + g2d.setColor(Color.blue); + g2d.drawString(str, 10, 100); + + // draw long string with larger pt size + Font font = g2d.getFont(); + g2d.setFont(font.deriveFont(40.0f)); + g2d.drawString(str, 10, 150); + + // do the same with LCD hints enabled + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); + g2d.setFont(font); + g2d.drawString(str, 10, 200); + g2d.setFont(font.deriveFont(43.0f)); + g2d.drawString(str, 10, 250); + + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR); + g2d.setFont(font); + g2d.drawString(str, 10, 300); + g2d.setFont(font.deriveFont(37.0f)); + g2d.drawString(str, 10, 350); + } + + static volatile Frame frame; + static volatile LargeOps test; + + static void createUI() { + frame = new Frame("OpenGL LargeOps Test"); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + frame.dispose(); + } + }); + test = new LargeOps(); + frame.add(test); + frame.setSize(600, 600); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + EventQueue.invokeAndWait(LargeOps::createUI); + robot.waitForIdle(); + robot.delay(6000); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/MultiWindowFillTest.java b/test/jdk/sun/java2d/OpenGL/MultiWindowFillTest.java new file mode 100644 index 000000000000..59c58d944d79 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/MultiWindowFillTest.java @@ -0,0 +1,122 @@ +/* + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; + +import javax.imageio.ImageIO; + +/** + * @test + * @bug 8378201 + * @key headful + * @summary Verifies that window content survives a GL context switch to another + * window and back + * @run main/othervm MultiWindowFillTest + * @run main/othervm -Dsun.java2d.opengl=True MultiWindowFillTest + */ +public final class MultiWindowFillTest { + + private static final int SIZE = 100; + private static final int TOLERANCE = 10; + + public static void main(String[] args) throws Exception { + Frame f1 = new Frame("f1"); + Frame f2 = new Frame("f2"); + try { + f1.setUndecorated(true); + f1.setSize(SIZE, SIZE); + f1.setLocation(100, 100); + f2.setUndecorated(true); + f2.setSize(SIZE, SIZE); + f2.setLocation(300, 100); + + f1.setVisible(true); + f2.setVisible(true); + + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + + int w = f1.getWidth(); + int h = f1.getHeight(); + + // Fill both, initializes surfaces + fill(f1, Color.RED, w, h); + fill(f2, Color.BLUE, w, h); + + // Touch both again + fill(f1, Color.RED, 2, 2); + fill(f2, Color.BLUE, 2, 2); + + robot.waitForIdle(); + robot.delay(1000); + + check(robot, f1, w, h, Color.RED, "f1 red"); + check(robot, f2, w, h, Color.BLUE, "f2 blue"); + } finally { + f1.dispose(); + f2.dispose(); + } + } + + private static void fill(Frame frame, Color c, int w, int h) { + Graphics g = frame.getGraphics(); + g.setColor(c); + g.fillRect(0, 0, w, h); + g.dispose(); + } + + private static void check(Robot robot, Frame frame, int w, int h, + Color exp, String desc) + { + Point loc = frame.getLocationOnScreen(); + Color c = robot.getPixelColor(loc.x + w / 2, loc.y + h / 2); + if (!isAlmostEqual(c, exp)) { + saveImage(robot, frame, desc); + throw new RuntimeException("%s: %s != %s".formatted(desc, exp, c)); + } + } + + private static void saveImage(Robot r, Frame f, String name) { + try { + Rectangle rect = f.getBounds(); + BufferedImage img = r.createScreenCapture(rect); + ImageIO.write(img, "png", new File(name + ".png")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private static boolean isAlmostEqual(Color c1, Color c2) { + return Math.abs(c1.getRed() - c2.getRed()) <= TOLERANCE + && Math.abs(c1.getGreen() - c2.getGreen()) <= TOLERANCE + && Math.abs(c1.getBlue() - c2.getBlue()) <= TOLERANCE; + } +} diff --git a/test/jdk/sun/java2d/OpenGL/OpaqueDest.java b/test/jdk/sun/java2d/OpenGL/OpaqueDest.java new file mode 100644 index 000000000000..397d516f9ae3 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/OpaqueDest.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6277977 6319663 8369335 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that blending operations do not inadvertantly leave + * non-opaque alpha values in the framebuffer. Note that this test is + * intended to run on GraphicsConfigs that support a stored alpha channel + * (to verify the bug at hand), but it is also a useful for testing the + * compositing results on any configuration. + * @run main/othervm -Dsun.java2d.opengl=True OpaqueDest + * @run main/othervm OpaqueDest + */ + +/* + * @test + * @bug 6277977 6319663 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that blending operations do not inadvertantly leave + * non-opaque alpha values in the framebuffer. Note that this test is + * intended to run on GraphicsConfigs that support a stored alpha channel + * (to verify the bug at hand), but it is also a useful for testing the + * compositing results on any configuration. + * @run main/othervm -Dsun.java2d.opengl=True OpaqueDest + * @run main/othervm OpaqueDest + */ + +import java.awt.AlphaComposite; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.IndexColorModel; +import java.io.File; +import javax.imageio.ImageIO; + +public class OpaqueDest extends Canvas { + + private static volatile Frame frame; + private static volatile OpaqueDest test; + private static final int W = 100, H = 100; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + g2d.setColor(Color.red); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + // This will clear the rectangle to black + g2d.setComposite(AlphaComposite.Clear); + g2d.fillRect(10, 10, 80, 80); + + // If everything is working properly, then this will fill the + // rectangle with red again. Before this bug was fixed, the previous + // Clear operation would leave zero values in the destination's + // alpha channel (if present), and therefore a SrcIn operation + // would result in all-black. + g2d.setComposite(AlphaComposite.SrcIn); + g2d.fillRect(10, 10, 80, 80); + } + + public Dimension getPreferredSize() { + return new Dimension(W, H); + } + + static void createUI() { + test = new OpaqueDest(); + frame = new Frame("OpenGL OpaqueDest Test"); + Panel p = new Panel(); + p.add(test); + frame.add(p); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(OpaqueDest::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + BufferedImage capture = null; + try { + GraphicsConfiguration gc = frame.getGraphicsConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.out.println("IndexColorModel detected: " + + "test considered PASSED"); + return; + } + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, W, H); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + + // Test all pixels (every one should be red) + for (int y = 0; y < W; y++) { + for (int x = 0; x < H; x++) { + int actual = capture.getRGB(x, y); + int expected = 0xffff0000; + if (!similar(actual, expected)) { + String msg = "Test failed at x="+x+" y="+y+ + " (expected="+ + Integer.toHexString(expected) + + " actual="+ + Integer.toHexString(actual) + + ")"; + if ( ( x== 0) || ( x == W) || ( y == 0) || ( y == H)) { + System.err.println(msg); + } else { + saveImage(capture); + throw new RuntimeException(msg); + } + } + } + } + } + + static boolean similar(int p1, int p2) { + int a1 = (p1 >> 24) & 0xff; + int r1 = (p1 >> 16) & 0xff; + int g1 = (p1 >> 8) & 0xff; + int b1 = p1 & 0xff; + int a2 = (p2 >> 24) & 0xff; + int r2 = (p2 >> 16) & 0xff; + int g2 = (p2 >> 8) & 0xff; + int b2 = p2 & 0xff; + + int allowedDiff = 0x01; // tiny rounding error allowed. + return + (Math.abs(a1 - a2) <= allowedDiff) && + (Math.abs(r1 - r2) <= allowedDiff) && + (Math.abs(g1 - g2) <= allowedDiff) && + (Math.abs(b1 - b2) <= allowedDiff); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java b/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java new file mode 100644 index 000000000000..acb5e41ce6f6 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/ScaleParamsOOB.java @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 5104584 8237244 8369335 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that scaling an image works properly when the + * source parameters are outside the source bounds. + * @run main/othervm -Dsun.java2d.opengl=True ScaleParamsOOB + * @run main/othervm ScaleParamsOOB + */ + +/* + * @test + * @bug 5104584 8237244 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that scaling an image works properly when the + * source parameters are outside the source bounds. + * @run main/othervm -Dsun.java2d.opengl=True ScaleParamsOOB + * @run main/othervm ScaleParamsOOB + */ + + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class ScaleParamsOOB extends Panel { + + private static final int TOLERANCE = 12; + + private static volatile ScaleParamsOOB test; + private static volatile Frame frame; + + private BufferedImage img; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + g2d.setColor(Color.black); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + BufferedImage img = getGraphicsConfiguration().createCompatibleImage(40, 40); + Graphics2D gimg = img.createGraphics(); + gimg.setColor(Color.red); + gimg.fillRect(0, 0, 40, 40); + gimg.dispose(); + + // first time will be a sw->surface blit + g2d.drawImage(img, + 10, 10, 90, 90, + -60, -60, 100, 100, + null); + + // second time will be a texture->surface blit + g2d.drawImage(img, + 110, 10, 190, 90, + -60, -60, 100, 100, + null); + } + + public Dimension getPreferredSize() { + return new Dimension(300, 200); + } + + private static void testRegion(BufferedImage bi, + Rectangle wholeRegion, + Rectangle affectedRegion) + { + int x1 = wholeRegion.x; + int y1 = wholeRegion.y; + int x2 = x1 + wholeRegion.width; + int y2 = y1 + wholeRegion.height; + + int ax1 = affectedRegion.x; + int ay1 = affectedRegion.y; + int ax2 = ax1 + affectedRegion.width; + int ay2 = ay1 + affectedRegion.height; + + for (int y = y1; y < y2; y++) { + for (int x = x1; x < x2; x++) { + int actual = bi.getRGB(x, y); + int expected = 0; + if (affectedRegion.contains(x, y)) { + expected = Color.red.getRGB(); + } else { + expected = Color.black.getRGB(); + } + int alpha = (actual >> 24) & 0xFF; + int red = (actual >> 16) & 0xFF; + int green = (actual >> 8) & 0xFF; + int blue = (actual) & 0xFF; + + int standardAlpha = (expected >> 24) & 0xFF; + int standardRed = (expected >> 16) & 0xFF; + int standardGreen = (expected >> 8) & 0xFF; + int standardBlue = (expected) & 0xFF; + + if ((Math.abs(alpha - standardAlpha) > TOLERANCE) || + (Math.abs(red - standardRed) > TOLERANCE) || + (Math.abs(green - standardGreen) > TOLERANCE) || + (Math.abs(blue - standardBlue) > TOLERANCE)) { + + String msg = ("Test failed at x="+x+" y="+y+ + " (expected="+ + Integer.toHexString(expected) + + " actual="+ + Integer.toHexString(actual) + + ")"); + // log edge pixel differences, but don't fail the test. + if ((x == ax1) || (x == ax2) || (y == ay1) || (y == ay2)) { + System.err.println(msg); + } else { + saveImage(bi); + throw new RuntimeException(msg); + } + } + } + } + } + + private static void createAndShowGUI() { + test = new ScaleParamsOOB(); + frame = new Frame("OpenGL ScaleParamsOOB Test"); + frame.setAlwaysOnTop(true); + frame.add(test); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(() -> createAndShowGUI()); + + robot.waitForIdle(); + robot.delay(2000); + + // Grab the screen region + BufferedImage capture = null; + try { + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 200, 200); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test background color + int pixel = capture.getRGB(5, 5); + if (pixel != 0xff000000) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "background: " + Integer.toHexString(pixel)); + } + + // Test pixels + testRegion(capture, + new Rectangle(5, 5, 90, 90), + new Rectangle(40, 40, 20, 20)); + testRegion(capture, + new Rectangle(105, 5, 90, 90), + new Rectangle(140, 40, 20, 20)); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/ShapeClip.java b/test/jdk/sun/java2d/OpenGL/ShapeClip.java new file mode 100644 index 000000000000..f50b7aff5a64 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/ShapeClip.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 5002133 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that the OpenGL pipeline does not affect the color + * buffer when setting up a complex (shape) clip region. The test fails if + * the circular clip region is filled with a green color (the green region + * should not be visible at all). + * @run main/othervm -Dsun.java2d.opengl=True ShapeClip + * @run main/othervm ShapeClip + */ + +/* + * @test + * @bug 5002133 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that the OpenGL pipeline does not affect the color + * buffer when setting up a complex (shape) clip region. The test fails if + * the circular clip region is filled with a green color (the green region + * should not be visible at all). + * @run main/othervm -Dsun.java2d.opengl=True ShapeClip + * @run main/othervm ShapeClip + */ + +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.geom.Ellipse2D; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class ShapeClip extends Panel { + + private static volatile Frame frame; + private static volatile ShapeClip test; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + int width = getWidth(); + int height = getHeight(); + + g2d.setColor(Color.black); + g2d.fillRect(0, 0, width, height); + + g2d.setColor(Color.green); + g2d.fillRect(0, 0, 1, 1); + g2d.setClip(new Ellipse2D.Double(10, 10, 100, 100)); + g2d.setColor(Color.blue); + g2d.fillRect(30, 30, 20, 20); + } + + static void createUI() { + test = new ShapeClip(); + frame = new Frame("OpenGL ShapeClip Test"); + frame.add(test); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(ShapeClip::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + // Grab the screen region + BufferedImage capture = null; + try { + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 80, 80); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test blue rectangle + int pixel1 = capture.getRGB(40, 40); + if (pixel1 != 0xff0000ff) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "rectangle " + Integer.toHexString(pixel1)); + } + + // Test clip region (should be same color as background) + int pixel2 = capture.getRGB(60, 40); + if (pixel2 != 0xff000000) { + saveImage(capture); + throw new RuntimeException("Failed: Incorrect color for " + + "clip region " + Integer.toHexString(pixel2)); + } + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/SrcMaskOps.java b/test/jdk/sun/java2d/OpenGL/SrcMaskOps.java new file mode 100644 index 000000000000..9908cffdefb0 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/SrcMaskOps.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4942939 4970674 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that OGLMaskFill, OGLMaskBlit, and OGLTextRenderer + * operations work properly for non-SrcOver composites. + * @run main/othervm -Dsun.java2d.opengl=True SrcMaskOps + * @run main/othervm SrcMaskOps + */ + +/* + * @test + * @bug 4942939 4970674 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that OGLMaskFill, OGLMaskBlit, and OGLTextRenderer + * operations work properly for non-SrcOver composites. + * @run main/othervm -Dsun.java2d.opengl=True SrcMaskOps + * @run main/othervm SrcMaskOps + */ + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class SrcMaskOps extends Panel { + + static volatile Frame frame; + static volatile SrcMaskOps test; + + static final int SRX = 50; + static final int SRY = 50; + static final int GPX = 90; + static final int GPY = 50; + static final int DTX = 120; + static final int DTY = 70; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setComposite(AlphaComposite.Src); + + g2d.setColor(Color.blue); + g2d.drawRect(SRX, SRY, 20, 20); + + g2d.setPaint(new GradientPaint(0.0f, 0.0f, Color.red, + 100.0f, 100.f, Color.red, true)); + g2d.drawRect(GPX, GPY, 20, 20); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + + g2d.setColor(Color.red); + Font font = new Font(Font.DIALOG, Font.PLAIN, 20); + g2d.setFont(font); + g2d.drawString("HELLO", DTX, DTY); + } + + static void createUI() { + frame = new Frame("OpenGL SrcMaskOps Test"); + test = new SrcMaskOps(); + frame.add(test); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + + Robot robot = new Robot(); + BufferedImage capture = null; + try { + EventQueue.invokeAndWait(SrcMaskOps::createUI); + robot.waitForIdle(); + robot.delay(3000); + + // Grab the screen region + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 300, 300); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test solid rectangle + int pixel1, pixel2; + pixel1 = capture.getRGB(SRX, SRY); + pixel2 = capture.getRGB(SRX+2, SRY+2); + if (!similar(pixel1, 0xff0000ff) || !similar(pixel2, 0xffffffff)) { + saveImage(capture); + throw new RuntimeException(getMsg("solid rectangle", pixel1, pixel2)); + } + + // Test GradientPaint rectangle + pixel1 = capture.getRGB(GPX, GPY); + pixel2 = capture.getRGB(GPX+2, GPY+2); + if (!similar(pixel1, 0xffff0000) || !similar(pixel2, 0xffffffff)) { + saveImage(capture); + throw new RuntimeException(getMsg("GradientPaint rectangle", pixel1, pixel2)); + } + + // Test solid text + pixel1 = capture.getRGB(DTX+2, DTY-5); + pixel2 = capture.getRGB(DTX+5, DTY-5); + if (!similar(pixel1, 0xffff0000) || !similar(pixel2, 0xffffffff)) { + saveImage(capture); + throw new RuntimeException(getMsg("solid text", pixel1, pixel2)); + } + + } + + static boolean similar(int p1, int p2) { + int a1 = (p1 >> 24) & 0xff; + int r1 = (p1 >> 16) & 0xff; + int g1 = (p1 >> 8) & 0xff; + int b1 = p1 & 0xff; + int a2 = (p2 >> 24) & 0xff; + int r2 = (p2 >> 16) & 0xff; + int g2 = (p2 >> 8) & 0xff; + int b2 = p2 & 0xff; + + int allowedDiff = 0x10; + return + (Math.abs(a1 - a2) <= allowedDiff) && + (Math.abs(r1 - r2) <= allowedDiff) && + (Math.abs(g1 - g2) <= allowedDiff) && + (Math.abs(b1 - b2) <= allowedDiff); + } + + static String getMsg(String r, int p1, int p2) { + return "Failed: Incorrect color[s] for " + r + " got " + + Integer.toHexString(p1) + " and " + Integer.toHexString(p2); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/OpenGL/VolatileSubRegion.java b/test/jdk/sun/java2d/OpenGL/VolatileSubRegion.java new file mode 100644 index 000000000000..7ec350bc9587 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/VolatileSubRegion.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6244071 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that copying a subregion from a VolatileImage works + * properly with the OGL pipeline. + * @run main/othervm VolatileSubRegion + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true VolatileSubRegion + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false VolatileSubRegion + */ + +/* + * @test + * @bug 6244071 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that copying a subregion from a VolatileImage works + * properly with the OGL pipeline. + * @run main/othervm VolatileSubRegion + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true VolatileSubRegion + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false VolatileSubRegion + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.IndexColorModel; +import java.awt.image.VolatileImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class VolatileSubRegion extends Panel { + + private VolatileImage img; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + if (img == null) { + img = createVolatileImage(200, 200); + Graphics2D goff = img.createGraphics(); + goff.setColor(Color.green); + goff.fillRect(50, 0, 100, 50); + goff.setColor(Color.blue); + goff.fillRect(0, 0, 200, 200); + goff.setColor(Color.red); + goff.fillRect(50, 50, 100, 100); + goff.setColor(Color.yellow); + goff.fillRect(50, 150, 100, 50); + goff.dispose(); + } + + g2d.setColor(Color.white); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.drawImage(img, + 50, 50, 200, 200, + 50, 50, 200, 200, + null); + + } + + + private static volatile VolatileSubRegion test; + private static volatile Frame frame; + + static void createUI() { + test = new VolatileSubRegion(); + frame = new Frame("OpenGL VolatileSubRegion Test"); + frame.add(test); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(VolatileSubRegion::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + BufferedImage capture = null; + try { + GraphicsConfiguration gc = frame.getGraphicsConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.out.println("IndexColorModel detected: " + + "test considered PASSED"); + return; + } + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 200, 200); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test pixels + int pixel1 = capture.getRGB(49, 50); + if (pixel1 != 0xffffffff) { + saveImage(capture); + throw new RuntimeException(getMsg("background pixel", pixel1)); + } + int pixel2 = capture.getRGB(50, 50); + if (pixel2 != 0xffff0000) { + saveImage(capture); + throw new RuntimeException(getMsg("red region", pixel2)); + } + int pixel3 = capture.getRGB(50, 150); + if (pixel3 != 0xffffff00) { + saveImage(capture); + throw new RuntimeException(getMsg("yellow region", pixel3)); + } + } + + static String getMsg(String r, int p1) { + return "Failed: Incorrect color for " + r + " : got " + Integer.toHexString(p1); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/test/jdk/sun/java2d/OpenGL/XformVolatile.java b/test/jdk/sun/java2d/OpenGL/XformVolatile.java new file mode 100644 index 000000000000..44e7c7ee8ba7 --- /dev/null +++ b/test/jdk/sun/java2d/OpenGL/XformVolatile.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4970836 + * @key headful + * @requires (os.family != "mac") + * @summary Verifies that transformed VolatileImage copies work properly with + * the OGL pipeline. + * @run main/othervm XformVolatile + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true XformVolatile + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false XformVolatile + */ + +/* + * @test + * @bug 4970836 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies that transformed VolatileImage copies work properly with + * the OGL pipeline. + * @run main/othervm XformVolatile + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true XformVolatile + * @run main/othervm -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false XformVolatile + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class XformVolatile extends Panel { + + private static volatile Frame frame; + private static volatile XformVolatile test; + private volatile VolatileImage img; + + public void paint(Graphics g) { + + Graphics2D g2d = (Graphics2D)g; + + if (img == null) { + img = createVolatileImage(200, 200); + Graphics2D goff = img.createGraphics(); + goff.setColor(Color.blue); + goff.fillRect(0, 0, 200, 200); + goff.setColor(Color.red); + goff.fillPolygon(new int[] {10, 100, 190}, + new int[] {190, 10, 190}, 3); + goff.dispose(); + } + + g2d.setColor(Color.black); + g2d.fillRect(0, 0, getWidth(), getHeight()); + + g2d.rotate(Math.toRadians(3.0)); + g2d.drawImage(img, 0, 0, null); + } + + static void createUI() { + test = new XformVolatile(); + frame = new Frame("OpenGL XformVolatile Test"); + frame.add(test); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + + Robot robot = new Robot(); + + EventQueue.invokeAndWait(XformVolatile::createUI); + + robot.waitForIdle(); + robot.delay(2000); + + // Grab the screen region + BufferedImage capture = null; + try { + Point pt1 = test.getLocationOnScreen(); + Rectangle rect = new Rectangle(pt1.x, pt1.y, 200, 200); + capture = robot.createScreenCapture(rect); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + // Test inner and outer pixels + int pixel1 = capture.getRGB(5, 175); + if (pixel1 != 0xff0000ff) { + saveImage(capture); + throw new RuntimeException(getMsg("inner", pixel1)); + } + int pixel2 = capture.getRGB(5, 188); + if (pixel2 != 0xffff0000) { + saveImage(capture); + throw new RuntimeException(getMsg("inner", pixel2)); + } + } + + static String getMsg(String r, int p1) { + return "Failed: Incorrect color for " + r + " pixel: got " + Integer.toHexString(p1); + } + + static void saveImage(BufferedImage img) { + try { + File file = new File("capture.png"); + ImageIO.write(img, "png", file); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java b/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java index efa938036706..9b109e954ebc 100644 --- a/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java +++ b/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,10 +21,10 @@ * questions. */ -import java.awt.AWTException; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.EventQueue; import java.awt.Frame; import java.awt.Graphics; import java.awt.Point; @@ -42,18 +42,18 @@ * make sure the pixels on the screen are red. * * Note that we force the use of shared memory pixmaps in the shell script. - * - * @author Dmitri.Trembovetski */ public class SharedMemoryPixmapsTest { - static final int IMAGE_SIZE = 100; - static boolean show = false; - final Frame testFrame; - /** Creates a new instance of SharedMemoryPixmapsTest */ - public SharedMemoryPixmapsTest() { + static final int IMAGE_SIZE = 200; + static volatile boolean show = false; + static volatile Frame testFrame; + static volatile TestComponent testComponent; + + static void createUI() { testFrame = new Frame("SharedMemoryPixmapsTest"); - testFrame.add(new TestComponent()); + testComponent = new TestComponent(); + testFrame.add(testComponent); testFrame.setUndecorated(true); testFrame.setResizable(false); testFrame.pack(); @@ -62,7 +62,7 @@ public SharedMemoryPixmapsTest() { testFrame.toFront(); } - public static void main(String[] args) { + public static void main(String[] args) throws Exception { for (String s : args) { if ("-show".equals(s)) { show = true; @@ -70,12 +70,43 @@ public static void main(String[] args) { System.err.println("Usage: SharedMemoryPixmapsTest [-show]"); } } - new SharedMemoryPixmapsTest(); + EventQueue.invokeAndWait(SharedMemoryPixmapsTest::createUI); + if (testRendering()) { + System.err.println("Test Passed"); + } else { + System.err.println("Test Failed"); + } + if (!show && testFrame != null) { + EventQueue.invokeAndWait(testFrame::dispose); + } + } + + static boolean testRendering() throws Exception { + Robot r = new Robot(); + r.waitForIdle(); + r.delay(2000); + Point p = testComponent.getLocationOnScreen(); + BufferedImage b = + r.createScreenCapture(new Rectangle(p, testComponent.getPreferredSize())); + for (int y = 20; y < b.getHeight() - 40; y++) { + for (int x = 20; x < b.getWidth() - 40; x++) { + if (b.getRGB(x, y) != Color.red.getRGB()) { + System.err.println("Incorrect pixel at " + + x + "x" + y + " : " + + Integer.toHexString(b.getRGB(x, y))); + if (show) { + return false; + } + System.err.println("Test Failed"); + System.exit(1); + } + } + } + return true; } - private class TestComponent extends Component { + static class TestComponent extends Component { VolatileImage vi = null; - boolean tested = false; void initVI() { int res; @@ -104,54 +135,10 @@ public synchronized void paint(Graphics g) { g.setColor(Color.green); g.fillRect(0, 0, getWidth(), getHeight()); + vi = null; initVI(); g.drawImage(vi, 0, 0, null); } while (vi.contentsLost()); - - Toolkit.getDefaultToolkit().sync(); - if (!tested) { - if (testRendering()) { - System.err.println("Test Passed"); - } else { - System.err.println("Test Failed"); - } - tested = true; - } - if (!show) { - testFrame.setVisible(false); - testFrame.dispose(); - } - } - - private boolean testRendering() throws RuntimeException { - try { - Thread.sleep(2000); - } catch (InterruptedException ex) {} - Robot r = null; - try { - r = new Robot(); - } catch (AWTException ex) { - ex.printStackTrace(); - throw new RuntimeException("Can't create Robot"); - } - Point p = getLocationOnScreen(); - BufferedImage b = - r.createScreenCapture(new Rectangle(p, getPreferredSize())); - for (int y = 0; y < b.getHeight(); y++) { - for (int x = 0; x < b.getWidth(); x++) { - if (b.getRGB(x, y) != Color.red.getRGB()) { - System.err.println("Incorrect pixel" + " at " - + x + "x" + y + " : " + - Integer.toHexString(b.getRGB(x, y))); - if (show) { - return false; - } - System.err.println("Test Failed"); - System.exit(1); - } - } - } - return true; } @Override @@ -159,5 +146,4 @@ public Dimension getPreferredSize() { return new Dimension(IMAGE_SIZE, IMAGE_SIZE); } } - } diff --git a/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh b/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh index 10dd58d90de8..786957ca0ebc 100644 --- a/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh +++ b/test/jdk/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ # by filling a VolatileImage with red color and copying it # to the screen. # Note that we force the use of shared memory pixmaps. -# @author Dmitri.Trembovetski echo "TESTJAVA=${TESTJAVA}" echo "TESTSRC=${TESTSRC}" diff --git a/test/jdk/sun/net/www/protocol/http/NTLMHeadTest.java b/test/jdk/sun/net/www/protocol/http/NTLMHeadTest.java index 52174ab2f554..2cbbf5f65342 100644 --- a/test/jdk/sun/net/www/protocol/http/NTLMHeadTest.java +++ b/test/jdk/sun/net/www/protocol/http/NTLMHeadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,9 @@ */ /* - * @test + * @test id=default * @bug 8270290 + * @requires os.family != "windows" * @library /test/lib * @run main/othervm NTLMHeadTest SERVER * @run main/othervm NTLMHeadTest PROXY @@ -48,6 +49,17 @@ * include the body. */ +/* + * @test id=windows + * @bug 8270290 + * @comment Only run on specific Windows OS versions because NTLMv1 is no longer supported starting Windows 11 and Windows Server 2025 + * @requires os.family == "windows" & (os.name == "Windows 10" | os.name == "Windows Server 2016" | os.name == "Windows Server 2019" | os.name == "Windows Server 2022") + * @library /test/lib + * @run main/othervm NTLMHeadTest SERVER + * @run main/othervm NTLMHeadTest PROXY + * @run main/othervm NTLMHeadTest TUNNEL + */ + import java.net.*; import java.io.*; import java.util.*; diff --git a/test/jdk/sun/net/www/protocol/http/TestTransparentNTLM.java b/test/jdk/sun/net/www/protocol/http/TestTransparentNTLM.java index 0df834765c8e..16b5d4194013 100644 --- a/test/jdk/sun/net/www/protocol/http/TestTransparentNTLM.java +++ b/test/jdk/sun/net/www/protocol/http/TestTransparentNTLM.java @@ -26,7 +26,8 @@ * @bug 8225425 * @summary Verifies that transparent NTLM (on Windows) is not used by default, * and is used only when the relevant property is set. - * @requires os.family == "windows" + * @comment Only run on specific Windows OS versions because NTLMv1 is no longer supported starting Windows 11 and Windows Server 2025 + * @requires os.family == "windows" & (os.name == "Windows 10" | os.name == "Windows Server 2016" | os.name == "Windows Server 2019" | os.name == "Windows Server 2022") * @library /test/lib * @run testng/othervm * -Dtest.auth.succeed=false diff --git a/test/jdk/sun/net/www/protocol/https/HttpsURLConnection/GetServerCertificates.java b/test/jdk/sun/net/www/protocol/https/HttpsURLConnection/GetServerCertificates.java new file mode 100644 index 000000000000..135c2375f222 --- /dev/null +++ b/test/jdk/sun/net/www/protocol/https/HttpsURLConnection/GetServerCertificates.java @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * @test + * @bug 8376031 + * @modules jdk.httpserver + * @library /test/lib + * @summary Ensure HttpsURLConnection::getServerCertificates does not + * throw after calling getResponseCode() if the response doesn't have + * a body. + * @run main/othervm ${test.main.class} + * @run main/othervm -Djava.net.preferIPv6Addresses=true ${test.main.class} + */ + +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Optional; +import java.util.stream.Stream; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; + +import com.sun.net.httpserver.HttpsConfigurator; +import com.sun.net.httpserver.HttpsServer; +import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; + +// Use of the static import (RSPBODY_EMPTY) depends on JDK-8331195, +// which requires a CSR approval before backporting. +// import static com.sun.net.httpserver.HttpExchange.RSPBODY_EMPTY; + + +public class GetServerCertificates { + + static final String URI_PATH = "/GetServerCertificates/"; + static final String BODY = "Go raibh maith agat"; + // Using constant (RSPBODY_EMPTY) instead of a static import that depends + // on JDK-8331195, which requires a CSR approval before backporting. + static final long RSPBODY_EMPTY = -1l; + enum TESTS { + HEAD("head", 200, "HEAD"), + NOBODY("nobody", 200, "GET", "POST"), + S204("204", 204, "GET", "POST"), + S304("304", 304, "GET", "POST"), + S200("200", 200, "GET", "POST"); + final String test; + final int code; + final List methods; + private TESTS(String test, int code, String... methods) { + this.test = test; + this.code = code; + this.methods = List.of(methods); + } + boolean isFor(String path) { + return path != null && path.endsWith("/" + test); + } + + String test() { return test; } + int code() { return code; } + List methods() { return methods; } + static Optional fromPath(String path) { + return Stream.of(values()) + .filter(test -> test.isFor(path)) + .findFirst(); + } + } + + void test(String[] args) throws Exception { + SSLContext.setDefault(SimpleSSLContext.findSSLContext()); + HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + HttpServer server = startHttpServer(); + try { + InetSocketAddress address = server.getAddress(); + URI uri = URIBuilder.newBuilder() + .scheme("https") + .host(address.getAddress()) + .port(address.getPort()) + .path(URI_PATH) + .build(); + for (var test : TESTS.values()) { + for (String method : test.methods()) { + doClient(method, uri, test); + } + } + + } finally { + server.stop(1000); + } + } + + void doClient(String method, URI baseUri, TESTS test) throws Exception { + assert baseUri.getRawQuery() == null; + assert baseUri.getRawFragment() == null; + assert test.methods().contains(method); + + String uriStr = baseUri.toString(); + if (!uriStr.endsWith("/")) uriStr = uriStr + "/"; + + URI uri = new URI(uriStr + test.test()); + assert uri.toString().endsWith("/" + test.test()); + int code = test.code(); + System.out.println("doClient(%s, %s, %s)" + .formatted(method, test.test(), test.code)); + + // first request - should create a TCP connection + HttpsURLConnection uc = (HttpsURLConnection) + uri.toURL().openConnection(Proxy.NO_PROXY); + if (!"GET".equals(method)) { + uc.setRequestMethod(method); + } + try { + uc.getServerCertificates(); + throw new AssertionError("Expected IllegalStateException not thrown"); + } catch (IllegalStateException ise) { + System.out.println("Got expected ISE: " + ise); + } + int resp = uc.getResponseCode(); + check(resp == code, "Unexpected response code. Expected %s, got %s" + .formatted(code, resp)); + + check(uc.getServerCertificates()); + if (test == TESTS.S200) { + byte[] bytes = uc.getInputStream().readAllBytes(); + String body = new String(bytes, StandardCharsets.UTF_8); + System.out.println("body: " + body); + check(BODY.equals(body), "Unexpected response body. Expected \"%s\", got \"%s\"" + .formatted(BODY, body)); + } + + // second request - should go on the same TCP connection. + // We don't have a reliable way to test that, and it could + // go on a new TCP connection if the previous connection + // was already closed. It is not an issue either way. + uc = (HttpsURLConnection) + uri.toURL().openConnection(Proxy.NO_PROXY); + if (!"GET".equals(method)) { + uc.setRequestMethod(method); + } + try { + uc.getServerCertificates(); + throw new AssertionError("Expected IllegalStateException not thrown"); + } catch (IllegalStateException ise) { + System.out.println("Got expected ISE: " + ise); + } + resp = uc.getResponseCode(); + check(resp == code, "Unexpected response code. Expected %s, got %s" + .formatted(code, resp)); + + check(uc.getServerCertificates()); + if (test == TESTS.S200) { + byte[] bytes = uc.getInputStream().readAllBytes(); + String body = new String(bytes, StandardCharsets.UTF_8); + System.out.println("body: " + body); + check(BODY.equals(body), "Unexpected response body. Expected \"%s\", got \"%s\"" + .formatted(BODY, body)); + } + + uc.disconnect(); + try { + uc.getServerCertificates(); + throw new AssertionError("Expected IllegalStateException not thrown"); + } catch (IllegalStateException ise) { + System.out.println("Got expected ISE: " + ise); + } + + // third request - forces the connection to close + // after use so that we don't find any connection in the pool + // for the next test case, assuming there was only + // one connection in the first place. + // Again there's no easy way to verify that the pool + // is empty (and it's not really necessary to bother) + uc = (HttpsURLConnection) + uri.toURL().openConnection(Proxy.NO_PROXY); + if (!"GET".equals(method)) { + uc.setRequestMethod(method); + } + uc.setRequestProperty("Connection", "close"); + try { + uc.getServerCertificates(); + throw new AssertionError("Expected IllegalStateException not thrown"); + } catch (IllegalStateException ise) { + System.out.println("Got expected ISE: " + ise); + } + resp = uc.getResponseCode(); + check(resp == code, "Unexpected response code. Expected %s, got %s" + .formatted(code, resp)); + check(uc.getServerCertificates()); + uc.disconnect(); + try { + uc.getServerCertificates(); + throw new AssertionError("Expected IllegalStateException not thrown"); + } catch (IllegalStateException ise) { + System.out.println("Got expected ISE: " + ise); + } + } + + // HTTP Server + HttpServer startHttpServer() throws IOException { + InetAddress localhost = InetAddress.getLoopbackAddress(); + HttpsServer httpServer = HttpsServer + .create(new InetSocketAddress(localhost, 0), 0); + var configurator = new HttpsConfigurator(SimpleSSLContext.findSSLContext()); + httpServer.setHttpsConfigurator(configurator); + httpServer.createContext(URI_PATH, new SimpleHandler()); + httpServer.start(); + return httpServer; + } + + static class SimpleHandler implements HttpHandler { + @Override + public void handle(HttpExchange t) throws IOException { + try { + String path = t.getRequestURI().getRawPath(); + var test = TESTS.fromPath(path); + if (!path.startsWith(URI_PATH) || !test.isPresent()) { + t.getRequestBody().close(); + t.getResponseHeaders().add("Connection", "close"); + t.sendResponseHeaders(421, RSPBODY_EMPTY); + t.close(); + return; + } + try (var is = t.getRequestBody()) { + is.readAllBytes(); + } + switch (test.get()) { + case S204, S304, NOBODY -> + t.sendResponseHeaders(test.get().code(), RSPBODY_EMPTY); + case S200 -> { + byte[] bytes = BODY.getBytes(StandardCharsets.UTF_8); + t.sendResponseHeaders(test.get().code(), bytes.length); + try (var os = t.getResponseBody()) { + os.write(bytes); + } + } + case HEAD -> { + assert t.getRequestMethod().equals("HEAD"); + byte[] bytes = BODY.getBytes(StandardCharsets.UTF_8); + t.sendResponseHeaders(test.get().code(), bytes.length); + } + } + t.close(); + } catch (Throwable error) { + error.printStackTrace(); + throw error; + } + } + } + + volatile int passed = 0, failed = 0; + boolean debug = false; + void pass() {passed++;} + void fail() {failed++;} + void fail(String msg) {System.err.println(msg); fail();} + void unexpected(Throwable t) {failed++; t.printStackTrace();} + void debug(String message) { if (debug) System.out.println(message); } + void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);} + void check(java.security.cert.Certificate[] certs) { + // Use List.of to check that certs is not null and does not + // contain null. NullPointerException will be thrown here + // if that happens, which will make the test fail. + check(!List.of(certs).isEmpty(), "no certificates returned"); + } + public static void main(String[] args) throws Throwable { + Class k = new Object(){}.getClass().getEnclosingClass(); + try {k.getMethod("instanceMain",String[].class) + .invoke( k.newInstance(), (Object) args);} + catch (Throwable e) {throw e.getCause();}} + public void instanceMain(String[] args) throws Throwable { + try {test(args);} catch (Throwable t) {unexpected(t);} + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new AssertionError("Some tests failed");} +} diff --git a/test/jdk/sun/security/krb5/auto/UserIterCount.java b/test/jdk/sun/security/krb5/auto/UserIterCount.java index a90da012a061..f972e20ee1e1 100644 --- a/test/jdk/sun/security/krb5/auto/UserIterCount.java +++ b/test/jdk/sun/security/krb5/auto/UserIterCount.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,11 +30,19 @@ * @run main jdk.test.lib.FileInstaller TestHosts TestHosts * @run main/othervm -Djdk.net.hosts.file=TestHosts UserIterCount */ + +import java.util.HashMap; + +import sun.security.krb5.EncryptionKey; +import sun.security.krb5.KrbException; import sun.security.krb5.PrincipalName; public class UserIterCount { static class MyKDC extends OneKDC { + static final HashMap CACHE + = new HashMap<>(); + public MyKDC() throws Exception { super(null); } @@ -51,6 +59,18 @@ protected byte[] getParams(PrincipalName p, int etype) { return super.getParams(p, etype); } } + + @Override + EncryptionKey keyForUser(PrincipalName p, int etype, boolean server) + throws KrbException { + var key = p.toString() + etype + server; + var v = CACHE.get(key); + if (v == null) { + v = super.keyForUser(p, etype, server); + CACHE.put(key, v); + } + return v; + } } public static void main(String[] args) throws Exception { diff --git a/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java b/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java index 7e396013a71e..a1281995c46e 100644 --- a/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java +++ b/test/jdk/sun/security/krb5/config/native/TestDynamicStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,8 @@ import jdk.test.lib.Asserts; import sun.security.krb5.Config; +import javax.swing.JOptionPane; + // =================== Attention =================== // This test calls a native method implemented in libTestDynamicStore.m // to modify system-level Kerberos 5 settings stored in the dynamic store. @@ -56,6 +58,17 @@ static int action(char what, char whom) throws Exception { public static void main(String[] args) throws Exception { + // Show a popup to remind to run this test as sudo user + // this will only trigger if sudo (root) user is not detected + if (!"root".equals(System.getProperty("user.name"))) { + + JOptionPane.showMessageDialog(null, """ + This test MUST be run as ROOT.\s + Please close and RESTART the test."""); + + Asserts.assertFalse(true, "This test must be run as ROOT"); + } + System.loadLibrary("TestDynamicStore"); Config cfg = Config.getInstance(); diff --git a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java index 1d28c3494e78..c2c58b36c383 100644 --- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java +++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ * 8223499 8225392 8232019 8234245 8233223 8225068 8225069 8243321 8243320 * 8243559 8225072 8258630 8259312 8256421 8225081 8225082 8225083 8245654 * 8305975 8304760 8307134 8295894 8314960 8317373 8317374 8318759 8319187 - * 8321408 8316138 8341057 8303770 8350498 8359170 8361212 + * 8321408 8316138 8341057 8303770 8350498 8359170 8361212 8372351 * @summary Check root CA entries in cacerts file */ import java.io.ByteArrayInputStream; @@ -47,12 +47,12 @@ public class VerifyCACerts { + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. - private static final int COUNT = 109; + private static final int COUNT = 111; // SHA-256 of cacerts, can be generated with // shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95 private static final String CHECKSUM - = "70:73:12:D3:E8:01:89:28:F5:3D:10:8E:45:34:F6:28:CB:BF:AD:18:19:6D:F1:A2:E7:28:84:30:0B:E1:A6:9F"; + = "26:75:A0:AA:6E:7C:15:8B:BC:CF:11:81:38:3E:E7:94:31:9E:36:2D:F9:A6:BC:88:E1:A5:F8:46:9A:4C:1D:D7"; // Hex formatter to upper case with ":" delimiter private static final HexFormat HEX = HexFormat.ofDelimiter(":").withUpperCase(); @@ -279,6 +279,10 @@ public class VerifyCACerts { "7E:76:26:0A:E6:9A:55:D3:F0:60:B0:FD:18:B2:A8:C0:14:43:C8:7B:60:79:10:30:C9:FA:0B:05:85:10:1A:38"); put("sectigocodesignroote46 [jdk]", "8F:63:71:D8:CC:5A:A7:CA:14:96:67:A9:8B:54:96:39:89:51:E4:31:9F:7A:FB:CC:6A:66:0D:67:3E:43:8D:0B"); + put("wisekeyglobalrootgbca [jdk]", + "6B:9C:08:E8:6E:B0:F7:67:CF:AD:65:CD:98:B6:21:49:E5:49:4A:67:F5:84:5E:7B:D1:ED:01:9F:27:B8:6B:D6"); + put("wisekeyglobalrootgcca [jdk]", + "85:60:F9:1C:36:24:DA:BA:95:70:B5:FE:A0:DB:E3:6F:F1:1A:83:23:BE:94:86:85:4F:B3:F3:4A:55:71:19:8D"); } }; diff --git a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java index e1f32ea80765..b570a0dd0301 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java +++ b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/NISTWrapKAT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,13 +29,19 @@ * @summary Verify that the AES-Key-Wrap and AES-Key-Wrap-Pad ciphers * work as expected using NIST test vectors. */ +import jtreg.SkippedException; + import java.security.Key; import java.security.AlgorithmParameters; import java.security.Provider; -import javax.crypto.*; -import javax.crypto.spec.*; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.util.ArrayList; import java.util.Arrays; import java.math.BigInteger; +import java.util.List; // adapted from com/sun/crypto/provider/Cipher/KeyWrap/NISTWrapKAT.java public class NISTWrapKAT extends PKCS11Test { @@ -73,8 +79,11 @@ public class NISTWrapKAT extends PKCS11Test { "308D49692B5F8CF638D54BB4B985633504237329964C76EBB3F669870A708DBC"; private static String KWP_AES256_224 = "0942747DB07032A3F04CDB2E7DE1CBA038F92BC355393AE9A0E4AE8C901912AC3D3AF0F16D240607"; - // from RFC 5649 sec6 - private static String KEK2 = "5840DF6E29B02AF1AB493B705BF16EA1AE8338F4DCC176A8"; + // from RFC 5649 sec6 + private static String KEK2 = + "5840DF6E29B02AF1AB493B705BF16EA1AE8338F4DCC176A8"; + + private static final List skippedAlgoList = new ArrayList <>(); private static byte[] toBytes(String hex, int hexLen) { if (hexLen < hex.length()) { @@ -91,10 +100,18 @@ private static byte[] toBytes(String hex, int hexLen) { byte[] out = new byte[outLen]; if (val.length < outLen) { // enlarge - System.arraycopy(val, 0, out, outLen - val.length, val.length); + System.arraycopy(val, + 0, + out, + outLen - val.length, + val.length); } else { // truncate - System.arraycopy(val, val.length - outLen, out, 0, outLen); + System.arraycopy(val, + val.length - outLen, + out, + 0, + outLen); } return out; } @@ -143,7 +160,8 @@ public Object[][] testData() { "AFBEB0F07DFBF5419200F2CCB50BB24F" }, { "AES/KWP/NoPadding", KEK2, 24, "C37B7E6492584340BED12207808941155068F738", 20, - "138BDEAA9B8FA7FC61F97742E72248EE5AE6AE5360D1AE6A5F54F373FA543B6A" }, + "138BDEAA9B8FA7FC61F97742E72248EE5AE6AE5360D1AE6A5F54F373FA543B6A" + }, // some more test vectors for KW and KWP // from csrc.nist.gov/groups/STM/cavp/documents/mac/kwtestvectors.zip { "AES/KW/NoPadding", "7575da3a93607cc2bfd8cec7aadfd9a6", 16, @@ -256,7 +274,10 @@ public void testKeyWrap(String algo, String key, int keyLen, dataLen + "-byte key with " + 8*keyLen + "-bit KEK"); int allowed = Cipher.getMaxAllowedKeyLength("AES"); if (keyLen > allowed) { - System.out.println("=> skip, exceeds max allowed size " + allowed); + System.err.println("Skip, exceeds max allowed size " + allowed); + skippedAlgoList.add(algo + " Cipher with wrapping " + + dataLen + "-byte key with " + 8 * keyLen + + "-bit KEK exceeds max allowed size " + allowed); return; } Cipher c1 = Cipher.getInstance(algo, @@ -275,7 +296,8 @@ public void testKeyWrap(String algo, String key, int keyLen, c1.init(Cipher.WRAP_MODE, cipherKey); IvParameterSpec ivSpec = new IvParameterSpec(c1.getIV()); c2.init(Cipher.WRAP_MODE, cipherKey, ivSpec); - AlgorithmParameters params = AlgorithmParameters.getInstance("AES"); + AlgorithmParameters params = + AlgorithmParameters.getInstance("AES"); params.init(ivSpec); c3.init(Cipher.WRAP_MODE, cipherKey, params); @@ -300,9 +322,12 @@ public void testKeyWrap(String algo, String key, int keyLen, params.init(ivSpec); c3.init(Cipher.UNWRAP_MODE, cipherKey, params); - Key unwrapped = c1.unwrap(wrapped, "AES", Cipher.SECRET_KEY); - Key unwrapped2 = c2.unwrap(wrapped, "AES", Cipher.SECRET_KEY); - Key unwrapped3 = c3.unwrap(wrapped, "AES", Cipher.SECRET_KEY); + Key unwrapped = + c1.unwrap(wrapped, "AES", Cipher.SECRET_KEY); + Key unwrapped2 = + c2.unwrap(wrapped, "AES", Cipher.SECRET_KEY); + Key unwrapped3 = + c3.unwrap(wrapped, "AES", Cipher.SECRET_KEY); if (!Arrays.equals(unwrapped.getEncoded(), dataVal) || !Arrays.equals(unwrapped2.getEncoded(), dataVal) || @@ -319,7 +344,10 @@ public void testEnc(String algo, String key, int keyLen, String data, dataLen + "-byte data with " + 8*keyLen + "-bit KEK"); int allowed = Cipher.getMaxAllowedKeyLength("AES"); if (keyLen > allowed) { - System.out.println("=> skip, exceeds max allowed size " + allowed); + System.err.println("Skip, exceeds max allowed size " + allowed); + skippedAlgoList.add(algo + " Cipher with enc " + + dataLen + "-byte data with " + 8 * keyLen + + "-bit KEK exceeds max allowed size " + allowed); return; } Cipher c1 = Cipher.getInstance(algo, @@ -336,7 +364,8 @@ public void testEnc(String algo, String key, int keyLen, String data, c1.init(Cipher.ENCRYPT_MODE, cipherKey); IvParameterSpec ivSpec = new IvParameterSpec(c1.getIV()); c2.init(Cipher.ENCRYPT_MODE, cipherKey, ivSpec); - AlgorithmParameters params = AlgorithmParameters.getInstance("AES"); + AlgorithmParameters params = + AlgorithmParameters.getInstance("AES"); params.init(ivSpec); c3.init(Cipher.ENCRYPT_MODE, cipherKey, params); @@ -384,18 +413,24 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { Object[][] testDatum = testData(); - for (int i = 0; i < testDatum.length; i++) { - Object[] td = testDatum[i]; + for (Object[] td : testDatum) { String algo = (String) td[0]; if (p.getService("Cipher", algo) == null) { - System.out.println("Skip, due to no support: " + algo); + System.err.println("Skip, due to no support: " + algo); + skippedAlgoList.add("No support for " + algo); continue; } - testKeyWrap(algo, (String)td[1], (int)td[2], (String)td[3], - (int)td[4], (String)td[5], p); - testEnc(algo, (String)td[1], (int)td[2], (String)td[3], - (int)td[4], (String)td[5], p); + testKeyWrap(algo, (String) td[1], (int) td[2], (String) td[3], + (int) td[4], (String) td[5], p); + testEnc(algo, (String) td[1], (int) td[2], (String) td[3], + (int) td[4], (String) td[5], p); + } + + if (!skippedAlgoList.isEmpty()) { + throw new SkippedException("One or more tests skipped " + + skippedAlgoList); + } else { + System.out.println("All Tests Passed"); } - System.out.println("Test Passed"); } } diff --git a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java index 0cfb4557572c..d7cdfc6c04c5 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java +++ b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/TestGeneral.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,18 +29,30 @@ * @library /test/lib ../.. * @run main/othervm TestGeneral */ +import jtreg.SkippedException; + import java.nio.ByteBuffer; +import java.security.AlgorithmParameters; +import java.security.InvalidAlgorithmParameterException; +import java.security.Key; +import java.security.KeyPairGenerator; +import java.security.PrivateKey; +import java.security.Provider; +import java.util.ArrayList; import java.util.Arrays; import java.util.HexFormat; -import java.security.*; -import javax.crypto.*; -import javax.crypto.spec.*; +import java.util.List; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; // adapted from com/sun/crypto/provider/Cipher/KeyWrap/TestGeneral.java public class TestGeneral extends PKCS11Test { private static final byte[] DATA_32 = - Arrays.copyOf("1234567890123456789012345678901234".getBytes(), 32); + Arrays.copyOf("1234567890123456789012345678901234".getBytes(), + 32); private static final SecretKey KEY = new SecretKeySpec(DATA_32, 0, 16, "AES"); private static final int KW_IV_LEN = 8; @@ -49,7 +61,8 @@ public class TestGeneral extends PKCS11Test { private static final int MAX_KWP_PAD_LEN = 7; // 0-7 public static void testEnc(Cipher c, byte[] in, int startLen, int inc, - IvParameterSpec[] ivs, int maxPadLen) throws Exception { + IvParameterSpec[] ivs, int maxPadLen) + throws Exception { System.out.println("testEnc, input len=" + startLen + " w/ inc=" + inc); @@ -96,7 +109,7 @@ public static void testEnc(Cipher c, byte[] in, int startLen, int inc, } public static void testKAT(Cipher c, String keyStr, String inStr, - String expectedStr) throws Exception { + String expectedStr) throws Exception { System.out.println("testKAT, input len: " + inStr.length()/2); @@ -245,15 +258,21 @@ public void main(Provider p) throws Exception { SecretKey aes256 = new SecretKeySpec(DATA_32, "AES"); SecretKey any256 = new SecretKeySpec(DATA_32, "ANY"); PrivateKey priv = KeyPairGenerator.getInstance - ("RSA", System.getProperty("test.provider.name","SunRsaSign")) + ("RSA", + System.getProperty( + "test.provider.name", + "SunRsaSign")) .generateKeyPair().getPrivate(); String[] algos = { "AES/KW/PKCS5Padding", "AES/KW/NoPadding", "AES/KWP/NoPadding" }; + + final List skippedList = new ArrayList<>(); + for (String a : algos) { if (p.getService("Cipher", a) == null) { - System.out.println("Skip, due to no support: " + a); + skippedList.add(a); continue; } @@ -329,6 +348,12 @@ public void main(Provider p) throws Exception { testWrap(c, keys, ivs, padLen); testIv(c, ivLen, allowCustomIv); } - System.out.println("All Tests Passed"); + + if (!skippedList.isEmpty()) { + throw new SkippedException("One or more tests skipped " + + "due to no support " + skippedList); + } else { + System.out.println("All Tests Passed"); + } } } diff --git a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/XMLEncKAT.java b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/XMLEncKAT.java index 1857e619cc64..5ba02416c8b2 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/XMLEncKAT.java +++ b/test/jdk/sun/security/pkcs11/Cipher/KeyWrap/XMLEncKAT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,14 +28,16 @@ * @library /test/lib ../.. * @run main/othervm XMLEncKAT */ +import jtreg.SkippedException; + import java.util.Base64; import java.security.Key; -import java.security.AlgorithmParameters; import java.security.Provider; -import javax.crypto.*; -import javax.crypto.spec.*; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; import java.io.UnsupportedEncodingException; -import java.io.IOException; // adapted from com/sun/crypto/provider/Cipher/KeyWrap/XMLEncKAT.java public class XMLEncKAT extends PKCS11Test { @@ -105,7 +107,9 @@ private void testKeyWrap(Provider p, String cAlg, byte[] cKeyVal, // first test UNWRAP with known values for (int i = 0; i < base64Wrapped.length; i++) { byte[] wrappedKey = base64D.decode(base64Wrapped[i]); - key[i] = c.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY); + key[i] = c.unwrap(wrappedKey, + "AES", + Cipher.SECRET_KEY); if (c.getIV() != null) { params[i] = new IvParameterSpec(c.getIV()); } @@ -131,8 +135,7 @@ public void main(Provider p) throws Exception { String wrapAlg = "AESWrap"; if (p.getService("Cipher", wrapAlg) == null) { - System.out.println("Skip, due to no support: " + wrapAlg); - return; + throw new SkippedException("No support " + wrapAlg); } String keyAlg = "AES"; diff --git a/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java b/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java index da547da752b0..78a623cb3738 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java +++ b/test/jdk/sun/security/pkcs11/Cipher/ReinitCipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ * @run main/othervm -Djava.security.manager=allow ReinitCipher sm */ +import jtreg.SkippedException; + import java.security.Provider; import java.util.Random; import javax.crypto.Cipher; @@ -47,8 +49,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("Cipher", "ARCFOUR") == null) { - System.out.println("Not supported by provider, skipping"); - return; + throw new SkippedException("Algorithm ARCFOUR is not supported by provider, skipping"); } Random random = new Random(); byte[] data1 = new byte[10 * 1024]; diff --git a/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java b/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java index ddca64ecb691..7aafa4fd70f4 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java +++ b/test/jdk/sun/security/pkcs11/Cipher/Test4512704.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,16 @@ * @run main Test4512704 * @summary Verify that AES cipher can generate default IV in encrypt mode */ -import java.io.PrintStream; -import java.security.*; -import java.security.spec.*; -import java.util.Random; +import jtreg.SkippedException; -import javax.crypto.*; -import javax.crypto.spec.*; +import java.security.GeneralSecurityException; +import java.security.InvalidAlgorithmParameterException; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; import java.security.Provider; +import java.security.spec.AlgorithmParameterSpec; public class Test4512704 extends PKCS11Test { @@ -48,9 +50,8 @@ public void test(String mode, Provider p) throws Exception { transformation = "AES/" + mode + "/NoPadding"; c = Cipher.getInstance(transformation, p); } catch (GeneralSecurityException e) { - System.out.println("Skip testing " + p.getName() + - ", no support for " + mode); - return; + throw new SkippedException("Skip testing " + p.getName() + + ", no support for " + mode); } SecretKey key = new SecretKeySpec(new byte[16], "AES"); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java index 06c1e84392c3..f6b6157cefa2 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,13 +31,21 @@ * @key randomness */ -import java.security.*; -import javax.crypto.*; -import javax.crypto.spec.*; -import java.math.*; -import java.io.*; +import jtreg.SkippedException; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import javax.crypto.Cipher; +import javax.crypto.CipherInputStream; +import javax.crypto.CipherOutputStream; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + +import java.security.GeneralSecurityException; +import java.security.Provider; +import java.util.Arrays; +import java.util.Random; -import java.util.*; public class TestCICOWithGCM extends PKCS11Test { public static void main(String[] args) throws Exception { @@ -55,9 +63,8 @@ public void test(String mode, Provider p) throws Exception { String transformation = "AES/" + mode + "/NoPadding"; c = Cipher.getInstance(transformation, p); } catch (GeneralSecurityException e) { - System.out.println("Skip testing " + p.getName() + - ", no support for " + mode); - return; + throw new SkippedException("Skip testing " + p.getName() + + ", no support for " + mode); } SecretKey key = new SecretKeySpec(new byte[16], "AES"); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java index be2b1d18c8f0..13ab8541351d 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestCICOWithGCMAndAAD.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ * @summary Test CipherInputStream/OutputStream with AES GCM mode with AAD. * @key randomness */ +import jtreg.SkippedException; + import java.io.*; import java.security.*; import java.util.*; @@ -44,7 +46,6 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { test("GCM", p); -// test("CCM", p); } public void test(String mode, Provider p) throws Exception { @@ -53,9 +54,8 @@ public void test(String mode, Provider p) throws Exception { String transformation = "AES/" + mode + "/NoPadding"; c = Cipher.getInstance(transformation, p); } catch (GeneralSecurityException e) { - System.out.println("Skip testing " + p.getName() + - ", no support for " + mode); - return; + throw new SkippedException("Skip testing " + p.getName() + + ", no support for " + mode); } SecretKey key = new SecretKeySpec(new byte[16], "AES"); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPoly.java b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPoly.java index 26853ae3ee6d..da351bc7493d 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPoly.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPoly.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ import javax.crypto.spec.SecretKeySpec; import javax.crypto.NoSuchPaddingException; -import jdk.test.lib.Utils; +import jtreg.SkippedException; public class TestChaChaPoly extends PKCS11Test { @@ -70,8 +70,7 @@ public void main(Provider p) throws Exception { try { Cipher.getInstance(ALGO, p); } catch (NoSuchAlgorithmException nsae) { - System.out.println("Skip; no support for " + ALGO); - return; + throw new SkippedException("Skip; no support for " + ALGO); } this.p = p; testTransformations(); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyKAT.java b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyKAT.java index 5649ed013ef5..d2590b2c3cba 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyKAT.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyKAT.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,22 +26,25 @@ * @bug 8255410 * @library /test/lib .. * @modules jdk.crypto.cryptoki - * @build jdk.test.lib.Convert * @run main/othervm TestChaChaPolyKAT * @summary ChaCha20-Poly1305 Cipher Implementation (KAT) */ -import java.util.*; +import jtreg.SkippedException; + import java.security.GeneralSecurityException; import java.security.Provider; import java.security.NoSuchAlgorithmException; import javax.crypto.Cipher; -import javax.crypto.spec.ChaCha20ParameterSpec; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import javax.crypto.AEADBadTagException; import java.nio.ByteBuffer; -import jdk.test.lib.Convert; +import java.util.Arrays; +import java.util.HexFormat; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; public class TestChaChaPolyKAT extends PKCS11Test { public static class TestData { @@ -126,8 +129,7 @@ public void main(Provider p) throws Exception { try { Cipher.getInstance(ALGO, p); } catch (NoSuchAlgorithmException nsae) { - System.out.println("Skip; no support for " + ALGO); - return; + throw new SkippedException("Skip; no support for " + ALGO); } int testsPassed = 0; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyNoReuse.java b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyNoReuse.java index 94272367caa3..60d80b9e3653 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyNoReuse.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyNoReuse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,18 +30,22 @@ * (key/nonce reuse check) */ -import java.util.*; +import jtreg.SkippedException; + import javax.crypto.Cipher; import java.security.spec.AlgorithmParameterSpec; import java.security.Provider; import java.security.NoSuchAlgorithmException; -import javax.crypto.spec.ChaCha20ParameterSpec; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import javax.crypto.AEADBadTagException; import javax.crypto.SecretKey; import java.security.InvalidKeyException; import java.security.InvalidAlgorithmParameterException; +import java.util.Arrays; +import java.util.HexFormat; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; public class TestChaChaPolyNoReuse extends PKCS11Test { @@ -238,8 +242,7 @@ public void main(Provider p) throws Exception { try { Cipher.getInstance(CIPHER_ALGO, p); } catch (NoSuchAlgorithmException nsae) { - System.out.println("Skip; no support for " + CIPHER_ALGO); - return; + throw new SkippedException("Skip; no support for " + CIPHER_ALGO); } int testsPassed = 0; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyOutputSize.java b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyOutputSize.java index 57a7b9a46067..f68340658fa3 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyOutputSize.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestChaChaPolyOutputSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,14 @@ * @run main TestChaChaPolyOutputSize */ +import jtreg.SkippedException; + import java.nio.ByteBuffer; import java.security.GeneralSecurityException; -import java.security.Key; import java.security.SecureRandom; import java.security.Provider; import java.security.NoSuchAlgorithmException; import javax.crypto.Cipher; -import javax.crypto.spec.ChaCha20ParameterSpec; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; @@ -60,8 +60,7 @@ public void main(Provider p) throws GeneralSecurityException { try { Cipher.getInstance(ALGO, p); } catch (NoSuchAlgorithmException nsae) { - System.out.println("Skip; no support for " + ALGO); - return; + throw new SkippedException("Skip; no support for " + ALGO); } testGetOutSize(p); testMultiPartAEADDec(p); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java b/test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java index 76f0c9dc4122..cf3d948be17f 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ * @run main/othervm TestCipherMode */ +import jtreg.SkippedException; + import java.security.Provider; import java.security.Key; import java.security.KeyPair; @@ -38,20 +40,22 @@ import java.security.PublicKey; import java.security.InvalidParameterException; import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class TestCipherMode extends PKCS11Test { - private static String[] TRANSFORMATIONS = { - "AES/ECB/PKCS5Padding", "AES/GCM/NoPadding", - "RSA/ECB/PKCS1Padding" + private static final String[] TRANSFORMATIONS = { + "AES/ECB/PKCS5Padding", "AES/GCM/NoPadding", + "RSA/ECB/PKCS1Padding" }; - private static byte[] BYTES16 = - Arrays.copyOf(TRANSFORMATIONS[0].getBytes(), 16); + private static final byte[] BYTES16 = + Arrays.copyOf("AES/ECB/PKCS5Padding".getBytes(), 16); private static SecretKey AES_KEY = new SecretKeySpec(BYTES16, "AES"); private static PublicKey RSA_PUBKEY = null; private static PrivateKey RSA_PRIVKEY = null; @@ -97,18 +101,29 @@ public void main(Provider p) throws Exception { // test all cipher impls, e.g. P11Cipher, P11AEADCipher, and // P11RSACipher - for (String t : TRANSFORMATIONS) { - checkModes(t, p); + List skipped = new ArrayList<>(); + for (final String t : TRANSFORMATIONS) { + try { + checkModes(t, p); + } catch (SkippedException skippedException) { + // printing to System.out, so it's easier to see which test it relates to + skippedException.printStackTrace(System.out); + skipped.add(t); + } + } + + if (!skipped.isEmpty()) { + throw new SkippedException("Some tests skipped: " + skipped); + } else { + System.out.println("All tests passed"); } - System.out.println("All tests passed"); } private static void checkModes(String t, Provider p) throws Exception { try { Cipher.getInstance(t, p); } catch (Exception e) { - System.out.println("Skip " + t + " due to " + e.getMessage()); - return; + throw new SkippedException("Skip " + t + " due to " + e.getMessage()); } for (CipherMode m : CipherMode.values()) { diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java b/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java index adabcc571aaa..4e78d8d39d77 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestGCMKeyAndIvCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,13 +31,21 @@ */ -import java.security.*; +import jtreg.SkippedException; + +import java.security.AlgorithmParameters; +import java.security.GeneralSecurityException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.Provider; import java.security.spec.AlgorithmParameterSpec; -import javax.crypto.*; -import javax.crypto.spec.*; -import java.math.*; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; -import java.util.*; +import java.util.Arrays; public class TestGCMKeyAndIvCheck extends PKCS11Test { @@ -77,9 +85,8 @@ public void test(String mode, Provider p) throws Exception { String transformation = "AES/" + mode + "/NoPadding"; c = Cipher.getInstance(transformation, p); } catch (GeneralSecurityException e) { - System.out.println("Skip testing " + p.getName() + - ", no support for " + mode); - return; + throw new SkippedException("Skip testing " + p.getName() + + ", no support for " + mode); } System.out.println("Testing against " + p.getName()); SecretKey key = new SecretKeySpec(new byte[16], "AES"); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java b/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java index 95e6e5b1a0a8..e5e8284e6f4a 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,6 +30,8 @@ * @summary Known Answer Test for AES cipher with GCM mode support in * PKCS11 provider. */ +import jtreg.SkippedException; + import java.security.GeneralSecurityException; import java.security.Provider; import java.util.Arrays; @@ -311,23 +313,27 @@ public void main(Provider p) throws Exception { try { c = Cipher.getInstance(transformation, p); } catch (GeneralSecurityException e) { - System.out.println("Skip testing " + p.getName() + - ", no support for " + transformation); - return; + throw new SkippedException("Skip testing " + p.getName() + + ", no support for " + transformation); } try { if (execute(testValues, c)) { System.out.println("Test Passed!"); } } catch (Exception e) { - System.out.println("Exception occured using " + p.getName() + " version " + p.getVersionStr()); + System.out.println("Exception occured using " + p.getName() + + " version " + p.getVersionStr()); if (isNSS(p)) { - double ver = getNSSInfo("nss"); + Version ver = getNSSInfo("nss"); String osName = System.getProperty("os.name"); - if (ver > 3.139 && ver < 3.15 && osName.equals("Linux")) { + + if (osName.equals("Linux") && + ver.major() == 3 && ver.minor() < 15 + && (ver.minor() > 13 && ver.patch() >= 9)) { // warn about buggy behaviour on Linux with nss 3.14 - System.out.println("Warning: old NSS " + ver + " might be problematic, consider upgrading it"); + System.out.println("Warning: old NSS " + ver + + " might be problematic, consider upgrading it"); } } throw e; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java index 6799b19d3e7c..3460eb64e171 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,7 @@ import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import jdk.test.lib.security.SecurityUtils; +import jtreg.SkippedException; public class TestRSACipher extends PKCS11Test { @@ -56,8 +57,7 @@ public void main(Provider p) throws Exception { try { Cipher.getInstance(RSA_ALGOS[0], p); } catch (GeneralSecurityException e) { - System.out.println("Not supported by provider, skipping"); - return; + throw new SkippedException("Algorithm " + RSA_ALGOS[0] + " is not supported by provider, skipping"); } String kpgAlgorithm = "RSA"; int keySize = SecurityUtils.getTestKeySize(kpgAlgorithm); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java index 0be916ebf9e7..23568da93e11 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestRSACipherWrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,6 +44,7 @@ import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import jdk.test.lib.security.SecurityUtils; +import jtreg.SkippedException; public class TestRSACipherWrap extends PKCS11Test { @@ -55,8 +56,7 @@ public void main(Provider p) throws Exception { try { Cipher.getInstance(RSA_ALGOS[0], p); } catch (GeneralSecurityException e) { - System.out.println(RSA_ALGOS[0] + " unsupported, skipping"); - return; + throw new SkippedException(RSA_ALGOS[0] + " unsupported, skipping"); } String kpgAlgorithm = "RSA"; KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgorithm, p); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java b/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java index fe6433d096e3..dae331bc85f6 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestRawRSACipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,7 @@ import java.util.Random; import javax.crypto.Cipher; import jdk.test.lib.security.SecurityUtils; +import jtreg.SkippedException; public class TestRawRSACipher extends PKCS11Test { @@ -50,8 +51,7 @@ public void main(Provider p) throws Exception { try { Cipher.getInstance("RSA/ECB/NoPadding", p); } catch (GeneralSecurityException e) { - System.out.println("Not supported by provider, skipping"); - return; + throw new SkippedException("Algorithm RSA/ECB/NoPadding is not supported by provider, skipping"); } String kpgAlgorithm = "RSA"; diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java index 5082336d36b8..81862fb05f28 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,11 +33,15 @@ * @run main/othervm -Djava.security.manager=allow TestSymmCiphers sm */ +import jtreg.SkippedException; + import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; import java.security.AlgorithmParameters; import java.security.NoSuchAlgorithmException; import java.security.Provider; +import java.util.ArrayList; +import java.util.List; import java.util.Random; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; @@ -45,42 +49,32 @@ public class TestSymmCiphers extends PKCS11Test { - private static class CI { // class for holding Cipher Information - - String transformation; - String keyAlgo; - int dataSize; + private record CI (String transformation, String keyAlgo, int dataSize){} // record for holding Cipher Information - CI(String transformation, String keyAlgo, int dataSize) { - this.transformation = transformation; - this.keyAlgo = keyAlgo; - this.dataSize = dataSize; - } - } private static final CI[] TEST_LIST = { - new CI("ARCFOUR", "ARCFOUR", 400), - new CI("RC4", "RC4", 401), - new CI("DES/CBC/NoPadding", "DES", 400), - new CI("DESede/CBC/NoPadding", "DESede", 160), - new CI("AES/CBC/NoPadding", "AES", 4800), - new CI("Blowfish/CBC/NoPadding", "Blowfish", 24), - new CI("DES/cbc/PKCS5Padding", "DES", 6401), - new CI("DESede/CBC/PKCS5Padding", "DESede", 402), - new CI("AES/CBC/PKCS5Padding", "AES", 30), - new CI("Blowfish/CBC/PKCS5Padding", "Blowfish", 19), - new CI("DES/ECB/NoPadding", "DES", 400), - new CI("DESede/ECB/NoPadding", "DESede", 160), - new CI("AES/ECB/NoPadding", "AES", 4800), - new CI("DES/ECB/PKCS5Padding", "DES", 32), - new CI("DES/ECB/PKCS5Padding", "DES", 6400), - new CI("DESede/ECB/PKCS5Padding", "DESede", 400), - new CI("AES/ECB/PKCS5Padding", "AES", 64), - - new CI("DES", "DES", 6400), - new CI("DESede", "DESede", 408), - new CI("AES", "AES", 128), - - new CI("AES/CTR/NoPadding", "AES", 3200) + new CI("ARCFOUR", "ARCFOUR", 400), + new CI("RC4", "RC4", 401), + new CI("DES/CBC/NoPadding", "DES", 400), + new CI("DESede/CBC/NoPadding", "DESede", 160), + new CI("AES/CBC/NoPadding", "AES", 4800), + new CI("Blowfish/CBC/NoPadding", "Blowfish", 24), + new CI("DES/cbc/PKCS5Padding", "DES", 6401), + new CI("DESede/CBC/PKCS5Padding", "DESede", 402), + new CI("AES/CBC/PKCS5Padding", "AES", 30), + new CI("Blowfish/CBC/PKCS5Padding", "Blowfish", 19), + new CI("DES/ECB/NoPadding", "DES", 400), + new CI("DESede/ECB/NoPadding", "DESede", 160), + new CI("AES/ECB/NoPadding", "AES", 4800), + new CI("DES/ECB/PKCS5Padding", "DES", 32), + new CI("DES/ECB/PKCS5Padding", "DES", 6400), + new CI("DESede/ECB/PKCS5Padding", "DESede", 400), + new CI("AES/ECB/PKCS5Padding", "AES", 64), + + new CI("DES", "DES", 6400), + new CI("DESede", "DESede", 408), + new CI("AES", "AES", 128), + + new CI("AES/CTR/NoPadding", "AES", 3200) }; private static StringBuffer debugBuf = new StringBuffer(); @@ -90,11 +84,10 @@ public void main(Provider p) throws Exception { // NSS reports CKR_DEVICE_ERROR when the data passed to // its EncryptUpdate/DecryptUpdate is not multiple of blocks int firstBlkSize = 16; - boolean status = true; + List skippedList = new ArrayList<>(); Random random = new Random(); try { - for (int i = 0; i < TEST_LIST.length; i++) { - CI currTest = TEST_LIST[i]; + for (CI currTest : TEST_LIST) { System.out.println("===" + currTest.transformation + "==="); try { KeyGenerator kg = @@ -123,7 +116,8 @@ public void main(Provider p) throws Exception { System.out.println("Decryption tests: DONE"); } catch (NoSuchAlgorithmException nsae) { System.out.println("Skipping unsupported algorithm: " + - nsae); + nsae); + skippedList.add(currTest); } } } catch (Exception ex) { @@ -134,11 +128,15 @@ public void main(Provider p) throws Exception { } throw ex; } + + if (!skippedList.isEmpty()){ + throw new SkippedException("Some tests skipped: " + skippedList); + } } private static void test(Cipher cipher, int mode, SecretKey key, - AlgorithmParameters params, int firstBlkSize, - byte[] in, byte[] answer) throws Exception { + AlgorithmParameters params, int firstBlkSize, + byte[] in, byte[] answer) throws Exception { // test setup long startTime, endTime; cipher.init(mode, key, params); diff --git a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java index ea5181e98dc3..cc27fedf2dab 100644 --- a/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java +++ b/test/jdk/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ * @run main/othervm -Djava.security.manager=allow TestSymmCiphersNoPad sm */ +import jtreg.SkippedException; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; @@ -40,6 +42,8 @@ import java.security.AlgorithmParameters; import java.security.NoSuchAlgorithmException; import java.security.Provider; +import java.util.ArrayList; +import java.util.List; import java.util.Random; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; @@ -48,46 +52,35 @@ public class TestSymmCiphersNoPad extends PKCS11Test { - private static class CI { // class for holding Cipher Information - String transformation; - String keyAlgo; - int dataSize; + private record CI (String transformation, String keyAlgo, int dataSize){} // record for holding Cipher Information - CI(String transformation, String keyAlgo, int dataSize) { - this.transformation = transformation; - this.keyAlgo = keyAlgo; - this.dataSize = dataSize; - } - } + private static StringBuffer debugBuf; - private static final CI TEST_LIST[] = { - new CI("ARCFOUR", "ARCFOUR", 400), - new CI("RC4", "RC4", 401), - new CI("DES/CBC/NoPadding", "DES", 400), - new CI("DESede/CBC/NoPadding", "DESede", 160), - new CI("AES/CBC/NoPadding", "AES", 4800), - new CI("Blowfish/CBC/NoPadding", "Blowfish", 24), - new CI("AES/CTR/NoPadding", "AES", 1600), - new CI("AES/CTR/NoPadding", "AES", 65) + private static final CI[] TEST_LIST = { + new CI("ARCFOUR", "ARCFOUR", 400), + new CI("RC4", "RC4", 401), + new CI("DES/CBC/NoPadding", "DES", 400), + new CI("DESede/CBC/NoPadding", "DESede", 160), + new CI("AES/CBC/NoPadding", "AES", 4800), + new CI("Blowfish/CBC/NoPadding", "Blowfish", 24), + new CI("AES/CTR/NoPadding", "AES", 1600), + new CI("AES/CTR/NoPadding", "AES", 65) }; - private static StringBuffer debugBuf; - @Override public void main(Provider p) throws Exception { - boolean status = true; + List skippedList = new ArrayList<>(); Random random = new Random(); try { - for (int i = 0; i < TEST_LIST.length; i++) { - CI currTest = TEST_LIST[i]; + for (CI currTest : TEST_LIST) { System.out.println("===" + currTest.transformation + "==="); try { KeyGenerator kg = - KeyGenerator.getInstance(currTest.keyAlgo, p); + KeyGenerator.getInstance(currTest.keyAlgo, p); SecretKey key = kg.generateKey(); Cipher c1 = Cipher.getInstance(currTest.transformation, p); Cipher c2 = Cipher.getInstance(currTest.transformation, - System.getProperty("test.provider.name", "SunJCE")); + System.getProperty("test.provider.name", "SunJCE")); byte[] plainTxt = new byte[currTest.dataSize]; random.nextBytes(plainTxt); @@ -97,16 +90,17 @@ public void main(Provider p) throws Exception { AlgorithmParameters params = c2.getParameters(); byte[] answer = c2.doFinal(plainTxt); test(c1, Cipher.ENCRYPT_MODE, key, params, - plainTxt, answer); + plainTxt, answer); System.out.println("Encryption tests: DONE"); c2.init(Cipher.DECRYPT_MODE, key, params); byte[] answer2 = c2.doFinal(answer); test(c1, Cipher.DECRYPT_MODE, key, params, - answer, answer2); + answer, answer2); System.out.println("Decryption tests: DONE"); } catch (NoSuchAlgorithmException nsae) { System.out.println("Skipping unsupported algorithm: " + nsae); + skippedList.add(currTest); } } } catch (Exception ex) { @@ -116,6 +110,10 @@ public void main(Provider p) throws Exception { } throw ex; } + + if (!skippedList.isEmpty()){ + throw new SkippedException("Some tests skipped: " + skippedList); + } } private static void test(Cipher cipher, int mode, SecretKey key, diff --git a/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.java b/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.java index 11a6a781e01d..23f5fc3d6a1c 100644 --- a/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.java +++ b/test/jdk/sun/security/pkcs11/Config/ReadConfInUTF16Env.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ */ import jdk.test.lib.process.ProcessTools; +import jtreg.SkippedException; import org.testng.annotations.Test; import java.security.Provider; @@ -47,8 +48,7 @@ static class TestSunPKCS11Provider { public static void main(String[] args) throws Exception { Provider p = Security.getProvider("SunPKCS11"); if (p == null) { - System.out.println("Skipping test - no PKCS11 provider available"); - return; + throw new SkippedException("No PKCS11 provider available"); } System.out.println(p.getName()); } diff --git a/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java b/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java index 4d876604c018..1ff80fcaf07f 100644 --- a/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java +++ b/test/jdk/sun/security/pkcs11/KeyStore/SecretKeysBasic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,11 +116,14 @@ private static boolean checkSecretKeyEntry(String alias, // A bug in NSS 3.12 (Mozilla bug 471665) causes AES key lengths // to be read incorrectly. Checking for improper 16 byte length // in key string. - if (isNSS(provider) && expected.getAlgorithm().equals("AES") && - (getNSSVersion() >= 3.12 && getNSSVersion() <= 3.122)) { - System.out.println("NSS 3.12 bug returns incorrect AES key "+ - "length breaking key storage. Aborting..."); - return true; + if (isNSS(provider) && expected.getAlgorithm().equals("AES")) { + Version version = getNSSVersion(); + if (version.major() == 3 && version.minor() == 12 + && version.patch() <= 2) { + System.out.println("NSS 3.12 bug returns incorrect AES key " + + "length breaking key storage. Aborting..."); + return true; + } } if (saveBeforeCheck) { @@ -168,7 +171,7 @@ private static void dumpKey(String info, SecretKey key) { private static void doTest() throws Exception { // Make sure both NSS libraries are the same version. if (isNSS(provider) && - (getLibsoftokn3Version() != getLibnss3Version())) { + (!getLibsoftokn3Version().equals(getLibnss3Version()))) { System.out.println("libsoftokn3 and libnss3 versions do not match. Aborting test..."); return; } diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index c231791e9728..21324922c70c 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -82,10 +82,10 @@ public abstract class PKCS11Test { // Version of the NSS artifact. This coincides with the version of // the NSS version - private static final String NSS_BUNDLE_VERSION = "3.111"; + private static final String NSS_BUNDLE_VERSION = "3.117"; private static final String NSSLIB = "jpg.tests.jdk.nsslib"; - static double nss_version = -1; + static Version nss_version = null; static ECCState nss_ecc_status = ECCState.Basic; // The NSS library we need to search for in getNSSLibDir() @@ -95,8 +95,8 @@ public abstract class PKCS11Test { // NSS versions of each library. It is simpler to keep nss_version // for quick checking for generic testing than many if-else statements. - static double softoken3_version = -1; - static double nss3_version = -1; + static Version softoken3_version = null; + static Version nss3_version = null; static Provider pkcs11 = newPKCS11Provider(); private static String PKCS11_BASE; private static Map osMap; @@ -271,13 +271,29 @@ private static String getOsId() { } static boolean isBadNSSVersion(Provider p) { - double nssVersion = getNSSVersion(); - if (isNSS(p) && nssVersion >= 3.11 && nssVersion < 3.12) { - System.out.println("NSS 3.11 has a DER issue that recent " + - "version do not, skipping"); - return true; + Version nssVersion = getNSSVersion(); + if (isNSS(p)) { + // bad version is just between [3.11,3.12) + return nssVersion.major == 3 && 11 == nssVersion.minor; + } else { + return false; } - return false; + } + + public record Version(int major, int minor, int patch) {} + + protected static Version parseVersionString(String version) { + String [] parts = version.split("\\."); + int major = Integer.parseInt(parts[0]); + int minor = 0; + int patch = 0; + if (parts.length >= 2) { + minor = Integer.parseInt(parts[1]); + } + if (parts.length >= 3) { + patch = Integer.parseInt(parts[2]); + } + return new Version(major, minor, patch); } protected static void safeReload(String lib) { @@ -306,26 +322,26 @@ public static boolean isNSS(Provider p) { return p.getName().equalsIgnoreCase("SUNPKCS11-NSS"); } - static double getNSSVersion() { - if (nss_version == -1) + static Version getNSSVersion() { + if (nss_version == null) getNSSInfo(); return nss_version; } static ECCState getNSSECC() { - if (nss_version == -1) + if (nss_version == null) getNSSInfo(); return nss_ecc_status; } - public static double getLibsoftokn3Version() { - if (softoken3_version == -1) + public static Version getLibsoftokn3Version() { + if (softoken3_version == null) return getNSSInfo("softokn3"); return softoken3_version; } - public static double getLibnss3Version() { - if (nss3_version == -1) + public static Version getLibnss3Version() { + if (nss3_version == null) return getNSSInfo("nss3"); return nss3_version; } @@ -340,7 +356,7 @@ static void getNSSInfo() { // $Header: NSS // Version: NSS // Here, stands for NSS version. - static double getNSSInfo(String library) { + static Version getNSSInfo(String library) { // look for two types of headers in NSS libraries String nssHeader1 = "$Header: NSS"; String nssHeader2 = "Version: NSS"; @@ -349,15 +365,15 @@ static double getNSSInfo(String library) { int i = 0; Path libfile = null; - if (library.compareTo("softokn3") == 0 && softoken3_version > -1) + if (library.compareTo("softokn3") == 0 && softoken3_version != null) return softoken3_version; - if (library.compareTo("nss3") == 0 && nss3_version > -1) + if (library.compareTo("nss3") == 0 && nss3_version != null) return nss3_version; try { libfile = getNSSLibPath(); if (libfile == null) { - return 0.0; + return parseVersionString("0.0"); } try (InputStream is = Files.newInputStream(libfile)) { byte[] data = new byte[1000]; @@ -393,7 +409,7 @@ static double getNSSInfo(String library) { if (!found) { System.out.println("lib" + library + " version not found, set to 0.0: " + libfile); - nss_version = 0.0; + nss_version = parseVersionString("0.0"); return nss_version; } @@ -406,26 +422,7 @@ static double getNSSInfo(String library) { version.append(c); } - // If a "dot dot" release, strip the extra dots for double parsing - String[] dot = version.toString().split("\\."); - if (dot.length > 2) { - version = new StringBuilder(dot[0] + "." + dot[1]); - for (int j = 2; dot.length > j; j++) { - version.append(dot[j]); - } - } - - // Convert to double for easier version value checking - try { - nss_version = Double.parseDouble(version.toString()); - } catch (NumberFormatException e) { - System.out.println("===== Content start ====="); - System.out.println(s); - System.out.println("===== Content end ====="); - System.out.println("Failed to parse lib" + library + - " version. Set to 0.0"); - e.printStackTrace(); - } + nss_version = parseVersionString(version.toString()); System.out.print("library: " + library + ", version: " + version + ". "); @@ -747,7 +744,12 @@ private static Path fetchNssLib(String osId, Path libraryName) throws IOExceptio } private static Path fetchNssLib(Class clazz, Path libraryName) throws IOException { - Path p = ArtifactResolver.fetchOne(clazz); + Path p; + try { + p = ArtifactResolver.fetchOne(clazz); + } catch (IOException exc) { + throw new SkippedException("Could not find NSS", exc); + } return findNSSLibrary(p, libraryName); } @@ -794,7 +796,7 @@ protected boolean skipTest(Provider p) { private void premain(Provider p) throws Exception { if (skipTest(p)) { - return; + throw new SkippedException("See logs for details"); } // set a security manager and policy before a test case runs, diff --git a/test/jdk/sun/security/pkcs11/Provider/Absolute.java b/test/jdk/sun/security/pkcs11/Provider/Absolute.java index c298c076b30f..07a934030dbf 100644 --- a/test/jdk/sun/security/pkcs11/Provider/Absolute.java +++ b/test/jdk/sun/security/pkcs11/Provider/Absolute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ * @summary load DLLs and launch executables using fully qualified path */ +import jtreg.SkippedException; + import java.security.InvalidParameterException; import java.security.Provider; @@ -40,12 +42,11 @@ public static void main(String[] args) throws Exception { try { Provider p = PKCS11Test.getSunPKCS11(config); if (p == null) { - System.out.println("Skipping test - no PKCS11 provider available"); + throw new SkippedException("Skipping test - no PKCS11 provider available"); } } catch (InvalidParameterException ipe) { Throwable ex = ipe.getCause(); - if (ex.getMessage().indexOf( - "Absolute path required for library value:") != -1) { + if (ex.getMessage().contains("Absolute path required for library value:")) { System.out.println("Test Passed: expected exception thrown"); } else { // rethrow diff --git a/test/jdk/sun/security/pkcs11/Provider/ConfigShortPath.java b/test/jdk/sun/security/pkcs11/Provider/ConfigShortPath.java index f229360f1afd..120f289d211b 100644 --- a/test/jdk/sun/security/pkcs11/Provider/ConfigShortPath.java +++ b/test/jdk/sun/security/pkcs11/Provider/ConfigShortPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,17 @@ * @bug 6581254 6986789 7196009 8062170 * @summary Allow '~', '+', and quoted paths in config file * @author Valerie Peng + * @library /test/lib */ -import java.security.*; -import java.io.*; -import java.lang.reflect.*; +import jtreg.SkippedException; + +import java.io.File; +import java.io.IOException; +import java.security.InvalidParameterException; +import java.security.Provider; +import java.security.ProviderException; +import java.security.Security; public class ConfigShortPath { @@ -43,8 +49,7 @@ public class ConfigShortPath { public static void main(String[] args) throws Exception { Provider p = Security.getProvider("SunPKCS11"); if (p == null) { - System.out.println("Skipping test - no PKCS11 provider available"); - return; + throw new SkippedException("Skipping test - no PKCS11 provider available"); } String osInfo = System.getProperty("os.name", ""); @@ -65,7 +70,7 @@ public static void main(String[] args) throws Exception { if (cause.getClass().getName().equals ("sun.security.pkcs11.ConfigurationException")) { // Error occurred during parsing - if (cause.getMessage().indexOf("Unexpected") != -1) { + if (cause.getMessage().contains("Unexpected")) { throw (ProviderException) cause; } } diff --git a/test/jdk/sun/security/pkcs11/Provider/LoginISE.java b/test/jdk/sun/security/pkcs11/Provider/LoginISE.java index 5027770c5e67..d131a8572164 100644 --- a/test/jdk/sun/security/pkcs11/Provider/LoginISE.java +++ b/test/jdk/sun/security/pkcs11/Provider/LoginISE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,16 +21,22 @@ * questions. */ -import java.io.*; -import java.util.*; -import java.security.*; -import javax.security.auth.callback.*; +import jtreg.SkippedException; + +import java.io.IOException; +import java.security.AuthProvider; +import java.security.Provider; +import java.security.Security; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; /** * @test * @bug 8130648 * @summary make sure IllegalStateException is thrown for uninitialized * SunPKCS11 provider instance + * @library /test/lib */ public class LoginISE { @@ -38,8 +44,7 @@ public static void main(String[] args) throws Exception { Provider p = Security.getProvider("SunPKCS11"); if (p == null) { - System.out.println("No un-initialized PKCS11 provider available; skip"); - return; + throw new SkippedException("No un-initialized PKCS11 provider available; skip"); } if (!(p instanceof AuthProvider)) { throw new RuntimeException("Error: expect AuthProvider!"); diff --git a/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java index ab74358fb0f7..91226f4a2280 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/AddPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,9 +68,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java index 9792a80de8dc..9c33c70e8952 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java +++ b/test/jdk/sun/security/pkcs11/Secmod/AddTrustedCert.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,9 +53,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (initSecmod() == false) { - return; - } + initSecmod(); X509Certificate cert; try (InputStream in = new FileInputStream(BASE + SEP + "anchor.cer")) { @@ -133,10 +131,10 @@ public static void main(String[] args) throws Exception { } private static boolean improperNSSVersion(Provider p) { - double nssVersion = getNSSVersion(); - if (p.getName().equalsIgnoreCase("SunPKCS11-NSSKeyStore") - && nssVersion >= 3.28 && nssVersion < 3.35) { - return true; + Version nssVersion = getNSSVersion(); + if (p.getName().equalsIgnoreCase("SunPKCS11-NSSKeyStore")) { + return nssVersion.major() == 3 && + (nssVersion.minor() >= 28 && nssVersion.minor() < 35); } return false; diff --git a/test/jdk/sun/security/pkcs11/Secmod/Crypto.java b/test/jdk/sun/security/pkcs11/Secmod/Crypto.java index d57794f1199f..57479db6bf5c 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/Crypto.java +++ b/test/jdk/sun/security/pkcs11/Secmod/Crypto.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,9 +41,7 @@ public class Crypto extends SecmodTest { public static void main(String[] args) throws Exception { - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nsscrypto.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java index f9f809f0d28f..00fbe7325d83 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/GetPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,9 +52,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java b/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java index 1689d4c4ed99..65693963347e 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java +++ b/test/jdk/sun/security/pkcs11/Secmod/JksSetPrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,9 +51,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java b/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java index ce9f8e9bb638..4bd800a49838 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java +++ b/test/jdk/sun/security/pkcs11/Secmod/LoadKeystore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,9 +48,7 @@ public static void main(String[] args) throws Exception { BASE + File.separator + args[1]); } - if (!initSecmod()) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; Provider p = getSunPKCS11(configName); diff --git a/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java b/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java index 7b22a4abfc6c..57309749e93a 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java +++ b/test/jdk/sun/security/pkcs11/Secmod/TestNssDbSqlite.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. and/or its affiliates. + * Copyright (c) 2017, 2025, Red Hat, Inc. and/or its affiliates. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -46,6 +46,7 @@ import java.security.Provider; import java.security.Signature; +import jtreg.SkippedException; import sun.security.rsa.SunRsaSign; import sun.security.jca.ProviderList; import sun.security.jca.Providers; @@ -66,9 +67,7 @@ public final class TestNssDbSqlite extends SecmodTest { public static void main(String[] args) throws Exception { - if (!initialize()) { - return; - } + initializeProvider(); if (enableDebug) { System.out.println("SunPKCS11 provider: " + @@ -110,16 +109,9 @@ private static void testRetrieveKeysFromKeystore() throws Exception { } } - private static boolean initialize() throws Exception { - return initializeProvider(); - } - - private static boolean initializeProvider() throws Exception { + private static void initializeProvider() throws Exception { useSqlite(true); - if (!initSecmod()) { - System.out.println("Cannot init security module database, skipping"); - return false; - } + initSecmod(); sunPKCS11NSSProvider = getSunPKCS11(BASE + SEP + "nss-sqlite.cfg"); sunJCEProvider = new com.sun.crypto.provider.SunJCE(); @@ -135,7 +127,5 @@ private static boolean initializeProvider() throws Exception { gen.generate(2048); privateKey = gen.getPrivateKey(); certificate = gen.getSelfCertificate(new X500Name("CN=Me"), 365); - - return true; } } diff --git a/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java b/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java index 81863f028f9b..5b1d69ca90fa 100644 --- a/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java +++ b/test/jdk/sun/security/pkcs11/Secmod/TrustAnchors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,9 +44,7 @@ public class TrustAnchors extends SecmodTest { public static void main(String[] args) throws Exception { - if (initSecmod() == false) { - return; - } + initSecmod(); // our secmod.db file says nssckbi.*so*, so NSS does not find the // *DLL* on Windows nor the *DYLIB* on Mac OSX. diff --git a/test/jdk/sun/security/pkcs11/SecmodTest.java b/test/jdk/sun/security/pkcs11/SecmodTest.java index 8201548bf9da..1979066e26ad 100644 --- a/test/jdk/sun/security/pkcs11/SecmodTest.java +++ b/test/jdk/sun/security/pkcs11/SecmodTest.java @@ -42,7 +42,7 @@ static void useSqlite(boolean b) { useSqlite = b; } - static boolean initSecmod() throws Exception { + static void initSecmod() throws Exception { useNSS(); LIBPATH = getNSSLibDir(); // load all the libraries except libnss3 into memory @@ -60,7 +60,7 @@ static boolean initSecmod() throws Exception { System.setProperty("pkcs11test.nss.db", DBDIR); } File dbdirFile = new File(DBDIR); - if (dbdirFile.exists() == false) { + if (!dbdirFile.exists()) { dbdirFile.mkdir(); } @@ -73,7 +73,6 @@ static boolean initSecmod() throws Exception { copyFile("key3.db", BASE, DBDIR); copyFile("cert8.db", BASE, DBDIR); } - return true; } private static void copyFile(String name, String srcDir, String dstDir) throws IOException { diff --git a/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java b/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java index d2515fa0f5a2..0ab17a31c5b0 100644 --- a/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java +++ b/test/jdk/sun/security/pkcs11/Signature/TestDSAKeyLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,13 +48,15 @@ public static void main(String[] args) throws Exception { @Override protected boolean skipTest(Provider provider) { - double version = getNSSVersion(); - String[] versionStrs = Double.toString(version).split("\\."); - int major = Integer.parseInt(versionStrs[0]); - int minor = Integer.parseInt(versionStrs[1]); - if (isNSS(provider) && (version == 0.0 || (major >= 3 && minor >= 14))) { - System.out.println("Skip testing NSS " + version); - return true; + if (isNSS(provider)) { + Version version = getNSSVersion(); + if (version == null) { + return true; + } + if (version.major() >= 3 && version.minor() >= 14){ + System.out.println("Skip testing NSS " + version); + return true; + } } return false; diff --git a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java index e0700a45553a..13d857b0aedf 100644 --- a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java +++ b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java @@ -56,6 +56,7 @@ import java.util.Map; import javax.security.auth.x500.X500Principal; import jdk.test.lib.security.Providers; +import jtreg.SkippedException; public class ReadCertificates extends PKCS11Test { @@ -79,8 +80,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("Signature", "SHA1withECDSA") == null) { - System.out.println("Provider does not support ECDSA, skipping..."); - return; + throw new SkippedException("Provider does not support ECDSA"); } /* diff --git a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java index 7acd4c2dc691..46b665526b9f 100644 --- a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java +++ b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java @@ -55,6 +55,7 @@ import java.util.Map; import java.util.Random; import jdk.test.lib.security.Providers; +import jtreg.SkippedException; public class ReadPKCS12 extends PKCS11Test { @@ -67,8 +68,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("Signature", "SHA1withECDSA") == null) { - System.out.println("Provider does not support ECDSA, skipping..."); - return; + throw new SkippedException("Provider does not support ECDSA"); } /* diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDH.java b/test/jdk/sun/security/pkcs11/ec/TestECDH.java index d2a45f3842db..cce51efbea25 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDH.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDH.java @@ -112,6 +112,7 @@ protected boolean skipTest(Provider p) { * PKCS11Test.main will remove this provider if needed */ Providers.setAt(p, 1); + System.out.println("Testing provider " + p.getName()); if (false) { KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p); diff --git a/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java b/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java index 60066f118af0..eb65be21a51d 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java +++ b/test/jdk/sun/security/pkcs11/ec/TestKeyFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ * @run main/othervm -Djava.security.manager=allow TestKeyFactory sm */ +import jtreg.SkippedException; + import java.security.Key; import java.security.KeyFactory; import java.security.KeyPair; @@ -127,8 +129,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("KeyFactory", "EC") == null) { - System.out.println("Provider does not support EC, skipping"); - return; + throw new SkippedException("Provider does not support EC, skipping"); } int[] keyLengths = {256, 521}; KeyFactory kf = KeyFactory.getInstance("EC", p); diff --git a/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java b/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java index 9a44d8ff0360..301d374646ca 100644 --- a/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java +++ b/test/jdk/sun/security/pkcs11/rsa/KeyWrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,8 @@ * @run main/othervm -Djava.security.manager=allow KeyWrap sm */ +import jtreg.SkippedException; + import java.security.GeneralSecurityException; import java.security.InvalidKeyException; import java.security.Key; @@ -55,8 +57,7 @@ public void main(Provider p) throws Exception { try { Cipher.getInstance("RSA/ECB/PKCS1Padding", p); } catch (GeneralSecurityException e) { - System.out.println("Not supported by provider, skipping"); - return; + throw new SkippedException("Not supported by provider, skipping"); } KeyPair kp; try { @@ -75,8 +76,7 @@ public void main(Provider p) throws Exception { kp = new KeyPair(pub, priv); } catch (NoSuchAlgorithmException | InvalidKeyException ee) { ee.printStackTrace(); - System.out.println("Provider does not support RSA, skipping"); - return; + throw new SkippedException("Provider does not support RSA, skipping"); } } System.out.println(kp); diff --git a/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java b/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java index e57ba07741c9..d6354e81e779 100644 --- a/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java +++ b/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java @@ -42,6 +42,7 @@ import java.security.Provider; import java.security.Security; import jdk.test.lib.security.Providers; +import jtreg.SkippedException; public class ClientJSSEServerJSSE extends PKCS11Test { @@ -60,8 +61,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider p) throws Exception { if (p.getService("KeyFactory", "EC") == null) { - System.out.println("Provider does not support EC, skipping"); - return; + throw new SkippedException("Provider does not support EC, skipping"); } Providers.setAt(p, 1); CipherTest.main(new JSSEFactory(), cmdArgs); diff --git a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java index 2083dadc5b2e..ac4132ecb2f1 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java +++ b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,6 @@ import java.io.BufferedReader; import java.nio.file.Files; import java.nio.file.Paths; -import java.security.InvalidAlgorithmParameterException; import java.security.Provider; import java.security.ProviderException; import java.util.Arrays; @@ -46,6 +45,7 @@ import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; +import jtreg.SkippedException; import sun.security.internal.spec.TlsKeyMaterialParameterSpec; import sun.security.internal.spec.TlsKeyMaterialSpec; @@ -61,8 +61,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider provider) throws Exception { if (provider.getService("KeyGenerator", "SunTlsKeyMaterial") == null) { - System.out.println("Provider does not support algorithm, skipping"); - return; + throw new SkippedException("Provider does not support algorithm, skipping"); } try (BufferedReader reader = Files.newBufferedReader( diff --git a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java index 51471fca65ae..b784a3127c62 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java +++ b/test/jdk/sun/security/pkcs11/tls/TestKeyMaterialChaCha20.java @@ -35,6 +35,8 @@ import javax.crypto.SecretKey; import java.security.Provider; import java.security.NoSuchAlgorithmException; + +import jtreg.SkippedException; import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; import sun.security.internal.spec.TlsMasterSecretParameterSpec; import sun.security.internal.spec.TlsKeyMaterialParameterSpec; @@ -52,20 +54,17 @@ public void main(Provider provider) throws Exception { try { kg1 = KeyGenerator.getInstance("SunTlsRsaPremasterSecret", provider); } catch (Exception e) { - System.out.println("Skipping, SunTlsRsaPremasterSecret KeyGenerator not supported"); - return; + throw new SkippedException("Skipping, SunTlsRsaPremasterSecret KeyGenerator not supported"); } try { kg2 = KeyGenerator.getInstance("SunTls12MasterSecret", provider); } catch (Exception e) { - System.out.println("Skipping, SunTls12MasterSecret KeyGenerator not supported"); - return; + throw new SkippedException("Skipping, SunTls12MasterSecret KeyGenerator not supported"); } try { kg3 = KeyGenerator.getInstance("SunTls12KeyMaterial", provider); } catch (Exception e) { - System.out.println("Skipping, SunTls12KeyMaterial KeyGenerator not supported"); - return; + throw new SkippedException("Skipping, SunTls12KeyMaterial KeyGenerator not supported"); } kg1.init(new TlsRsaPremasterSecretParameterSpec(0x0303, 0x0303)); diff --git a/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java b/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java index 816e76697ced..d47fee98284a 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java +++ b/test/jdk/sun/security/pkcs11/tls/TestMasterSecret.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,8 @@ import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; + +import jtreg.SkippedException; import sun.security.internal.interfaces.TlsMasterSecret; import sun.security.internal.spec.TlsMasterSecretParameterSpec; @@ -57,8 +59,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider provider) throws Exception { if (provider.getService("KeyGenerator", "SunTlsMasterSecret") == null) { - System.out.println("Not supported by provider, skipping"); - return; + throw new SkippedException("Not supported by provider, skipping"); } try (BufferedReader reader = Files.newBufferedReader( diff --git a/test/jdk/sun/security/pkcs11/tls/TestPRF.java b/test/jdk/sun/security/pkcs11/tls/TestPRF.java index d99c21d0e568..9682dc700351 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestPRF.java +++ b/test/jdk/sun/security/pkcs11/tls/TestPRF.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,8 @@ import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; + +import jtreg.SkippedException; import sun.security.internal.spec.TlsPrfParameterSpec; public class TestPRF extends PKCS11Test { @@ -54,8 +56,7 @@ public static void main(String[] args) throws Exception { @Override public void main(Provider provider) throws Exception { if (provider.getService("KeyGenerator", "SunTlsPrf") == null) { - System.out.println("Provider does not support algorithm, skipping"); - return; + throw new SkippedException("Provider does not support algorithm, skipping"); } try (BufferedReader reader = Files.newBufferedReader( diff --git a/test/jdk/sun/security/pkcs11/tls/TestPremaster.java b/test/jdk/sun/security/pkcs11/tls/TestPremaster.java index ebae28c996c7..173ffe69b563 100644 --- a/test/jdk/sun/security/pkcs11/tls/TestPremaster.java +++ b/test/jdk/sun/security/pkcs11/tls/TestPremaster.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,8 @@ import java.security.InvalidAlgorithmParameterException; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; + +import jtreg.SkippedException; import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; public class TestPremaster extends PKCS11Test { @@ -49,8 +51,7 @@ public static void main(String[] args) throws Exception { public void main(Provider provider) throws Exception { if (provider.getService( "KeyGenerator", "SunTlsRsaPremasterSecret") == null) { - System.out.println("Not supported by provider, skipping"); - return; + throw new SkippedException("Not supported by provider, skipping"); } KeyGenerator kg; kg = KeyGenerator.getInstance("SunTlsRsaPremasterSecret", provider); @@ -88,8 +89,7 @@ private static void test(KeyGenerator kg, } catch (InvalidAlgorithmParameterException iape) { // S12 removed support for SSL v3.0 if (clientVersion == 0x300 || serverVersion == 0x300) { - System.out.println("Skip testing SSLv3 due to no support"); - return; + throw new SkippedException("Skip testing SSLv3 due to no support"); } // unexpected, pass it up throw iape; diff --git a/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java b/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java index a91bbac46519..a07d2d49d27e 100644 --- a/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java +++ b/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java @@ -65,6 +65,7 @@ import javax.net.ssl.TrustManagerFactory; import jdk.test.lib.security.SecurityUtils; +import jtreg.SkippedException; import sun.security.internal.spec.TlsMasterSecretParameterSpec; import sun.security.internal.spec.TlsPrfParameterSpec; import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; @@ -88,12 +89,11 @@ public static void main(String[] args) throws Exception { try { initialize(); } catch (Exception e) { - System.out.println("Test skipped: failure during" + - " initialization"); if (enableDebug) { System.out.println(e); } - return; + throw new SkippedException("Test skipped: failure during" + + " initialization"); } if (shouldRun()) { @@ -105,8 +105,8 @@ public static void main(String[] args) throws Exception { System.out.println("Test PASS - OK"); } else { - System.out.println("Test skipped: TLS 1.2 mechanisms" + - " not supported by current SunPKCS11 back-end"); + throw new SkippedException("Test skipped: TLS 1.2 mechanisms" + + " not supported by current SunPKCS11 back-end"); } } @@ -454,9 +454,7 @@ private static void initialize() throws Exception { disabledAlgorithms += "RSASSA-PSS"; Security.setProperty("jdk.tls.disabledAlgorithms", disabledAlgorithms); - if (initSecmod() == false) { - return; - } + initSecmod(); String configName = BASE + SEP + "nss.cfg"; sunPKCS11NSSProvider = getSunPKCS11(configName); System.out.println("SunPKCS11 provider: " + sunPKCS11NSSProvider); diff --git a/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java b/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java index f7e677bbbd05..68761f10c599 100644 --- a/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ public class ReuseAddr extends SSLSocketTemplate { - private static final int MAX_ATTEMPTS = 3; + private static final int MAX_ATTEMPTS = 15; @Override protected void doServerSide() throws Exception { @@ -65,6 +65,7 @@ public static void main(String[] args) throws Exception { System.err.println(msg); throw new AssertionError("Failed to reuse address: " + msg, x); } else { + Thread.sleep(100*i); System.out.println("Retrying..."); } } diff --git a/test/jdk/sun/security/ssl/X509KeyManager/PreferredKey.java b/test/jdk/sun/security/ssl/X509KeyManager/PreferredKey.java index 5086463b5897..7eb8d0710807 100644 --- a/test/jdk/sun/security/ssl/X509KeyManager/PreferredKey.java +++ b/test/jdk/sun/security/ssl/X509KeyManager/PreferredKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,89 +21,93 @@ * questions. */ -// -// Security properties, once set, cannot revert to unset. To avoid -// conflicts with tests running in the same VM isolate this test by -// running it in otherVM mode. -// - /* * @test * @bug 6302644 * @summary X509KeyManager implementation for NewSunX509 doesn't return most * preferable key - * @run main/othervm PreferredKey + * @modules java.base/sun.security.x509 + * java.base/sun.security.util + * @library /test/lib */ -import java.io.*; -import java.net.*; -import java.security.*; -import javax.net.ssl.*; +import jdk.test.lib.Asserts; +import jdk.test.lib.security.CertificateBuilder; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.X509KeyManager; +import java.io.IOException; +import java.math.BigInteger; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; public class PreferredKey { - /* - * ============================================================= - * Set the various variables needed for the tests, then - * specify what tests to run on each side. - */ + public static void main(String[] args) throws Exception { + X509KeyManager km = getKeyManager(); + + testPreferredKey(km, "RSA", new String[] {"RSA", "DSA"}); + testPreferredKey(km, "DSA", new String[] {"DSA", "RSA"}); + } - /* - * Where do we find the keystores? - */ - static String pathToStores = "../../../../javax/net/ssl/etc"; - static String keyStoreFile = "keystore"; - static String passwd = "passphrase"; + private static void testPreferredKey(X509KeyManager km, + String keyType, + String[] multiKeyTypes) { + String[] aliases = km.getClientAliases(keyType, null); + String alias = km.chooseClientAlias(multiKeyTypes, null, null); + Asserts.assertTrue(aliases != null && alias != null, + "Should return preferred alias"); - public static void main(String[] args) throws Exception { - // MD5 is used in this test case, don't disable MD5 algorithm. - Security.setProperty("jdk.certpath.disabledAlgorithms", - "MD2, RSA keySize < 1024"); - Security.setProperty("jdk.tls.disabledAlgorithms", - "SSLv3, RC4, DH keySize < 768"); + String algorithm = km.getPrivateKey(alias).getAlgorithm(); + Asserts.assertTrue(algorithm.equals(keyType) && algorithm.equals( + km.getPrivateKey(aliases[0]).getAlgorithm()), + "Failed to get the preferable key aliases"); + } - KeyStore ks; - KeyManagerFactory kmf; - X509KeyManager km; + private static X509KeyManager getKeyManager() throws Exception { + char[] passphrase = "passphrase".toCharArray(); - String keyFilename = - System.getProperty("test.src", ".") + "/" + pathToStores + - "/" + keyStoreFile; - char [] password = passwd.toCharArray(); + KeyPair rsaKey = KeyPairGenerator.getInstance("RSA").generateKeyPair(); + KeyPair dsaKey = KeyPairGenerator.getInstance("DSA").generateKeyPair(); - ks = KeyStore.getInstance(new File(keyFilename), password); - kmf = KeyManagerFactory.getInstance("NewSunX509"); - kmf.init(ks, password); - km = (X509KeyManager) kmf.getKeyManagers()[0]; + // create a key store + KeyStore ks = KeyStore.getInstance("PKCS12"); + ks.load(null, passphrase); - /* - * There should be both an rsa and a dsa entry in the - * keystore, otherwise the test will no work. - */ - String[] aliases = km.getClientAliases("RSA", null); - String alias = km.chooseClientAlias(new String[] {"RSA", "DSA"}, - null, null); + ks.setKeyEntry("dummyrsa", + rsaKey.getPrivate(), + passphrase, + new Certificate[]{createSelfSignedCert(rsaKey, + "SHA256withRSA")}); + ks.setKeyEntry("dummydsa", + dsaKey.getPrivate(), + passphrase, + new Certificate[]{createSelfSignedCert(dsaKey, + "SHA256withDSA")}); - // there're should both be null or nonnull - if (aliases != null || alias != null) { - String algorithm = km.getPrivateKey(alias).getAlgorithm(); - if (!algorithm.equals("RSA") || !algorithm.equals( - km.getPrivateKey(aliases[0]).getAlgorithm())) { - throw new Exception("Failed to get the preferable key aliases"); - } - } + KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509"); + kmf.init(ks, passphrase); - aliases = km.getClientAliases("DSA", null); - alias = km.chooseClientAlias(new String[] {"DSA", "RSA"}, - null, null); + return (X509KeyManager) kmf.getKeyManagers()[0]; + } - // there're should both be null or nonnull - if (aliases != null || alias != null) { - String algorithm = km.getPrivateKey(alias).getAlgorithm(); - if (!algorithm.equals("DSA") || !algorithm.equals( - km.getPrivateKey(aliases[0]).getAlgorithm())) { - throw new Exception("Failed to get the preferable key aliases"); - } - } + private static X509Certificate createSelfSignedCert(KeyPair caKeys, + String keyAlg) + throws CertificateException, IOException, NoSuchAlgorithmException { + return (new CertificateBuilder() + .setSubjectName("CN=dummy.example.com, OU=Dummy, " + + "O=Dummy, L=Cupertino, ST=CA, C=US") + .setPublicKey(caKeys.getPublic()) + .setOneHourValidity() + .setSerialNumber(BigInteger.valueOf( + new SecureRandom().nextLong(1000000) + 1)) + .addSubjectKeyIdExt(caKeys.getPublic()) + ).build(null, caKeys.getPrivate(), keyAlg); } } diff --git a/test/jdk/sun/security/ssl/X509KeyManager/SelectOneKeyOutOfMany.java b/test/jdk/sun/security/ssl/X509KeyManager/SelectOneKeyOutOfMany.java index f05c32b30795..1d1469f81175 100644 --- a/test/jdk/sun/security/ssl/X509KeyManager/SelectOneKeyOutOfMany.java +++ b/test/jdk/sun/security/ssl/X509KeyManager/SelectOneKeyOutOfMany.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,178 +24,147 @@ /* * @test * @bug 4387949 4302197 - * @summary Need to add Sockets and key arrays to the - * X509KeyManager.choose*Alias() methods & There's no mechanism - * to select one key out of many in a keystore - * - * chooseServerAlias method is reverted back to accept a single - * keytype as a parameter, please see RFE: 4501014 - * The part of the test on the server-side is changed to test - * passing in a single keytype parameter to chooseServerAlias method. - * - * @author Brad Wetmore + * @summary Verify X509KeyManager selects the correct RSA or DSA key + * @modules java.base/sun.security.x509 + * java.base/sun.security.util + * @library /test/lib */ -import java.io.*; -import java.net.*; -import java.security.*; -import javax.net.ssl.*; +import jdk.test.lib.Asserts; +import jdk.test.lib.security.CertificateBuilder; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.X509KeyManager; +import java.io.IOException; +import java.math.BigInteger; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Arrays; public class SelectOneKeyOutOfMany { + private static final String NOTHING = "nothing"; + private static final String RSA = "RSA"; + private static final String DSA = "DSA"; + private static final String RSA_ALIAS = "dummyrsa"; + private static final String DSA_ALIAS = "dummydsa"; - /* - * ============================================================= - * Set the various variables needed for the tests, then - * specify what tests to run on each side. - */ + public static void main(String[] args) throws Exception { + X509KeyManager km = getKeyManager(); - /* - * Where do we find the keystores? - */ - static String pathToStores = "../../../../javax/net/ssl/etc"; - static String keyStoreFile = "keystore"; - static String passwd = "passphrase"; + // String[] getClientAliases(String keyType, Principal[] issuers) + Asserts.assertNull(km.getClientAliases(NOTHING, null), + "getClientAliases shouldn't return alias for unknown type"); - public static void main(String[] args) throws Exception { - KeyStore ks; - KeyManagerFactory kmf; - X509KeyManager km; - - char[] passphrase = passwd.toCharArray(); - - String keyFilename = - System.getProperty("test.src", ".") + "/" + pathToStores + - "/" + keyStoreFile; - /* - * Setup the tests. - */ - kmf = KeyManagerFactory.getInstance("SunX509"); - ks = KeyStore.getInstance(new File(keyFilename), passphrase); + Asserts.assertTrue(Arrays.stream(km.getClientAliases(RSA, + null)).toList().contains(RSA_ALIAS), + "getClientAliases should return RSA alias: " + + Arrays.toString(km.getClientAliases(RSA, null))); + + Asserts.assertTrue(Arrays.stream(km.getClientAliases(DSA, + null)).toList().contains(DSA_ALIAS), + "getClientAliases should return DSA alias: " + + Arrays.toString(km.getClientAliases(DSA, null))); + + + // String[] getServerAliases(String keyType, Principal[] issuers) + Asserts.assertNull(km.getServerAliases(NOTHING, null), + "getServerAliases shouldn't return alias for unknown type"); + + Asserts.assertTrue(Arrays.stream(km.getServerAliases(RSA, + null)).toList().contains(RSA_ALIAS), + "getServerAliases should return RSA alias: " + + Arrays.toString(km.getServerAliases(RSA, null))); + + Asserts.assertTrue(Arrays.stream(km.getServerAliases(DSA, + null)).toList().contains(DSA_ALIAS), + "getServerAliases should return DSA alias: " + + Arrays.toString(km.getServerAliases(DSA, null))); + + + // String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) + Asserts.assertNull(km.chooseClientAlias(new String[]{NOTHING}, + null, + null), + "chooseClientAlias shouldn't return alias for unknown type"); + + Asserts.assertEQ( + km.chooseClientAlias(new String[]{RSA}, null, null), + RSA_ALIAS, + "chooseClientAlias should return RSA alias"); + + Asserts.assertEQ( + km.chooseClientAlias(new String[]{DSA}, null, null), + DSA_ALIAS, + "chooseClientAlias should return DSA alias"); + + Asserts.assertEQ( + km.chooseClientAlias(new String[]{RSA, DSA}, null, null), + RSA_ALIAS, + "chooseClientAlias should return RSA alias"); + + Asserts.assertEQ( + km.chooseClientAlias(new String[]{DSA, RSA}, null, null), + DSA_ALIAS, + "chooseClientAlias should return DSA alias"); + + + // String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) + Asserts.assertNull(km.chooseServerAlias(NOTHING, null, null), + "chooseServerAlias shouldn't return alias for unknown type"); + + Asserts.assertEQ(km.chooseServerAlias(RSA, null, null), + RSA_ALIAS, + "chooseServerAlias should return RSA alias"); + + Asserts.assertEQ(km.chooseServerAlias(DSA, null, null), + DSA_ALIAS, + "chooseServerAlias should return DSA alias"); + } + + private static X509KeyManager getKeyManager() throws Exception { + char[] passphrase = "passphrase".toCharArray(); + + KeyPair rsaKey = KeyPairGenerator.getInstance(RSA).generateKeyPair(); + KeyPair dsaKey = KeyPairGenerator.getInstance(DSA).generateKeyPair(); + + // create a key store + KeyStore ks = KeyStore.getInstance("PKCS12"); + ks.load(null, passphrase); + + ks.setKeyEntry(RSA_ALIAS, + rsaKey.getPrivate(), + passphrase, + new Certificate[]{createSelfSignedCert(rsaKey, + "SHA256withRSA")}); + ks.setKeyEntry(DSA_ALIAS, + dsaKey.getPrivate(), + passphrase, + new Certificate[]{createSelfSignedCert(dsaKey, + "SHA256withDSA")}); + + KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, passphrase); - km = (X509KeyManager) kmf.getKeyManagers()[0]; - - /* - * There should be one of each key type here. - */ - String [] nothing = new String [] { "nothing" }; - String [] rsa = new String [] { "RSA" }; - String [] dsa = new String [] { "DSA" }; - String [] rsaDsa = new String [] { "RSA", "DSA" }; - String [] dsaRsa = new String [] { "DSA", "RSA" }; - - String resultsRsaDsa, resultsDsaRsa; - String resultsRsa, resultsDsa; - String resultsNone; - - String [] resultArrayRSA; - String [] resultArrayDSA; - - /* - * Check get*Aliases for null returns - */ - if (km.getClientAliases("nothing", null) != null) - throw new Exception("km.getClientAliases(nothing) != null"); - System.out.println("km.getClientAlias(nothing) returning nulls"); - - if (km.getServerAliases("nothing", null) != null) - throw new Exception("km.getServerAliases(nothing) != null"); - System.out.println("km.getServerAlias(nothing) returning nulls"); - System.out.println("====="); - - System.out.println("Dumping Certs..."); - if ((resultArrayRSA = km.getServerAliases("RSA", null)) == null) - throw new Exception("km.getServerAliases(RSA) == null"); - for (int i = 0; i < resultArrayRSA.length; i++) { - System.out.println(" resultArrayRSA#" + i + ": " + - resultArrayRSA[i]); - } - - if ((resultArrayDSA = km.getServerAliases("DSA", null)) == null) - throw new Exception("km.getServerAliases(DSA) == null"); - for (int i = 0; i < resultArrayDSA.length; i++) { - System.out.println(" resultArrayDSA#" + i + ": " + - resultArrayDSA[i]); - } - System.out.println("====="); - - /* - * Check chooseClientAliases for null returns - */ - resultsNone = km.chooseClientAlias(nothing, null, null); - if (resultsNone != null) { - throw new Exception("km.chooseClientAlias(nothing) != null"); - } - System.out.println("km.ChooseClientAlias(nothing) passed"); - - /* - * Check chooseClientAlias for RSA keys. - */ - resultsRsa = km.chooseClientAlias(rsa, null, null); - if (resultsRsa == null) { - throw new Exception( - "km.chooseClientAlias(rsa, null, null) != null"); - } - System.out.println("km.chooseClientAlias(rsa) passed"); - - /* - * Check chooseClientAlias for DSA keys. - */ - resultsDsa = km.chooseClientAlias(dsa, null, null); - if (resultsDsa == null) { - throw new Exception( - "km.chooseClientAlias(dsa, null, null) != null"); - } - System.out.println("km.chooseClientAlias(dsa) passed"); - - /* - * There should be both an rsa and a dsa entry in the - * keystore. - * - * Check chooseClientAlias for RSA/DSA keys and be sure - * the ordering is correct. - */ - resultsRsaDsa = km.chooseClientAlias(rsaDsa, null, null); - if ((resultsRsaDsa == null) || (resultsRsaDsa != resultsRsa)) { - throw new Exception("km.chooseClientAlias(rsaDsa) failed"); - } - System.out.println("km.chooseClientAlias(rsaDsa) passed"); - - resultsDsaRsa = km.chooseClientAlias(dsaRsa, null, null); - if ((resultsDsaRsa == null) || (resultsDsaRsa != resultsDsa)) { - throw new Exception("km.chooseClientAlias(DsaRsa) failed"); - } - System.out.println("km.chooseClientAlias(DsaRsa) passed"); - - System.out.println("====="); - - /* - * Check chooseServerAliases for null returns - */ - resultsNone = km.chooseServerAlias("nothing", null, null); - if (resultsNone != null) { - throw new Exception("km.chooseServerAlias(\"nothing\") != null"); - } - System.out.println("km.ChooseServerAlias(\"nothing\") passed"); - - /* - * Check chooseServerAlias for RSA keys. - */ - resultsRsa = km.chooseServerAlias("RSA", null, null); - if (resultsRsa == null) { - throw new Exception( - "km.chooseServerAlias(\"RSA\", null, null) != null"); - } - System.out.println("km.chooseServerAlias(\"RSA\") passed"); - - /* - * Check chooseServerAlias for DSA keys. - */ - resultsDsa = km.chooseServerAlias("DSA", null, null); - if (resultsDsa == null) { - throw new Exception( - "km.chooseServerAlias(\"DSA\", null, null) != null"); - } - System.out.println("km.chooseServerAlias(\"DSA\") passed"); + return (X509KeyManager) kmf.getKeyManagers()[0]; + } + + private static X509Certificate createSelfSignedCert(KeyPair caKeys, + String keyAlg) + throws CertificateException, IOException, NoSuchAlgorithmException { + return (new CertificateBuilder() + .setSubjectName("CN=dummy.example.com, OU=Dummy, " + + "O=Dummy, L=Cupertino, ST=CA, C=US") + .setPublicKey(caKeys.getPublic()) + .setOneHourValidity() + .setSerialNumber(BigInteger.valueOf( + new SecureRandom().nextLong(1000000) + 1)) + .addSubjectKeyIdExt(caKeys.getPublic()) + ).build(null, caKeys.getPrivate(), keyAlg); } } diff --git a/test/jdk/sun/security/tools/jarsigner/DefaultOptions.java b/test/jdk/sun/security/tools/jarsigner/DefaultOptions.java index 72756de6f8bd..fe8adfb89624 100644 --- a/test/jdk/sun/security/tools/jarsigner/DefaultOptions.java +++ b/test/jdk/sun/security/tools/jarsigner/DefaultOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,10 @@ public static void main(String[] args) throws Throwable { keytool("-genkeypair -dname CN=CA -alias ca -keyalg rsa -ext bc:c") .shouldHaveExitValue(0); keytool("-alias a -certreq -file a.req"); - keytool("-alias ca -gencert -infile a.req -outfile a.cert"); + + // The start date is set to -1M to prevent the certificate not yet + // valid during fast enough execution. + keytool("-alias ca -gencert -infile a.req -outfile a.cert -startdate -1M"); keytool("-alias a -import -file a.cert").shouldHaveExitValue(0); Files.write(Path.of("js.conf"), List.of( diff --git a/test/jdk/sun/security/tools/keytool/i18n.java b/test/jdk/sun/security/tools/keytool/i18n.java index 4ba8c7830b72..5e049f741114 100644 --- a/test/jdk/sun/security/tools/keytool/i18n.java +++ b/test/jdk/sun/security/tools/keytool/i18n.java @@ -28,7 +28,7 @@ * @author charlie lai * @modules java.base/sun.security.tools.keytool * @library /test/lib - * @run main/manual/othervm -Duser.language=en i18n + * @run main/manual/othervm -Duser.language=en -Duser.country=USA i18n */ /* @@ -38,7 +38,7 @@ * @author charlie lai * @modules java.base/sun.security.tools.keytool * @library /test/lib - * @run main/manual/othervm -Duser.language=de i18n + * @run main/manual/othervm -Duser.language=de -Duser.country=DE i18n */ /* @@ -48,7 +48,7 @@ * @author charlie lai * @modules java.base/sun.security.tools.keytool * @library /test/lib - * @run main/manual/othervm -Duser.language=ja i18n + * @run main/manual/othervm -Duser.language=ja -Duser.country=JP i18n */ /* @@ -63,11 +63,21 @@ import jdk.test.lib.UIBuilder; -import javax.swing.*; +import javax.swing.JDialog; +import javax.swing.SwingUtilities; +import javax.swing.JTextArea; +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JFrame; +import java.awt.FlowLayout; +import java.awt.BorderLayout; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.Locale; +import static javax.swing.BorderFactory.createEmptyBorder; + public class i18n { private static final String[][] TABLE = new String[][]{ {"-help", "All the output in this test should be in ${LANG}. " @@ -238,11 +248,12 @@ public class i18n { "Output in ${LANG}. Check keytool error: java.lang" + ".IllegalArgumentException: if -protected is " + "specified, then -storepass, -keypass, and -new " - + "must not be specified."}, + + "must not be specified."} }; private static String TEST_SRC = System.getProperty("test.src"); private static int TIMEOUT_MS = 120000; private volatile boolean failed = false; + private volatile String failureReason = ""; private volatile boolean aborted = false; private Thread currentThread = null; @@ -334,6 +345,7 @@ public boolean validate(String command, String instruction, String message) { if (failed) { System.out.println(command + ": TEST FAILED"); + System.out.println("REASON: " + failureReason); System.out.println(message); } else { System.out.println(command + ": TEST PASSED"); @@ -352,6 +364,7 @@ public void pass() { public void fail() { failed = true; + failureReason = requestFailDescription(); currentThread.interrupt(); } @@ -359,4 +372,33 @@ public void abort() { aborted = true; currentThread.interrupt(); } + + /** + * Opens a prompt to enter a failure reason to be filled by the tester + */ + public static String requestFailDescription() { + + final JDialog dialogWindow = new JDialog(new JFrame(), "Failure Description", true); + final JTextArea reasonTextArea = new JTextArea(5, 20); + + final JButton okButton = new JButton("OK"); + okButton.addActionListener(e -> dialogWindow.setVisible(false)); + + final JPanel okayBtnPanel = new JPanel( + new FlowLayout(FlowLayout.CENTER, 4, 0)); + okayBtnPanel.setBorder(createEmptyBorder(4, 0, 0, 0)); + okayBtnPanel.add(okButton); + + final JPanel mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(new JScrollPane(reasonTextArea), BorderLayout.CENTER); + mainPanel.add(okayBtnPanel, BorderLayout.SOUTH); + + dialogWindow.add(mainPanel); + dialogWindow.pack(); + dialogWindow.setVisible(true); + + dialogWindow.dispose(); + + return reasonTextArea.getText(); + } } diff --git a/test/jdk/sun/security/util/RegisteredDomain/ParseNames.java b/test/jdk/sun/security/util/RegisteredDomain/ParseNames.java index 904f672ba401..f3811511e530 100644 --- a/test/jdk/sun/security/util/RegisteredDomain/ParseNames.java +++ b/test/jdk/sun/security/util/RegisteredDomain/ParseNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8228969 8244087 8255266 8302182 8331864 + * @bug 8228969 8244087 8255266 8302182 8331864 8357062 * @modules java.base/sun.security.util * @summary unit test for RegisteredDomain */ diff --git a/test/jdk/sun/security/util/RegisteredDomain/tests.dat b/test/jdk/sun/security/util/RegisteredDomain/tests.dat index 7fe95c979ea8..7d395c62a742 100644 --- a/test/jdk/sun/security/util/RegisteredDomain/tests.dat +++ b/test/jdk/sun/security/util/RegisteredDomain/tests.dat @@ -72,9 +72,9 @@ w.foo.公司.cn 公司.cn foo.公司.cn www.foo.com com foo.com z.www.foo.com com foo.com com com null -ar.com ar.com null -site.ar.com ar.com site.ar.com -w.site.ar.com ar.com site.ar.com +us.com us.com null +site.us.com us.com site.us.com +w.site.us.com us.com site.us.com # fj (no longer *.fj) foo.gov.fj gov.fj foo.gov.fj @@ -109,6 +109,10 @@ p.w.foo.kawasaki.jp foo.kawasaki.jp w.foo.kawasaki.jp city.kawasaki.jp kawasaki.jp city.kawasaki.jp w.city.kawasaki.jp kawasaki.jp city.kawasaki.jp +# kr +ai.kr ai.kr null +foo.ai.kr ai.kr foo.ai.kr + # kw www.example.kw kw example.kw www.example.com.kw com.kw example.com.kw @@ -151,6 +155,7 @@ w.s.k12.oh.us k12.oh.us s.k12.oh.us s.k12.oh.us k12.oh.us s.k12.oh.us s.pvt.k12.ma.us pvt.k12.ma.us s.pvt.k12.ma.us w.s.pvt.k12.ma.us pvt.k12.ma.us s.pvt.k12.ma.us +kids.us us kids.us # vn site.com.vn com.vn site.com.vn diff --git a/test/jdk/sun/security/validator/CertReplace.java b/test/jdk/sun/security/validator/CertReplace.java index e858cc7657c1..42885b73e96e 100644 --- a/test/jdk/sun/security/validator/CertReplace.java +++ b/test/jdk/sun/security/validator/CertReplace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,29 +21,186 @@ * questions. */ -/* - * This test is called by certreplace.sh - */ - import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; import java.security.KeyStore; +import java.security.PrivateKey; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; -import java.util.Arrays; import java.util.ArrayList; import java.util.List; + +import jdk.test.lib.SecurityTools; +import jdk.test.lib.security.CertUtils; +import jdk.test.lib.security.KeyStoreUtils; import sun.security.validator.Validator; +/* + * @test id=certreplace + * @bug 6948803 + * @summary CertPath validation regression caused by SHA1 replacement root and MD2 disable feature + * @library /test/lib + * @modules java.base/sun.security.validator + * + * @run main CertReplace certreplace.jks certreplace.certs + */ + +/* + * @test id=samedn + * @bug 6958869 + * @summary Regression: PKIXValidator fails when multiple trust anchors have same dn + * @library /test/lib + * @modules java.base/sun.security.validator + * + * @run main CertReplace samedn.jks samedn1.certs + * @run main CertReplace samedn.jks samedn2.certs + */ + public class CertReplace { + private static final String SAMEDN_JKS = "samedn.jks"; + private static final String CERTREPLACE_JKS = "certreplace.jks"; + private static final String PASSWORD = "changeit"; + private static final char[] PASSWORD_CHAR_ARR = PASSWORD.toCharArray(); + + /** + * This method creates certs for the Cert Replace test + * + * @throws Exception + */ + private static void certReplace() throws Exception { + + final String ktBaseParameters = "-storepass " + PASSWORD + " " + + "-keypass " + PASSWORD + " " + + "-keystore " + CERTREPLACE_JKS + " " + + "-keyalg rsa "; + + final Path keystoreFilePath = Paths.get(CERTREPLACE_JKS); + Files.deleteIfExists(keystoreFilePath); + + // 1. Generate 3 aliases in a keystore: ca, int, user + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias ca -dname CN=CA -keyalg rsa -sigalg md2withrsa -ext bc"); + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias int -dname CN=Int -keyalg rsa"); + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias user -dname CN=User -keyalg rsa"); + + final KeyStore keyStore = KeyStoreUtils.loadKeyStore(CERTREPLACE_JKS, PASSWORD); + + // 2. Signing: ca -> int -> user + + SecurityTools.keytool(ktBaseParameters + + "-certreq -alias int -file int.req"); + SecurityTools.keytool(ktBaseParameters + + "-gencert -rfc -alias ca -ext bc -infile int.req " + + "-outfile int.cert"); + + //putting the certificate in the keystore + try (final FileInputStream certInputStream = new FileInputStream("int.cert")) { + final Certificate[] certs = new Certificate[]{ + CertUtils.getCertFromStream( + certInputStream + ) + }; + + final PrivateKey privateKey = (PrivateKey) keyStore.getKey("int", PASSWORD_CHAR_ARR); + keyStore.setKeyEntry("int", privateKey, PASSWORD_CHAR_ARR, certs); + keyStore.store(new FileOutputStream(CERTREPLACE_JKS), PASSWORD_CHAR_ARR); + } + + SecurityTools.keytool(ktBaseParameters + + "-certreq -alias user -file user.req"); + SecurityTools.keytool(ktBaseParameters + + "-gencert -rfc -alias int " + + "-infile user.req " + + "-outfile certreplace.certs"); // this will create certreplace.certs which is later appended + + // 3. Create the certchain file + final Path certPath = Paths.get("certreplace.certs"); + + Files.write(certPath, Files.readAllBytes(Path.of("int.cert")), StandardOpenOption.APPEND); + + final String outputCa = SecurityTools.keytool(ktBaseParameters + + "-export -rfc -alias ca").getOutput(); + Files.write(certPath, outputCa.getBytes(), StandardOpenOption.APPEND); + + // 4. Upgrade ca from MD2withRSA to SHA256withRSA, remove other aliases and make this keystore the cacerts file + keyStore.deleteEntry("int"); + keyStore.deleteEntry("user"); + keyStore.store(new FileOutputStream(CERTREPLACE_JKS), PASSWORD_CHAR_ARR); + + SecurityTools.keytool(ktBaseParameters + + "-selfcert -alias ca"); + } + + /** + * This method creates certs for the Same DN test + * + * @throws Exception + */ + private static void sameDn() throws Exception { + + final String ktBaseParameters = "-storepass " + PASSWORD + " " + + "-keypass " + PASSWORD + " " + + "-keystore " + SAMEDN_JKS + " " + + "-keyalg rsa "; + + final Path keystoreFilePath = Paths.get(SAMEDN_JKS); + Files.deleteIfExists(keystoreFilePath); + + // 1. Generate 3 aliases in a keystore: ca1, ca2, user. The CAs' startdate + // is set to one year ago so that they are expired now + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias ca1 -dname CN=CA -keyalg rsa " + + "-sigalg md5withrsa -ext bc -startdate -1y"); + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias ca2 -dname CN=CA -keyalg rsa " + + "-sigalg sha1withrsa -ext bc -startdate -1y"); + SecurityTools.keytool(ktBaseParameters + + "-genkeypair -alias user -dname CN=User -keyalg rsa"); + + // 2. Signing: ca -> user. The startdate is set to 1 minute in the past to ensure the certificate + // is valid at the time of validation and to prevent any issues with timing discrepancies + // Automatically saves the certs to the certs files + + SecurityTools.keytool(ktBaseParameters + + "-certreq -alias user -file user.req"); + SecurityTools.keytool(ktBaseParameters + + "-gencert -rfc -alias ca1 " + + "-startdate -1M -infile user.req -outfile samedn1.certs"); + SecurityTools.keytool(ktBaseParameters + + "-gencert -rfc -alias ca2 " + + "-startdate -1M -infile user.req -outfile samedn2.certs"); + + // 3. Remove user for cacerts + final KeyStore keyStore = KeyStoreUtils.loadKeyStore(SAMEDN_JKS, PASSWORD); + keyStore.deleteEntry("user"); + keyStore.store(new FileOutputStream(CERTREPLACE_JKS), PASSWORD_CHAR_ARR); + } + /** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { + if (args[0].equals(CERTREPLACE_JKS)) { + certReplace(); + } else if (args[0].equals(SAMEDN_JKS)) { + sameDn(); + } else { + throw new RuntimeException("Not recognised test " + args[0]); + } + KeyStore ks = KeyStore.getInstance("JKS"); - ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); + try (final FileInputStream certInputStream = new FileInputStream(args[0])) { + ks.load(certInputStream, PASSWORD_CHAR_ARR); + } Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); @@ -57,9 +214,10 @@ public static void main(String[] args) throws Exception { public static X509Certificate[] createPath(String chain) throws Exception { CertificateFactory cf = CertificateFactory.getInstance("X.509"); List list = new ArrayList(); - for (Certificate c: cf.generateCertificates( - new FileInputStream(chain))) { - list.add((X509Certificate)c); + try (final FileInputStream certInputStream = new FileInputStream(chain)) { + for (Certificate c : cf.generateCertificates(certInputStream)) { + list.add((X509Certificate) c); + } } return (X509Certificate[]) list.toArray(new X509Certificate[0]); } diff --git a/test/jdk/sun/security/validator/certreplace.sh b/test/jdk/sun/security/validator/certreplace.sh deleted file mode 100644 index 79c973280927..000000000000 --- a/test/jdk/sun/security/validator/certreplace.sh +++ /dev/null @@ -1,88 +0,0 @@ -# -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# @test -# @bug 6948803 -# @summary CertPath validation regression caused by SHA1 replacement root -# and MD2 disable feature -# @modules java.base/sun.security.validator -# - -if [ "${TESTSRC}" = "" ] ; then - TESTSRC="." -fi -if [ "${TESTJAVA}" = "" ] ; then - JAVAC_CMD=`which javac` - TESTJAVA=`dirname $JAVAC_CMD`/.. - COMPILEJAVA="${TESTJAVA}" -fi - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Windows_* ) - FS="\\" - ;; - * ) - FS="/" - ;; -esac - -KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit \ - -keypass changeit -keystore certreplace.jks -keyalg rsa" -JAVAC=$COMPILEJAVA${FS}bin${FS}javac -JAVA=$TESTJAVA${FS}bin${FS}java - -rm -rf certreplace.jks 2> /dev/null - -# 1. Generate 3 aliases in a keystore: ca, int, user - -$KT -genkeypair -alias ca -dname CN=CA -keyalg rsa -sigalg md2withrsa -ext bc -$KT -genkeypair -alias int -dname CN=Int -keyalg rsa -$KT -genkeypair -alias user -dname CN=User -keyalg rsa - -# 2. Signing: ca -> int -> user - -$KT -certreq -alias int | $KT -gencert -rfc -alias ca -ext bc \ - | $KT -import -alias int -$KT -certreq -alias user | $KT -gencert -rfc -alias int \ - | $KT -import -alias user - -# 3. Create the certchain file - -$KT -export -alias user -rfc > certreplace.certs -$KT -export -rfc -alias int >> certreplace.certs -$KT -export -rfc -alias ca >> certreplace.certs - -# 4. Upgrade ca from MD2withRSA to SHA256withRSA, remove other aliases and -# make this keystore the cacerts file - -$KT -selfcert -alias ca -$KT -delete -alias int -$KT -delete -alias user - -# 5. Build and run test - -EXTRAOPTS="--add-exports java.base/sun.security.validator=ALL-UNNAMED" -$JAVAC ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . ${TESTSRC}${FS}CertReplace.java -$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace certreplace.jks certreplace.certs diff --git a/test/jdk/sun/security/validator/samedn.sh b/test/jdk/sun/security/validator/samedn.sh deleted file mode 100644 index 912bbcd40c7c..000000000000 --- a/test/jdk/sun/security/validator/samedn.sh +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# @test -# @bug 6958869 -# @summary regression: PKIXValidator fails when multiple trust anchors -# have same dn -# @modules java.base/sun.security.validator -# - -if [ "${TESTSRC}" = "" ] ; then - TESTSRC="." -fi -if [ "${TESTJAVA}" = "" ] ; then - JAVAC_CMD=`which javac` - TESTJAVA=`dirname $JAVAC_CMD`/.. - COMPILEJAVA="${TESTJAVA}" -fi - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Windows_* ) - FS="\\" - ;; - * ) - FS="/" - ;; -esac - -KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit \ - -keypass changeit -keystore samedn.jks -keyalg rsa" -JAVAC=$COMPILEJAVA${FS}bin${FS}javac -JAVA=$TESTJAVA${FS}bin${FS}java - -rm -rf samedn.jks 2> /dev/null - -# 1. Generate 3 aliases in a keystore: ca1, ca2, user. The CAs' startdate -# is set to one year ago so that they are expired now - -$KT -genkeypair -alias ca1 -dname CN=CA -keyalg rsa -sigalg md5withrsa -ext bc -startdate -1y -$KT -genkeypair -alias ca2 -dname CN=CA -keyalg rsa -sigalg sha1withrsa -ext bc -startdate -1y -$KT -genkeypair -alias user -dname CN=User -keyalg rsa - -# 2. Signing: ca -> user. The startdate is set to 1 minute in the past to ensure the certificate -# is valid at the time of validation and to prevent any issues with timing discrepancies - -$KT -certreq -alias user | $KT -gencert -rfc -alias ca1 -startdate -1M > samedn1.certs -$KT -certreq -alias user | $KT -gencert -rfc -alias ca2 -startdate -1M > samedn2.certs - -# 3. Append the ca file - -$KT -export -rfc -alias ca1 >> samedn1.certs -$KT -export -rfc -alias ca2 >> samedn2.certs - -# 4. Remove user for cacerts - -$KT -delete -alias user - -# 5. Build and run test. Make sure the CA certs are ignored for validity check. -# Check both, one of them might be dropped out of map in old codes. - -EXTRAOPTS="--add-exports java.base/sun.security.validator=ALL-UNNAMED" -$JAVAC ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . ${TESTSRC}${FS}CertReplace.java -$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace samedn.jks samedn1.certs || exit 1 -$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} ${EXTRAOPTS} CertReplace samedn.jks samedn2.certs || exit 2 diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java index 70a727d157b3..626ebaf12641 100644 --- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java +++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java @@ -41,6 +41,7 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; +import java.util.Base64; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -505,9 +506,9 @@ public static RuntimeException throwUnknownPlatformError() { public static RuntimeException throwSkippedException(String reason) { trace("Skip the test: " + reason); - RuntimeException ex = ThrowingSupplier.toSupplier( - () -> (RuntimeException) Class.forName("jtreg.SkippedException").getConstructor( - String.class).newInstance(reason)).get(); + RuntimeException ex = ThrowingSupplier.toSupplier(() -> { + return JtregSkippedExceptionClass.INSTANCE.getConstructor(String.class).newInstance(reason); + }).get(); currentTest.notifySkipped(ex); throw ex; @@ -1074,4 +1075,29 @@ static Set tokenizeConfigProperty(String propertyName) { VERBOSE_TEST_SETUP = isNonOf.test(Set.of("init", "i")); } } + + private static final class JtregSkippedExceptionClass extends ClassLoader { + @SuppressWarnings("unchecked") + JtregSkippedExceptionClass() { + super(TKit.class.getClassLoader()); + + final byte[] bytes = Base64.getDecoder().decode( + // Base64-encoded "jtreg/SkippedException.class" file + // emitted by jdk8's javac from "$OPEN_JDK/test/lib/jtreg/SkippedException.java" + "yv66vgAAADQAFQoABAARCgAEABIHABMHABQBABBzZXJpYWxWZXJzaW9uVUlEAQABSgEADUNvbnN0" + + "YW50VmFsdWUFErH6BHk+kr0BAAY8aW5pdD4BACooTGphdmEvbGFuZy9TdHJpbmc7TGphdmEvbGFu" + + "Zy9UaHJvd2FibGU7KVYBAARDb2RlAQAPTGluZU51bWJlclRhYmxlAQAVKExqYXZhL2xhbmcvU3Ry" + + "aW5nOylWAQAKU291cmNlRmlsZQEAFVNraXBwZWRFeGNlcHRpb24uamF2YQwACgALDAAKAA4BABZq" + + "dHJlZy9Ta2lwcGVkRXhjZXB0aW9uAQAaamF2YS9sYW5nL1J1bnRpbWVFeGNlcHRpb24AMQADAAQA" + + "AAABABoABQAGAAEABwAAAAIACAACAAEACgALAAEADAAAACMAAwADAAAAByorLLcAAbEAAAABAA0A" + + "AAAKAAIAAAAiAAYAIwABAAoADgABAAwAAAAiAAIAAgAAAAYqK7cAArEAAAABAA0AAAAKAAIAAAAm" + + "AAUAJwABAA8AAAACABA"); + + clazz = (Class)defineClass("jtreg.SkippedException", bytes, 0, bytes.length); + } + + private final Class clazz; + + static final Class INSTANCE = new JtregSkippedExceptionClass().clazz; + } } diff --git a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java index 787ac67b915b..9a80ca4d0899 100644 --- a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java +++ b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestRedirectLinks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,40 +26,36 @@ * @bug 8190312 * @key intermittent * @summary test redirected URLs for -link - * @library /tools/lib ../../lib - * @library /test/lib + * @library /tools/lib ../../lib /test/lib * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.javadoc/jdk.javadoc.internal.api * jdk.javadoc/jdk.javadoc.internal.tool * @build toolbox.ToolBox toolbox.JavacTask javadoc.tester.* * @build jtreg.SkippedException - * @build jdk.test.lib.Platform + * @build jdk.test.lib.Platform jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.URIBuilder * @run main TestRedirectLinks */ import java.io.File; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; import java.net.UnknownHostException; import java.nio.file.Files; import java.nio.file.Path; -import java.security.KeyStore; import java.time.Duration; import java.time.Instant; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManagerFactory; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpServer; @@ -67,6 +63,8 @@ import com.sun.net.httpserver.HttpsServer; import javadoc.tester.JavadocTester; +import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; import toolbox.JavacTask; import toolbox.ToolBox; @@ -74,6 +72,9 @@ import jtreg.SkippedException; public class TestRedirectLinks extends JavadocTester { + // represents the HTTP response body length when the response contains no body + private static final int NO_RESPONSE_BODY = -1; + /** * The entry point of the test. * @param args the array of command line arguments. @@ -207,17 +208,28 @@ public void testWithServers() throws Exception { // start web servers // use loopback address to avoid any issues if proxy is in use - InetAddress localHost = InetAddress.getLoopbackAddress(); + InetAddress loopback = InetAddress.getLoopbackAddress(); try { - oldServer = HttpServer.create(new InetSocketAddress(localHost, 0), 0); - String oldURL = "http:/" + oldServer.getAddress(); + oldServer = HttpServer.create(new InetSocketAddress(loopback, 0), 0); + String oldURL = URIBuilder.newBuilder() + .scheme("http") + .loopback() + .port(oldServer.getAddress().getPort()) + .build().toString(); oldServer.createContext("/", this::handleOldRequest); out.println("Starting old server (" + oldServer.getClass().getSimpleName() + ") on " + oldURL); oldServer.start(); SSLContext sslContext = new SimpleSSLContext().get(); - newServer = HttpsServer.create(new InetSocketAddress(localHost, 0), 0); - String newURL = "https:/" + newServer.getAddress(); + if (sslContext == null) { + throw new AssertionError("Could not create a SSLContext"); + } + newServer = HttpsServer.create(new InetSocketAddress(loopback, 0), 0); + String newURL = URIBuilder.newBuilder() + .scheme("https") + .loopback() + .port(newServer.getAddress().getPort()) + .build().toString(); newServer.setHttpsConfigurator(new HttpsConfigurator(sslContext)); newServer.createContext("/", this::handleNewRequest); out.println("Starting new server (" + newServer.getClass().getSimpleName() + ") on " + newURL); @@ -241,7 +253,7 @@ public void testWithServers() throws Exception { javadoc("-d", "api", "--module-source-path", src.toString(), "--module-path", libModules.toString(), - "-link", "http:/" + oldServer.getAddress(), + "-link", oldURL, "--module", "mC", "-Xdoclint:none"); @@ -282,10 +294,19 @@ private void handleOldRequest(HttpExchange x) throws IOException { + x.getRequestMethod() + " " + x.getRequestURI()); String newProtocol = (newServer instanceof HttpsServer) ? "https" : "http"; - String redirectTo = newProtocol + ":/" + newServer.getAddress() + x.getRequestURI(); + String redirectTo; + try { + redirectTo = URIBuilder.newBuilder().scheme(newProtocol) + .host(newServer.getAddress().getAddress()) + .port(newServer.getAddress().getPort()) + .path(x.getRequestURI().getPath()) + .build().toString(); + } catch (URISyntaxException e) { + throw new IOException(e); + } out.println(" redirect to: " + redirectTo); x.getResponseHeaders().add("Location", redirectTo); - x.sendResponseHeaders(HttpURLConnection.HTTP_MOVED_PERM, 0); + x.sendResponseHeaders(HttpURLConnection.HTTP_MOVED_PERM, NO_RESPONSE_BODY); x.getResponseBody().close(); } @@ -306,64 +327,8 @@ private void handleNewRequest(HttpExchange x) throws IOException { responseStream.write(bytes); } } else { - x.sendResponseHeaders(HttpURLConnection.HTTP_NOT_FOUND, 0); + x.sendResponseHeaders(HttpURLConnection.HTTP_NOT_FOUND, NO_RESPONSE_BODY); x.getResponseBody().close(); } } - - /** - * Creates a simple usable SSLContext for an HttpsServer using - * a default keystore in the test tree. - *

- * This class is based on - * test/jdk/java/net/httpclient/whitebox/java.net.http/jdk/internal/net/http/SimpleSSLContext.java - */ - static class SimpleSSLContext { - - private final SSLContext ssl; - - /** - * Loads default keystore. - */ - SimpleSSLContext() throws Exception { - Path p = Path.of(System.getProperty("test.src", ".")).toAbsolutePath(); - while (!Files.exists(p.resolve("TEST.ROOT"))) { - p = p.getParent(); - if (p == null) { - throw new IOException("can't find TEST.ROOT"); - } - } - - System.err.println("Test suite root: " + p); - Path testKeys = p.resolve("../lib/jdk/test/lib/net/testkeys").normalize(); - if (!Files.exists(testKeys)) { - throw new IOException("can't find testkeys"); - } - System.err.println("Test keys: " + testKeys); - - try (InputStream fis = Files.newInputStream(testKeys)) { - ssl = init(fis); - } - } - - private SSLContext init(InputStream i) throws Exception { - char[] passphrase = "passphrase".toCharArray(); - KeyStore ks = KeyStore.getInstance("PKCS12"); - ks.load(i, passphrase); - - KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX"); - kmf.init(ks, passphrase); - - TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); - tmf.init(ks); - - SSLContext ssl = SSLContext.getInstance("TLS"); - ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); - return ssl; - } - - SSLContext get() { - return ssl; - } - } } diff --git a/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java b/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java index 971a2dd546fb..5b01f5077231 100644 --- a/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java +++ b/test/langtools/jdk/javadoc/tool/EnablePreviewOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8199196 * @summary Test --enable-preview option in javadoc diff --git a/test/langtools/jdk/javadoc/tool/ReleaseOption.java b/test/langtools/jdk/javadoc/tool/ReleaseOption.java index dfee8726f30b..5a7955099ca0 100644 --- a/test/langtools/jdk/javadoc/tool/ReleaseOption.java +++ b/test/langtools/jdk/javadoc/tool/ReleaseOption.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ import static jdk.javadoc.internal.tool.Main.Result.*; -/** +/* * @test * @bug 8086737 * @summary Test --release option in javadoc diff --git a/test/langtools/jdk/javadoc/tool/T4696488.java b/test/langtools/jdk/javadoc/tool/T4696488.java index b48c7fac93d2..715f738f53b7 100644 --- a/test/langtools/jdk/javadoc/tool/T4696488.java +++ b/test/langtools/jdk/javadoc/tool/T4696488.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4696488 * @summary javadoc doesn't handle UNC paths for destination directory diff --git a/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java b/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java index 47fb2aa179ed..247db2732cc4 100644 --- a/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java +++ b/test/langtools/jdk/javadoc/tool/T4994049/T4994049.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 4994049 * @summary Unit test for SourcePosition.column with respect to tab expansion diff --git a/test/langtools/jdk/javadoc/tool/T6551367.java b/test/langtools/jdk/javadoc/tool/T6551367.java index 875c91a1cf15..815b0b121e4e 100644 --- a/test/langtools/jdk/javadoc/tool/T6551367.java +++ b/test/langtools/jdk/javadoc/tool/T6551367.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 6551367 * @summary javadoc throws ClassCastException when an link tag tries to reference constructor. diff --git a/test/langtools/jdk/javadoc/tool/TestScriptInComment.java b/test/langtools/jdk/javadoc/tool/TestScriptInComment.java index 3eaa47a36d56..638e4c180597 100644 --- a/test/langtools/jdk/javadoc/tool/TestScriptInComment.java +++ b/test/langtools/jdk/javadoc/tool/TestScriptInComment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8138725 8226765 * @summary test --allow-script-in-comments diff --git a/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java b/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java index 006a6489f8d3..229d729bf402 100644 --- a/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java +++ b/test/langtools/jdk/javadoc/tool/modules/CommandLineFiles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8176539 * @summary Test use case when all java files are listed diff --git a/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java b/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java index 8fd9b26cc12e..e510ea83bc41 100644 --- a/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/FilterOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8159305 8167383 * @summary Tests elements filtering options diff --git a/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java b/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java index b6e16dc592d4..2c6624ca19aa 100644 --- a/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/PackageOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8159305 * @summary Test modules with packages and subpackages filtering diff --git a/test/langtools/jdk/javadoc/tool/modules/PatchModules.java b/test/langtools/jdk/javadoc/tool/modules/PatchModules.java index 10101a33ec64..ec9e6b3b8940 100644 --- a/test/langtools/jdk/javadoc/tool/modules/PatchModules.java +++ b/test/langtools/jdk/javadoc/tool/modules/PatchModules.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8175346 * @summary Test patch module options diff --git a/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java b/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java index 2e0d4778401e..ce86d073e330 100644 --- a/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java +++ b/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8175346 8175277 * @summary Test release option interactions diff --git a/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java b/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java index 889945b236d0..cba4792f1660 100644 --- a/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java +++ b/test/langtools/jdk/javadoc/tool/nonConstExprs/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8010310 * @summary Error processing sources with -private diff --git a/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java b/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java index 39a726e3261c..598b1b63c022 100644 --- a/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java +++ b/test/langtools/jdk/javadoc/tool/parser/7091528/T7091528.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 7091528 8029145 8037484 * @summary ensures javadoc parses unique source files and ignores all class files diff --git a/test/langtools/jdk/jshell/AnalysisTest.java b/test/langtools/jdk/jshell/AnalysisTest.java index f6cd5bf9efb5..478301f3fd59 100644 --- a/test/langtools/jdk/jshell/AnalysisTest.java +++ b/test/langtools/jdk/jshell/AnalysisTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,14 @@ * @test * @summary Test SourceCodeAnalysis * @build KullaTesting TestingInputStream - * @run testng AnalysisTest + * @run junit AnalysisTest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class AnalysisTest extends KullaTesting { + @Test public void testSource() { assertAnalyze("int x=3//test", "int x=3;//test", "", true); assertAnalyze("int x=3 ;//test", "int x=3 ;//test", "", true); @@ -41,6 +41,7 @@ public void testSource() { assertAnalyze("int ff; int v // hi", "int ff;", " int v // hi", true); } + @Test public void testSourceSlashStar() { assertAnalyze("/*zoo*/int x=3 /*test*/", "/*zoo*/int x=3; /*test*/", "", true); assertAnalyze("/*zoo*/int x=3 ;/*test*/", "/*zoo*/int x=3 ;/*test*/", "", true); @@ -49,11 +50,13 @@ public void testSourceSlashStar() { assertAnalyze("int ff; int v /*hgjghj*/", "int ff;", " int v /*hgjghj*/", true); } + @Test public void testIncomplete() { assertAnalyze("void m() { //erer", null, "void m() { //erer\n", false); assertAnalyze("int m=//", null, "int m=//\n", false); } + @Test public void testExpression() { assertAnalyze("45//test", "45//test", "", true); assertAnalyze("45;//test", "45;//test", "", true); diff --git a/test/langtools/jdk/jshell/AnalyzeSnippetTest.java b/test/langtools/jdk/jshell/AnalyzeSnippetTest.java index 3e2e1a839e2b..e1a9efb820ed 100644 --- a/test/langtools/jdk/jshell/AnalyzeSnippetTest.java +++ b/test/langtools/jdk/jshell/AnalyzeSnippetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @bug 8182270 * @summary test non-eval Snippet analysis * @build KullaTesting TestingInputStream - * @run testng AnalyzeSnippetTest + * @run junit AnalyzeSnippetTest */ import java.io.ByteArrayOutputStream; @@ -34,15 +34,12 @@ import java.util.List; import jdk.jshell.Snippet; import jdk.jshell.DeclarationSnippet; -import org.testng.annotations.Test; import jdk.jshell.JShell; import jdk.jshell.MethodSnippet; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; import jdk.jshell.ErroneousSnippet; import jdk.jshell.ExpressionSnippet; import jdk.jshell.ImportSnippet; @@ -52,14 +49,16 @@ import jdk.jshell.TypeDeclSnippet; import jdk.jshell.VarSnippet; import static jdk.jshell.Snippet.SubKind.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class AnalyzeSnippetTest { JShell state; SourceCodeAnalysis sca; - @BeforeMethod + @BeforeEach public void setUp() { state = JShell.builder() .out(new PrintStream(new ByteArrayOutputStream())) @@ -69,7 +68,7 @@ public void setUp() { sca = state.sourceCodeAnalysis(); } - @AfterMethod + @AfterEach public void tearDown() { if (state != null) { state.close(); @@ -78,55 +77,61 @@ public void tearDown() { sca = null; } + @Test public void testImport() { ImportSnippet sn = (ImportSnippet) assertSnippet("import java.util.List;", SubKind.SINGLE_TYPE_IMPORT_SUBKIND); - assertEquals(sn.name(), "List"); + assertEquals("List", sn.name()); sn = (ImportSnippet) assertSnippet("import static java.nio.file.StandardOpenOption.CREATE;", SubKind.SINGLE_STATIC_IMPORT_SUBKIND); assertTrue(sn.isStatic()); } + @Test public void testClass() { TypeDeclSnippet sn = (TypeDeclSnippet) assertSnippet("class C {}", SubKind.CLASS_SUBKIND); - assertEquals(sn.name(), "C"); + assertEquals("C", sn.name()); sn = (TypeDeclSnippet) assertSnippet("enum EE {A, B , C}", SubKind.ENUM_SUBKIND); } + @Test public void testMethod() { MethodSnippet sn = (MethodSnippet) assertSnippet("int m(int x) { return x + x; }", SubKind.METHOD_SUBKIND); - assertEquals(sn.name(), "m"); - assertEquals(sn.signature(), "(int)int"); + assertEquals("m", sn.name()); + assertEquals("(int)int", sn.signature()); } + @Test public void testVar() { VarSnippet sn = (VarSnippet) assertSnippet("int i;", SubKind.VAR_DECLARATION_SUBKIND); - assertEquals(sn.name(), "i"); - assertEquals(sn.typeName(), "int"); + assertEquals("i", sn.name()); + assertEquals("int", sn.typeName()); sn = (VarSnippet) assertSnippet("int jj = 6;", SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND); sn = (VarSnippet) assertSnippet("2 + 2", SubKind.TEMP_VAR_EXPRESSION_SUBKIND); } + @Test public void testExpression() { state.eval("int aa = 10;"); ExpressionSnippet sn = (ExpressionSnippet) assertSnippet("aa", SubKind.VAR_VALUE_SUBKIND); - assertEquals(sn.name(), "aa"); - assertEquals(sn.typeName(), "int"); + assertEquals("aa", sn.name()); + assertEquals("int", sn.typeName()); sn = (ExpressionSnippet) assertSnippet("aa;", SubKind.VAR_VALUE_SUBKIND); - assertEquals(sn.name(), "aa"); - assertEquals(sn.typeName(), "int"); + assertEquals("aa", sn.name()); + assertEquals("int", sn.typeName()); sn = (ExpressionSnippet) assertSnippet("aa = 99", SubKind.ASSIGNMENT_SUBKIND); } + @Test public void testStatement() { StatementSnippet sn = (StatementSnippet) assertSnippet("System.out.println(33)", SubKind.STATEMENT_SUBKIND); @@ -134,6 +139,7 @@ public void testStatement() { SubKind.STATEMENT_SUBKIND); } + @Test public void testErroneous() { ErroneousSnippet sn = (ErroneousSnippet) assertSnippet("+++", SubKind.UNKNOWN_SUBKIND); diff --git a/test/langtools/jdk/jshell/BadExecutionControlSpecTest.java b/test/langtools/jdk/jshell/BadExecutionControlSpecTest.java index a4f4158a5c74..f7b34a0e1942 100644 --- a/test/langtools/jdk/jshell/BadExecutionControlSpecTest.java +++ b/test/langtools/jdk/jshell/BadExecutionControlSpecTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool - * @run testng BadExecutionControlSpecTest + * @run junit BadExecutionControlSpecTest */ import java.io.ByteArrayInputStream; @@ -38,12 +38,11 @@ import java.io.PrintStream; import java.util.Collections; import java.util.List; -import org.testng.annotations.Test; import jdk.jshell.spi.ExecutionControl; import jdk.jshell.spi.ExecutionEnv; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -@Test public class BadExecutionControlSpecTest { private static void assertIllegal(String spec) throws Throwable { try { @@ -80,6 +79,7 @@ public void closeDown() { } } + @Test public void syntaxTest() throws Throwable { assertIllegal(":launch(true)"); assertIllegal("jdi:launch(true"); @@ -87,6 +87,7 @@ public void syntaxTest() throws Throwable { assertIllegal("jdi:,"); } + @Test public void notFoundTest() throws Throwable { assertIllegal("fruitbats"); assertIllegal("jdi:baz(true)"); diff --git a/test/langtools/jdk/jshell/ClassMembersTest.java b/test/langtools/jdk/jshell/ClassMembersTest.java index 25360770ab3e..6e188e7b8eb2 100644 --- a/test/langtools/jdk/jshell/ClassMembersTest.java +++ b/test/langtools/jdk/jshell/ClassMembersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @bug 8139829 * @summary Test access to members of user defined class. * @build KullaTesting TestingInputStream ExpectedDiagnostic - * @run testng/timeout=600 ClassMembersTest + * @run junit/timeout=600 ClassMembersTest */ import java.lang.annotation.RetentionPolicy; @@ -36,22 +36,26 @@ import javax.tools.Diagnostic; import jdk.jshell.SourceCodeAnalysis; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; import jdk.jshell.TypeDeclSnippet; import static jdk.jshell.Snippet.Status.OVERWRITTEN; import static jdk.jshell.Snippet.Status.VALID; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ClassMembersTest extends KullaTesting { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine("local")); } - @Test(dataProvider = "memberTestCase") + @ParameterizedTest + @MethodSource("memberTestCaseGenerator") public void memberTest(AccessModifier accessModifier, CodeChunk codeChunk, Static isStaticMember, Static isStaticReference) { MemberTestCase testCase = new MemberTestCase(accessModifier, codeChunk, isStaticMember, isStaticReference); assertEval(testCase.generateSource()); @@ -78,7 +82,8 @@ private List parseCode(String input) { return list; } - @Test(dataProvider = "memberTestCase") + @ParameterizedTest + @MethodSource("memberTestCaseGenerator") public void extendsMemberTest(AccessModifier accessModifier, CodeChunk codeChunk, Static isStaticMember, Static isStaticReference) { MemberTestCase testCase = new ExtendsMemberTestCase(accessModifier, codeChunk, isStaticMember, isStaticReference); String input = testCase.generateSource(); @@ -151,7 +156,8 @@ public void enumTest() { new ExpectedDiagnostic("compiler.err.non-static.cant.be.ref", 0, 8, 1, -1, -1, Diagnostic.Kind.ERROR)); } - @Test(dataProvider = "retentionPolicyTestCase") + @ParameterizedTest + @MethodSource("retentionPolicyTestCaseGenerator") public void annotationTest(RetentionPolicy policy) { assertEval("import java.lang.annotation.*;"); String annotationSource = @@ -174,7 +180,6 @@ public void annotationTest(RetentionPolicy policy) { assertEval("C.Inner.class.getAnnotationsByType(A.class).length > 0;", isRuntimeVisible); } - @DataProvider(name = "retentionPolicyTestCase") public Object[][] retentionPolicyTestCaseGenerator() { List list = new ArrayList<>(); for (RetentionPolicy policy : RetentionPolicy.values()) { @@ -183,7 +188,6 @@ public Object[][] retentionPolicyTestCaseGenerator() { return list.toArray(new Object[list.size()][]); } - @DataProvider(name = "memberTestCase") public Object[][] memberTestCaseGenerator() { List list = new ArrayList<>(); for (AccessModifier accessModifier : AccessModifier.values()) { diff --git a/test/langtools/jdk/jshell/ClassPathTest.java b/test/langtools/jdk/jshell/ClassPathTest.java index b9c862743890..6c2320ffac27 100644 --- a/test/langtools/jdk/jshell/ClassPathTest.java +++ b/test/langtools/jdk/jshell/ClassPathTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,20 +30,20 @@ * @library /tools/lib * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting TestingInputStream Compiler - * @run testng ClassPathTest + * @run junit ClassPathTest */ import java.nio.file.Path; import java.nio.file.Paths; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class ClassPathTest extends KullaTesting { private final Compiler compiler = new Compiler(); private final Path outDir = Paths.get("class_path_test"); + @Test public void testDirectory() { compiler.compile(outDir, "package pkg; public class TestDirectory { }"); assertDeclareFail("import pkg.TestDirectory;", "compiler.err.doesnt.exist"); @@ -52,6 +52,7 @@ public void testDirectory() { assertEval("new pkg.TestDirectory();"); } + @Test public void testJar() { compiler.compile(outDir, "package pkg; public class TestJar { }"); String jarName = "test.jar"; @@ -62,6 +63,7 @@ public void testJar() { assertEval("new pkg.TestJar();"); } + @Test public void testAmbiguousDirectory() { Path p1 = outDir.resolve("dir1"); compiler.compile(p1, @@ -82,6 +84,7 @@ public void testAmbiguousDirectory() { assertEval("new p.TestAmbiguous();", "first"); } + @Test public void testAmbiguousJar() { Path p1 = outDir.resolve("dir1"); compiler.compile(p1, @@ -104,11 +107,13 @@ public void testAmbiguousJar() { assertEval("new p.TestAmbiguous();", "first"); } + @Test public void testEmptyClassPath() { addToClasspath(""); assertEval("new java.util.ArrayList();"); } + @Test public void testUnknown() { addToClasspath(compiler.getPath(outDir.resolve("UNKNOWN"))); assertDeclareFail("new Unknown();", "compiler.err.cant.resolve.location"); diff --git a/test/langtools/jdk/jshell/ClassesTest.java b/test/langtools/jdk/jshell/ClassesTest.java index 8c17c8072f8d..4e1e297d077b 100644 --- a/test/langtools/jdk/jshell/ClassesTest.java +++ b/test/langtools/jdk/jshell/ClassesTest.java @@ -26,7 +26,7 @@ * @bug 8145239 8129559 8080354 8189248 8010319 8246353 8247456 8282160 8292755 8319532 * @summary Tests for EvaluationState.classes * @build KullaTesting TestingInputStream ExpectedDiagnostic - * @run testng ClassesTest + * @run junit ClassesTest */ import java.util.ArrayList; @@ -37,8 +37,6 @@ import jdk.jshell.Snippet; import jdk.jshell.TypeDeclSnippet; import jdk.jshell.VarSnippet; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import jdk.jshell.Diag; import jdk.jshell.Snippet.Status; @@ -51,16 +49,22 @@ import static jdk.jshell.Snippet.Status.OVERWRITTEN; import static jdk.jshell.Snippet.Status.NONEXISTENT; import static jdk.jshell.Snippet.SubKind.*; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -@Test +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ClassesTest extends KullaTesting { + @Test public void noClasses() { assertNumberOfActiveClasses(0); } + @Test public void testSignature1() { TypeDeclSnippet c1 = classKey(assertEval("class A extends B {}", added(RECOVERABLE_NOT_DEFINED))); assertTypeDeclSnippet(c1, "A", RECOVERABLE_NOT_DEFINED, CLASS_SUBKIND, 1, 0); @@ -82,6 +86,7 @@ public void testSignature1() { assertTypeDeclSnippet(c5, "A", RECOVERABLE_NOT_DEFINED, CLASS_SUBKIND, 1, 0); } + @Test public void testSignature2() { TypeDeclSnippet c1 = (TypeDeclSnippet) assertDeclareFail("class A { void f() { return g(); } }", "compiler.err.prob.found.req"); assertTypeDeclSnippet(c1, "A", REJECTED, CLASS_SUBKIND, 0, 2); @@ -92,27 +97,32 @@ public void testSignature2() { ste(c2, RECOVERABLE_DEFINED, DROPPED, true, null)); } + @Test public void classDeclaration() { assertEval("class A { }"); assertClasses(clazz(KullaTesting.ClassType.CLASS, "A")); } + @Test public void interfaceDeclaration() { assertEval("interface A { }"); assertClasses(clazz(KullaTesting.ClassType.INTERFACE, "A")); } + @Test public void annotationDeclaration() { assertEval("@interface A { }"); assertClasses(clazz(KullaTesting.ClassType.ANNOTATION, "A")); } + @Test public void enumDeclaration() { assertEval("enum A { }"); assertClasses(clazz(KullaTesting.ClassType.ENUM, "A")); } + @Test public void classesDeclaration() { assertEval("interface A { }"); assertEval("class B implements A { }"); @@ -128,6 +138,7 @@ public void classesDeclaration() { assertActiveKeys(); } + @Test public void classesRedeclaration1() { Snippet a = classKey(assertEval("class A { }")); Snippet b = classKey(assertEval("interface B { }")); @@ -149,6 +160,7 @@ public void classesRedeclaration1() { assertActiveKeys(); } + @Test public void classesRedeclaration2() { assertEval("class A { }"); assertClasses(clazz(KullaTesting.ClassType.CLASS, "A")); @@ -180,6 +192,7 @@ public void classesRedeclaration2() { } //8154496: test3 update: sig change should false + @Test public void classesRedeclaration3() { Snippet a = classKey(assertEval("class A { }")); assertClasses(clazz(KullaTesting.ClassType.CLASS, "A")); @@ -201,6 +214,7 @@ public void classesRedeclaration3() { assertActiveKeys(); } + @Test public void classesCyclic1() { Snippet b = classKey(assertEval("class B extends A { }", added(RECOVERABLE_NOT_DEFINED))); @@ -221,11 +235,12 @@ public void classesCyclic1() { diags = diagsA; assertTrue(diagsB.isEmpty()); } - assertEquals(diags.size(), 1, "Expected one error"); - assertEquals(diags.get(0).getCode(), "compiler.err.cyclic.inheritance", "Expected cyclic inheritance error"); + assertEquals(1, diags.size(), "Expected one error"); + assertEquals("compiler.err.cyclic.inheritance", diags.get(0).getCode(), "Expected cyclic inheritance error"); assertActiveKeys(); } + @Test public void classesCyclic2() { Snippet d = classKey(assertEval("class D extends E { }", added(RECOVERABLE_NOT_DEFINED))); assertEval("class E { D d; }", @@ -234,6 +249,7 @@ public void classesCyclic2() { assertActiveKeys(); } + @Test public void classesCyclic3() { Snippet outer = classKey(assertEval("class Outer { class Inner extends Foo { } }", added(RECOVERABLE_NOT_DEFINED))); @@ -247,6 +263,7 @@ public void classesCyclic3() { assertActiveKeys(); } + @Test public void classesIgnoredModifiers() { assertEval("public interface A { }"); assertEval("static class B implements A { }"); @@ -254,6 +271,7 @@ public void classesIgnoredModifiers() { assertActiveKeys(); } + @Test public void classesIgnoredModifiersAnnotation() { assertEval("public @interface X { }"); assertEval("@X public interface A { }"); @@ -262,6 +280,7 @@ public void classesIgnoredModifiersAnnotation() { assertActiveKeys(); } + @Test public void classesIgnoredModifiersOtherModifiers() { assertEval("strictfp public interface A { }"); assertEval("strictfp static class B implements A { }"); @@ -269,6 +288,7 @@ public void classesIgnoredModifiersOtherModifiers() { assertActiveKeys(); } + @Test public void ignoreModifierSpaceIssue() { assertEval("interface I { void f(); } "); // there should not be a space between 'I' and '{' to reproduce the failure @@ -277,7 +297,6 @@ public void ignoreModifierSpaceIssue() { assertActiveKeys(); } - @DataProvider(name = "innerClasses") public Object[][] innerClasses() { List list = new ArrayList<>(); for (ClassType outerClassType : ClassType.values()) { @@ -288,7 +307,8 @@ public Object[][] innerClasses() { return list.toArray(new Object[list.size()][]); } - @Test(dataProvider = "innerClasses") + @ParameterizedTest + @MethodSource("innerClasses") public void innerClasses(ClassType outerClassType, ClassType innerClassType) { String source = outerClassType + " A {" + (outerClassType == ClassType.ENUM ? ";" : "") + @@ -299,6 +319,7 @@ public void innerClasses(ClassType outerClassType, ClassType innerClassType) { assertActiveKeys(); } + @Test public void testInnerClassesCrash() { Snippet a = classKey(assertEval("class A { class B extends A {} }")); Snippet a2 = classKey(assertEval("class A { interface I1 extends I2 {} interface I2 {} }", @@ -309,20 +330,23 @@ public void testInnerClassesCrash() { ste(a2, VALID, OVERWRITTEN, false, MAIN_SNIPPET)); } + @Test public void testInnerClassesCrash1() { assertEval("class A { class B extends A {} B getB() { return new B();} }"); - assertEquals(varKey(assertEval("A a = new A();")).name(), "a"); + assertEquals("a", varKey(assertEval("A a = new A();")).name()); VarSnippet variableKey = varKey(assertEval("a.getB();")); - assertEquals(variableKey.typeName(), "A.B"); + assertEquals("A.B", variableKey.typeName()); } + @Test public void testInnerClassesCrash2() { assertEval("class A { interface I1 extends I2 {} interface I2 {} I1 x; }"); - assertEquals(varKey(assertEval("A a = new A();")).name(), "a"); + assertEquals("a", varKey(assertEval("A a = new A();")).name()); VarSnippet variableKey = varKey(assertEval("a.x;")); - assertEquals(variableKey.typeName(), "A.I1"); + assertEquals("A.I1", variableKey.typeName()); } + @Test public void testCircular() { assertEval("import java.util.function.Supplier;"); TypeDeclSnippet aClass = @@ -342,6 +366,7 @@ public void testCircular() { assertEval("new A()"); } + @Test public void testCircular8282160() { TypeDeclSnippet classKey = classKey(assertEval(""" class B { @@ -360,6 +385,7 @@ public void run() {} ste(classKey, Status.RECOVERABLE_NOT_DEFINED, Status.VALID, true, null)); } + @Test public void testDefaultMethodInInterface() { assertEvalFail(""" interface C { @@ -374,6 +400,7 @@ public void run() { """); } + @Test public void testNonSealed() { assertAnalyze("non-sealed class C extends B {}int i;", "non-sealed class C extends B {}", diff --git a/test/langtools/jdk/jshell/CommandCompletionTest.java b/test/langtools/jdk/jshell/CommandCompletionTest.java index 3a818a74e1e5..ef02e1359734 100644 --- a/test/langtools/jdk/jshell/CommandCompletionTest.java +++ b/test/langtools/jdk/jshell/CommandCompletionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ * @library /tools/lib * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build ReplToolTesting TestingInputStream Compiler - * @run testng CommandCompletionTest + * @run junit CommandCompletionTest */ import java.io.IOException; @@ -46,16 +46,16 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.testng.SkipException; -import org.testng.annotations.Test; import jdk.internal.jshell.tool.JShellTool; import jdk.internal.jshell.tool.JShellToolBuilder; import jdk.jshell.SourceCodeAnalysis.Suggestion; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.Test; public class CommandCompletionTest extends ReplToolTesting { @@ -94,7 +94,7 @@ public void assertCompletion(boolean after, String code, boolean isSmart, String public void assertCompletion(String code, boolean isSmart, String... expected) { List completions = computeCompletions(code, isSmart); List expectedL = Arrays.asList(expected); - assertEquals(completions, expectedL, "Command: " + code + ", output: " + + assertEquals(expectedL, completions, "Command: " + code + ", output: " + completions.toString() + ", expected: " + expectedL.toString()); } @@ -356,9 +356,7 @@ public void testUserHome() throws IOException { .map(file -> file.getFileName().toString().replace(" ", "\\ ")) .orElse(null); } - if (selectedFile == null) { - throw new SkipException("No suitable file(s) found for this test in " + home); - } + Assumptions.assumeFalse(selectedFile == null, "No suitable file(s) found for this test in " + home); try (Stream content = Files.list(home)) { completions = content.filter(CLASSPATH_FILTER) .filter(file -> file.getFileName().toString().startsWith(selectedFile.replace("\\ ", " "))) diff --git a/test/langtools/jdk/jshell/CompilerOptionsTest.java b/test/langtools/jdk/jshell/CompilerOptionsTest.java index 1b4f5a8002dc..e4c9332d5aa6 100644 --- a/test/langtools/jdk/jshell/CompilerOptionsTest.java +++ b/test/langtools/jdk/jshell/CompilerOptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,28 +26,29 @@ * @bug 8159635 * @summary Test setting compiler options * @build KullaTesting TestingInputStream - * @run testng CompilerOptionsTest + * @run junit CompilerOptionsTest */ import javax.tools.Diagnostic; -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; import static jdk.jshell.Snippet.Status.VALID; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class CompilerOptionsTest extends KullaTesting { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(b -> b.compilerOptions("-source", "8", "-Xlint:cast,-options")); } + @Test public void testLint() { assertDeclareWarn1("String s = (String)\"hello\";", new ExpectedDiagnostic("compiler.warn.redundant.cast", 11, 26, 11, -1, -1, Diagnostic.Kind.WARNING)); } + @Test public void testSourceVersion() { assertEval("import java.util.ArrayList;", added(VALID)); // Diamond with anonymous classes allowed in 9 diff --git a/test/langtools/jdk/jshell/CompletenessStressTest.java b/test/langtools/jdk/jshell/CompletenessStressTest.java index 167ba716b10b..4b20ae93d467 100644 --- a/test/langtools/jdk/jshell/CompletenessStressTest.java +++ b/test/langtools/jdk/jshell/CompletenessStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,12 +64,12 @@ import jdk.jshell.SourceCodeAnalysis; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import static java.lang.Integer.max; import static java.lang.Integer.min; import static jdk.jshell.SourceCodeAnalysis.Completeness.*; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; public class CompletenessStressTest extends KullaTesting { public final static String JDK_ROOT_SRC_PROP = "jdk.root.src"; @@ -99,7 +99,6 @@ public File[] getDirectoriesToTest() { }; } - @DataProvider(name = "crawler") public Object[][] dataProvider() throws IOException { File[] srcDirs = getDirectoriesToTest(); List list = new ArrayList<>(); @@ -121,7 +120,8 @@ public Object[][] dataProvider() throws IOException { return list.toArray(new String[list.size()][]); } - @Test(dataProvider = "crawler") + @ParameterizedTest + @MethodSource("dataProvider") public void testFile(String fileName) throws IOException { File file = getSourceFile(fileName); final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); diff --git a/test/langtools/jdk/jshell/CompletenessTest.java b/test/langtools/jdk/jshell/CompletenessTest.java index 79d819656891..d638b3e86262 100644 --- a/test/langtools/jdk/jshell/CompletenessTest.java +++ b/test/langtools/jdk/jshell/CompletenessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @bug 8149524 8131024 8165211 8080071 8130454 8167343 8129559 8114842 8182268 8223782 8235474 8246774 8276149 * @summary Test SourceCodeAnalysis * @build KullaTesting TestingInputStream - * @run testng CompletenessTest + * @run junit CompletenessTest */ import java.util.Map; @@ -35,13 +35,11 @@ import javax.lang.model.SourceVersion; import jdk.jshell.JShell; -import org.testng.annotations.Test; import jdk.jshell.SourceCodeAnalysis.Completeness; import static jdk.jshell.SourceCodeAnalysis.Completeness.*; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.Test; -@Test public class CompletenessTest extends KullaTesting { // Add complete units that end with semicolon to complete_with_semi (without @@ -282,30 +280,37 @@ private void assertStatus(String[] ins, Completeness status) { } } + @Test public void test_complete() { assertStatus(complete, COMPLETE); } + @Test public void test_expression() { assertStatus(expression, COMPLETE); } + @Test public void test_complete_with_semi() { assertStatus(complete_with_semi, COMPLETE_WITH_SEMI); } + @Test public void test_considered_incomplete() { assertStatus(considered_incomplete, CONSIDERED_INCOMPLETE); } + @Test public void test_definitely_incomplete() { assertStatus(definitely_incomplete, DEFINITELY_INCOMPLETE); } + @Test public void test_unknown() { assertStatus(definitely_incomplete, DEFINITELY_INCOMPLETE); } + @Test public void testCompleted_complete_with_semi() { for (String in : complete_with_semi) { String input = in + ";"; @@ -313,6 +318,7 @@ public void testCompleted_complete_with_semi() { } } + @Test public void testCompleted_expression_with_semi() { for (String in : expression) { String input = in + ";"; @@ -320,6 +326,7 @@ public void testCompleted_expression_with_semi() { } } + @Test public void testCompleted_considered_incomplete() { for (String in : considered_incomplete) { String input = in + ";"; @@ -336,12 +343,14 @@ private void assertSourceByStatus(String first) { } } + @Test public void testCompleteSource_complete() { for (String input : complete) { assertSourceByStatus(input); } } + @Test public void testCompleteSource_complete_with_semi() { for (String in : complete_with_semi) { String input = in + ";"; @@ -349,6 +358,7 @@ public void testCompleteSource_complete_with_semi() { } } + @Test public void testCompleteSource_expression() { for (String in : expression) { String input = in + ";"; @@ -356,6 +366,7 @@ public void testCompleteSource_expression() { } } + @Test public void testCompleteSource_considered_incomplete() { for (String in : considered_incomplete) { String input = in + ";"; @@ -363,15 +374,18 @@ public void testCompleteSource_considered_incomplete() { } } + @Test public void testTrailingSlash() { assertStatus("\"abc\\", UNKNOWN, "\"abc\\"); } + @Test public void testOpenComment() { assertStatus("int xx; /* hello", DEFINITELY_INCOMPLETE, null); assertStatus("/** test", DEFINITELY_INCOMPLETE, null); } + @Test public void testTextBlocks() { assertStatus("\"\"\"", DEFINITELY_INCOMPLETE, null); assertStatus("\"\"\"broken", DEFINITELY_INCOMPLETE, null); @@ -389,6 +403,7 @@ public void testTextBlocks() { assertStatus("\"\"\"\n\\{0}", DEFINITELY_INCOMPLETE, null); } + @Test public void testMiscSource() { assertStatus("if (t) if ", DEFINITELY_INCOMPLETE, "if (t) if"); //Bug assertStatus("int m() {} dfd", COMPLETE, "int m() {}"); diff --git a/test/langtools/jdk/jshell/CompletionSuggestionTest.java b/test/langtools/jdk/jshell/CompletionSuggestionTest.java index dda5e9f9f060..73b06a045d16 100644 --- a/test/langtools/jdk/jshell/CompletionSuggestionTest.java +++ b/test/langtools/jdk/jshell/CompletionSuggestionTest.java @@ -32,7 +32,7 @@ * jdk.jshell/jdk.jshell:open * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting TestingInputStream Compiler - * @run testng CompletionSuggestionTest + * @run junit CompletionSuggestionTest */ import java.io.IOException; @@ -50,18 +50,19 @@ import java.util.jar.JarOutputStream; import jdk.jshell.Snippet; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import static jdk.jshell.Snippet.Status.VALID; import static jdk.jshell.Snippet.Status.OVERWRITTEN; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Test public class CompletionSuggestionTest extends KullaTesting { private final Compiler compiler = new Compiler(); private final Path outDir = Paths.get("completion_suggestion_test"); + @Test public void testMemberExpr() { assertEval("class Test { static void test() { } }"); assertCompletion("Test.t|", "test()"); @@ -111,16 +112,19 @@ public void testMemberExpr() { assertCompletion("\"\"\"\n\"\"\".leng|", "length()"); } + @Test public void testStartOfExpression() { assertEval("int ccTest = 0;"); assertCompletion("System.err.println(cc|", "ccTest"); assertCompletion("for (int i = cc|", "ccTest"); } + @Test public void testParameter() { assertCompletion("class C{void method(int num){num|", "num"); } + @Test public void testPrimitive() { Set primitives = new HashSet<>(Arrays.asList("boolean", "char", "byte", "short", "int", "long", "float", "double")); Set onlyVoid = new HashSet<>(Collections.singletonList("void")); @@ -154,6 +158,7 @@ public void testPrimitive() { assertCompletion("class A(Arrays.asList("Object", "Void")), @@ -166,6 +171,7 @@ public void testEmpty() { new HashSet<>(Arrays.asList("$REPL00DOESNOTMATTER"))); } + @Test public void testSmartCompletion() { assertEval("int ccTest1 = 0;"); assertEval("int ccTest2 = 0;"); @@ -198,6 +204,7 @@ public void testSmartCompletion() { assertCompletion("new Klass(|", true, "ccTest1", "ccTest2"); } + @Test public void testSmartCompletionInOverriddenMethodInvocation() { assertEval("int ccTest1 = 0;"); assertEval("int ccTest2 = 0;"); @@ -208,6 +215,7 @@ public void testSmartCompletionInOverriddenMethodInvocation() { assertCompletion("new Extend().method(|", true, "ccTest1", "ccTest2"); } + @Test public void testSmartCompletionForBoxedType() { assertEval("int ccTest1 = 0;"); assertEval("Integer ccTest2 = 0;"); @@ -223,6 +231,7 @@ public void testSmartCompletionForBoxedType() { assertCompletion("method3(|", true, "ccTest1", "ccTest2", "ccTest3", "method1(", "method2(", "method3("); } + @Test public void testNewClass() { assertCompletion("String str = new Strin|", "String(", "StringBuffer(", "StringBuilder(", "StringIndexOutOfBoundsException("); assertCompletion("String str = new java.lang.Strin|", "String(", "StringBuffer(", "StringBuilder(", "StringIndexOutOfBoundsException("); @@ -243,6 +252,7 @@ public void testNewClass() { assertCompletion("new String(I.A|", "A"); } + @Test public void testFullyQualified() { assertCompletion("Optional opt = java.u|", "util."); assertCompletionIncludesExcludes("Optional opt = java.util.O|", new HashSet<>(Collections.singletonList("Optional")), Collections.emptySet()); @@ -271,15 +281,18 @@ public void testFullyQualified() { assertCompletion("p1.p3.|", "Test"); } + @Test public void testCheckAccessibility() { assertCompletion("java.util.regex.Pattern.co|", "compile("); } + @Test public void testCompletePackages() { assertCompletion("java.u|", "util."); assertCompletionIncludesExcludes("jav|", new HashSet<>(Arrays.asList("java.", "javax.")), Collections.emptySet()); } + @Test public void testImports() { assertCompletion("import java.u|", "util."); assertCompletionIncludesExcludes("import jav|", new HashSet<>(Arrays.asList("java.", "javax.")), Collections.emptySet()); @@ -298,10 +311,12 @@ public void testImports() { new HashSet<>(Arrays.asList("class"))); } + @Test public void testImportStart() { assertCompletionIncludesExcludes("import c|", Set.of("com."), Set.of()); } + @Test public void testBrokenClassFile() throws Exception { Compiler compiler = new Compiler(); Path testOutDir = Paths.get("CompletionTestBrokenClassFile"); @@ -311,6 +326,7 @@ public void testBrokenClassFile() throws Exception { assertCompletion("import inner.|"); } + @Test public void testDocumentation() throws Exception { dontReadParameterNamesFromClassFile(); assertSignature("System.getProperty(|", @@ -339,6 +355,7 @@ public void testDocumentation() throws Exception { assertSignature("field.FieldTest.R|", "field.FieldTest.R(java.lang.String s, E e)"); } + @Test public void testMethodsWithNoArguments() throws Exception { dontReadParameterNamesFromClassFile(); assertSignature("System.out.println(|", @@ -354,11 +371,13 @@ public void testMethodsWithNoArguments() throws Exception { "void java.io.PrintStream.println(Object)"); } + @Test public void testErroneous() { assertCompletion("Undefined.|"); assertSignature("does.not.exist|"); } + @Test public void testClinit() { assertEval("enum E{;}"); assertEval("class C{static{}}"); @@ -366,6 +385,7 @@ public void testClinit() { assertCompletionIncludesExcludes("C.|", Collections.emptySet(), new HashSet<>(Collections.singletonList(""))); } + @Test public void testMethodHeaderContext() { assertCompletion("private void f(Runn|", "Runnable"); assertCompletion("void f(Runn|", "Runnable"); @@ -377,6 +397,7 @@ public void testMethodHeaderContext() { assertCompletion("void f(Object o1) throws HogeHoge.|", true, "HogeHogeException"); } + @Test public void testTypeVariables() { assertCompletion("class A { public void test() { TY|", "TYPE"); assertCompletion("class A { public static void test() { TY|"); @@ -384,6 +405,7 @@ public void testTypeVariables() { assertCompletion("class A { public static void test() { TY|", "TYPE"); } + @Test public void testGeneric() { assertEval("import java.util.concurrent.*;"); assertCompletion("java.util.Listf(T... ts)", "void f(A a)"); } + @Test public void testClass() { assertSignature("String|", "java.lang.String"); } + @Test public void testDocumentationOfUserDefinedConstructors() { Snippet a = classKey(assertEval("class A {}")); assertSignature("new A(|", "A()"); @@ -519,6 +547,7 @@ public void testDocumentationOfUserDefinedConstructors() { assertSignature("new A(|", "A(T a)", "A(int i)", " A(T t, U u)"); } + @Test public void testDocumentationOfOverriddenMethods() throws Exception { dontReadParameterNamesFromClassFile(); assertSignature("\"\".wait(|", @@ -534,6 +563,7 @@ public void testDocumentationOfOverriddenMethods() throws Exception { assertSignature("new Extend().method(|", "void Extend.method()"); } + @Test public void testDocumentationOfInvisibleMethods() { assertSignature("Object.wait(|"); assertSignature("\"\".indexOfSupplementary(|"); @@ -545,12 +575,14 @@ public void testDocumentationOfInvisibleMethods() { assertSignature("new A().method(|"); } + @Test public void testDocumentationOfInvisibleConstructors() { assertSignature("new Compiler(|"); assertEval("class A { private A() {} }"); assertSignature("new A(|"); } + @Test public void testDocumentationWithBoxing() { assertEval("int primitive = 0;"); assertEval("Integer boxed = 0;"); @@ -567,6 +599,7 @@ public void testDocumentationWithBoxing() { "void method(Object n, int o)"); } + @Test public void testDocumentationWithGenerics() { class TestDocumentationWithGenerics { private final Function codeFacotry; @@ -621,6 +654,7 @@ void assertDoc(String generics, String expectedGenerics) { }); } + @Test public void testVarArgs() { assertEval("int i = 0;"); assertEval("class Foo1 { static void m(int... i) { } } "); @@ -646,6 +680,7 @@ public void testVarArgs() { assertCompletion("Foo4.m(ia, |", true, "str"); } + @Test public void testConstructorAsMemberOf() { assertEval("class Baz { Baz(X x) { } } "); assertEval("String str = null;"); @@ -657,6 +692,7 @@ public void testConstructorAsMemberOf() { assertCompletion("Foo.m(new Baz<>(|", true, "str"); } + @Test public void testIntersection() { assertEval(" Z get() { return null; }"); assertEval("var v = get();"); @@ -666,6 +702,7 @@ public void testIntersection() { assertCompletion("Number r = |", true); } + @Test public void testAnonymous() { assertEval("var v = new Runnable() { public void run() { } public int length() { return 0; } };"); assertCompletionIncludesExcludes("v.|", true, Set.of("run()", "length()"), Set.of()); @@ -673,10 +710,12 @@ public void testAnonymous() { assertCompletion("CharSequence r = |", true); } + @Test public void testCompletionInAnonymous() { assertCompletionIncludesExcludes("new Undefined() { int i = \"\".l|", Set.of("length()"), Set.of()); } + @Test public void testMemberReferences() { assertEval("class C {" + " public static String stat() { return null; }" + @@ -700,6 +739,7 @@ public void testMemberReferences() { assertCompletion("FI2 fi = C::|", true, "statConvert1", "statConvert3"); } + @Test public void testBrokenLambdaCompletion() { assertEval("interface Consumer { public void consume(T t); }"); assertEval("interface Function { public R convert(T t); }"); @@ -721,7 +761,7 @@ public void testBrokenLambdaCompletion() { assertCompletion("String s = m8(x -> {x.tri|", "trim()"); } - @BeforeMethod + @BeforeEach public void setUp() { setUp(builder -> builder.executionEngine("local")); @@ -753,7 +793,8 @@ private void dontReadParameterNamesFromClassFile() throws Exception { keepParameterNames.set(getAnalysis(), new String[0]); } - @Test(enabled = false) //TODO 8171829 + @Test //TODO 8171829 + @Disabled public void testBrokenClassFile2() throws IOException { Path broken = outDir.resolve("broken"); compiler.compile(broken, @@ -776,6 +817,7 @@ public void testBrokenClassFile2() throws IOException { assertCompletion("Broke|", "BrokenA", "BrokenC"); } + @Test public void testStatements() { assertEval("String s = \"\";"); assertCompletion("if (s.conta|", (Boolean) null, "contains("); @@ -788,11 +830,13 @@ public void testStatements() { assertCompletion("for (var v : s.conta|", (Boolean) null, "contains("); } + @Test public void testRecord() { assertCompletion("record R() implements Ru|", true, "Runnable"); } //JDK-8296789 + @Test public void testParentMembers() { assertEval("var sb=new StringBuilder();"); assertCompletionIncludesExcludes("sb.|", true, Set.of("capacity()", "setLength("), Set.of("maybeLatin1")); diff --git a/test/langtools/jdk/jshell/ComputeFQNsTest.java b/test/langtools/jdk/jshell/ComputeFQNsTest.java index 68bb530f311e..8e7f5a1d8897 100644 --- a/test/langtools/jdk/jshell/ComputeFQNsTest.java +++ b/test/langtools/jdk/jshell/ComputeFQNsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * jdk.jshell/jdk.jshell:open * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting TestingInputStream Compiler - * @run testng ComputeFQNsTest + * @run junit ComputeFQNsTest */ import java.io.Writer; @@ -41,15 +41,16 @@ import java.util.Arrays; import jdk.jshell.SourceCodeAnalysis.QualifiedNames; -import static org.testng.Assert.*; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Test public class ComputeFQNsTest extends KullaTesting { private final Compiler compiler = new Compiler(); private final Path outDir = Paths.get("ComputeFQNsTest"); + @Test public void testAddImport() throws Exception { compiler.compile(outDir, "package test1; public class FQNTestClass { }", "package test2; public class FQNTestClass { }"); String jarName = "test.jar"; @@ -77,7 +78,8 @@ public void testAddImport() throws Exception { assertInferredFQNs("class X { ArrayList", "ArrayList".length(), false, "java.util.ArrayList"); } - @Test(enabled = false) //TODO 8161165 + @Test //TODO 8161165 + @Disabled public void testSuspendIndexing() throws Throwable { compiler.compile(outDir, "package test; public class FQNTest { }"); String jarName = "test.jar"; @@ -127,8 +129,8 @@ public void testSuspendIndexing() throws Throwable { QualifiedNames candidates = getAnalysis().listQualifiedNames(code, code.length()); - assertEquals(candidates.getNames(), Arrays.asList(), "Input: " + code + ", candidates=" + candidates.getNames()); - assertEquals(candidates.isUpToDate(), false, "Input: " + code + ", up-to-date=" + candidates.isUpToDate()); + assertEquals(Arrays.asList(), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames()); + assertEquals(false, candidates.isUpToDate(), "Input: " + code + ", up-to-date=" + candidates.isUpToDate()); Files.delete(continueMarkFile); @@ -136,7 +138,7 @@ public void testSuspendIndexing() throws Throwable { candidates = getAnalysis().listQualifiedNames(code, code.length()); - assertEquals(candidates.getNames(), Arrays.asList("test.FQNTest"), "Input: " + code + ", candidates=" + candidates.getNames()); + assertEquals(Arrays.asList("test.FQNTest"), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames()); assertEquals(true, candidates.isUpToDate(), "Input: " + code + ", up-to-date=" + candidates.isUpToDate()); } diff --git a/test/langtools/jdk/jshell/ConsoleTest.java b/test/langtools/jdk/jshell/ConsoleTest.java index c6ddddac44b0..aaffbc1d1cb9 100644 --- a/test/langtools/jdk/jshell/ConsoleTest.java +++ b/test/langtools/jdk/jshell/ConsoleTest.java @@ -26,7 +26,7 @@ * @bug 8298425 * @summary Verify behavior of System.console() * @build KullaTesting TestingInputStream - * @run testng ConsoleTest + * @run junit ConsoleTest */ import java.io.IOError; @@ -43,8 +43,8 @@ import jdk.jshell.JShell; import jdk.jshell.JShellConsole; -import org.testng.annotations.Test; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; public class ConsoleTest extends KullaTesting { @@ -60,7 +60,7 @@ public Charset charset() { console = new ThrowingJShellConsole() { @Override public String readLine(String prompt) throws IOError { - assertEquals(prompt, "expected"); + assertEquals("expected", prompt); return "AB"; } }; @@ -68,7 +68,7 @@ public String readLine(String prompt) throws IOError { console = new ThrowingJShellConsole() { @Override public char[] readPassword(String prompt) throws IOError { - assertEquals(prompt, "expected"); + assertEquals("expected", prompt); return "AB".toCharArray(); } }; @@ -116,7 +116,7 @@ public void flush() { console = new ThrowingJShellConsole() { @Override public String readLine(String prompt) throws IOError { - assertEquals(prompt, "expected"); + assertEquals("expected", prompt); return "AB"; } }; @@ -144,7 +144,32 @@ public void close() throws IOException {} int count = 1_000; assertEval("for (int i = 0; i < " + count + "; i++) System.console().writer().write(\"A\");"); String expected = "A".repeat(count); - assertEquals(sb.toString(), expected); + assertEquals(expected, sb.toString()); + } + + @Test + public void testConsoleUnicodeWritingTest() { + StringBuilder sb = new StringBuilder(); + console = new ThrowingJShellConsole() { + @Override + public PrintWriter writer() { + return new PrintWriter(new Writer() { + @Override + public void write(char[] cbuf, int off, int len) throws IOException { + sb.append(cbuf, off, len); + } + @Override + public void flush() throws IOException {} + @Override + public void close() throws IOException {} + }); + } + }; + int count = 384; // 128-255, 384-511, 640-767, ... (JDK-8355371) + String testStr = "\u30A2"; // Japanese katakana (A2 >= 80) (JDK-8354910) + assertEval("System.console().writer().write(\"" + testStr + "\".repeat(" + count + "))"); + String expected = testStr.repeat(count); + assertEquals(expected, sb.toString()); } @Test @@ -180,7 +205,7 @@ public void close() throws IOException {} """.replace("${repeats}", "" + repeats) .replace("${output}", "" + output)); String expected = "A".repeat(repeats * output); - assertEquals(sb.toString(), expected); + assertEquals(expected, sb.toString()); } @Override diff --git a/test/langtools/jdk/jshell/CustomInputToolBuilder.java b/test/langtools/jdk/jshell/CustomInputToolBuilder.java index 523981b3d915..f6fdf97ae1ee 100644 --- a/test/langtools/jdk/jshell/CustomInputToolBuilder.java +++ b/test/langtools/jdk/jshell/CustomInputToolBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @summary Verify JavaShellToolBuilder uses provided inputs * @modules jdk.jshell * @build KullaTesting TestingInputStream - * @run testng CustomInputToolBuilder + * @run junit CustomInputToolBuilder */ import java.io.ByteArrayInputStream; @@ -38,15 +38,14 @@ import java.util.HashMap; import java.util.List; import jdk.jshell.tool.JavaShellToolBuilder; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertTrue; - -@Test public class CustomInputToolBuilder extends KullaTesting { private static final String TEST_JDK = "test.jdk"; + @Test public void checkCustomInput() throws Exception { String testJdk = System.getProperty(TEST_JDK); try { @@ -102,6 +101,7 @@ private void doTest(boolean interactiveTerminal, String code, String... expected } } + @Test public void checkInteractiveTerminal() throws Exception { String testJdk = System.getProperty(TEST_JDK); try { diff --git a/test/langtools/jdk/jshell/DropTest.java b/test/langtools/jdk/jshell/DropTest.java index e277d1cbeea4..1501d391a4d9 100644 --- a/test/langtools/jdk/jshell/DropTest.java +++ b/test/langtools/jdk/jshell/DropTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,20 +26,20 @@ * @bug 8081431 8080069 8167128 8199623 * @summary Test of JShell#drop(). * @build KullaTesting TestingInputStream - * @run testng DropTest + * @run junit DropTest */ import jdk.jshell.DeclarationSnippet; import jdk.jshell.Snippet; import jdk.jshell.MethodSnippet; import jdk.jshell.VarSnippet; -import org.testng.annotations.Test; import static jdk.jshell.Snippet.Status.*; +import org.junit.jupiter.api.Test; -@Test public class DropTest extends KullaTesting { + @Test public void testDrop() { Snippet var = varKey(assertEval("int x;")); Snippet method = methodKey(assertEval("int mu() { return x * 4; }")); @@ -88,6 +88,7 @@ public void testDrop() { assertActiveKeys(); } + @Test public void testDropImport() { Snippet imp = importKey(assertEval("import java.util.*;")); Snippet decl = varKey( @@ -101,11 +102,13 @@ public void testDropImport() { assertDeclareFail("list;", "compiler.err.cant.resolve.location"); } + @Test public void testDropStatement() { Snippet x = key(assertEval("if (true);")); assertDrop(x, ste(x, VALID, DROPPED, true, null)); } + @Test public void testDropVarToMethod() { Snippet x = varKey(assertEval("int x;")); DeclarationSnippet method = methodKey(assertEval("double mu() { return x * 4; }")); @@ -123,6 +126,7 @@ public void testDropVarToMethod() { assertActiveKeys(); } + @Test public void testDropMethodToMethod() { Snippet a = methodKey(assertEval("double a() { return 2; }")); DeclarationSnippet b = methodKey(assertEval("double b() { return a() * 10; }")); @@ -139,6 +143,7 @@ public void testDropMethodToMethod() { assertActiveKeys(); } + @Test public void testDropClassToMethod() { Snippet c = classKey(assertEval("class C { int f() { return 7; } }")); DeclarationSnippet m = methodKey(assertEval("int m() { return new C().f(); }")); @@ -150,6 +155,7 @@ public void testDropClassToMethod() { assertActiveKeys(); } + @Test public void testDropVarToClass() { Snippet x = varKey(assertEval("int x;")); DeclarationSnippet a = classKey(assertEval("class A { double a = 4 * x; }")); @@ -165,6 +171,7 @@ public void testDropVarToClass() { assertActiveKeys(); } + @Test public void testDropMethodToClass() { Snippet x = methodKey(assertEval("int x() { return 0; }")); DeclarationSnippet a = classKey(assertEval("class A { double a = 4 * x(); }")); @@ -179,6 +186,7 @@ public void testDropMethodToClass() { assertActiveKeys(); } + @Test public void testDropClassToClass() { Snippet a = classKey(assertEval("class A {}")); Snippet b = classKey(assertEval("class B extends A {}")); @@ -204,6 +212,7 @@ public void testDropClassToClass() { assertActiveKeys(); } + @Test public void testDropNoUpdate() { String as1 = "class A {}"; String as2 = "class A extends java.util.ArrayList {}"; @@ -228,6 +237,7 @@ public void testDropNoUpdate() { } // 8199623 + @Test public void testTwoForkedDrop() { MethodSnippet p = methodKey(assertEval("void p() throws Exception { ((String) null).toString(); }")); MethodSnippet n = methodKey(assertEval("void n() throws Exception { try { p(); } catch (Exception ex) { throw new RuntimeException(\"bar\", ex); }}")); diff --git a/test/langtools/jdk/jshell/EditorTestBase.java b/test/langtools/jdk/jshell/EditorTestBase.java index 422d07ba1c8f..a384c09fcb13 100644 --- a/test/langtools/jdk/jshell/EditorTestBase.java +++ b/test/langtools/jdk/jshell/EditorTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,10 +25,10 @@ import java.util.concurrent.Executors; import java.util.function.Consumer; -import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public abstract class EditorTestBase extends ReplToolTesting { @@ -61,11 +61,11 @@ void assertEditOutput(boolean after, String cmd, Consumer checkOutput, A } void assertEditInput(boolean after, String cmd, String input, Action action) { - assertEditInput(after, cmd, s -> assertEquals(s, input, "Input"), action); + assertEditInput(after, cmd, s -> assertEquals(input, s, "Input"), action); } void assertEditOutput(boolean after, String cmd, String output, Action action) { - assertEditOutput(after, cmd, s -> assertEquals(s.trim(), output.trim(), "command"), action); + assertEditOutput(after, cmd, s -> assertEquals(output.trim(), s.trim(), "command"), action); } @Test @@ -219,16 +219,15 @@ public void testEditMethod2() { @Test public void testNoArguments() { - testEditor( - a -> assertVariable(a, "int", "a"), + testEditor(a -> assertVariable(a, "int", "a"), a -> assertMethod(a, "void f() {}", "()void", "f"), a -> assertClass(a, "class A {}", "class", "A"), a -> assertEditInput(a, "/ed", s -> { String[] ss = s.split("\n"); - assertEquals(ss.length, 3, "Expected 3 lines: " + s); - assertEquals(ss[0], "int a;"); - assertEquals(ss[1], "void f() {}"); - assertEquals(ss[2], "class A {}"); + assertEquals(3, ss.length, "Expected 3 lines: " + s); + assertEquals("int a;", ss[0]); + assertEquals("void f() {}", ss[1]); + assertEquals("class A {}", ss[2]); }, this::exit) ); } @@ -263,7 +262,8 @@ public void testAccept() { ); } - @Test(enabled = false) // TODO JDK-8191875 + @Test // TODO JDK-8191875 + @Disabled public void testStatementMush() { testEditor( a -> assertCommand(a, "System.out.println(\"Hello\")", diff --git a/test/langtools/jdk/jshell/EmptyTest.java b/test/langtools/jdk/jshell/EmptyTest.java index 6e838432220f..937ab04cb2d9 100644 --- a/test/langtools/jdk/jshell/EmptyTest.java +++ b/test/langtools/jdk/jshell/EmptyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,34 +25,39 @@ * @test * @summary null test * @build KullaTesting TestingInputStream - * @run testng EmptyTest + * @run junit EmptyTest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class EmptyTest extends KullaTesting { + @Test public void testEmpty() { assertEvalEmpty(""); } + @Test public void testSpace() { assertEvalEmpty(" "); } + @Test public void testSemicolon() { assertEval(";", ""); } + @Test public void testSlashStarComment() { assertEvalEmpty("/*test*/"); } + @Test public void testSlashStarCommentSemicolon() { assertEval("/*test*/;", ""); } + @Test public void testSlashComment() { assertEvalEmpty("// test"); } diff --git a/test/langtools/jdk/jshell/ErrorRecoveryTest.java b/test/langtools/jdk/jshell/ErrorRecoveryTest.java index f07db23f977b..5e4f2e9656c5 100644 --- a/test/langtools/jdk/jshell/ErrorRecoveryTest.java +++ b/test/langtools/jdk/jshell/ErrorRecoveryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,17 +31,17 @@ * jdk.jshell/jdk.internal.jshell.tool * @library /tools/lib * @build KullaTesting TestingInputStream ExpectedDiagnostic toolbox.ToolBox Compiler - * @run testng ErrorRecoveryTest + * @run junit ErrorRecoveryTest */ -import org.testng.annotations.Test; import static jdk.jshell.Snippet.Status.NONEXISTENT; import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED; import static jdk.jshell.Snippet.Status.REJECTED; +import org.junit.jupiter.api.Test; -@Test public class ErrorRecoveryTest extends KullaTesting { + @Test public void testExceptionErrors() { assertEval("import java.lang.annotation.Repeatable;"); assertEval(""" @@ -51,6 +51,7 @@ public void testExceptionErrors() { ste(MAIN_SNIPPET, NONEXISTENT, RECOVERABLE_NOT_DEFINED, false, null)); } + @Test public void testBrokenName() { assertEval("int strictfp = 0;", DiagCheck.DIAG_ERROR, @@ -58,6 +59,7 @@ public void testBrokenName() { ste(MAIN_SNIPPET, NONEXISTENT, REJECTED, false, null)); } + @Test public void testBooleanPatternExpression() { assertEval("Number n = 0;"); assertEval("if (!n instanceof Integer i) {}", diff --git a/test/langtools/jdk/jshell/ErrorTranslationTest.java b/test/langtools/jdk/jshell/ErrorTranslationTest.java index 4db2ff65469b..235f4443004c 100644 --- a/test/langtools/jdk/jshell/ErrorTranslationTest.java +++ b/test/langtools/jdk/jshell/ErrorTranslationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * jdk.jshell/jdk.internal.jshell.tool * @library /tools/lib * @build KullaTesting TestingInputStream ExpectedDiagnostic toolbox.ToolBox Compiler - * @run testng ErrorTranslationTest + * @run junit ErrorTranslationTest */ import java.nio.file.Path; @@ -41,15 +41,15 @@ import javax.tools.Diagnostic; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -@Test public class ErrorTranslationTest extends ReplToolTesting { - @Test(enabled = false) // TODO 8080353 + @Test // TODO 8080353 + @Disabled public void testErrors() { test( a -> assertDiagnostic(a, "abstract void f();", newExpectedDiagnostic(0, 8, 0, -1, -1, Diagnostic.Kind.ERROR)), @@ -60,6 +60,7 @@ public void testErrors() { ); } + @Test public void testlvtiErrors() { test( a -> assertDiagnostic(a, "var broken = () -> {};", newExpectedDiagnostic(0, 22, 0, -1, -1, Diagnostic.Kind.ERROR)), @@ -67,13 +68,15 @@ public void testlvtiErrors() { ); } + @Test public void testExceptionErrors() { test( a -> assertDiagnostic(a, "try { } catch (IllegalStateException | java.io.IOException ex) { }", newExpectedDiagnostic(39, 58, -1, -1, -1, Diagnostic.Kind.ERROR)) ); } - @Test(enabled = false) // TODO 8132147 + @Test // TODO 8132147 + @Disabled public void stressTest() { Compiler compiler = new Compiler(); Path oome = compiler.getPath("OOME.repl"); @@ -115,11 +118,11 @@ private Consumer assertDiagnostic(String expectedSource, ExpectedDiagnos throw new AssertionError("Not enough lines: " + s); } String kind = getKind(expectedDiagnostic.getKind()); - assertEquals(lines[0], kind); + assertEquals(kind, lines[0]); boolean found = false; for (int i = 0; i < lines.length; i++) { if (lines[i].endsWith(expectedSource)) { - assertEquals(lines[i + 1], expectedMarkingLine, "Input: " + expectedSource + ", marking line: "); + assertEquals(expectedMarkingLine, lines[i + 1], "Input: " + expectedSource + ", marking line: "); found = true; } } diff --git a/test/langtools/jdk/jshell/ExceptionMessageTest.java b/test/langtools/jdk/jshell/ExceptionMessageTest.java index fe8eec577392..c329afeb35e8 100644 --- a/test/langtools/jdk/jshell/ExceptionMessageTest.java +++ b/test/langtools/jdk/jshell/ExceptionMessageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @bug 8185108 * @summary Test exception().getMessage() in events returned by eval() - * @run testng ExceptionMessageTest + * @run junit ExceptionMessageTest * @key intermittent */ @@ -42,22 +42,23 @@ import jdk.jshell.spi.ExecutionControlProvider; import jdk.jshell.spi.ExecutionEnv; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; -@Test public class ExceptionMessageTest { + @Test public void testDefaultEC() { doTestCases(new JdiExecutionControlProvider(), "default"); } + @Test public void testLocalEC() { doTestCases(new LocalExecutionControlProvider(), "local"); } + @Test public void testDirectEC() { doTestCases(new ExecutionControlProvider() { public ExecutionControl generate(ExecutionEnv env, Map param) throws Throwable { @@ -85,11 +86,11 @@ private void doTestCases(ExecutionControlProvider ec, String label) { private void doTest(JShell jshell, String label, String code, String expected) { List result = jshell.eval(code); - assertEquals(result.size(), 1, "Expected only one event"); + assertEquals(1, result.size(), "Expected only one event"); SnippetEvent evt = result.get(0); Exception exc = evt.exception(); String out = exc.getMessage(); - assertEquals(out, expected, "Exception message not as expected: " + + assertEquals(expected, out, "Exception message not as expected: " + label + " -- " + code); } } diff --git a/test/langtools/jdk/jshell/ExceptionsTest.java b/test/langtools/jdk/jshell/ExceptionsTest.java index 765c3696f072..f7273b2a6fcd 100644 --- a/test/langtools/jdk/jshell/ExceptionsTest.java +++ b/test/langtools/jdk/jshell/ExceptionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * @library /tools/lib * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting TestingInputStream Compiler - * @run testng ExceptionsTest + * @run junit ExceptionsTest */ import java.io.IOException; @@ -46,16 +46,16 @@ import java.nio.file.Path; import java.nio.file.Paths; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.*; - -@Test public class ExceptionsTest extends KullaTesting { private final Compiler compiler = new Compiler(); private final Path outDir = Paths.get("test_class_path"); + @Test public void throwUncheckedException() { String message = "error_message"; SnippetEvent cr = assertEvalException("throw new RuntimeException(\"" + message + "\");"); @@ -64,6 +64,7 @@ public void throwUncheckedException() { newStackTraceElement("", "", cr.snippet(), 1))); } + @Test public void throwCheckedException() { String message = "error_message"; SnippetEvent cr = assertEvalException("throw new Exception(\"" + message + "\");"); @@ -72,6 +73,7 @@ public void throwCheckedException() { newStackTraceElement("", "", cr.snippet(), 1))); } + @Test public void throwFromStaticMethodOfClass() { String message = "error_message"; Snippet s1 = methodKey(assertEval("void f() { throw new RuntimeException(\"" + message + "\"); }")); @@ -84,6 +86,7 @@ public void throwFromStaticMethodOfClass() { newStackTraceElement("", "", cr3.snippet(), 1))); } + @Test public void throwFromStaticMethodOfInterface() { String message = "error_message"; Snippet s1 = methodKey(assertEval("void f() { throw new RuntimeException(\"" + message + "\"); }")); @@ -96,6 +99,7 @@ public void throwFromStaticMethodOfInterface() { newStackTraceElement("", "", cr3.snippet(), 1))); } + @Test public void throwChained() { String message1 = "error_message1"; String message2 = "error_message2"; @@ -122,6 +126,7 @@ public void throwChained() { newStackTraceElement("", "", cr4.snippet(), 1))); } + @Test public void throwChainedUnresolved() { String message1 = "error_message1"; String message2 = "error_message2"; @@ -144,6 +149,7 @@ public void throwChainedUnresolved() { newStackTraceElement("", "", cr4.snippet(), 1))); } + @Test public void throwFromConstructor() { String message = "error_message"; Snippet s1 = methodKey(assertEval("void f() { throw new RuntimeException(\"" + message + "\"); }")); @@ -156,6 +162,7 @@ public void throwFromConstructor() { newStackTraceElement("", "", cr3.snippet(), 1))); } + @Test public void throwFromDefaultMethodOfInterface() { String message = "error_message"; Snippet s1 = methodKey(assertEval("void f() { throw new RuntimeException(\"" + message + "\"); }")); @@ -168,6 +175,7 @@ public void throwFromDefaultMethodOfInterface() { newStackTraceElement("", "", cr3.snippet(), 1))); } + @Test public void throwFromLambda() { String message = "lambda"; Snippet s1 = varKey(assertEval( @@ -182,6 +190,7 @@ public void throwFromLambda() { newStackTraceElement("", "", cr2.snippet(), 1))); } + @Test public void throwFromAnonymousClass() { String message = "anonymous"; Snippet s1 = varKey(assertEval( @@ -198,6 +207,7 @@ public void throwFromAnonymousClass() { newStackTraceElement("", "", cr2.snippet(), 1))); } + @Test public void throwFromLocalClass() { String message = "local"; Snippet s1 = methodKey(assertEval( @@ -219,6 +229,7 @@ public void throwFromLocalClass() { } // test 8210527 + @Test public void throwFromWithoutSource() { String message = "show this"; SnippetEvent se = assertEvalException("java.lang.reflect.Proxy.newProxyInstance(" + @@ -232,6 +243,7 @@ public void throwFromWithoutSource() { } // test 8210527 + @Test public void throwFromNoSource() { Path path = outDir.resolve("fail"); compiler.compile(path, @@ -250,6 +262,7 @@ public void throwFromNoSource() { } // test 8212167 + @Test public void throwLineFormat1() { SnippetEvent se = assertEvalException( "if (true) { \n" + @@ -261,6 +274,7 @@ public void throwLineFormat1() { newStackTraceElement("", "", se.snippet(), 3))); } + @Test public void throwLineFormat3() { Snippet sp = methodKey(assertEval( "int p() \n" + @@ -292,13 +306,15 @@ public void throwLineFormat3() { newStackTraceElement("", "", se.snippet(), 1))); } - @Test(enabled = false) // TODO 8129427 + @Test // TODO 8129427 + @Disabled public void outOfMemory() { assertEval("import java.util.*;"); assertEval("List list = new ArrayList<>();"); assertExecuteException("while (true) { list.add(new byte[10000]); }", OutOfMemoryError.class); } + @Test public void stackOverflow() { assertEval("void f() { f(); }"); assertExecuteException("f();", StackOverflowError.class); @@ -361,11 +377,11 @@ private void assertExceptionMatch(Throwable exception, String source, ExceptionI EvalException ex = (EvalException) exception; String actualException = ex.getExceptionClassName(); String expectedException = exceptionInfo.exception.getCanonicalName(); - assertEquals(actualException, expectedException, + assertEquals(expectedException, actualException, String.format("Given \"%s\" expected exception: %s, got: %s%nStack trace:%n%s", source, expectedException, actualException, getStackTrace(ex))); if (exceptionInfo.message != null) { - assertEquals(ex.getMessage(), exceptionInfo.message, + assertEquals(exceptionInfo.message, ex.getMessage(), String.format("Given \"%s\" expected message: %s, got: %s", source, exceptionInfo.message, ex.getMessage())); } @@ -395,7 +411,7 @@ private void assertAnyExceptionMatch(Throwable exception, AnyExceptionInfo excep "Expected UnresolvedReferenceException: " + exception); UnresolvedExceptionInfo uei = (UnresolvedExceptionInfo) exceptionInfo; UnresolvedReferenceException ure = (UnresolvedReferenceException) exception; - assertEquals(ure.getSnippet(), uei.sn); + assertEquals(uei.sn, ure.getSnippet()); assertStackMatch(ure, "", exceptionInfo); } } @@ -405,20 +421,20 @@ private void assertStackTrace(StackTraceElement[] actual, StackTraceElement[] ex if (actual == null || expected == null) { fail(message); } else { - assertEquals(actual.length, expected.length, message + " : arrays do not have the same size"); + assertEquals(expected.length, actual.length, message + " : arrays do not have the same size"); for (int i = 0; i < actual.length; ++i) { StackTraceElement actualElement = actual[i]; StackTraceElement expectedElement = expected[i]; - assertEquals(actualElement.getClassName(), expectedElement.getClassName(), message + " : class names [" + i + "]"); + assertEquals(expectedElement.getClassName(), actualElement.getClassName(), message + " : class names [" + i + "]"); String expectedMethodName = expectedElement.getMethodName(); if (expectedMethodName.startsWith("lambda$")) { assertTrue(actualElement.getMethodName().startsWith("lambda$"), message + " : method names"); } else { - assertEquals(actualElement.getMethodName(), expectedElement.getMethodName(), message + " : method names [" + i + "]"); + assertEquals(expectedElement.getMethodName(), actualElement.getMethodName(), message + " : method names [" + i + "]"); } - assertEquals(actualElement.getFileName(), expectedElement.getFileName(), message + " : file names [" + i + "]"); + assertEquals(expectedElement.getFileName(), actualElement.getFileName(), message + " : file names [" + i + "]"); if (expectedElement.getLineNumber() >= 0) { - assertEquals(actualElement.getLineNumber(), expectedElement.getLineNumber(), message + " : line numbers [" + i + "]" + assertEquals(expectedElement.getLineNumber(), actualElement.getLineNumber(), message + " : line numbers [" + i + "]" + " -- actual: " + actualElement.getLineNumber() + ", expected: " + expectedElement.getLineNumber() + " -- in: " + actualElement.getClassName()); } diff --git a/test/langtools/jdk/jshell/ExecutionControlSpecTest.java b/test/langtools/jdk/jshell/ExecutionControlSpecTest.java index 920310bb1e55..14661030cf06 100644 --- a/test/langtools/jdk/jshell/ExecutionControlSpecTest.java +++ b/test/langtools/jdk/jshell/ExecutionControlSpecTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,20 +34,20 @@ * @library /tools/lib * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting Compiler - * @run testng ExecutionControlSpecTest + * @run junit ExecutionControlSpecTest */ import java.nio.file.Path; import java.nio.file.Paths; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class ExecutionControlSpecTest extends KullaTesting { ClassLoader ccl; - @BeforeMethod + @BeforeEach @Override public void setUp() { String mod = "my.ec"; @@ -86,7 +86,7 @@ public void setUp() { setUp(builder -> builder.executionEngine("prefixing")); } - @AfterMethod + @AfterEach @Override public void tearDown() { super.tearDown(); diff --git a/test/langtools/jdk/jshell/ExecutionControlTestBase.java b/test/langtools/jdk/jshell/ExecutionControlTestBase.java index 20336c902cff..a63e1b16569f 100644 --- a/test/langtools/jdk/jshell/ExecutionControlTestBase.java +++ b/test/langtools/jdk/jshell/ExecutionControlTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,11 +23,11 @@ import javax.tools.Diagnostic; -import org.testng.annotations.Test; import jdk.jshell.VarSnippet; import static jdk.jshell.Snippet.Status.VALID; import static jdk.jshell.Snippet.SubKind.*; +import org.junit.jupiter.api.Test; public class ExecutionControlTestBase extends KullaTesting { diff --git a/test/langtools/jdk/jshell/ExpectedDiagnostic.java b/test/langtools/jdk/jshell/ExpectedDiagnostic.java index 2416c9875b83..1fe96200e3c6 100644 --- a/test/langtools/jdk/jshell/ExpectedDiagnostic.java +++ b/test/langtools/jdk/jshell/ExpectedDiagnostic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ import javax.tools.Diagnostic; import jdk.jshell.Diag; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ExpectedDiagnostic { @@ -79,16 +79,16 @@ public Diagnostic.Kind getKind() { public void assertDiagnostic(Diag diagnostic) { String code = diagnostic.getCode(); - assertEquals(code, this.code, "Expected error: " + this.code + ", got: " + code); - assertEquals(diagnostic.isError(), kind == Diagnostic.Kind.ERROR); + assertEquals(this.code, code, "Expected error: " + this.code + ", got: " + code); + assertEquals(kind == Diagnostic.Kind.ERROR, diagnostic.isError()); if (startPosition != -1) { - assertEquals(diagnostic.getStartPosition(), startPosition, "Start position"); + assertEquals(startPosition, diagnostic.getStartPosition(), "Start position"); } if (endPosition != -1) { - assertEquals(diagnostic.getEndPosition(), endPosition, "End position"); + assertEquals(endPosition, diagnostic.getEndPosition(), "End position"); } if (position != -1) { - assertEquals(diagnostic.getPosition(), position, "Position"); + assertEquals(position, diagnostic.getPosition(), "Position"); } } } diff --git a/test/langtools/jdk/jshell/ExternalEditorTest.java b/test/langtools/jdk/jshell/ExternalEditorTest.java index 607637e207c4..cf1ae4f1ae2d 100644 --- a/test/langtools/jdk/jshell/ExternalEditorTest.java +++ b/test/langtools/jdk/jshell/ExternalEditorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @bug 8143955 8080843 8163816 8143006 8169828 8171130 8162989 8210808 * @modules jdk.jshell/jdk.internal.jshell.tool * @build ReplToolTesting CustomEditor EditorTestBase - * @run testng ExternalEditorTest + * @run junit ExternalEditorTest * @key intermittent */ @@ -47,15 +47,17 @@ import java.util.concurrent.Future; import java.util.function.Consumer; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import org.junit.jupiter.api.AfterAll; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ExternalEditorTest extends EditorTestBase { private static Path executionScript; @@ -133,21 +135,19 @@ public void testEditor(boolean defaultStartup, String[] args, ReplTest... tests) @Test public void testStatementSemicolonAddition() { - testEditor( - a -> assertCommand(a, "if (true) {}", ""), + testEditor(a -> assertCommand(a, "if (true) {}", ""), a -> assertCommand(a, "if (true) {} else {}", ""), a -> assertCommand(a, "Object o", "o ==> null"), a -> assertCommand(a, "if (true) o = new Object() { int x; }", ""), a -> assertCommand(a, "if (true) o = new Object() { int y; }", ""), a -> assertCommand(a, "System.err.flush()", ""), // test still ; for expression statement a -> assertEditOutput(a, "/ed", "", () -> { - assertEquals(getSource(), - "if (true) {}\n" + + assertEquals( "if (true) {}\n" + "if (true) {} else {}\n" + "Object o;\n" + "if (true) o = new Object() { int x; };\n" + "if (true) o = new Object() { int y; };\n" + - "System.err.flush();\n"); + "System.err.flush();\n", getSource()); exit(); }) ); @@ -173,7 +173,7 @@ private static boolean isWindows() { return System.getProperty("os.name").startsWith("Windows"); } - @BeforeClass + @BeforeAll public static void setUpExternalEditorTest() throws IOException { listener = new ServerSocket(0); listener.setSoTimeout(30000); @@ -250,7 +250,8 @@ public void setUnknownEditor() { ); } - @Test(enabled = false) // TODO 8159229 + @Test // TODO 8159229 + @Disabled public void testRemoveTempFile() { test(new String[]{"--no-startup"}, a -> assertCommandCheckOutput(a, "/set editor " + executionScript, @@ -264,7 +265,7 @@ public void testRemoveTempFile() { ); } - @AfterClass + @AfterAll public static void shutdown() throws IOException { executorShutdown(); if (listener != null) { diff --git a/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java b/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java index 99457ea2ce6d..c43ec747ffac 100644 --- a/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java +++ b/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ * @library /tools/lib * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting ExecutionControlTestBase Compiler - * @run testng FailOverDirectExecutionControlTest + * @run junit FailOverDirectExecutionControlTest * @key intermittent */ @@ -48,16 +48,15 @@ import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; import jdk.jshell.execution.FailOverExecutionControlProvider; import jdk.jshell.spi.ExecutionControlProvider; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; +import org.junit.jupiter.api.AfterEach; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class FailOverDirectExecutionControlTest extends ExecutionControlTestBase { ClassLoader ccl; @@ -93,7 +92,7 @@ public void close() throws SecurityException { } - @BeforeMethod + @BeforeEach @Override public void setUp() { logger = Logger.getLogger("jdk.jshell.execution"); @@ -134,7 +133,7 @@ public void setUp() { setUp(builder -> builder.executionEngine(provider, pm)); } - @AfterMethod + @AfterEach @Override public void tearDown() { super.tearDown(); @@ -144,11 +143,12 @@ public void tearDown() { } @Override + @Test public void variables() { super.variables(); - assertEquals(logged.get(Level.FINEST).size(), 1); - assertEquals(logged.get(Level.FINE).size(), 2); - assertEquals(logged.get(Level.WARNING).size(), 2); + assertEquals(1, logged.get(Level.FINEST).size()); + assertEquals(2, logged.get(Level.FINE).size()); + assertEquals(2, logged.get(Level.WARNING).size()); assertNull(logged.get(Level.SEVERE)); String log = logged.get(Level.WARNING).get(0); assertTrue(log.contains("Failure failover -- 0 = alwaysFailing"), log); diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java index 31011960880d..2e53b11b95a0 100644 --- a/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java +++ b/test/langtools/jdk/jshell/FailOverExecutionControlDyingLaunchTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,17 +28,15 @@ * @modules jdk.jshell/jdk.jshell.execution * jdk.jshell/jdk.jshell.spi * @build KullaTesting ExecutionControlTestBase DyingRemoteAgent - * @run testng FailOverExecutionControlDyingLaunchTest + * @run junit FailOverExecutionControlDyingLaunchTest * @key intermittent */ -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.BeforeEach; -@Test public class FailOverExecutionControlDyingLaunchTest extends ExecutionControlTestBase { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine( diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java index 9958b7a3284e..0de985b7a28e 100644 --- a/test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java +++ b/test/langtools/jdk/jshell/FailOverExecutionControlHangingLaunchTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,16 +28,14 @@ * @modules jdk.jshell/jdk.jshell.execution * jdk.jshell/jdk.jshell.spi * @build KullaTesting ExecutionControlTestBase - * @run testng FailOverExecutionControlHangingLaunchTest + * @run junit FailOverExecutionControlHangingLaunchTest */ -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.BeforeEach; -@Test public class FailOverExecutionControlHangingLaunchTest extends ExecutionControlTestBase { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine( diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java index 4f29bfe9c7a8..6d61bcb0322f 100644 --- a/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java +++ b/test/langtools/jdk/jshell/FailOverExecutionControlHangingListenTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,18 +28,16 @@ * @modules jdk.jshell/jdk.jshell.execution * jdk.jshell/jdk.jshell.spi * @build KullaTesting ExecutionControlTestBase - * @run testng FailOverExecutionControlHangingListenTest + * @run junit FailOverExecutionControlHangingListenTest * @key intermittent */ import java.net.InetAddress; -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.BeforeEach; -@Test public class FailOverExecutionControlHangingListenTest extends ExecutionControlTestBase { - @BeforeMethod + @BeforeEach @Override public void setUp() { String loopback = InetAddress.getLoopbackAddress().getHostAddress(); diff --git a/test/langtools/jdk/jshell/FailOverExecutionControlTest.java b/test/langtools/jdk/jshell/FailOverExecutionControlTest.java index 80dc56d72c48..579029af4c0e 100644 --- a/test/langtools/jdk/jshell/FailOverExecutionControlTest.java +++ b/test/langtools/jdk/jshell/FailOverExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,16 +28,14 @@ * @modules jdk.jshell/jdk.jshell.execution * jdk.jshell/jdk.jshell.spi * @build KullaTesting ExecutionControlTestBase - * @run testng FailOverExecutionControlTest + * @run junit FailOverExecutionControlTest */ -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.BeforeEach; -@Test public class FailOverExecutionControlTest extends ExecutionControlTestBase { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine("failover:0(expectedFailureNonExistent1), 1(expectedFailureNonExistent2), " diff --git a/test/langtools/jdk/jshell/FileManagerTest.java b/test/langtools/jdk/jshell/FileManagerTest.java index 9e4f063da9dd..c8c6a7dded71 100644 --- a/test/langtools/jdk/jshell/FileManagerTest.java +++ b/test/langtools/jdk/jshell/FileManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test 8173845 * @summary test custom file managers * @build KullaTesting TestingInputStream - * @run testng FileManagerTest + * @run junit FileManagerTest */ @@ -37,12 +37,10 @@ import javax.tools.JavaFileObject; import javax.tools.JavaFileObject.Kind; import javax.tools.StandardJavaFileManager; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertTrue; - -@Test public class FileManagerTest extends KullaTesting { boolean encountered; @@ -100,12 +98,13 @@ public Iterable getLocation(Location location) { } - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(b -> b.fileManager(fm -> new MyFileManager(fm))); } + @Test public void testSnippetMemberAssignment() { assertEval("java.lang.reflect.Array.get(new String[1], 0) == null"); assertTrue(encountered, "java.lang.reflect not encountered"); diff --git a/test/langtools/jdk/jshell/ForwardReferenceImportTest.java b/test/langtools/jdk/jshell/ForwardReferenceImportTest.java index 4e66eaa2196d..4459a424092f 100644 --- a/test/langtools/jdk/jshell/ForwardReferenceImportTest.java +++ b/test/langtools/jdk/jshell/ForwardReferenceImportTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,18 +25,18 @@ * @test 8173232 * @summary Test of forward referencing of snippets (related to import). * @build KullaTesting TestingInputStream - * @run testng ForwardReferenceImportTest + * @run junit ForwardReferenceImportTest */ import jdk.jshell.Snippet; import jdk.jshell.DeclarationSnippet; -import org.testng.annotations.Test; import static jdk.jshell.Snippet.Status.*; +import org.junit.jupiter.api.Test; -@Test public class ForwardReferenceImportTest extends KullaTesting { + @Test public void testImportDeclare() { Snippet singleImport = importKey(assertEval("import java.util.List;", added(VALID))); Snippet importOnDemand = importKey(assertEval("import java.util.*;", added(VALID))); @@ -57,6 +57,7 @@ public void testImportDeclare() { assertActiveKeys(); } + @Test public void testForwardSingleImportMethodToMethod() { DeclarationSnippet string = methodKey(assertEval("String string() { return format(\"string\"); }", added(RECOVERABLE_DEFINED))); @@ -76,6 +77,7 @@ public void testForwardSingleImportMethodToMethod() { assertActiveKeys(); } + @Test public void testForwardImportMethodOnDemandToMethod() { DeclarationSnippet string = methodKey(assertEval("String string() { return format(\"string\"); }", added(RECOVERABLE_DEFINED))); @@ -95,6 +97,7 @@ public void testForwardImportMethodOnDemandToMethod() { assertActiveKeys(); } + @Test public void testForwardSingleImportFieldToMethod() { DeclarationSnippet pi = methodKey(assertEval("double pi() { return PI; }", added(RECOVERABLE_DEFINED))); @@ -114,6 +117,7 @@ public void testForwardSingleImportFieldToMethod() { assertActiveKeys(); } + @Test public void testForwardImportFieldOnDemandToMethod() { DeclarationSnippet pi = methodKey(assertEval("double pi() { return PI; }", added(RECOVERABLE_DEFINED))); @@ -133,6 +137,7 @@ public void testForwardImportFieldOnDemandToMethod() { assertActiveKeys(); } + @Test public void testForwardSingleImportMethodToClass1() { Snippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }", added(RECOVERABLE_DEFINED))); @@ -153,6 +158,7 @@ public void testForwardSingleImportMethodToClass1() { ste(a, RECOVERABLE_DEFINED, VALID, false, format)); } + @Test public void testForwardSingleImportMethodToClass2() { Snippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }", added(RECOVERABLE_DEFINED))); @@ -173,6 +179,7 @@ public void testForwardSingleImportMethodToClass2() { ste(a, RECOVERABLE_DEFINED, VALID, false, format)); } + @Test public void testForwardSingleImportClassToClass1() { Snippet a = classKey(assertEval("class A { static List list; }", added(RECOVERABLE_NOT_DEFINED))); @@ -195,6 +202,7 @@ public void testForwardSingleImportClassToClass1() { ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, list)); } + @Test public void testForwardSingleImportClassToClass2() { Snippet clsA = classKey(assertEval("class A extends ArrayList { }", added(RECOVERABLE_NOT_DEFINED))); @@ -219,6 +227,7 @@ public void testForwardSingleImportClassToClass2() { ste(clsA, RECOVERABLE_NOT_DEFINED, VALID, true, arraylist)); } + @Test public void testForwardImportOnDemandMethodToClass1() { Snippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }", added(RECOVERABLE_DEFINED))); @@ -241,6 +250,7 @@ public void testForwardImportOnDemandMethodToClass1() { assertEval("x.s;", "\"10\""); } + @Test public void testForwardImportOnDemandMethodToClass2() { Snippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }", added(RECOVERABLE_DEFINED))); @@ -261,6 +271,7 @@ public void testForwardImportOnDemandMethodToClass2() { ste(a, RECOVERABLE_DEFINED, VALID, false, format)); } + @Test public void testForwardImportOnDemandClassToClass1() { Snippet a = classKey(assertEval("class A { static List list; }", added(RECOVERABLE_NOT_DEFINED))); @@ -282,6 +293,7 @@ public void testForwardImportOnDemandClassToClass1() { ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, list)); } + @Test public void testForwardImportOnDemandClassToClass2() { Snippet clsA = classKey(assertEval("class A extends ArrayList { }", added(RECOVERABLE_NOT_DEFINED))); @@ -305,6 +317,7 @@ public void testForwardImportOnDemandClassToClass2() { ste(vara, RECOVERABLE_NOT_DEFINED, VALID, true, clsA)); } + @Test public void testForwardSingleImportFieldToClass1() { Snippet a = classKey(assertEval("class A { static double pi() { return PI; } }", added(RECOVERABLE_DEFINED))); @@ -326,6 +339,7 @@ public void testForwardSingleImportFieldToClass1() { ste(a, RECOVERABLE_DEFINED, VALID, false, list)); } + @Test public void testForwardSingleImportFieldToClass2() { Snippet a = classKey(assertEval("class A { static double pi = PI; }", added(RECOVERABLE_DEFINED))); @@ -347,6 +361,7 @@ public void testForwardSingleImportFieldToClass2() { ste(a, RECOVERABLE_DEFINED, VALID, true, list)); } + @Test public void testForwardImportOnDemandFieldToClass1() { Snippet a = classKey(assertEval("class A { static double pi() { return PI; } }", added(RECOVERABLE_DEFINED))); @@ -368,6 +383,7 @@ public void testForwardImportOnDemandFieldToClass1() { ste(a, RECOVERABLE_DEFINED, VALID, false, list)); } + @Test public void testForwardImportOnDemandFieldToClass2() { Snippet a = classKey(assertEval("class A { static double pi = PI; }", added(RECOVERABLE_DEFINED))); diff --git a/test/langtools/jdk/jshell/ForwardReferenceTest.java b/test/langtools/jdk/jshell/ForwardReferenceTest.java index a010e9ed31a1..841b1f60a8ec 100644 --- a/test/langtools/jdk/jshell/ForwardReferenceTest.java +++ b/test/langtools/jdk/jshell/ForwardReferenceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test 8173232 8010319 * @summary Test of forward referencing of snippets. * @build KullaTesting TestingInputStream - * @run testng ForwardReferenceTest + * @run junit ForwardReferenceTest */ import java.util.List; @@ -33,17 +33,17 @@ import jdk.jshell.MethodSnippet; import jdk.jshell.VarSnippet; import jdk.jshell.DeclarationSnippet; -import org.testng.annotations.Test; import jdk.jshell.SnippetEvent; import jdk.jshell.UnresolvedReferenceException; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import static jdk.jshell.Snippet.Status.*; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; -@Test public class ForwardReferenceTest extends KullaTesting { + @Test public void testOverwriteMethodForwardReferenceClass() { Snippet k1 = methodKey(assertEval("int q(Boo b) { return b.x; }", added(RECOVERABLE_NOT_DEFINED))); @@ -56,6 +56,7 @@ public void testOverwriteMethodForwardReferenceClass() { assertActiveKeys(); } + @Test public void testOverwriteMethodForwardReferenceClassImport() { MethodSnippet k1 = methodKey(assertEval("int ff(List lis) { return lis.size(); }", added(RECOVERABLE_NOT_DEFINED))); @@ -68,6 +69,7 @@ public void testOverwriteMethodForwardReferenceClassImport() { assertActiveKeys(); } + @Test public void testForwardVarToMethod() { DeclarationSnippet t = methodKey(assertEval("int t() { return x; }", added(RECOVERABLE_DEFINED))); assertUnresolvedDependencies1(t, RECOVERABLE_DEFINED, "variable x"); @@ -87,6 +89,7 @@ public void testForwardVarToMethod() { assertActiveKeys(); } + @Test public void testForwardMethodToMethod() { Snippet t = methodKey(assertEval("int t() { return f(); }", added(RECOVERABLE_DEFINED))); Snippet f = methodKey(assertEval("int f() { return g(); }", @@ -109,6 +112,7 @@ public void testForwardMethodToMethod() { assertActiveKeys(); } + @Test public void testForwardClassToMethod() { DeclarationSnippet t = methodKey(assertEval("int t() { return new A().f(); }", added(RECOVERABLE_DEFINED))); assertUnresolvedDependencies1(t, RECOVERABLE_DEFINED, "class A"); @@ -133,6 +137,7 @@ public void testForwardClassToMethod() { assertActiveKeys(); } + @Test public void testForwardVarToClass() { DeclarationSnippet a = classKey(assertEval("class A { int f() { return g; } }", added(RECOVERABLE_DEFINED))); assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable g"); @@ -150,6 +155,7 @@ public void testForwardVarToClass() { assertActiveKeys(); } + @Test public void testForwardVarToClassGeneric() { DeclarationSnippet a = classKey(assertEval("class A { final T x; A(T v) { this.x = v; } ; T get() { return x; } int core() { return g; } }", added(RECOVERABLE_DEFINED))); assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable g"); @@ -159,9 +165,9 @@ public void testForwardVarToClassGeneric() { SnippetEvent ste = events.get(0); Snippet assn = ste.snippet(); DeclarationSnippet unsn = ((UnresolvedReferenceException) ste.exception()).getSnippet(); - assertEquals(unsn.name(), "A", "Wrong with unresolved"); - assertEquals(getState().unresolvedDependencies(unsn).count(), 1, "Wrong size unresolved"); - assertEquals(getState().diagnostics(unsn).count(), 0L, "Expected no diagnostics"); + assertEquals("A", unsn.name(), "Wrong with unresolved"); + assertEquals(1, getState().unresolvedDependencies(unsn).count(), "Wrong size unresolved"); + assertEquals(0L, getState().diagnostics(unsn).count(), "Expected no diagnostics"); Snippet g = varKey(assertEval("int g = 10;", "10", added(VALID), @@ -174,6 +180,7 @@ public void testForwardVarToClassGeneric() { assertActiveKeys(); } + @Test public void testForwardVarToClassExtendsImplements() { DeclarationSnippet ik = classKey(assertEval("interface I { default int ii() { return 1; } }", added(VALID))); DeclarationSnippet jk = classKey(assertEval("interface J { default int jj() { return 2; } }", added(VALID))); @@ -200,6 +207,7 @@ public void testForwardVarToClassExtendsImplements() { assertActiveKeys(); } + @Test public void testForwardVarToInterface() { DeclarationSnippet i = classKey(assertEval("interface I { default int f() { return x; } }", added(RECOVERABLE_DEFINED))); assertUnresolvedDependencies1(i, RECOVERABLE_DEFINED, "variable x"); @@ -215,6 +223,7 @@ public void testForwardVarToInterface() { assertActiveKeys(); } + @Test public void testForwardVarToEnum() { DeclarationSnippet a = classKey(assertEval("enum E { Q, W, E; float ff() { return fff; } }", added(RECOVERABLE_DEFINED))); assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable fff"); @@ -232,6 +241,7 @@ public void testForwardVarToEnum() { assertActiveKeys(); } + @Test public void testForwardMethodToClass() { DeclarationSnippet a = classKey(assertEval("class A { int f() { return g(); } }", added(RECOVERABLE_DEFINED))); assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "method g()"); @@ -251,6 +261,7 @@ public void testForwardMethodToClass() { assertActiveKeys(); } + @Test public void testForwardClassToClass1() { Snippet a = classKey(assertEval("class A { B b = new B(); }", added(RECOVERABLE_NOT_DEFINED))); assertDeclareFail("new A().b;", "compiler.err.cant.resolve.location"); @@ -269,6 +280,7 @@ public void testForwardClassToClass1() { assertActiveKeys(); } + @Test public void testForwardClassToClass2() { Snippet a = classKey(assertEval("class A extends B { }", added(RECOVERABLE_NOT_DEFINED))); assertDeclareFail("new A();", "compiler.err.cant.resolve.location"); @@ -287,6 +299,7 @@ public void testForwardClassToClass2() { assertActiveKeys(); } + @Test public void testForwardClassToClass3() { Snippet a = classKey(assertEval("interface A extends B { static int f() { return 10; } }", added(RECOVERABLE_NOT_DEFINED))); assertDeclareFail("A.f();", "compiler.err.cant.resolve.location"); @@ -305,12 +318,14 @@ public void testForwardClassToClass3() { assertActiveKeys(); } + @Test public void testForwardVariable() { assertEval("int f() { return x; }", added(RECOVERABLE_DEFINED)); assertEvalUnresolvedException("f();", "f", 1, 0); assertActiveKeys(); } + @Test public void testLocalClassInUnresolved() { Snippet f = methodKey(assertEval("void f() { class A {} g(); }", added(RECOVERABLE_DEFINED))); assertEval("void g() {}", diff --git a/test/langtools/jdk/jshell/GetResourceTest.java b/test/langtools/jdk/jshell/GetResourceTest.java index f8b2b1af2279..dfba8ed588be 100644 --- a/test/langtools/jdk/jshell/GetResourceTest.java +++ b/test/langtools/jdk/jshell/GetResourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,18 +27,18 @@ * @summary Check that ClassLoader.getResource works as expected in the JShell agent. * @modules jdk.jshell * @build KullaTesting TestingInputStream - * @run testng GetResourceTest + * @run junit GetResourceTest */ import jdk.jshell.Snippet; import static jdk.jshell.Snippet.Status.OVERWRITTEN; import static jdk.jshell.Snippet.Status.VALID; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class GetResourceTest extends KullaTesting { + @Test public void checkGetResource() { assertEval("import java.util.Arrays;"); assertEval("boolean match(byte[] data, byte[] snippet) {\n" + @@ -57,6 +57,7 @@ public void checkGetResource() { assertEval("test()", "true"); } + @Test public void checkRedefine() { assertEval("import java.util.Arrays;"); assertEval("boolean match(byte[] data, byte[] snippet) {\n" + @@ -85,6 +86,7 @@ public void checkRedefine() { assertEval("test()", "true"); } + @Test public void checkResourceSize() { assertEval("import java.net.*;"); assertEval("boolean test() throws Exception {\n" + @@ -97,6 +99,7 @@ public void checkResourceSize() { assertEval("test()", "true"); } + @Test public void checkTimestampCheck() { assertEval("import java.net.*;"); assertEval("import java.time.*;"); @@ -138,6 +141,7 @@ public void checkTimestampCheck() { assertEval("nue[0] == nue[2]", "true"); } + @Test public void checkFieldAccess() { assertEval("import java.net.*;"); assertEval("Class c = new Object() {}.getClass().getEnclosingClass();"); @@ -154,6 +158,7 @@ public void checkFieldAccess() { assertEval("connection.getHeaderField(3) == null", "true"); } + @Test public void checkGetResources() { assertEval("import java.net.*;"); assertEval("Class c = new Object() {}.getClass().getEnclosingClass();"); diff --git a/test/langtools/jdk/jshell/HighlightUITest.java b/test/langtools/jdk/jshell/HighlightUITest.java index ede22e8f0107..22403d5ae7e0 100644 --- a/test/langtools/jdk/jshell/HighlightUITest.java +++ b/test/langtools/jdk/jshell/HighlightUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8274148 * @summary Check the UI behavior of snippet highligting @@ -35,18 +35,18 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build Compiler UITesting * @compile HighlightUITest.java - * @run testng HighlightUITest + * @run junit HighlightUITest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class HighlightUITest extends UITesting { public HighlightUITest() { super(true); } + @Test public void testHighlight() throws Exception { System.setProperty("test.enable.highlighter", "true"); doRunTest((inputSink, out) -> { diff --git a/test/langtools/jdk/jshell/HistoryTest.java b/test/langtools/jdk/jshell/HistoryTest.java index a07523d54cb2..923d064c18ae 100644 --- a/test/langtools/jdk/jshell/HistoryTest.java +++ b/test/langtools/jdk/jshell/HistoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ * @modules jdk.internal.le/jdk.internal.org.jline.reader * jdk.jshell/jdk.internal.jshell.tool:+open * @build HistoryTest - * @run testng HistoryTest + * @run junit HistoryTest */ import java.lang.reflect.Field; @@ -37,12 +37,12 @@ import java.util.logging.Level; import java.util.logging.Logger; -import org.testng.annotations.Test; import jdk.internal.jshell.tool.JShellTool; import jdk.internal.jshell.tool.JShellToolBuilder; import jdk.internal.org.jline.reader.History; -import static org.testng.Assert.*; -import org.testng.annotations.BeforeMethod; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class HistoryTest extends ReplToolTesting { @@ -180,16 +180,16 @@ public void testReadExistingHistory() { } assertCommand(a, "/exit", ""); }); - assertEquals(prefsMap.get("HISTORY_LINE_00"), "/debug 0"); - assertEquals(prefsMap.get("HISTORY_LINE_01"), "void test() {\\"); - assertEquals(prefsMap.get("HISTORY_LINE_02"), " System.err.println(1);\\"); - assertEquals(prefsMap.get("HISTORY_LINE_03"), " System.err.println(`\\\\\\\\\\"); - assertEquals(prefsMap.get("HISTORY_LINE_04"), " \\\\\\"); - assertEquals(prefsMap.get("HISTORY_LINE_05"), "`);\\"); - assertEquals(prefsMap.get("HISTORY_LINE_06"), "} //test"); - assertEquals(prefsMap.get("HISTORY_LINE_07"), "/debug 0"); - assertEquals(prefsMap.get("HISTORY_LINE_08"), "int i"); - assertEquals(prefsMap.get("HISTORY_LINE_09"), "/exit"); + assertEquals("/debug 0", prefsMap.get("HISTORY_LINE_00")); + assertEquals("void test() {\\", prefsMap.get("HISTORY_LINE_01")); + assertEquals(" System.err.println(1);\\", prefsMap.get("HISTORY_LINE_02")); + assertEquals(" System.err.println(`\\\\\\\\\\", prefsMap.get("HISTORY_LINE_03")); + assertEquals(" \\\\\\", prefsMap.get("HISTORY_LINE_04")); + assertEquals("`);\\", prefsMap.get("HISTORY_LINE_05")); + assertEquals("} //test", prefsMap.get("HISTORY_LINE_06")); + assertEquals("/debug 0", prefsMap.get("HISTORY_LINE_07")); + assertEquals("int i", prefsMap.get("HISTORY_LINE_08")); + assertEquals("/exit", prefsMap.get("HISTORY_LINE_09")); System.err.println("prefsMap: " + prefsMap); } @@ -204,10 +204,10 @@ private History getHistory() throws Exception { private void previousAndAssert(History history, String expected) { assertTrue(history.previous()); - assertEquals(history.current().toString(), expected); + assertEquals(expected, history.current().toString()); } - @BeforeMethod + @BeforeEach public void setUp() { super.setUp(); System.setProperty("jshell.test.allow.incomplete.inputs", "false"); diff --git a/test/langtools/jdk/jshell/HistoryUITest.java b/test/langtools/jdk/jshell/HistoryUITest.java index 42e242fe1e6e..aa10010e270a 100644 --- a/test/langtools/jdk/jshell/HistoryUITest.java +++ b/test/langtools/jdk/jshell/HistoryUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8178077 8232856 * @summary Check the UI behavior of editing history. @@ -35,18 +35,18 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build Compiler UITesting * @compile HistoryUITest.java - * @run testng HistoryUITest + * @run junit HistoryUITest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class HistoryUITest extends UITesting { public HistoryUITest() { super(true); } + @Test public void testPrevNextSnippet() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("void test1() {\nSystem.err.println(1);\n}\n"); @@ -78,6 +78,7 @@ public void testPrevNextSnippet() throws Exception { }); } + @Test public void testReRun() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("System.err.println(\"RAN\");\n"); diff --git a/test/langtools/jdk/jshell/IOTest.java b/test/langtools/jdk/jshell/IOTest.java index 112b956fec31..988b73ec071e 100644 --- a/test/langtools/jdk/jshell/IOTest.java +++ b/test/langtools/jdk/jshell/IOTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,28 +25,29 @@ * @test * @summary Test input/output * @build KullaTesting TestingInputStream - * @run testng IOTest + * @run junit IOTest */ -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; - -@Test public class IOTest extends KullaTesting { String LINE_SEPARATOR = System.getProperty("line.separator"); + @Test public void testOutput() { assertEval("System.out.println(\"Test\");"); - assertEquals(getOutput(), "Test" + LINE_SEPARATOR); + assertEquals("Test" + LINE_SEPARATOR, getOutput()); } + @Test public void testErrorOutput() { assertEval("System.err.println(\"Oops\");"); - assertEquals(getErrorOutput(), "Oops" + LINE_SEPARATOR); + assertEquals("Oops" + LINE_SEPARATOR, getErrorOutput()); } + @Test public void testInput() { setInput("x"); assertEval("(char)System.in.read();", "'x'"); diff --git a/test/langtools/jdk/jshell/IdGeneratorTest.java b/test/langtools/jdk/jshell/IdGeneratorTest.java index e8a38dfe7f05..521c87b02657 100644 --- a/test/langtools/jdk/jshell/IdGeneratorTest.java +++ b/test/langtools/jdk/jshell/IdGeneratorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @summary Test custom id generators * @build KullaTesting TestingInputStream - * @run testng IdGeneratorTest + * @run junit IdGeneratorTest */ import java.io.ByteArrayOutputStream; @@ -38,12 +38,10 @@ import jdk.jshell.SnippetEvent; import jdk.jshell.UnresolvedReferenceException; import jdk.jshell.VarSnippet; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -@Test public class IdGeneratorTest { public JShell.Builder getBuilder() { @@ -57,6 +55,7 @@ public JShell.Builder getBuilder() { .executionEngine(Presets.TEST_DEFAULT_EXECUTION); } + @Test public void testTempNameGenerator() { JShell.Builder builder = getBuilder().tempVariableNameGenerator(new Supplier() { int count = 0; @@ -69,11 +68,12 @@ public String get() { try (JShell jShell = builder.build()) { for (int i = 0; i < 3; ++i) { VarSnippet v = (VarSnippet) jShell.eval("2 + " + (i + 1)).get(0).snippet(); - assertEquals("temp" + (i + 1), v.name(), "Custom id: "); + assertEquals(v.name(), "temp" + (i + 1), "Custom id: "); } } } + @Test public void testResetTempNameGenerator() { JShell.Builder builder = getBuilder().tempVariableNameGenerator(() -> { throw new AssertionError("Should not be called"); @@ -83,6 +83,7 @@ public void testResetTempNameGenerator() { } } + @Test public void testIdGenerator() { JShell.Builder builder = getBuilder().idGenerator(((snippet, id) -> "custom" + id)); try (JShell jShell = builder.build()) { @@ -99,6 +100,7 @@ private void checkIds(List events) { } } + @Test public void testIdInException() { JShell.Builder builder = getBuilder().idGenerator(((snippet, id) -> "custom" + id)); try (JShell jShell = builder.build()) { @@ -116,6 +118,7 @@ public void testIdInException() { } } + @Test public void testResetIdGenerator() { JShell.Builder builder = getBuilder().idGenerator((sn, id) -> { throw new AssertionError("Should not be called"); diff --git a/test/langtools/jdk/jshell/IgnoreTest.java b/test/langtools/jdk/jshell/IgnoreTest.java index 023b5c99ac89..4350ce0cac30 100644 --- a/test/langtools/jdk/jshell/IgnoreTest.java +++ b/test/langtools/jdk/jshell/IgnoreTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,20 +26,20 @@ * @bug 8129559 8246353 8247456 * @summary Test the ignoring of comments and certain modifiers * @build KullaTesting TestingInputStream - * @run testng IgnoreTest + * @run junit IgnoreTest */ -import org.testng.annotations.Test; import jdk.jshell.MethodSnippet; import jdk.jshell.TypeDeclSnippet; import jdk.jshell.VarSnippet; import static jdk.jshell.Snippet.Status.VALID; import static jdk.jshell.Snippet.SubKind.*; +import org.junit.jupiter.api.Test; -@Test public class IgnoreTest extends KullaTesting { + @Test public void testComment() { assertVarKeyMatch("//t1\n int//t2\n x//t3\n =//t4\n 12//t5\n ;//t6\n", true, "x", VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, "int", added(VALID)); @@ -58,6 +58,7 @@ public void testComment() { false, "f", METHOD_SUBKIND, added(VALID)); } + @Test public void testVarModifier() { VarSnippet x1 = varKey(assertEval("public int x1;")); assertVariableDeclSnippet(x1, "x1", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0); @@ -71,6 +72,7 @@ public void testVarModifier() { assertVariableDeclSnippet(x5, "x5", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0); } + @Test public void testVarModifierAnnotation() { assertEval("@interface A { int value() default 0; }"); VarSnippet x1 = varKey(assertEval("@A public int x1;")); @@ -85,6 +87,7 @@ public void testVarModifierAnnotation() { assertVariableDeclSnippet(x5, "x5", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0); } + @Test public void testVarModifierOtherModifier() { VarSnippet x1 = varKey(assertEval("volatile public int x1;")); assertVariableDeclSnippet(x1, "x1", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0); @@ -98,12 +101,14 @@ public void testVarModifierOtherModifier() { assertVariableDeclSnippet(x5, "x5", "int", VALID, VAR_DECLARATION_SUBKIND, 0, 0); } + @Test public void testMisplacedIgnoredModifier() { assertEvalFail("int public y;"); assertEvalFail("String private x;"); assertEvalFail("(protected 34);"); } + @Test public void testMethodModifier() { MethodSnippet m4 = methodKey(assertEval("static void m4() {}")); assertMethodDeclSnippet(m4, "m4", "()void", VALID, 0, 0); @@ -111,6 +116,7 @@ public void testMethodModifier() { assertMethodDeclSnippet(m5, "m5", "()void", VALID, 0, 0); } + @Test public void testMethodModifierAnnotation() { assertEval("@interface A { int value() default 0; }"); MethodSnippet m4 = methodKey(assertEval("@A static void m4() {}")); @@ -119,6 +125,7 @@ public void testMethodModifierAnnotation() { assertMethodDeclSnippet(m5, "m5", "()void", VALID, 0, 0); } + @Test public void testClassModifier() { TypeDeclSnippet c4 = classKey(assertEval("static class C4 {}")); assertTypeDeclSnippet(c4, "C4", VALID, CLASS_SUBKIND, 0, 0); @@ -126,6 +133,7 @@ public void testClassModifier() { assertTypeDeclSnippet(c5, "C5", VALID, CLASS_SUBKIND, 0, 0); } + @Test public void testInsideModifier() { assertEval("import static java.lang.reflect.Modifier.*;"); assertEval("class C {" diff --git a/test/langtools/jdk/jshell/IllegalArgumentExceptionTest.java b/test/langtools/jdk/jshell/IllegalArgumentExceptionTest.java index 3ba5910e8b59..f43778bb4655 100644 --- a/test/langtools/jdk/jshell/IllegalArgumentExceptionTest.java +++ b/test/langtools/jdk/jshell/IllegalArgumentExceptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @summary Testing IllegalArgumentException. * @build KullaTesting TestingInputStream IllegalArgumentExceptionTest - * @run testng IllegalArgumentExceptionTest + * @run junit IllegalArgumentExceptionTest */ import java.util.function.Consumer; @@ -33,12 +33,10 @@ import jdk.jshell.DeclarationSnippet; import jdk.jshell.Snippet; import jdk.jshell.VarSnippet; -import org.testng.annotations.Test; - -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import static jdk.jshell.Snippet.Status.VALID; +import org.junit.jupiter.api.Test; -@Test public class IllegalArgumentExceptionTest extends KullaTesting { private void testIllegalArgumentException(Consumer action) { @@ -54,22 +52,27 @@ private void testIllegalArgumentException(Consumer action) { } } + @Test public void testVarValue() { testIllegalArgumentException((key) -> getState().varValue((VarSnippet) key)); } + @Test public void testStatus() { testIllegalArgumentException((key) -> getState().status(key)); } + @Test public void testDrop() { testIllegalArgumentException((key) -> getState().drop(key)); } + @Test public void testUnresolved() { testIllegalArgumentException((key) -> getState().unresolvedDependencies((DeclarationSnippet) key)); } + @Test public void testDiagnostics() { testIllegalArgumentException((key) -> getState().diagnostics(key)); } diff --git a/test/langtools/jdk/jshell/ImportTest.java b/test/langtools/jdk/jshell/ImportTest.java index e09490052cff..a3d61ed691b9 100644 --- a/test/langtools/jdk/jshell/ImportTest.java +++ b/test/langtools/jdk/jshell/ImportTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,14 +23,14 @@ /* * @test - * @bug 8141415 + * @bug 8141415 8129418 * @summary Test imports * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * @library /tools/lib * @build KullaTesting TestingInputStream toolbox.Task.ExpectedDiagnostic - * @run testng ImportTest + * @run junit ImportTest */ import java.nio.file.Path; @@ -39,7 +39,6 @@ import javax.tools.Diagnostic; import jdk.jshell.Snippet; -import org.testng.annotations.Test; import static jdk.jshell.Snippet.Status.VALID; import static jdk.jshell.Snippet.Status.OVERWRITTEN; @@ -47,10 +46,13 @@ import static jdk.jshell.Snippet.SubKind.SINGLE_STATIC_IMPORT_SUBKIND; import static jdk.jshell.Snippet.SubKind.TYPE_IMPORT_ON_DEMAND_SUBKIND; import static jdk.jshell.Snippet.SubKind.STATIC_IMPORT_ON_DEMAND_SUBKIND; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; -@Test public class ImportTest extends KullaTesting { + @Test public void testImport() { assertImportKeyMatch("import java.util.List;", "List", SINGLE_TYPE_IMPORT_SUBKIND, added(VALID)); assertImportKeyMatch("import java.util.ArrayList;", "ArrayList", SINGLE_TYPE_IMPORT_SUBKIND, added(VALID)); @@ -59,6 +61,7 @@ public void testImport() { assertEval("list.size();", "1"); } + @Test public void testImportOnDemand() { assertImportKeyMatch("import java.util.*;", "java.util.*", TYPE_IMPORT_ON_DEMAND_SUBKIND, added(VALID)); assertEval("List list = new ArrayList<>();"); @@ -66,40 +69,46 @@ public void testImportOnDemand() { assertEval("list.size();", "1"); } + @Test public void testImportStatic() { assertImportKeyMatch("import static java.lang.Math.PI;", "PI", SINGLE_STATIC_IMPORT_SUBKIND, added(VALID)); assertEval("Double.valueOf(PI).toString().substring(0, 16).equals(\"3.14159265358979\");", "true"); } + @Test public void testImportStaticOnDemand() { assertImportKeyMatch("import static java.lang.Math.*;", "java.lang.Math.*", STATIC_IMPORT_ON_DEMAND_SUBKIND, added(VALID)); assertEval("abs(cos(PI / 2)) < 0.00001;", "true"); } - @Test(enabled = false) // TODO 8129418 + @Test public void testUnknownPackage() { assertDeclareFail("import unknown.qqq;", new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 18, 14, -1, -1, Diagnostic.Kind.ERROR)); assertDeclareFail("import unknown.*;", - new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 15, 7, -1, -1, Diagnostic.Kind.ERROR)); + new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 14, 7, -1, -1, Diagnostic.Kind.ERROR)); } + @Test public void testBogusImportIgnoredInFuture() { assertDeclareFail("import unknown.qqq;", "compiler.err.doesnt.exist"); assertDeclareFail("import unknown.*;", "compiler.err.doesnt.exist"); assertEval("2 + 2;"); } + @Test public void testBadImport() { assertDeclareFail("import static java.lang.reflect.Modifier;", new ExpectedDiagnostic("compiler.err.cant.resolve.location", 14, 31, 23, -1, -1, Diagnostic.Kind.ERROR)); } + @Test public void testBadSyntaxImport() { assertDeclareFail("import not found.*;", new ExpectedDiagnostic("compiler.err.expected", 10, 10, 10, -1, -1, Diagnostic.Kind.ERROR)); } + @Test public void testImportRedefinition() { Compiler compiler = new Compiler(); Path path = Paths.get("testImport"); @@ -140,6 +149,7 @@ public void testImportRedefinition() { assertEval("new ArrayList();", "MyInnerList"); } + @Test public void testImportMemberRedefinition() { Compiler compiler = new Compiler(); Path path = Paths.get("testImport"); @@ -164,6 +174,7 @@ public void testImportMemberRedefinition() { assertEval("method();", "\"A\""); } + @Test public void testImportWithComment() { assertImportKeyMatch("import java.util.List;//comment", "List", SINGLE_TYPE_IMPORT_SUBKIND, added(VALID)); assertEval("List l = null;"); diff --git a/test/langtools/jdk/jshell/InaccessibleExpressionTest.java b/test/langtools/jdk/jshell/InaccessibleExpressionTest.java index 9e6c95fd3f71..db82067d3dea 100644 --- a/test/langtools/jdk/jshell/InaccessibleExpressionTest.java +++ b/test/langtools/jdk/jshell/InaccessibleExpressionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,23 +29,21 @@ * jdk.jdeps/com.sun.tools.javap * @library /tools/lib * @build KullaTesting Compiler - * @run testng InaccessibleExpressionTest + * @run junit InaccessibleExpressionTest */ import java.nio.file.Path; import java.nio.file.Paths; -import org.testng.annotations.BeforeMethod; import jdk.jshell.VarSnippet; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; - -@Test public class InaccessibleExpressionTest extends KullaTesting { - @BeforeMethod + @BeforeEach @Override public void setUp() { Path path = Paths.get("eit"); @@ -76,20 +74,22 @@ public void setUp() { .compilerOptions("--class-path", tpath)); } + @Test public void testExternal() { assertEval("import static priv.GetPriv.*;"); VarSnippet down = varKey(assertEval("down()", "Packp")); - assertEquals(down.typeName(), "priv.Packp"); + assertEquals("priv.Packp", down.typeName()); assertEval(down.name() + ".get()", "5"); VarSnippet list = varKey(assertEval("list()", "[]")); - assertEquals(list.typeName(), "priv.MyList"); + assertEquals("priv.MyList", list.typeName()); assertEval(list.name() + ".size()", "0"); VarSnippet one = varKey(assertEval("priv()", "One")); - assertEquals(one.typeName(), "priv.GetPriv.Count"); + assertEquals("priv.GetPriv.Count", one.typeName()); assertEval("var v = down();", "Packp"); assertDeclareFail("v.toString()", "compiler.err.not.def.access.class.intf.cant.access"); } + @Test public void testInternal() { assertEval( "class Top {" + @@ -98,7 +98,7 @@ public void testInternal() { " }" + " Inner n = new Inner(); }"); VarSnippet n = varKey(assertEval("new Top().n", "Inner")); - assertEquals(n.typeName(), "Top.Inner"); + assertEquals("Top.Inner", n.typeName()); } } diff --git a/test/langtools/jdk/jshell/IndentUITest.java b/test/langtools/jdk/jshell/IndentUITest.java index 6858277a179f..a771b9b10318 100644 --- a/test/langtools/jdk/jshell/IndentUITest.java +++ b/test/langtools/jdk/jshell/IndentUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8241950 8247932 * @summary Check the UI behavior of indentation @@ -35,18 +35,18 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build Compiler UITesting * @compile IndentUITest.java - * @run testng IndentUITest + * @run junit IndentUITest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class IndentUITest extends UITesting { public IndentUITest() { super(true); } + @Test public void testIdent() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("void test1() {\nSystem.err.println(1);\n}\n"); diff --git a/test/langtools/jdk/jshell/InferTypeTest.java b/test/langtools/jdk/jshell/InferTypeTest.java index 080697666a29..a1455306f45e 100644 --- a/test/langtools/jdk/jshell/InferTypeTest.java +++ b/test/langtools/jdk/jshell/InferTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,14 +30,14 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler - * @run testng InferTypeTest + * @run junit InferTypeTest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class InferTypeTest extends KullaTesting { + @Test public void testTypeInference() { assertInferredType("1", "int"); assertEval("import java.util.*;"); diff --git a/test/langtools/jdk/jshell/JShellQueryTest.java b/test/langtools/jdk/jshell/JShellQueryTest.java index 352e639a29c4..e487c294f3b1 100644 --- a/test/langtools/jdk/jshell/JShellQueryTest.java +++ b/test/langtools/jdk/jshell/JShellQueryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,21 +26,21 @@ * @bug 8143964 * @summary test queries to the JShell that return Streams * @build KullaTesting - * @run testng JShellQueryTest + * @run junit JShellQueryTest */ import jdk.jshell.Snippet; -import org.testng.annotations.Test; import jdk.jshell.ImportSnippet; import jdk.jshell.MethodSnippet; import jdk.jshell.TypeDeclSnippet; import jdk.jshell.VarSnippet; import static java.util.stream.Collectors.joining; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; -@Test public class JShellQueryTest extends KullaTesting { + @Test public void testSnippets() { assertStreamMatch(getState().snippets()); VarSnippet sx = varKey(assertEval("int x = 5;")); @@ -54,6 +54,7 @@ public void testSnippets() { assertStreamMatch(getState().snippets(), sx, sfoo, smm, svv, sc, si, simp); } + @Test public void testVars() { assertStreamMatch(getState().variables()); VarSnippet sx = varKey(assertEval("int x = 5;")); @@ -67,6 +68,7 @@ public void testVars() { assertStreamMatch(getState().variables(), sx, sfoo); } + @Test public void testMethods() { assertStreamMatch(getState().methods()); VarSnippet sx = varKey(assertEval("int x = 5;")); @@ -79,6 +81,7 @@ public void testMethods() { assertStreamMatch(getState().methods(), smm, svv); } + @Test public void testTypes() { assertStreamMatch(getState().types()); VarSnippet sx = varKey(assertEval("int x = 5;")); @@ -91,6 +94,7 @@ public void testTypes() { assertStreamMatch(getState().types(), sc, si); } + @Test public void testImports() { assertStreamMatch(getState().imports()); VarSnippet sx = varKey(assertEval("int x = 5;")); @@ -103,6 +107,7 @@ public void testImports() { assertStreamMatch(getState().imports(), simp); } + @Test public void testDiagnostics() { Snippet sx = varKey(assertEval("int x = 5;")); assertStreamMatch(getState().diagnostics(sx)); @@ -110,9 +115,10 @@ public void testDiagnostics() { String res = getState().diagnostics(broken) .map(d -> d.getCode()) .collect(joining("+")); - assertEquals(res, "compiler.err.cant.resolve.location.args+compiler.err.prob.found.req"); + assertEquals("compiler.err.cant.resolve.location.args+compiler.err.prob.found.req", res); } + @Test public void testUnresolvedDependencies() { VarSnippet sx = varKey(assertEval("int x = 5;")); assertStreamMatch(getState().unresolvedDependencies(sx)); diff --git a/test/langtools/jdk/jshell/JShellStateClosedTest.java b/test/langtools/jdk/jshell/JShellStateClosedTest.java index 2f8d12156671..62044dc1f2f1 100644 --- a/test/langtools/jdk/jshell/JShellStateClosedTest.java +++ b/test/langtools/jdk/jshell/JShellStateClosedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test 8164277 * @summary Testing IllegalStateException. * @build KullaTesting TestingInputStream JShellStateClosedTest - * @run testng JShellStateClosedTest + * @run junit JShellStateClosedTest */ import java.util.function.Consumer; @@ -36,11 +36,9 @@ import jdk.jshell.Snippet; import jdk.jshell.TypeDeclSnippet; import jdk.jshell.VarSnippet; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.fail; - -@Test public class JShellStateClosedTest extends KullaTesting { private void testStateClosedException(Runnable action) { @@ -53,6 +51,7 @@ private void testStateClosedException(Runnable action) { } } + @Test public void testClasses() { TypeDeclSnippet sc = classKey(assertEval("class C { }")); TypeDeclSnippet si = classKey(assertEval("interface I { }")); @@ -60,6 +59,7 @@ public void testClasses() { assertStreamMatch(getState().types(), sc, si); } + @Test public void testVariables() { VarSnippet sx = varKey(assertEval("int x = 5;")); VarSnippet sfoo = varKey(assertEval("String foo;")); @@ -67,6 +67,7 @@ public void testVariables() { assertStreamMatch(getState().variables(), sx, sfoo); } + @Test public void testMethods() { MethodSnippet smm = methodKey(assertEval("int mm() { return 6; }")); MethodSnippet svv = methodKey(assertEval("void vv() { }")); @@ -74,12 +75,14 @@ public void testMethods() { assertStreamMatch(getState().methods(), smm, svv); } + @Test public void testImports() { ImportSnippet simp = importKey(assertEval("import java.lang.reflect.*;")); getState().close(); assertStreamMatch(getState().imports(), simp); } + @Test public void testSnippets() { VarSnippet sx = varKey(assertEval("int x = 5;")); VarSnippet sfoo = varKey(assertEval("String foo;")); @@ -92,6 +95,7 @@ public void testSnippets() { assertStreamMatch(getState().snippets(), sx, sfoo, smm, svv, sc, si, simp); } + @Test public void testEval() { testStateClosedException(() -> getState().eval("int a;")); } @@ -117,22 +121,27 @@ private void testStateClosedWithoutException(Consumer action) { } } + @Test public void testStatus() { testStateClosedWithoutException((key) -> getState().status(key)); } + @Test public void testVarValue() { testStateClosedException((key) -> getState().varValue((VarSnippet) key)); } + @Test public void testDrop() { testStateClosedException((key) -> getState().drop(key)); } + @Test public void testUnresolved() { testStateClosedWithoutException((key) -> getState().unresolvedDependencies((DeclarationSnippet) key)); } + @Test public void testDiagnostics() { testStateClosedWithoutException((key) -> getState().diagnostics(key)); } diff --git a/test/langtools/jdk/jshell/JavadocTest.java b/test/langtools/jdk/jshell/JavadocTest.java index 184921adf9a9..463c23a4f31a 100644 --- a/test/langtools/jdk/jshell/JavadocTest.java +++ b/test/langtools/jdk/jshell/JavadocTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * jdk.jshell/jdk.jshell:open * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting TestingInputStream Compiler - * @run testng JavadocTest + * @run junit JavadocTest */ import java.io.IOException; @@ -43,13 +43,13 @@ import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class JavadocTest extends KullaTesting { private final Compiler compiler = new Compiler(); + @Test public void testJavadoc() { prepareZip(); assertJavadoc("test.Clazz|", "test.Clazz\n" + @@ -65,6 +65,7 @@ public void testJavadoc() { assertJavadoc("clz.undef|"); } + @Test public void testVariableInRepl() { assertEval("Object o;"); assertSignature("o|", "o:java.lang.Object"); @@ -107,6 +108,7 @@ private void prepareZip() { addToClasspath(compiler.getClassDir()); } + @Test public void testCollectionsMin() { prepareJavaUtilZip(); assertJavadoc("java.util.Collections.min(|", diff --git a/test/langtools/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java b/test/langtools/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java index 0a5d531eff7f..4922bad214fc 100644 --- a/test/langtools/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiBadOptionLaunchExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,22 +26,22 @@ * @bug 8169519 8166581 * @summary Tests for JDI connector failure * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution - * @run testng JdiBadOptionLaunchExecutionControlTest + * @run junit JdiBadOptionLaunchExecutionControlTest */ import java.util.logging.Level; import java.util.logging.Logger; -import org.testng.annotations.Test; import jdk.jshell.JShell; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -@Test public class JdiBadOptionLaunchExecutionControlTest { private static final String EXPECTED_ERROR = "Launching JShell execution engine threw: Failed remote launch: java.util.concurrent.ExecutionException: com.sun.jdi.connect.VMStartException: VM initialization failed"; + @Test public void badOptionLaunchTest() { try { // turn on logging of launch failures diff --git a/test/langtools/jdk/jshell/JdiBadOptionListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiBadOptionListenExecutionControlTest.java index 5ce3f3d7ab67..6bc5e6eadc2f 100644 --- a/test/langtools/jdk/jshell/JdiBadOptionListenExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiBadOptionListenExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,22 +26,22 @@ * @bug 8169519 8166581 * @summary Tests for JDI connector failure * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution - * @run testng JdiBadOptionListenExecutionControlTest + * @run junit JdiBadOptionListenExecutionControlTest */ import java.util.logging.Level; import java.util.logging.Logger; -import org.testng.annotations.Test; import jdk.jshell.JShell; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -@Test public class JdiBadOptionListenExecutionControlTest { private static final String EXPECTED_ERROR = "Unrecognized option: -BadBadOption"; + @Test public void badOptionListenTest() { try { // turn on logging of launch failures diff --git a/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java index 03659952279e..7f0924229b73 100644 --- a/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiBogusHostListenExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,17 +26,16 @@ * @bug 8169519 8168615 8176474 * @summary Tests for JDI connector failure * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution - * @run testng JdiBogusHostListenExecutionControlTest + * @run junit JdiBogusHostListenExecutionControlTest */ import java.util.logging.Level; import java.util.logging.Logger; -import org.testng.annotations.Test; import jdk.jshell.JShell; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -@Test public class JdiBogusHostListenExecutionControlTest { private static final String EXPECTED_ERROR = @@ -44,6 +43,7 @@ public class JdiBogusHostListenExecutionControlTest { private static final String EXPECTED_LOCATION = "@ com.sun.jdi.SocketListen"; + @Test public void badOptionListenTest() { try { // turn on logging of launch failures diff --git a/test/langtools/jdk/jshell/JdiFailingLaunchExecutionControlTest.java b/test/langtools/jdk/jshell/JdiFailingLaunchExecutionControlTest.java index 288983a05e52..6ce9df1ccf44 100644 --- a/test/langtools/jdk/jshell/JdiFailingLaunchExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiFailingLaunchExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,19 +27,19 @@ * @summary Tests for JDI connector failure * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution * @build DyingRemoteAgent - * @run testng JdiFailingLaunchExecutionControlTest + * @run junit JdiFailingLaunchExecutionControlTest */ -import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -@Test public class JdiFailingLaunchExecutionControlTest { private static final String EXPECTED_ERROR = "Launching JShell execution engine threw: Accept timed out"; + @Test public void failLaunchTest() { try { System.err.printf("Unexpected return value: %s\n", DyingRemoteAgent.state(true, null).eval("33;")); diff --git a/test/langtools/jdk/jshell/JdiFailingListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiFailingListenExecutionControlTest.java index aaa3357a754f..d8b524585519 100644 --- a/test/langtools/jdk/jshell/JdiFailingListenExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiFailingListenExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,19 +27,19 @@ * @summary Tests for JDI connector failure * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution * @build DyingRemoteAgent - * @run testng JdiFailingListenExecutionControlTest + * @run junit JdiFailingListenExecutionControlTest */ -import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -@Test public class JdiFailingListenExecutionControlTest { private static final String EXPECTED_ERROR = "Launching JShell execution engine threw: Accept timed out"; + @Test public void failListenTest() { try { System.err.printf("Unexpected return value: %s\n", DyingRemoteAgent.state(true, null).eval("33;")); diff --git a/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java b/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java index 577228d48209..a0c0751395d2 100644 --- a/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiHangingLaunchExecutionControlTest.java @@ -27,19 +27,19 @@ * @summary Tests for JDI connector timeout failure * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution * @build HangingRemoteAgent - * @run testng JdiHangingLaunchExecutionControlTest + * @run junit JdiHangingLaunchExecutionControlTest */ -import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -@Test public class JdiHangingLaunchExecutionControlTest { private static final String EXPECTED_ERROR = "Launching JShell execution engine threw: Accept timed out"; + @Test public void hangLaunchTimeoutTest() { try { System.err.printf("Unexpected return value: %s\n", diff --git a/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java b/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java index 2e9b04a634b2..2013b0809a25 100644 --- a/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiHangingListenExecutionControlTest.java @@ -27,20 +27,20 @@ * @summary Tests for JDI connector timeout failure * @modules jdk.jshell/jdk.jshell jdk.jshell/jdk.jshell.spi jdk.jshell/jdk.jshell.execution * @build HangingRemoteAgent - * @run testng JdiHangingListenExecutionControlTest + * @run junit JdiHangingListenExecutionControlTest * @key intermittent */ -import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Test; -@Test public class JdiHangingListenExecutionControlTest { private static final String EXPECTED_ERROR = "Launching JShell execution engine threw: Accept timed out"; + @Test public void hangListenTimeoutTest() { try { System.err.printf("Unexpected return value: %s\n", diff --git a/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java b/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java index af9dce89bcf4..35261ff6fa1a 100644 --- a/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiLaunchingExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,18 +27,16 @@ * @summary Tests for standard JDI connector (without failover) -- launching * @modules jdk.jshell/jdk.jshell.execution * @build KullaTesting ExecutionControlTestBase - * @run testng JdiLaunchingExecutionControlTest + * @run junit JdiLaunchingExecutionControlTest * @key intermittent */ -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.BeforeEach; -@Test public class JdiLaunchingExecutionControlTest extends ExecutionControlTestBase { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine("jdi:launch(true)")); diff --git a/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java b/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java index 700ec077e34f..3cc2a9785a3c 100644 --- a/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiListeningExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,18 +27,16 @@ * @summary Tests for alternate JDI connector -- listening * @modules jdk.jshell/jdk.jshell.execution * @build KullaTesting ExecutionControlTestBase - * @run testng JdiListeningExecutionControlTest + * @run junit JdiListeningExecutionControlTest * @key intermittent */ -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.BeforeEach; -@Test public class JdiListeningExecutionControlTest extends ExecutionControlTestBase { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine("jdi")); diff --git a/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java b/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java index 241774d639e0..2e38e9f9aaef 100644 --- a/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java +++ b/test/langtools/jdk/jshell/JdiListeningLocalhostExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,18 +27,16 @@ * @summary Tests for alternate JDI connector -- listening to "localhost" * @modules jdk.jshell/jdk.jshell.execution * @build KullaTesting ExecutionControlTestBase - * @run testng JdiListeningLocalhostExecutionControlTest + * @run junit JdiListeningLocalhostExecutionControlTest * @key intermittent */ -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.BeforeEach; -@Test public class JdiListeningLocalhostExecutionControlTest extends ExecutionControlTestBase { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine("jdi:hostname(localhost)")); diff --git a/test/langtools/jdk/jshell/KullaCompletenessStressTest.java b/test/langtools/jdk/jshell/KullaCompletenessStressTest.java index e79e043dd10c..16274fa924e0 100644 --- a/test/langtools/jdk/jshell/KullaCompletenessStressTest.java +++ b/test/langtools/jdk/jshell/KullaCompletenessStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,15 @@ * @summary Test SourceCodeAnalysis * @modules jdk.compiler/com.sun.tools.javac.api * @build KullaTesting TestingInputStream KullaCompletenessStressTest CompletenessStressTest - * @run testng KullaCompletenessStressTest + * @run junit KullaCompletenessStressTest */ import java.io.File; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.TestInstance; -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class KullaCompletenessStressTest extends CompletenessStressTest { @Override public File[] getDirectoriesToTest() { @@ -44,11 +45,10 @@ public File[] getDirectoriesToTest() { } else { file = new File(src, "../../../src/jdk.jshell/share/classes"); } - if (!file.exists()) { - System.out.println("jdk.jshell sources are not exist. Test has been skipped. Path: " + file.toString()); - return new File[]{}; - }else { - return new File[]{file}; - } + + Assumptions.assumeTrue(file.exists(), + "jdk.jshell sources are not exist. Test has been skipped. Path: " + file.toString()); + + return new File[]{file}; } } diff --git a/test/langtools/jdk/jshell/KullaTesting.java b/test/langtools/jdk/jshell/KullaTesting.java index d74f3484f4bd..9689b812e0ae 100644 --- a/test/langtools/jdk/jshell/KullaTesting.java +++ b/test/langtools/jdk/jshell/KullaTesting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,8 +71,6 @@ import jdk.jshell.SourceCodeAnalysis.QualifiedNames; import jdk.jshell.SourceCodeAnalysis.Suggestion; import jdk.jshell.UnresolvedReferenceException; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; import jdk.jshell.Diag; @@ -80,9 +78,11 @@ import static java.util.stream.Collectors.toSet; import static jdk.jshell.Snippet.Status.*; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import static jdk.jshell.Snippet.SubKind.METHOD_SUBKIND; import jdk.jshell.SourceCodeAnalysis.Documentation; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; public class KullaTesting { @@ -166,7 +166,7 @@ public void addToClasspath(Path path) { addToClasspath(path.toString()); } - @BeforeMethod + @BeforeEach public void setUp() { setUp(b -> {}); } @@ -202,7 +202,7 @@ public int read(byte[] b, int off, int len) throws IOException { idToSnippet = new LinkedHashMap<>(); } - @AfterMethod + @AfterEach public void tearDown() { if (state != null) state.close(); state = null; @@ -226,16 +226,16 @@ public ClassLoader createAndRunFromModule(String moduleName, Path modPath) { public List assertUnresolvedDependencies(DeclarationSnippet key, int unresolvedSize) { List unresolved = getState().unresolvedDependencies(key).collect(toList()); - assertEquals(unresolved.size(), unresolvedSize, "Input: " + key.source() + ", checking unresolved: "); + assertEquals(unresolvedSize, unresolved.size(), "Input: " + key.source() + ", checking unresolved: "); return unresolved; } public DeclarationSnippet assertUnresolvedDependencies1(DeclarationSnippet key, Status status, String name) { List unresolved = assertUnresolvedDependencies(key, 1); String input = key.source(); - assertEquals(unresolved.size(), 1, "Given input: " + input + ", checking unresolved"); - assertEquals(unresolved.get(0), name, "Given input: " + input + ", checking unresolved: "); - assertEquals(getState().status(key), status, "Given input: " + input + ", checking status: "); + assertEquals(1, unresolved.size(), "Given input: " + input + ", checking unresolved"); + assertEquals(name, unresolved.get(0), "Given input: " + input + ", checking unresolved: "); + assertEquals(status, getState().status(key), "Given input: " + input + ", checking status: "); return key; } @@ -243,24 +243,24 @@ public DeclarationSnippet assertEvalUnresolvedException(String input, String nam List events = assertEval(input, null, UnresolvedReferenceException.class, DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, null); SnippetEvent ste = events.get(0); DeclarationSnippet sn = ((UnresolvedReferenceException) ste.exception()).getSnippet(); - assertEquals(sn.name(), name, "Given input: " + input + ", checking name"); - assertEquals(getState().unresolvedDependencies(sn).count(), unresolvedSize, "Given input: " + input + ", checking unresolved"); - assertEquals(getState().diagnostics(sn).count(), (long) diagnosticsSize, "Given input: " + input + ", checking diagnostics"); + assertEquals(name, sn.name(), "Given input: " + input + ", checking name"); + assertEquals(unresolvedSize, getState().unresolvedDependencies(sn).count(), "Given input: " + input + ", checking unresolved"); + assertEquals((long) diagnosticsSize, getState().diagnostics(sn).count(), "Given input: " + input + ", checking diagnostics"); return sn; } public Snippet assertKeyMatch(String input, boolean isExecutable, SubKind expectedSubKind, STEInfo mainInfo, STEInfo... updates) { Snippet key = key(assertEval(input, IGNORE_VALUE, mainInfo, updates)); String source = key.source(); - assertEquals(source, input, "Key \"" + input + "\" source mismatch, got: " + source + ", expected: " + input); + assertEquals(input, source, "Key \"" + input + "\" source mismatch, got: " + source + ", expected: " + input); SubKind subkind = key.subKind(); - assertEquals(subkind, expectedSubKind, "Key \"" + input + "\" subkind mismatch, got: " + assertEquals(expectedSubKind, subkind, "Key \"" + input + "\" subkind mismatch, got: " + subkind + ", expected: " + expectedSubKind); - assertEquals(subkind.isExecutable(), isExecutable, "Key \"" + input + "\", expected isExecutable: " + assertEquals(isExecutable, subkind.isExecutable(), "Key \"" + input + "\", expected isExecutable: " + isExecutable + ", got: " + subkind.isExecutable()); Snippet.Kind expectedKind = getKind(key); - assertEquals(key.kind(), expectedKind, "Checking kind: "); - assertEquals(expectedSubKind.kind(), expectedKind, "Checking kind: "); + assertEquals(expectedKind, key.kind(), "Checking kind: "); + assertEquals(expectedKind, expectedSubKind.kind(), "Checking kind: "); return key; } @@ -309,9 +309,9 @@ public ImportSnippet assertImportKeyMatch(String input, String name, SubKind sub assertTrue(key instanceof ImportSnippet, "Expected an ImportKey, got: " + key.getClass().getName()); ImportSnippet importKey = (ImportSnippet) key; - assertEquals(importKey.name(), name, "Input \"" + input + + assertEquals(name, importKey.name(), "Input \"" + input + "\" name mismatch, got: " + importKey.name() + ", expected: " + name); - assertEquals(importKey.kind(), Kind.IMPORT, "Checking kind: "); + assertEquals(Kind.IMPORT, importKey.kind(), "Checking kind: "); return importKey; } @@ -320,7 +320,7 @@ public DeclarationSnippet assertDeclarationKeyMatch(String input, boolean isExec assertTrue(key instanceof DeclarationSnippet, "Expected a DeclarationKey, got: " + key.getClass().getName()); DeclarationSnippet declKey = (DeclarationSnippet) key; - assertEquals(declKey.name(), name, "Input \"" + input + + assertEquals(name, declKey.name(), "Input \"" + input + "\" name mismatch, got: " + declKey.name() + ", expected: " + name); return declKey; } @@ -330,9 +330,9 @@ public VarSnippet assertVarKeyMatch(String input, boolean isExecutable, String n assertTrue(sn instanceof VarSnippet, "Expected a VarKey, got: " + sn.getClass().getName()); VarSnippet variableKey = (VarSnippet) sn; String signature = variableKey.typeName(); - assertEquals(signature, typeName, "Key \"" + input + + assertEquals(typeName, signature, "Key \"" + input + "\" typeName mismatch, got: " + signature + ", expected: " + typeName); - assertEquals(variableKey.kind(), Kind.VAR, "Checking kind: "); + assertEquals(Kind.VAR, variableKey.kind(), "Checking kind: "); return variableKey; } @@ -340,11 +340,11 @@ public void assertExpressionKeyMatch(String input, String name, SubKind kind, St Snippet key = assertKeyMatch(input, true, kind, added(VALID)); assertTrue(key instanceof ExpressionSnippet, "Expected a ExpressionKey, got: " + key.getClass().getName()); ExpressionSnippet exprKey = (ExpressionSnippet) key; - assertEquals(exprKey.name(), name, "Input \"" + input + + assertEquals(name, exprKey.name(), "Input \"" + input + "\" name mismatch, got: " + exprKey.name() + ", expected: " + name); - assertEquals(exprKey.typeName(), typeName, "Key \"" + input + + assertEquals(typeName, exprKey.typeName(), "Key \"" + input + "\" typeName mismatch, got: " + exprKey.typeName() + ", expected: " + typeName); - assertEquals(exprKey.kind(), Kind.EXPRESSION, "Checking kind: "); + assertEquals(Kind.EXPRESSION, exprKey.kind(), "Checking kind: "); } // For expressions throwing an EvalException @@ -402,7 +402,7 @@ public List assertEval(String input, void assertStreamMatch(Stream result, T... expected) { Set sns = result.collect(toSet()); Set exp = Stream.of(expected).collect(toSet()); - assertEquals(sns, exp); + assertEquals(exp, sns); } private Map closure(List events) { @@ -483,9 +483,9 @@ private List checkEvents(Supplier> toTest, }); List events = toTest.get(); getState().unsubscribe(token); - assertEquals(dispatched.size(), events.size(), "dispatched event size not the same as event size"); + assertEquals(events.size(), dispatched.size(), "dispatched event size not the same as event size"); for (int i = events.size() - 1; i >= 0; --i) { - assertEquals(dispatched.get(i), events.get(i), "Event element " + i + " does not match"); + assertEquals(events.get(i), dispatched.get(i), "Event element " + i + " does not match"); } dispatched.add(null); // mark end of dispatchs @@ -499,11 +499,11 @@ private List checkEvents(Supplier> toTest, if (old != null) { switch (evt.status()) { case DROPPED: - assertEquals(old, evt.snippet(), + assertEquals(evt.snippet(), old, "Drop: Old snippet must be what is dropped -- input: " + descriptor); break; case OVERWRITTEN: - assertEquals(old, evt.snippet(), + assertEquals(evt.snippet(), old, "Overwrite: Old snippet (" + old + ") must be what is overwritten -- input: " + descriptor + " -- " + evt); @@ -511,12 +511,12 @@ private List checkEvents(Supplier> toTest, default: if (evt.causeSnippet() == null) { // New source - assertNotEquals(old, evt.snippet(), + assertNotEquals(evt.snippet(), old, "New source: Old snippet must be different from the replacing -- input: " + descriptor); } else { // An update (key Overwrite??) - assertEquals(old, evt.snippet(), + assertEquals(evt.snippet(), old, "Update: Old snippet must be equal to the replacing -- input: " + descriptor); } @@ -556,7 +556,7 @@ private List checkEvents(Supplier> toTest, int impactId = 0; Map> groupedEvents = groupByCauseSnippet(events); - assertEquals(groupedEvents.size(), eventChains.length, "Number of main events"); + assertEquals(eventChains.length, groupedEvents.size(), "Number of main events"); for (Map.Entry> entry : groupedEvents.entrySet()) { EventChain eventChain = eventChains[impactId++]; SnippetEvent main = entry.getValue().get(0); @@ -579,12 +579,12 @@ private List checkEvents(Supplier> toTest, } } if (((Object) eventChain.value) != IGNORE_VALUE) { - assertEquals(main.value(), eventChain.value, "Expected execution value of: " + eventChain.value + + assertEquals(eventChain.value, main.value(), "Expected execution value of: " + eventChain.value + ", but got: " + main.value()); } if (eventChain.exceptionClass != IGNORE_EXCEPTION) { if (main.exception() == null) { - assertEquals(eventChain.exceptionClass, null, "Expected an exception of class " + assertEquals(null, eventChain.exceptionClass, "Expected an exception of class " + eventChain.exceptionClass + " got no exception"); } else if (eventChain.exceptionClass == null) { fail("Expected no exception but got " + main.exception().toString()); @@ -597,7 +597,7 @@ private List checkEvents(Supplier> toTest, List diagnostics = getState().diagnostics(mainKey).collect(toList()); switch (diagMain) { case DIAG_OK: - assertEquals(diagnostics.size(), 0, "Expected no diagnostics, got: " + diagnosticsToString(diagnostics)); + assertEquals(0, diagnostics.size(), "Expected no diagnostics, got: " + diagnosticsToString(diagnostics)); break; case DIAG_WARNING: assertFalse(hasFatalError(diagnostics), "Expected no errors, got: " + diagnosticsToString(diagnostics)); @@ -611,7 +611,7 @@ private List checkEvents(Supplier> toTest, diagnostics = getState().diagnostics(ste.snippet()).collect(toList()); switch (diagUpdates) { case DIAG_OK: - assertEquals(diagnostics.size(), 0, "Expected no diagnostics, got: " + diagnosticsToString(diagnostics)); + assertEquals(0, diagnostics.size(), "Expected no diagnostics, got: " + diagnosticsToString(diagnostics)); break; case DIAG_WARNING: assertFalse(hasFatalError(diagnostics), "Expected no errors, got: " + diagnosticsToString(diagnostics)); @@ -626,7 +626,7 @@ private List checkEvents(Supplier> toTest, // Use this for all EMPTY calls to eval() public void assertEvalEmpty(String input) { List events = getState().eval(input); - assertEquals(events.size(), 0, "Expected no events, got: " + events.size()); + assertEquals(0, events.size(), "Expected no events, got: " + events.size()); } public VarSnippet varKey(List events) { @@ -660,7 +660,7 @@ public Snippet key(List events) { public void assertVarValue(Snippet key, String expected) { String value = state.varValue((VarSnippet) key); - assertEquals(value, expected, "Expected var value of: " + expected + ", but got: " + value); + assertEquals(expected, value, "Expected var value of: " + expected + ", but got: " + value); } public Snippet assertDeclareFail(String input, String expectedErrorCode) { @@ -684,7 +684,7 @@ public Snippet assertDeclareFail(String input, ExpectedDiagnostic expectedDiagno DiagCheck.DIAG_ERROR, DiagCheck.DIAG_IGNORE, mainInfo, updates); SnippetEvent e = events.get(0); Snippet key = e.snippet(); - assertEquals(getState().status(key), REJECTED); + assertEquals(REJECTED, getState().status(key)); List diagnostics = getState().diagnostics(e.snippet()).collect(toList()); assertTrue(diagnostics.size() > 0, "Expected diagnostics, got none"); assertDiagnostic(input, diagnostics.get(0), expectedDiagnostic); @@ -727,7 +727,7 @@ public void assertMethodDeclSnippet(MethodSnippet method, assertDeclarationSnippet(method, expectedName, expectedStatus, METHOD_SUBKIND, unressz, othersz); String signature = method.signature(); - assertEquals(signature, expectedSignature, + assertEquals(expectedSignature, signature, "Expected " + method.source() + " to have the name: " + expectedSignature + ", got: " + signature); } @@ -739,7 +739,7 @@ public void assertVariableDeclSnippet(VarSnippet var, assertDeclarationSnippet(var, expectedName, expectedStatus, expectedSubKind, unressz, othersz); String signature = var.typeName(); - assertEquals(signature, expectedTypeName, + assertEquals(expectedTypeName, signature, "Expected " + var.source() + " to have the type name: " + expectedTypeName + ", got: " + signature); } @@ -750,27 +750,27 @@ public void assertDeclarationSnippet(DeclarationSnippet declarationKey, int unressz, int othersz) { assertKey(declarationKey, expectedStatus, expectedSubKind); String source = declarationKey.source(); - assertEquals(declarationKey.name(), expectedName, + assertEquals(expectedName, declarationKey.name(), "Expected " + source + " to have the name: " + expectedName + ", got: " + declarationKey.name()); long unresolved = getState().unresolvedDependencies(declarationKey).count(); - assertEquals(unresolved, unressz, "Expected " + source + " to have " + unressz + assertEquals(unressz, unresolved, "Expected " + source + " to have " + unressz + " unresolved symbols, got: " + unresolved); long otherCorralledErrorsCount = getState().diagnostics(declarationKey).count(); - assertEquals(otherCorralledErrorsCount, othersz, "Expected " + source + " to have " + othersz + assertEquals(othersz, otherCorralledErrorsCount, "Expected " + source + " to have " + othersz + " other errors, got: " + otherCorralledErrorsCount); } public void assertKey(Snippet key, Status expectedStatus, SubKind expectedSubKind) { String source = key.source(); SubKind actualSubKind = key.subKind(); - assertEquals(actualSubKind, expectedSubKind, + assertEquals(expectedSubKind, actualSubKind, "Expected " + source + " to have the subkind: " + expectedSubKind + ", got: " + actualSubKind); Status status = getState().status(key); - assertEquals(status, expectedStatus, "Expected " + source + " to be " + assertEquals(expectedStatus, status, "Expected " + source + " to be " + expectedStatus + ", but it is " + status); Snippet.Kind expectedKind = getKind(key); - assertEquals(key.kind(), expectedKind, "Checking kind: "); - assertEquals(expectedSubKind.kind(), expectedKind, "Checking kind: "); + assertEquals(expectedKind, key.kind(), "Checking kind: "); + assertEquals(expectedKind, expectedSubKind.kind(), "Checking kind: "); } public void assertDrop(Snippet key, STEInfo mainInfo, STEInfo... updates) { @@ -795,36 +795,36 @@ public void assertAnalyze(String input, Completeness status, String source) { public void assertAnalyze(String input, Completeness status, String source, String remaining, Boolean isComplete) { CompletionInfo ci = getAnalysis().analyzeCompletion(input); - if (status != null) assertEquals(ci.completeness(), status, "Input : " + input + ", status: "); - assertEquals(ci.source(), source, "Input : " + input + ", source: "); - if (remaining != null) assertEquals(ci.remaining(), remaining, "Input : " + input + ", remaining: "); + if (status != null) assertEquals(status, ci.completeness(), "Input : " + input + ", status: "); + assertEquals(source, ci.source(), "Input : " + input + ", source: "); + if (remaining != null) assertEquals(remaining, ci.remaining(), "Input : " + input + ", remaining: "); if (isComplete != null) { boolean isExpectedComplete = isComplete; - assertEquals(ci.completeness().isComplete(), isExpectedComplete, "Input : " + input + ", isComplete: "); + assertEquals(isExpectedComplete, ci.completeness().isComplete(), "Input : " + input + ", isComplete: "); } } public void assertNumberOfActiveVariables(int cnt) { - assertEquals(getState().variables().count(), cnt, "Variables : " + getState().variables().collect(toList())); + assertEquals(cnt, getState().variables().count(), "Variables : " + getState().variables().collect(toList())); } public void assertNumberOfActiveMethods(int cnt) { - assertEquals(getState().methods().count(), cnt, "Methods : " + getState().methods().collect(toList())); + assertEquals(cnt, getState().methods().count(), "Methods : " + getState().methods().collect(toList())); } public void assertNumberOfActiveClasses(int cnt) { - assertEquals(getState().types().count(), cnt, "Types : " + getState().types().collect(toList())); + assertEquals(cnt, getState().types().count(), "Types : " + getState().types().collect(toList())); } public void assertKeys(MemberInfo... expected) { int index = 0; List snippets = getState().snippets().collect(toList()); - assertEquals(allSnippets.size(), snippets.size()); + assertEquals(snippets.size(), allSnippets.size()); for (Snippet sn : snippets) { if (sn.kind().isPersistent() && getState().status(sn).isActive()) { MemberInfo actual = getMemberInfo(sn); MemberInfo exp = expected[index]; - assertEquals(actual, exp, String.format("Difference in #%d. Expected: %s, actual: %s", + assertEquals(exp, actual, String.format("Difference in #%d. Expected: %s, actual: %s", index, exp, actual)); ++index; } @@ -840,7 +840,7 @@ public void assertActiveKeys(Snippet... expected) { int index = 0; for (Snippet key : getState().snippets().collect(toList())) { if (state.status(key).isActive()) { - assertEquals(expected[index], key, String.format("Difference in #%d. Expected: %s, actual: %s", index, key, expected[index])); + assertEquals(key, expected[index], String.format("Difference in #%d. Expected: %s, actual: %s", index, key, expected[index])); ++index; } } @@ -852,7 +852,7 @@ private void assertActiveSnippets(Stream snippets, Predicate< .collect(Collectors.toSet()); Set got = snippets .collect(Collectors.toSet()); - assertEquals(active, got, label); + assertEquals(got, active, label); } public void assertVariables() { @@ -872,8 +872,8 @@ public void assertMembers(Stream members, MemberInfo...expect Set got = members .map(this::getMemberInfo) .collect(Collectors.toSet()); - assertEquals(got.size(), expected.size(), "Expected : " + expected + ", actual : " + members); - assertEquals(got, expected); + assertEquals(expected.size(), got.size(), "Expected : " + expected + ", actual : " + members); + assertEquals(expected, got); } public void assertVariables(MemberInfo...expected) { @@ -891,7 +891,7 @@ public void assertMethods(MemberInfo...expected) { } assertNotNull(expectedInfo, "Not found method: " + methodKey.name()); int lastIndexOf = expectedInfo.type.lastIndexOf(')'); - assertEquals(methodKey.parameterTypes(), expectedInfo.type.substring(1, lastIndexOf), "Parameter types"); + assertEquals(expectedInfo.type.substring(1, lastIndexOf), methodKey.parameterTypes(), "Parameter types"); }); } @@ -905,7 +905,7 @@ public void assertCompletion(String code, String... expected) { public void assertCompletion(String code, Boolean isSmart, String... expected) { List completions = computeCompletions(code, isSmart); - assertEquals(completions, Arrays.asList(expected), "Input: " + code + ", " + completions.toString()); + assertEquals(Arrays.asList(expected), completions, "Input: " + code + ", " + completions.toString()); } public void assertCompletionIncludesExcludes(String code, Set expected, Set notExpected) { @@ -939,7 +939,7 @@ private List computeCompletions(String code, Boolean isSmart) { public void assertInferredType(String code, String expectedType) { String inferredType = getAnalysis().analyzeType(code, code.length()); - assertEquals(inferredType, expectedType, "Input: " + code + ", " + inferredType); + assertEquals(expectedType, inferredType, "Input: " + code + ", " + inferredType); } public void assertInferredFQNs(String code, String... fqns) { @@ -951,9 +951,9 @@ public void assertInferredFQNs(String code, int simpleNameLen, boolean resolvabl QualifiedNames candidates = getAnalysis().listQualifiedNames(code, code.length()); - assertEquals(candidates.getNames(), Arrays.asList(fqns), "Input: " + code + ", candidates=" + candidates.getNames()); - assertEquals(candidates.getSimpleNameLength(), simpleNameLen, "Input: " + code + ", simpleNameLen=" + candidates.getSimpleNameLength()); - assertEquals(candidates.isResolvable(), resolvable, "Input: " + code + ", resolvable=" + candidates.isResolvable()); + assertEquals(Arrays.asList(fqns), candidates.getNames(), "Input: " + code + ", candidates=" + candidates.getNames()); + assertEquals(simpleNameLen, candidates.getSimpleNameLength(), "Input: " + code + ", simpleNameLen=" + candidates.getSimpleNameLength()); + assertEquals(resolvable, candidates.isResolvable(), "Input: " + code + ", resolvable=" + candidates.isResolvable()); } protected void waitIndexingFinished() { @@ -974,7 +974,7 @@ public void assertSignature(String code, String... expected) { List documentation = getAnalysis().documentation(code, cursor, false); Set docSet = documentation.stream().map(doc -> doc.signature()).collect(Collectors.toSet()); Set expectedSet = Stream.of(expected).collect(Collectors.toSet()); - assertEquals(docSet, expectedSet, "Input: " + code); + assertEquals(expectedSet, docSet, "Input: " + code); } public void assertJavadoc(String code, String... expected) { @@ -986,7 +986,7 @@ public void assertJavadoc(String code, String... expected) { .map(doc -> doc.signature() + "\n" + doc.javadoc()) .collect(Collectors.toSet()); Set expectedSet = Stream.of(expected).collect(Collectors.toSet()); - assertEquals(docSet, expectedSet, "Input: " + code); + assertEquals(expectedSet, docSet, "Input: " + code); } public enum ClassType { @@ -1182,7 +1182,7 @@ public void assertMatch(SnippetEvent ste, Snippet mainSnippet) { assertStatusMatch(ste, ste.previousStatus(), previousStatus()); assertStatusMatch(ste, ste.status(), status()); if (checkIsSignatureChange) { - assertEquals(ste.isSignatureChange(), isSignatureChange(), + assertEquals(isSignatureChange(), ste.isSignatureChange(), "Expected " + (isSignatureChange()? "" : "no ") + "signature-change, got: " + @@ -1205,10 +1205,10 @@ private void assertKeyMatch(SnippetEvent ste, Snippet sn, Snippet expected, Snip assertTrue(sn != testKey, "Main-event: Expected new snippet to be != : " + testKey + "\n got-event: " + toString(ste)); - assertEquals(sn.id(), testKey.id(), "Expected IDs to match: " + testKey + ", got: " + sn + assertEquals(testKey.id(), sn.id(), "Expected IDs to match: " + testKey + ", got: " + sn + "\n expected-event: " + this + "\n got-event: " + toString(ste)); } else { - assertEquals(sn, testKey, "Expected key to be: " + testKey + ", got: " + sn + assertEquals(testKey, sn, "Expected key to be: " + testKey + ", got: " + sn + "\n expected-event: " + this + "\n got-event: " + toString(ste)); } } @@ -1216,7 +1216,7 @@ private void assertKeyMatch(SnippetEvent ste, Snippet sn, Snippet expected, Snip private void assertStatusMatch(SnippetEvent ste, Status status, Status expected) { if (expected != null) { - assertEquals(status, expected, "Expected status to be: " + expected + ", got: " + status + + assertEquals(expected, status, "Expected status to be: " + expected + ", got: " + status + "\n expected-event: " + this + "\n got-event: " + toString(ste)); } } diff --git a/test/langtools/jdk/jshell/MethodsTest.java b/test/langtools/jdk/jshell/MethodsTest.java index 85f63f82f77d..9577f943c519 100644 --- a/test/langtools/jdk/jshell/MethodsTest.java +++ b/test/langtools/jdk/jshell/MethodsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @bug 8080357 8167643 8187359 8199762 8080353 8246353 8247456 8267221 8272135 * @summary Tests for EvaluationState.methods * @build KullaTesting TestingInputStream ExpectedDiagnostic - * @run testng MethodsTest + * @run junit MethodsTest */ import javax.tools.Diagnostic; @@ -34,21 +34,23 @@ import jdk.jshell.Snippet; import jdk.jshell.MethodSnippet; import jdk.jshell.Snippet.Status; -import org.testng.annotations.Test; import java.util.List; import java.util.stream.Collectors; import static jdk.jshell.Snippet.Status.*; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Test public class MethodsTest extends KullaTesting { + @Test public void noMethods() { assertNumberOfActiveMethods(0); } + @Test public void testSignature1() { MethodSnippet m1 = methodKey(assertEval("void f() { g(); }", added(RECOVERABLE_DEFINED))); assertMethodDeclSnippet(m1, "f", "()void", RECOVERABLE_DEFINED, 1, 0); @@ -58,6 +60,7 @@ public void testSignature1() { assertMethodDeclSnippet(m2, "g", "()void", VALID, 0, 0); } + @Test public void testSignature2() { MethodSnippet m1 = (MethodSnippet) assertDeclareFail("void f() { return g(); }", "compiler.err.prob.found.req"); assertMethodDeclSnippet(m1, "f", "()void", REJECTED, 0, 2); @@ -67,7 +70,8 @@ public void testSignature2() { assertMethodDeclSnippet(m2, "f", "()int", RECOVERABLE_DEFINED, 1, 0); } - @Test(enabled = false) // TODO 8081690 + @Test // TODO 8081690 + @Disabled public void testSignature3() { MethodSnippet m1 = methodKey(assertEval("void f(Bar b) { }", added(RECOVERABLE_NOT_DEFINED))); assertMethodDeclSnippet(m1, "f", "(Bar)void", RECOVERABLE_NOT_DEFINED, 1, 0); @@ -79,6 +83,7 @@ public void testSignature3() { } // 8080357 + @Test public void testNonReplUnresolved() { // internal case assertEval("class CCC {}", added(VALID)); @@ -87,6 +92,7 @@ public void testNonReplUnresolved() { assertDeclareFail("void f2() { System.xxxx(); }", "compiler.err.cant.resolve.location.args"); } + @Test public void methods() { assertEval("int x() { return 10; }"); assertEval("String y() { return null; }"); @@ -95,6 +101,7 @@ public void methods() { assertActiveKeys(); } + @Test public void methodOverload() { assertEval("int m() { return 1; }"); assertEval("int m(int x) { return 2; }"); @@ -139,6 +146,7 @@ public void methodOverloadDependent() { } ***/ + @Test public void methodsRedeclaration1() { Snippet x = methodKey(assertEval("int x() { return 10; }")); Snippet y = methodKey(assertEval("String y() { return \"\"; }")); @@ -158,6 +166,7 @@ public void methodsRedeclaration1() { assertActiveKeys(); } + @Test public void methodsRedeclaration2() { assertEval("int a() { return 1; }"); assertMethods(method("()int", "a")); @@ -179,6 +188,7 @@ public void methodsRedeclaration2() { assertActiveKeys(); } + @Test public void methodsRedeclaration3() { Snippet x = methodKey(assertEval("int x(Object...a) { return 10; }")); assertMethods(method("(Object...)int", "x")); @@ -192,6 +202,7 @@ public void methodsRedeclaration3() { } + @Test public void methodsRedeclaration4() { Snippet a = methodKey(assertEval("int foo(int a) { return a; }")); assertEval("int x = foo(10);"); @@ -204,6 +215,7 @@ public void methodsRedeclaration4() { } // 8199762 + @Test public void methodsRedeclaration5() { Snippet m1 = methodKey(assertEval("int m(Object o) { return 10; }")); assertMethods(method("(Object)int", "m")); @@ -220,22 +232,23 @@ public void methodsRedeclaration5() { assertActiveKeys(); } + @Test public void methodsAbstract() { MethodSnippet m1 = methodKey(assertEval("abstract String f();", ste(MAIN_SNIPPET, NONEXISTENT, RECOVERABLE_DEFINED, true, null))); - assertEquals(getState().unresolvedDependencies(m1).collect(Collectors.toList()), - List.of("method f()")); + assertEquals( List.of("method f()"), getState().unresolvedDependencies(m1).collect(Collectors.toList())); MethodSnippet m2 = methodKey(assertEval("abstract int mm(Blah b);", ste(MAIN_SNIPPET, NONEXISTENT, RECOVERABLE_NOT_DEFINED, false, null))); List unr = getState().unresolvedDependencies(m2).collect(Collectors.toList()); - assertEquals(unr.size(), 2); + assertEquals(2, unr.size()); unr.remove("class Blah"); unr.remove("method mm(Blah)"); - assertEquals(unr.size(), 0, "unexpected entry: " + unr); + assertEquals(0, unr.size(), "unexpected entry: " + unr); assertNumberOfActiveMethods(2); assertActiveKeys(); } + @Test public void methodsErrors() { assertDeclareFail("String f();", new ExpectedDiagnostic("compiler.err.missing.meth.body.or.decl.abstract", 0, 11, 7, -1, -1, Diagnostic.Kind.ERROR)); @@ -267,6 +280,7 @@ public void methodsErrors() { assertActiveKeys(); } + @Test public void objectMethodNamedMethodsErrors() { assertDeclareFail("boolean equals(double d1, double d2) { return d1 == d2; }", new ExpectedDiagnostic("jdk.eval.error.object.method", 8, 14, 8, -1, -1, Diagnostic.Kind.ERROR)); @@ -286,6 +300,7 @@ public void objectMethodNamedMethodsErrors() { } + @Test public void methodsAccessModifierIgnored() { Snippet f = methodKey(assertEval("public String f() {return null;}", added(VALID))); @@ -305,6 +320,7 @@ public void methodsAccessModifierIgnored() { assertActiveKeys(); } + @Test public void methodsIgnoredModifiers() { Snippet f = methodKey(assertEval("static String f() {return null;}")); assertNumberOfActiveMethods(1); @@ -318,6 +334,7 @@ public void methodsIgnoredModifiers() { assertActiveKeys(); } + @Test public void methodSignatureUnresolved() { MethodSnippet key = (MethodSnippet) methodKey(assertEval("und m() { return new und(); }", added(RECOVERABLE_NOT_DEFINED))); assertMethodDeclSnippet(key, "m", "()und", RECOVERABLE_NOT_DEFINED, 1, 0); @@ -330,7 +347,8 @@ public void methodSignatureUnresolved() { assertActiveKeys(); } - @Test(enabled = false) // TODO 8081689 + @Test // TODO 8081689 + @Disabled public void classMethodsAreNotVisible() { assertEval( "class A {" + @@ -351,6 +369,7 @@ public void classMethodsAreNotVisible() { assertActiveKeys(); } + @Test public void lambdas() { assertEval("class Inner1 implements Runnable {" + "public Runnable lambda1 = () -> {};" + @@ -376,15 +395,17 @@ public void lambdas() { } //JDK-8267221: + @Test public void testMethodArrayParameters() { MethodSnippet m1 = methodKey(assertEval("void m1(int... p) { }", added(VALID))); - assertEquals(m1.parameterTypes(), "int..."); + assertEquals("int...", m1.parameterTypes()); MethodSnippet m2 = methodKey(assertEval("void m2(int[]... p) { }", added(VALID))); - assertEquals(m2.parameterTypes(), "int[]..."); + assertEquals("int[]...", m2.parameterTypes()); MethodSnippet m3 = methodKey(assertEval("void m3(int[][] p) { }", added(VALID))); - assertEquals(m3.parameterTypes(), "int[][]"); + assertEquals("int[][]", m3.parameterTypes()); } + @Test public void testOverloadCalls() { MethodSnippet orig = methodKey(assertEval("int m(String s) { return 0; }")); MethodSnippet overload = methodKey(assertEval("int m(int i) { return 1; }")); diff --git a/test/langtools/jdk/jshell/ModifiersTest.java b/test/langtools/jdk/jshell/ModifiersTest.java index 2cbebc8b5b87..2cdb5ce28b6f 100644 --- a/test/langtools/jdk/jshell/ModifiersTest.java +++ b/test/langtools/jdk/jshell/ModifiersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test 8167643 8129559 8247456 * @summary Tests for modifiers * @build KullaTesting TestingInputStream ExpectedDiagnostic - * @run testng ModifiersTest + * @run junit ModifiersTest */ import java.util.ArrayList; @@ -34,13 +34,14 @@ import java.util.function.Consumer; import javax.tools.Diagnostic; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; -@Test +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class ModifiersTest extends KullaTesting { - @DataProvider(name = "ignoredModifiers") public Object[][] getTestCases() { List testCases = new ArrayList<>(); String[] ignoredModifiers = new String[] { @@ -77,7 +78,8 @@ public Object[][] getTestCases() { return testCases.toArray(new Object[testCases.size()][]); } - @Test(dataProvider = "ignoredModifiers") + @ParameterizedTest + @MethodSource("getTestCases") public void ignoredModifiers(String modifier, ClassType classType, Consumer eval, String preface, String context) { if (context != null) { @@ -95,6 +97,7 @@ public void ignoredModifiers(String modifier, ClassType classType, assertActiveKeys(); } + @Test public void accessToStaticFieldsOfClass() { assertEval("class A {" + "int x = 14;" + @@ -108,6 +111,7 @@ public void accessToStaticFieldsOfClass() { assertActiveKeys(); } + @Test public void accessToStaticMethodsOfClass() { assertEval("class A {" + "void x() {}" + @@ -119,6 +123,7 @@ public void accessToStaticMethodsOfClass() { assertActiveKeys(); } + @Test public void accessToStaticFieldsOfInterface() { assertEval("interface A {" + "int x = 14;" + @@ -134,12 +139,14 @@ public void accessToStaticFieldsOfInterface() { assertActiveKeys(); } + @Test public void accessToStaticMethodsOfInterface() { assertEval("interface A { static void x() {} }"); assertEval("A.x();"); assertActiveKeys(); } + @Test public void finalMethod() { assertEval("class A { final void f() {} }"); assertDeclareFail("class B extends A { void f() {} }", @@ -148,6 +155,7 @@ public void finalMethod() { } //TODO: is this the right semantics? + @Test public void finalConstructor() { assertDeclareFail("class A { final A() {} }", new ExpectedDiagnostic("compiler.err.mod.not.allowed.here", 10, 22, 16, -1, -1, Diagnostic.Kind.ERROR)); @@ -155,6 +163,7 @@ public void finalConstructor() { } //TODO: is this the right semantics? + @Test public void finalDefaultMethod() { assertDeclareFail("interface A { final default void a() {} }", new ExpectedDiagnostic("compiler.err.mod.not.allowed.here", 14, 39, 33, -1, -1, Diagnostic.Kind.ERROR)); diff --git a/test/langtools/jdk/jshell/MultipleDocumentationTest.java b/test/langtools/jdk/jshell/MultipleDocumentationTest.java index 8037381ccc8d..d7894212016d 100644 --- a/test/langtools/jdk/jshell/MultipleDocumentationTest.java +++ b/test/langtools/jdk/jshell/MultipleDocumentationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,8 @@ import java.util.List; import java.util.stream.Collectors; import jdk.jshell.JShell; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; /* * @test @@ -39,11 +39,11 @@ * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool * @build Compiler toolbox.ToolBox - * @run testng MultipleDocumentationTest + * @run junit MultipleDocumentationTest */ -@Test public class MultipleDocumentationTest { + @Test public void testMultipleDocumentation() { String input = "java.lang.String"; @@ -68,7 +68,7 @@ public void testMultipleDocumentation() { .map(d -> d.javadoc()) .collect(Collectors.toList()); - assertEquals(javadocs2, javadocs1); + assertEquals(javadocs1, javadocs2); } } } diff --git a/test/langtools/jdk/jshell/MyExecutionControl.java b/test/langtools/jdk/jshell/MyExecutionControl.java index 8493638db576..12a0ac6986d0 100644 --- a/test/langtools/jdk/jshell/MyExecutionControl.java +++ b/test/langtools/jdk/jshell/MyExecutionControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ import jdk.jshell.spi.ExecutionControl; import jdk.jshell.spi.ExecutionControl.EngineTerminationException; import jdk.jshell.spi.ExecutionEnv; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import static jdk.jshell.execution.Util.remoteInputOutput; class MyExecutionControl extends JdiExecutionControl { diff --git a/test/langtools/jdk/jshell/NullTest.java b/test/langtools/jdk/jshell/NullTest.java index b365b5155f8c..c4759aca87fb 100644 --- a/test/langtools/jdk/jshell/NullTest.java +++ b/test/langtools/jdk/jshell/NullTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,14 @@ * @test * @summary null test * @build KullaTesting TestingInputStream - * @run testng NullTest + * @run junit NullTest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class NullTest extends KullaTesting { + @Test public void testNull() { assertEval("null;", "null"); assertEval("(Object)null;", "null"); diff --git a/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java b/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java index 409965e2e682..350a6659c525 100644 --- a/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java +++ b/test/langtools/jdk/jshell/PasteAndMeasurementsUITest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8182297 8242919 8267459 * @summary Verify that pasting multi-line snippets works properly. @@ -38,7 +38,7 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build Compiler UITesting * @build PasteAndMeasurementsUITest - * @run testng/othervm PasteAndMeasurementsUITest + * @run junit/othervm PasteAndMeasurementsUITest */ import java.io.Console; @@ -46,15 +46,15 @@ import java.lang.reflect.Field; import jdk.internal.org.jline.reader.impl.LineReaderImpl; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class PasteAndMeasurementsUITest extends UITesting { public PasteAndMeasurementsUITest() { super(true); } + @Test public void testPrevNextSnippet() throws Exception { Field cons = System.class.getDeclaredField("cons"); cons.setAccessible(true); @@ -77,6 +77,7 @@ public void testPrevNextSnippet() throws Exception { } private static final String LOC = "\033[12;1R"; + @Test public void testBracketedPaste() throws Exception { Field cons = System.class.getDeclaredField("cons"); cons.setAccessible(true); @@ -91,6 +92,7 @@ public void testBracketedPaste() throws Exception { }); } + @Test public void testBracketedPasteNonAscii() throws Exception { Field cons = System.class.getDeclaredField("cons"); cons.setAccessible(true); diff --git a/test/langtools/jdk/jshell/PipeInputStreamTest.java b/test/langtools/jdk/jshell/PipeInputStreamTest.java index 867a1f254a49..0062c6006e11 100644 --- a/test/langtools/jdk/jshell/PipeInputStreamTest.java +++ b/test/langtools/jdk/jshell/PipeInputStreamTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @summary Verify PipeInputStream works. * @modules jdk.compiler/com.sun.tools.javac.util * jdk.jshell/jdk.jshell.execution.impl:open - * @run testng PipeInputStreamTest + * @run junit PipeInputStreamTest */ import java.io.InputStream; @@ -34,28 +34,28 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import org.testng.annotations.Test; import com.sun.tools.javac.util.Pair; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; -@Test public class PipeInputStreamTest { + @Test public void testReadArrayNotBlocking() throws Exception { Pair streams = createPipeStream(); InputStream in = streams.fst; OutputStream out = streams.snd; out.write('a'); byte[] data = new byte[12]; - assertEquals(in.read(data), 1); - assertEquals(data[0], 'a'); + assertEquals(1, in.read(data)); + assertEquals('a', data[0]); out.write('a'); out.write('b'); out.write('c'); - assertEquals(in.read(data), 3); - assertEquals(data[0], 'a'); - assertEquals(data[1], 'b'); - assertEquals(data[2], 'c'); + assertEquals(3, in.read(data)); + assertEquals('a', data[0]); + assertEquals('b', data[1]); + assertEquals('c', data[2]); } private Pair createPipeStream() throws Exception { diff --git a/test/langtools/jdk/jshell/RecordsTest.java b/test/langtools/jdk/jshell/RecordsTest.java index 69aaae8e46f8..fdf75aed3ab9 100644 --- a/test/langtools/jdk/jshell/RecordsTest.java +++ b/test/langtools/jdk/jshell/RecordsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,27 +27,27 @@ * @summary Tests for evalution of records * @modules jdk.jshell * @build KullaTesting TestingInputStream ExpectedDiagnostic - * @run testng RecordsTest + * @run junit RecordsTest */ -import org.testng.annotations.Test; import javax.lang.model.SourceVersion; import jdk.jshell.Snippet.Status; import jdk.jshell.UnresolvedReferenceException; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.BeforeMethod; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; -@Test public class RecordsTest extends KullaTesting { + @Test public void testRecordClass() { assertEval("record R(String s, int i) { }"); - assertEquals(varKey(assertEval("R r = new R(\"r\", 42);")).name(), "r"); + assertEquals("r", varKey(assertEval("R r = new R(\"r\", 42);")).name()); assertEval("r.s()", "\"r\""); assertEval("r.i()", "42"); } + @Test public void testRecordCorralling() { //simple record with a mistake that can be fixed by corralling: assertEval("record R1(int i) { int g() { return j; } }", ste(MAIN_SNIPPET, Status.NONEXISTENT, Status.RECOVERABLE_DEFINED, true, null)); @@ -66,13 +66,15 @@ public void testRecordCorralling() { assertEval("R5 r5 = new R5(1);", null, UnresolvedReferenceException.class, DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, added(Status.VALID)); } + @Test public void testRecordField() { - assertEquals(varKey(assertEval("String record = \"\";")).name(), "record"); + assertEquals("record", varKey(assertEval("String record = \"\";")).name()); assertEval("record.length()", "0"); } + @Test public void testRecordMethod() { - assertEquals(methodKey(assertEval("String record(String record) { return record + record; }")).name(), "record"); + assertEquals("record", methodKey(assertEval("String record(String record) { return record + record; }")).name()); assertEval("record(\"r\")", "\"rr\""); assertEval("record(\"r\").length()", "2"); } diff --git a/test/langtools/jdk/jshell/RejectedFailedTest.java b/test/langtools/jdk/jshell/RejectedFailedTest.java index 5411d5d8aee1..5e97a03d3994 100644 --- a/test/langtools/jdk/jshell/RejectedFailedTest.java +++ b/test/langtools/jdk/jshell/RejectedFailedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,12 @@ * @test 8080352 * @summary Tests for hard errors, like syntax errors * @build KullaTesting - * @run testng RejectedFailedTest + * @run junit RejectedFailedTest */ import java.util.List; import jdk.jshell.Snippet.SubKind; -import org.testng.annotations.Test; import jdk.jshell.Diag; import jdk.jshell.Snippet; @@ -40,31 +39,31 @@ import jdk.jshell.SnippetEvent; import static java.util.stream.Collectors.toList; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; -@Test public class RejectedFailedTest extends KullaTesting { private String bad(String input, Kind kind, String prevId) { List events = assertEvalFail(input); - assertEquals(events.size(), 1, "Expected one event, got: " + events.size()); + assertEquals(1, events.size(), "Expected one event, got: " + events.size()); SnippetEvent e = events.get(0); List diagnostics = getState().diagnostics(e.snippet()).collect(toList()); assertTrue(diagnostics.size() > 0, "Expected diagnostics, got none"); - assertEquals(e.exception(), null, "Expected exception to be null."); - assertEquals(e.value(), null, "Expected value to be null."); + assertEquals(null, e.exception(), "Expected exception to be null."); + assertEquals(null, e.value(), "Expected value to be null."); Snippet key = e.snippet(); assertTrue(key != null, "key must be non-null, but was null."); - assertEquals(key.kind(), kind, "Expected kind: " + kind + ", got: " + key.kind()); + assertEquals(kind, key.kind(), "Expected kind: " + kind + ", got: " + key.kind()); SubKind expectedSubKind = kind == Kind.ERRONEOUS ? SubKind.UNKNOWN_SUBKIND : SubKind.METHOD_SUBKIND; - assertEquals(key.subKind(), expectedSubKind, "SubKind: "); + assertEquals(expectedSubKind, key.subKind(), "SubKind: "); assertTrue(key.id().compareTo(prevId) > 0, "Current id: " + key.id() + ", previous: " + prevId); - assertEquals(getState().diagnostics(key).collect(toList()), diagnostics, "Expected retrieved diagnostics to match, but didn't."); - assertEquals(key.source(), input, "Expected retrieved source: " + + assertEquals(diagnostics, getState().diagnostics(key).collect(toList()), "Expected retrieved diagnostics to match, but didn't."); + assertEquals(input, key.source(), "Expected retrieved source: " + key.source() + " to match input: " + input); - assertEquals(getState().status(key), Status.REJECTED, "Expected status of REJECTED, got: " + getState().status(key)); + assertEquals(Status.REJECTED, getState().status(key), "Expected status of REJECTED, got: " + getState().status(key)); return key.id(); } @@ -75,6 +74,7 @@ private void checkByKind(String[] inputs, Kind kind) { } } + @Test public void testErroneous() { String[] inputsErroneous = { "%&^%&", @@ -86,6 +86,7 @@ public void testErroneous() { checkByKind(inputsErroneous, Kind.ERRONEOUS); } + @Test public void testBadMethod() { String[] inputsMethod = { "transient int m() { return x; }", diff --git a/test/langtools/jdk/jshell/ReplToolTesting.java b/test/langtools/jdk/jshell/ReplToolTesting.java index 52eb2d5798c6..f6c15ca2d792 100644 --- a/test/langtools/jdk/jshell/ReplToolTesting.java +++ b/test/langtools/jdk/jshell/ReplToolTesting.java @@ -45,14 +45,14 @@ import java.util.stream.Stream; -import org.testng.annotations.BeforeMethod; import jdk.jshell.tool.JavaShellToolBuilder; import static java.util.stream.Collectors.toList; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.BeforeEach; public class ReplToolTesting { @@ -142,7 +142,7 @@ public Consumer assertList() { .filter(l -> !l.isEmpty()) .collect(Collectors.toList()); int previousId = Integer.MIN_VALUE; - assertEquals(lines.size(), keys.size(), "Number of keys"); + assertEquals(keys.size(), lines.size(), "Number of keys"); for (int i = 0; i < lines.size(); ++i) { String line = lines.get(i); Matcher matcher = idPattern.matcher(line); @@ -165,7 +165,7 @@ private Consumer assertMembers(String message, Map !l.isEmpty()) .filter(l -> !l.startsWith("| ")) // error/unresolved info .collect(Collectors.toList()); - assertEquals(lines.size(), set.size(), message + " : expected: " + set.keySet() + "\ngot:\n" + lines); + assertEquals(set.size(), lines.size(), message + " : expected: " + set.keySet() + "\ngot:\n" + lines); for (String line : lines) { Matcher matcher = extractPattern.matcher(line); assertTrue(matcher.find(), line); @@ -275,7 +275,7 @@ private void initSnippets() { } } - @BeforeMethod + @BeforeEach public void setUp() { prefsMap = new HashMap<>(); prefsMap.put("INDENT", "0"); @@ -335,8 +335,7 @@ private void testRawCheck(Locale locale, String expectedErrorOutput) { String ueos = getUserErrorOutput(); assertTrue((cos.isEmpty() || cos.startsWith("| Goodbye") || !locale.equals(Locale.ROOT)), "Expected a goodbye, but got: " + cos); - assertEquals(ceos, - expectedErrorOutput, + assertEquals( expectedErrorOutput, ceos, "Expected \"" + expectedErrorOutput + "\" command error output, got: \"" + ceos + "\""); assertTrue(uos.isEmpty(), "Expected empty user output, got: " + uos); @@ -560,7 +559,7 @@ public Consumer assertStartsWith(String prefix) { public void assertOutput(String got, String expected, String display) { if (expected != null) { - assertEquals(got, expected, display + ".\n"); + assertEquals(expected, got, display + ".\n"); } } diff --git a/test/langtools/jdk/jshell/ReplaceTest.java b/test/langtools/jdk/jshell/ReplaceTest.java index e4c2c8575c0c..02ebb27fcb9b 100644 --- a/test/langtools/jdk/jshell/ReplaceTest.java +++ b/test/langtools/jdk/jshell/ReplaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test 8080069 8152925 * @summary Test of Snippet redefinition and replacement. * @build KullaTesting TestingInputStream - * @run testng ReplaceTest + * @run junit ReplaceTest */ import java.util.Iterator; @@ -34,16 +34,16 @@ import jdk.jshell.MethodSnippet; import jdk.jshell.TypeDeclSnippet; import jdk.jshell.VarSnippet; -import org.testng.annotations.Test; - -import static org.testng.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertFalse; import static jdk.jshell.Snippet.Status.*; import static jdk.jshell.Snippet.SubKind.*; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Test public class ReplaceTest extends KullaTesting { + @Test public void testRedefine() { Snippet vx = varKey(assertEval("int x;")); Snippet mu = methodKey(assertEval("int mu() { return x * 4; }")); @@ -69,6 +69,7 @@ public void testRedefine() { assertActiveKeys(); } + @Test public void testReplaceClassToVar() { Snippet oldA = classKey(assertEval("class A { public String toString() { return \"old\"; } }")); Snippet v = varKey(assertEval("A a = new A();", "old")); @@ -92,6 +93,7 @@ private void identityMatch(Stream got, T expected) { assertFalse(it.hasNext(), "expected exactly one"); } + @Test public void testReplaceVarToMethod() { Snippet x = varKey(assertEval("int x;")); MethodSnippet musn = methodKey(assertEval("double mu() { return x * 4; }")); @@ -106,6 +108,7 @@ public void testReplaceVarToMethod() { assertActiveKeys(); } + @Test public void testReplaceMethodToMethod() { Snippet a = methodKey(assertEval("double a() { return 2; }")); Snippet b = methodKey(assertEval("double b() { return a() * 10; }")); @@ -119,6 +122,7 @@ public void testReplaceMethodToMethod() { assertActiveKeys(); } + @Test public void testReplaceClassToMethod() { Snippet c = classKey(assertEval("class C { int f() { return 7; } }")); Snippet m = methodKey(assertEval("int m() { return new C().f(); }")); @@ -130,6 +134,7 @@ public void testReplaceClassToMethod() { assertActiveKeys(); } + @Test public void testReplaceVarToClass() { Snippet x = varKey(assertEval("int x;")); TypeDeclSnippet c = classKey(assertEval("class A { double a = 4 * x; }")); @@ -144,6 +149,7 @@ public void testReplaceVarToClass() { assertActiveKeys(); } + @Test public void testReplaceMethodToClass() { Snippet x = methodKey(assertEval("int x() { return 0; }")); TypeDeclSnippet c = classKey(assertEval("class A { double a = 4 * x(); }")); @@ -159,6 +165,7 @@ public void testReplaceMethodToClass() { assertActiveKeys(); } + @Test public void testReplaceClassToClass() { TypeDeclSnippet a = classKey(assertEval("class A {}")); assertTypeDeclSnippet(a, "A", VALID, CLASS_SUBKIND, 0, 0); @@ -178,6 +185,7 @@ public void testReplaceClassToClass() { assertActiveKeys(); } + @Test public void testOverwriteReplaceMethod() { MethodSnippet k1 = methodKey(assertEval("String m(Integer i) { return i.toString(); }")); MethodSnippet k2 = methodKey(assertEval("String m(java.lang.Integer i) { return \"java.lang.\" + i.toString(); }", @@ -193,6 +201,7 @@ public void testOverwriteReplaceMethod() { assertActiveKeys(); } + @Test public void testImportDeclare() { Snippet singleImport = importKey(assertEval("import java.util.List;", added(VALID))); Snippet importOnDemand = importKey(assertEval("import java.util.*;", added(VALID))); @@ -213,7 +222,8 @@ public void testImportDeclare() { assertActiveKeys(); } - @Test(enabled = false) // TODO 8129420 + @Test // TODO 8129420 + @Disabled public void testLocalClassEvolve() { Snippet j = methodKey(assertEval("Object j() { return null; }", added(VALID))); assertEval("Object j() { class B {}; return null; }", @@ -227,6 +237,7 @@ public void testLocalClassEvolve() { assertEval("j();", "Yep"); } + @Test public void testReplaceCausesMethodReferenceError() { Snippet l = classKey(assertEval("interface Logger { public void log(String message); }", added(VALID))); Snippet v = varKey(assertEval("Logger l = System.out::println;", added(VALID))); @@ -238,6 +249,7 @@ public void testReplaceCausesMethodReferenceError() { ste(v, VALID, RECOVERABLE_NOT_DEFINED, true, MAIN_SNIPPET)); } + @Test public void testReplaceCausesClassCompilationError() { Snippet l = classKey(assertEval("interface L { }", added(VALID))); Snippet c = classKey(assertEval("class C implements L { }", added(VALID))); @@ -249,6 +261,7 @@ public void testReplaceCausesClassCompilationError() { ste(c, VALID, RECOVERABLE_NOT_DEFINED, true, MAIN_SNIPPET)); } + @Test public void testOverwriteNoUpdate() { String xsi = "int x = 5;"; String xsd = "double x = 3.14159;"; diff --git a/test/langtools/jdk/jshell/SealedClassesTest.java b/test/langtools/jdk/jshell/SealedClassesTest.java index ba4f8c8f008c..c45bc7677692 100644 --- a/test/langtools/jdk/jshell/SealedClassesTest.java +++ b/test/langtools/jdk/jshell/SealedClassesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ * @summary Test sealed class in jshell * @modules jdk.jshell * @build KullaTesting TestingInputStream ExpectedDiagnostic - * @run testng SealedClassesTest + * @run junit SealedClassesTest */ import javax.lang.model.SourceVersion; @@ -35,14 +35,13 @@ import jdk.jshell.TypeDeclSnippet; import jdk.jshell.Snippet.Status; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import static jdk.jshell.Snippet.Status.VALID; +import org.junit.jupiter.api.Test; -@Test public class SealedClassesTest extends KullaTesting { + @Test public void testSealed() { TypeDeclSnippet base = classKey( assertEval("sealed class B permits I {}", @@ -53,6 +52,7 @@ public void testSealed() { assertEval("new I()"); } + @Test public void testInterface() { TypeDeclSnippet base = classKey( assertEval("sealed interface I permits C {}", @@ -63,6 +63,7 @@ public void testInterface() { assertEval("new C()"); } + @Test public void testNonSealed() { TypeDeclSnippet base = classKey( assertEval("sealed class B permits I {}", @@ -74,6 +75,7 @@ public void testNonSealed() { assertEval("new I2()"); } + @Test public void testNonSealedInterface() { TypeDeclSnippet base = classKey( assertEval("sealed interface B permits C {}", diff --git a/test/langtools/jdk/jshell/ShutdownTest.java b/test/langtools/jdk/jshell/ShutdownTest.java index 45431f661620..9c3b084f6a3d 100644 --- a/test/langtools/jdk/jshell/ShutdownTest.java +++ b/test/langtools/jdk/jshell/ShutdownTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,18 +25,21 @@ * @test * @summary Shutdown tests * @build KullaTesting TestingInputStream - * @run testng ShutdownTest + * @run junit ShutdownTest */ import java.util.function.Consumer; import jdk.jshell.JShell; import jdk.jshell.JShell.Subscription; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; -import static org.testng.Assert.assertEquals; - -@Test public class ShutdownTest extends KullaTesting { int shutdownCount; @@ -45,29 +48,33 @@ void shutdownCounter(JShell state) { ++shutdownCount; } - @Test(enabled = false) //TODO 8139873 + @Test //TODO 8139873 + @Disabled public void testExit() { shutdownCount = 0; getState().onShutdown(this::shutdownCounter); assertEval("System.exit(1);"); - assertEquals(shutdownCount, 1); + assertEquals(1, shutdownCount); } + @Test public void testCloseCallback() { shutdownCount = 0; getState().onShutdown(this::shutdownCounter); getState().close(); - assertEquals(shutdownCount, 1); + assertEquals(1, shutdownCount); } + @Test public void testCloseUnsubscribe() { shutdownCount = 0; Subscription token = getState().onShutdown(this::shutdownCounter); getState().unsubscribe(token); getState().close(); - assertEquals(shutdownCount, 0); + assertEquals(0, shutdownCount); } + @Test public void testTwoShutdownListeners() { ShutdownListener listener1 = new ShutdownListener(); ShutdownListener listener2 = new ShutdownListener(); @@ -76,46 +83,56 @@ public void testTwoShutdownListeners() { getState().unsubscribe(subscription1); getState().close(); - assertEquals(listener1.getEvents(), 0, "Checking got events"); - assertEquals(listener2.getEvents(), 1, "Checking got events"); + assertEquals(0, listener1.getEvents(), "Checking got events"); + assertEquals(1, listener2.getEvents(), "Checking got events"); getState().close(); - assertEquals(listener1.getEvents(), 0, "Checking got events"); - assertEquals(listener2.getEvents(), 1, "Checking got events"); + assertEquals(0, listener1.getEvents(), "Checking got events"); + assertEquals(1, listener2.getEvents(), "Checking got events"); getState().unsubscribe(subscription2); } - @Test(expectedExceptions = IllegalStateException.class) + @Test public void testCloseException() { - getState().close(); - getState().eval("45"); + Assertions.assertThrows(IllegalStateException.class, () -> { + getState().close(); + getState().eval("45"); + }); } - @Test(expectedExceptions = IllegalStateException.class, - enabled = false) //TODO 8139873 + @Test //TODO 8139873 + @Disabled public void testShutdownException() { - assertEval("System.exit(0);"); - getState().eval("45"); + Assertions.assertThrows(IllegalStateException.class, () -> { + assertEval("System.exit(0);"); + getState().eval("45"); + }); } - @Test(expectedExceptions = NullPointerException.class) + @Test public void testNullCallback() { - getState().onShutdown(null); + Assertions.assertThrows(NullPointerException.class, () -> { + getState().onShutdown(null); + }); } - @Test(expectedExceptions = IllegalStateException.class) + @Test public void testSubscriptionAfterClose() { - getState().close(); - getState().onShutdown(e -> {}); + Assertions.assertThrows(IllegalStateException.class, () -> { + getState().close(); + getState().onShutdown(e -> {}); + }); } - @Test(expectedExceptions = IllegalStateException.class, - enabled = false) //TODO 8139873 + @Test //TODO 8139873 + @Disabled public void testSubscriptionAfterShutdown() { - assertEval("System.exit(0);"); - getState().onShutdown(e -> {}); + Assertions.assertThrows(IllegalStateException.class, () -> { + assertEval("System.exit(0);"); + getState().onShutdown(e -> {}); + }); } private static class ShutdownListener implements Consumer { diff --git a/test/langtools/jdk/jshell/SimpleRegressionTest.java b/test/langtools/jdk/jshell/SimpleRegressionTest.java index 1e347cfd207e..4cd7c8b71eb1 100644 --- a/test/langtools/jdk/jshell/SimpleRegressionTest.java +++ b/test/langtools/jdk/jshell/SimpleRegressionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test 8130450 8158906 8154374 8166400 8171892 8173807 8173848 8282434 * @summary simple regression test * @build KullaTesting TestingInputStream - * @run testng SimpleRegressionTest + * @run junit SimpleRegressionTest */ @@ -36,53 +36,56 @@ import jdk.jshell.Snippet; import jdk.jshell.VarSnippet; import jdk.jshell.SnippetEvent; -import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static jdk.jshell.Snippet.Status.OVERWRITTEN; import static jdk.jshell.Snippet.SubKind.TEMP_VAR_EXPRESSION_SUBKIND; import static jdk.jshell.Snippet.Status.VALID; -import org.testng.annotations.BeforeMethod; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class SimpleRegressionTest extends KullaTesting { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine("local")); } + @Test public void testSnippetMemberAssignment() { assertEval("class C { int y; }"); assertEval("C c = new C();"); assertVarKeyMatch("c.y = 4;", true, "$1", TEMP_VAR_EXPRESSION_SUBKIND, "int", added(VALID)); } + @Test public void testUserTakesTempVarName() { assertEval("int $2 = 4;"); assertEval("String $1;"); assertVarKeyMatch("1234;", true, "$3", TEMP_VAR_EXPRESSION_SUBKIND, "int", added(VALID)); } + @Test public void testCompileThrow() { assertEvalException("throw new Exception();"); } + @Test public void testMultiSnippetDependencies() { List events = assertEval("int a = 3, b = a+a, c = b *100;", DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, chain(added(VALID)), chain(added(VALID)), chain(added(VALID))); - assertEquals(events.get(0).value(), "3"); - assertEquals(events.get(1).value(), "6"); - assertEquals(events.get(2).value(), "600"); + assertEquals("3", events.get(0).value()); + assertEquals("6", events.get(1).value()); + assertEquals("600", events.get(2).value()); assertEval("c;", "600"); } + @Test public void testLessThanParsing() { assertEval("int x = 3;", "3"); assertEval("int y = 4;", "4"); @@ -92,18 +95,22 @@ public void testLessThanParsing() { assertEval("x < y && y < z", "true"); } + @Test public void testNotStmtCannotResolve() { assertDeclareFail("dfasder;", new ExpectedDiagnostic("compiler.err.cant.resolve.location", 0, 7, 0, -1, -1, Diagnostic.Kind.ERROR)); } + @Test public void testNotStmtIncomparable() { assertDeclareFail("true == 5.0;", new ExpectedDiagnostic("compiler.err.incomparable.types", 0, 11, 5, -1, -1, Diagnostic.Kind.ERROR)); } + @Test public void testStringAdd() { assertEval("String s = \"a\" + \"b\";", "\"ab\""); } + @Test public void testExprSanity() { assertEval("int x = 3;", "3"); assertEval("int y = 4;", "4"); @@ -111,13 +118,15 @@ public void testExprSanity() { assertActiveKeys(); } + @Test public void testGenericMethodCrash() { assertDeclareWarn1(" void f(T...a) {}", (ExpectedDiagnostic) null); Snippet sn = methodKey(assertEval(" R n(R x) { return x; }", added(VALID))); VarSnippet sne = varKey(assertEval("n(5)", added(VALID))); - assertEquals(sne.typeName(), "Integer"); + assertEquals("Integer", sne.typeName()); } + @Test public void testLongRemoteStrings() { //8158906 assertEval("String m(int x) { byte[] b = new byte[x]; for (int i = 0; i < x; ++i) b[i] = (byte) 'a'; return new String(b); }"); boolean[] shut = new boolean[1]; @@ -127,12 +136,13 @@ public void testLongRemoteStrings() { //8158906 for (String len : new String[]{"12345", "64000", "65535", "65536", "120000"}) { List el = assertEval("m(" + len + ");"); assertFalse(shut[0], "JShell died with long string"); - assertEquals(el.size(), 1, "Excepted one event"); + assertEquals(1, el.size(), "Excepted one event"); assertTrue(el.get(0).value().length() > 10000, "Expected truncated but long String, got: " + el.get(0).value().length()); } } + @Test public void testLongRemoteJapaneseStrings() { //8158906 assertEval("import java.util.stream.*;"); assertEval("String m(int x) { return Stream.generate(() -> \"\u3042\").limit(x).collect(Collectors.joining()); }"); @@ -143,13 +153,14 @@ public void testLongRemoteJapaneseStrings() { //8158906 for (String len : new String[]{"12345", "21843", "21844", "21845", "21846", "64000", "65535", "65536", "120000"}) { List el = assertEval("m(" + len + ");"); assertFalse(shut[0], "JShell died with long string"); - assertEquals(el.size(), 1, "Excepted one event"); + assertEquals(1, el.size(), "Excepted one event"); assertTrue(el.get(0).value().length() > 10000, "Expected truncated but long String, got: " + el.get(0).value().length()); } } // 8130450 + @Test public void testDuplicate() { Snippet snm = methodKey(assertEval("void mm() {}", added(VALID))); assertEval("void mm() {}", @@ -161,11 +172,13 @@ public void testDuplicate() { ste(snv, VALID, OVERWRITTEN, false, MAIN_SNIPPET)); } + @Test public void testContextClassLoader() { assertEval("class C {}"); assertEval("C.class.getClassLoader() == Thread.currentThread().getContextClassLoader()", "true"); } + @Test public void testArrayRepresentation() { assertEval("new int[4]", "int[4] { 0, 0, 0, 0 }"); assertEval("new int[0]", "int[0] { }"); @@ -183,6 +196,7 @@ public void testArrayRepresentation() { "Object[3] { \"howdy\", int[3] { 33, 44, 55 }, String[2] { \"up\", \"down\" } }"); } + @Test public void testMultiDimArrayRepresentation() { assertEval("new int[3][1]", "int[3][] { int[1] { 0 }, int[1] { 0 }, int[1] { 0 } }"); @@ -199,6 +213,7 @@ public void testMultiDimArrayRepresentation() { "boolean[2][][] { boolean[1][] { boolean[3] { false, false, false } }, boolean[1][] { boolean[3] { false, false, false } } }"); } + @Test public void testStringRepresentation() { assertEval("\"A!\\rB!\"", "\"A!\\rB!\""); @@ -220,6 +235,7 @@ public void testStringRepresentation() { "\"a\u032Ea\""); } + @Test public void testCharRepresentation() { for (String s : new String[]{"'A'", "'Z'", "'0'", "'9'", "'a'", "'z'", "'*'", "'%'", diff --git a/test/langtools/jdk/jshell/SnippetEventToStringTest.java b/test/langtools/jdk/jshell/SnippetEventToStringTest.java new file mode 100644 index 000000000000..7dacafe93d22 --- /dev/null +++ b/test/langtools/jdk/jshell/SnippetEventToStringTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8350808 + * @summary Check for proper formatting of SnippetEvent.toString() + * @run junit SnippetEventToStringTest + */ + +import java.util.Map; +import java.util.List; + +import jdk.jshell.JShell; +import jdk.jshell.SnippetEvent; +import jdk.jshell.execution.LocalExecutionControlProvider; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class SnippetEventToStringTest { + + public String[][] sourceLevels() { + return new String[][] { + { "*", ",causeSnippet=null" }, + { "123", ",value=123" }, + { "throw new Exception(\"foo\");", ",exception=jdk.jshell.EvalException: foo" } + }; + } + + @ParameterizedTest + @MethodSource("sourceLevels") + void verifySnippetEvent(String source, String match) { + try (JShell jsh = JShell.builder().executionEngine(new LocalExecutionControlProvider(), Map.of()).build()) { + List result = jsh.eval(source); + assertEquals(1, result.size()); + String string = result.get(0).toString(); + if (!string.contains(match)) + throw new AssertionError(String.format("\"%s\" not found in \"%s\"", match, string)); + } + } +} diff --git a/test/langtools/jdk/jshell/SnippetHighlightTest.java b/test/langtools/jdk/jshell/SnippetHighlightTest.java index 9c59a3d80163..fb954706aa8e 100644 --- a/test/langtools/jdk/jshell/SnippetHighlightTest.java +++ b/test/langtools/jdk/jshell/SnippetHighlightTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,22 +32,22 @@ * jdk.jshell/jdk.jshell:open * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting TestingInputStream Compiler - * @run testng SnippetHighlightTest + * @run junit SnippetHighlightTest */ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -import org.testng.annotations.Test; import jdk.jshell.SourceCodeAnalysis.Highlight; -import static org.testng.Assert.*; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; -@Test public class SnippetHighlightTest extends KullaTesting { + @Test public void testMemberExpr() { assertEval("@Deprecated class TestClass { }"); assertEval("class TestConstructor { @Deprecated TestConstructor() {} }"); @@ -99,6 +99,7 @@ public void testMemberExpr() { "Highlight[start=5, end=11, attributes=[DECLARATION]]"); } + @Test public void testClassErrorRecovery() { //JDK-8301580 assertHighlights(""" class C { @@ -116,7 +117,7 @@ class C { private void assertHighlights(String code, String... expected) { List completions = computeHighlights(code); - assertEquals(completions, Arrays.asList(expected), "Input: " + code + ", " + completions.toString()); + assertEquals(Arrays.asList(expected), completions, "Input: " + code + ", " + completions.toString()); } private List computeHighlights(String code) { diff --git a/test/langtools/jdk/jshell/SnippetStatusListenerTest.java b/test/langtools/jdk/jshell/SnippetStatusListenerTest.java index 14ea0b956a70..205749af277e 100644 --- a/test/langtools/jdk/jshell/SnippetStatusListenerTest.java +++ b/test/langtools/jdk/jshell/SnippetStatusListenerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test * @summary Subscribe tests * @build KullaTesting TestingInputStream - * @run testng SnippetStatusListenerTest + * @run junit SnippetStatusListenerTest */ import java.util.ArrayList; @@ -37,14 +37,16 @@ import jdk.jshell.JShell.Subscription; import jdk.jshell.SnippetEvent; import jdk.jshell.TypeDeclSnippet; -import org.testng.annotations.Test; import static jdk.jshell.Snippet.Status.*; -import static org.testng.Assert.assertEquals; +import org.junit.jupiter.api.Assertions; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Test public class SnippetStatusListenerTest extends KullaTesting { + @Test public void testTwoSnippetEventListeners() { SnippetListener listener1 = new SnippetListener(); SnippetListener listener2 = new SnippetListener(); @@ -61,45 +63,52 @@ public void testTwoSnippetEventListeners() { assertEval("int a = 0;"); List events1 = Collections.unmodifiableList(listener1.getEvents()); - assertEquals(events1, listener2.getEvents(), "Checking got events"); + assertEquals(listener2.getEvents(), events1, "Checking got events"); getState().unsubscribe(subscription1); assertDrop(f, DiagCheck.DIAG_IGNORE, DiagCheck.DIAG_IGNORE, ste(f, REJECTED, DROPPED, false, null)); assertEval("void f() { }", added(VALID)); assertEvalException("throw new RuntimeException();"); - assertEquals(listener1.getEvents(), events1, "Checking that unsubscribed listener does not get events"); + assertEquals(events1, listener1.getEvents(), "Checking that unsubscribed listener does not get events"); List events2 = new ArrayList<>(listener2.getEvents()); events2.removeAll(events1); - assertEquals(events2.size(), 3, "The second listener got events"); + assertEquals(3, events2.size(), "The second listener got events"); } - @Test(expectedExceptions = NullPointerException.class) + @Test public void testNullCallback() { - getState().onSnippetEvent(null); + Assertions.assertThrows(NullPointerException.class, () -> { + getState().onSnippetEvent(null); + }); } - @Test(expectedExceptions = IllegalStateException.class) + @Test public void testSubscriptionAfterClose() { - getState().close(); - getState().onSnippetEvent(e -> {}); + Assertions.assertThrows(IllegalStateException.class, () -> { + getState().close(); + getState().onSnippetEvent(e -> {}); + }); } - @Test(expectedExceptions = IllegalStateException.class, - enabled = false) //TODO 8139873 + @Test //TODO 8139873 + @Disabled public void testSubscriptionAfterShutdown() { - assertEval("System.exit(0);"); - getState().onSnippetEvent(e -> {}); + Assertions.assertThrows(IllegalStateException.class, () -> { + assertEval("System.exit(0);"); + getState().onSnippetEvent(e -> {}); + }); } + @Test public void testSubscriptionToAnotherState() { SnippetListener listener = new SnippetListener(); Subscription subscription = getState().onSnippetEvent(listener); tearDown(); setUp(); assertEval("int x;"); - assertEquals(Collections.emptyList(), listener.getEvents(), "No events"); + assertEquals(listener.getEvents(), Collections.emptyList(), "No events"); getState().unsubscribe(subscription); } diff --git a/test/langtools/jdk/jshell/SnippetTest.java b/test/langtools/jdk/jshell/SnippetTest.java index 3ccd0e42f4b8..3e5bdbbf3242 100644 --- a/test/langtools/jdk/jshell/SnippetTest.java +++ b/test/langtools/jdk/jshell/SnippetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,74 +26,86 @@ * @bug 8139829 * @summary test accessors of Snippet * @build KullaTesting TestingInputStream - * @run testng SnippetTest + * @run junit SnippetTest */ import jdk.jshell.Snippet; import jdk.jshell.DeclarationSnippet; -import org.testng.annotations.Test; import jdk.jshell.MethodSnippet; import jdk.jshell.Snippet.Status; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static jdk.jshell.Snippet.Status.VALID; import static jdk.jshell.Snippet.Status.RECOVERABLE_DEFINED; import static jdk.jshell.Snippet.Status.OVERWRITTEN; import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED; import static jdk.jshell.Snippet.SubKind.*; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Test public class SnippetTest extends KullaTesting { + @Test public void testImportKey() { assertImportKeyMatch("import java.util.List;", "List", SINGLE_TYPE_IMPORT_SUBKIND, added(VALID)); assertImportKeyMatch("import java.util.*;", "java.util.*", TYPE_IMPORT_ON_DEMAND_SUBKIND, added(VALID)); assertImportKeyMatch("import static java.lang.String.*;", "java.lang.String.*", STATIC_IMPORT_ON_DEMAND_SUBKIND, added(VALID)); } + @Test public void testClassKey() { assertDeclarationKeyMatch("class X {}", false, "X", CLASS_SUBKIND, added(VALID)); } + @Test public void testInterfaceKey() { assertDeclarationKeyMatch("interface I {}", false, "I", INTERFACE_SUBKIND, added(VALID)); } + @Test public void testEnumKey() { assertDeclarationKeyMatch("enum E {}", false, "E", ENUM_SUBKIND, added(VALID)); } + @Test public void testAnnotationKey() { assertDeclarationKeyMatch("@interface A {}", false, "A", ANNOTATION_TYPE_SUBKIND, added(VALID)); } + @Test public void testMethodKey() { assertDeclarationKeyMatch("void m() {}", false, "m", METHOD_SUBKIND, added(VALID)); } + @Test public void testVarDeclarationKey() { assertVarKeyMatch("int a;", true, "a", VAR_DECLARATION_SUBKIND, "int", added(VALID)); } + @Test public void testVarDeclarationWithInitializerKey() { assertVarKeyMatch("double b = 9.0;", true, "b", VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, "double", added(VALID)); } + @Test public void testTempVarExpressionKey() { assertVarKeyMatch("47;", true, "$1", TEMP_VAR_EXPRESSION_SUBKIND, "int", added(VALID)); } + @Test public void testVarValueKey() { assertEval("double x = 4;", "4.0"); assertExpressionKeyMatch("x;", "x", VAR_VALUE_SUBKIND, "double"); } + @Test public void testAssignmentKey() { assertEval("int y;"); assertExpressionKeyMatch("y = 4;", "y", ASSIGNMENT_SUBKIND, "int"); } + @Test public void testStatementKey() { assertKeyMatch("if (true) {}", true, STATEMENT_SUBKIND, added(VALID)); assertKeyMatch("while (true) { break; }", true, STATEMENT_SUBKIND, added(VALID)); @@ -101,10 +113,12 @@ public void testStatementKey() { assertKeyMatch("for (;;) { break; }", true, STATEMENT_SUBKIND, added(VALID)); } + @Test public void noKeys() { assertActiveKeys(new DeclarationSnippet[0]); } + @Test public void testKeyId1() { Snippet a = classKey(assertEval("class A { }")); assertEval("void f() { }"); @@ -116,7 +130,8 @@ public void testKeyId1() { assertActiveKeys(); } - @Test(enabled = false) // TODO 8081689 + @Test // TODO 8081689 + @Disabled public void testKeyId2() { Snippet g = methodKey(assertEval("void g() { f(); }", added(RECOVERABLE_DEFINED))); Snippet f = methodKey(assertEval("void f() { }", @@ -136,6 +151,7 @@ public void testKeyId2() { assertActiveKeys(); } + @Test public void testKeyId3() { Snippet g = methodKey(assertEval("void g() { f(); }", added(RECOVERABLE_DEFINED))); Snippet f = methodKey(assertEval("void f() { }", @@ -154,6 +170,7 @@ public void testKeyId3() { assertActiveKeys(); } + @Test public void testBooleanSnippetQueries() { Snippet nd = varKey(assertEval("blort x;", added(RECOVERABLE_NOT_DEFINED))); assertTrue(nd.kind().isPersistent(), "nd.isPersistent"); diff --git a/test/langtools/jdk/jshell/SourceLevelTest.java b/test/langtools/jdk/jshell/SourceLevelTest.java index ce5572e6f712..f1092a5d2e89 100644 --- a/test/langtools/jdk/jshell/SourceLevelTest.java +++ b/test/langtools/jdk/jshell/SourceLevelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,15 +26,16 @@ * @bug 8259820 * @summary Check JShell can handle -source 8 * @modules jdk.jshell - * @run testng SourceLevelTest + * @run junit SourceLevelTest */ -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class SourceLevelTest extends ReplToolTesting { - @DataProvider(name="sourceLevels") public Object[][] sourceLevels() { return new Object[][] { new Object[] {"8"}, @@ -42,7 +43,8 @@ public Object[][] sourceLevels() { }; } - @Test(dataProvider="sourceLevels") + @ParameterizedTest + @MethodSource("sourceLevels") public void testSourceLevel(String sourceLevel) { test(new String[] {"-C", "-source", "-C", sourceLevel}, (a) -> assertCommand(a, "1 + 1", "$1 ==> 2"), diff --git a/test/langtools/jdk/jshell/StartOptionTest.java b/test/langtools/jdk/jshell/StartOptionTest.java index cd46318bead2..6eb638be1967 100644 --- a/test/langtools/jdk/jshell/StartOptionTest.java +++ b/test/langtools/jdk/jshell/StartOptionTest.java @@ -22,15 +22,16 @@ */ /* - * @test 8151754 8080883 8160089 8170162 8166581 8172102 8171343 8178023 8186708 8179856 8185840 8190383 + * @test 8151754 8080883 8160089 8170162 8166581 8172102 8171343 8178023 8186708 8179856 8185840 8190383 8341833 * @summary Testing startExCe-up options. * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool + * jdk.jshell/jdk.internal.jshell.tool.resources:+open * @library /tools/lib * @build Compiler toolbox.ToolBox - * @run testng StartOptionTest + * @run junit StartOptionTest */ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -38,24 +39,26 @@ import java.io.PrintStream; import java.nio.charset.StandardCharsets; import java.nio.file.Path; +import java.text.MessageFormat; import java.util.HashMap; import java.util.Locale; +import java.util.ResourceBundle; import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; +import jdk.jshell.JShell; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import jdk.jshell.tool.JavaShellToolBuilder; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import org.junit.jupiter.api.AfterEach; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class StartOptionTest { protected ByteArrayOutputStream cmdout; @@ -97,7 +100,7 @@ protected void check(ByteArrayOutputStream str, Consumer checkOut, Strin if (checkOut != null) { checkOut.accept(out); } else { - assertEquals(out, "", label + ": Expected empty -- "); + assertEquals("", out, label + ": Expected empty -- "); } } @@ -105,7 +108,7 @@ protected void checkExit(int ec, Consumer checkCode) { if (checkCode != null) { checkCode.accept(ec); } else { - assertEquals(ec, 0, "Expected standard exit code (0), but found: " + ec); + assertEquals(0, ec, "Expected standard exit code (0), but found: " + ec); } } @@ -126,10 +129,17 @@ protected void startExCoUoCeCn(Consumer checkExitCode, check(usererr, null, "usererr"); } + protected void startCheckError(Consumer checkError, + String... args) { + runShell(args); + check(cmderr, checkError, "userout"); + check(userout, null, "userout"); + check(usererr, null, "usererr"); + } + // Start with an exit code and command error check protected void startExCe(int eec, Consumer checkError, String... args) { - StartOptionTest.this.startExCoUoCeCn( - (Integer ec) -> assertEquals((int) ec, eec, + StartOptionTest.this.startExCoUoCeCn((Integer ec) -> assertEquals(eec, (int) ec, "Expected error exit code (" + eec + "), but found: " + ec), null, null, checkError, null, args); } @@ -142,7 +152,7 @@ protected void startCo(Consumer checkCmdOutput, String... args) { private Consumer assertOrNull(String expected, String label) { return expected == null ? null - : s -> assertEquals(s.replaceAll("\\r\\n?", "\n").trim(), expected.trim(), label); + : s -> assertEquals(expected.trim(), s.replaceAll("\\r\\n?", "\n").trim(), label); } // Start and check the resultant: exit code (Ex), command output (Co), @@ -153,10 +163,9 @@ protected void startExCoUoCeCn(int expectedExitCode, String expectedError, String expectedConsole, String... args) { - startExCoUoCeCn( - expectedExitCode == 0 + startExCoUoCeCn(expectedExitCode == 0 ? null - : (Integer i) -> assertEquals((int) i, expectedExitCode, + : (Integer i) -> assertEquals(expectedExitCode, (int) i, "Expected exit code (" + expectedExitCode + "), but found: " + i), assertOrNull(expectedCmdOutput, "cmdout: "), assertOrNull(expectedUserOutput, "userout: "), @@ -180,7 +189,7 @@ protected void startUo(String expectedUserOutput, String... args) { startExCoUoCeCn(0, null, expectedUserOutput, null, null, args); } - @BeforeMethod + @BeforeEach public void setUp() { cmdout = new ByteArrayOutputStream(); cmderr = new ByteArrayOutputStream(); @@ -203,6 +212,7 @@ protected void setIn(String s) { } // Test load files + @Test public void testCommandFile() { String fn = writeToFile("String str = \"Hello \"\n" + "/list\n" + @@ -217,6 +227,7 @@ public void testCommandFile() { } // Test that the usage message is printed + @Test public void testUsage() { for (String opt : new String[]{"-?", "-h", "--help"}) { startCo(s -> { @@ -229,6 +240,7 @@ public void testUsage() { } // Test the --help-extra message + @Test public void testHelpExtra() { for (String opt : new String[]{"-X", "--help-extra"}) { startCo(s -> { @@ -241,12 +253,14 @@ public void testHelpExtra() { } // Test handling of bogus options + @Test public void testUnknown() { startExCe(1, "Unknown option: u", "-unknown"); startExCe(1, "Unknown option: unknown", "--unknown"); } // Test that input is read with "-" and there is no extra output. + @Test public void testHypenFile() { setIn("System.out.print(\"Hello\");\n"); startUo("Hello", "-"); @@ -263,6 +277,7 @@ public void testHypenFile() { } // Test that user specified exit codes are propagated + @Test public void testExitCode() { setIn("/exit 57\n"); startExCoUoCeCn(57, null, null, null, "-> /exit 57", "-s"); @@ -277,11 +292,13 @@ public void testExitCode() { } // Test that non-existent load file sends output to stderr and does not startExCe (no welcome). + @Test public void testUnknownLoadFile() { startExCe(1, "File 'UNKNOWN' for 'jshell' is not found.", "UNKNOWN"); } // Test bad usage of the --startup option + @Test public void testStartup() { String fn = writeToFile(""); startExCe(1, "Argument to startup missing.", "--startup"); @@ -291,18 +308,21 @@ public void testStartup() { } // Test an option that causes the back-end to fail is propagated + @Test public void testStartupFailedOption() { startExCe(1, s -> assertTrue(s.contains("Unrecognized option: -hoge-foo-bar"), "cmderr: " + s), "-R-XX:-IgnoreUnrecognizedVMOptions", "-R-hoge-foo-bar"); } // Test the use of non-existant files with the --startup option + @Test public void testStartupUnknown() { startExCe(1, "File 'UNKNOWN' for '--startup' is not found.", "--startup", "UNKNOWN"); startExCe(1, "File 'UNKNOWN' for '--startup' is not found.", "--startup", "DEFAULT", "--startup", "UNKNOWN"); } // Test bad usage of --class-path option + @Test public void testClasspath() { for (String cp : new String[]{"--class-path"}) { startExCe(1, "Only one --class-path option may be used.", cp, ".", "--class-path", "."); @@ -311,12 +331,14 @@ public void testClasspath() { } // Test bogus module on --add-modules option + @Test public void testUnknownModule() { startExCe(1, s -> assertTrue(s.contains("rror") && s.contains("unKnown"), "cmderr: " + s), "--add-modules", "unKnown"); } // Test that muliple feedback options fail + @Test public void testFeedbackOptionConflict() { startExCe(1, "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "concise", "--feedback", "verbose"); @@ -331,12 +353,14 @@ public void testFeedbackOptionConflict() { } // Test bogus arguments to the --feedback option + @Test public void testNegFeedbackOption() { startExCe(1, "Argument to feedback missing.", "--feedback"); startExCe(1, "Does not match any current feedback mode: blorp -- --feedback blorp", "--feedback", "blorp"); } // Test --version + @Test public void testVersion() { startCo(s -> { assertTrue(s.startsWith("jshell"), "unexpected version: " + s); @@ -346,6 +370,7 @@ public void testVersion() { } // Test --show-version + @Test public void testShowVersion() { startExCoUoCeCn(null, s -> { @@ -358,7 +383,26 @@ public void testShowVersion() { "--show-version"); } - @AfterMethod + public void testErroneousFile() { + String code = """ + var v = ( + System.console().readLine("prompt: "); + /exit + """; + String readLinePrompt = writeToFile(code); + String expectedErrorFormat = + ResourceBundle.getBundle("jdk.internal.jshell.tool.resources.l10n", + Locale.getDefault(), + JShell.class.getModule()) + .getString("jshell.err.incomplete.input"); + String expectedError = + new MessageFormat(expectedErrorFormat).format(new Object[] {code}); + startCheckError(s -> assertEquals(expectedError, s), + readLinePrompt); + } + + + @AfterEach public void tearDown() { cmdout = null; cmderr = null; diff --git a/test/langtools/jdk/jshell/StopExecutionTest.java b/test/langtools/jdk/jshell/StopExecutionTest.java index 389794d35d24..12f95ea99c0d 100644 --- a/test/langtools/jdk/jshell/StopExecutionTest.java +++ b/test/langtools/jdk/jshell/StopExecutionTest.java @@ -27,7 +27,7 @@ * @summary Test JShell#stop * @modules jdk.jshell/jdk.internal.jshell.tool * @build KullaTesting TestingInputStream - * @run testng StopExecutionTest + * @run junit StopExecutionTest */ import java.io.IOException; @@ -42,28 +42,30 @@ import jdk.internal.jshell.tool.StopDetectingInputStream; import jdk.internal.jshell.tool.StopDetectingInputStream.State; import jdk.jshell.JShell; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -@Test public class StopExecutionTest extends KullaTesting { private final Object lock = new Object(); private boolean isStopped; - @Test(enabled = false) // TODO 8129546 + @Test // TODO 8129546 + @Disabled public void testStopLoop() throws InterruptedException { scheduleStop("while (true) ;"); } - @Test(enabled = false) // TODO 8129546 + @Test // TODO 8129546 + @Disabled public void testStopASleep() throws InterruptedException { scheduleStop("while (true) { try { Thread.sleep(100); } catch (InterruptedException ex) { } }"); } - @Test(enabled = false) // TODO 8129546 + @Test // TODO 8129546 + @Disabled public void testScriptCatchesStop() throws Exception { scheduleStop("for (int i = 0; i < 30; i++) { try { Thread.sleep(100); } catch (Throwable ex) { } }"); } @@ -104,6 +106,7 @@ private void scheduleStop(String src) throws InterruptedException { t.join(); } + @Test public void testStopDetectingInputRandom() throws IOException { long seed = System.nanoTime(); Random r = new Random(seed); @@ -129,10 +132,11 @@ private void doChunk(StopDetectingInputStream buffer, int chunkSize) throws IOEx for (int c = 0; c < chunkSize; c++) { int read = buffer.read(); - assertEquals(read, c); + assertEquals(c, read); } } + @Test public void testStopDetectingInputBufferWaitStop() throws Exception { Runnable shouldNotHappenRun = () -> { throw new AssertionError("Should not happen."); }; diff --git a/test/langtools/jdk/jshell/T8146368/JShellTest8146368.java b/test/langtools/jdk/jshell/T8146368/JShellTest8146368.java index 8cf92545bb5c..21cb37e65b3a 100644 --- a/test/langtools/jdk/jshell/T8146368/JShellTest8146368.java +++ b/test/langtools/jdk/jshell/T8146368/JShellTest8146368.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,14 +27,14 @@ * @summary Test Smashing Error when user language is Japanese * @library /tools/lib /jdk/jshell * @build KullaTesting - * @run testng/othervm -Duser.language=ja JShellTest8146368 + * @run junit/othervm -Duser.language=ja JShellTest8146368 */ import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class JShellTest8146368 extends KullaTesting { + @Test public void test() { assertEval("class A extends B {}", added(RECOVERABLE_NOT_DEFINED)); assertEval("und m() { return new und(); }", added(RECOVERABLE_NOT_DEFINED)); diff --git a/test/langtools/jdk/jshell/T8146368/JShellToolTest8146368.java b/test/langtools/jdk/jshell/T8146368/JShellToolTest8146368.java index 101083c0e271..3a7db71be713 100644 --- a/test/langtools/jdk/jshell/T8146368/JShellToolTest8146368.java +++ b/test/langtools/jdk/jshell/T8146368/JShellToolTest8146368.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,13 +28,13 @@ * @modules jdk.jshell/jdk.internal.jshell.tool * @library /tools/lib /jdk/jshell * @build ReplToolTesting - * @run testng/othervm -Duser.language=ja JShellToolTest8146368 + * @run junit/othervm -Duser.language=ja JShellToolTest8146368 */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class JShellToolTest8146368 extends ReplToolTesting { + @Test public void test() { test( a -> assertCommand(a, "class A extends B {}", "| created class A, however, it cannot be referenced until class B is declared\n"), diff --git a/test/langtools/jdk/jshell/Test8294583.java b/test/langtools/jdk/jshell/Test8294583.java index 3d2ce2e36381..281911b71133 100644 --- a/test/langtools/jdk/jshell/Test8294583.java +++ b/test/langtools/jdk/jshell/Test8294583.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,22 +26,23 @@ * @bug 8294583 * @summary JShell: NPE in switch with non existing record pattern * @build KullaTesting TestingInputStream - * @run testng Test8294583 + * @run junit Test8294583 */ -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class Test8294583 extends KullaTesting { + @Test public void test() { assertEvalFail("switch (new Object()) {\n" + " case Foo() -> {}\n" + "};"); } - @org.testng.annotations.BeforeMethod + @BeforeEach public void setUp() { super.setUp(bc -> bc.compilerOptions("--source", System.getProperty("java.specification.version"), "--enable-preview").remoteVMOptions("--enable-preview")); } diff --git a/test/langtools/jdk/jshell/Test8296012.java b/test/langtools/jdk/jshell/Test8296012.java index 73e5cc06ae0a..4f08861b952d 100644 --- a/test/langtools/jdk/jshell/Test8296012.java +++ b/test/langtools/jdk/jshell/Test8296012.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,21 +26,22 @@ * @bug 8296012 * @summary jshell crashes on mismatched record pattern * @build KullaTesting TestingInputStream - * @run testng Test8296012 + * @run junit Test8296012 */ -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class Test8296012 extends KullaTesting { + @Test public void test() { assertEval("record Foo(int x, int y) {}"); assertEvalFail("switch (new Foo(1, 2)) { case Foo(int z) -> z; }"); } - @org.testng.annotations.BeforeMethod + @BeforeEach public void setUp() { super.setUp(bc -> bc.compilerOptions("--source", System.getProperty("java.specification.version"), "--enable-preview").remoteVMOptions("--enable-preview")); } diff --git a/test/langtools/jdk/jshell/ToolBasicTest.java b/test/langtools/jdk/jshell/ToolBasicTest.java index b5128de738a9..5015d1f64b12 100644 --- a/test/langtools/jdk/jshell/ToolBasicTest.java +++ b/test/langtools/jdk/jshell/ToolBasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ * @library /tools/lib * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build KullaTesting TestingInputStream Compiler - * @run testng/timeout=600 ToolBasicTest + * @run junit/timeout=600 ToolBasicTest * @key intermittent */ @@ -57,19 +57,18 @@ import java.util.stream.Stream; import com.sun.net.httpserver.HttpServer; -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.fail; - -@Test public class ToolBasicTest extends ReplToolTesting { + @Test public void elideStartUpFromList() { - test( - (a) -> assertCommandOutputContains(a, "123", "==> 123"), + test((a) -> assertCommandOutputContains(a, "123", "==> 123"), (a) -> assertCommandCheckOutput(a, "/list", (s) -> { int cnt; try (Scanner scanner = new Scanner(s)) { @@ -81,11 +80,12 @@ public void elideStartUpFromList() { } } } - assertEquals(cnt, 1, "Expected only one listed line"); + assertEquals(1, cnt, "Expected only one listed line"); }) ); } + @Test public void elideStartUpFromSave() throws IOException { Compiler compiler = new Compiler(); Path path = compiler.getPath("myfile"); @@ -94,10 +94,11 @@ public void elideStartUpFromSave() throws IOException { (a) -> assertCommand(a, "/save " + path.toString(), "") ); try (Stream lines = Files.lines(path)) { - assertEquals(lines.count(), 1, "Expected only one saved line"); + assertEquals(1, lines.count(), "Expected only one saved line"); } } + @Test public void testInterrupt() { ReplTest interrupt = (a) -> assertCommand(a, "\u0003", ""); for (String s : new String[] { "", "\u0003" }) { @@ -132,6 +133,7 @@ public void testInterrupt() { } } + @Test public void testCtrlD() { test(false, new String[]{"--no-startup"}, a -> { @@ -193,6 +195,7 @@ private void assertStop(boolean after, String cmd, String output) { } } + @Test public void testStop() { test( (a) -> assertStop(a, "while (true) {}", ""), @@ -200,6 +203,7 @@ public void testStop() { ); } + @Test public void testRerun() { test(false, new String[] {"--no-startup"}, (a) -> assertCommand(a, "/0", "| No snippet with ID: 0"), @@ -221,7 +225,7 @@ public void testRerun() { final int finalI = i; Consumer check = (s) -> { String[] ss = s.split("\n"); - assertEquals(ss[0], codes[finalI]); + assertEquals(codes[finalI], ss[0]); assertTrue(ss.length > 1, s); }; tests.add((a) -> assertCommandCheckOutput(a, "/" + (finalI + 1), check)); @@ -231,7 +235,7 @@ public void testRerun() { final int finalI = i; Consumer check = (s) -> { String[] ss = s.split("\n"); - assertEquals(ss[0], codes[codes.length - finalI - 1]); + assertEquals(codes[codes.length - finalI - 1], ss[0]); assertTrue(ss.length > 1, s); }; tests.add((a) -> assertCommandCheckOutput(a, "/-" + (2 * finalI + 1), check)); @@ -241,11 +245,12 @@ public void testRerun() { tests.toArray(new ReplTest[tests.size()])); } + @Test public void test8142447() { Function> assertRerun = cmd -> (code, assertionCount) -> (a) -> assertCommandCheckOutput(a, cmd, s -> { String[] ss = s.split("\n"); - assertEquals(ss[0], code); + assertEquals(code, ss[0]); loadVariable(a, "int", "assertionCount", Integer.toString(assertionCount), Integer.toString(assertionCount)); }); ReplTest assertVariables = (a) -> assertCommandCheckOutput(a, "/v", assertVariables()); @@ -256,7 +261,7 @@ public void test8142447() { "void add(int n) { assertionCount += n; }"); test(new String[]{"--startup", startup.toString()}, (a) -> assertCommand(a, "add(1)", ""), // id: 1 - (a) -> assertCommandCheckOutput(a, "add(ONE)", s -> assertEquals(s.split("\n")[0], "| Error:")), // id: e1 + (a) -> assertCommandCheckOutput(a, "add(ONE)", s -> assertEquals("| Error:", s.split("\n")[0])), // id: e1 (a) -> assertVariable(a, "int", "ONE", "1", "1"), assertRerun.apply("/1").apply("add(1)", 2), assertVariables, assertRerun.apply("/e1").apply("add(ONE)", 3), assertVariables, @@ -270,6 +275,7 @@ public void test8142447() { ); } + @Test public void testClasspathDirectory() { Compiler compiler = new Compiler(); Path outDir = Paths.get("testClasspathDirectory"); @@ -285,6 +291,7 @@ public void testClasspathDirectory() { ); } + @Test public void testEnvInStartUp() { Compiler compiler = new Compiler(); Path outDir = Paths.get("testClasspathDirectory"); @@ -320,6 +327,7 @@ private String makeSimpleJar() { return compiler.getPath(outDir).resolve(jarName).toString(); } + @Test public void testClasspathJar() { String jarPath = makeSimpleJar(); test( @@ -332,6 +340,7 @@ public void testClasspathJar() { ); } + @Test public void testClasspathUserHomeExpansion() { String jarPath = makeSimpleJar(); String tilde = "~" + File.separator; @@ -346,6 +355,7 @@ public void testClasspathUserHomeExpansion() { ); } + @Test public void testBadClasspath() { String jarPath = makeSimpleJar(); Compiler compiler = new Compiler(); @@ -373,6 +383,7 @@ private String makeBadSourceJar() { return compiler.getPath(outDir).resolve(jarName).toString(); } + @Test public void testBadSourceJarClasspath() { String jarPath = makeBadSourceJar(); test( @@ -391,6 +402,7 @@ public void testBadSourceJarClasspath() { ); } + @Test public void testModulePath() { Compiler compiler = new Compiler(); Path modsDir = Paths.get("mods"); @@ -406,6 +418,7 @@ public void testModulePath() { ); } + @Test public void testModulePathUserHomeExpansion() { String tilde = "~" + File.separatorChar; test( @@ -415,6 +428,7 @@ public void testModulePathUserHomeExpansion() { ); } + @Test public void testBadModulePath() { Compiler compiler = new Compiler(); Path t1 = compiler.getPath("whatever/thing.zip"); @@ -425,6 +439,7 @@ public void testBadModulePath() { ); } + @Test public void testStartupFileOption() { Compiler compiler = new Compiler(); Path startup = compiler.getPath("StartupFileOption/startup.txt"); @@ -440,6 +455,7 @@ public void testStartupFileOption() { ); } + @Test public void testLoadingFromArgs() { Compiler compiler = new Compiler(); Path path = compiler.getPath("loading.repl"); @@ -450,6 +466,7 @@ public void testLoadingFromArgs() { ); } + @Test public void testReset() { test( (a) -> assertReset(a, "/res"), @@ -470,6 +487,7 @@ public void testReset() { ); } + @Test public void testOpen() { Compiler compiler = new Compiler(); Path path = compiler.getPath("testOpen.repl"); @@ -504,6 +522,7 @@ public void testOpen() { } } + @Test public void testOpenLocalFileUrl() { Compiler compiler = new Compiler(); Path path = compiler.getPath("testOpen.repl"); @@ -518,6 +537,7 @@ public void testOpenLocalFileUrl() { } } + @Test public void testOpenFileOverHttp() throws IOException { var script = "int a = 10;int b = 20;int c = a + b;"; @@ -549,6 +569,7 @@ public void testOpenFileOverHttp() throws IOException { } } + @Test public void testOpenResource() { test(new String[]{"-R", "-Duser.language=en", "-R", "-Duser.country=US"}, (a) -> assertCommand(a, "/open PRINTING", ""), @@ -559,6 +580,7 @@ public void testOpenResource() { ); } + @Test public void testSave() throws IOException { Compiler compiler = new Compiler(); Path path = compiler.getPath("testSave.repl"); @@ -573,7 +595,7 @@ public void testSave() throws IOException { (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"), (a) -> assertCommand(a, "/save " + path.toString(), "") ); - assertEquals(Files.readAllLines(path), list); + assertEquals(list, Files.readAllLines(path)); } { List output = new ArrayList<>(); @@ -589,7 +611,7 @@ public void testSave() throws IOException { .collect(Collectors.toList()))), (a) -> assertCommand(a, "/save -all " + path.toString(), "") ); - assertEquals(Files.readAllLines(path), output); + assertEquals(output, Files.readAllLines(path)); } { List output = new ArrayList<>(); @@ -606,7 +628,7 @@ public void testSave() throws IOException { .collect(Collectors.toList()))), (a) -> assertCommand(a, "/save 2-3 1 4 " + path.toString(), "") ); - assertEquals(Files.readAllLines(path), output); + assertEquals(output, Files.readAllLines(path)); } { List output = new ArrayList<>(); @@ -621,10 +643,11 @@ public void testSave() throws IOException { (a) -> assertCommand(a, "/save -history " + path.toString(), "") ); output.add("/save -history " + path.toString()); - assertEquals(Files.readAllLines(path), output); + assertEquals(output, Files.readAllLines(path)); } } + @Test public void testStartRetain() { Compiler compiler = new Compiler(); Path startUpFile = compiler.getPath("startUp.txt"); @@ -655,6 +678,7 @@ public void testStartRetain() { ); } + @Test public void testStartSave() throws IOException { Compiler compiler = new Compiler(); Path startSave = compiler.getPath("startSave.txt"); @@ -662,9 +686,10 @@ public void testStartSave() throws IOException { List lines = Files.lines(startSave) .filter(s -> !s.isEmpty()) .collect(Collectors.toList()); - assertEquals(lines, START_UP); + assertEquals(START_UP, lines); } + @Test public void testConstrainedUpdates() { test( a -> assertClass(a, "class XYZZY { }", "class", "XYZZY"), @@ -674,6 +699,7 @@ public void testConstrainedUpdates() { ); } + @Test public void testRemoteExit() { test( a -> assertVariable(a, "int", "x"), @@ -686,11 +712,13 @@ public void testRemoteExit() { ); } + @Test public void testFeedbackNegative() { test(a -> assertCommandCheckOutput(a, "/set feedback aaaa", assertStartsWith("| Does not match any current feedback mode"))); } + @Test public void testFeedbackSilent() { for (String off : new String[]{"s", "silent"}) { test( @@ -702,6 +730,7 @@ public void testFeedbackSilent() { } } + @Test public void testFeedbackNormal() { Compiler compiler = new Compiler(); Path testNormalFile = compiler.getPath("testConciseNormal"); @@ -728,6 +757,7 @@ public void testFeedbackNormal() { } } + @Test public void testVarsWithNotActive() { test( a -> assertVariable(a, "Blath", "x"), @@ -735,6 +765,7 @@ public void testVarsWithNotActive() { ); } + @Test public void testHistoryReference() { test(false, new String[]{"--no-startup"}, a -> assertCommand(a, "System.err.println(99)", "", "", null, "", "99\n"), @@ -767,6 +798,7 @@ public void testHistoryReference() { ); } + @Test public void testRerunIdRange() { Compiler compiler = new Compiler(); Path startup = compiler.getPath("rangeStartup"); @@ -825,7 +857,8 @@ public void testRerunIdRange() { ); } - @Test(enabled = false) // TODO 8158197 + @Test // TODO 8158197 + @Disabled public void testHeadlessEditPad() { String prevHeadless = System.getProperty("java.awt.headless"); try { @@ -838,6 +871,7 @@ public void testHeadlessEditPad() { } } + @Test public void testAddExports() { test(false, new String[]{"--no-startup"}, a -> assertCommandOutputStartsWith(a, "import jdk.internal.misc.VM;", "| Error:") @@ -854,6 +888,7 @@ public void testAddExports() { ); } + @Test public void testRedeclareVariableNoInit() { test( a -> assertCommand(a, "Integer a;", "a ==> null"), @@ -865,6 +900,7 @@ public void testRedeclareVariableNoInit() { ); } + @Test public void testWarningUnchecked() { //8223688 test(false, new String[]{"--no-startup"}, a -> assertCommand(a, "abstract class A { A(T t){} }", "| created class A"), @@ -876,6 +912,7 @@ public void testWarningUnchecked() { //8223688 ); } + @Test public void testIndent() { //8223688 prefsMap.remove("INDENT"); test(false, new String[]{"--no-startup"}, @@ -887,6 +924,7 @@ public void testIndent() { //8223688 ); } + @Test public void testSystemExitStartUp() { Compiler compiler = new Compiler(); Path startup = compiler.getPath("SystemExitStartUp/startup.txt"); diff --git a/test/langtools/jdk/jshell/ToolCommandOptionTest.java b/test/langtools/jdk/jshell/ToolCommandOptionTest.java index ec137a3ec608..d647c28c20cf 100644 --- a/test/langtools/jdk/jshell/ToolCommandOptionTest.java +++ b/test/langtools/jdk/jshell/ToolCommandOptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,16 +30,16 @@ * jdk.compiler/com.sun.tools.javac.main * @library /tools/lib * @build ToolCommandOptionTest ReplToolTesting - * @run testng ToolCommandOptionTest + * @run junit ToolCommandOptionTest */ import java.nio.file.Path; -import org.testng.annotations.Test; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; -@Test public class ToolCommandOptionTest extends ReplToolTesting { + @Test public void listTest() { test( (a) -> assertCommand(a, "int x;", @@ -67,6 +67,7 @@ public void listTest() { ); } + @Test public void typesTest() { test( (a) -> assertCommand(a, "int x", @@ -92,6 +93,7 @@ public void typesTest() { ); } + @Test public void dropTest() { test(false, new String[]{"--no-startup"}, (a) -> assertCommand(a, "int x = 5;", @@ -120,6 +122,7 @@ public void dropTest() { ); } + @Test public void setEditorTest() { test( (a) -> assertCommand(a, "/set editor -furball", @@ -157,6 +160,7 @@ public void setEditorTest() { ); } + @Test public void retainEditorTest() { test( (a) -> assertCommand(a, "/set editor -retain -furball", @@ -211,6 +215,7 @@ public void retainEditorTest() { ); } + @Test public void setEditorEnvTest() { setEnvVar("EDITOR", "best one"); setEditorEnvSubtest(); @@ -244,6 +249,7 @@ private void setEditorEnvSubtest() { ); } + @Test public void setStartTest() { Compiler compiler = new Compiler(); Path startup = compiler.getPath("StartTest/startup.txt"); @@ -288,6 +294,7 @@ public void setStartTest() { ); } + @Test public void retainStartTest() { Compiler compiler = new Compiler(); Path startup = compiler.getPath("StartTest/startup.txt"); @@ -337,6 +344,7 @@ public void retainStartTest() { ); } + @Test public void setModeTest() { test( (a) -> assertCommandOutputContains(a, "/set mode", @@ -399,6 +407,7 @@ public void setModeTest() { ); } + @Test public void setModeSmashTest() { test( (a) -> assertCommand(a, "/set mode mymode -command", @@ -428,6 +437,7 @@ public void setModeSmashTest() { ); } + @Test public void retainModeTest() { test( (a) -> assertCommandOutputStartsWith(a, "/set mode -retain", @@ -531,6 +541,7 @@ public void retainModeTest() { ); } + @Test public void retainModeDeleteLocalTest() { test( (a) -> assertCommand(a, "/set mode rmdlt normal -command", diff --git a/test/langtools/jdk/jshell/ToolEnableNativeAccessTest.java b/test/langtools/jdk/jshell/ToolEnableNativeAccessTest.java index 212301c0fd83..54cae875d893 100644 --- a/test/langtools/jdk/jshell/ToolEnableNativeAccessTest.java +++ b/test/langtools/jdk/jshell/ToolEnableNativeAccessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,12 +26,11 @@ * @bug 8268725 * @summary Tests for the --enable-native-access option * @modules jdk.jshell - * @run testng ToolEnableNativeAccessTest + * @run junit ToolEnableNativeAccessTest */ -import org.testng.annotations.Test; - -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; public class ToolEnableNativeAccessTest extends ReplToolTesting { diff --git a/test/langtools/jdk/jshell/ToolEnablePreviewTest.java b/test/langtools/jdk/jshell/ToolEnablePreviewTest.java index 61a54254455e..6e5d63eade9f 100644 --- a/test/langtools/jdk/jshell/ToolEnablePreviewTest.java +++ b/test/langtools/jdk/jshell/ToolEnablePreviewTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,11 @@ * @test * @bug 8199193 * @summary Tests for the --enable-preview option - * @run testng ToolEnablePreviewTest + * @run junit ToolEnablePreviewTest */ -import org.testng.annotations.Test; - -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; public class ToolEnablePreviewTest extends ReplToolTesting { diff --git a/test/langtools/jdk/jshell/ToolFormatTest.java b/test/langtools/jdk/jshell/ToolFormatTest.java index 3aaf5e79ea5f..5d25fb99928b 100644 --- a/test/langtools/jdk/jshell/ToolFormatTest.java +++ b/test/langtools/jdk/jshell/ToolFormatTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,21 +31,22 @@ * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler - * @run testng ToolFormatTest + * @run junit ToolFormatTest */ import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Test public class ToolFormatTest extends ReplToolTesting { + @Test public void testSetFormat() { try { test( @@ -86,6 +87,7 @@ public void testSetFormat() { } } + @Test public void testSetFormatOverride() { test( (a) -> assertCommand(a, "/set mode tm -c", "| Created new feedback mode: tm"), @@ -138,6 +140,7 @@ public void testSetFormatOverride() { ); } + @Test public void testSetFormatSelectorSample() { test( (a) -> assertCommandOutputStartsWith(a, "/set mode ate -quiet", @@ -197,7 +200,8 @@ public void testSetFormatSelectorSample() { // A sampling of these has been added (above: testSetFormatSelectorSample). // See 8173007 // Save for possible future deep testing or debugging - @Test(enabled = false) + @Test + @Disabled public void testSetFormatSelector() { List tests = new ArrayList<>(); tests.add((a) -> assertCommandOutputStartsWith(a, "/set mode ate -quiet", @@ -278,6 +282,7 @@ boolean append(boolean ahead) { } } + @Test public void testSetTruncation() { try { test( @@ -309,6 +314,7 @@ public void testSetTruncation() { } } + @Test public void testDefaultTruncation() { test( (a) -> assertCommand(a, "char[] cs = new char[2000];", null), @@ -331,9 +337,9 @@ public void testDefaultTruncation() { ); } + @Test public void testPrompt() { - test( - (a) -> assertCommand(a, "/set mode tp -quiet", "| Created new feedback mode: tp"), + test((a) -> assertCommand(a, "/set mode tp -quiet", "| Created new feedback mode: tp"), (a) -> assertCommand(a, "/set prompt tp 'aaa' 'bbb'", ""), (a) -> assertCommand(a, "/set prompt tp", "| /set prompt tp \"aaa\" \"bbb\""), @@ -347,21 +353,21 @@ public void testPrompt() { (s) -> { try { BufferedReader rdr = new BufferedReader(new StringReader(s)); - assertEquals(rdr.readLine(), "| /set mode tp -quiet", + assertEquals("| /set mode tp -quiet", rdr.readLine(), "| /set mode tp -quiet"); - assertEquals(rdr.readLine(), "| /set prompt tp \"aaa\" \"bbb\"", + assertEquals("| /set prompt tp \"aaa\" \"bbb\"", rdr.readLine(), "| /set prompt tp \"aaa\" \"bbb\""); String l = rdr.readLine(); while (l.startsWith("| /set format tp ")) { l = rdr.readLine(); } - assertEquals(l, "| /set mode -retain tp", + assertEquals("| /set mode -retain tp", l, "| /set mode -retain tp"); - assertEquals(rdr.readLine(), "| ", + assertEquals("| ", rdr.readLine(), "| "); - assertEquals(rdr.readLine(), "| /set mode tp -quiet", + assertEquals("| /set mode tp -quiet", rdr.readLine(), "| /set mode tp -quiet"); - assertEquals(rdr.readLine(), "| /set prompt tp \"ccc\" \"ddd\"", + assertEquals("| /set prompt tp \"ccc\" \"ddd\"", rdr.readLine(), "| /set prompt tp \"ccc\" \"ddd\""); } catch (IOException ex) { fail("threw " + ex); @@ -370,12 +376,14 @@ public void testPrompt() { ); } + @Test public void testShowFeedbackModes() { test( (a) -> assertCommandOutputContains(a, "/set feedback", "normal") ); } + @Test public void testSetNewModeQuiet() { try { test( @@ -396,6 +404,7 @@ public void testSetNewModeQuiet() { } } + @Test public void testSetError() { try { test( @@ -473,6 +482,7 @@ public void testSetError() { } } + @Test public void testSetHelp() { try { test( diff --git a/test/langtools/jdk/jshell/ToolLocalSimpleTest.java b/test/langtools/jdk/jshell/ToolLocalSimpleTest.java index 6221f2951036..bb0273a2123d 100644 --- a/test/langtools/jdk/jshell/ToolLocalSimpleTest.java +++ b/test/langtools/jdk/jshell/ToolLocalSimpleTest.java @@ -30,12 +30,12 @@ * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool * @build KullaTesting TestingInputStream ToolSimpleTest - * @run testng/othervm ToolLocalSimpleTest + * @run junit/othervm ToolLocalSimpleTest */ import java.util.Locale; -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; public class ToolLocalSimpleTest extends ToolSimpleTest { @@ -51,12 +51,12 @@ public void test(Locale locale, boolean isDefaultStartUp, String[] args, String @Test public void verifyLocal() { System.setProperty("LOCAL_CHECK", "Here"); - assertEquals(System.getProperty("LOCAL_CHECK"), "Here"); + assertEquals("Here", System.getProperty("LOCAL_CHECK")); test(new String[]{"--no-startup"}, a -> assertCommand(a, "System.getProperty(\"LOCAL_CHECK\")", "$1 ==> \"Here\""), a -> assertCommand(a, "System.setProperty(\"LOCAL_CHECK\", \"After\")", "$2 ==> \"Here\"") ); - assertEquals(System.getProperty("LOCAL_CHECK"), "After"); + assertEquals("After", System.getProperty("LOCAL_CHECK")); } @Override diff --git a/test/langtools/jdk/jshell/ToolLocaleMessageTest.java b/test/langtools/jdk/jshell/ToolLocaleMessageTest.java index 6111320f1af4..c3e4a4211437 100644 --- a/test/langtools/jdk/jshell/ToolLocaleMessageTest.java +++ b/test/langtools/jdk/jshell/ToolLocaleMessageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,16 +31,15 @@ * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler - * @run testng ToolLocaleMessageTest + * @run junit ToolLocaleMessageTest * @key intermittent */ import java.util.Locale; -import org.testng.annotations.Test; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; -@Test public class ToolLocaleMessageTest extends ReplToolTesting { void testLocale(ReplTest... tests) { @@ -67,12 +66,14 @@ void assertCommandFail(boolean after, String cmd, String... contains) { }); } + @Test public void testTerminate() { testLocale( (a) -> assertCommandOK(a, "System.exit(1)", "/reload") ); } + @Test public void testSample() { try { testLocale( @@ -98,6 +99,7 @@ public void testSample() { } } + @Test public void testCommand() { try { testLocale( @@ -132,6 +134,7 @@ public void testCommand() { } } + @Test public void testHelp() { testLocale( (a) -> assertCommandOK(a, "/help", "/list", "/save", "/set", "[-restore]"), @@ -153,6 +156,7 @@ public void testHelp() { ); } + @Test public void testFeedbackError() { try { testLocale( diff --git a/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java b/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java index 8a7b46fc1c77..e3cbba3f20d4 100644 --- a/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java +++ b/test/langtools/jdk/jshell/ToolMultilineSnippetHistoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8182489 * @summary test history with multiline snippets @@ -31,18 +31,18 @@ * jdk.jshell/jdk.jshell:open * @build UITesting * @build ToolMultilineSnippetHistoryTest - * @run testng ToolMultilineSnippetHistoryTest + * @run junit ToolMultilineSnippetHistoryTest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class ToolMultilineSnippetHistoryTest extends UITesting { public ToolMultilineSnippetHistoryTest() { super(true); } + @Test public void testUpArrow() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("int x=\n44\n"); diff --git a/test/langtools/jdk/jshell/ToolProviderTest.java b/test/langtools/jdk/jshell/ToolProviderTest.java index be8ba23f7c48..b8e9f8e0f4e0 100644 --- a/test/langtools/jdk/jshell/ToolProviderTest.java +++ b/test/langtools/jdk/jshell/ToolProviderTest.java @@ -23,8 +23,8 @@ import java.util.ServiceLoader; import javax.tools.Tool; -import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; /* * @test @@ -34,11 +34,11 @@ * jdk.compiler/com.sun.tools.javac.main * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool + * jdk.jshell/jdk.internal.jshell.tool.resources:+open * @library /tools/lib * @build Compiler toolbox.ToolBox - * @run testng ToolProviderTest + * @run junit ToolProviderTest */ -@Test public class ToolProviderTest extends StartOptionTest { // Through the provider, the console and console go to command out (we assume, @@ -71,6 +71,7 @@ protected int runShell(String... args) { // Test --show-version @Override + @Test public void testShowVersion() { startCo(s -> { assertTrue(s.startsWith("jshell "), "unexpected version: " + s); diff --git a/test/langtools/jdk/jshell/ToolReloadTest.java b/test/langtools/jdk/jshell/ToolReloadTest.java index 4709584cd126..c4193f602bef 100644 --- a/test/langtools/jdk/jshell/ToolReloadTest.java +++ b/test/langtools/jdk/jshell/ToolReloadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,20 +32,20 @@ * jdk.jshell/jdk.internal.jshell.tool * @library /tools/lib * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler - * @run testng ToolReloadTest + * @run junit ToolReloadTest */ import java.nio.file.Path; import java.nio.file.Paths; import java.util.function.Function; -import org.testng.annotations.Test; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; -@Test public class ToolReloadTest extends ReplToolTesting { + @Test public void testReloadSnippets() { test( (a) -> assertVariable(a, "int", "x", "5", "5"), @@ -63,6 +63,7 @@ public void testReloadSnippets() { ); } + @Test public void testReloadClasspath() { Function prog = (s) -> String.format( "package pkg; public class A { public String toString() { return \"%s\"; } }\n", s); @@ -89,6 +90,7 @@ public void testReloadClasspath() { ); } + @Test public void testReloadDrop() { test(false, new String[]{"--no-startup"}, a -> assertVariable(a, "int", "a"), @@ -112,6 +114,7 @@ public void testReloadDrop() { ); } + @Test public void testReloadQuiet() { test(false, new String[]{"--no-startup"}, a -> assertVariable(a, "int", "a"), @@ -129,6 +132,7 @@ public void testReloadQuiet() { ); } + @Test public void testReloadRepeat() { test(false, new String[]{"--no-startup"}, (a) -> assertVariable(a, "int", "c", "7", "7"), @@ -149,6 +153,7 @@ public void testReloadRepeat() { ); } + @Test public void testReloadIgnore() { test(false, new String[]{"--no-startup"}, (a) -> assertCommand(a, "(-)", null), @@ -162,6 +167,7 @@ public void testReloadIgnore() { ); } + @Test public void testReloadResetRestore() { test( (a) -> assertVariable(a, "int", "x", "5", "5"), @@ -180,6 +186,7 @@ public void testReloadResetRestore() { ); } + @Test public void testReloadCrashRestore() { test( (a) -> assertVariable(a, "int", "x", "5", "5"), @@ -200,6 +207,7 @@ public void testReloadCrashRestore() { ); } + @Test public void testEnvBadModule() { test(new String[] {"--execution", Presets.TEST_STANDARD_EXECUTION}, (a) -> assertVariable(a, "int", "x", "5", "5"), @@ -221,6 +229,7 @@ public void testEnvBadModule() { ); } + @Test public void testReloadExitRestore() { test(false, new String[]{"--no-startup"}, (a) -> assertVariable(a, "int", "x", "5", "5"), diff --git a/test/langtools/jdk/jshell/ToolRetainTest.java b/test/langtools/jdk/jshell/ToolRetainTest.java index 452a3d8dac2c..adf3dd0343e2 100644 --- a/test/langtools/jdk/jshell/ToolRetainTest.java +++ b/test/langtools/jdk/jshell/ToolRetainTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,15 +27,15 @@ * @summary Tests of what information is retained across jshell tool runs * @modules jdk.jshell/jdk.internal.jshell.tool * @build ToolRetainTest ReplToolTesting - * @run testng ToolRetainTest + * @run junit ToolRetainTest */ import java.util.Locale; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class ToolRetainTest extends ReplToolTesting { + @Test public void testRetainMode() { test( (a) -> assertCommand(a, "/set mode trm -quiet", "| Created new feedback mode: trm"), @@ -53,6 +53,7 @@ public void testRetainMode() { ); } + @Test public void testRetain2Mode() { test( (a) -> assertCommand(a, "/set mode trm1 -quiet", "| Created new feedback mode: trm1"), @@ -81,6 +82,7 @@ public void testRetain2Mode() { ); } + @Test public void testRetainFeedback() { test( (a) -> assertCommand(a, "/set feedback -retain verbose", "| Feedback mode: verbose"), @@ -95,6 +97,7 @@ public void testRetainFeedback() { ); } + @Test public void testRetainFeedbackBlank() { String feedbackOut = "| /set feedback -retain verbose\n" + @@ -116,6 +119,7 @@ public void testRetainFeedbackBlank() { ); } + @Test public void testRetainEditor() { test( (a) -> assertCommand(a, "/set editor -retain nonexistent", @@ -130,6 +134,7 @@ public void testRetainEditor() { ); } + @Test public void testRetainEditorBlank() { test( (a) -> assertCommand(a, "/set editor nonexistent", "| Editor set to: nonexistent"), @@ -142,6 +147,7 @@ public void testRetainEditorBlank() { ); } + @Test public void testRetainModeNeg() { test( (a) -> assertCommandOutputStartsWith(a, "/set mode -retain verbose", @@ -151,6 +157,7 @@ public void testRetainModeNeg() { ); } + @Test public void testRetainFeedbackNeg() { test( (a) -> assertCommandOutputStartsWith(a, "/set feedback -retain babble1", @@ -167,6 +174,7 @@ public void testRetainFeedbackNeg() { ); } + @Test public void testNoRetainMode() { test( (a) -> assertCommand(a, "/set mode trm -quiet", "| Created new feedback mode: trm"), @@ -182,6 +190,7 @@ public void testNoRetainMode() { ); } + @Test public void testNoRetainFeedback() { test( (a) -> assertCommand(a, "/set feedback verbose", "| Feedback mode: verbose"), diff --git a/test/langtools/jdk/jshell/ToolShiftTabTest.java b/test/langtools/jdk/jshell/ToolShiftTabTest.java index 4c36d79c16a4..84f1a65c67be 100644 --- a/test/langtools/jdk/jshell/ToolShiftTabTest.java +++ b/test/langtools/jdk/jshell/ToolShiftTabTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8166334 8188894 * @summary test shift-tab shortcuts "fixes" @@ -31,18 +31,18 @@ * jdk.jshell/jdk.jshell:open * @build UITesting * @build ToolShiftTabTest - * @run testng/timeout=300 ToolShiftTabTest + * @run junit/timeout=300 ToolShiftTabTest */ import java.util.regex.Pattern; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class ToolShiftTabTest extends UITesting { // Shift-tab as escape sequence private String FIX = "\033\133\132"; + @Test public void testFixVariable() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("3+4"); @@ -54,6 +54,7 @@ public void testFixVariable() throws Exception { }); } + @Test public void testFixMethod() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("5.5 >= 3.1415926535"); @@ -68,6 +69,7 @@ public void testFixMethod() throws Exception { }); } + @Test public void testFixMethodVoid() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("System.out.println(\"Testing\")"); @@ -81,6 +83,7 @@ public void testFixMethodVoid() throws Exception { }); } + @Test public void testFixMethodNoLeaks() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("4"); @@ -106,6 +109,7 @@ public void testFixMethodNoLeaks() throws Exception { }); } + @Test public void testFixImport() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("Frame"); @@ -126,6 +130,7 @@ public void testFixImport() throws Exception { }); } + @Test public void testFixBad() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("123"); diff --git a/test/langtools/jdk/jshell/ToolSimpleTest.java b/test/langtools/jdk/jshell/ToolSimpleTest.java index 222acb5291c7..668da9605788 100644 --- a/test/langtools/jdk/jshell/ToolSimpleTest.java +++ b/test/langtools/jdk/jshell/ToolSimpleTest.java @@ -34,7 +34,7 @@ * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool * @build KullaTesting TestingInputStream - * @run testng ToolSimpleTest + * @run junit ToolSimpleTest */ import java.util.ArrayList; @@ -46,10 +46,9 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.testng.annotations.Test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; public class ToolSimpleTest extends ReplToolTesting { @@ -542,7 +541,7 @@ private void checkLineToList(String in, List match) { String[] res = trimmed.isEmpty() ? new String[0] : trimmed.split("\n"); - assertEquals(res.length, match.size(), "Got: " + Arrays.asList(res)); + assertEquals(match.size(), res.length, "Got: " + Arrays.asList(res)); for (int i = 0; i < match.size(); ++i) { assertTrue(res[i].contains(match.get(i))); } @@ -618,7 +617,7 @@ public void testMethodsArgs() { a -> assertCommandCheckOutput(a, "/methods print println printf", s -> checkLineToList(s, printingMethodList)), a -> assertCommandCheckOutput(a, "/methods println", - s -> assertEquals(s.trim().split("\n").length, 10)), + s -> assertEquals(10, s.trim().split("\n").length)), a -> assertCommandCheckOutput(a, "/methods", s -> checkLineToList(s, printingMethodList)), a -> assertCommandOutputStartsWith(a, "/methods " + arg, diff --git a/test/langtools/jdk/jshell/ToolTabCommandTest.java b/test/langtools/jdk/jshell/ToolTabCommandTest.java index 9a429bb72530..3dcc81e77bea 100644 --- a/test/langtools/jdk/jshell/ToolTabCommandTest.java +++ b/test/langtools/jdk/jshell/ToolTabCommandTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8177076 8185840 8178109 8192863 * @modules @@ -34,18 +34,18 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build Compiler UITesting * @build ToolTabCommandTest - * @run testng ToolTabCommandTest + * @run junit ToolTabCommandTest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class ToolTabCommandTest extends UITesting { public ToolTabCommandTest() { super(true); } + @Test public void testCommand() throws Exception { // set terminal height so that help output won't hit page breaks System.setProperty("test.terminal.height", "1000000"); @@ -133,6 +133,7 @@ public void testCommand() throws Exception { }); } + @Test public void testRerunCommands() throws Exception { // set terminal height so that help output won't hit page breaks System.setProperty("test.terminal.height", "1000000"); @@ -170,6 +171,7 @@ public void testRerunCommands() throws Exception { }); } + @Test public void testHelp() throws Exception { // set terminal height so that help output won't hit page breaks System.setProperty("test.terminal.height", "1000000"); diff --git a/test/langtools/jdk/jshell/ToolTabSnippetTest.java b/test/langtools/jdk/jshell/ToolTabSnippetTest.java index 86338938c2cd..39189da86865 100644 --- a/test/langtools/jdk/jshell/ToolTabSnippetTest.java +++ b/test/langtools/jdk/jshell/ToolTabSnippetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8177076 8185426 8189595 8188072 8221759 8255273 * @modules @@ -34,7 +34,7 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build Compiler UITesting * @build ToolTabSnippetTest - * @run testng/timeout=300 ToolTabSnippetTest + * @run junit/timeout=300 ToolTabSnippetTest */ import java.io.IOException; @@ -48,15 +48,15 @@ import java.util.jar.JarOutputStream; import jdk.internal.jshell.tool.ConsoleIOContextTestSupport; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class ToolTabSnippetTest extends UITesting { public ToolTabSnippetTest() { super(true); } + @Test public void testExpression() throws Exception { Path classes = prepareZip(); doRunTest((inputSink, out) -> { @@ -208,6 +208,7 @@ public void testExpression() throws Exception { }); } + @Test public void testCleaningCompletionTODO() throws Exception { doRunTest((inputSink, out) -> { CountDownLatch testCompleteComputationStarted = new CountDownLatch(1); @@ -241,6 +242,7 @@ protected void willComputeCompletionCallback() { }); } + @Test public void testNoRepeat() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("String xyzAA;\n"); @@ -266,6 +268,7 @@ public void testNoRepeat() throws Exception { }); } + @Test public void testCrash8221759() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("java.io.File.path" + TAB); @@ -331,6 +334,7 @@ private Path prepareZip() { //where: private final Compiler compiler = new Compiler(); + @Test public void testDocumentationAfterInsert() throws Exception { doRunTest((inputSink, out) -> { inputSink.write("import java.time.*\n"); diff --git a/test/langtools/jdk/jshell/ToolingTest.java b/test/langtools/jdk/jshell/ToolingTest.java index b36fdc03c190..1f514caf2e39 100644 --- a/test/langtools/jdk/jshell/ToolingTest.java +++ b/test/langtools/jdk/jshell/ToolingTest.java @@ -30,11 +30,10 @@ * jdk.jdeps/com.sun.tools.javap * jdk.jshell/jdk.internal.jshell.tool * @build KullaTesting TestingInputStream - * @run testng ToolingTest + * @run junit ToolingTest */ -import org.testng.Assert; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; public class ToolingTest extends ReplToolTesting { @Test diff --git a/test/langtools/jdk/jshell/TypeNameTest.java b/test/langtools/jdk/jshell/TypeNameTest.java index dc2b2152ca81..cbcde20a5413 100644 --- a/test/langtools/jdk/jshell/TypeNameTest.java +++ b/test/langtools/jdk/jshell/TypeNameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,14 +26,12 @@ * @bug 8144903 8171981 8191802 8191842 * @summary Tests for determining the type from the expression * @build KullaTesting TestingInputStream - * @run testng TypeNameTest + * @run junit TypeNameTest */ -import org.testng.annotations.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; - -@Test public class TypeNameTest extends KullaTesting { @@ -42,10 +40,11 @@ private void assertType(String expr, String type) { } private void assertType(String expr, String type, String inferType) { - assertEquals(varKey(assertEval(expr)).typeName(), type); + assertEquals(type, varKey(assertEval(expr)).typeName()); assertInferredType(expr, inferType); } + @Test public void testTypeInference() { assertEval("import java.util.List;"); assertEval("import java.util.ArrayList;"); @@ -75,6 +74,7 @@ public void testTypeInference() { assertType("(P) null", "P"); } + @Test public void testConditionals() { assertEval("import java.util.List;"); assertEval("import java.util.ArrayList;"); @@ -95,6 +95,7 @@ public void testConditionals() { assertType("b? new B() : new C()", "X"); } + @Test public void testJEP286NonDenotable() { assertEval("import java.util.List;"); assertEval("import java.util.Arrays;"); @@ -144,6 +145,7 @@ public void testJEP286NonDenotable() { assertType("unbStringIter().iterator().next().get(0)", "Object"); } + @Test public void testJEP286NonDenotable2() { assertEval("import java.util.List;"); assertEval("import java.util.Arrays;"); @@ -197,6 +199,7 @@ public void testJEP286NonDenotable2() { "Number"); } + @Test public void testVariableTypeName() { assertType("\"x\"", "String"); @@ -213,30 +216,36 @@ public void testVariableTypeName() { assertType("java.util.Locale.Category.FORMAT", "Category"); } + @Test public void testReplNestedClassName() { assertEval("class D { static class E {} }"); assertType("new D.E();", "D.E"); } + @Test public void testAnonymousClassName() { assertEval("class C {}"); assertType("new C();", "C"); assertType("new C() { int x; };", "", "C"); } + @Test public void testCapturedTypeName() { assertType("\"\".getClass();", "Class"); assertType("\"\".getClass().getEnumConstants();", "String[]"); } + @Test public void testJavaLang() { assertType("\"\";", "String"); } + @Test public void testNotOverEagerPackageEating() { assertType("\"\".getClass().getDeclaredMethod(\"hashCode\");", "java.lang.reflect.Method"); } + @Test public void testBounds() { assertEval("java.util.List list1 = java.util.Arrays.asList(\"\");"); assertType("list1.iterator().next()", "String"); diff --git a/test/langtools/jdk/jshell/UITesting.java b/test/langtools/jdk/jshell/UITesting.java index 473ba36c5aed..b9bfd994fc85 100644 --- a/test/langtools/jdk/jshell/UITesting.java +++ b/test/langtools/jdk/jshell/UITesting.java @@ -61,7 +61,7 @@ public UITesting(boolean laxLineEndings) { this.laxLineEndings = laxLineEndings; } - protected void doRunTest(Test test) throws Exception { + protected void doRunTest(UITest test) throws Exception { // turn on logging of launch failures Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL); @@ -127,7 +127,7 @@ public void write(String str) throws IOException { } } - protected interface Test { + protected interface UITest { public void test(Writer inputSink, StringBuilder out) throws Exception; } diff --git a/test/langtools/jdk/jshell/UndefinedClassTest.java b/test/langtools/jdk/jshell/UndefinedClassTest.java index 5c509252bd6f..3891aa7b4cd3 100644 --- a/test/langtools/jdk/jshell/UndefinedClassTest.java +++ b/test/langtools/jdk/jshell/UndefinedClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -/** +/* * @test * @bug 8292755 * @summary InternalError seen while throwing undefined exception @@ -35,18 +35,18 @@ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask * @build Compiler UITesting * @build UndefinedClassTest - * @run testng UndefinedClassTest + * @run junit UndefinedClassTest */ -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class UndefinedClassTest extends UITesting { public UndefinedClassTest() { super(true); } + @Test public void testUndefinedClassWithStaticAccess() throws Exception{ String code = "@FunctionalInterface\n" + "interface RunnableWithThrowable {\n" + @@ -62,6 +62,7 @@ public void testUndefinedClassWithStaticAccess() throws Exception{ }); } + @Test public void testUndefinedClassWithDefaultAccess() throws Exception{ String code = "@FunctionalInterface\n" + "interface RunnableWithThrowable {\n" + diff --git a/test/langtools/jdk/jshell/UnicodeTest.java b/test/langtools/jdk/jshell/UnicodeTest.java index 6812dcf1a50e..13dd30f0975d 100644 --- a/test/langtools/jdk/jshell/UnicodeTest.java +++ b/test/langtools/jdk/jshell/UnicodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,27 +26,28 @@ * @bug 8248157 * @summary test Unicode characters in Snippets * @build KullaTesting TestingInputStream - * @run testng UnicodeTest + * @run junit UnicodeTest */ import jdk.jshell.Snippet; import jdk.jshell.DeclarationSnippet; -import org.testng.annotations.Test; import jdk.jshell.Snippet.Status; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static jdk.jshell.Snippet.Status.VALID; import static jdk.jshell.Snippet.SubKind.*; +import org.junit.jupiter.api.Test; -@Test public class UnicodeTest extends KullaTesting { + @Test public void testVarDeclarationKey() { assertVarKeyMatch("int \\u00aa;", true, "\u00aa", VAR_DECLARATION_SUBKIND, "int", added(VALID)); assertEval("\\u00aa", "0"); } + @Test public void testVarDeclarationWithInitializerKey() { assertVarKeyMatch("double \\u00ba\\u0044\\u0577 = 9.4;", true, "\u00ba\u0044\u0577", VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, "double", added(VALID)); diff --git a/test/langtools/jdk/jshell/UnnamedTest.java b/test/langtools/jdk/jshell/UnnamedTest.java index 87ce6f68cadd..65d2b83c8562 100644 --- a/test/langtools/jdk/jshell/UnnamedTest.java +++ b/test/langtools/jdk/jshell/UnnamedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,31 +23,109 @@ /* * @test - * @bug 9999999 + * @bug 8315851 8315588 * @summary Tests for unnamed variables * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jshell * @build Compiler KullaTesting TestingInputStream ExpectedDiagnostic - * @run testng UnnamedTest + * @run junit UnnamedTest */ import java.util.function.Consumer; + +import jdk.jshell.SourceCodeAnalysis; import jdk.jshell.VarSnippet; -import org.testng.Assert; -import org.testng.annotations.Test; import jdk.jshell.JShell; +import static jdk.jshell.SourceCodeAnalysis.Completeness.COMPLETE; +import static jdk.jshell.SourceCodeAnalysis.Completeness.DEFINITELY_INCOMPLETE; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + public class UnnamedTest extends KullaTesting { @Test public void unnamed() { VarSnippet sn1 = varKey(assertEval("int _ = 0;")); VarSnippet sn2 = varKey(assertEval("String _ = \"x\";")); - Assert.assertEquals(getState().varValue(sn1), "0"); - Assert.assertEquals(getState().varValue(sn2), "\"x\""); + Assertions.assertEquals("0", getState().varValue(sn1)); + Assertions.assertEquals("\"x\"", getState().varValue(sn2)); + } + + static final String[] definitely_incomplete = new String[]{ + "int _ = ", + "int m(String v, int r) {\n" + + " try {\n" + + " return Integer.parseInt(v, r);\n" + + " } catch (NumberFormatException _) {", + "try (final Lock _ = ", + "try (Lock _ = null) {\n" + + " try (Lock _ = null) {", + "for (var _ : strs", + "TwoParams p1 = (_, _) ->", + "for (int _ = 0, _ = 1, x = 1;", + "if (r instanceof R(_" + }; + + static final String[] complete = new String[]{ + "int _ = 42;", + "int m(String v, int r) {\n" + + " try {\n" + + " return Integer.parseInt(v, r);\n" + + " } catch (NumberFormatException _) { } }", + "try (final Lock _ = TEST) {}", + "try (Lock _ = null) {\n" + + " try (Lock _ = null) { } }", + "for (var _ : strs) { }", + "TwoParams p1 = (_, _) -> {};", + "for (int _ = 0, _ = 1, x = 1; x <= 1 ; x++) {}", + "if (r instanceof R(_)) { }" + }; + + private void assertStatus(String input, SourceCodeAnalysis.Completeness status, String source) { + String augSrc; + switch (status) { + case COMPLETE_WITH_SEMI: + augSrc = source + ";"; + break; + + case DEFINITELY_INCOMPLETE: + augSrc = null; + break; + + case CONSIDERED_INCOMPLETE: + augSrc = source + ";"; + break; + + case EMPTY: + case COMPLETE: + case UNKNOWN: + augSrc = source; + break; + + default: + throw new AssertionError(); + } + assertAnalyze(input, status, augSrc); + } + + private void assertStatus(String[] ins, SourceCodeAnalysis.Completeness status) { + for (String input : ins) { + assertStatus(input, status, input); + } + } + + @Test + public void test_definitely_incomplete() { + assertStatus(definitely_incomplete, DEFINITELY_INCOMPLETE); + } + + @Test + public void test_definitely_complete() { + assertStatus(complete, COMPLETE); } @Override diff --git a/test/langtools/jdk/jshell/UserExecutionControlTest.java b/test/langtools/jdk/jshell/UserExecutionControlTest.java index 90c99db4a8fb..41719f9ff2ab 100644 --- a/test/langtools/jdk/jshell/UserExecutionControlTest.java +++ b/test/langtools/jdk/jshell/UserExecutionControlTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,29 +26,29 @@ * @bug 8156101 8159935 8159122 8168615 * @summary Tests for ExecutionControl SPI * @build KullaTesting ExecutionControlTestBase - * @run testng UserExecutionControlTest + * @run junit UserExecutionControlTest */ -import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; -import org.testng.annotations.BeforeMethod; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class UserExecutionControlTest extends ExecutionControlTestBase { - @BeforeMethod + @BeforeEach @Override public void setUp() { setUp(builder -> builder.executionEngine("local")); } + @Test public void verifyLocal() throws ClassNotFoundException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { System.setProperty("LOCAL_CHECK", "TBD"); - assertEquals(System.getProperty("LOCAL_CHECK"), "TBD"); + assertEquals("TBD", System.getProperty("LOCAL_CHECK")); assertEval("System.getProperty(\"LOCAL_CHECK\")", "\"TBD\""); assertEval("System.setProperty(\"LOCAL_CHECK\", \"local\")"); - assertEquals(System.getProperty("LOCAL_CHECK"), "local"); + assertEquals("local", System.getProperty("LOCAL_CHECK")); } } diff --git a/test/langtools/jdk/jshell/UserInputTest.java b/test/langtools/jdk/jshell/UserInputTest.java index 392278abef19..c0246acdf63e 100644 --- a/test/langtools/jdk/jshell/UserInputTest.java +++ b/test/langtools/jdk/jshell/UserInputTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,18 +26,18 @@ * @bug 8131023 8167461 * @summary Verify that the user's code can read System.in * @build KullaTesting TestingInputStream - * @run testng UserInputTest + * @run junit UserInputTest * @key intermittent */ import java.io.IOException; import java.io.InputStream; -import org.testng.annotations.Test; +import org.junit.jupiter.api.Test; -@Test public class UserInputTest extends KullaTesting { + @Test public void testReadInput() { setInput("AB\n"); assertEval("System.in.read()", "65"); @@ -45,6 +45,7 @@ public void testReadInput() { assertEval("System.in.read()", "67"); } + @Test public void testScanner() { assertEval("import java.util.Scanner;"); assertEval("Scanner s = new Scanner(System.in);"); @@ -52,6 +53,7 @@ public void testScanner() { assertEval("s.nextInt();", "12"); } + @Test public void testClose() { setInput(new InputStream() { private final byte[] data = new byte[] {0, 1, 2}; @@ -73,6 +75,7 @@ public void testClose() { assertEval("System.in.read();", "-1"); } + @Test public void testException() { setInput(new InputStream() { private final int[] data = new int[] {0, 1, -2, 2}; @@ -99,6 +102,7 @@ public void testException() { assertEval("System.in.read();", "-1"); } + @Test public void testNoConsole() { assertEval("System.console()", "null"); } diff --git a/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java b/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java index 02c725cffa41..094c705bce64 100644 --- a/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java +++ b/test/langtools/jdk/jshell/UserJdiUserRemoteTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,46 +26,48 @@ * @bug 8160128 8159935 8168615 * @summary Tests for Aux channel, custom remote agents, custom JDI implementations. * @build KullaTesting ExecutionControlTestBase MyExecutionControl MyRemoteExecutionControl MyExecutionControlProvider - * @run testng UserJdiUserRemoteTest + * @run junit UserJdiUserRemoteTest * @key intermittent */ import java.io.ByteArrayOutputStream; -import org.testng.annotations.Test; -import org.testng.annotations.BeforeMethod; import jdk.jshell.Snippet; import static jdk.jshell.Snippet.Status.OVERWRITTEN; import static jdk.jshell.Snippet.Status.VALID; import jdk.jshell.VarSnippet; import jdk.jshell.spi.ExecutionControl; import jdk.jshell.spi.ExecutionControl.ExecutionControlException; -import static org.testng.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -@Test public class UserJdiUserRemoteTest extends ExecutionControlTestBase { ExecutionControl currentEC; ByteArrayOutputStream auxStream; - @BeforeMethod + @BeforeEach @Override public void setUp() { auxStream = new ByteArrayOutputStream(); setUp(builder -> builder.executionEngine(new MyExecutionControlProvider(this), null)); } + @Test public void testVarValue() { VarSnippet dv = varKey(assertEval("double aDouble = 1.5;")); String vd = getState().varValue(dv); - assertEquals(vd, "1.5"); - assertEquals(auxStream.toString(), "aDouble"); + assertEquals("1.5", vd); + assertEquals("aDouble", auxStream.toString()); } + @Test public void testExtension() throws ExecutionControlException { assertEval("42;"); Object res = currentEC.extensionCommand("FROG", "test"); - assertEquals(res, "ribbit"); + assertEquals("ribbit", res); } + @Test public void testRedefine() { Snippet vx = varKey(assertEval("int x;")); Snippet mu = methodKey(assertEval("int mu() { return x * 4; }")); diff --git a/test/langtools/jdk/jshell/VariablesTest.java b/test/langtools/jdk/jshell/VariablesTest.java index 51ccbd17d604..46ddc699d13e 100644 --- a/test/langtools/jdk/jshell/VariablesTest.java +++ b/test/langtools/jdk/jshell/VariablesTest.java @@ -23,14 +23,14 @@ /* * @test - * @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236 8252409 8294431 + * @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236 8252409 8294431 8322532 * @summary Tests for EvaluationState.variables * @library /tools/lib * @modules jdk.compiler/com.sun.tools.javac.api * jdk.compiler/com.sun.tools.javac.main * jdk.jshell * @build Compiler KullaTesting TestingInputStream ExpectedDiagnostic - * @run testng VariablesTest + * @run junit VariablesTest */ import java.nio.file.Path; @@ -44,18 +44,19 @@ import jdk.jshell.VarSnippet; import jdk.jshell.Snippet.SubKind; import jdk.jshell.SnippetEvent; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; import static java.util.stream.Collectors.toList; import static jdk.jshell.Snippet.Status.*; import static jdk.jshell.Snippet.SubKind.VAR_DECLARATION_SUBKIND; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; -@Test public class VariablesTest extends KullaTesting { + @Test public void noVariables() { assertNumberOfActiveVariables(0); } @@ -69,6 +70,7 @@ private void badVarValue(VarSnippet key) { } } + @Test public void testVarValue1() { VarSnippet v1 = varKey(assertEval("und1 a;", added(RECOVERABLE_NOT_DEFINED))); badVarValue(v1); @@ -89,6 +91,7 @@ public void testVarValue1() { badVarValue(v2); } + @Test public void testVarValue2() { VarSnippet v1 = (VarSnippet) assertDeclareFail("int a = 0.0;", "compiler.err.prob.found.req"); badVarValue(v1); @@ -97,6 +100,7 @@ public void testVarValue2() { badVarValue(v2); } + @Test public void testSignature1() { VarSnippet v1 = varKey(assertEval("und1 a;", added(RECOVERABLE_NOT_DEFINED))); assertVariableDeclSnippet(v1, "a", "und1", RECOVERABLE_NOT_DEFINED, VAR_DECLARATION_SUBKIND, 1, 0); @@ -116,6 +120,7 @@ public void testSignature1() { assertVariableDeclSnippet(v2, "a", "und2", RECOVERABLE_NOT_DEFINED, VAR_DECLARATION_SUBKIND, 1, 0); } + @Test public void testSignature2() { VarSnippet v1 = (VarSnippet) assertDeclareFail("int a = 0.0;", "compiler.err.prob.found.req"); assertVariableDeclSnippet(v1, "a", "int", REJECTED, SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, 0, 1); @@ -126,6 +131,7 @@ public void testSignature2() { assertVariableDeclSnippet(v2, "a", "int", DROPPED, SubKind.VAR_DECLARATION_WITH_INITIALIZER_SUBKIND, 0, 0); } + @Test public void variables() { VarSnippet snx = varKey(assertEval("int x = 10;")); VarSnippet sny = varKey(assertEval("String y = \"hi\";")); @@ -137,22 +143,25 @@ public void variables() { assertActiveKeys(); } + @Test public void variablesArray() { VarSnippet sn = varKey(assertEval("int[] a = new int[12];")); - assertEquals(sn.typeName(), "int[]"); + assertEquals("int[]", sn.typeName()); assertEval("int len = a.length;", "12"); assertVariables(variable("int[]", "a"), variable("int", "len")); assertActiveKeys(); } + @Test public void variablesArrayOld() { VarSnippet sn = varKey(assertEval("int a[] = new int[12];")); - assertEquals(sn.typeName(), "int[]"); + assertEquals("int[]", sn.typeName()); assertEval("int len = a.length;", "12"); assertVariables(variable("int[]", "a"), variable("int", "len")); assertActiveKeys(); } + @Test public void variablesRedefinition() { Snippet x = varKey(assertEval("int x = 10;")); Snippet y = varKey(assertEval("String y = \"\";", added(VALID))); @@ -170,6 +179,7 @@ public void variablesRedefinition() { assertActiveKeys(); } + @Test public void variablesTemporary() { assertEval("int $1 = 10;", added(VALID)); assertEval("2 * $1;", added(VALID)); @@ -180,6 +190,7 @@ public void variablesTemporary() { assertActiveKeys(); } + @Test public void variablesTemporaryNull() { assertEval("null;", added(VALID)); assertVariables(variable("Object", "$1")); @@ -194,6 +205,7 @@ public void variablesTemporaryNull() { assertActiveKeys(); } + @Test public void variablesTemporaryArrayOfCapturedType() { assertEval("class Test { T[][] get() { return null; } }", added(VALID)); assertEval("Test test() { return new Test<>(); }", added(VALID)); @@ -204,6 +216,7 @@ public void variablesTemporaryArrayOfCapturedType() { assertActiveKeys(); } + @Test public void variablesClassReplace() { assertEval("import java.util.*;", added(VALID)); Snippet var = varKey(assertEval("List list = new ArrayList<>();", "[]", @@ -223,12 +236,14 @@ public void variablesClassReplace() { assertActiveKeys(); } + @Test public void variablesErrors() { assertDeclareFail("String;", new ExpectedDiagnostic("compiler.err.cant.resolve.location", 0, 6, 0, -1, -1, Diagnostic.Kind.ERROR)); assertNumberOfActiveVariables(0); assertActiveKeys(); } + @Test public void variablesUnresolvedActiveFailed() { VarSnippet key = varKey(assertEval("und x;", added(RECOVERABLE_NOT_DEFINED))); assertVariableDeclSnippet(key, "x", "und", RECOVERABLE_NOT_DEFINED, VAR_DECLARATION_SUBKIND, 1, 0); @@ -237,12 +252,14 @@ public void variablesUnresolvedActiveFailed() { assertActiveKeys(); } + @Test public void variablesUnresolvedError() { assertDeclareFail("und y = null;", new ExpectedDiagnostic("compiler.err.cant.resolve.location", 0, 3, 0, -1, -1, Diagnostic.Kind.ERROR)); assertNumberOfActiveVariables(0); assertActiveKeys(); } + @Test public void variablesMultiByteCharacterType() { assertEval("class \u3042 {}"); assertEval("\u3042 \u3042 = null;", added(VALID)); @@ -261,7 +278,8 @@ public void variablesMultiByteCharacterType() { assertActiveKeys(); } - @Test(enabled = false) // TODO 8081689 + @Test // TODO 8081689 + @Disabled public void methodVariablesAreNotVisible() { Snippet foo = varKey(assertEval("int foo() {" + "int x = 10;" + @@ -283,7 +301,8 @@ public void methodVariablesAreNotVisible() { assertActiveKeys(); } - @Test(enabled = false) // TODO 8081689 + @Test // TODO 8081689 + @Disabled public void classFieldsAreNotVisible() { Snippet key = classKey(assertEval("class clazz {" + "int x = 10;" + @@ -303,6 +322,7 @@ public void classFieldsAreNotVisible() { assertActiveKeys(); } + @Test public void multiVariables() { List abc = assertEval("int a, b, c = 10;", DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, @@ -324,12 +344,14 @@ public void multiVariables() { assertActiveKeys(); } + @Test public void syntheticVariables() { assertEval("assert false;"); assertNumberOfActiveVariables(0); assertActiveKeys(); } + @Test public void undefinedReplaceVariable() { Snippet key = varKey(assertEval("int d = 234;", "234")); assertVariables(variable("int", "d")); @@ -339,13 +361,14 @@ public void undefinedReplaceVariable() { ste(key, VALID, OVERWRITTEN, false, MAIN_SNIPPET))); //assertEquals(getState().source(snippet), src); //assertEquals(snippet, undefKey); - assertEquals(getState().status(undefKey), RECOVERABLE_NOT_DEFINED); + assertEquals(RECOVERABLE_NOT_DEFINED, getState().status(undefKey)); List unr = getState().unresolvedDependencies((VarSnippet) undefKey).collect(toList()); - assertEquals(unr.size(), 1); - assertEquals(unr.get(0), "class undefined"); + assertEquals(1, unr.size()); + assertEquals("class undefined", unr.get(0)); assertVariables(variable("undefined", "d")); } + @Test public void lvti() { assertEval("var d = 234;", "234"); assertEval("class Test { T[][] get() { return null; } }", added(VALID)); @@ -410,12 +433,14 @@ public void lvti() { assertEval("var r16d = r16d();"); } + @Test public void test8191842() { assertEval("import java.util.stream.*;"); assertEval("var list = Stream.of(1, 2, 3).map(j -> new Object() { int i = j; }).collect(Collectors.toList());"); assertEval("list.stream().map(a -> String.valueOf(a.i)).collect(Collectors.joining(\", \"));", "\"1, 2, 3\""); } + @Test public void lvtiRecompileDependentsWithIntersectionTypes() { assertEval(" Z get1() { return null; }", added(VALID)); assertEval("var i1 = get1();", added(VALID)); @@ -428,27 +453,32 @@ public void lvtiRecompileDependentsWithIntersectionTypes() { assertEval("void t2() { i2.run(); i2.count(); }", added(VALID)); } + @Test public void arrayInit() { assertEval("int[] d = {1, 2, 3};"); } + @Test public void testAnonymousVar() { assertEval("new Object() { public String get() { return \"a\"; } }"); assertEval("$1.get()", "\"a\""); } + @Test public void testIntersectionVar() { assertEval(" Z get() { return null; }", added(VALID)); assertEval("get();", added(VALID)); assertEval("void t1() { $1.run(); $1.length(); }", added(VALID)); } + @Test public void multipleCaptures() { assertEval("class D { D(int foo, String bar) { this.foo = foo; this.bar = bar; } int foo; String bar; } "); assertEval("var d = new D(34, \"hi\") { String z = foo + bar; };"); assertEval("d.z", "\"34hi\""); } + @Test public void multipleAnonymous() { VarSnippet v1 = varKey(assertEval("new Object() { public int i = 42; public int i1 = i; public int m1() { return i1; } };")); VarSnippet v2 = varKey(assertEval("new Object() { public int i = 42; public int i2 = i; public int m2() { return i2; } };")); @@ -466,6 +496,7 @@ public void multipleAnonymous() { -1, -1, Diagnostic.Kind.ERROR)); } + @Test public void displayName() { assertVarDisplayName("var v1 = 234;", "int"); assertVarDisplayName("var v2 = new int[] {234};", "int[]"); @@ -478,6 +509,7 @@ public void displayName() { assertVarDisplayName("var v6 = new Runnable() { public void run() { } };", ""); } + @Test public void varType() { assertEval("import java.util.*;"); var firstVar = varKey(assertEval("var v1 = List.of(1);", added(VALID))); @@ -487,6 +519,7 @@ public void varType() { assertEval("v2", "[1]"); } + @Test public void varDeclNoInit() { assertVarDeclNoInit("byte", "b", "0"); assertVarDeclNoInit("short", "h", "0"); @@ -500,6 +533,7 @@ public void varDeclNoInit() { assertVarDeclNoInit("String", "s", "null"); } + @Test public void varDeclRedefNoInit() { assertVarDeclRedefNoInit("byte", "b", "1", "0"); assertVarDeclRedefNoInit("short", "h", "2", "0"); @@ -513,6 +547,7 @@ public void varDeclRedefNoInit() { assertVarDeclRedefNoInit("String", "s", "\"hi\"", "null"); } + @Test public void badPkgVarDecl() { Compiler compiler = new Compiler(); Path nopkgdirpath = Paths.get("cp", "xyz"); @@ -545,16 +580,16 @@ private VarSnippet assertVarDeclNoInit(String typeName, String name, String dval private VarSnippet assertVarDeclNoInit(String typeName, String name, String dvalue, STEInfo mainInfo, STEInfo... updates) { VarSnippet vs = varKey(assertEval(typeName + " " + name + ";", dvalue, mainInfo, updates)); - assertEquals(vs.typeName(), typeName); + assertEquals(typeName, vs.typeName()); assertEval(name, dvalue, added(VALID)); return vs; } private void assertVarDisplayName(String var, String typeName) { - assertEquals(varKey(assertEval(var)).typeName(), typeName); + assertEquals(typeName, varKey(assertEval(var)).typeName()); } - @BeforeMethod + @BeforeEach @Override public void setUp() { Path path = Paths.get("cp"); @@ -611,14 +646,23 @@ public void setUp() { .compilerOptions("--class-path", tpath)); } + @Test public void varIntersection() { assertEval("interface Marker {}"); assertEval("var v = (Marker & Runnable) () -> {};", added(VALID)); assertEval("v.run()"); } + @Test public void varAnonymousClassAndStaticField() { //JDK-8294431 assertEval("var obj = new Object() { public static final String msg = \"hello\"; };"); } + @Test + public void underscoreAsLambdaParameter() { //JDK-8322532 + assertAnalyze("Func f = _ -> 0; int i;", + "Func f = _ -> 0;", + " int i;", true); + } + } diff --git a/test/langtools/jdk/jshell/WrapperTest.java b/test/langtools/jdk/jshell/WrapperTest.java index 8986c99b4b3d..9903f04676fa 100644 --- a/test/langtools/jdk/jshell/WrapperTest.java +++ b/test/langtools/jdk/jshell/WrapperTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,28 +27,28 @@ * @summary test wrappers and dependencies * @modules jdk.jshell/jdk.jshell * @build KullaTesting - * @run testng WrapperTest + * @run junit WrapperTest */ import java.util.Collection; import java.util.List; -import org.testng.annotations.Test; import jdk.jshell.ErroneousSnippet; import jdk.jshell.Snippet; import jdk.jshell.Snippet.Kind; import jdk.jshell.SourceCodeAnalysis.SnippetWrapper; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static jdk.jshell.Snippet.Status.RECOVERABLE_DEFINED; import static jdk.jshell.Snippet.Status.VALID; +import org.junit.jupiter.api.Test; -@Test public class WrapperTest extends KullaTesting { + @Test public void testMethod() { String src = "void glib() { System.out.println(\"hello\"); }"; List swl = getState().sourceCodeAnalysis().wrappers(src); - assertEquals(swl.size(), 1, "unexpected list length"); + assertEquals(1, swl.size(), "unexpected list length"); assertWrapperHas(swl.get(0), src, Kind.METHOD, "void", "glib", "println"); assertPosition(swl.get(0), src, 0, 4); assertPosition(swl.get(0), src, 5, 4); @@ -63,6 +63,7 @@ public void testMethod() { } // test 8159740 + @Test public void testMethodCorralled() { String src = "void glib() { f(); }"; // _123456789_123456789 @@ -75,6 +76,7 @@ public void testMethodCorralled() { } // test 8159740 + @Test public void testClassCorralled0() { String src = "class AAA { float mmm(double d1234) { return (float) (f0 * d1234); } }"; // _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 @@ -91,6 +93,7 @@ public void testClassCorralled0() { } // test 8159740 + @Test public void testClassCorralled() { String src = "class AAA { int xxx = x0 + 4; float mmm(float ffff) { return f0 * ffff; } }"; // _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 @@ -109,6 +112,7 @@ public void testClassCorralled() { } // test 8159740 + @Test public void testClassWithConstructorCorralled() { String src = "public class AAA { AAA(String b) {} int xxx = x0 + 4; float mmm(float ffff) { return f0 * ffff; } }"; // _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 @@ -130,6 +134,7 @@ public void testClassWithConstructorCorralled() { } // test 8159740 + @Test public void testInterfaceCorralled() { String src = "interface AAA { default float mmm(double d1234) { return (float) (f0 * d1234); } }"; // _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789 @@ -147,6 +152,7 @@ public void testInterfaceCorralled() { } // test 8159740 + @Test public void testEnumCorralled() { String src = "public enum Planet {\n" + @@ -182,25 +188,27 @@ public void testEnumCorralled() { "radius", "surfaceGravity", "surfaceWeight"); } + @Test public void testMethodBad() { String src = "void flob() { ?????; }"; List swl = getState().sourceCodeAnalysis().wrappers(src); - assertEquals(swl.size(), 1, "unexpected list length"); + assertEquals(1, swl.size(), "unexpected list length"); assertWrapperHas(swl.get(0), src, Kind.METHOD, "void", "flob", "?????"); assertPosition(swl.get(0), src, 9, 2); Snippet f = key(assertEvalFail(src)); - assertEquals(f.kind(), Kind.ERRONEOUS); - assertEquals(((ErroneousSnippet)f).probableKind(), Kind.METHOD); + assertEquals(Kind.ERRONEOUS, f.kind()); + assertEquals(Kind.METHOD, ((ErroneousSnippet)f).probableKind()); SnippetWrapper sw = getState().sourceCodeAnalysis().wrapper(f); assertWrapperHas(sw, src, Kind.METHOD, "void", "flob", "?????"); assertPosition(swl.get(0), src, 14, 5); } + @Test public void testVar() { String src = "int gx = 1234;"; List swl = getState().sourceCodeAnalysis().wrappers(src); - assertEquals(swl.size(), 1, "unexpected list length"); + assertEquals(1, swl.size(), "unexpected list length"); assertWrapperHas(swl.get(0), src, Kind.VAR, "int", "gx", "1234"); assertPosition(swl.get(0), src, 4, 2); @@ -210,25 +218,27 @@ public void testVar() { assertPosition(swg, src, 0, 3); } + @Test public void testVarBad() { String src = "double dd = ?????;"; List swl = getState().sourceCodeAnalysis().wrappers(src); - assertEquals(swl.size(), 1, "unexpected list length"); + assertEquals(1, swl.size(), "unexpected list length"); assertWrapperHas(swl.get(0), src, Kind.VAR, "double", "dd", "?????"); assertPosition(swl.get(0), src, 9, 2); Snippet f = key(assertEvalFail(src)); - assertEquals(f.kind(), Kind.ERRONEOUS); - assertEquals(((ErroneousSnippet)f).probableKind(), Kind.VAR); + assertEquals(Kind.ERRONEOUS, f.kind()); + assertEquals(Kind.VAR, ((ErroneousSnippet)f).probableKind()); SnippetWrapper sw = getState().sourceCodeAnalysis().wrapper(f); assertWrapperHas(sw, src, Kind.VAR, "double", "dd", "?????"); assertPosition(swl.get(0), src, 12, 5); } + @Test public void testImport() { String src = "import java.lang.*;"; List swl = getState().sourceCodeAnalysis().wrappers(src); - assertEquals(swl.size(), 1, "unexpected list length"); + assertEquals(1, swl.size(), "unexpected list length"); assertWrapperHas(swl.get(0), src, Kind.IMPORT, "import", "java.lang"); assertPosition(swl.get(0), src, 7, 4); @@ -238,61 +248,65 @@ public void testImport() { assertPosition(swg, src, 0, 6); } + @Test public void testImportBad() { String src = "import java.?????;"; List swl = getState().sourceCodeAnalysis().wrappers(src); - assertEquals(swl.size(), 1, "unexpected list length"); + assertEquals(1, swl.size(), "unexpected list length"); assertWrapperHas(swl.get(0), src, Kind.IMPORT, "import", "?????"); assertPosition(swl.get(0), src, 7, 4); Snippet f = key(assertEvalFail(src)); - assertEquals(f.kind(), Kind.ERRONEOUS); - assertEquals(((ErroneousSnippet)f).probableKind(), Kind.IMPORT); + assertEquals(Kind.ERRONEOUS, f.kind()); + assertEquals(Kind.IMPORT, ((ErroneousSnippet)f).probableKind()); SnippetWrapper sw = getState().sourceCodeAnalysis().wrapper(f); assertWrapperHas(sw, src, Kind.IMPORT, "import", "?????"); assertPosition(swl.get(0), src, 0, 6); } + @Test public void testErroneous() { String src = "@@@@@@@@@@"; List swl = getState().sourceCodeAnalysis().wrappers(src); - assertEquals(swl.size(), 1, "unexpected list length"); + assertEquals(1, swl.size(), "unexpected list length"); assertWrapperHas(swl.get(0), src, Kind.ERRONEOUS, "@@@@@@@@@@"); assertPosition(swl.get(0), src, 0, 10); Snippet f = key(assertEvalFail(src)); - assertEquals(f.kind(), Kind.ERRONEOUS); - assertEquals(((ErroneousSnippet)f).probableKind(), Kind.ERRONEOUS); + assertEquals(Kind.ERRONEOUS, f.kind()); + assertEquals(Kind.ERRONEOUS, ((ErroneousSnippet)f).probableKind()); SnippetWrapper sw = getState().sourceCodeAnalysis().wrapper(f); assertWrapperHas(sw, src, Kind.ERRONEOUS, "@@@@@@@@@@"); assertPosition(swl.get(0), src, 0, 10); } + @Test public void testEmpty() { String src = ""; List swl = getState().sourceCodeAnalysis().wrappers(src); - assertEquals(swl.size(), 0, "expected empty list"); + assertEquals(0, swl.size(), "expected empty list"); } + @Test public void testDependencies() { Snippet a = key(assertEval("int aaa = 6;", added(VALID))); Snippet b = key(assertEval("class B { B(int x) { aaa = x; } }", added(VALID))); Snippet c = key(assertEval("B ccc() { return new B(aaa); }", added(VALID))); Collection dep; dep = getState().sourceCodeAnalysis().dependents(c); - assertEquals(dep.size(), 0); + assertEquals(0, dep.size()); dep = getState().sourceCodeAnalysis().dependents(b); - assertEquals(dep.size(), 1); + assertEquals(1, dep.size()); assertTrue(dep.contains(c)); dep = getState().sourceCodeAnalysis().dependents(a); - assertEquals(dep.size(), 2); + assertEquals(2, dep.size()); assertTrue(dep.contains(c)); assertTrue(dep.contains(b)); } private void assertWrapperHas(SnippetWrapper sw, String source, Kind kind, String... has) { - assertEquals(sw.source(), source); - assertEquals(sw.kind(), kind); + assertEquals(source, sw.source()); + assertEquals(kind, sw.kind()); String s = sw.wrapped(); if (kind == Kind.IMPORT) { assertHas(s, "import"); @@ -322,8 +336,8 @@ private void assertPosition(SnippetWrapper sw, String source, int start, int len //System.err.printf("# wrapped @ wrappedPos: %s\n", wrappedPart); //System.err.printf("# source @ start: %s\n", sourcePart); - assertEquals(wrappedPart, sourcePart, + assertEquals(sourcePart, wrappedPart, "position " + wpg + " in " + sw.wrapped()); - assertEquals(sw.wrappedToSourcePosition(wpg), start); + assertEquals(start, sw.wrappedToSourcePosition(wpg)); } } diff --git a/test/langtools/tools/javac/7129225/NegTest.out b/test/langtools/tools/javac/7129225/NegTest.out index d6fbd22adc39..53ceaa4cb9a1 100644 --- a/test/langtools/tools/javac/7129225/NegTest.out +++ b/test/langtools/tools/javac/7129225/NegTest.out @@ -1,2 +1,2 @@ -TestImportStar.java:16:1: compiler.err.doesnt.exist: xxx +TestImportStar.java:16:8: compiler.err.doesnt.exist: xxx 1 error diff --git a/test/langtools/tools/javac/7129225/TestImportStar.out b/test/langtools/tools/javac/7129225/TestImportStar.out index 86ff89331387..352c0848392a 100644 --- a/test/langtools/tools/javac/7129225/TestImportStar.out +++ b/test/langtools/tools/javac/7129225/TestImportStar.out @@ -1,4 +1,4 @@ - compiler.note.proc.messager: RUNNING - lastRound = false -TestImportStar.java:16:1: compiler.err.doesnt.exist: xxx +TestImportStar.java:16:8: compiler.err.doesnt.exist: xxx - compiler.note.proc.messager: RUNNING - lastRound = true 1 error diff --git a/test/langtools/tools/javac/HexThree.java b/test/langtools/tools/javac/HexThree.java index a89db6e99f86..81c69a4f5329 100644 --- a/test/langtools/tools/javac/HexThree.java +++ b/test/langtools/tools/javac/HexThree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 4920023 * @summary Test hex floating-point literals - * @author darcy */ public class HexThree { diff --git a/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java b/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java index 160c3a3093d0..58dfc69ee2cf 100644 --- a/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java +++ b/test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java @@ -4,7 +4,6 @@ * @summary Positive tests for strings in switch with few alternatives. * @compile OneCaseSwitches.java * @run main OneCaseSwitches - * @author Joseph D. Darcy */ import java.lang.reflect.*; diff --git a/test/langtools/tools/javac/StringsInSwitch/StringSwitches.java b/test/langtools/tools/javac/StringsInSwitch/StringSwitches.java index 2e6737e0c050..cd775a1bcb3b 100644 --- a/test/langtools/tools/javac/StringsInSwitch/StringSwitches.java +++ b/test/langtools/tools/javac/StringsInSwitch/StringSwitches.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6827009 7071246 * @summary Positive tests for strings in switch. - * @author Joseph D. Darcy */ public class StringSwitches { diff --git a/test/langtools/tools/javac/TryWithResources/BadTwr.java b/test/langtools/tools/javac/TryWithResources/BadTwr.java index 6043c527af17..a38300b70369 100644 --- a/test/langtools/tools/javac/TryWithResources/BadTwr.java +++ b/test/langtools/tools/javac/TryWithResources/BadTwr.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 - * @author Joseph D. Darcy * @summary Verify bad TWRs don't compile * @compile/fail/ref=BadTwr.out -XDrawDiagnostics BadTwr.java */ diff --git a/test/langtools/tools/javac/TryWithResources/BadTwr.out b/test/langtools/tools/javac/TryWithResources/BadTwr.out index ed8c2524c1b6..b4e951305a51 100644 --- a/test/langtools/tools/javac/TryWithResources/BadTwr.out +++ b/test/langtools/tools/javac/TryWithResources/BadTwr.out @@ -1,5 +1,5 @@ -BadTwr.java:12:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, meth(java.lang.String...) -BadTwr.java:17:20: compiler.err.already.defined: kindname.variable, args, kindname.method, meth(java.lang.String...) -BadTwr.java:20:13: compiler.err.cant.assign.val.to.var: final, thatsIt -BadTwr.java:25:24: compiler.err.already.defined: kindname.variable, name, kindname.method, meth(java.lang.String...) +BadTwr.java:11:46: compiler.err.already.defined: kindname.variable, r1, kindname.method, meth(java.lang.String...) +BadTwr.java:16:20: compiler.err.already.defined: kindname.variable, args, kindname.method, meth(java.lang.String...) +BadTwr.java:19:13: compiler.err.cant.assign.val.to.var: final, thatsIt +BadTwr.java:24:24: compiler.err.already.defined: kindname.variable, name, kindname.method, meth(java.lang.String...) 4 errors diff --git a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java index 988249cef200..fc31895315c9 100644 --- a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java +++ b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 - * @author Joseph D. Darcy * @summary Verify bad TWRs don't compile * @compile/fail/ref=BadTwrSyntax.out -XDrawDiagnostics BadTwrSyntax.java */ diff --git a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out index 0d7263710c58..44b283dc611f 100644 --- a/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out +++ b/test/langtools/tools/javac/TryWithResources/BadTwrSyntax.out @@ -1,2 +1,2 @@ -BadTwrSyntax.java:13:43: compiler.err.illegal.start.of.expr +BadTwrSyntax.java:12:43: compiler.err.illegal.start.of.expr 1 error diff --git a/test/langtools/tools/javac/TryWithResources/ExplicitFinal.java b/test/langtools/tools/javac/TryWithResources/ExplicitFinal.java index e77de854f472..472b9089c1e6 100644 --- a/test/langtools/tools/javac/TryWithResources/ExplicitFinal.java +++ b/test/langtools/tools/javac/TryWithResources/ExplicitFinal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ /* * @test * @bug 7013420 - * @author Joseph D. Darcy * @summary Test that resource variables are accepted as explicitly final. */ diff --git a/test/langtools/tools/javac/TryWithResources/PlainTry.java b/test/langtools/tools/javac/TryWithResources/PlainTry.java index edbb233578b2..52c05a1ff7cc 100644 --- a/test/langtools/tools/javac/TryWithResources/PlainTry.java +++ b/test/langtools/tools/javac/TryWithResources/PlainTry.java @@ -1,9 +1,8 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 - * @author Joseph D. Darcy * @summary Test error messages for an unadorned try - * @compile/fail/ref=PlainTry.out -XDrawDiagnostics PlainTry.java + * @compile/fail/ref=PlainTry.out -XDrawDiagnostics PlainTry.java */ public class PlainTry { public static void meth() { diff --git a/test/langtools/tools/javac/TryWithResources/PlainTry.out b/test/langtools/tools/javac/TryWithResources/PlainTry.out index 9357cd8cdd79..0f8f16ae1e87 100644 --- a/test/langtools/tools/javac/TryWithResources/PlainTry.out +++ b/test/langtools/tools/javac/TryWithResources/PlainTry.out @@ -1,2 +1,2 @@ -PlainTry.java:10:9: compiler.err.try.without.catch.finally.or.resource.decls +PlainTry.java:9:9: compiler.err.try.without.catch.finally.or.resource.decls 1 error diff --git a/test/langtools/tools/javac/TryWithResources/TwrFlow.java b/test/langtools/tools/javac/TryWithResources/TwrFlow.java index 8ea54244570f..366648fb42e3 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrFlow.java +++ b/test/langtools/tools/javac/TryWithResources/TwrFlow.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 7013420 - * @author Joseph D. Darcy * @summary Test exception analysis of try-with-resources blocks * @compile/fail/ref=TwrFlow.out -XDrawDiagnostics TwrFlow.java */ diff --git a/test/langtools/tools/javac/TryWithResources/TwrFlow.out b/test/langtools/tools/javac/TryWithResources/TwrFlow.out index 23db6517c434..758fb778aae4 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrFlow.out +++ b/test/langtools/tools/javac/TryWithResources/TwrFlow.out @@ -1,3 +1,3 @@ -TwrFlow.java:14:11: compiler.err.except.never.thrown.in.try: java.io.IOException -TwrFlow.java:12:21: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow +TwrFlow.java:13:11: compiler.err.except.never.thrown.in.try: java.io.IOException +TwrFlow.java:11:21: compiler.err.unreported.exception.implicit.close: CustomCloseException, twrFlow 2 errors diff --git a/test/langtools/tools/javac/TryWithResources/TwrLint.java b/test/langtools/tools/javac/TryWithResources/TwrLint.java index 39c5ed67f8f8..ca45efc1e0a6 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrLint.java +++ b/test/langtools/tools/javac/TryWithResources/TwrLint.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 6965277 6967065 - * @author Joseph D. Darcy * @summary Check that -Xlint:twr warnings are generated as expected * @compile/ref=TwrLint.out -Xlint:try,deprecation -XDrawDiagnostics TwrLint.java */ diff --git a/test/langtools/tools/javac/TryWithResources/TwrLint.out b/test/langtools/tools/javac/TryWithResources/TwrLint.out index 6adfc5122b3b..28778b0e3a56 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrLint.out +++ b/test/langtools/tools/javac/TryWithResources/TwrLint.out @@ -1,3 +1,3 @@ -TwrLint.java:14:15: compiler.warn.try.explicit.close.call -TwrLint.java:13:21: compiler.warn.try.resource.not.referenced: r3 +TwrLint.java:13:15: compiler.warn.try.explicit.close.call +TwrLint.java:12:21: compiler.warn.try.resource.not.referenced: r3 2 warnings diff --git a/test/langtools/tools/javac/TryWithResources/TwrMultiCatch.java b/test/langtools/tools/javac/TryWithResources/TwrMultiCatch.java index dbbb633efe17..002e30277e39 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrMultiCatch.java +++ b/test/langtools/tools/javac/TryWithResources/TwrMultiCatch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ /* * @test * @bug 6911256 6964740 7013420 - * @author Joseph D. Darcy * @summary Test that TWR and multi-catch play well together * @compile TwrMultiCatch.java * @run main TwrMultiCatch diff --git a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java index ac0a72645ba3..0d6c2f4bc445 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java +++ b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 7013420 - * @author Joseph D. Darcy * @summary Verify invalid TWR block is not accepted. * @compile/fail/ref=TwrOnNonResource.out -XDrawDiagnostics TwrOnNonResource.java */ diff --git a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out index 07488a78071f..9a01e28e1051 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out +++ b/test/langtools/tools/javac/TryWithResources/TwrOnNonResource.out @@ -1,4 +1,4 @@ -TwrOnNonResource.java:11:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) -TwrOnNonResource.java:14:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) -TwrOnNonResource.java:17:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) +TwrOnNonResource.java:10:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) +TwrOnNonResource.java:13:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) +TwrOnNonResource.java:16:30: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: TwrOnNonResource, java.lang.AutoCloseable)) 3 errors diff --git a/test/langtools/tools/javac/TryWithResources/TwrSuppression.java b/test/langtools/tools/javac/TryWithResources/TwrSuppression.java index 9834d5a17b2e..0c511d28cbcb 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrSuppression.java +++ b/test/langtools/tools/javac/TryWithResources/TwrSuppression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ /* * @test * @bug 6971877 - * @author Joseph D. Darcy * @summary Verify a primary exception suppresses all throwables */ diff --git a/test/langtools/tools/javac/TryWithResources/WeirdTwr.java b/test/langtools/tools/javac/TryWithResources/WeirdTwr.java index 6331507097c4..fbfbbe6ecd8b 100644 --- a/test/langtools/tools/javac/TryWithResources/WeirdTwr.java +++ b/test/langtools/tools/javac/TryWithResources/WeirdTwr.java @@ -1,7 +1,6 @@ /* * @test /nodynamiccopyright/ * @bug 6911256 6964740 - * @author Joseph D. Darcy * @summary Strange TWRs * @compile WeirdTwr.java * @run main WeirdTwr diff --git a/test/langtools/tools/javac/annotations/pos/TrailingComma.java b/test/langtools/tools/javac/annotations/pos/TrailingComma.java index d6601ce419db..0fa4bdb3546d 100644 --- a/test/langtools/tools/javac/annotations/pos/TrailingComma.java +++ b/test/langtools/tools/javac/annotations/pos/TrailingComma.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6337964 * @summary javac incorrectly disallows trailing comma in annotation arrays - * @author darcy * @compile TrailingComma.java */ diff --git a/test/langtools/tools/javac/boxing/BoxingCaching.java b/test/langtools/tools/javac/boxing/BoxingCaching.java index 2d7acb817f02..f4c1337f240f 100644 --- a/test/langtools/tools/javac/boxing/BoxingCaching.java +++ b/test/langtools/tools/javac/boxing/BoxingCaching.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 4990346 8200478 * @summary Verify autoboxed values are cached as required. - * @author Joseph D. Darcy */ public class BoxingCaching { diff --git a/test/langtools/tools/javac/enum/6350057/T6350057.java b/test/langtools/tools/javac/enum/6350057/T6350057.java index ff96b710af6c..8eb0aa997b6c 100644 --- a/test/langtools/tools/javac/enum/6350057/T6350057.java +++ b/test/langtools/tools/javac/enum/6350057/T6350057.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6350057 7025809 * @summary Test that parameters on implicit enum methods have the right kind - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/enum/AbstractEmptyEnum.java b/test/langtools/tools/javac/enum/AbstractEmptyEnum.java index 38c13bde8287..7f5792167e8d 100644 --- a/test/langtools/tools/javac/enum/AbstractEmptyEnum.java +++ b/test/langtools/tools/javac/enum/AbstractEmptyEnum.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary empty enum cannot be abstract - * @author Joseph D. Darcy * * @compile/fail/ref=AbstractEmptyEnum.out -XDrawDiagnostics AbstractEmptyEnum.java */ diff --git a/test/langtools/tools/javac/enum/AbstractEmptyEnum.out b/test/langtools/tools/javac/enum/AbstractEmptyEnum.out index 933363a3fe6e..b6b2460bb68a 100644 --- a/test/langtools/tools/javac/enum/AbstractEmptyEnum.out +++ b/test/langtools/tools/javac/enum/AbstractEmptyEnum.out @@ -1,2 +1,2 @@ -AbstractEmptyEnum.java:10:8: compiler.err.does.not.override.abstract: AbstractEmptyEnum, m(), AbstractEmptyEnum +AbstractEmptyEnum.java:9:8: compiler.err.does.not.override.abstract: AbstractEmptyEnum, m(), AbstractEmptyEnum 1 error diff --git a/test/langtools/tools/javac/enum/EnumImplicitPrivateConstructor.java b/test/langtools/tools/javac/enum/EnumImplicitPrivateConstructor.java index 36c090668c4f..8ed9e1489782 100644 --- a/test/langtools/tools/javac/enum/EnumImplicitPrivateConstructor.java +++ b/test/langtools/tools/javac/enum/EnumImplicitPrivateConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 5009601 5010455 5005748 * @summary enum constructors can be declared private - * @author Joseph D. Darcy */ import java.util.*; diff --git a/test/langtools/tools/javac/enum/EnumPrivateConstructor.java b/test/langtools/tools/javac/enum/EnumPrivateConstructor.java index 84a28a819769..412f79945c8b 100644 --- a/test/langtools/tools/javac/enum/EnumPrivateConstructor.java +++ b/test/langtools/tools/javac/enum/EnumPrivateConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 5009601 * @summary enum constructors can be declared private - * @author Joseph D. Darcy * * @compile EnumPrivateConstructor.java */ diff --git a/test/langtools/tools/javac/enum/EnumProtectedConstructor.java b/test/langtools/tools/javac/enum/EnumProtectedConstructor.java index 481de39319c6..298dcc738c9d 100644 --- a/test/langtools/tools/javac/enum/EnumProtectedConstructor.java +++ b/test/langtools/tools/javac/enum/EnumProtectedConstructor.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum constructors cannot be declared public or protected - * @author Joseph D. Darcy * * @compile/fail/ref=EnumProtectedConstructor.out -XDrawDiagnostics EnumProtectedConstructor.java */ diff --git a/test/langtools/tools/javac/enum/EnumProtectedConstructor.out b/test/langtools/tools/javac/enum/EnumProtectedConstructor.out index 71826a2d331d..5cc734020acd 100644 --- a/test/langtools/tools/javac/enum/EnumProtectedConstructor.out +++ b/test/langtools/tools/javac/enum/EnumProtectedConstructor.out @@ -1,2 +1,2 @@ -EnumProtectedConstructor.java:16:15: compiler.err.mod.not.allowed.here: protected +EnumProtectedConstructor.java:15:15: compiler.err.mod.not.allowed.here: protected 1 error diff --git a/test/langtools/tools/javac/enum/EnumPublicConstructor.java b/test/langtools/tools/javac/enum/EnumPublicConstructor.java index 313605970358..b5c622208efa 100644 --- a/test/langtools/tools/javac/enum/EnumPublicConstructor.java +++ b/test/langtools/tools/javac/enum/EnumPublicConstructor.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum constructors cannot be declared public or protected - * @author Joseph D. Darcy * * @compile/fail/ref=EnumPublicConstructor.out -XDrawDiagnostics EnumPublicConstructor.java */ diff --git a/test/langtools/tools/javac/enum/EnumPublicConstructor.out b/test/langtools/tools/javac/enum/EnumPublicConstructor.out index 56c099f4330c..89ba98d1d81e 100644 --- a/test/langtools/tools/javac/enum/EnumPublicConstructor.out +++ b/test/langtools/tools/javac/enum/EnumPublicConstructor.out @@ -1,2 +1,2 @@ -EnumPublicConstructor.java:16:12: compiler.err.mod.not.allowed.here: public +EnumPublicConstructor.java:15:12: compiler.err.mod.not.allowed.here: public 1 error diff --git a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.java b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.java index 5af537686846..d04a25587150 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.java +++ b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared abstract - * @author Joseph D. Darcy * @compile/fail/ref=ExplicitlyAbstractEnum1.out -XDrawDiagnostics ExplicitlyAbstractEnum1.java */ diff --git a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.out b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.out index 827e331a4913..902c9e5730fb 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.out +++ b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum1.out @@ -1,2 +1,2 @@ -ExplicitlyAbstractEnum1.java:9:10: compiler.err.mod.not.allowed.here: abstract +ExplicitlyAbstractEnum1.java:8:10: compiler.err.mod.not.allowed.here: abstract 1 error diff --git a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.java b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.java index cbd9bd512d68..293c36a867d1 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.java +++ b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared abstract even if they are abstract - * @author Joseph D. Darcy * @compile/fail/ref=ExplicitlyAbstractEnum2.out -XDrawDiagnostics ExplicitlyAbstractEnum2.java */ diff --git a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.out b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.out index 8a35cec31802..f2c25ca5d4e7 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.out +++ b/test/langtools/tools/javac/enum/ExplicitlyAbstractEnum2.out @@ -1,2 +1,2 @@ -ExplicitlyAbstractEnum2.java:9:10: compiler.err.mod.not.allowed.here: abstract +ExplicitlyAbstractEnum2.java:8:10: compiler.err.mod.not.allowed.here: abstract 1 error diff --git a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java index 1dba3d0dff5e..1e2bf650ca5d 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java +++ b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared final even if they are - * @author Joseph D. Darcy * @compile/fail/ref=ExplicitlyFinalEnum1.out -XDrawDiagnostics ExplicitlyFinalEnum1.java */ diff --git a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out index 023d00e265fb..11bbdb690b6a 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out +++ b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum1.out @@ -1,2 +1,2 @@ -ExplicitlyFinalEnum1.java:9:7: compiler.err.mod.not.allowed.here: final +ExplicitlyFinalEnum1.java:8:7: compiler.err.mod.not.allowed.here: final 1 error diff --git a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java index 73d3b8acb7b4..0c02799c3d3e 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java +++ b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary enum's cannot be explicitly declared final - * @author Joseph D. Darcy * @compile/fail/ref=ExplicitlyFinalEnum2.out -XDrawDiagnostics ExplicitlyFinalEnum2.java */ diff --git a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out index 09cbf1461add..8d67c8888644 100644 --- a/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out +++ b/test/langtools/tools/javac/enum/ExplicitlyFinalEnum2.out @@ -1,2 +1,2 @@ -ExplicitlyFinalEnum2.java:9:7: compiler.err.mod.not.allowed.here: final +ExplicitlyFinalEnum2.java:8:7: compiler.err.mod.not.allowed.here: final 1 error diff --git a/test/langtools/tools/javac/enum/FauxEnum1.java b/test/langtools/tools/javac/enum/FauxEnum1.java index 5ae6a8b090ca..7565633032fc 100644 --- a/test/langtools/tools/javac/enum/FauxEnum1.java +++ b/test/langtools/tools/javac/enum/FauxEnum1.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009574 * @summary verify java.lang.Enum can't be directly subclassed - * @author Joseph D. Darcy * * @compile/fail/ref=FauxEnum1.out -XDrawDiagnostics FauxEnum1.java */ diff --git a/test/langtools/tools/javac/enum/FauxEnum1.out b/test/langtools/tools/javac/enum/FauxEnum1.out index ff1e8fa73155..7cae5443e258 100644 --- a/test/langtools/tools/javac/enum/FauxEnum1.out +++ b/test/langtools/tools/javac/enum/FauxEnum1.out @@ -1,4 +1,4 @@ -FauxEnum1.java:10:8: compiler.err.enum.no.subclassing +FauxEnum1.java:9:8: compiler.err.enum.no.subclassing - compiler.note.unchecked.filename: FauxEnum1.java - compiler.note.unchecked.recompile 1 error diff --git a/test/langtools/tools/javac/enum/FauxEnum3.java b/test/langtools/tools/javac/enum/FauxEnum3.java index ec53aeb59519..6cf41cfa8890 100644 --- a/test/langtools/tools/javac/enum/FauxEnum3.java +++ b/test/langtools/tools/javac/enum/FauxEnum3.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009574 * @summary verify an enum type can't be directly subclassed - * @author Joseph D. Darcy * * @compile/fail/ref=FauxEnum3.out -XDrawDiagnostics FauxEnum3.java */ diff --git a/test/langtools/tools/javac/enum/FauxEnum3.out b/test/langtools/tools/javac/enum/FauxEnum3.out index 885154d073a8..33596c87b51f 100644 --- a/test/langtools/tools/javac/enum/FauxEnum3.out +++ b/test/langtools/tools/javac/enum/FauxEnum3.out @@ -1,2 +1,2 @@ -FauxEnum3.java:10:14: compiler.err.enum.types.not.extensible +FauxEnum3.java:9:14: compiler.err.enum.types.not.extensible 1 error diff --git a/test/langtools/tools/javac/enum/FauxSpecialEnum1.java b/test/langtools/tools/javac/enum/FauxSpecialEnum1.java index 5b427bb110de..578864061d03 100644 --- a/test/langtools/tools/javac/enum/FauxSpecialEnum1.java +++ b/test/langtools/tools/javac/enum/FauxSpecialEnum1.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary verify specialized enum classes can't be abstract - * @author Joseph D. Darcy * * @compile/fail/ref=FauxSpecialEnum1.out -XDrawDiagnostics FauxSpecialEnum1.java */ diff --git a/test/langtools/tools/javac/enum/FauxSpecialEnum1.out b/test/langtools/tools/javac/enum/FauxSpecialEnum1.out index 4530bf40a884..ed9a5feaf1f5 100644 --- a/test/langtools/tools/javac/enum/FauxSpecialEnum1.out +++ b/test/langtools/tools/javac/enum/FauxSpecialEnum1.out @@ -1,2 +1,2 @@ -FauxSpecialEnum1.java:14:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum1$2, test(), compiler.misc.anonymous.class: FauxSpecialEnum1$2 +FauxSpecialEnum1.java:13:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum1$2, test(), compiler.misc.anonymous.class: FauxSpecialEnum1$2 1 error diff --git a/test/langtools/tools/javac/enum/FauxSpecialEnum2.java b/test/langtools/tools/javac/enum/FauxSpecialEnum2.java index 5c0cc610fa2f..6bf9a97f29ca 100644 --- a/test/langtools/tools/javac/enum/FauxSpecialEnum2.java +++ b/test/langtools/tools/javac/enum/FauxSpecialEnum2.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 5009601 * @summary verify specialized enum classes can't be abstract - * @author Joseph D. Darcy * * @compile/fail/ref=FauxSpecialEnum2.out -XDrawDiagnostics FauxSpecialEnum2.java */ diff --git a/test/langtools/tools/javac/enum/FauxSpecialEnum2.out b/test/langtools/tools/javac/enum/FauxSpecialEnum2.out index 81de8f41726b..aa1cbc8e9cc5 100644 --- a/test/langtools/tools/javac/enum/FauxSpecialEnum2.out +++ b/test/langtools/tools/javac/enum/FauxSpecialEnum2.out @@ -1,2 +1,2 @@ -FauxSpecialEnum2.java:12:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum2$1, test(), compiler.misc.anonymous.class: FauxSpecialEnum2$1 +FauxSpecialEnum2.java:11:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum2$1, test(), compiler.misc.anonymous.class: FauxSpecialEnum2$1 1 error diff --git a/test/langtools/tools/javac/generics/InheritanceConflict3.java b/test/langtools/tools/javac/generics/InheritanceConflict3.java index ae725d6c1e28..d9f3c76b06e9 100644 --- a/test/langtools/tools/javac/generics/InheritanceConflict3.java +++ b/test/langtools/tools/javac/generics/InheritanceConflict3.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 4984158 * @summary two inherited methods with same signature - * @author darcy * * @compile/fail/ref=InheritanceConflict3.out -XDrawDiagnostics InheritanceConflict3.java */ diff --git a/test/langtools/tools/javac/generics/InheritanceConflict3.out b/test/langtools/tools/javac/generics/InheritanceConflict3.out index 60cfe5d21488..c168d4b2b86d 100644 --- a/test/langtools/tools/javac/generics/InheritanceConflict3.out +++ b/test/langtools/tools/javac/generics/InheritanceConflict3.out @@ -1,3 +1,3 @@ -InheritanceConflict3.java:14:10: compiler.err.name.clash.same.erasure: f(java.lang.Object), f(T) -InheritanceConflict3.java:17:1: compiler.err.concrete.inheritance.conflict: f(java.lang.Object), inheritance.conflict3.X1, f(T), inheritance.conflict3.X1, inheritance.conflict3.X1 +InheritanceConflict3.java:13:10: compiler.err.name.clash.same.erasure: f(java.lang.Object), f(T) +InheritanceConflict3.java:16:1: compiler.err.concrete.inheritance.conflict: f(java.lang.Object), inheritance.conflict3.X1, f(T), inheritance.conflict3.X1, inheritance.conflict3.X1 2 errors diff --git a/test/langtools/tools/javac/importChecks/ImportIsFullyQualified.out b/test/langtools/tools/javac/importChecks/ImportIsFullyQualified.out index 33e7d2f71c39..89495c2b93dc 100644 --- a/test/langtools/tools/javac/importChecks/ImportIsFullyQualified.out +++ b/test/langtools/tools/javac/importChecks/ImportIsFullyQualified.out @@ -1,2 +1,2 @@ -ImportIsFullyQualified.java:11:1: compiler.err.doesnt.exist: JobAttributes +ImportIsFullyQualified.java:11:8: compiler.err.doesnt.exist: JobAttributes 1 error diff --git a/test/langtools/tools/javac/importChecks/ImportsObservable.out b/test/langtools/tools/javac/importChecks/ImportsObservable.out index e6b6e51e4bb3..28ba84c6aa45 100644 --- a/test/langtools/tools/javac/importChecks/ImportsObservable.out +++ b/test/langtools/tools/javac/importChecks/ImportsObservable.out @@ -1,2 +1,2 @@ -ImportsObservable.java:9:1: compiler.err.doesnt.exist: javax +ImportsObservable.java:9:8: compiler.err.doesnt.exist: javax 1 error diff --git a/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java b/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java index cf06bd06dfe5..24c2b0458008 100644 --- a/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java +++ b/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java @@ -799,7 +799,7 @@ public void testPackagesUniquelyVisibleInImportOnDemandNoPrefixes(Path base) thr .getOutputLines(Task.OutputKind.DIRECT); List expected = Arrays.asList( - "Test.java:1:31: compiler.err.doesnt.exist: ma", + "Test.java:1:38: compiler.err.doesnt.exist: ma", "1 error"); if (!expected.equals(log)) @@ -827,7 +827,7 @@ public void testPackagesUniquelyVisibleInImportOnDemandThisModule(Path base) thr .getOutputLines(Task.OutputKind.DIRECT); List expected = Arrays.asList( - "Test.java:1:15: compiler.err.doesnt.exist: ma", + "Test.java:1:22: compiler.err.doesnt.exist: ma", "1 error"); if (!expected.equals(log)) @@ -861,7 +861,7 @@ public void testPackagesUniquelyVisibleInImportOnDemandThisModuleUnnamed(Path ba .getOutputLines(Task.OutputKind.DIRECT); List expected = Arrays.asList( - "Test.java:1:15: compiler.err.doesnt.exist: ma", + "Test.java:1:22: compiler.err.doesnt.exist: ma", "1 error"); if (!expected.equals(log)) diff --git a/test/langtools/tools/javac/multicatch/Neg01.java b/test/langtools/tools/javac/multicatch/Neg01.java index 378e4f285cbd..86a2ae952a19 100644 --- a/test/langtools/tools/javac/multicatch/Neg01.java +++ b/test/langtools/tools/javac/multicatch/Neg01.java @@ -3,7 +3,6 @@ * @bug 6943289 * * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch') - * @author darcy * @compile/fail/ref=Neg01.out -XDrawDiagnostics Neg01.java */ diff --git a/test/langtools/tools/javac/multicatch/Neg01.out b/test/langtools/tools/javac/multicatch/Neg01.out index 56eb1958a526..f0ddda9bce65 100644 --- a/test/langtools/tools/javac/multicatch/Neg01.out +++ b/test/langtools/tools/javac/multicatch/Neg01.out @@ -1,2 +1,2 @@ -Neg01.java:22:19: compiler.err.except.never.thrown.in.try: Neg01.B2 +Neg01.java:21:19: compiler.err.except.never.thrown.in.try: Neg01.B2 1 error diff --git a/test/langtools/tools/javac/multicatch/Neg01eff_final.java b/test/langtools/tools/javac/multicatch/Neg01eff_final.java index e2c78f5e055c..933d7d1599dc 100644 --- a/test/langtools/tools/javac/multicatch/Neg01eff_final.java +++ b/test/langtools/tools/javac/multicatch/Neg01eff_final.java @@ -3,7 +3,6 @@ * @bug 6943289 * * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch') - * @author darcy * @compile/fail/ref=Neg01eff_final.out -XDrawDiagnostics Neg01eff_final.java */ diff --git a/test/langtools/tools/javac/multicatch/Neg01eff_final.out b/test/langtools/tools/javac/multicatch/Neg01eff_final.out index 4327ef45b9bd..b110d4468a1f 100644 --- a/test/langtools/tools/javac/multicatch/Neg01eff_final.out +++ b/test/langtools/tools/javac/multicatch/Neg01eff_final.out @@ -1,2 +1,2 @@ -Neg01eff_final.java:22:19: compiler.err.except.never.thrown.in.try: Neg01eff_final.B2 +Neg01eff_final.java:21:19: compiler.err.except.never.thrown.in.try: Neg01eff_final.B2 1 error diff --git a/test/langtools/tools/javac/multicatch/Neg07.java b/test/langtools/tools/javac/multicatch/Neg07.java index e5869e6a2ccf..a2c1704c6b2f 100644 --- a/test/langtools/tools/javac/multicatch/Neg07.java +++ b/test/langtools/tools/javac/multicatch/Neg07.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 7039822 * @summary Verify typing of lub of exception parameter w.r.t getClass - * @author Joseph D. Darcy * @compile/fail/ref=Neg07.out -XDrawDiagnostics Neg07.java */ diff --git a/test/langtools/tools/javac/multicatch/Neg07.out b/test/langtools/tools/javac/multicatch/Neg07.out index 32030e176957..0acdba265da4 100644 --- a/test/langtools/tools/javac/multicatch/Neg07.out +++ b/test/langtools/tools/javac/multicatch/Neg07.out @@ -1,2 +1,2 @@ -Neg07.java:14:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class, java.lang.Class) +Neg07.java:13:56: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class, java.lang.Class) 1 error diff --git a/test/langtools/tools/javac/multicatch/Pos10.java b/test/langtools/tools/javac/multicatch/Pos10.java index c66fa5334cd1..d108c8f9671a 100644 --- a/test/langtools/tools/javac/multicatch/Pos10.java +++ b/test/langtools/tools/javac/multicatch/Pos10.java @@ -25,7 +25,6 @@ * @test * @bug 7039822 * @summary Verify lub of an exception parameter can be an intersection type - * @author Joseph D. Darcy */ public class Pos10 { diff --git a/test/langtools/tools/javac/processing/6365040/T6365040.java b/test/langtools/tools/javac/processing/6365040/T6365040.java index 4413ff1375c9..c538609800d8 100644 --- a/test/langtools/tools/javac/processing/6365040/T6365040.java +++ b/test/langtools/tools/javac/processing/6365040/T6365040.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 6365040 6358129 * @summary Test -processor foo,bar,baz - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler @@ -13,7 +12,7 @@ * @compile -processor ProcFoo,ProcBar,T6365040 -proc:only T6365040.java * @compile -processor T6365040 -proc:only T6365040.java * @compile -processor T6365040,NotThere, -proc:only T6365040.java - * @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere -proc:only T6365040.java + * @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere -proc:only T6365040.java * @compile/fail/ref=T6365040.out -XDrawDiagnostics -processor NotThere,T6365040 -proc:only T6365040.java */ @@ -23,7 +22,6 @@ import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.element.TypeElement; - public class T6365040 extends JavacTestingAbstractProcessor { public boolean process(Set annotations, RoundEnvironment roundEnvironment) { diff --git a/test/langtools/tools/javac/processing/6378728/T6378728.java b/test/langtools/tools/javac/processing/6378728/T6378728.java index 9ee620510274..791296fb7549 100644 --- a/test/langtools/tools/javac/processing/6378728/T6378728.java +++ b/test/langtools/tools/javac/processing/6378728/T6378728.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ /* @test * @bug 6378728 * @summary Verify -proc:only doesn't produce class files - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler * @compile T6378728.java diff --git a/test/langtools/tools/javac/processing/6634138/T6634138.java b/test/langtools/tools/javac/processing/6634138/T6634138.java index 872192d51eca..baf9bff3b634 100644 --- a/test/langtools/tools/javac/processing/6634138/T6634138.java +++ b/test/langtools/tools/javac/processing/6634138/T6634138.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ /* * @test * @bug 6634138 - * @author Joseph D. Darcy * @summary Verify source files output after processing is over are compiled * @library /tools/javac/lib * @modules java.compiler diff --git a/test/langtools/tools/javac/processing/completion/TestCompletions.java b/test/langtools/tools/javac/processing/completion/TestCompletions.java index 87d947f173e3..c181b0fc84de 100644 --- a/test/langtools/tools/javac/processing/completion/TestCompletions.java +++ b/test/langtools/tools/javac/processing/completion/TestCompletions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6341177 * @summary Some simple tests of the methods in Completions - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/environment/TestSourceVersion.java b/test/langtools/tools/javac/processing/environment/TestSourceVersion.java index e31664b8a93b..473b14ad39c3 100644 --- a/test/langtools/tools/javac/processing/environment/TestSourceVersion.java +++ b/test/langtools/tools/javac/processing/environment/TestSourceVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6402506 8028545 8028543 * @summary Test that getSourceVersion works properly - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java b/test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java index 33b19543ef7e..ddcaaf7b60db 100644 --- a/test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java +++ b/test/langtools/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 8030049 8038080 8032230 8190886 * @summary Tests that getElementsAnnotatedWith[Any] methods work properly. - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/errors/TestFatalityOfParseErrors.java b/test/langtools/tools/javac/processing/errors/TestFatalityOfParseErrors.java index 300afaad5248..3a7ee877c1f9 100644 --- a/test/langtools/tools/javac/processing/errors/TestFatalityOfParseErrors.java +++ b/test/langtools/tools/javac/processing/errors/TestFatalityOfParseErrors.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 6403459 * @summary Test that generating programs with syntax errors is a fatal condition - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/errors/TestOptionSyntaxErrors.java b/test/langtools/tools/javac/processing/errors/TestOptionSyntaxErrors.java index 8c397b20f629..bd1dea81a403 100644 --- a/test/langtools/tools/javac/processing/errors/TestOptionSyntaxErrors.java +++ b/test/langtools/tools/javac/processing/errors/TestOptionSyntaxErrors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6406212 * @summary Test that annotation processor options with illegal syntax are rejected - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler/com.sun.tools.javac.main * @build JavacTestingAbstractProcessor CompileFail diff --git a/test/langtools/tools/javac/processing/errors/TestReturnCode.java b/test/langtools/tools/javac/processing/errors/TestReturnCode.java index 749044edd6f6..5ca6a50e3c64 100644 --- a/test/langtools/tools/javac/processing/errors/TestReturnCode.java +++ b/test/langtools/tools/javac/processing/errors/TestReturnCode.java @@ -25,7 +25,6 @@ * @test * @bug 6403468 * @summary Test that an erroneous return code results from raising an error. - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler/com.sun.tools.javac.main * @build JavacTestingAbstractProcessor CompileFail diff --git a/test/langtools/tools/javac/processing/filer/TestFilerConstraints.java b/test/langtools/tools/javac/processing/filer/TestFilerConstraints.java index e522afa9ce8f..6eac5475c0b1 100644 --- a/test/langtools/tools/javac/processing/filer/TestFilerConstraints.java +++ b/test/langtools/tools/javac/processing/filer/TestFilerConstraints.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6380018 6453386 6457283 * @summary Test that the constraints guaranteed by the Filer and maintained - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/filer/TestGetResource.java b/test/langtools/tools/javac/processing/filer/TestGetResource.java index 073757d1217a..cf8ac2aafeba 100644 --- a/test/langtools/tools/javac/processing/filer/TestGetResource.java +++ b/test/langtools/tools/javac/processing/filer/TestGetResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6380018 6449798 * @summary Test Filer.getResource - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/filer/TestPackageInfo.java b/test/langtools/tools/javac/processing/filer/TestPackageInfo.java index 1e0659c9b120..1b11c75acde6 100644 --- a/test/langtools/tools/javac/processing/filer/TestPackageInfo.java +++ b/test/langtools/tools/javac/processing/filer/TestPackageInfo.java @@ -25,7 +25,6 @@ * @test * @bug 6380018 6392177 6993311 8193462 * @summary Test the ability to create and process package-info.java files - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/messager/MessagerBasics.java b/test/langtools/tools/javac/processing/messager/MessagerBasics.java index 35c3b64ca2d4..896f7b579b57 100644 --- a/test/langtools/tools/javac/processing/messager/MessagerBasics.java +++ b/test/langtools/tools/javac/processing/messager/MessagerBasics.java @@ -2,7 +2,6 @@ * @test /nodynamiccopyright/ * @bug 6341173 6341072 * @summary Test presence of Messager methods - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/TestExceptions.java b/test/langtools/tools/javac/processing/model/TestExceptions.java index 993e084e157b..e9f5846a7caf 100644 --- a/test/langtools/tools/javac/processing/model/TestExceptions.java +++ b/test/langtools/tools/javac/processing/model/TestExceptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6794071 * @summary Test that exceptions have a proper parent class - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/model/TestSourceVersion.java b/test/langtools/tools/javac/processing/model/TestSourceVersion.java index 3a56bf76007f..d53368d3b6df 100644 --- a/test/langtools/tools/javac/processing/model/TestSourceVersion.java +++ b/test/langtools/tools/javac/processing/model/TestSourceVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 7025809 8028543 6415644 8028544 8029942 8187951 8193291 8196551 8233096 8275308 * @summary Test latest, latestSupported, underscore as keyword, etc. - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java b/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java index c7504da4f893..de575841d122 100644 --- a/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java +++ b/test/langtools/tools/javac/processing/model/element/TestAnonClassNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6449781 6930508 * @summary Test that reported names of anonymous classes are non-null. - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler * @build JavacTestingAbstractProcessor TestAnonSourceNames diff --git a/test/langtools/tools/javac/processing/model/element/TestElement.java b/test/langtools/tools/javac/processing/model/element/TestElement.java index 9c8783191106..4bfe6280fd58 100644 --- a/test/langtools/tools/javac/processing/model/element/TestElement.java +++ b/test/langtools/tools/javac/processing/model/element/TestElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6453386 * @summary Test basic properties of javax.lang.element.Element - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/element/TestExecutableElement.java b/test/langtools/tools/javac/processing/model/element/TestExecutableElement.java index 4a37be9d7d75..2296214555f6 100644 --- a/test/langtools/tools/javac/processing/model/element/TestExecutableElement.java +++ b/test/langtools/tools/javac/processing/model/element/TestExecutableElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 8005046 8011052 8025087 * @summary Test basic properties of javax.lang.element.ExecutableElement - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/element/TestNames.java b/test/langtools/tools/javac/processing/model/element/TestNames.java index adbbf87c8e42..7e9ed193afd6 100644 --- a/test/langtools/tools/javac/processing/model/element/TestNames.java +++ b/test/langtools/tools/javac/processing/model/element/TestNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6380016 * @summary Test that the constraints guaranteed by the Filer and maintained - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/element/TestPackageElement.java b/test/langtools/tools/javac/processing/model/element/TestPackageElement.java index f3749f6c5ffa..83d7515677b4 100644 --- a/test/langtools/tools/javac/processing/model/element/TestPackageElement.java +++ b/test/langtools/tools/javac/processing/model/element/TestPackageElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6449798 6399404 8173776 8163989 * @summary Test basic workings of PackageElement - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/element/TestResourceVariable.java b/test/langtools/tools/javac/processing/model/element/TestResourceVariable.java index a0f133779ab1..9a51613358a4 100644 --- a/test/langtools/tools/javac/processing/model/element/TestResourceVariable.java +++ b/test/langtools/tools/javac/processing/model/element/TestResourceVariable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6911256 6964740 6967842 6961571 7025809 * @summary Test that the resource variable kind is appropriately set - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler * @build JavacTestingAbstractProcessor TestResourceVariable diff --git a/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/NpeTest.java b/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/NpeTest.java index 1e252c01cc06..849f8df7b710 100644 --- a/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/NpeTest.java +++ b/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/NpeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6593082 * @summary MirroredTypeException constructor should not accept null - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java b/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java index 38c2db7ca139..2487ac779105 100644 --- a/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java +++ b/test/langtools/tools/javac/processing/model/type/MirroredTypeEx/Plurality.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ * @build JavacTestingAbstractProcessor * @compile Plurality.java * @compile -processor Plurality -proc:only Plurality.java - * @author Joseph D. Darcy */ import java.lang.annotation.*; import java.math.BigDecimal; diff --git a/test/langtools/tools/javac/processing/model/type/TestTypeKind.java b/test/langtools/tools/javac/processing/model/type/TestTypeKind.java index fc1ed62e2a58..9bc2e7e7cb62 100644 --- a/test/langtools/tools/javac/processing/model/type/TestTypeKind.java +++ b/test/langtools/tools/javac/processing/model/type/TestTypeKind.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6347716 * @summary Test TypeKind.isPrimitive - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler */ diff --git a/test/langtools/tools/javac/processing/model/util/deprecation/TestDeprecation.java b/test/langtools/tools/javac/processing/model/util/deprecation/TestDeprecation.java index d90b1ad34bf9..fe8e5262be4f 100644 --- a/test/langtools/tools/javac/processing/model/util/deprecation/TestDeprecation.java +++ b/test/langtools/tools/javac/processing/model/util/deprecation/TestDeprecation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6392818 * @summary Tests Elements.isDeprecated(Element) - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/elements/TestGetConstantExpression.java b/test/langtools/tools/javac/processing/model/util/elements/TestGetConstantExpression.java index a9827b2aacc1..b0b15cf92260 100644 --- a/test/langtools/tools/javac/processing/model/util/elements/TestGetConstantExpression.java +++ b/test/langtools/tools/javac/processing/model/util/elements/TestGetConstantExpression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6471577 6517779 * @summary Test Elements.getConstantExpression - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/elements/TestGetPackageOf.java b/test/langtools/tools/javac/processing/model/util/elements/TestGetPackageOf.java index d82addd8b1fe..96c84db5bb7d 100644 --- a/test/langtools/tools/javac/processing/model/util/elements/TestGetPackageOf.java +++ b/test/langtools/tools/javac/processing/model/util/elements/TestGetPackageOf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6453386 8216404 8230337 * @summary Test Elements.getPackageOf - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java b/test/langtools/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java index f8292afd8155..ae048af45cc3 100644 --- a/test/langtools/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java +++ b/test/langtools/tools/javac/processing/model/util/elements/TestIsFunctionalInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 8007574 * @summary Test Elements.isFunctionalInterface - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/elements/VacuousEnum.java b/test/langtools/tools/javac/processing/model/util/elements/VacuousEnum.java index 2d16a8786255..6269d5c7334a 100644 --- a/test/langtools/tools/javac/processing/model/util/elements/VacuousEnum.java +++ b/test/langtools/tools/javac/processing/model/util/elements/VacuousEnum.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6937417 * @summary Test -Xprint on enum type with no constants - * @author Joseph D. Darcy * @compile -Xprint VacuousEnum.java */ public enum VacuousEnum { diff --git a/test/langtools/tools/javac/processing/model/util/filter/TestIterables.java b/test/langtools/tools/javac/processing/model/util/filter/TestIterables.java index a9bf8ecf8e69..6e9539b7a9e6 100644 --- a/test/langtools/tools/javac/processing/model/util/filter/TestIterables.java +++ b/test/langtools/tools/javac/processing/model/util/filter/TestIterables.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 6406164 * @summary Test that ElementFilter iterable methods behave properly. - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules java.compiler * jdk.compiler diff --git a/test/langtools/tools/javac/processing/model/util/types/TestPseudoTypeHandling.java b/test/langtools/tools/javac/processing/model/util/types/TestPseudoTypeHandling.java index 5359d26e53f7..b0898a30ca91 100644 --- a/test/langtools/tools/javac/processing/model/util/types/TestPseudoTypeHandling.java +++ b/test/langtools/tools/javac/processing/model/util/types/TestPseudoTypeHandling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 8175335 * @summary Test Types methods on module and package TypeMirrors - * @author Joseph D. Darcy * @library /tools/javac/lib * @modules jdk.compiler * @build JavacTestingAbstractProcessor TestPseudoTypeHandling diff --git a/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java b/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java index 54fe613acf18..24abf89ee029 100644 --- a/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java +++ b/test/langtools/tools/javac/processing/warnings/TestSourceVersionWarnings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,11 @@ * questions. */ + /* * @test * @bug 6376083 6376084 6458819 7025784 7025786 7025789 * @summary Test that warnings about source versions are output as expected. - * @author Joseph D. Darcy * @modules java.compiler * jdk.compiler * @compile TestSourceVersionWarnings.java diff --git a/test/lib-test/jdk/test/lib/security/DerUtilsTest.java b/test/lib-test/jdk/test/lib/security/DerUtilsTest.java new file mode 100644 index 000000000000..5ab6dcf59f4c --- /dev/null +++ b/test/lib-test/jdk/test/lib/security/DerUtilsTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.util.HexFormat; + +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; +import jdk.test.lib.security.DerUtils; +import sun.security.util.DerOutputStream; +import sun.security.util.DerValue; +import sun.security.util.KnownOIDs; +import sun.security.util.ObjectIdentifier; + +/* + * @test + * @bug 8381049 + * @library /test/lib + * @modules java.base/sun.security.util + * @summary Tests DerUtils navigation, assertions, and editing helpers + */ +public class DerUtilsTest { + + public static void main(String[] args) throws Exception { + //0000:0015 [] SEQUENCE + //0002:0004 [0] OID 1.2.3 + //0006:0003 [1] INTEGER 1 + //0009:000C [2] OCTET STRING + // >>> into 10 octets + //000B:000A [2c] SEQUENCE + //000D:0005 [2c0] OID 2.5.4.3 (CommonName) + //0012:0003 [2c1] INTEGER 2 + byte[] der = bytes("30 13 06022a03 020101 04 0a 30 08 0603550403 020102"); + + // Test innerDerValue + Asserts.assertEQ(DerUtils.innerDerValue(der, "0").getOID(), + ObjectIdentifier.of("1.2.3")); + Asserts.assertEQ(DerUtils.innerDerValue(der, "1").getInteger(), 1); + Asserts.assertEQ(DerUtils.innerDerValue(der, "2c0").getOID(), + ObjectIdentifier.of(KnownOIDs.CommonName)); + Asserts.assertEQ(DerUtils.innerDerValue(der, "2c1").getInteger(), 2); + Asserts.assertTrue(DerUtils.innerDerValue(der, "3") == null); + + // Test checks + DerUtils.checkAlg(der, "0", ObjectIdentifier.of("1.2.3")); + DerUtils.checkInt(der, "1", 1); + DerUtils.checkAlg(der, "2c0", ObjectIdentifier.of(KnownOIDs.CommonName)); + DerUtils.checkInt(der, "2c1", 2); + DerUtils.shouldNotExist(der, "3"); + + // Test edit + der = DerUtils.edit(der, "0", oidValue("1.2.3.4")); + Asserts.assertEqualsByteArray( + bytes("30 14 06032a0304 020101 04 0a 30 08 0603550403 020102"), der); + + der = DerUtils.edit(der, "2c1", intValue(8)); + Asserts.assertEqualsByteArray( + bytes("30 14 06032a0304 020101 04 0a 30 08 0603550403 020108"), der); + + der = DerUtils.edit(der, "1", null); + Asserts.assertEqualsByteArray( + bytes("30 11 06032a0304 04 0a 30 08 0603550403 020108"), der); + + // Test insert + der = DerUtils.insert(der, "0", oidValue("1.2.5")); + Asserts.assertEqualsByteArray( + bytes("30 15 06022a05 06032a0304 04 0a 30 08 0603550403 020108"), der); + + der = DerUtils.insert(der, "2c1", intValue(9)); + Asserts.assertEqualsByteArray( + bytes("30 18 06022a05 06032a0304 04 0d 30 0b 0603550403 020109 020108"), der); + + der = DerUtils.insert(der, "2c1", oidValue("1.2.6")); + Asserts.assertEqualsByteArray( + bytes("30 1c 06022a05 06032a0304 04 11 30 0f 0603550403 06022a06 020109 020108"), der); + + // Cannot insert into a position ends with "c" + var derClone = der.clone(); // non-final reference cannot be used in lambda + Utils.runAndCheckException(() -> DerUtils.insert(derClone, "2c", + oidValue("1.2.7")), IOException.class); + } + + static DerValue oidValue(String oid) throws IOException { + return DerValue.wrap(new DerOutputStream() + .putOID(ObjectIdentifier.of(oid)).toByteArray()); + } + + static DerValue intValue(int value) throws IOException { + return DerValue.wrap(new DerOutputStream() + .putInteger(value).toByteArray()); + } + + public static byte[] bytes(String hex) { + return HexFormat.of().parseHex(hex.replace(" ", "")); + } +} diff --git a/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java b/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java index 83e381356a08..fb67ce83bbe1 100644 --- a/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java +++ b/test/lib/jdk/test/lib/artifacts/ArtifactResolver.java @@ -23,8 +23,7 @@ package jdk.test.lib.artifacts; -import jtreg.SkippedException; - +import java.io.IOException; import java.nio.file.Path; import java.util.HashMap; import java.util.Map; @@ -90,15 +89,15 @@ public static Path resolve(String name, Map artifactDescription, * @return the local path to the artifact. If the artifact is a compressed * file that gets unpacked, this path will point to the root * directory of the uncompressed file(s). - * @throws SkippedException thrown if the artifact cannot be found + * @throws IOException thrown if the artifact cannot be found */ - public static Path fetchOne(Class klass) { + public static Path fetchOne(Class klass) throws IOException { try { return ArtifactResolver.resolve(klass).entrySet().stream() .findAny().get().getValue(); } catch (ArtifactResolverException e) { Artifact artifact = klass.getAnnotation(Artifact.class); - throw new SkippedException("Cannot find the artifact " + artifact.name(), e); + throw new IOException("Cannot find the artifact " + artifact.name(), e); } } diff --git a/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java b/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java index 3d721b598b93..886412190674 100644 --- a/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java +++ b/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java @@ -281,7 +281,9 @@ public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Excepti * @throws Exception */ public static void removeDockerImage(String imageNameAndTag) throws Exception { + if(!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) { execute(Container.ENGINE_COMMAND, "rmi", "--force", imageNameAndTag); + } } @@ -320,7 +322,7 @@ public static OutputAnalyzer execute(String... command) throws Exception { System.out.println("[ELAPSED: " + (System.currentTimeMillis() - started) + " ms]"); System.out.println("[STDERR]\n" + output.getStderr()); System.out.println("[STDOUT]\n" + stdoutLimited); - if (stdout != stdoutLimited) { + if (!stdout.equals(stdoutLimited)) { System.out.printf("Child process STDOUT is limited to %d lines\n", max); } diff --git a/test/lib/jdk/test/lib/net/SimpleSSLContext.java b/test/lib/jdk/test/lib/net/SimpleSSLContext.java index e8611fb007f3..a4ea873ec693 100644 --- a/test/lib/jdk/test/lib/net/SimpleSSLContext.java +++ b/test/lib/jdk/test/lib/net/SimpleSSLContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,69 +23,100 @@ package jdk.test.lib.net; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; import java.io.*; import java.security.*; -import java.security.cert.*; -import java.util.function.Supplier; import javax.net.ssl.*; /** - * Creates a simple usable SSLContext for SSLSocketFactory - * or a HttpsServer using either a given keystore or a default - * one in the test tree. - * - * Using this class with a security manager requires the following - * permissions to be granted: - * - * permission "java.util.PropertyPermission" "test.src.path", "read"; - * permission java.io.FilePermission "/path/to/test/lib/jdk/test/lib/testkeys", "read"; - * The exact path above depends on the location of the test. + * Utility for creating a simple usable {@link SSLContext} for testing purposes. */ -public class SimpleSSLContext { +public final class SimpleSSLContext { + + private static final String DEFAULT_PROTOCOL = "TLS"; + + private static final String DEFAULT_KEY_STORE_FILE_REL_PATH = "jdk/test/lib/net/testkeys"; - SSLContext ssl; + private final SSLContext ssl; + + // Made `public` for backward compatibility + public SimpleSSLContext() throws IOException { + this.ssl = findSSLContext(DEFAULT_KEY_STORE_FILE_REL_PATH, DEFAULT_PROTOCOL); + } + + // Kept for backward compatibility + public SimpleSSLContext(String keyStoreFileRelPath) throws IOException { + this.ssl = findSSLContext(Objects.requireNonNull(keyStoreFileRelPath), DEFAULT_PROTOCOL); + } /** - * loads default keystore from SimpleSSLContext - * source directory + * {@return a new {@link SSLContext} instance by searching for a key store + * file path, and loading the first found one} + * + * @throws RuntimeException if no key store file can be found or the found + * one cannot be loaded */ - public SimpleSSLContext() throws IOException { - this(() -> "TLS"); + public static SSLContext findSSLContext() throws IOException { + return findSSLContext(DEFAULT_PROTOCOL); + } + + /** + * {@return a new {@link SSLContext} instance by searching for a key store + * file path, and loading the first found one} + * + * @param protocol an {@link SSLContext} protocol + * + * @throws NullPointerException if {@code protocol} is null + * @throws RuntimeException if no key store file can be found or the found + * one cannot be loaded + */ + public static SSLContext findSSLContext(String protocol) throws IOException { + Objects.requireNonNull(protocol); + return findSSLContext(DEFAULT_KEY_STORE_FILE_REL_PATH, protocol); } + /** + * {@return a new {@link SSLContext} instance by searching for a key store + * file path, and loading the first found one} + * + * @param keyStoreFileRelPath a key store file path to be concatenated with + * the search path(s) obtained from the + * {@code test.src.path} system property + * @param protocol an {@link SSLContext} protocol + * + * @throws NullPointerException if {@code keyStoreFileRelPath} or {@code protocol} is null + * @throws RuntimeException if no key store file can be found or the found + * one cannot be loaded + */ @SuppressWarnings("removal") - private SimpleSSLContext(Supplier protocols) throws IOException { + public static SSLContext findSSLContext(String keyStoreFileRelPath, String protocol) throws IOException { + Objects.requireNonNull(keyStoreFileRelPath); + Objects.requireNonNull(protocol); + try { - final String proto = protocols.get(); - AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public Void run() throws Exception { - String paths = System.getProperty("test.src.path"); - StringTokenizer st = new StringTokenizer(paths, File.pathSeparator); - boolean securityExceptions = false; - while (st.hasMoreTokens()) { - String path = st.nextToken(); - try { - File f = new File(path, "jdk/test/lib/net/testkeys"); - if (f.exists()) { - try (FileInputStream fis = new FileInputStream(f)) { - init(fis, proto); - return null; - } - } - } catch (SecurityException e) { - // catch and ignore because permission only required - // for one entry on path (at most) - securityExceptions = true; + SSLContext res = (SSLContext) AccessController.doPrivileged((PrivilegedExceptionAction) () -> { + String sourcePaths = System.getProperty("test.src.path"); + boolean securityExceptions = false; + for (var sourcePath : Collections.list(new StringTokenizer(sourcePaths, File.pathSeparator))) { + try { + var keyStoreFileAbsPath = Path.of((String) sourcePath, keyStoreFileRelPath); + if (Files.exists(keyStoreFileAbsPath)) { + return loadSSLContext(keyStoreFileAbsPath, protocol); } + } catch (SecurityException e) { + // catch and ignore because permission only required + // for one entry on path (at most) + securityExceptions = true; } - if (securityExceptions) { - System.err.println("SecurityExceptions thrown on loading testkeys"); - } - return null; } + if (securityExceptions) { + System.err.println("SecurityExceptions thrown on loading testkeys"); + } + return null; }); + if (res != null) return res; } catch (PrivilegedActionException pae) { Throwable t = pae.getCause() != null ? pae.getCause() : pae; if (t instanceof IOException) @@ -96,23 +127,25 @@ public Void run() throws Exception { throw (Error)t; throw new RuntimeException(t); } + throw new RuntimeException( + "Could not find any key store at source path(s) using key store file relative path '%s'".formatted( + keyStoreFileRelPath)); } /** - * loads default keystore from given directory + * {@return a new {@link SSLContext} loaded from the provided key store file + * path using the given protocol} + * + * @param keyStoreFilePath a {@link KeyStore} file path + * @param protocol an {@link SSLContext} protocol + * + * @throws RuntimeException if loading fails */ - public SimpleSSLContext(String dir) throws IOException { - String file = dir + "/testkeys"; - try (FileInputStream fis = new FileInputStream(file)) { - init(fis, "TLS"); - } - } - - private void init(InputStream i, String protocol) throws IOException { - try { + private static SSLContext loadSSLContext(Path keyStoreFilePath, String protocol) { + try (var storeStream = Files.newInputStream(keyStoreFilePath)) { char[] passphrase = "passphrase".toCharArray(); KeyStore ks = KeyStore.getInstance("PKCS12"); - ks.load(i, passphrase); + ks.load(storeStream, passphrase); KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX"); kmf.init(ks, passphrase); @@ -120,25 +153,32 @@ private void init(InputStream i, String protocol) throws IOException { TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); tmf.init(ks); - ssl = SSLContext.getInstance(protocol); - ssl.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); - } catch (KeyManagementException | KeyStoreException | - UnrecoverableKeyException | CertificateException | - NoSuchAlgorithmException e) { - throw new RuntimeException(e.getMessage()); + var sslContext = SSLContext.getInstance(protocol); + sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + return sslContext; + } catch (SecurityException e) { + throw e; + } catch (Exception e) { + var message = "Failed loading 'SSLContext' from key store at location '%s' for protocol '%s'".formatted( + keyStoreFilePath, protocol); + throw new RuntimeException(message, e); } } + // Kept for backward compatibility public static SSLContext getContext(String protocol) throws IOException { - if(protocol == null || protocol.isEmpty()) { - return new SimpleSSLContext().get(); - } - else { - return new SimpleSSLContext(() -> protocol).get(); + try { + return protocol == null || protocol.isEmpty() + ? findSSLContext() + : findSSLContext(protocol); + } catch (RuntimeException re) { + throw new IOException(re); } } + // Kept for backward compatibility public SSLContext get() { return ssl; } + } diff --git a/test/lib/jdk/test/lib/security/CertificateBuilder.java b/test/lib/jdk/test/lib/security/CertificateBuilder.java index a1078185560d..2cf836b0a5d7 100644 --- a/test/lib/jdk/test/lib/security/CertificateBuilder.java +++ b/test/lib/jdk/test/lib/security/CertificateBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ package jdk.test.lib.security; import java.io.*; +import java.net.IDN; import java.security.cert.*; import java.security.cert.Extension; import java.util.*; @@ -41,10 +42,14 @@ import sun.security.x509.AlgorithmId; import sun.security.x509.AuthorityInfoAccessExtension; import sun.security.x509.AuthorityKeyIdentifierExtension; +import sun.security.x509.CRLDistributionPointsExtension; +import sun.security.x509.GeneralSubtrees; import sun.security.x509.IPAddressName; +import sun.security.x509.NameConstraintsExtension; import sun.security.x509.SubjectKeyIdentifierExtension; import sun.security.x509.BasicConstraintsExtension; import sun.security.x509.ExtendedKeyUsageExtension; +import sun.security.x509.DistributionPoint; import sun.security.x509.DNSName; import sun.security.x509.GeneralName; import sun.security.x509.GeneralNames; @@ -58,13 +63,13 @@ /** * Helper class that builds and signs X.509 certificates. - * + *

* A CertificateBuilder is created with a default constructor, and then * uses additional public methods to set the public key, desired validity * dates, serial number and extensions. It is expected that the caller will * have generated the necessary key pairs prior to using a CertificateBuilder * to generate certificates. - * + *

* The following methods are mandatory before calling build(): *

    *
  • {@link #setSubjectName(java.lang.String)} @@ -78,12 +83,12 @@ * Additionally, the caller can either provide a {@link List} of * {@link Extension} objects, or use the helper classes to add specific * extension types. - * + *

    * When all required and desired parameters are set, the * {@link #build(java.security.cert.X509Certificate, java.security.PrivateKey, * java.lang.String)} method can be used to create the {@link X509Certificate} * object. - * + *

    * Multiple certificates may be cut from the same settings using subsequent * calls to the build method. Settings may be cleared using the * {@link #reset()} method. @@ -109,20 +114,23 @@ public enum KeyUsage { KEY_CERT_SIGN, CRL_SIGN, ENCIPHER_ONLY, - DECIPHER_ONLY; + DECIPHER_ONLY } /** - * Create a new CertificateBuilder instance. This method sets the subject name, - * public key, authority key id, and serial number. + * Create a new {@code CertificateBuilder} instance. This method sets the + * subject name, public key, authority key id, and serial number. * * @param subjectName entity associated with the public key * @param publicKey the entity's public key * @param caKey public key of certificate signer * @param keyUsages list of key uses - * @return - * @throws CertificateException - * @throws IOException + * @return a {@code CertificateBuilder} configured with the provided + * parameters + * + * @throws CertificateException if an error occurs when obtaining the + * underlying {@link CertificateFactory} + * @throws IOException if any extension encoding errors occur */ public static CertificateBuilder newCertificateBuilder(String subjectName, PublicKey publicKey, PublicKey caKey, KeyUsage... keyUsages) @@ -148,9 +156,13 @@ public static CertificateBuilder newCertificateBuilder(String subjectName, /** * Create a Subject Alternative Name extension for the given DNS name + * * @param critical Sets the extension to critical or non-critical * @param dnsName DNS name to use in the extension - * @throws IOException + * @return a {@code SubjectAlternativeNameExtension} configured with + * the {@code dnsName} as individual DNSName entry. + * + * @throws IOException if any encoding errors occur */ public static SubjectAlternativeNameExtension createDNSSubjectAltNameExt( boolean critical, String dnsName) throws IOException { @@ -161,9 +173,13 @@ public static SubjectAlternativeNameExtension createDNSSubjectAltNameExt( /** * Create a Subject Alternative Name extension for the given IP address + * * @param critical Sets the extension to critical or non-critical * @param ipAddress IP address to use in the extension - * @throws IOException + * @return a {@code SubjectAlternativeNameExtension} configured with + * the {@code ipAddress} as individual IPAddressName entry. + * + * @throws IOException if any encoding errors occur */ public static SubjectAlternativeNameExtension createIPSubjectAltNameExt( boolean critical, String ipAddress) throws IOException { @@ -208,6 +224,9 @@ public CertificateBuilder setSubjectName(X500Principal name) { * Set the subject name for the certificate. * * @param name The subject name in RFC 2253 format + * + * @throws IllegalArgumentException if any parsing errors on the + * {@code name} parameter occur. */ public CertificateBuilder setSubjectName(String name) { try { @@ -234,6 +253,9 @@ public CertificateBuilder setSubjectName(X500Name name) { * Set the public key for this certificate. * * @param pubKey The {@link PublicKey} to be used on this certificate. + * + * @throws NullPointerException if the {@code pubKey} parameter + * is {@code null} */ public CertificateBuilder setPublicKey(PublicKey pubKey) { publicKey = Objects.requireNonNull(pubKey, "Caught null public key"); @@ -245,6 +267,9 @@ public CertificateBuilder setPublicKey(PublicKey pubKey) { * * @param nbDate A {@link Date} object specifying the start of the * certificate validity period. + * + * @throws NullPointerException if the {@code nbDate} parameter + * is {@code null} */ public CertificateBuilder setNotBefore(Date nbDate) { Objects.requireNonNull(nbDate, "Caught null notBefore date"); @@ -257,6 +282,9 @@ public CertificateBuilder setNotBefore(Date nbDate) { * * @param naDate A {@link Date} object specifying the end of the * certificate validity period. + * + * @throws NullPointerException if the {@code naDate} parameter + * is {@code null} */ public CertificateBuilder setNotAfter(Date naDate) { Objects.requireNonNull(naDate, "Caught null notAfter date"); @@ -271,6 +299,9 @@ public CertificateBuilder setNotAfter(Date naDate) { * certificate validity period. * @param naDate A {@link Date} object specifying the end of the * certificate validity period. + * + * @throws NullPointerException if either the {@code nbDate} or + * {@code naDate} parameters are {@code null} */ public CertificateBuilder setValidity(Date nbDate, Date naDate) { return setNotBefore(nbDate).setNotAfter(naDate); @@ -285,6 +316,8 @@ public CertificateBuilder setOneHourValidity() { * Set the serial number on the certificate. * * @param serial A serial number in {@link BigInteger} form. + * + * @throws NullPointerException if {@code serial} is {@code null} */ public CertificateBuilder setSerialNumber(BigInteger serial) { Objects.requireNonNull(serial, "Caught null serial number"); @@ -309,6 +342,8 @@ public CertificateBuilder addExtension(Extension ext) { * * @param extList The {@link List} of extensions to be added to * the certificate. + * + * @throws NullPointerException if {@code extList} is {@code null} */ public CertificateBuilder addExtensions(List extList) { Objects.requireNonNull(extList, "Caught null extension list"); @@ -330,7 +365,8 @@ public CertificateBuilder addSubjectAltNameDNSExt(List dnsNames) if (!dnsNames.isEmpty()) { GeneralNames gNames = new GeneralNames(); for (String name : dnsNames) { - gNames.add(new GeneralName(new DNSName(name))); + gNames.add(new GeneralName(new DNSName(new DerValue( + DerValue.tag_IA5String, IDN.toASCII(name))))); } addExtension(new SubjectAlternativeNameExtension(false, gNames)); @@ -338,13 +374,41 @@ public CertificateBuilder addSubjectAltNameDNSExt(List dnsNames) return this; } + /** + * Helper method to add one or more distribution points to the CRL + * Distribution Points extension. This form of the method only supports + * URI name types, but can be extended in the future to support other types. + * + * @param uriNames a list of URIs in String form + * @return the {@code CertificateBuilder} configured to add this + * CRL Distribution Points extension. + * + * @throws IOException if any of the URIs in {@code uriNames} are + * malformed + */ + public CertificateBuilder addCrlDistributionPointsExt(List uriNames) + throws IOException { + if (uriNames != null && !uriNames.isEmpty()) { + GeneralNames gNames = new GeneralNames(); + for (String name : uriNames) { + gNames.add(new GeneralName(new URIName(name))); + } + addExtension(new CRLDistributionPointsExtension(List.of( + new DistributionPoint(gNames, null, null)))); + } + return this; + } + /** * Helper method to add one or more OCSP URIs to the Authority Info Access * certificate extension. Location strings can be in two forms: - * 1) Just a URI by itself: This will be treated as using the OCSP + *

      + *
    1. Just a URI by itself: This will be treated as using the OCSP * access description (legacy behavior). - * 2) An access description name (case-insensitive) followed by a - * pipe (|) and the URI (e.g. OCSP|http://ocsp.company.com/revcheck). + *
    2. An access description name (case-insensitive) followed by a + * pipe (|) and the URI (e.g. + * {@code OCSP|http://ocsp.company.com/revcheck}). + *
    * Current description names are OCSP and CAISSUER. Others may be * added later. * @@ -365,16 +429,12 @@ public CertificateBuilder addAIAExt(List locations) adObj = AccessDescription.Ad_OCSP_Id; uriLoc = tokens[0]; } else { - switch (tokens[0].toUpperCase()) { - case "OCSP": - adObj = AccessDescription.Ad_OCSP_Id; - break; - case "CAISSUER": - adObj = AccessDescription.Ad_CAISSUERS_Id; - break; - default: - throw new IOException("Unknown AD: " + tokens[0]); - } + adObj = switch (tokens[0].toUpperCase()) { + case "OCSP" -> AccessDescription.Ad_OCSP_Id; + case "CAISSUER" -> AccessDescription.Ad_CAISSUERS_Id; + default -> throw new IOException("Unknown AD: " + + tokens[0]); + }; uriLoc = tokens[1]; } acDescList.add(new AccessDescription(adObj, @@ -418,6 +478,17 @@ public CertificateBuilder addBasicConstraintsExt(boolean crit, boolean isCA, maxPathLen)); } + /** + * Set the Name Constraints Extension for a certificate. + * + * @param permitted permitted names + * @param excluded excluded names + */ + public CertificateBuilder addNameConstraintsExt( + GeneralSubtrees permitted, GeneralSubtrees excluded) { + return addExtension(new NameConstraintsExtension(permitted, excluded)); + } + /** * Add the Authority Key Identifier extension. * @@ -519,7 +590,7 @@ public X509Certificate build(X509Certificate issuerCert, } /** - * Encode the contents of the outer-most ASN.1 SEQUENCE: + * Encode the contents of the outermost ASN.1 SEQUENCE: * *
          *  Certificate  ::=  SEQUENCE  {
    diff --git a/test/lib/jdk/test/lib/security/DerUtils.java b/test/lib/jdk/test/lib/security/DerUtils.java
    index 234130aa4ca7..2323065b5952 100644
    --- a/test/lib/jdk/test/lib/security/DerUtils.java
    +++ b/test/lib/jdk/test/lib/security/DerUtils.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2018, 2026, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -24,6 +24,7 @@
     
     import jdk.test.lib.Asserts;
     import sun.security.util.DerInputStream;
    +import sun.security.util.DerOutputStream;
     import sun.security.util.DerValue;
     import sun.security.util.KnownOIDs;
     import sun.security.util.ObjectIdentifier;
    @@ -124,4 +125,84 @@ public static void shouldNotExist(byte[] der, String location)
                 throws Exception {
             Asserts.assertTrue(innerDerValue(der, location) == null);
         }
    +
    +    /// Replaces a `DerValue` (deep) inside with another one.
    +    ///
    +    /// @param data the `DerValue`
    +    /// @param target the location to edit. Cannot be empty.
    +    /// @param replacement replace the value at `target` with this. Can be a `DerValue`
    +    ///         or a `DerOutputStream`. Remove if `null`.
    +    /// @return the new value
    +    public static byte[] edit(byte[] data, String target, Object replacement)
    +            throws IOException {
    +        if (target.isEmpty()) throw new IOException("Must be a sub-location");
    +        return modify0(data, "", target, replacement, false).toByteArray();
    +    }
    +
    +    /// Inserts a `DerValue` (deep) into another one.
    +    ///
    +    /// @param data the `DerValue`
    +    /// @param target the location to insert at. Cannot be empty. The new value
    +    ///        is inserted before the existing value at `target`, and following
    +    ///        values are shifted. After insertion, the value at `target`
    +    ///        is the inserted value. A target ending exactly with `c` is not
    +    ///        a valid insertion position because the content of an OCTET
    +    ///        STRING must be only one `DerValue`.
    +    /// @param addition the value to insert. Can be a `DerValue` or a
    +    ///        `DerOutputStream`
    +    /// @return the new value
    +    public static byte[] insert(byte[] data, String target, Object addition)
    +            throws IOException {
    +        if (target.isEmpty()) throw new IOException("Must be a sub-location");
    +        return modify0(data, "", target, addition, true).toByteArray();
    +    }
    +
    +    /// Implementation of [#edit] and [#insert], recursively.
    +    ///
    +    /// @param data the `DerValue`
    +    /// @param now the current location
    +    /// @param target the location to edit or insert at
    +    /// @param replacement the replacement or inserted value
    +    /// @param insert true to insert before the target, false to replace it
    +    /// @return the new value at this location
    +    private static DerOutputStream modify0(byte[] data, String now, String target,
    +            Object replacement, boolean insert) throws IOException {
    +        var out = new DerOutputStream();
    +        var parent = DerUtils.innerDerValue(data, now);
    +        if (target.equals(now + "c")) {
    +            if (insert) {
    +                throw new IOException("Action cannot be performed at position " + target);
    +            }
    +            if (replacement instanceof DerValue v) {
    +                out.putDerValue(v);
    +            } else if (replacement instanceof DerOutputStream s) {
    +                out.write(s);
    +            }
    +        } else if (target.startsWith(now + "c")) { // not there yet, go inside
    +            return out.write(parent.tag, modify0(data, now + "c", target, replacement, insert));
    +        } else {
    +            for (int i = 0; ; i++) {
    +                // We only support locations of one digit now
    +                if (i > 9) throw new IllegalStateException("Too big " + i);
    +                String pos = now + i;
    +                var sub = DerUtils.innerDerValue(data, pos); // current value
    +                if (sub == null) break; // at the end
    +                if (target.equals(pos)) { // the one we want to change
    +                    if (replacement instanceof DerValue v) {
    +                        out.putDerValue(v);
    +                    } else if (replacement instanceof DerOutputStream s) {
    +                        out.write(s);
    +                    }
    +                    if (insert) {
    +                        out.putDerValue(sub);
    +                    }
    +                } else if (target.startsWith(pos)) { // not there yet, go inside
    +                    out.write(modify0(data, pos, target, replacement, insert));
    +                } else { // the untouched values
    +                    out.putDerValue(sub);
    +                }
    +            }
    +        }
    +        return new DerOutputStream().write(parent.tag, out);
    +    }
     }
    diff --git a/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java b/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java
    index 88508f89587f..32041a93701a 100644
    --- a/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java
    +++ b/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java
    @@ -23,6 +23,7 @@
     
     package jdk.test.lib.security;
     
    +import java.io.IOException;
     import java.nio.file.Path;
     import jdk.test.lib.Platform;
     import jdk.test.lib.process.ProcessTools;
    @@ -49,42 +50,40 @@ public class OpensslArtifactFetcher {
          *
          * @return openssl binary path of the current version
          * @throws SkippedException if a valid version of OpenSSL cannot be found
    +     *         or if OpenSSL is not available on the target platform
          */
         public static String getOpensslPath() {
             String path = getOpensslFromSystemProp(OPENSSL_BUNDLE_VERSION);
             if (path != null) {
    +            System.out.println("Using OpenSSL from system property.");
                 return path;
             }
    +
             path = getDefaultSystemOpensslPath(OPENSSL_BUNDLE_VERSION);
             if (path != null) {
    +            System.out.println("Using OpenSSL from system.");
                 return path;
             }
    +
             if (Platform.isX64()) {
                 if (Platform.isLinux()) {
    -                path = fetchOpenssl(LINUX_X64.class);
    +                return fetchOpenssl(LINUX_X64.class);
                 } else if (Platform.isOSX()) {
    -                path = fetchOpenssl(MACOSX_X64.class);
    +                return fetchOpenssl(MACOSX_X64.class);
                 } else if (Platform.isWindows()) {
    -                path = fetchOpenssl(WINDOWS_X64.class);
    +                return fetchOpenssl(WINDOWS_X64.class);
                 }
             } else if (Platform.isAArch64()) {
                 if (Platform.isLinux()) {
    -                path = fetchOpenssl(LINUX_AARCH64.class);
    +                return fetchOpenssl(LINUX_AARCH64.class);
                 }
                 if (Platform.isOSX()) {
    -                path = fetchOpenssl(MACOSX_AARCH64.class);
    +                return fetchOpenssl(MACOSX_AARCH64.class);
                 }
             }
     
    -        if (!verifyOpensslVersion(path, OPENSSL_BUNDLE_VERSION)) {
    -            String exMsg = "Can't find the version: "
    -                    + OpensslArtifactFetcher.getTestOpensslBundleVersion()
    -                    + " of openssl binary on this machine, please install"
    -                    + " and set openssl path with property 'test.openssl.path'";
    -            throw new SkippedException(exMsg);
    -        } else {
    -            return path;
    -        }
    +        throw new SkippedException(String.format("No OpenSSL %s found for %s/%s",
    +                OPENSSL_BUNDLE_VERSION, Platform.getOsName(), Platform.getOsArch()));
         }
     
         private static String getOpensslFromSystemProp(String version) {
    @@ -120,9 +119,13 @@ private static boolean verifyOpensslVersion(String path, String version) {
         }
     
         private static String fetchOpenssl(Class clazz) {
    -        return ArtifactResolver.fetchOne(clazz)
    -            .resolve("openssl").resolve("bin").resolve("openssl")
    +        try {
    +            return ArtifactResolver.fetchOne(clazz)
    +                .resolve("openssl").resolve("bin").resolve("openssl")
                     .toString();
    +        } catch (IOException exc) {
    +            throw new SkippedException("Could not find openssl", exc);
    +        }
         }
     
         // retrieve the provider directory path from /bin/openssl
    diff --git a/test/lib/jdk/test/lib/security/timestamp/TsaHandler.java b/test/lib/jdk/test/lib/security/timestamp/TsaHandler.java
    index d42d9f031d47..fa3d6abe599b 100644
    --- a/test/lib/jdk/test/lib/security/timestamp/TsaHandler.java
    +++ b/test/lib/jdk/test/lib/security/timestamp/TsaHandler.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -148,7 +148,6 @@ protected SignerEntry createSignerEntry(String alias) throws Exception {
          */
         protected TsaParam getParam(URI uri) {
             String query = uri.getQuery();
    -
             TsaParam param = TsaParam.newInstance();
             if (query != null) {
                 for (String bufParam : query.split("&")) {
    @@ -186,6 +185,12 @@ protected TsaParam getParam(URI uri) {
                     } else if ("certReq".equalsIgnoreCase(pair[0])) {
                         param.certReq(Boolean.valueOf(pair[1]));
                         System.out.println("certReq: " + param.certReq());
    +                } else if ("noSignedAttrs".equalsIgnoreCase(pair[0])) {
    +                    param.noSignedAttrs(Boolean.valueOf(pair[1]));
    +                    System.out.println("noSignedAttrs: " + param.noSignedAttrs());
    +                } else if ("notTimestampOID".equalsIgnoreCase(pair[0])) {
    +                    param.notTimestampOID(Boolean.valueOf(pair[1]));
    +                    System.out.println("notTimestampOID: " + param.notTimestampOID());
                     }
                 }
             }
    diff --git a/test/lib/jdk/test/lib/security/timestamp/TsaParam.java b/test/lib/jdk/test/lib/security/timestamp/TsaParam.java
    index fca684bd5e6d..8838fb71a3a7 100644
    --- a/test/lib/jdk/test/lib/security/timestamp/TsaParam.java
    +++ b/test/lib/jdk/test/lib/security/timestamp/TsaParam.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -71,6 +71,12 @@ public class TsaParam {
         // Indicate if request TSA server certificate
         private Boolean certReq;
     
    +    // Do not create signedAttrs
    +    private Boolean noSignedAttrs;
    +
    +    // Do not use TIMESTAMP_TOKEN_INFO_OID
    +    private Boolean notTimestampOID;
    +
         public static TsaParam newInstance() {
             return new TsaParam();
         }
    @@ -177,4 +183,22 @@ public TsaParam certReq(Boolean certReq) {
             this.certReq = certReq;
             return this;
         }
    +
    +    public Boolean noSignedAttrs() {
    +        return noSignedAttrs;
    +    }
    +
    +    public TsaParam noSignedAttrs(Boolean noSignedAttrs) {
    +        this.noSignedAttrs = noSignedAttrs;
    +        return this;
    +    }
    +
    +    public Boolean notTimestampOID() {
    +        return notTimestampOID;
    +    }
    +
    +    public TsaParam notTimestampOID(Boolean notTimestampOID) {
    +        this.notTimestampOID = notTimestampOID;
    +        return this;
    +    }
     }
    diff --git a/test/lib/jdk/test/lib/security/timestamp/TsaSigner.java b/test/lib/jdk/test/lib/security/timestamp/TsaSigner.java
    index a3647552557d..e8a10b73d5bd 100644
    --- a/test/lib/jdk/test/lib/security/timestamp/TsaSigner.java
    +++ b/test/lib/jdk/test/lib/security/timestamp/TsaSigner.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    @@ -23,8 +23,8 @@
     
     package jdk.test.lib.security.timestamp;
     
    -import java.io.ByteArrayOutputStream;
     import java.math.BigInteger;
    +import java.security.MessageDigest;
     import java.security.Signature;
     import java.security.cert.X509Certificate;
     import java.util.Date;
    @@ -33,6 +33,8 @@
     import jdk.test.lib.hexdump.HexPrinter;
     import sun.security.pkcs.ContentInfo;
     import sun.security.pkcs.PKCS7;
    +import sun.security.pkcs.PKCS9Attribute;
    +import sun.security.pkcs.PKCS9Attributes;
     import sun.security.pkcs.SignerInfo;
     import sun.security.util.*;
     import sun.security.x509.AlgorithmId;
    @@ -202,8 +204,11 @@ private byte[] createResponse(TsaParam requestParam) throws Exception {
                 DerOutputStream eContentOut = new DerOutputStream();
                 eContentOut.putOctetString(tstInfoSeqData);
     
    +            ObjectIdentifier infoOid = respParam.notTimestampOID() == Boolean.TRUE
    +                    ? ContentInfo.DATA_OID
    +                    : ContentInfo.TIMESTAMP_TOKEN_INFO_OID;
                 ContentInfo eContentInfo = new ContentInfo(
    -                    ObjectIdentifier.of(KnownOIDs.TimeStampTokenInfo),
    +                    infoOid,
                         new DerValue(eContentOut.toByteArray()));
     
                 String defaultSigAlgo =  SignatureUtil.getDefaultSigAlgForKey(
    @@ -213,15 +218,35 @@ private byte[] createResponse(TsaParam requestParam) throws Exception {
                 System.out.println(
                         "Signature algorithm: " + signature.getAlgorithm());
                 signature.initSign(signerEntry.privateKey);
    -            signature.update(tstInfoSeqData);
    +
    +            AlgorithmId digestAlg = SignatureUtil.getDigestAlgInPkcs7SignerInfo(
    +                    signature, sigAlgo, signerEntry.privateKey, false);
    +
    +            PKCS9Attributes authAttrs = null;
    +
    +            if (respParam.noSignedAttrs() == Boolean.TRUE) {
    +                signature.update(tstInfoSeqData);
    +            } else {
    +                authAttrs = new PKCS9Attributes(new PKCS9Attribute[]{
    +                        new PKCS9Attribute(PKCS9Attribute.CONTENT_TYPE_OID,
    +                                infoOid),
    +                        new PKCS9Attribute(PKCS9Attribute.SIGNING_TIME_OID,
    +                                new Date()),
    +                        new PKCS9Attribute(PKCS9Attribute.MESSAGE_DIGEST_OID,
    +                                MessageDigest.getInstance(digestAlg.getName())
    +                                        .digest(tstInfoSeqData))
    +                });
    +                signature.update(authAttrs.getDerEncoding());
    +            }
     
                 SignerInfo signerInfo = new SignerInfo(
                         new X500Name(issuerName),
                         signerEntry.cert.getSerialNumber(),
    -                    SignatureUtil.getDigestAlgInPkcs7SignerInfo(
    -                            signature, sigAlgo, signerEntry.privateKey, false),
    +                    digestAlg,
    +                    authAttrs,
                         AlgorithmId.get(sigAlgo),
    -                    signature.sign());
    +                    signature.sign(),
    +                    null);
     
                 X509Certificate[] signerCertChain = interceptor.getSignerCertChain(
                         signerEntry.certChain, requestParam.certReq());
    diff --git a/test/lib/jdk/test/lib/thread/TestThreadFactory.java b/test/lib/jdk/test/lib/thread/TestThreadFactory.java
    new file mode 100644
    index 000000000000..ac5a6b749092
    --- /dev/null
    +++ b/test/lib/jdk/test/lib/thread/TestThreadFactory.java
    @@ -0,0 +1,55 @@
    +/*
    + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
    + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    + *
    + * This code is free software; you can redistribute it and/or modify it
    + * under the terms of the GNU General Public License version 2 only, as
    + * published by the Free Software Foundation.
    + *
    + * This code is distributed in the hope that it will be useful, but WITHOUT
    + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    + * version 2 for more details (a copy is included in the LICENSE file that
    + * accompanied this code).
    + *
    + * You should have received a copy of the GNU General Public License version
    + * 2 along with this work; if not, write to the Free Software Foundation,
    + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    + *
    + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    + * or visit www.oracle.com if you need additional information or have any
    + * questions.
    + */
    +
    +package jdk.test.lib.thread;
    +
    +import java.util.concurrent.ThreadFactory;
    +
    +/*
    +    This factory is used to start new threads in tests.
    +    It supports creation of virtual threads when jtreg test.thread.factory plugin is enabled.
    +*/
    +
    +public class TestThreadFactory {
    +
    +    private static ThreadFactory threadFactory = "Virtual".equals(System.getProperty("test.thread.factory"))
    +            ? virtualThreadFactory() : platformThreadFactory();
    +
    +    public static Thread newThread(Runnable task) {
    +        return threadFactory.newThread(task);
    +    }
    +
    +    public static Thread newThread(Runnable task, String name) {
    +        Thread t = threadFactory.newThread(task);
    +        t.setName(name);
    +        return t;
    +    }
    +
    +    private static ThreadFactory platformThreadFactory() {
    +        return Thread.ofPlatform().factory();
    +    }
    +
    +    private static ThreadFactory virtualThreadFactory() {
    +        return Thread.ofVirtual().factory();
    +    }
    +}
    diff --git a/test/micro/org/openjdk/bench/java/security/HSS.java b/test/micro/org/openjdk/bench/java/security/HSS.java
    index c2f746d2449e..6d0cf694f4aa 100644
    --- a/test/micro/org/openjdk/bench/java/security/HSS.java
    +++ b/test/micro/org/openjdk/bench/java/security/HSS.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
    @@ -57,11 +57,6 @@
     @Measurement(iterations = 5, time = 1)
     @Fork(value = 3, jvmArgs = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"})
     
    -// Tests 1-2 are from RFC 8554, Appendix F.
    -
    -// Tests 3-10 were generated with parameter sets mentioned in
    -// RFC 8554 section 6.4; two with W=8 and six with W=4.
    -
     public class HSS {
     
         static byte[] decode(String s) {
    @@ -87,14 +82,13 @@ public static void verify(Signature v, byte[] pk, byte[] msg, byte[] sig)
             }
         }
     
    -    // RFC 8554 Test Case 1
         @State(Scope.Benchmark)
         public static class test01 {
             byte[] pk;
             byte[] msg;
             byte[] sig;
     
    -        @Param({"RFC 8554 1"})
    +        @Param({"Test 1"})
             private String test;
     
             @Setup
    @@ -103,119 +97,117 @@ public void setup() throws Exception {
                     00000002
                     00000005
                     00000004
    -                61a5d57d37f5e46bfb7520806b07a1b850650e3b31fe4a773ea29a07f09cf2ea
    -                30e579f0df58ef8e298da0434cb2b878""");
    +                0e975b10a6b33473d01baa138c155e81d7b7156b389b2a6a09d49f42c1ac4984
    +                2d977e65fceb6bc80e06eace38ce0116
    +                """);
                 msg = decode("""
    -                54686520706f77657273206e6f742064656c65676174656420746f2074686520
    -                556e69746564205374617465732062792074686520436f6e737469747574696f
    -                6e2c206e6f722070726f6869626974656420627920697420746f207468652053
    -                74617465732c2061726520726573657276656420746f20746865205374617465
    -                7320726573706563746976656c792c206f7220746f207468652070656f706c65
    -                2e0a""");
    +                312e20546869732069732061207465737420666f72204853532f4c4d53207768
    +                6963682069732076657279206c6f6e6720616e64206e6f74206d65616e742074
    +                6f207265616420627920612068756d616e206265696e672e
    +                """);
                 sig = decode("""
                     00000001
                     00000005
                     00000004
    -                d32b56671d7eb98833c49b433c272586bc4a1c8a8970528ffa04b966f9426eb9
    -                965a25bfd37f196b9073f3d4a232feb69128ec45146f86292f9dff9610a7bf95
    -                a64c7f60f6261a62043f86c70324b7707f5b4a8a6e19c114c7be866d488778a0
    -                e05fd5c6509a6e61d559cf1a77a970de927d60c70d3de31a7fa0100994e162a2
    -                582e8ff1b10cd99d4e8e413ef469559f7d7ed12c838342f9b9c96b83a4943d16
    -                81d84b15357ff48ca579f19f5e71f18466f2bbef4bf660c2518eb20de2f66e3b
    -                14784269d7d876f5d35d3fbfc7039a462c716bb9f6891a7f41ad133e9e1f6d95
    -                60b960e7777c52f060492f2d7c660e1471e07e72655562035abc9a701b473ecb
    -                c3943c6b9c4f2405a3cb8bf8a691ca51d3f6ad2f428bab6f3a30f55dd9625563
    -                f0a75ee390e385e3ae0b906961ecf41ae073a0590c2eb6204f44831c26dd768c
    -                35b167b28ce8dc988a3748255230cef99ebf14e730632f27414489808afab1d1
    -                e783ed04516de012498682212b07810579b250365941bcc98142da13609e9768
    -                aaf65de7620dabec29eb82a17fde35af15ad238c73f81bdb8dec2fc0e7f93270
    -                1099762b37f43c4a3c20010a3d72e2f606be108d310e639f09ce7286800d9ef8
    -                a1a40281cc5a7ea98d2adc7c7400c2fe5a101552df4e3cccfd0cbf2ddf5dc677
    -                9cbbc68fee0c3efe4ec22b83a2caa3e48e0809a0a750b73ccdcf3c79e6580c15
    -                4f8a58f7f24335eec5c5eb5e0cf01dcf4439424095fceb077f66ded5bec73b27
    -                c5b9f64a2a9af2f07c05e99e5cf80f00252e39db32f6c19674f190c9fbc506d8
    -                26857713afd2ca6bb85cd8c107347552f30575a5417816ab4db3f603f2df56fb
    -                c413e7d0acd8bdd81352b2471fc1bc4f1ef296fea1220403466b1afe78b94f7e
    -                cf7cc62fb92be14f18c2192384ebceaf8801afdf947f698ce9c6ceb696ed70e9
    -                e87b0144417e8d7baf25eb5f70f09f016fc925b4db048ab8d8cb2a661ce3b57a
    -                da67571f5dd546fc22cb1f97e0ebd1a65926b1234fd04f171cf469c76b884cf3
    -                115cce6f792cc84e36da58960c5f1d760f32c12faef477e94c92eb75625b6a37
    -                1efc72d60ca5e908b3a7dd69fef0249150e3eebdfed39cbdc3ce9704882a2072
    -                c75e13527b7a581a556168783dc1e97545e31865ddc46b3c957835da252bb732
    -                8d3ee2062445dfb85ef8c35f8e1f3371af34023cef626e0af1e0bc017351aae2
    -                ab8f5c612ead0b729a1d059d02bfe18efa971b7300e882360a93b025ff97e9e0
    -                eec0f3f3f13039a17f88b0cf808f488431606cb13f9241f40f44e537d302c64a
    -                4f1f4ab949b9feefadcb71ab50ef27d6d6ca8510f150c85fb525bf25703df720
    -                9b6066f09c37280d59128d2f0f637c7d7d7fad4ed1c1ea04e628d221e3d8db77
    -                b7c878c9411cafc5071a34a00f4cf07738912753dfce48f07576f0d4f94f42c6
    -                d76f7ce973e9367095ba7e9a3649b7f461d9f9ac1332a4d1044c96aefee67676
    -                401b64457c54d65fef6500c59cdfb69af7b6dddfcb0f086278dd8ad0686078df
    -                b0f3f79cd893d314168648499898fbc0ced5f95b74e8ff14d735cdea968bee74
    +                a63c20fdbd752910d2a87d25c4ba6bb233d5dd363e5f44a25f766a477f13aa79
    +                1474acc5f205d27f1f89234282a2f27205bb914efa34ea8bdd8d7eab6e748614
    +                79b5e6088451c07b079196d0d897edc8974e3d2fa244e38242c6831b9124a298
    +                ed74872b0c6c5cd1c25fcc5279fb1bc30d4b1ee122b9292aedbcfd7e49d4d54b
    +                a1a330d88774e6de909a81624c3440b687495758c83b0439fb104d9e7a695a9e
    +                62247b52162121c1a80999d11e4211cd23c374a1a23e57dfc49792427806276f
    +                c03cc2d0958990c030e2f8c85e2922547e4ae4918833357ed8ff16ae189fbc76
    +                1da5a2e02f824d4ebd8ff731f9c3a8268d3056c1917129a918981bb35079a73b
    +                bac9cba7a99a4536ed4420def0d1ca3b9702be27c6d638fb3a8449edf699d349
    +                fbd44a8c80985d85946d31221942541143ede3b557929c7f2de6840b0910b6ab
    +                c0dac975200be5f36fbcb5d0ebe0c79d7c8b1218e6afa1fb487399f53ac2a10e
    +                e70113fdc20ab4e1689122568eeeacd0da903cb56ddfe54d386e6f7ab7971878
    +                e3dddcf7f78e31ce95c9aa6dfa26501027e42f7066ee5a94c4ccf6647d85776f
    +                b244ffa85794e873a12634a5468967f05a9a5efc4276944ec9664aaf9b684db4
    +                bd417669f2e151f174ae1eed01565b563eabf8177fbbeb2ab61667dcb7423a86
    +                2dbea29581cada5c0ebab53c0811ec8ebab234b7dbb30456837e82bd5e23e8a8
    +                a75f4331a4da821abc63d50b1bdc4bd861a0ba1ebfad6db2fd5d44e587ce9bf3
    +                095f314be58411b4b2ea5f0fd10bf091c5038bb8290b5964d6f24edb2aecccf2
    +                eb81cbcecaf1e1320853e326a8af9bb1f456105ea58b42ae9d994e35c505a74b
    +                50e04e406b247ff34e3ba27ddb4d7d2a6ade1e2652c25da88a8c6a76024c7c7d
    +                7e879597438e608741ac8bd3f35c9212db9978d7d54fda331df3e302e3b59201
    +                4be842a48a0abc58f5421c8f9d32e191aad082ac04bde2e3695e346d2af5e20a
    +                00c232def87a5a3dfca8809b1260a43403242b303197a5329b951632aab0738c
    +                b45a51c76f1c97a6c836f40c5165e0c68c16a8ab50b078c2b8fe09f280838648
    +                c6c74d59fc2c1a46ce424e28bdc7c44a683902b06e9995c67e4efd3981f5424a
    +                3930100b11bf7ef17c99c5d27a661e8d366ee49441278959c59e7af1ae25bd93
    +                a504291b3e834c5b68c1e84ee885c6e0152c7cf015aac2065ec19ba3b16166b9
    +                02621389a60efea12d8b4a5b5d59ab8145c804bb45694d443b09d4111faa2ba6
    +                e7e48d3bfa3d1c48b427f383b393c7d0e422fd1e958e14e5866cf6dfd06764c0
    +                fe384c6ae8e1650860dbc12b0e2731ece7ea40e11fdeba8ae7dff74375d7d717
    +                2ab0fb15d6c40b1677a2079b5a4af563fc4c08363176ce4da74b1ef34b0b8627
    +                1d405a442b60a554fa88d0320363e7b818bf532d3fbc52764479886d3f4d3d7b
    +                b35d0402b17025abad9cc1525e722cca4c961497f784e55f46d8f8067e4705c3
    +                6b62c260391575cfaa949ad99a98e9ca2a55d4e2241c33b3dd8b2505a804c6f7
    +                67617d02ebaefaa6cd02cc93041395d1c47be820abc647bd531549aee307cbca
                     00000005
    -                d8b8112f9200a5e50c4a262165bd342cd800b8496810bc716277435ac376728d
    -                129ac6eda839a6f357b5a04387c5ce97382a78f2a4372917eefcbf93f63bb591
    -                12f5dbe400bd49e4501e859f885bf0736e90a509b30a26bfac8c17b5991c157e
    -                b5971115aa39efd8d564a6b90282c3168af2d30ef89d51bf14654510a12b8a14
    -                4cca1848cf7da59cc2b3d9d0692dd2a20ba3863480e25b1b85ee860c62bf5136
    +                d443111b4f3c3e02ea3043a3db682e8720e10e67852a4331f55deaf62ff8673b
    +                fc8e3fed9740f6cd4a276556c40de3ce8c7c0e60d7b2744f2a481a0d7854b703
    +                cc47a30d27ed823933e6d87c5573c135c0ced4c944f766de92f216756824c4a4
    +                d80b9d5337dee0498becbd5b248920283dac655346a847f93555d9a469c66858
    +                51891eb06cdfa25179c9054ee8795477c4806df8790becc8eb9ea458656f82a1
                     00000005
                     00000004
    -                d2f14ff6346af964569f7d6cb880a1b66c5004917da6eafe4d9ef6c6407b3db0
    -                e5485b122d9ebe15cda93cfec582d7ab
    +                bb8df6a42d2b9f29644c2c99967d2cc569b3a8470a960d6fa954aafe5e15660a
    +                9fa56cc9a583d7b1dab98da3e6c121c1
                     0000000a
                     00000004
    -                0703c491e7558b35011ece3592eaa5da4d918786771233e8353bc4f62323185c
    -                95cae05b899e35dffd717054706209988ebfdf6e37960bb5c38d7657e8bffeef
    -                9bc042da4b4525650485c66d0ce19b317587c6ba4bffcc428e25d08931e72dfb
    -                6a120c5612344258b85efdb7db1db9e1865a73caf96557eb39ed3e3f426933ac
    -                9eeddb03a1d2374af7bf77185577456237f9de2d60113c23f846df26fa942008
    -                a698994c0827d90e86d43e0df7f4bfcdb09b86a373b98288b7094ad81a0185ac
    -                100e4f2c5fc38c003c1ab6fea479eb2f5ebe48f584d7159b8ada03586e65ad9c
    -                969f6aecbfe44cf356888a7b15a3ff074f771760b26f9c04884ee1faa329fbf4
    -                e61af23aee7fa5d4d9a5dfcf43c4c26ce8aea2ce8a2990d7ba7b57108b47dabf
    -                beadb2b25b3cacc1ac0cef346cbb90fb044beee4fac2603a442bdf7e507243b7
    -                319c9944b1586e899d431c7f91bcccc8690dbf59b28386b2315f3d36ef2eaa3c
    -                f30b2b51f48b71b003dfb08249484201043f65f5a3ef6bbd61ddfee81aca9ce6
    -                0081262a00000480dcbc9a3da6fbef5c1c0a55e48a0e729f9184fcb1407c3152
    -                9db268f6fe50032a363c9801306837fafabdf957fd97eafc80dbd165e435d0e2
    -                dfd836a28b354023924b6fb7e48bc0b3ed95eea64c2d402f4d734c8dc26f3ac5
    -                91825daef01eae3c38e3328d00a77dc657034f287ccb0f0e1c9a7cbdc828f627
    -                205e4737b84b58376551d44c12c3c215c812a0970789c83de51d6ad787271963
    -                327f0a5fbb6b5907dec02c9a90934af5a1c63b72c82653605d1dcce51596b3c2
    -                b45696689f2eb382007497557692caac4d57b5de9f5569bc2ad0137fd47fb47e
    -                664fcb6db4971f5b3e07aceda9ac130e9f38182de994cff192ec0e82fd6d4cb7
    -                f3fe00812589b7a7ce515440456433016b84a59bec6619a1c6c0b37dd1450ed4
    -                f2d8b584410ceda8025f5d2d8dd0d2176fc1cf2cc06fa8c82bed4d944e71339e
    -                ce780fd025bd41ec34ebff9d4270a3224e019fcb444474d482fd2dbe75efb203
    -                89cc10cd600abb54c47ede93e08c114edb04117d714dc1d525e11bed8756192f
    -                929d15462b939ff3f52f2252da2ed64d8fae88818b1efa2c7b08c8794fb1b214
    -                aa233db3162833141ea4383f1a6f120be1db82ce3630b3429114463157a64e91
    -                234d475e2f79cbf05e4db6a9407d72c6bff7d1198b5c4d6aad2831db61274993
    -                715a0182c7dc8089e32c8531deed4f7431c07c02195eba2ef91efb5613c37af7
    -                ae0c066babc69369700e1dd26eddc0d216c781d56e4ce47e3303fa73007ff7b9
    -                49ef23be2aa4dbf25206fe45c20dd888395b2526391a724996a44156beac8082
    -                12858792bf8e74cba49dee5e8812e019da87454bff9e847ed83db07af3137430
    -                82f880a278f682c2bd0ad6887cb59f652e155987d61bbf6a88d36ee93b6072e6
    -                656d9ccbaae3d655852e38deb3a2dcf8058dc9fb6f2ab3d3b3539eb77b248a66
    -                1091d05eb6e2f297774fe6053598457cc61908318de4b826f0fc86d4bb117d33
    -                e865aa805009cc2918d9c2f840c4da43a703ad9f5b5806163d7161696b5a0adc
    +                3431bace4875824faf76e488612472b3a535893056745f0f20e615806d87ba36
    +                ab0935d2b080fd6281fa5fca325926ba219c04a02aa2e2faca7ba0f885cb90ce
    +                5bf07a6dfb60f55541092cbb9386ab47438debaed31b648cb3cab090ab2c3eaf
    +                386a2024899e4cb83e75340933c564a22c060e5ac792316123d004125babf59e
    +                082dc93d4817ab8a7cd772fe28a400060ca4dcecc001203a474f294031c44dcf
    +                ebc3c73f672556cda6ad193883c5c95fb1587042b733f936dc0977cbc4aa13b9
    +                fd22794a7204968e0cdb73cc19061447617bfdcef141fb9b87538232d92b1482
    +                54b0917f252efc8766d6b09b0215c675ab5d41c87630121e5e536bcfea3fc134
    +                f57de38eff427a531ed403d903c1c96b5fd71d8431c03ca8d521a2c686051e0a
    +                5a57e199d65b0a60a086f70a3e42ad6b343e5565e996e7bb678ebdc1e01f9041
    +                289f45c3e0f56e5aeb269cfe70deca17153ee46388ac0d88b24ee7a32c607726
    +                1664a5d10fb5f64ed925351b2475494920acb7272962da31c8db6f76baadbc83
    +                9d94373f8a203ac3c62fad998913277153e1db8872f75cb3ab18f4b6ae785d35
    +                54785bd261b66535f34a756e8749f6d2a6049c9bf8aa991b1c5d79eae63ebde0
    +                99f853608dae24d68d4709c0898bf1e1fb44198a23fd7a7ecd653db67688153f
    +                f2a1c399cb3379903e31e4c4f06ef50671eb071a2084d16b08270ff203d51c1a
    +                5334d777d169c331db8e3e1c6653649d69cf1a3853423c7de5e688b10d741aa3
    +                5233ef53440db7a3bd6b9a613183820ea7ec1e7469d1743cf1d8aefb599f6f1c
    +                08865c99afd652558b73955734b36794351c246c9822e96bc276cfa7cd942f6a
    +                afcdb162a361332ee79a128c6ccf67d0ae3dec0b0a80e716c572162e9eb9230d
    +                83c3d758d4efecdfb573864f7fc1f203cf0c64d2fc9a68029ea67d7e53885c60
    +                c7dffc6e1af3c0460a64a8b21c62107f7a3408b724e478d0018eaee33e60350b
    +                7e355758d236bf8fbaa82d43955a9df4a5073ab1eab25269e89c9278097ed20c
    +                0d46b0722c9a0ab613ae09a5220dfffb930f013f83262f524061fb47f16dde4e
    +                48ba37d1e73c5b63bfd3f80ea1b36ad690476e0338271555de0e8a88a2f4ec14
    +                e05ab9753633ee4b792a715c6c7c1d01209619c4a4070235fb1022781f5ee437
    +                8514cf87b6b274bcf25551fec891fba127dcf09bbbaad957ea1e4f512b64d787
    +                f32538f53fdffe99e3914e9c9815c812b0bc6c1aee4d9d5a5cacd7f0d6f5ecc5
    +                958a595788400787615d3ab0bccdf9fc94c6bcf7154c0975d90fb60fafe0834a
    +                1cd44979b52548c875094b1adc9c63b5de19f3e888db7a0b7a2c238b4090c55f
    +                f57734c24e69df21697c650c1d8f5f62e067bda229e4ec3e9da93e6fa76a9ff9
    +                48327baba8c7b8b14a63291fd7fd6847e20f6653edabbc21e257827be4089fbc
    +                39047197e40ad2553bcdc603c82a1b80c03bf5a461f31e073295a4cbbc02530f
    +                be5a6c3092813f37ae9e2ec7ee8c0dc1a2379cbcfe2ad550e90f0a73f4e789a1
    +                270a3332e277e7113ed38527c241817d391b5a2742b6a4cb789a407525f35982
                     00000005
    -                d5c0d1bebb06048ed6fe2ef2c6cef305b3ed633941ebc8b3bec9738754cddd60
    -                e1920ada52f43d055b5031cee6192520d6a5115514851ce7fd448d4a39fae2ab
    -                2335b525f484e9b40d6a4a969394843bdcf6d14c48e8015e08ab92662c05c6e9
    -                f90b65a7a6201689999f32bfd368e5e3ec9cb70ac7b8399003f175c40885081a
    -                09ab3034911fe125631051df0408b3946b0bde790911e8978ba07dd56c73e7ee
    +                e6ffc1535a60978d93a81a64564b61821c7125542c0fe5996a93e0da0f5f8a71
    +                2d2e444d1bd96837bf0354ca844e90b82bf08746bbc95189e2268bfa686e88f9
    +                f90f35a095a2ab26402fc87ddf3656edfb16fe3816ffaf99e983915ebbcf2f51
    +                85f294d491c47fb90d3ce9046d2f05da6a723ac342a32154d1c18b465b49308f
    +                41ca2f0475adf5ed46413766a6057bc810aeb6dd593691b84752b883c8a1a422
                     """);
             }
         }
     
    -    // RFC 8554 Test Case 2
         @State(Scope.Benchmark)
         public static class test02 {
             byte[] pk;
             byte[] msg;
             byte[] sig;
     
    -        @Param({"RFC 8554 2"})
    +        @Param({"Test 2"})
             private String test;
     
             @Setup
    @@ -224,1604 +216,144 @@ public void setup() throws Exception {
                     00000002
                     00000006
                     00000003
    -                d08fabd4a2091ff0a8cb4ed834e7453432a58885cd9ba0431235466bff9651c6
    -                c92124404d45fa53cf161c28f1ad5a8e""");
    +                ff466afe664c2581845b2c6af92aeb6e5c4dd15affc86c82ef4e807ad3c648a6
    +                4561666c975fd9cb150d6c7acd6e577f
    +                """);
                 msg = decode("""
    -                54686520656e756d65726174696f6e20696e2074686520436f6e737469747574
    -                696f6e2c206f66206365727461696e207269676874732c207368616c6c206e6f
    -                7420626520636f6e73747275656420746f2064656e79206f7220646973706172
    -                616765206f74686572732072657461696e6564206279207468652070656f706c
    -                652e0a""");
    +                322e20546869732069732061207465737420666f72204853532f4c4d53207768
    +                6963682069732076657279206c6f6e6720616e64206e6f74206d65616e742074
    +                6f207265616420627920612068756d616e206265696e672e
    +                """);
                 sig = decode("""
                     00000001
                     00000003
                     00000003
    -                3d46bee8660f8f215d3f96408a7a64cf1c4da02b63a55f62c666ef5707a914ce
    -                0674e8cb7a55f0c48d484f31f3aa4af9719a74f22cf823b94431d01c926e2a76
    -                bb71226d279700ec81c9e95fb11a0d10d065279a5796e265ae17737c44eb8c59
    -                4508e126a9a7870bf4360820bdeb9a01d9693779e416828e75bddd7d8c70d50a
    -                0ac8ba39810909d445f44cb5bb58de737e60cb4345302786ef2c6b14af212ca1
    -                9edeaa3bfcfe8baa6621ce88480df2371dd37add732c9de4ea2ce0dffa53c926
    -                49a18d39a50788f4652987f226a1d48168205df6ae7c58e049a25d4907edc1aa
    -                90da8aa5e5f7671773e941d8055360215c6b60dd35463cf2240a9c06d694e9cb
    -                54e7b1e1bf494d0d1a28c0d31acc75161f4f485dfd3cb9578e836ec2dc722f37
    -                ed30872e07f2b8bd0374eb57d22c614e09150f6c0d8774a39a6e168211035dc5
    -                2988ab46eaca9ec597fb18b4936e66ef2f0df26e8d1e34da28cbb3af75231372
    -                0c7b345434f72d65314328bbb030d0f0f6d5e47b28ea91008fb11b05017705a8
    -                be3b2adb83c60a54f9d1d1b2f476f9e393eb5695203d2ba6ad815e6a111ea293
    -                dcc21033f9453d49c8e5a6387f588b1ea4f706217c151e05f55a6eb7997be09d
    -                56a326a32f9cba1fbe1c07bb49fa04cecf9df1a1b815483c75d7a27cc88ad1b1
    -                238e5ea986b53e087045723ce16187eda22e33b2c70709e53251025abde89396
    -                45fc8c0693e97763928f00b2e3c75af3942d8ddaee81b59a6f1f67efda0ef81d
    -                11873b59137f67800b35e81b01563d187c4a1575a1acb92d087b517a8833383f
    -                05d357ef4678de0c57ff9f1b2da61dfde5d88318bcdde4d9061cc75c2de3cd47
    -                40dd7739ca3ef66f1930026f47d9ebaa713b07176f76f953e1c2e7f8f271a6ca
    -                375dbfb83d719b1635a7d8a13891957944b1c29bb101913e166e11bd5f34186f
    -                a6c0a555c9026b256a6860f4866bd6d0b5bf90627086c6149133f8282ce6c9b3
    -                622442443d5eca959d6c14ca8389d12c4068b503e4e3c39b635bea245d9d05a2
    -                558f249c9661c0427d2e489ca5b5dde220a90333f4862aec793223c781997da9
    -                8266c12c50ea28b2c438e7a379eb106eca0c7fd6006e9bf612f3ea0a454ba3bd
    -                b76e8027992e60de01e9094fddeb3349883914fb17a9621ab929d970d101e45f
    -                8278c14b032bcab02bd15692d21b6c5c204abbf077d465553bd6eda645e6c306
    -                5d33b10d518a61e15ed0f092c32226281a29c8a0f50cde0a8c66236e29c2f310
    -                a375cebda1dc6bb9a1a01dae6c7aba8ebedc6371a7d52aacb955f83bd6e4f84d
    -                2949dcc198fb77c7e5cdf6040b0f84faf82808bf985577f0a2acf2ec7ed7c0b0
    -                ae8a270e951743ff23e0b2dd12e9c3c828fb5598a22461af94d568f29240ba28
    -                20c4591f71c088f96e095dd98beae456579ebbba36f6d9ca2613d1c26eee4d8c
    -                73217ac5962b5f3147b492e8831597fd89b64aa7fde82e1974d2f6779504dc21
    -                435eb3109350756b9fdabe1c6f368081bd40b27ebcb9819a75d7df8bb07bb05d
    -                b1bab705a4b7e37125186339464ad8faaa4f052cc1272919fde3e025bb64aa8e
    -                0eb1fcbfcc25acb5f718ce4f7c2182fb393a1814b0e942490e52d3bca817b2b2
    -                6e90d4c9b0cc38608a6cef5eb153af0858acc867c9922aed43bb67d7b33acc51
    -                9313d28d41a5c6fe6cf3595dd5ee63f0a4c4065a083590b275788bee7ad875a7
    -                f88dd73720708c6c6c0ecf1f43bbaadae6f208557fdc07bd4ed91f88ce4c0de8
    -                42761c70c186bfdafafc444834bd3418be4253a71eaf41d718753ad07754ca3e
    -                ffd5960b0336981795721426803599ed5b2b7516920efcbe32ada4bcf6c73bd2
    -                9e3fa152d9adeca36020fdeeee1b739521d3ea8c0da497003df1513897b0f547
    -                94a873670b8d93bcca2ae47e64424b7423e1f078d9554bb5232cc6de8aae9b83
    -                fa5b9510beb39ccf4b4e1d9c0f19d5e17f58e5b8705d9a6837a7d9bf99cd1338
    -                7af256a8491671f1f2f22af253bcff54b673199bdb7d05d81064ef05f80f0153
    -                d0be7919684b23da8d42ff3effdb7ca0985033f389181f47659138003d712b5e
    -                c0a614d31cc7487f52de8664916af79c98456b2c94a8038083db55391e347586
    -                2250274a1de2584fec975fb09536792cfbfcf6192856cc76eb5b13dc4709e2f7
    -                301ddff26ec1b23de2d188c999166c74e1e14bbc15f457cf4e471ae13dcbdd9c
    -                50f4d646fc6278e8fe7eb6cb5c94100fa870187380b777ed19d7868fd8ca7ceb
    -                7fa7d5cc861c5bdac98e7495eb0a2ceec1924ae979f44c5390ebedddc65d6ec1
    -                1287d978b8df064219bc5679f7d7b264a76ff272b2ac9f2f7cfc9fdcfb6a5142
    -                8240027afd9d52a79b647c90c2709e060ed70f87299dd798d68f4fadd3da6c51
    -                d839f851f98f67840b964ebe73f8cec41572538ec6bc131034ca2894eb736b3b
    -                da93d9f5f6fa6f6c0f03ce43362b8414940355fb54d3dfdd03633ae108f3de3e
    -                bc85a3ff51efeea3bc2cf27e1658f1789ee612c83d0f5fd56f7cd071930e2946
    -                beeecaa04dccea9f97786001475e0294bc2852f62eb5d39bb9fbeef75916efe4
    -                4a662ecae37ede27e9d6eadfdeb8f8b2b2dbccbf96fa6dbaf7321fb0e701f4d4
    -                29c2f4dcd153a2742574126e5eaccc77686acf6e3ee48f423766e0fc466810a9
    -                05ff5453ec99897b56bc55dd49b991142f65043f2d744eeb935ba7f4ef23cf80
    -                cc5a8a335d3619d781e7454826df720eec82e06034c44699b5f0c44a8787752e
    -                057fa3419b5bb0e25d30981e41cb1361322dba8f69931cf42fad3f3bce6ded5b
    -                8bfc3d20a2148861b2afc14562ddd27f12897abf0685288dcc5c4982f8260268
    -                46a24bf77e383c7aacab1ab692b29ed8c018a65f3dc2b87ff619a633c41b4fad
    -                b1c78725c1f8f922f6009787b1964247df0136b1bc614ab575c59a16d089917b
    -                d4a8b6f04d95c581279a139be09fcf6e98a470a0bceca191fce476f9370021cb
    -                c05518a7efd35d89d8577c990a5e19961ba16203c959c91829ba7497cffcbb4b
    -                294546454fa5388a23a22e805a5ca35f956598848bda678615fec28afd5da61a
    +                8b0b372cbd26c8e43b5feee870169c7c8345f7d353980ec3f6f6b81c696c672c
    +                7d0cfc8f74de7a0950f30151ab06c218c4ca0dc425a713060e1f14a3009ed09f
    +                565b6f6a07d6fee14a618a34fd02dd43745c7c11572f3e2c9a7d7c80d1d16e5c
    +                ca11706861fb5359bb1a8e78d2da42d528d913cc593b414fe8ceb03e71171fb6
    +                6722dd5677c5bd6446c372356e8d4dba0da50ce696b80deeac51fac231e59241
    +                84706f9dd5820a430a1d0404071a3ce75f14a8fbee1573ad893cf2f5dea0fe21
    +                f899305b15fb971b785cb7432ca8a92b13fe055d7a1ddc46628b9591291bceba
    +                0c9c6d76d8c24b919c2c1b6d5c1dcdcfc177e6c7ac67ef0af08222d6780bd686
    +                439b78a5575494330d824b8b6962652b15b3d5d4f8ce2216033741f51b6e3aab
    +                c69817097649124460c9ddd7ffb14df8ed1de436f0958e193ba118334fc12859
    +                68ae32b6c3d1af8b8c95e4a620e442efb221ae5eb1953c7b8dfe645587916a4e
    +                c26f60ca2b088accfcf5f8f724b558c527f31cf3ed9311315a629d81f2702704
    +                56f237d745ea92ba6777d934df150ed9b3e10ce5a8a16011118081287463793c
    +                3818c2448b10e1ede5bfa8da646d9417a97ae70db9aa8df030c6019dab6ebb18
    +                6b9d4db14b3d9b33d1df3b23169963e371e2ec25bc3d932b8503ccbbe85d5675
    +                c433e62b5926de825420727da4c6bd70dd93fc4fcf9062d4f2acb96699b910db
    +                9788ffd122d88911f98e12fc57551b8282e5f296cc0dd075121c88e1a5838c3e
    +                239e2968af2eceec9ee4f7c3433d3145f2b7345d7c418febd0839fd45771debe
    +                52c0cefb71a38b55ddfb9b8386ec6e7fb39047df9e963d056d6e0b02a2620ba1
    +                f58264de9b09347ac0320919df80e5a66ebee3d6e801792b19a31c07cf28fff5
    +                85b4788aec445d4d04ca005f6a240d8e90c6bc2398df5ec6a9a1858549b67026
    +                b6c4a91d10faf47fcc7afa56d228d0518fb7a786d2f24decc476203fd84150e9
    +                165f11ec6eb168934bb7055ae2ae0f499ec8205565fcd397c6cb1c8f0bafa90f
    +                6c61a08a4657a19009085217ac255081bf280c726f2c818c543bde5fd2a67549
    +                efccf9e0d35144f5c8af2c69dda3b01b7333a31d6d6210475f0168db67c22940
    +                4d36818b6d530fb23941ae4c63226ec6135e598c879d6ab88928f84da104ee82
    +                30d96494b818b9d7004b2f15c7565dee0f611d1faf2ef538c70f2c08919e7919
    +                25b81e658743cf8903e40a1323bec2530288820f2c46e85f0622e50eed0a93fe
    +                5cf92db7d672d2d3186710c0b7e509afd1d498cb21936befc8029c936f9e1f6c
    +                587071dae0b5999e407929199f4bf03dea05bded0ddc6ccba2a8e880e972f876
    +                142c99fbefd3a362b27416cc2aadd8c595ab31cc53af7cfd87362118e9cb409c
    +                32cf3600eecd314073e8393fe390e3ed60d105a7d054143227874e96a1a16ce8
    +                1f9a17f03aa647ef08670e5ba7e561c025775a574ee84bd294b808c2908b7112
    +                d02f4d6462be588bf27d418545a64dc6fc472e743c913bf7f702356872166a4c
    +                9fcda456ca69651832c72786546a9e9011511bfdf7351f2333f944ac82e5f14e
    +                a1be1ad7b0b01caf273c9f3ef540cc79c47c7b32a8febcf8e3c34a3a0641e09a
    +                fbcb9a1c6bbf594e44faad8671d6e4c9d8bc053db2ebdd2e22ddd8a154462b23
    +                6b47d1fc2205a4e7405d8e883189d8b863b31152459e602bc6c30d0baed658a6
    +                4f2ac6858ea5e11ac3fae173f1a251cd7e5b26693bf994a952cc12a9b684a919
    +                77510077cc11002a325697eb0a7f86f7b45275e13e89d959a593d51c98cbb48f
    +                bea795ac5d5e61c4360431bb0712096c1e88a03d2367b2772f34ca938a4c0180
    +                68aa0f90314b6b23ae01437178bbf812590e347a7759581748d877a31c94a7eb
    +                9e839b0f2654a354faae234a819fbab9c32374f3b99ea7deb42e6a169e03d59a
    +                0ff3a6b4809059fcd4e5c426e5d580f6fff8e49be1c9a1baacad5b1cf0284060
    +                6969a2c6d04fbb30952ea3f792a60e517cdd3cd8f427c335b9a66ba6ac321657
    +                beb77de5e2b8d4a8f5c425665b9cadd6a379b7ef5ba513cfb2b2022d8e057637
    +                38d0edad6a24b1e57d7ebd11434a1e6fb00c1f5f9228bcdd2f24c468b7b4408c
    +                35b54e09fe59ed0dbab9760b3fe415c277e39a0bdd74783d7d0feb4d7428b609
    +                319f8e667899fb52c822076dfd07286d8c6058c2fcf8618cb77d0ba1077f49c8
    +                8f8ef55e980307dfa8d9a3076d8a7ba32f1c822e1c6bf7beb997e03181bade32
    +                b0b69507210466acd24cc9e13e4913c7e31dbfcf84021fe947e37f469de19488
    +                097852097888f11de144fc03606c68d63c7309c054853e1c66ca1b499898fd8b
    +                5edc934e7f368022c2576e18db909b88a8f9c6caa5fdc00f7da47995ad2e21f9
    +                b9e3133321ec6e7f6d43ee30b5376b846ce6390e1168b0543e4a50d961f82588
    +                58569f6a98e5bcad0dd90c4b88e982f34e7ad2897d8218aaa9284d947ddba4eb
    +                25a1f02ea59504d82c1e570a2804dd9fbde7dfaaa40996e9aeb0a3d65c27e3cf
    +                d81005ad070375c868ac754bd849700c52b10828deab05eefd2d0575a3ef7338
    +                d7ae9fe2c1c6c0f38abb7a63381a6903035ce87b93e0c4927e6b15a32d8bf86c
    +                fd9f9bd21366a2a264ebf96bb1213ae8bf7e193bd3eb041a7beebc8d5c474b2d
    +                1a2afd2488dd1f5176e99b11d6986bd8a30f2c4de7abc0a8b9d18e591c2e7deb
    +                05944d7661cce336f0c08ed3283a8500d91030e2553b1fa7839ff232ac8f70ee
    +                e1656c964a627bec73bf015b10b59551a38cc0a7b95b4cce2f8292ea28c85c20
    +                d51a97d0e0c59f99b9af2fc7585cb97999c298885522e6bd8a102cbeb891eeca
    +                a7d3a2402c0a00ab85f66f0267fbb707ea1052f1f926e4328bfc31cbbfab6689
    +                5f290ffb90970a62e506ef39513a7d3792c0c3f8d7cd285db8326c6b0d5d4323
    +                261ef9ccaefb1fa8e68b9de82345578729904ad9de4f2c5640fddef0c4f54ca2
    +                e12115befeecd8145be43d3ade502970e255cae2af3cc221569592056eb9f61f
    +                fe511566f235325bac531d8b25bcbf31429426d002f265a4971927246efe218e
                     00000006
    -                b326493313053ced3876db9d237148181b7173bc7d042cefb4dbe94d2e58cd21
    -                a769db4657a103279ba8ef3a629ca84ee836172a9c50e51f45581741cf808315
    -                0b491cb4ecbbabec128e7c81a46e62a67b57640a0a78be1cbf7dd9d419a10cd8
    -                686d16621a80816bfdb5bdc56211d72ca70b81f1117d129529a7570cf79cf52a
    -                7028a48538ecdd3b38d3d5d62d26246595c4fb73a525a5ed2c30524ebb1d8cc8
    -                2e0c19bc4977c6898ff95fd3d310b0bae71696cef93c6a552456bf96e9d075e3
    -                83bb7543c675842bafbfc7cdb88483b3276c29d4f0a341c2d406e40d4653b7e4
    -                d045851acf6a0a0ea9c710b805cced4635ee8c107362f0fc8d80c14d0ac49c51
    -                6703d26d14752f34c1c0d2c4247581c18c2cf4de48e9ce949be7c888e9caebe4
    -                a415e291fd107d21dc1f084b1158208249f28f4f7c7e931ba7b3bd0d824a4570
    +                c3aba396848a87900478ae558564722df671d145ad178dd9ef736fc5c353a8db
    +                82e4d9999c4c2e0fae928a66cd3aaf71678ff745d5726d65b0dd6a0ee5f85ca5
    +                cecd79ef77e4aa47d284a0bdb71662148029d8d891e2381bb7e6045efae1f641
    +                505c4b31a8d5acae51cbef029b047e52a5b495aabeae20ee94f8c56ae9b0ac6c
    +                2d01207d212698865cb0a47e73b6247e777118a617c4b49a558dd4f1d0886f19
    +                cc2344598bf5cd9039bf7879d37abc66aa3947caf939425adc599d3d1190747c
    +                dce7f61a12f92bd2c1ad95eda9a3b2af26c8ee652b9be2f36e1f80b2ef37bd23
    +                2a0d94cc605402848df45afd8ae36d729b25f00d1a09e8fbac6e323669227506
    +                d0b7b2bab0b320bf58e69a6879e67880c6818ce83f8630c91ab0e82a3f54ceeb
    +                1053a66d540d800956b248e951695e52c4290014c4fd7eee8c93393e593cf54c
                     00000005
                     00000004
    -                215f83b7ccb9acbcd08db97b0d04dc2ba1cd035833e0e90059603f26e07ad2aa
    -                d152338e7a5e5984bcd5f7bb4eba40b7
    +                0f5cf24b2d72360a58d71392202a49fbef628a53b11e3617bbc1723a879a89e4
    +                c64e0e5dea7faf8cac58d4e7fcd71774
                     00000004
                     00000004
    -                0eb1ed54a2460d512388cad533138d240534e97b1e82d33bd927d201dfc24ebb
    -                11b3649023696f85150b189e50c00e98850ac343a77b3638319c347d7310269d
    -                3b7714fa406b8c35b021d54d4fdada7b9ce5d4ba5b06719e72aaf58c5aae7aca
    -                057aa0e2e74e7dcfd17a0823429db62965b7d563c57b4cec942cc865e29c1dad
    -                83cac8b4d61aacc457f336e6a10b66323f5887bf3523dfcadee158503bfaa89d
    -                c6bf59daa82afd2b5ebb2a9ca6572a6067cee7c327e9039b3b6ea6a1edc7fdc3
    -                df927aade10c1c9f2d5ff446450d2a3998d0f9f6202b5e07c3f97d2458c69d3c
    -                8190643978d7a7f4d64e97e3f1c4a08a7c5bc03fd55682c017e2907eab07e5bb
    -                2f190143475a6043d5e6d5263471f4eecf6e2575fbc6ff37edfa249d6cda1a09
    -                f797fd5a3cd53a066700f45863f04b6c8a58cfd341241e002d0d2c0217472bf1
    -                8b636ae547c1771368d9f317835c9b0ef430b3df4034f6af00d0da44f4af7800
    -                bc7a5cf8a5abdb12dc718b559b74cab9090e33cc58a955300981c420c4da8ffd
    -                67df540890a062fe40dba8b2c1c548ced22473219c534911d48ccaabfb71bc71
    -                862f4a24ebd376d288fd4e6fb06ed8705787c5fedc813cd2697e5b1aac1ced45
    -                767b14ce88409eaebb601a93559aae893e143d1c395bc326da821d79a9ed41dc
    -                fbe549147f71c092f4f3ac522b5cc57290706650487bae9bb5671ecc9ccc2ce5
    -                1ead87ac01985268521222fb9057df7ed41810b5ef0d4f7cc67368c90f573b1a
    -                c2ce956c365ed38e893ce7b2fae15d3685a3df2fa3d4cc098fa57dd60d2c9754
    -                a8ade980ad0f93f6787075c3f680a2ba1936a8c61d1af52ab7e21f416be09d2a
    -                8d64c3d3d8582968c2839902229f85aee297e717c094c8df4a23bb5db658dd37
    -                7bf0f4ff3ffd8fba5e383a48574802ed545bbe7a6b4753533353d73706067640
    -                135a7ce517279cd683039747d218647c86e097b0daa2872d54b8f3e508598762
    -                9547b830d8118161b65079fe7bc59a99e9c3c7380e3e70b7138fe5d9be255150
    -                2b698d09ae193972f27d40f38dea264a0126e637d74ae4c92a6249fa103436d3
    -                eb0d4029ac712bfc7a5eacbdd7518d6d4fe903a5ae65527cd65bb0d4e9925ca2
    -                4fd7214dc617c150544e423f450c99ce51ac8005d33acd74f1bed3b17b7266a4
    -                a3bb86da7eba80b101e15cb79de9a207852cf91249ef480619ff2af8cabca831
    -                25d1faa94cbb0a03a906f683b3f47a97c871fd513e510a7a25f283b196075778
    -                496152a91c2bf9da76ebe089f4654877f2d586ae7149c406e663eadeb2b5c7e8
    -                2429b9e8cb4834c83464f079995332e4b3c8f5a72bb4b8c6f74b0d45dc6c1f79
    -                952c0b7420df525e37c15377b5f0984319c3993921e5ccd97e097592064530d3
    -                3de3afad5733cbe7703c5296263f77342efbf5a04755b0b3c997c4328463e84c
    -                aa2de3ffdcd297baaaacd7ae646e44b5c0f16044df38fabd296a47b3a838a913
    -                982fb2e370c078edb042c84db34ce36b46ccb76460a690cc86c302457dd1cde1
    -                97ec8075e82b393d542075134e2a17ee70a5e187075d03ae3c853cff60729ba4
    +                4849cdc5ce9923584e66bda4a1e96c856ead6a30672d94cab9ba1dcffe30843a
    +                646bd1ecba04f13bf7c6d7d8aabebfa8cb9a2190cd93d65d921ab7035cc81951
    +                d073609e5dedeb6ef7d00e2ed4c2680772077a9ce3f99ca74eb97f91339a81b1
    +                bb1c0dc10ad799ea594d4e7760463b4e441661c5f8e09ee9cc82c461dcfdf13d
    +                391db836b3d30fb42d33cabccb8ef9c81d054114e298a8100ac8ba9bcee4f518
    +                afd7bd2a158db134dd5ed299435ab7d2dc32db8b7fe35b24186e3c4b6114f7d0
    +                46ba7de17e65ce9e1c5618c308c650a828d1c0f786a3d6a69ebbf04e51449308
    +                868ecd7a5ce8f87f796396dc4837d08740376205249d8517a47c2ba816ab6c9c
    +                8bd8fd841ba4667ec53d353a661ea9e5ffa1769d981e4a31178e4f5ad3d99623
    +                d58c0ab2514b3c5306f3c83927f1b11a3784a384322780b100b44369f80b340f
    +                8212ad7f5092c44178a22a54110da8f8d3e8ac473aaa687587ea725806f44eaa
    +                c1e340bb7aa801b455914418c1cdd6b59007f4ac5e9d519f2158762e40957507
    +                3d6f30736f065bb74cd2c5d60b917cbad94af657ef37c1b92938c959e21d23f1
    +                6950c38c2f6eeede9b1675dcc4b4985bf892f3a2a0ac601bcde4acde5ccdf71f
    +                0a850d9813f92f7279482ae2697fed0722d456d8557ab5bb3fd49421f8d2e71f
    +                06769fcd695fc186ecb0236051b534bb6a6641d859fd013afa975c0bf889b900
    +                433581712b4b04c758fc121deea327817456f70135c3db767e16041f933186c4
    +                081fe52635b917bc809c2063d035e14fb512a452c8f443f2a66362ea6b08ddd1
    +                6d3a04065611cc962ccad06598fce7821837302ba00d57a83654130f582ce62c
    +                3266cae361d7db6f2b740ed7f90dca1ff4bf9ec4a0b7cbce226390bc2c38b3bf
    +                a27a40508139f985749420e6fc4ebafcf4799248661e1134e5442f1ef8714739
    +                1d589b45ecb61ac90ad6f82cb2bc3f006b62c40dcda5c362b5d4a8c56e42f672
    +                1b8598de29d5d6c1293b3751d48ccff5c5805a59a41c00a6758913c86861f2ad
    +                2400f93fec76e1062db46e4e21f70d7881b7c91bafb9cd34afbfb05ce072fb3d
    +                d4d9970ea49b57ed3ac73a2d75973f8d2a29de6e963d10bc62b695359d5807ed
    +                7ea0eb6908207698d08e96b619755872e840248550f053cc2597a65df404577d
    +                828c4604dc143cd42df691daae06a50502d7ad26d577478a00131fb4de24e780
    +                39b56b4fb1408a26fa72a9f5db80fe39e49e414a27d57ab3abef508628812bea
    +                6f61e9e182148ddd920efb7493d3b68a79c3946c8dec31fe6963e8c2dea92dd7
    +                9f789b20036b493bbdf605f45654498b93493181b71f261194f1faa6180f23ae
    +                6417720055d0b966a650e5f217bbfb1c711470fc9014874f8283d6efcabed894
    +                ec72f5887580f5fb9eb5e9be81a9e1f8ad650acd07069d499720815d052f4e11
    +                8d14be427742a206f275a1b6570f684feb8c4cd62cbc89d0a93de601a7f0ff40
    +                4125b7d29c1820d0b26490efde697f1699f4490a8b5db33a07af8df86da46817
    +                2ebb99d63c45a3786d2be23395d5761f1c59ee591e5ecf35ba5cf2b5d39e8615
                     00000005
    -                4de1f6965bdabc676c5a4dc7c35f97f82cb0e31c68d04f1dad96314ff09e6b3d
    -                e96aeee300d1f68bf1bca9fc58e4032336cd819aaf578744e50d1357a0e42867
    -                04d341aa0a337b19fe4bc43c2e79964d4f351089f2e0e41c7c43ae0d49e7f404
    -                b0f75be80ea3af098c9752420a8ac0ea2bbb1f4eeba05238aef0d8ce63f0c6e5
    -                e4041d95398a6f7f3e0ee97cc1591849d4ed236338b147abde9f51ef9fd4e1c1
    -                """);
    -        }
    -    }
    -
    -    // LMSigParameters.lms_sha256_m32_h15, LMOtsParameters.sha256_n32_w8);
    -    @State(Scope.Benchmark)
    -    public static class test03 {
    -        byte[] pk;
    -        byte[] msg;
    -        byte[] sig;
    -
    -        @Param({"       h15_w8"})
    -        private String test;
    -
    -        @Setup
    -        public void setup() throws Exception {
    -            pk = decode("""
    -                00000001
    -                00000007
    -                00000004
    -                0dc6e2060bd57f6893d7934b26515ce751360f93dd74a648fa015aa79c862407
    -                5ae5daea402617abb48a1f6b9e2c9f28""");
    -            msg = decode("""
    -                466f75722073636f726520616e6420736576656e2079656172732061676f206f
    -                757220666174686572732062726f7567687420666f727468206f6e2074686973
    -                20636f6e74696e656e742061206e6577206e6174696f6e2c20636f6e63656976
    -                656420696e206c6962657274792c20616e642064656469636174656420746f20
    -                7468652070726f706f736974696f6e207468617420616c6c206d656e20617265
    -                206372656174656420657175616c2e204e6f772077652061726520656e676167
    -                656420696e206120677265617420636976696c207761722c2074657374696e67
    -                20776865746865722074686174206e6174696f6e2c206f7220616e79206e6174
    -                696f6e20736f20636f6e63656976656420616e6420736f206465646963617465
    -                642c2063616e206c6f6e6720656e647572652e20576520617265206d6574206f
    -                6e206120677265617420626174746c656669656c64206f662074686174207761
    -                722e205765206861766520636f6d6520746f206465646963617465206120706f
    -                7274696f6e206f662074686174206669656c6420617320612066696e616c2072
    -                657374696e6720706c61636520666f722074686f73652077686f206865726520
    -                67617665207468656972206c6976657320746861742074686174206e6174696f
    -                6e206d69676874206c6976652e20497420697320616c746f6765746865722066
    -                697474696e6720616e642070726f70657220746861742077652073686f756c64
    -                20646f20746869732e2042757420696e2061206c61726765722073656e736520
    -                77652063616e6e6f742064656469636174652c2077652063616e6e6f7420636f
    -                6e736563726174652c2077652063616e6e6f742068616c6c6f77207468697320
    -                67726f756e642e20546865206272617665206d656e2c206c6976696e6720616e
    -                6420646561642c2077686f207374727567676c65642068657265206861766520
    -                636f6e73656372617465642069742c206661722061626f7665206f757220706f
    -                6f7220706f77657220746f20616464206f7220646574726163742e2054686520
    -                776f726c642077696c6c206c6974746c65206e6f74652c206e6f72206c6f6e67
    -                2072656d656d6265722c20776861742077652073617920686572652c20627574
    -                2069742063616e206e6576657220666f72676574207768617420746865792064
    -                696420686572652e20497420697320666f7220757320746865206c6976696e67
    -                2c207261746865722c20746f2062652064656469636174656420686572652074
    -                6f2074686520756e66696e697368656420776f726b2077686963682074686579
    -                2077686f20666f75676874206865726520686176652074687573206661722073
    -                6f206e6f626c7920616476616e6365642e204974206973207261746865720a0a
    -                """);
    -            sig = decode("""
    -                00000000
    -                00000000
    -                00000004
    -                96755d5f8af0aa32419be743afe779842db52a82387fedd67881aec7172db8c0
    -                70734189eadc76de06e2fc999e8ce42e7ba68c942515b4547abc8c6659a42fd1
    -                371b03ef9ddafdf755b4ea374bfd00b259baef59fd87fd23b1ca5c254ae54fdc
    -                65eec03046b0ca68e8168f82c2e7d28f456ab4f3c69c67ff550cbabdf0f25437
    -                c890347db9d87e0fd243a0341bd6d6cde5190d3c3e7a249bfb757228fe6353f7
    -                69ce313fdaaee88c0416622625f3b6206c2302633e81c23f81de067393a3e3c8
    -                537d3b6b800e7ccea2d90787fb8b7c73cbdf1e778044786ad3b47cab75f9238d
    -                4ef8913fd5ad1e9f762200a649c3e42915f66210c6674a9c0f5a1dc780607b36
    -                c20ea9e299b2dffa4cd144d0715d18cc7130736ebaa67db1c69336ac3c4295a9
    -                94c725bb75a5638a569399f4905f39ccf87999e053fb08ac6e3c04dbbb9c9196
    -                121306e02152603817a574f15dcf010ae68401367024a62ecc4c0dc68bbc76df
    -                c604978101c1ebe4f5fbd8b0bd14aded6740c60b3cb18f8d166c4857940ae8b9
    -                25b707b56637499984f24194cdb2aa66b1bb80a679a8a40bba732ef19b80c301
    -                91bde4b32c6ec0267d81dc86a07ab30afb24b422e99285faae17e8679cf3a6c3
    -                c1682a1d91afb678700fa40fabf03e8b795bd06c4b0b2f8f124ee6790f5aa410
    -                5b8eb7b845efddad84488ebaae01ba7f28e9c670bdf4a142305f3376d13c1a55
    -                cb3e8618e05c11bcf244ae51b825d221e372f45b9c0f512a8ebbeea9a01f213b
    -                75f69f8090f50c11f13ab092c947ded0689803c834c2bbc8b80310be3ad15972
    -                b745678270a0a670806ff1dfb00c65bf661356634bd9466946d79e7e59d4bb63
    -                008f22127172f54c7c15531003a7d31dd949ba15a401b6e8b574f462ee296fba
    -                00e523fe2c54b4b763eb18028d49f5fe60fa88c7c26188710a2ef040c2641c1f
    -                0499a41352ce2c397bee4fa7ffc84a4834419bc571bcfa9ecf17e5e30e14042d
    -                424d0651e85b826e8bf592285e83d01b8b67eff87caaca112fd67a1ed4d5ae7e
    -                2a587d4390c8fd1ef366ff80b83ab02973bcce0be3352656c7e07dfed0df04df
    -                f886adda121035831bf24c31a47157fa19f1e29a7c329a8c0647365886d7914c
    -                969f5477211713dcfe40883c9e00037b200190aa8bd6441e2e9caf895b9ad8d9
    -                52dc7e2ccaaa1d5181b1554c90da50f53bbc993e9a04caed8aff848b72470d1c
    -                7deb858d9baf393f63d8f85cf570161d74a12c93de618d0b1112d5c73164358e
    -                92ce5e4d344b0c9a20e045b47f7ba00567b49cade32612222a5178e5868d88a3
    -                3ec703145ba626a497a716db4ef391cd6c4061dbb904bcbf6ce0e9010893d15b
    -                991b3b0b1d48e2973a19bd94ce2de05577e3db8961dd40c2107ad39aca37e101
    -                66a1788260c7cd125e615b0f19493923a17c0bdba2c982a6ab29fc28689e2b55
    -                c6460afe1e49332835228ea102e9bebf60fe64e44dc1643eaf49c569331e8ca3
    -                d4c7a8206d4b088d786aa514322d9030266fd52d5b92170a112c36b86117f8e7
    -                37520d176ee71b88a13e22b74afb78915c8516bc2967b46b350c6cb5462cd3fe
    -                00000007
    -                7547b8dd925185bf123233ebd5d6efb5b84c25f193ccc96f3cf5746053054d09
    -                274b10a2e41c5b137cc6e3008f6fbe13a32b41ba0ca3d5b95d2ca2af3a7791b4
    -                e4e80d0a837cc7ca2660105679d28c7230bacf244b74e89c9d1a00ec30a96d12
    -                5ff86a045d8d1ce2cad8df211cea8053336b35a4ce75ea9b6a3693c906486a2e
    -                f978e4bc95d39450ae4c44b5204a0f463061cecf2f4b5a3182b40305b57d9bf9
    -                130d38397d257fae6eed3ccf5ed8739738f948aa1e99ada7da70e2f4cb090758
    -                21323fd7b9934344bb47a53196150b88c4e016363132e798a5949a2b52e7194b
    -                d4babc9dc13749f7e69ed462f42de21e03186b6e13aa496b73784d071f8f8292
    -                63b37b71c24b1316bfe5dc48d19cfb4a3dfab112311cbedb59de0fc6d139676c
    -                b5cca0ed495ce2251895447f4983d8147999a9e8a3fbae038e0d3c941b81bdc9
    -                6a80dc3b8569237837940d148150c400d2a93ffe7f2b62aee591498b6c659cb3
    -                1da85478899ad1bfce0803419a4b5bfcfb0ffc27481c351dc594af1146d1ba70
    -                127968e379d34fa22c03a1ca9f2cd8d2f255e9ee2058a6b018cc464d758d633f
    -                f4197291b1ad4257f8f76e1633c19f77fc361767a7a3804d5607931d975d3b19
    -                5182fd0867719ce10daf0f0c0d52b16b8088ca9a26a22aa05224a1765fc82961
    -                """);
    -        }
    -    }
    -
    -    // LMSigParameters.lms_sha256_m32_h20, LMOtsParameters.sha256_n32_w8);
    -    @State(Scope.Benchmark)
    -    public static class test04 {
    -        byte[] pk;
    -        byte[] msg;
    -        byte[] sig;
    -
    -        @Param({"       h20_w8"})
    -        private String test;
    -
    -        @Setup
    -        public void setup() throws Exception {
    -            pk = decode("""
    -                00000001
    -                00000008
    -                00000004
    -                c8568f619f0d5429eab1e63c80e058d1b8a326640a6ab457d776c52eec545dd9
    -                7fedc7e225ab0cce270d961ff9b1615b""");
    -            msg = decode("""
    -                466f75722073636f726520616e6420736576656e2079656172732061676f206f
    -                757220666174686572732062726f7567687420666f727468206f6e2074686973
    -                20636f6e74696e656e742061206e6577206e6174696f6e2c20636f6e63656976
    -                656420696e206c6962657274792c20616e642064656469636174656420746f20
    -                7468652070726f706f736974696f6e207468617420616c6c206d656e20617265
    -                206372656174656420657175616c2e204e6f772077652061726520656e676167
    -                656420696e206120677265617420636976696c207761722c2074657374696e67
    -                20776865746865722074686174206e6174696f6e2c206f7220616e79206e6174
    -                696f6e20736f20636f6e63656976656420616e6420736f206465646963617465
    -                642c2063616e206c6f6e6720656e647572652e20576520617265206d6574206f
    -                6e206120677265617420626174746c656669656c64206f662074686174207761
    -                722e205765206861766520636f6d6520746f206465646963617465206120706f
    -                7274696f6e206f662074686174206669656c6420617320612066696e616c2072
    -                657374696e6720706c61636520666f722074686f73652077686f206865726520
    -                67617665207468656972206c6976657320746861742074686174206e6174696f
    -                6e206d69676874206c6976652e20497420697320616c746f6765746865722066
    -                697474696e6720616e642070726f70657220746861742077652073686f756c64
    -                20646f20746869732e2042757420696e2061206c61726765722073656e736520
    -                77652063616e6e6f742064656469636174652c2077652063616e6e6f7420636f
    -                6e736563726174652c2077652063616e6e6f742068616c6c6f77207468697320
    -                67726f756e642e20546865206272617665206d656e2c206c6976696e6720616e
    -                6420646561642c2077686f207374727567676c65642068657265206861766520
    -                636f6e73656372617465642069742c206661722061626f7665206f757220706f
    -                6f7220706f77657220746f20616464206f7220646574726163742e2054686520
    -                776f726c642077696c6c206c6974746c65206e6f74652c206e6f72206c6f6e67
    -                2072656d656d6265722c20776861742077652073617920686572652c20627574
    -                2069742063616e206e6576657220666f72676574207768617420746865792064
    -                696420686572652e20497420697320666f7220757320746865206c6976696e67
    -                2c207261746865722c20746f2062652064656469636174656420686572652074
    -                6f2074686520756e66696e697368656420776f726b2077686963682074686579
    -                2077686f20666f75676874206865726520686176652074687573206661722073
    -                6f206e6f626c7920616476616e6365642e204974206973207261746865720a0a
    -                """);
    -            sig = decode("""
    -                00000000
    -                00000000
    -                00000004
    -                c89e20317ae8d2211c381fe7354bf382a750e37c307588a30d1bb9a5868e0fbf
    -                414378b30f8c59ccb95a603f03679a417c01bcb191677d629c37a396ffe313c7
    -                f27f1553e993102d1b311b92fd7669c2d1ada6cc808c11477c86fa928196028d
    -                3855d6a39fb56a73ac8eb812fa1974778ab1a7838eda03e4b7ff32d8faad4574
    -                1ede66888334c584ae4086d6a5446772c3f18041126e1972d5acb593261a0a5f
    -                2685e71bb75fae408c4d8dc359bd723d97b5180d96d57a9edbaa7a74f2ef4aa7
    -                316bf4b8232bb32b32bfd3e6c4b7e1356d5822fb90b8c861e8ef9a1f7cd67b32
    -                2b632c2565a6ac6e3635568f1c2cda59cf4ea6a83ec622f81dda9db0b91fff87
    -                080fc8b29ee5514cb25c943a714bd298ea0bba527decdd546c76151b0a9b6c60
    -                ef9de9b8aabc3c979f08fa1a613682eec4c564e5c0d87e932bc618b6009ad575
    -                59489d25a58a4338a03c9ed4c8a89eeea418d5b4a7f813eaf163e2530a40ee84
    -                9b8893f91a2f5aeab8ddd32ad8bbb8e0ffac69d0f1b5333d5211d11f32cb89a9
    -                9f7f346aa5f3c68447e831dfbce57a0a90ac32cb59066f1e5a0c7eb6bb5ef4d2
    -                e941f0a8ffe6e8e944cecdb7124a866e4282ecd848bf53f94f0323828a2250f8
    -                9a59dbc5a0dd02fc90fc433219ce64e982d86c5ddf3bc8bff3ac7f2c6e5dbab1
    -                50a2f4371ebab285f70e25fb0f64667c5805381ff1031321e6f8cb1c85250393
    -                5db51e0032f2da99c0bcc22cafe3abd1d7fddf676713a7fcf2388ed13d60a8a1
    -                ccfb996d9d0accf2be789b949f8cb8ee895f870c4b0c4280a99713abfa29377b
    -                b22a6cfa5f3e0bfd7b6b65c395ac40f8e88980fce0c4ea54b55271a6b3a78a15
    -                957cee33a498d237cb0b6457e7b539591b4c3c01b3ed1e75308cb2d85b1a5d46
    -                40086d1f3c01a244516beb5409175179cc112c16bef7041c92be7e25843703b3
    -                c9fdbb1e9e2d880f9e2c54b8cec53bff94d15406cdac5793dad36af28abf8f16
    -                d95606410d7a8b2af01ddea64572d77609bc9b1f26e0f61ed6115709edaefe5e
    -                c3c44e62d93ffb3dd868f799de31fdd82a5ddbf9126a5271fb368624ecfcba8e
    -                859e9d644063e2d016f3bd6984495bb67a92295a7ba6958d09fb3fa5415cdfbb
    -                c25605e991a5a6d914199f50842357226438c5d757cf1d0bbffdabd32cdb1559
    -                3167d8e672bf1653c2c7466ab7a84e4b587e62be7fe73270cda64513e39966ae
    -                71108c4d187175ae14d9d36dfe6754770febe70c88515b108a20e4fddc240531
    -                3a47377388104fb2597ab1c6ba6aeaf96bf9fa3ef7aa8fc61fdb46fb4c99d401
    -                3ec90362b3b2df6b9be155ffd520f696950ac931d1d32c1fae4d0da0ef76065c
    -                5070edf2043fc9b03ec3c250594f92b8f80862182501a4cb2637d79d347cc2cd
    -                966a3d20415bc34a870d0e9479da62a820f7973e8737a3d1f1cb04507d70981c
    -                5f30c0319443ba0a03cab8c8460306b5a66dd1efe29956995ab4488ee20ceb83
    -                c0891c84eb01761ed74d514d483a51e11a938e89e1f1e6b4a23ebc71150b9381
    -                c01faf71b0ab4f2842f342b80d6bb58bb410091e314127d1c33520e5f38f02f1
    -                00000008
    -                44feef16ea19cce8296b02d3955c58a873f2adb5672f5408d2a1c404c0a955a0
    -                45f483df1000b0cd4dbf5c7918b5259866135714df5fe538b26c10d19b29c5bd
    -                3e6d7f04bf4544385f9fac1e216e371888f866ac840a83518f940f1d0c77487c
    -                eca40d5fec7174006e7255ccd1a85fbd745c0d17797e0425edf97a92b8eb3b79
    -                e524988e3aaaeff9ae4762289737a39acf87e381b5cbe4fc2a0ec29bb3fb5dfd
    -                77c4ae959b46e038e7150c7bb26613125728dbfaf900aa6696c6f2ce0f590c30
    -                14d6b61f70897b732564baa09674b12ff2412eae3378a15ca8ab7d79af7372b3
    -                3dad3878699eda11cc5265d591a2b00a5d948c38fb4e9c4bfa2f34328d590c19
    -                26396c9db7355037bb9e7fa0918e9d2467d358898bad77ed3fdd2cb6f0d14f92
    -                67ba57212ea080200635419bec21ac4163aa41209865b212c5f4b000968e2837
    -                f55c5dc8389f44824427b4e6cda1917e73f7fab883717a0304373e95a7118909
    -                aa1e7854e2546c766823e2f2f4a52f001763692bdb45675ee65101f10007fdef
    -                b5205b6f2d74c42396a7de0a55ff47855e50cea65f46549f845ff855ca6bceee
    -                450eb11b7932b6465736893ca654e1faf280ec2da99dad0b833f5c4e7d805af1
    -                0e95359ba4e23b2640e2768075815adb2298fb5d1dd3552b0e868c2b69a92da3
    -                8b83713af275e933354c5a02438480004d26d0667c3d31236f2e42e594b3108a
    -                2631d63f6b0d6abfa0cc338294019b38bed8da4b49b0ff1a64871ff648687c5c
    -                97b863b78eb60844af1e94d6d3ffbaeead48a974e65fff24776553b3dca6c7b3
    -                072a39cfd09a8bf9c7591c605659c1b103288486475f54be0fb80c18717a944f
    -                51b6d317fba486e1e0ab5afea205335836e717a185827ea4cd47d557be53cc4e
    -                """);
    -        }
    -    }
    -
    -    // LMSigParameters.lms_sha256_m32_h15, LMOtsParameters.sha256_n32_w4);
    -    @State(Scope.Benchmark)
    -    public static class test05 {
    -        byte[] pk;
    -        byte[] msg;
    -        byte[] sig;
    -
    -        @Param({"       h15_w4"})
    -        private String test;
    -
    -        @Setup
    -        public void setup() throws Exception {
    -            pk = decode("""
    -                00000001
    -                00000007
    -                00000003
    -                7bce4db5bd53cb23819d0fa2181e4d441453ff821284c9d83b8ddace22581469
    -                593d6dd0aa2c99feddc84f8242f6a002""");
    -            msg = decode("""
    -                466f75722073636f726520616e6420736576656e2079656172732061676f206f
    -                757220666174686572732062726f7567687420666f727468206f6e2074686973
    -                20636f6e74696e656e742061206e6577206e6174696f6e2c20636f6e63656976
    -                656420696e206c6962657274792c20616e642064656469636174656420746f20
    -                7468652070726f706f736974696f6e207468617420616c6c206d656e20617265
    -                206372656174656420657175616c2e204e6f772077652061726520656e676167
    -                656420696e206120677265617420636976696c207761722c2074657374696e67
    -                20776865746865722074686174206e6174696f6e2c206f7220616e79206e6174
    -                696f6e20736f20636f6e63656976656420616e6420736f206465646963617465
    -                642c2063616e206c6f6e6720656e647572652e20576520617265206d6574206f
    -                6e206120677265617420626174746c656669656c64206f662074686174207761
    -                722e205765206861766520636f6d6520746f206465646963617465206120706f
    -                7274696f6e206f662074686174206669656c6420617320612066696e616c2072
    -                657374696e6720706c61636520666f722074686f73652077686f206865726520
    -                67617665207468656972206c6976657320746861742074686174206e6174696f
    -                6e206d69676874206c6976652e20497420697320616c746f6765746865722066
    -                697474696e6720616e642070726f70657220746861742077652073686f756c64
    -                20646f20746869732e2042757420696e2061206c61726765722073656e736520
    -                77652063616e6e6f742064656469636174652c2077652063616e6e6f7420636f
    -                6e736563726174652c2077652063616e6e6f742068616c6c6f77207468697320
    -                67726f756e642e20546865206272617665206d656e2c206c6976696e6720616e
    -                6420646561642c2077686f207374727567676c65642068657265206861766520
    -                636f6e73656372617465642069742c206661722061626f7665206f757220706f
    -                6f7220706f77657220746f20616464206f7220646574726163742e2054686520
    -                776f726c642077696c6c206c6974746c65206e6f74652c206e6f72206c6f6e67
    -                2072656d656d6265722c20776861742077652073617920686572652c20627574
    -                2069742063616e206e6576657220666f72676574207768617420746865792064
    -                696420686572652e20497420697320666f7220757320746865206c6976696e67
    -                2c207261746865722c20746f2062652064656469636174656420686572652074
    -                6f2074686520756e66696e697368656420776f726b2077686963682074686579
    -                2077686f20666f75676874206865726520686176652074687573206661722073
    -                6f206e6f626c7920616476616e6365642e204974206973207261746865720a0a
    -                """);
    -            sig = decode("""
    -                00000000
    -                00000000
    -                00000003
    -                92f6ada5a00376437675ae462a5c40d4b1123d97352fdeb3f0b6dd741a3e4db7
    -                60ec956306dc6f2900f5e70e427265deab2d979ebef270cb61fac22a6b6ddc78
    -                ec265af6ef86c9513f3de135f674948c08e5cda0cb953fc6846e2720eb669fd6
    -                2d7e1fd5de25ea3491a4d018782cd929f8df2684ed20c2f71950ac606e86a475
    -                4f60cfca6810ff34233425f932bef13cbb334981f71d54ea71de3510ee52fd31
    -                85cb24191f426bdec8c10caa831e74498ee52dece68f886e9b157b68f2f521b2
    -                17e5907d824bca542126b9d79c70ed4cb1431146025e42ecf8f12b970f109f79
    -                f74e4af4511d966b032976f93ae8118cb4cd3924e92bfe5f508101b0abdc53d2
    -                6f5c1720448e2efa4b97aea98e2069eb4495e2c093601fe70193ed469162e976
    -                4ca3cf64866c59189a488a9e7a510149e0e9b92b0fadcabf22140841946997c4
    -                51410e4954faed09bc3e3e5dfdcfd598e5e70966356718230db6ea8bdf22256d
    -                fb337383d342212b6fbe4be731aef548e86e628fb372971e20d878d3f003b06c
    -                b363799967396381c34252b306a67cfd469710aa9664222dc22fe41008919439
    -                9394d75ffaeeac3b621b0643de2e98f723a761ff6e695f673c3d70918247ef5c
    -                39f222ddedaccc63b6da7ebdfef33a1aba8df3e2444610f6c7b72ba15352f783
    -                b1cac31841e58f6f22a78e2f8521379e226c6890fe41682f2c2a74a44f619f05
    -                84a343deff837d809e41e82cc6ca0b568eb4dfaf5df71de6ad488a3733d07db9
    -                a1d4137cb10244167dada62b3300e5329f886bcf2d35568f39ec759ca82687d9
    -                37fc2b6c7b22d0016f856d9ab353503399bd525298a460b5e5b748942affbe5d
    -                5f562145c6018f53175bfb1c145e512baad481193889f487eb6a007ab3fe7d0f
    -                3e7298c3519fb6d6f6f1c493f5e18bf64e5d421ad60b5c01b599aac05355e674
    -                1966c4d95f3fe002fb936c948121db57a921baef1d9aca2aa918641705a7618f
    -                59df64211e2a0043088af6e970e6e87997a7f9b1fc85513dba92dc8d1f990ada
    -                a8694c4b408341d2e1e01e07ff329486d322ee9b5fa7c3498558c503358f29ed
    -                7abf96c1928b3d21f5262517800587d01517a3ec8fbced7d3f0f7523e6544d7e
    -                2cc5afb15b709fac35301940ca8cf4ef09abe8d1b175cdaa84caba9dad175890
    -                ed9f51d762881e16cec7fed78fe9324bea6b372c09e1ec8078c73192e6869830
    -                5f16d35fdbe5ce305473399014e15c1011329723df62e3f39d28b9e9576e16a2
    -                1199b8eb076017b0500ec5da3e33789a48f6115856a586923f23f167912a307e
    -                19cc96697a4c3198211e95defbc541b797718b0a59bd330a069a3eadd2c285e6
    -                275dfce172e1a109614f0a23ca45fe29dbdf943710176ac138ca10e8a09d87f0
    -                b59ecc4073fa253e0b6707557d075175a167bd0390e089b300d3106c21e83aa0
    -                0ab384f9b301da07eba951294252a421e373def9205711db8326e1558bbd7a79
    -                3665e5663ecc7a552223edabcc6333f07095f274d3e3aa8ec114b8e124aaac0a
    -                4e99113d1950ddf46edf9ea8c8af0d9fd72146885e381a9d899b84d404906db5
    -                6f7f3c209be9da130b0011de9916f7d63c3172637ad83e9a9566d7938559fae3
    -                ac94602daef9f18a8d908e55dc962c48aeaa49c29b4fdb2a3ab38802f650225b
    -                8e6b3d25d3590ed13c3d22e3f1253d385fb02b1feee7770b0f5eb66df2558d5f
    -                3fa6a247e297e96b8f8263648f5f469c8e5313fb929c801e61a16ebe10286010
    -                2c2e9e1a759b7b1f4b2586f3e916970479a0d836c5465c1345314d3dacbe5ee1
    -                074d3a15e4bcf37051d9b1ad76ffbf5bc2826c2311e53caa05d22a7d0315f096
    -                51be069f7903a00b3a1b38a632b00b2e26d3946d151c6a7413cdd7a12593ee70
    -                6307d8dc0d822da33b7e335bc674d287f944fcfbb12af664ef889c9bf9e1175e
    -                f4aa47736532b9a79c489e0130fb2f49456f189cdda60e480ff0cc8435537374
    -                e7619db6a06a6e2eabbbf861483003673f5998dd31c722a6c7d17c7e43d94acf
    -                311e726e12c51805db6837392abcd880b2c5ad035b04bfca7b16ba9b82212c7d
    -                6920b91da7c1e6eaca690756d9b0d403c67ab0f258067f1ae537ad794bb2f2ac
    -                f1132d35e83bc8de5d542f100ea092c33499c5577617dd56399448c6e0719751
    -                f322e16abf3e792ed0014b49354e697f3d4d78b19431d92cbc97aa12bb9f339f
    -                d4be05c666b3215e8450f4f27e5a1a705eaea74c312bfa7d76d4ab39d957fb33
    -                1badfe1cda019460c5011897430e14ad9e8101a5b25fd3de752f47e97452f8d3
    -                2170946b4c905f613953b6a7ea03b96d67b9bee3651bdf1a33f63d2d8bce2867
    -                2e90ef39a066557e991c78201353aeaa47094542581506a5ab258f8cc7757738
    -                9f3d8fc5c19f91b5e7ec60e88bd8c6665b649ac696341229cc1b2cc2224c5da2
    -                7f2c57a53f5824aad8198d9cdefd13753ce10f8cc14f1b764b19d247e6872fd1
    -                99624aaf8a3def3cbb72ae940868870cfb29edc1354532df028dd61414a107ea
    -                83e5a86aad58f52306ada8c12e6817a870696cbec7f5d4ac6a8c5cf63a0494b5
    -                b51617e04794cdd195a1dbaf105175d0219b97fb15efcd172cb3084dff951a69
    -                0b2a0490f8641f245b03a67e4cd75783a8a668483789a3386899d888806633d7
    -                023ce6b77ee7b4c011be72d52eba18cc5f87fc702c9bbcad61e829c78b8faa6c
    -                c6882cfa49bc6ce98f8975bcd88c5c3213c422f20294b4bf960c79911744e18a
    -                1e54b91c78ab7de3f2f5bc69b20a68d7c76f9b0ac029355c523db8348e9bd854
    -                5bc86e1005eb48819993dc2eb96712a71528cfcd69b38c44f668b2ae1e74d985
    -                2303619ef5f54d927d41db399f7273a8d42c85fac74705880b50aee227dab2f4
    -                a2c96d9d6a0cd66ba0c062796c085b0d351b203421f0c1b4ef61330faa31c5ce
    -                f1e91688a35b7c5feb455d467c275049ec330af627d90ac89c7696d9ba06a402
    -                69c347eb6e9114d0f95f0b7a0e3058282988cb2c2cf33ac135d3b108670b8ca0
    -                90e8a770cc1b522fcfd3a777e6efb2e658743a9e65f8dcf218828556626d87f4
    -                00000007
    -                8f421eba67cfd61a355895a87fae815f4531f5ad25dd1832a672321836cbf772
    -                77099b27748d0dcbd08bbd4dd5bc67ff64d630c41bebbd7bf1072910745fcb42
    -                867b9b5e07a6614df38dda0a0f4c89b393b27f42e0a850852a75e9f178e0ee70
    -                f490bdb5266af9db46a2ec1e0fcc6ccb609808cf460048df6a5e8c8fa864ecd8
    -                c87266261ad5e79c874731e2c00a9efc9649895f30ff4a46cc860ebdbeba90fd
    -                c47cdd5e8bb67584f2758b25b032e1462caca6e1f026ecd855856765ebe87f04
    -                4e749f257bb5defbfb826cbfc5de07baffa680e520ff8663b523f151bfb772c2
    -                a6297ab5a9977fb15367eb960050d4c23e42bfc89ac812c1e6cd9ec37668e37c
    -                1a594e0ce90de5cab6341b1e77ea447521645632912a0682fc60de7f7831d0ae
    -                72604756a4416573c0cf6a52e0868b857b76b1faa5bb7e3607a339dd32f33263
    -                4b210e0e31da922ac6870ace1a068f3418588071996ff816b95a1a478488f82f
    -                b54e27fd3f7037360b20e1b3e8674325253ffff578dbf8108927a966cf4163b0
    -                40aa99d98df801f0e241c1607d9e8484c9755f6bbe299a6efe96ec0836e9d53c
    -                213db6d352863854781c78c4cac3083210f979d3f7884aca69fa83429c1542a5
    -                51b8e95ffad4f89b506bd31ba613fe66a375434114dfbdf11741a8d86a239ded
    -                """);
    -        }
    -    }
    -
    -    // LMSigParameters.lms_sha256_m32_h20, LMOtsParameters.sha256_n32_w4);
    -    @State(Scope.Benchmark)
    -    public static class test06 {
    -        byte[] pk;
    -        byte[] msg;
    -        byte[] sig;
    -
    -        @Param({"       h20_w4"})
    -        private String test;
    -
    -        @Setup
    -        public void setup() throws Exception {
    -            pk = decode("""
    -                00000001
    -                00000008
    -                00000003
    -                fe732f6abc16f3b1c0d1b78d9e72fbe118904abe9b33f2e03d0728ff4cf15b3c
    -                ebea5149fe955d36f911e528d2aaff42""");
    -            msg = decode("""
    -                466f75722073636f726520616e6420736576656e2079656172732061676f206f
    -                757220666174686572732062726f7567687420666f727468206f6e2074686973
    -                20636f6e74696e656e742061206e6577206e6174696f6e2c20636f6e63656976
    -                656420696e206c6962657274792c20616e642064656469636174656420746f20
    -                7468652070726f706f736974696f6e207468617420616c6c206d656e20617265
    -                206372656174656420657175616c2e204e6f772077652061726520656e676167
    -                656420696e206120677265617420636976696c207761722c2074657374696e67
    -                20776865746865722074686174206e6174696f6e2c206f7220616e79206e6174
    -                696f6e20736f20636f6e63656976656420616e6420736f206465646963617465
    -                642c2063616e206c6f6e6720656e647572652e20576520617265206d6574206f
    -                6e206120677265617420626174746c656669656c64206f662074686174207761
    -                722e205765206861766520636f6d6520746f206465646963617465206120706f
    -                7274696f6e206f662074686174206669656c6420617320612066696e616c2072
    -                657374696e6720706c61636520666f722074686f73652077686f206865726520
    -                67617665207468656972206c6976657320746861742074686174206e6174696f
    -                6e206d69676874206c6976652e20497420697320616c746f6765746865722066
    -                697474696e6720616e642070726f70657220746861742077652073686f756c64
    -                20646f20746869732e2042757420696e2061206c61726765722073656e736520
    -                77652063616e6e6f742064656469636174652c2077652063616e6e6f7420636f
    -                6e736563726174652c2077652063616e6e6f742068616c6c6f77207468697320
    -                67726f756e642e20546865206272617665206d656e2c206c6976696e6720616e
    -                6420646561642c2077686f207374727567676c65642068657265206861766520
    -                636f6e73656372617465642069742c206661722061626f7665206f757220706f
    -                6f7220706f77657220746f20616464206f7220646574726163742e2054686520
    -                776f726c642077696c6c206c6974746c65206e6f74652c206e6f72206c6f6e67
    -                2072656d656d6265722c20776861742077652073617920686572652c20627574
    -                2069742063616e206e6576657220666f72676574207768617420746865792064
    -                696420686572652e20497420697320666f7220757320746865206c6976696e67
    -                2c207261746865722c20746f2062652064656469636174656420686572652074
    -                6f2074686520756e66696e697368656420776f726b2077686963682074686579
    -                2077686f20666f75676874206865726520686176652074687573206661722073
    -                6f206e6f626c7920616476616e6365642e204974206973207261746865720a0a
    -                """);
    -            sig = decode("""
    -                00000000
    -                00000000
    -                00000003
    -                4da59d6dc70132d671114d7e3fafb184a898a603a60119dcb55148775618754f
    -                e4d35a9594db68ab5003f967e968b97101307219d000d16dbc58bcc2285ddb23
    -                dd983189c34e7defa68a7682e26c50668bb20c6d1340fbb127d1d5b805454a66
    -                d2a7f43d2a579568bea4187ae180cd1038d80655454c5dcb9700821d55db70f3
    -                aea2d5f8e1b1b99cfaa86b253e13a72af3389d33bd51329171d666c260b71a66
    -                7f1f7e4256906c0247ac361fd2cb11ab9f3d8d042bab28fd5df69f14a54f88f3
    -                4339c81c02a0a9256292566ed753d2f4312d4103bf25f7b310a86f96301143f2
    -                47c2291674797bd1088920eb5bdc049b8f9809c3c6d96ebfe49084d1021aadef
    -                ec3ece50b4b42e4af022038c6b5363c2dc24522a2e641e352363d9149d68cac3
    -                5bc3d973071e6b7aed2f4f96ca91aa22e162ab985baec0e56df59d3e8b37fe89
    -                59c00aeab5f3713093105cf7db782fa45ea8ee2ec8feb56c529e6b42f18043f9
    -                79d8c4c9d56a4255ec9747d31cc62a7bf70cd8777ffb75ee43dbb2c394e36525
    -                71ce27770f6ea480e89f05ba3cdc633cc3ed269eb2ca0131268fc0579d738334
    -                504b477e8fc2264c421e2e551b1a93713281858ba2cb588a2adcce4d11c2700e
    -                31d7ce6936b267ebe96b4f9bbc4763cccb4f245d371177c258c6d23c30bc5dca
    -                0f6d8fd8194b683f2ac4e0f3ddb7ba1cee1c47e5eec239f5a6b661aaafd2960a
    -                5d1b3305e53d9bbf8f6413368b7656723bcd47e7ab18b41d7e29b511767ba267
    -                e662ee59a004264ec2f88b8ab6fc778315ebc2a08144503455b8b2c1bb410eec
    -                b767ee1eb779f9f2bca35184fa4ff7d8d36a41a9ed3a76fec7fd9a68f8bd35ec
    -                2dd1aa14e7ed9c41db03de868b266f8cfac7fcc887c78e1aa3e085cf0883eddb
    -                74d483dd177f9168ab14134a5e2272bca7e6e31185c34225e05de4545a99a4d2
    -                949a75f970b862aa3b8c9218ac34ad1e3b70a64be25005fd248463606275b9d7
    -                8d96725b39d8b9ba08acb91c3103c7e31f7970f937e176a34f4f4bc601dd8f5f
    -                f83caff6c72b2e7bfeefd49c93cbc270cdd4d442be431b8e9b68e011975708a5
    -                60095a8b784850a3c5bb3bdf2778a8aaca9064b6f1d424f4b41047efc7088639
    -                73df9b861320e66779b25d134bd4528920b64c79c9eed64d5a01e39f8c2e1a62
    -                ad2e6e68bc5de644f5f28b09a9479abe5f96bc6d3e0d77763e3cf61feb31f152
    -                98864c632b450d37a04e6aa4a2fc67406acda826ae98b7c52cc82da5da333ebf
    -                8b1c771dd994f6c650bf24cea6f25963fcf11a1aab7574b888dc89f92659fcb8
    -                1aadd497eb6676243eb9f65e66ef97ab8da3fd9678c8166d1b2aeb724211f4c8
    -                4e72749176f5d63798fbd16b0006dc8d92db7ee411a8ac90eead5a08f89a89bf
    -                295296b8d1d27e97d472cff51787b67a3d6d2a29b66e672647f395e21c9c83d6
    -                dbdda3d3608968288224494a815103549960155b1594d36580ca1db90c54b783
    -                f9e732fc2b14d58726a17bf5869a296985058318adccf6e56672e8dff8beddbc
    -                dbb4bf30d2c59bcb8eedc0e713cd39ad9bb748e5abe75e05179a856c686d1c6c
    -                764f8422372d6f2dbe76f277a21c75c7f778a4056a1ff3bb9f0022d931612411
    -                819c5a8a7b2e360c0ccaaa910e2af0d7ec87e9ba4cb90e85a18ebb8fafb4eec3
    -                40ee8cfa4b9d9a92fbe07aafd07c58e06baeeb5c587279c2b2c344db5e43d5ae
    -                32547dc5f45bc855a9dfd6c8d3ff174d0fb999f4819e3b09ca53cb328689486b
    -                e715f148dcbeea8f46ad00db30bfb087b8ad53ad6e1cb579ed51007289dc5b0f
    -                691188592e1beb23243ea4ab09771552fd03bafc9619dbba025764a5290a938b
    -                3c61ceb22c480a0985cc89a790e189b9e0022f772b30daaa218978208ff94c4d
    -                2f357f74fb93c961de0c97e95efa3a11dfe80caa3fd04051a717bdff5f5cd9ba
    -                36170cbb14defceac5ce20479b564e0d6a3b978a16cc48ede540212af06de08d
    -                300290cdeda5a9eb4c35f6b38cdd04a959370a929bb7c3372cd2a3130e1ae19f
    -                adb54c2389079bd8c7f0249a2b53bf23687cec51b529411fea705fee52504ccb
    -                fa64f7185c6f3601967d30a644a5fb4051517c8560b64009f6de5993c85516d9
    -                2c81e47c076a679ce96435939352d67d11fd5bbc94e6e90881d70311cba88a55
    -                83a7ec14f853f128da2377d14f95b947d00219638e712573223ff1aa2762d1f8
    -                f93d421e70dfd5ff040eb8f2f435d487e2d91d6d9cc0fe2d9066a01eef8a6c92
    -                d3a437a8ef5d8c8c5ea5be932d2f71b4d04ab3dacff9508e7dbbba3a01ea63ed
    -                4b7eb611e35e7d70f0e4ba82ab8a86719bb0e28fc9b3ad28bfa91f227a34b005
    -                418ae4439814122d5e79336d63e1554e1137642a98e67654ee73031166c34726
    -                c4e78848a55ae01b1398338217771198db5973527a82ada98aefa954edf09f55
    -                9f4896aa3b6117592599fd4301dd304d73ce8859509782bf60e8398ff311bcbe
    -                c26cf13b8a6448f2aebd0ca29d06fca7ea09f559aff3a315b1ee70bff8038b06
    -                c381c9630896666c83d14b7bc3b07eb153efddc2b09568c0ea3260c26106d1d9
    -                002ec640f4ed596991b51c20e9d4bb78de99588a33d0a64b20f8ffb2c18b250f
    -                d5f7ed0a4a5e2a9ff94f62b8e84cb4e2ee898b85c11db384a26e9bddbd300128
    -                2d886b7485166c7fc982be8c417f8fcd1a7fd98e529f2fe88a46f36d5091af16
    -                feb75ace51927a339c79cf79fb222b223e845126c73e4e8103fdd04786de373c
    -                9586d13460949c080ec557345dbb88ff1ca59701c889dfbb6492bb9086f05ccb
    -                330a2bff05ebba97a5358702a8d2aee46bf1d7fae1b934405d652a05e532b65d
    -                d7ef2e6599af8683bfe4644ae2fbc77424f31bc422ab791de730e4718d080603
    -                8dbb78b84c5df001047502acc3efe437cd46b8a0a7b4198d5598dbc343db47ad
    -                9c379d5147a5d4bb3c8b962a7368a7405a580f7daf312327141cb5681e198795
    -                3ea2d2d95c7b9ecd6899428a8966203a9ce586357c631f7af27aaef3ea3a47bb
    -                b8a81a7b83bde6f223b270576427c02f0fbb8e9232b2d70f9a0af16ec6544eaf
    -                00000008
    -                ff48f2d9fc8998f7cb6685a1d980003da426db35481323c56195cd5142148269
    -                5b064c6f98dc3289b8244a5a7cfedf3c1c9a96ae48c79d6c9b59e713e91d90bb
    -                a0212398645f8c55bbd03832e57397200b8127d6f38570e15297489040fbe0de
    -                a21d372dfbe5098b1491d8efcfd2389e506039bd49fc976ae940b5e6bf3c394b
    -                189c63af6e799ed580f999ff02a16a5915f9b2ebee58ecde057345f4557e87b7
    -                8828c700ec978f41e9b9ea78cf8dc961b0ac33c54d0f91a1d05b4910e981a050
    -                a2c319c8cf5470b427ab09159fb17e5393176683e6e0b3fcb11104e357d75d66
    -                6b13356454c5bd0e70c18ccaa775ca568ae50d924c2ba2d74babff2fba05ed25
    -                4d9e8dff7d8770738f2e666f8db461fbf0ba307cd638950692c65254b03d739f
    -                72ded6f48b6a9a37de6cb2f3c4498626586ceac37a2644e5fdf9b7794fa4b472
    -                37bc4d45381e5bcf6852d15fd572e0062c8b1fc63a31312737f2347ea40b2117
    -                03f23f5811b7ddbca4a3f19fccaf4860773bcfb872000845166c61243b05b033
    -                4ce5faaac3ab1a7e950403b952e0b0ef4396e5f12abd08bb1354c28afb9bdbc3
    -                edb94b15aad3a85ba3444caa1019262ab6e04f343284bb5a21320440a95edb16
    -                d3317c875cf0187f0ed79b676ca45203c2d4a83233229f0861c58164b2b80b30
    -                0c13ce8899b0ba1e470ead23836fefb921ab6a472beb63b655a1238a5b8f039b
    -                f1c2916a44168e288d4c4aff2ec82c8189a7f7b70837e0a5756db0d38057c9d4
    -                5927418b9fc50048b6ae0f16a9b3e3399d9b08b67c41c84bbc5f8bb9b23f08ca
    -                cd742fa9e1225dc8e6cc32b86d6f57a3ac4b6d733a0655cfcc036c4b4c004a61
    -                1efd58035b06ba03b4a701a68f5945cd90bd4d69d702fb43f0ff10a5879ab709
    -                """);
    -        }
    -    }
    -
    -    // LMSigParameters.lms_sha256_m32_h15, LMOtsParameters.sha256_n32_w4);
    -    // LMSigParameters.lms_sha256_m32_h10, LMOtsParameters.sha256_n32_w4);
    -    @State(Scope.Benchmark)
    -    public static class test07 {
    -        byte[] pk;
    -        byte[] msg;
    -        byte[] sig;
    -
    -        @Param({"h15_w4_h10_w4"})
    -        private String test;
    -
    -        @Setup
    -        public void setup() throws Exception {
    -            pk = decode("""
    -                00000002
    -                00000007
    -                00000003
    -                c56e39882736881759e92ef7a37a1953322e3e9742a70e3f401e9bd35c973ace
    -                e06d7f77bd11b4a6082bbf7a5429dd4b""");
    -            msg = decode("""
    -                466f75722073636f726520616e6420736576656e2079656172732061676f206f
    -                757220666174686572732062726f7567687420666f727468206f6e2074686973
    -                20636f6e74696e656e742061206e6577206e6174696f6e2c20636f6e63656976
    -                656420696e206c6962657274792c20616e642064656469636174656420746f20
    -                7468652070726f706f736974696f6e207468617420616c6c206d656e20617265
    -                206372656174656420657175616c2e204e6f772077652061726520656e676167
    -                656420696e206120677265617420636976696c207761722c2074657374696e67
    -                20776865746865722074686174206e6174696f6e2c206f7220616e79206e6174
    -                696f6e20736f20636f6e63656976656420616e6420736f206465646963617465
    -                642c2063616e206c6f6e6720656e647572652e20576520617265206d6574206f
    -                6e206120677265617420626174746c656669656c64206f662074686174207761
    -                722e205765206861766520636f6d6520746f206465646963617465206120706f
    -                7274696f6e206f662074686174206669656c6420617320612066696e616c2072
    -                657374696e6720706c61636520666f722074686f73652077686f206865726520
    -                67617665207468656972206c6976657320746861742074686174206e6174696f
    -                6e206d69676874206c6976652e20497420697320616c746f6765746865722066
    -                697474696e6720616e642070726f70657220746861742077652073686f756c64
    -                20646f20746869732e2042757420696e2061206c61726765722073656e736520
    -                77652063616e6e6f742064656469636174652c2077652063616e6e6f7420636f
    -                6e736563726174652c2077652063616e6e6f742068616c6c6f77207468697320
    -                67726f756e642e20546865206272617665206d656e2c206c6976696e6720616e
    -                6420646561642c2077686f207374727567676c65642068657265206861766520
    -                636f6e73656372617465642069742c206661722061626f7665206f757220706f
    -                6f7220706f77657220746f20616464206f7220646574726163742e2054686520
    -                776f726c642077696c6c206c6974746c65206e6f74652c206e6f72206c6f6e67
    -                2072656d656d6265722c20776861742077652073617920686572652c20627574
    -                2069742063616e206e6576657220666f72676574207768617420746865792064
    -                696420686572652e20497420697320666f7220757320746865206c6976696e67
    -                2c207261746865722c20746f2062652064656469636174656420686572652074
    -                6f2074686520756e66696e697368656420776f726b2077686963682074686579
    -                2077686f20666f75676874206865726520686176652074687573206661722073
    -                6f206e6f626c7920616476616e6365642e204974206973207261746865720a0a
    -                """);
    -            sig = decode("""
    -                00000001
    -                00000000
    -                00000003
    -                c94b744512be0c92aa45ab245dcdb53513877236830106ce43f09a2a6fb083b4
    -                53d15c7290b92cc2864d0780ae105d535de9f9651db43ea47f91a1334bc215e1
    -                eada1413a30a5917c0da8a5ae8256a0d40e98f33d6bca2d93579a44707a4cf0f
    -                6cab795d4e332685898ff004836490805f3b7eeb675c89b46f6d0d76467ffceb
    -                18f41176ce105214f4d57d1058aa1468cd1c2a894b62502b22ecf0b4f73f110b
    -                4b9726934786d58ad59b57ef1fea528421968ef136fd2ca7131c83ca9f03ece5
    -                a8c81765c769d79e8fa4093235c857d3e2864e2614be9535de95a09f60f2c033
    -                fe0125946b47bf09ecbc92123d486411c3c715f313b178818e00a81f02c8b7cf
    -                6c9f6babe65218f5caa8b0c38785fcc9dfe8c35b59077db5084c49f99fa7fccf
    -                5d3dca81c273f72a8f3e8777ffed035edcb9696f9a062a7befa59741abdd8952
    -                1dc585d1f8b37141c6d07974d768ec338ba71f98581fddc7db7f6b11602f2bce
    -                a4168f7959b621d7e298936a981e041092ebc13e944ee2150b91dee55a1f6724
    -                66fc58e24d8d1844237dbf4ae6d5623001afffe971174541fdb7bdf8695d8afd
    -                cc56ce99cd603ad02b700983e6b97b76b9d95715a57baaa5804dee2a02b88894
    -                0260b58e99c05f05bb5b2280e242a40d1f443f3a37ad051dfcf3e1888107c067
    -                a67379ba8716e167b862fcde469ab62a4d84162f68d74a6631ab0a7c41ba7519
    -                096b72110d7a9561eb8bed3d7a87b383a5085c99c54149b56d5d40c747ca28de
    -                ffc08f627609600d2e8f40bd7104bc99a2ec73952b857eda20475530c1fb969a
    -                c79c062c6a687bd2e008b8574260b822de26c9e7cbf32338348db43e4130026e
    -                c2dcd20b79e4b1766762037af058cdd89a9bb2ee4148d09653f0366c7e0b018a
    -                2b72a195a6b1c422e5adc23fbca25968f7bb97e51e01a83b7d1e83b22a118b76
    -                ecc8acac709b3e5de5cfba07d8e81b2dcac4a476359b1541adb24c2e9fd68a38
    -                32f2ae30b1db83470cb50a9f36777fb02b98f63818a078449de16c3108c0b724
    -                ce49b7f5f3beeee04ffdad3cd5cdd2e7955008d6e3123a42a46574a8237f2d54
    -                d54b3f8a6e01185287b167237ef736cef9881ed8478466124d72ac30a3caeb2a
    -                18fd68be71625289e05e076b7c290876dff1a95fab3503533be3ef0c5ad356c9
    -                df59630f3eb5fb6be37c61171243c0cf72ba2e2b83c4d84ef6ff9cac6b9790cf
    -                09eba6e0dc76664cf957c91b09b67f0e5c0f933d503c7a6a6be06f78019eaad0
    -                302e68f499e87d84627a7443bf1e2a8a2673247b1dc6aff3ac940d5f0e3a3ad7
    -                c888cb961d8adc05a85cf2c9af4ac80eb0109b7ae822933ddbfbbbb36e05bf24
    -                c3538c645e22946197d21091192cc2ece6f866fa2c37ce1f4a9be52428d23913
    -                3952f89286f88a7183ad17416360e0143d266f730cfdedd42437eb4baf9c3e7a
    -                1fe7a3e084c2ef4f50e2730ab9fe44c90b1d0167fbd1b6bde2f1457e2a7521be
    -                7bbd3bf2fc64dd111c185062afe4b90830747c68ad4ba890d691bd66d95fde6b
    -                ff7b1b1c4d13c69d4beb23ba90309fa17633ac5c6d3c0571530ee61e48eb4e65
    -                b2482bca9bb230d3fbb6a6e83145a8c918059befc05143a5145ffd4fffb38114
    -                e4026f262038e7d24d5f9dab453899daea13fb4bb07f7c7fa875ff4b8c1600bf
    -                d05be8a945f323243987db289a19bb29250a6a2d8d53c26e4cd5319324676f38
    -                a2adc2fbbedb324a5dd7ef804dfaaba33b4d7fbe17f134e1883400072d5f30ab
    -                86bbfdfdfacabc41b80749abb2271f903c71b383b5779aabb317db34ac01424c
    -                174cacff3dee16cf50e7ecb99d50afead31ab13363f49050463c25aea4d65235
    -                0797d491ebace80bfd2074095f1ab5dceea9866a62c1e7e3c7683c3d7bb50272
    -                741afac834a1e48ffe3e3dac6c168a33f40febfe4ede57637653c7731b4f5d81
    -                ac275de086acfb63133ae49b40cecf3e8a0333764957ecb1fbad30d80e0486d6
    -                5a9727a590494ef7aae57f40bb0d75b05fc8a99d98b28f2294585234894c3f58
    -                a1064bb824afa73938feb5b96b279dfd3f9145ccd4a8339d2be01a62ea25efbe
    -                b4bd970ba21c53d31fe66efba0450e8c5edf46c7116701b52954a11baf31727f
    -                7f845d9050a6a29759850af2d55d47be9646dfd6321af2677806335ecd6812e4
    -                a2ee84aff5aaea12478c36b822335db52a6cc0bac5b59c79f5d947fc526288d6
    -                585abd23a071c6a98bcc6909cc3e45b15ee4244f19fb5e91b9c408870a37741f
    -                bff097374f1da1ac712561ed5f908926f9c05748291de93690cc863d998640f0
    -                963a92ec0b5246745477c83c600e52fd937d4a190d621a114c185a0a84b5ff3e
    -                782113864ccce2b9acf86100bf188d9a00de08bfc9b1fdfffcc1f2ba68420bbd
    -                d6df840fb782a21cda9f051610663e8eb0d1e3e976886fbd98134101fabe1ba9
    -                33b2546f1a468697d453d94716b157dc8dbab7052424b095d3dd7a19ed709da2
    -                60d7ea9df24170f6feea4712c56f82158d1870b1380e7dc4313a4d419ece9ea1
    -                dfd7b3df4ede21f29e050156d5089bc0cff7e15c7983476e890b41f29a2bb373
    -                26dd2da928dca53655602886fd1c4a9c8153cbe50652741ba398857e37ad2231
    -                973c24653ab47e413ca95097a984e56f3fe7fcb3e8a7621d8cd710dcbf8faf0e
    -                2be05dd70a0e746a010fbabf8dc45963673f8e009cf146688852ff02eb1c00b0
    -                5c4adc1ebe2dfcd31a15f37a4ee935bad87bda3e27df9724a7b1564b3f251602
    -                50e722a50869d1cd39784b362bbee70c3a917f18bf92b77a5322e8b5c1a7d101
    -                77fb7a50f3d1b10669d570f7cfd4d5ca1401a4da432d4f68137986c456507611
    -                a050b0ae0b7b8ea295bf78ba9b8b3acceb14aafc82385928ee544ee068171a2a
    -                34a7e2e5b37a19a70c0251910c0966cc6b8a689cd6fc8a00f73959388624f9af
    -                ee57d316054eb23ff1aa63879e13519f416a8449942da592e727073bdccbfc72
    -                52baf02a65ec66bb9504199a147a3616ec20e7c57ab6a4f4c7def3eee13dfe48
    -                06372b85bf3d32cb6b3407a59af02c5549f29a76c73f43566b868e5f1092bfc9
    -                00000007
    -                a22f82a1ca76d4b8fce179e98c2b8f53fc36a1be0c8ecc5ac22a6c65b02101e1
    -                0da5ee071fa5a641198ad237ddc7b03f50612080ff3867ce11df78150d06c9be
    -                35bd7d0befbf473bae9f2f8e077e9358e8bf2b4ca45c7a6af889f56564a22470
    -                43b4b86db63819c4f9d024e3e09b96e731e315d10c3db8312e9bd33d477c318b
    -                3a5f886dc3d8595363de2e2d4053aef8b722f7fe4e092c1c9de6942c6597babb
    -                91ba0b88467321a8762daed53a5e31bd91a76085d559718fa3368aca9c5defbb
    -                6402193da3e293fd7d5df6c0d0b36e4696dbb0e6683dab1e29740b2625faf976
    -                a86910e194b46ca4857c3a1fa37b2a932ee300fd69ff2987fdb6e8ec7fb0a57e
    -                f50448510f72818c87f0a51be0796e20d9fabb66244ec5e99d6fa786b7524992
    -                bed245b61066371a4d0b3b91b64ec0e4e4912b5064f4e73a684de396f73b9531
    -                397506e10da845520a724a419003445e4b3a02ecd83a5fbfa392725054acc609
    -                b9d66d83ca4981ab5a826ac0c675706a0db4ea4f4ad55b3c3a9cad8ebdabcbb0
    -                c1526eeb2f678c0782ff98858241abd90104f0a89767cbfbc8584062ec2f7fd3
    -                ac911a09b2188c85a46b71ed13f71c740cb8f78513476f33b7157b49422e2710
    -                e4ea2efd66b147f1e94f512d5bf7ec40fbf020094c03626fc71053c6984d8b15
    -                00000006
    -                00000003
    -                6002a704915e03814410e7c4a86744b6269cc17650b33496e73414170f642ad0
    -                a5a308f58beacc5b39af6b988b906c8f
    -                00000000
    -                00000003
    -                4958d1fa4dce4ace05d93d530b008131b8c01191cb9c6248842e503676f89c91
    -                12431e2d9276492e1dd36fbdcbdced7dac7a4d86fc64cd8a1f6761d6072eb0fd
    -                a335e5a374b7139a62537af2d20747b199f32b97aa98b7ed722e651b4ea2e8b1
    -                6741525a4adf245446407ef3a0f8da6a374245bc5796fffad397d33ac887ef8a
    -                f1eef9ef53f9bf5ad79d0ca617c69bf8d5687551779762530a71c15a1a833cce
    -                ba629d85f03eb30b065fcf401282632e97cb505e41993ea121aabb93c5f5188a
    -                ae98a85213bfa98bdbe14d2b53fdbc4c00b1826ff9b34ce84293eee25a440622
    -                677e290239095d199a3776d2208ff1dbe2382657e83d1e29f8da4cad0dc2fefe
    -                2d17350229b945718f71d17c646c881229a4fa47e2dcf7485e9096b47c24ee1c
    -                4f051855cd19d787be09ea221bf827f6c2e648435f4d66d2028a011e8536dfc2
    -                66fe9bc6c4d342b95a692567291e6e2ddff81179eeec69fc135983fb550569c0
    -                4d90c040c2a3ecf2b81a55f5368ac0a7a3d9c2bfdb8aa13568c3147f56b0a504
    -                84c4a00b2b1c795e784498d4bd1951eb5733cab4a7b6103a4823f2a94f890c62
    -                dc83c57ac233902bda5440eaea0aa553e0528458b39e8b58ef98e157c95a723f
    -                7c074b5e3c4b2d2c15ded5582d2774c71173be7f7ecbdc659d8d5a132e39f64f
    -                4ae6a81fd550d8dcf7a1e695bc985d059892567fc502399123ee3f1131d113f2
    -                bdcbe027fbf6ef0738f78762982ab379547eee6b4276635d1961b7cfbf1bf6f2
    -                e9c9512fb4699468d882b382bfe6c479878824a52fd5bc0ffbc5cd857d1b96c4
    -                18ef6c59e799b93f14bfe5b769ee28aeee86ff5caae4e7cf19491a00f084b818
    -                dd61b0f97675c85077bee6ce5a44d9a47603491ba1d5e690f311037d7319bcd5
    -                74542337ed91eb7d65a01987d32f17b08d62c9b2cd326fff38e3a6e280c31255
    -                950b7911c262a17193bc9fbe9c43da2a3b69e61a5f09d67f667f64a12e91ab8b
    -                baf00cd7647b9fa8ab76057e5c2dbcb347c26ba18b03c25af8f1bfe18491f962
    -                b537cf3b24078dd8f45a2b3f707657592872d4c3c050bbb69dddc885399e068c
    -                c4d13709c8533f650e48780663b28218bc4e81ac3265b505f4d4ed6c8edf10cc
    -                c9db22b1f92029727cde22f4cade608fcc64372da7367886290828c478ab588b
    -                4473c2e9bfb975368fe6b53b71953eedc62980b60f3da18acbbd292b723d673b
    -                217d17366586344be60802ae9b4bd945c27e196317f9b8aa91299863a6dd336c
    -                9a321b7445934edcfaf6dc7f107a06ec6aacf3c4e7e04d83a938741912a9a34d
    -                6d6cc6598ad635c8299b4c5adb149f935f39a1cae255a8116e544306330ce49e
    -                6a46452ce0420c655ecaf659b8723780c9d2a7946f9b7781ca0ae983dc68c0cc
    -                afbaad6792d3b31b728668d91de0a7927780c78406521bcd483d3614d20a4265
    -                62c6435a924b998e3824351706be646e2d530a2389f6c09a2d8c443611e7c092
    -                330b56ef2672ad807f1ea8e249b0a15a57881048f91b00c4fb374201f8b92259
    -                739e521e10604eb307d3638090c0a4e4eefcda271a5387cebe0fd48d9a146232
    -                37b9380e40ef1108f00a980c4cf9abc88b3edbc7826c48508e02069ab34578f9
    -                db6bc3196dc806e0b1659577ff34d138e53cf784dfd03e3d8289b0d8fa9ab004
    -                dc35ead8fc1433b8c2b1265241f17d9629829c658513051ad7feea28e1d72a34
    -                05a2571a4af94b7ec6ab2ac4cbc810077aeed2237831eb42e303511a3b79475a
    -                9f9284f00b3baaed51ee50f3ec7af02effd2dcaf7abcb9e4bdd639c28293c8f0
    -                63d35b3f3934df46eb853a2b8f9e1e8e39abd9f22a7992325b9965ccc14e7910
    -                829b503007fe5a521c03ffb48f154d908a7f145988de3d35da8710e8b42cf0b3
    -                c9197a9d250dcb5ab5ac724e0eddca2f1e92baa61c2f2862087794fb6aadd837
    -                229c58b673f4a682b6f16178a8bffc71e696a29f9116cb896dfd05780afce77d
    -                cba573170724b067964901112baa343346d2c82e705b842e8be9e5b56577015b
    -                f86f9b27be99ae333bff689d93c7e4ba77be967cf8e6328284c76a2e1a3920a5
    -                515bdc7e5b65e6041aca2268ce13c17195274cb0461611421521e79a2d53af61
    -                1728b35b71db1b6424b6382aaceee899b495fbef4184911ed1877a3b17be2276
    -                571a2347d613ceee0c9de7e0d2f0bb5e18a63ef05f424b1ed1353409f926f84b
    -                4ebafa712f5ce1d36de03c6c90559a60f80e2b4915fa57d08222f6735a6201c9
    -                4931dc8a50f88b537031855c3824f617334f9ca13a9603ac1038d2cde3dab425
    -                e5a3ff1a7fb7a7c25b315187f202eb5311d078cb2e2ffcb1a509cedee7c372b9
    -                c06c6cee6b66b6bae7bcb158e4a74769805a88f5c9cb7c581e12e1d05ece3865
    -                4b5261501fe414ba395f446a846bf736e1eba29fb30fe80ee174677eaab90e1d
    -                eee16dec7a31c23865a38ee8c052a757abb91b104d1b5e0150e535b1c4669e7c
    -                c6b23f57a8dfed44b3f853049596b7f149e5d21be66ae72df95d1e969b054cc8
    -                49f2bc06a1d6bc5565bde1093648ad2581d691cad46237bb920deeb5facabe8e
    -                52e1e02d07903a17332198526a9214b6d4d4bac9f13994f6ae01ee74e673aefa
    -                5aa33ec67c4e0fec44bbd163fc6c317c0db4ce0de479115cd2a9474c7b222a81
    -                23cb5c784e3579ee3805c8a606d2c5d113fcd12bd83d03a9d72c8f72d6c577d9
    -                c891542cd3f3e59abaafdd2b0e9195f57e9c826039647506f0fdda125a1403f3
    -                f007d6db2555125c33de5b3a90ac9cd8485e48bf1db995708b697b5b47741108
    -                1b83dc7bdfdd8aa5a3506cf5a828c0e9803320af6a8b8949edf8fcbe65226beb
    -                aa2930c5502dc34b4ea9588ecf3e69edf41ec734be808b3e39c85a54a7eb5ce4
    -                33994c40209f02eef0e43adb560bdb26a969216b521812c6364bb336d004c56f
    -                91bc928887ae8deae2ea6bde44ddd39135222698c491759ff20dfb6d7686c284
    -                2ffd232c9544e3c39d37e9ce8bac185d58802050284a5fe653aa64e16c9b1777
    -                d011e2ab479a85d33e041423e6a50e5dae059eca94b6c99015e4b65047ae8c6d
    -                00000006
    -                d67b98d51d77fd23841bef1a34fd81e4c561c4f085b02c791553ed46c7644b51
    -                b6b97076d18c3ff64891f63784cd38c9fd1580656d4ed635023f4fca45bd49ad
    -                7958c3201c2233d8e1444a58b1f03221603f1c3b59b72eeac085fdccb79e07b8
    -                37451bf427cb58ac9234253ac0c56906b0540fe5bdf35b47b73f04f56b22c8b2
    -                1ff441f59983c2763a021e6d8f0ee5b73a16ef63d89168563b086698507fa56c
    -                ddd5d64bb968b0763191da92171580f9c404720254cad5c7d6900a4997fb0570
    -                bb9fcd4d249803c3ba2b3e5758cee761ba4c2df21f20ee2d36a547a0cfb216fc
    -                efcf58231cb7d6112ac2583fc1e52f3062c1cb8b14df921eb4b702eb703082db
    -                7ffe104cd0be40b96a04048def98caffea64e25ecfdd3566d3775200c5eb9182
    -                e9a45d41023db850048e05f200a4e7ed2e0b48c532e10c1628503d5b7f394cde
    -                """);
    -        }
    -    }
    -
    -    // LMSigParameters.lms_sha256_m32_h15, LMOtsParameters.sha256_n32_w4);
    -    // LMSigParameters.lms_sha256_m32_h15, LMOtsParameters.sha256_n32_w4);
    -    @State(Scope.Benchmark)
    -    public static class test08 {
    -        byte[] pk;
    -        byte[] msg;
    -        byte[] sig;
    -
    -        @Param({"h15_w4_h15_w4"})
    -        private String test;
    -
    -        @Setup
    -        public void setup() throws Exception {
    -            pk = decode("""
    -                00000002
    -                00000007
    -                00000003
    -                31b6c6a3b78feaefaf459a33e2acfa66a208240984abbe18996896c0eda7b999
    -                9d9786e59e41179854928ed5c5726bfb""");
    -            msg = decode("""
    -                466f75722073636f726520616e6420736576656e2079656172732061676f206f
    -                757220666174686572732062726f7567687420666f727468206f6e2074686973
    -                20636f6e74696e656e742061206e6577206e6174696f6e2c20636f6e63656976
    -                656420696e206c6962657274792c20616e642064656469636174656420746f20
    -                7468652070726f706f736974696f6e207468617420616c6c206d656e20617265
    -                206372656174656420657175616c2e204e6f772077652061726520656e676167
    -                656420696e206120677265617420636976696c207761722c2074657374696e67
    -                20776865746865722074686174206e6174696f6e2c206f7220616e79206e6174
    -                696f6e20736f20636f6e63656976656420616e6420736f206465646963617465
    -                642c2063616e206c6f6e6720656e647572652e20576520617265206d6574206f
    -                6e206120677265617420626174746c656669656c64206f662074686174207761
    -                722e205765206861766520636f6d6520746f206465646963617465206120706f
    -                7274696f6e206f662074686174206669656c6420617320612066696e616c2072
    -                657374696e6720706c61636520666f722074686f73652077686f206865726520
    -                67617665207468656972206c6976657320746861742074686174206e6174696f
    -                6e206d69676874206c6976652e20497420697320616c746f6765746865722066
    -                697474696e6720616e642070726f70657220746861742077652073686f756c64
    -                20646f20746869732e2042757420696e2061206c61726765722073656e736520
    -                77652063616e6e6f742064656469636174652c2077652063616e6e6f7420636f
    -                6e736563726174652c2077652063616e6e6f742068616c6c6f77207468697320
    -                67726f756e642e20546865206272617665206d656e2c206c6976696e6720616e
    -                6420646561642c2077686f207374727567676c65642068657265206861766520
    -                636f6e73656372617465642069742c206661722061626f7665206f757220706f
    -                6f7220706f77657220746f20616464206f7220646574726163742e2054686520
    -                776f726c642077696c6c206c6974746c65206e6f74652c206e6f72206c6f6e67
    -                2072656d656d6265722c20776861742077652073617920686572652c20627574
    -                2069742063616e206e6576657220666f72676574207768617420746865792064
    -                696420686572652e20497420697320666f7220757320746865206c6976696e67
    -                2c207261746865722c20746f2062652064656469636174656420686572652074
    -                6f2074686520756e66696e697368656420776f726b2077686963682074686579
    -                2077686f20666f75676874206865726520686176652074687573206661722073
    -                6f206e6f626c7920616476616e6365642e204974206973207261746865720a0a
    -                """);
    -            sig = decode("""
    -                00000001
    -                00000000
    -                00000003
    -                a3e30c30ffb7b27a99e1e53b030fbbe5f901b7fc38b059190b9ccb9612503d10
    -                d0b0266063d5e234c985b0278428e147ca9686e3540e6d51964e27d0334c0043
    -                3564dc02fe8b1f911667561445bc9e61773d4ea4fb7b5c8e637ce482cfbb69e1
    -                15e118eb5dd28ad2db03ad6618af5a0a919aefafb46d8ae5ca011274032445c9
    -                7a49502e49064fb41fe28aa76c103f0d98edac1d71f51010d7e89d04028394a6
    -                87c98d1ba0b07470add461bdbc5dc553cb7225bc12d6925319253f50e8b8b1ad
    -                1d5ea6304ce5e69150b0b2953e38ba7bf75b5900e1b4e84e81d1ba177c7dad91
    -                956511d74a5b79c22aba2b821ec31021244fc4ceed9b1d992382e7f2e188eb68
    -                841b09301ead899c0857194939576e830cab8fede0f14eace0755d56d144eebf
    -                1eaf5f228f3c3a915de564ffd8c50b7a0e95834eba10737082d38f1c459f2a5b
    -                6479b129f77f57306bc9888a469ea7a7f69be2f4784c472d90b3a84c8a10789e
    -                5984c01ca390681ef94b483be22c2559222a3c8505055fdfcf3c1d5dbc22f342
    -                8d07178cb2736d930313812c30cb9fed3c083e3319208ed600d449df46106898
    -                1f7b3201a9f1760f388aff82eeea616ff89301ed98de1fc9d3a820c7b3e8d5e7
    -                e7a97f3eb819f4f5a08ef7e435d9df748d631539205204f269000d423bf195f8
    -                02091fc8f25e186da3ac3b63f7fcdf832c9a8b849a3efc207dbc39b7d6e67184
    -                4efa7ea995aba735be8d69ea2a7fa954f23d9cd548aae96068e4cca1e53f5fca
    -                2940cf78a43865ff1ef52ac1ed6c347a38b217537ebb6052a094ab8a7d5d67ca
    -                0ea8e46f10be7f07e4f5859f6f940c308aa156268a2378e36b6f642cda1a0e31
    -                dc3eac909426d8e9ad55ee21971c60f58571877e3c9e41bfec8c50c5775fb8da
    -                bc78c18abf1e9c3c9d6a1fdcbc42bb613e5019d95cbd12bbc820df6304240a7a
    -                0aae87df42881ab1e5df3906453ff32acc16a3bd5c01c4bfbe28240a05621899
    -                104994f21e87431596a2c43a336be790cc095ab7fea51a5f957caf3f221dd875
    -                59bad735356ed5364fd9f034ae53c1ae7b7a3672a5d7bc0974650923dca467c3
    -                0f826ae5bfaacfc381469b93825cde82e5f631936bfed860a786d35f29ee326b
    -                18e215c6e01630e811683da0d8d7b9fc24131da9de35a36d5e541896b79bbbe0
    -                eb15ade43e39134013b0de86731d17e7ec7c7cc1cb46d925c211e23f427ddc10
    -                a0d25b18c397a83b3be64eadf9106d5ca75286f599059b2cb0c3cfc892ae5e88
    -                6fb873326634a5231f555a4dabed9fd3370706c6e4af23e5736f5449883d446a
    -                593bbd6f36749f5a71a49175ba562855635511fe9005ab1fdbaa224f55b95a03
    -                cd08a215b8cb400a02896138900273216402241caff7398067b0f6c18edff0b3
    -                3b5e1350ee6157b2d79065ca0beb45feaa67795a821d783d3c566a0a130cd310
    -                ddad078aaa83a319ee6ffba73799bbe3f14a406be25b3f989c316256ae0120ef
    -                bf3593dcbfde8d1f1dce1fbb1cb1c6c8258623112a05b70389b1e801e17fb17e
    -                f10544099ac788eb4cf045ed1fdb9e5e957d7fd930bd927f4c15c253b145f848
    -                dd1ac985fee170307f56d34dae9926d67d1f97fa014fa3ad57c10d76d27dfcc0
    -                0a088a043021d5b053b6d69e912d3cb85b7c2cc029ecec40089333c7c9ec45b4
    -                f9c3ec3720df8fb592f5c71d7dc230f90439ec1ae12643a8f4a30dc96e798cba
    -                269bcd463116dd9657c89c569b519cd061816150e8c39ec3e798574610cd13da
    -                83b52042a890b37d10797ad80f74928a96b697bc810867a4e0e96e98585bf386
    -                d0df41627d76af70436258dd3ed1ae49554d8dc5a2c7e54d477af70e2a407747
    -                227fdd0bc0b5a9019c4df9fe95dcd8ea6251ef1bac071771d364fd428c3db3cf
    -                cb4eb26b7908ed96d30eceffbe634c0184e8cc2b807376d7d5fd9f4d9579f148
    -                8f085df80f032c6c382a48dc80b07bdeca6085aa59f97abc666c1a73d4aeee34
    -                a35e3569ac357a84fa1a9fcd84af37b388dae14e03be6b5e088891060bd69e5f
    -                419fd7d2ae50eb97bfb24c7dbd602de5db1f05c84f1f47fc7c6d40c0fa4c95d0
    -                464a18d0b6338ce123b46188492df786abd9075a535a38de4b42d8d8bd6691d8
    -                fa9dcd8af407d5f20a59cb959802735c2149c18a067367ab9e457e93e569ec1c
    -                42741ac055420fd531dda33faa9f179e272faa5b32c1e6d3029b55e21140f4f0
    -                104a89760e5e038c07a770bc85726fc57159089cc3a2ca2b8a14e9f040b41e30
    -                3e2c57f64dd7579eb094e8deb536a45bfc2840428617117a1b2ae8259764e860
    -                efc03fadfca03511a370256420fbda932a5ab58c98d0df2a9aabeaa7d886ccd1
    -                59281e77e7a1c70094722ec788212885674e90a3134c2471c399bef65cece979
    -                0ef61cf83201cc137a09115b0fa06ebed4de9104974f80fe00b54367ab267483
    -                35e0f8fc02d52e4c556ab748a98aa161d4c9cb712c88155b0177699f5fc4d037
    -                02560279c2be7db70603f03c0c2ccac7437597c79da01ef70d84ae5ab2e0ecc5
    -                b77e9f6a4c412569589d97bfda88efdffb626dafd24408eb79919cf48a619744
    -                fe4c42f3c49ec4c1f94ec8e79366f036aa1366ad559553d102efb9b3a913bb06
    -                feca31ab71949e4aff7fe00be4bfa36e7d6dedfd349c0bd0d8a895b7f8fc55eb
    -                09933f061f0c4a756caea8790d134c58cd1469ce78edd16be26e0208d449556f
    -                b02f343493fafaf615585320902dc4c606d3ae2fd4df7619817b49d47a672121
    -                c18da014aa89309814f49d2259540aa4897cccade9eb94351950a21ef3aab45b
    -                90caa42e3e41f39e1da7b341cacca50a8978f1dab0a54becc79c9501c9ad7c06
    -                db29ca593441ea36ce2d48aa5ab2455efdd70e558ad9f208c2f26ce7c716ef96
    -                44a12f904f4cecae04cb68a433db2d3aefc192009355e6f67f7b565c746c42d7
    -                ed6645ca837351fcc9534c66451e8e1fbc327999423aefe4f5f620c8e15000d3
    -                2c621ba53d572da4d4871d36173e83b1550cfa40a3a8fd7248d351a703389122
    -                a4b070ee87b44ec6543adea6921c567be95a8034a06a00c3fc102b8d2fa4e6b8
    -                00000007
    -                c792abc23c442a9822041aa5889816e9e127ab2323bdf2636cc672b47d055dac
    -                698074f11a96c53449a1ee30e1bc27fc8be61d85f4e5738725457d4cda5f7d62
    -                fc2e949005146d26590fd090a3c50e4141c63b8cfb14087affe86e9ad5207b4e
    -                dedd578be3e0a969d10fcafd1ddb134093d026a9055615e07ec4419786a82aef
    -                0afd2ee68e706169d7688ecfa37c8533d9f7af2bbb02adf614c680db745af017
    -                1676255f9e319f00501c43e4787e8349c9b04bf6bb3e7763fe6e40d6c21e6ec4
    -                d4611c5480aa2f8ef0f6ce3208748b966eb5d1c5945c54f8421ea3c2bf7602ce
    -                c1dbfc1c8408f84cbc3a2b7932764baf9c45e60404f60736cdcb8bd3397398b9
    -                c0e64e4555efd2c94f04a87ae037fd685591599d5c0b1a7197b6886df17c5225
    -                5ad8fec5950668c3dedefbe53ce5ede382633962be26da09260ee48b5d8ba67f
    -                900b54dda5630094a9fa85ae4217faf60801fd315f1f0dd58d30190fee4ef279
    -                51fc2c5633cb46f70e9ee9678e27ac8482a2e48415b14e5d1d3bfa6a86d5b972
    -                93f2d0a32d0c567002b03df6cc7a4c36129ecd04f9cdbc53cee787a344f305a7
    -                b1e61609f7df2745c75a88e07f071d1e93c868409b67afb114cdd539562046fb
    -                7d85f590ebe6969684eeaf7b42547139b50d64400bfe76c687658bf7195c9791
    -                00000007
    -                00000003
    -                052aa96293117df09356c119dd4b9edfe3d7c53d62d9855912682d1c502d64f2
    -                3b298883ffe67153ae1a23d0c6ca41bb
    -                00000000
    -                00000003
    -                9058ddc450f6e1e7b9ddf5fc65edb6c55d60cfaa3b3b1e62fd53d7286903b9c0
    -                63656485ed67b07407c84e1c4a34841d6e88aa0d6a22b262da4265063f3a84c6
    -                fabdc96e1c523d68043290d7d689e7bbd572880f0fb2a1fc2d247c622faad758
    -                ccf2f8751b983a86c29d721002f14050150227e594ab05b2f6ef605140511290
    -                dc213ca6db06bed09f33baaad9a0eb840c7b510bab2a31f7bc039f944b5b40a8
    -                1f047eb423d306a8a190dc1023c6433f39edfe68f2a11357e70356703d15a46d
    -                6df90861e10f84cbffb6efd1b3917e38f6baa2602f4a3d1b4bcf6ff6fc61e22b
    -                edccb0831a655474d5d701fce378142a307819d5a1e8156d655276f1f0b7d9f6
    -                a250c938935f86a2f12410cd5756526d70bfb17e0f90fb440e3e8c760b693ce0
    -                5c5cf7af31049ea0144f6ccfa9a2ca892df28504391c3f1e7fa053fdd29c9767
    -                94ee174f23267131aa62d5346150d9f5ed14867d86b55643ba6ff94b8065a85b
    -                a33499a09fc620e81a57a5d059e37458801464aa461f07ecb15cbd0239272919
    -                aaecec880c2f5bcc5c73af198324d06d9ec48d8a75a0d7aae6fa704bee98eb62
    -                77204af01e13cd80bb8ca5f243c67b02d2eb535041b0b41713c155fc5d5d2ea3
    -                61f27770cf31264a034989896edab335be1ec9b2c5df0106093162af112d1d7a
    -                9913a2edcb1c2fdf732b25c003ebd9df617cc5fc47d8413c2b3b34dd542a217c
    -                32e4aa7a283809f8011dcf59b639e4ca7baeb9b408a100188bd719446c77964d
    -                4865d6b138e9ef1c76d13145218c7de1827ef3599f8c9883ffc2d2412e48ef13
    -                4ef821e1d426748803ddcf325df9b49cd61257f2b2d3fe2bdc960b5140f5ddb6
    -                4696063fcaa699de790947a4ddbc8fdabd46f45d2640a07b434e304d00fa8310
    -                8667fddc1e04a671548ba468ab83dcc897ffc4b776d1694618ab131118cb7830
    -                ec1cf9e432d8f04cf48d8485d58c51b18d5a0bd795588bbcdf65a583f7615e32
    -                4d4a76cd5bfbfec3a0c37c97f9b5b1c5d8795e3149fb11096ab600cd9f77ab37
    -                0fd5970b641fefcf83870fea3d7deb9a4b0d4cc53a9d28330c07802d52635ad4
    -                3cb76a04b6fc09a7129da5a3d617935d144ca865c4a958d4592dd9dff080a696
    -                b2c7301fd3d2974df382562eaab239df41289c7a2b9b55264a879b322d693acb
    -                52c38d9a31559fae7592bc29b1a83e35caef47d793fdab943ff2e3f98a898c80
    -                73ef087f8d4419f1aebd705d2e0ae8fd137f7a46912c6a0ab7cf33f76d523cf4
    -                d27e5c2a22783974134846d923d8d966041d88f113451b439db3af3c90747739
    -                aba2de8ee7e1a7f1f84c6826cd405404c838eb387cba680b5c8f62ce8376c23d
    -                d7bf26386855df8f8d554445987bbee37597171f7849590db96281fba0cd9055
    -                92980b85e0f29f57cc6536e2172695607dee4f53fab7b123a34a97e12182e13c
    -                623f3ac68807718ec5d7806072dcbbf087e6f1e5b834cbbf7d8e85c3021213ae
    -                4100af501e8f77f57fd68c7b339fd649357b396a45eb2826fe06373928cbfe51
    -                f1de9fae833492e42f82d01ea9da9f4074ff22f5b59760d776241c73ebb0f05d
    -                6856dc9e07a2af219e38998afa04ac953dbeb0672b13277bca76ab02566d3f42
    -                2c6763dac87898373b69a1fddd92ef198f52388644be117fd8192b592325039f
    -                aac41b147a73162a5e297f82e09604eab0e06866450f8cebdffa2ff475e83daf
    -                e5eb9296626a895518872a97608ffe04f454a9e0098add3bf581f53490a1e2da
    -                324ee87fd47b7ed7551c0f222f475a57fd041b6e626979434d119525da68fbbc
    -                1e23d8affef88ad8542bd99f981c29435a3a7f3b40ad86426c6bf0a0948a15f7
    -                d8dcf09f4d083cc3c3ac77191afea39e3852f2b679bf2b3028a551e91bb41272
    -                bf59c1bd443dd6c71ead77700dfcdc2a9c686859b12ecfc1f75cddef50ed5eec
    -                fff75007bb26c09b836c32950104dd417ac60622bc57df8e55815204a75d9c79
    -                c13cb605dbc321cfbacdcdebb24ed3fbcde6d7d5b667262a89346598d9f2d9c1
    -                6e6f6886a55caf87221dc27a911cf4c389503d7715b1a791bdc17ba5bffe862d
    -                138b52768c1608f356dd8c88d5b28903a2295891fa139e4cfb16dd22ac8a755b
    -                d496864c95288aa4197ceaa54112e60ae999a8aeca4bef48602298b906c673bd
    -                93bb62da2d0cc7dd0951d304fb878513d2ed70ae39d1f56bb2c665281551ab74
    -                0c1976060bb67bd898868a2c245747a58ea6c1e71eeca9d1e196024b8df0314a
    -                96c278e9387e817caafd11c0cbd517b7cd3b1f1ca9c38a5741b7a46cbe180a9a
    -                deca3d975759eeb165354ca2ac5aa5bbd15841673f5aa25313009e570dc1e70f
    -                58d5d5eea6b10c36f0d5d09fd02021ab10bad7ea9dbd04ed909c7f1b6632eb03
    -                827d67ee609b96079824394bcb3e8f99d7ad77e27c5970fdf56f33097cd38c11
    -                1a095a7cf2ed76014b32a5a73e6a4bbfd86755d2b6e403671fe65ee3fbdf5c30
    -                3b261e3bc613468a46a8c04fb761fcf8b262b142ee4fdcee6a1a8c7baa76f442
    -                2880206b06d406ca77dbf75bf5c0885405e9446e6d0cc8251c11b2a9bf12900d
    -                a45b2515e240afa6d6091cc0618125839efd0e0cf55368b10f9ca04d9e18830a
    -                c0992ca32b1923c1b950215e3eadae1e3fd102f64cb7edf371fdf743ed553048
    -                7e7cc35827d94b7a2462fcdcc7e6eeacbf3626498d66ea1e7d98118431c7b823
    -                5ff390bc68d3063cd42bb63daf5db50edecfb9ce8a83cc5565f1d3ea2d843df8
    -                b899deca8a36e07b79a38be4c064af92b908658743c2808b94f8113490163669
    -                4b50d40b246e3f87930684ebfa0feee96a150e74d3e9150619ffa8c12db5d951
    -                2e55dbd4dc21e09d0262a3b4c9ebe995ca12941e0bc32091891c68614df8ef12
    -                bf34b0441c2204694236631cf4b1992daf2f4511f9f3adc29858dbe1100bfa09
    -                1a8343cf5987fd8175ede1a11e6a5e419d48d1fc834cb83e71e2d2b16a4d724b
    -                0768682f72e83797757e92a04fe738db302cc39622b33ff37a6f3f39503bf229
    -                51af13e28a4f1210f8b88c5279464dcfbfcfb8c2cff3d2ff11321b7f5f1e188c
    -                00000007
    -                ba78a4b874ece30e24b271f4f1a44db792a841a7405e270accf650a793961fd2
    -                09499109aa03394808cab26bf07cb44a856b76a52384c2c8cccf3e343a724d4c
    -                203d131c29a5060c9d518b60ecc1754c52c7abf223683192a40a6831bed6dff0
    -                80a26b30e52b268c8a9184857153af60266b0eb40b0bc255d0e96649c63ec359
    -                6686c1f11ac84488c6ba20f76649b257b6a3bc60d24d6cece4f8396716455dbd
    -                9b9df1ad3ddcd6db59e41d67d52d6648b5da92929d61a17e5b8c9b46246c5101
    -                ef8f4e1b64c8fd471deab9356fb1f5679ae5ac71059a1d54f7a1d72705128c50
    -                b45902f8da6e82e2851bbcd51d8dbb8f824a222596648dffbd61a1d6c95f9885
    -                68500d1d3b084594e0a5c3f3150ed15c4ddf484f45f1a615d63be1d7aebca110
    -                e80efb7a86132d6a57d296343d7c784f50859c9072fdd30c08d71bff9667caab
    -                65b044ecf87e90d7943acb7b5f26a26562ebb6b0a2aa31514c096125ea73c2a5
    -                d17cb68392d92e6c1ac7805a57466a3738256bf8de6cb3c5ee944f45bd4f1d6a
    -                d9977f46826deab2abf93378819376fdc7b61cf344d2265b9f8cd22a1632f738
    -                244569171a23d6d593bd19634758b7ff9c8731720e771023fdb0a6241dda4f61
    -                a4385d3b9c5b6f6bb018324528aff429eca9c1264de9ea434a1a90e07f69015e
    -                """);
    -        }
    -    }
    -
    -    // LMSigParameters.lms_sha256_m32_h20, LMOtsParameters.sha256_n32_w4);
    -    // LMSigParameters.lms_sha256_m32_h10, LMOtsParameters.sha256_n32_w4);
    -    @State(Scope.Benchmark)
    -    public static class test09 {
    -        byte[] pk;
    -        byte[] msg;
    -        byte[] sig;
    -
    -        @Param({"h20_w4_h10_w4"})
    -        private String test;
    -
    -        @Setup
    -        public void setup() throws Exception {
    -            pk = decode("""
    -                00000002
    -                00000008
    -                00000003
    -                4f9fbdfc21ece22a13965cd32027f6d4e5706e751440d214da485f202309a24c
    -                f90dafc3d8f09f797b1b6cfa3636e18c""");
    -            msg = decode("""
    -                466f75722073636f726520616e6420736576656e2079656172732061676f206f
    -                757220666174686572732062726f7567687420666f727468206f6e2074686973
    -                20636f6e74696e656e742061206e6577206e6174696f6e2c20636f6e63656976
    -                656420696e206c6962657274792c20616e642064656469636174656420746f20
    -                7468652070726f706f736974696f6e207468617420616c6c206d656e20617265
    -                206372656174656420657175616c2e204e6f772077652061726520656e676167
    -                656420696e206120677265617420636976696c207761722c2074657374696e67
    -                20776865746865722074686174206e6174696f6e2c206f7220616e79206e6174
    -                696f6e20736f20636f6e63656976656420616e6420736f206465646963617465
    -                642c2063616e206c6f6e6720656e647572652e20576520617265206d6574206f
    -                6e206120677265617420626174746c656669656c64206f662074686174207761
    -                722e205765206861766520636f6d6520746f206465646963617465206120706f
    -                7274696f6e206f662074686174206669656c6420617320612066696e616c2072
    -                657374696e6720706c61636520666f722074686f73652077686f206865726520
    -                67617665207468656972206c6976657320746861742074686174206e6174696f
    -                6e206d69676874206c6976652e20497420697320616c746f6765746865722066
    -                697474696e6720616e642070726f70657220746861742077652073686f756c64
    -                20646f20746869732e2042757420696e2061206c61726765722073656e736520
    -                77652063616e6e6f742064656469636174652c2077652063616e6e6f7420636f
    -                6e736563726174652c2077652063616e6e6f742068616c6c6f77207468697320
    -                67726f756e642e20546865206272617665206d656e2c206c6976696e6720616e
    -                6420646561642c2077686f207374727567676c65642068657265206861766520
    -                636f6e73656372617465642069742c206661722061626f7665206f757220706f
    -                6f7220706f77657220746f20616464206f7220646574726163742e2054686520
    -                776f726c642077696c6c206c6974746c65206e6f74652c206e6f72206c6f6e67
    -                2072656d656d6265722c20776861742077652073617920686572652c20627574
    -                2069742063616e206e6576657220666f72676574207768617420746865792064
    -                696420686572652e20497420697320666f7220757320746865206c6976696e67
    -                2c207261746865722c20746f2062652064656469636174656420686572652074
    -                6f2074686520756e66696e697368656420776f726b2077686963682074686579
    -                2077686f20666f75676874206865726520686176652074687573206661722073
    -                6f206e6f626c7920616476616e6365642e204974206973207261746865720a0a
    -                """);
    -            sig = decode("""
    -                00000001
    -                00000000
    -                00000003
    -                7d5dda179d7f33bd79840ecd9c46c0274f93453448b4b3c8eee74440b900b7e9
    -                9da9eaa94691fda7716fdf2354ad1858df27d29b79c91cf30423c32d5e093b71
    -                b0a141ae160487d8a4451622b5ff1488167cbbf342a876d53671eb0272c6d1b2
    -                ab8d8fe4b51d50ecaa977f379903c9dab520df31beba6f6dd2a310b8514d7a3e
    -                c78e2fd0a33369da3d5e8fde5a3df3669474ada32db4854eeddccb9daa82270c
    -                9f1f9d7d0f45d6b59db36355ccdfff8a08ce7c16cc5c15066b86fa955c7036fd
    -                5706b8560fd06fc1612fbd2aa9866eb40d962bd12585885321fef67dd80c3efc
    -                c0a9f620276038b0850e9598729efcec780d56a67f98d1392426308adfb4d8fb
    -                e4128ad38aad50060186b40fd63eae216d8761ad4b66600f90ad39dbac2c4771
    -                6986754a8c505c0d33906b8a66ca740f68edf3ea55c9e0df72e7f5f1c3b6fdd3
    -                67d8b0205a880a3ac1c9d2a9e48616753a0b9b34d63a8ee4b7f908cbd0a8eebd
    -                a55823c0abeb1911d369ec16414ff39a2d1068ae1331af1eceb6ffdebd3bbc6e
    -                e9ce74dbad7e6fcb362d111a9992b875d4f993a413348d91d7f217c0239b52f6
    -                0140cf51777848ddd04fd1b481033b9ebcd8e4b129db0bb801d99d05ac2490e8
    -                1f858d6f35ff29abd35c40fb650f97a0b32061aa7983822868119dca5c2c78cf
    -                a4f76d26ba91a56bff8c6e500fa35aaf89cce3ca8dc5c9de98a89981cd9283ba
    -                ceaef88dfd5a177d2c71fc7c1131c6ce74be3a2a7a673acaa731482cc4bd4dd5
    -                8f0de26586c2a8863bd96d505821b7e78f88a0560860d022961e6d0ed3cbe9d1
    -                22dd27f77208ad85d12dc33ad819e394841ff0055ce1649b20cd00af1942c76d
    -                14cb6b645d459caa7707f081f47b7a327b3596ab1e3af5b741e503f4888f5261
    -                83d0607e274c4b544e72417aa98326de9bbf51b035bc70e75211b084a947119d
    -                d7929a16d43cba2663a8d2ff8934ac0ee157f01c13fad772bdf15c52bc1cfed0
    -                24aad7e06e3fb72f7ba7bd03860b804ebbf3a78b40cfdc46c147a393d8f88ed3
    -                f921398995697a51b5e3cd8a3b363d03f60f531e3f2d7a8205bdaa4e652f8dfa
    -                42a17bf406580fc7d2240314bc3632850352a9212fbb56e2c4055634ddf76f30
    -                3c9818d2e806b3474587c3dd95d871b7b7b9987108d837efdbafc10735285f3f
    -                3613cffa7ed61e402e08cae00dd43aae21cb70c03cf1fd0313c365075a2927df
    -                a2af481b3026b81aaba7652b8c27a1bf64df4b079ddabc4e142678e86021cfe8
    -                35347ad78e3877a35bfa9da1325935bfd8ee76437c95e95a9199db1949a1d034
    -                2ad2e61b7459e9cc67832093240540d8c1c69af238f5ff9ac49829c5a06db24c
    -                a0cea539f2c58a52e256f404bf0123d03979c32da4b35847f01b253105d71a87
    -                86972babf78052003d2f1183c5bb1f986de6b443ad2b8674a8a88cc6dd1c658d
    -                4efa74da693e5194a7c8eb68a7ea8313e7d42ace9ab5f15e2c536eb4c0da7579
    -                5e50ff72b351c773c603cb749d6410608fe64e191715276fb36a97ee81720d98
    -                06209e53f728bb3be9021a5ac2aa157616b6c9f4f587916732cd682359c8b616
    -                84d3f0ad309c03a3d168f3927601544c622b99a3ddf5291e2500126278122794
    -                5dd8244314b972e0e6c303089055a449aceeaad870a1171b3a93fb329cd777a8
    -                9768b54671a3e87c9861d2c4fbd68971da747e0e12a70211574f5cbd8c98df42
    -                c7439886d089c3515f30ff5c5fb9e1e5a7f0d901ef76a8b5b290e0236caea5b1
    -                bef9f583c7d7b07bf793fabf560ebda31d56a19707fec2a476842dc8171faf3e
    -                b572452a092de32ce195160efe384e7f5c6c5ccfd3201dc34d33fed0fa0fad24
    -                e13053dea01c5ef210e1d5c2d77a94a6acc3fc7d2bb7ead6ef69c5877c1d1587
    -                931fef54754681e96904f5c24050b8d7617843674f4b652bbbcd19860da98aac
    -                c1e00d9c6cdf4a209c8b530b243b7b8f1646b55f9c4b0a35b0133c67eb16b7c9
    -                05834f2e392299ca1c61863c89e333f4530c25c7765379b69fe8ef30a644e746
    -                f09ad8a6090c2548e9294c1ea78695b90639e20de1fb47d3f378689254780b7d
    -                cd4bd7dbc66b62976a5e5df5fe72eda740fd4e38382283f1b335ed72000f8e30
    -                c0de5eb9256808cc5082611a10395710c17861bb7513e52ceb23d005bfb419da
    -                440025643128f9d074351a7ac35e92e9d9eb1520eecc78fd7a8de4919d428642
    -                e1641c269261d4eebc817c82d5b59b3e34bad0a081aa549c02ad7c7c1e8b936f
    -                51eeb581e9a27104a1d210b49c8882234b2de3a655ca4b69b3f72bda9e910875
    -                8cf881ffcab37b11ccd7991b3e12493f4a9e237c3184a838f029be09ac3d511d
    -                12dd84068c476afcf6d18c9516ae5800547b26d0a7d366af96125775f5fda02b
    -                9ac818f4d2209610d48e86c1f57bc71e31519363ea8bcdae791a88b50a84420d
    -                020b627b80424dd377577f0665503dad7d16d2f7532ac51b7adfe5704592dc76
    -                dbc6a32081f3435723b51a7c61ab2b8ffd27179561a8debafff46f1f6ba6a7d9
    -                79a12962352728770024f016cc28caa3de3e7d9695c3c0d2c53d45b7b57e797a
    -                10d1b64e37fa8dd2981d010e95fa9c75619606aac70dacc633d7b415f440d4b7
    -                37fe944f936990afa5f0149776483ead9759af9984c0d37a710735854f526e9c
    -                fcc200c16bc62b6c0a7d3c18189f721eba9b90a29fca15de8d084e44c97cff27
    -                f28af689a7670286687cdd40e60a9f68e7eca10568d5a02561c3f437afc57ad6
    -                9dd6505b04690530c9ed30c5278299a58057b7a24581a0eac0d26166d3f6b49d
    -                796f516103f61ec8f5a6e4307f97b77fed8898190b744c66eb661706fa71606d
    -                5692cb08973738cc0ea9a247590f23dfa8f2c0d406da850c8fcc639b0070c2ca
    -                d9d4c42a42255611b781104068ae3d09e94a7b2b46df774eba4dc6e712509a28
    -                2735e898bef0675f988568bbfdcd09720fa6e2afdc5590ecc9676faf12986f10
    -                9eb838e4e998968dced593c337607f6190b1f32a3cf5aefda5043cbc57e0ac09
    -                eed1660ccaac44af2c55b12ab13a7ef3763eed79cd5ab1b754cf15883c0ce966
    -                0000000856bbc3dc1996d6154a8847e9800276e50ab54db3c75f879f03c48c91
    -                7cfad26d2199acb69cccc8149332d3fcb94f076e55818aa59dc477ecf1bd16c8
    -                f362695da854c55030e90919b40f9aad3d43ead32e97f596c066eafe89d4a8b0
    -                d228e9ee47b531dcf1337b4e45c4ad21ceda14ee10f5f60ad341ba84bda14500
    -                f4c6a8f5317bd98da8713f1d76508046c62decaf44c61d752a9ddbb539eb5844
    -                b4ce4a5ddbc1a050472236a437713603e34fa0eafd713017b932814b6b24a74a
    -                1ff7a6c5d47b4153e2007d87dcaf47573425647f7e6f5f032a934967ada85b7a
    -                8e8934b8aa5395988a6fa50261b8ce6b7900bd6a8bba2d2ac54cf7ce04a0718a
    -                5eccf4551ae37c7b136081189eedbc1793ae7dbf368361f00b1df0cf236bad37
    -                b87b7cec97715aa6daabdb2b30301c376ba7ebb44cd9e2366411aa3b3a1a351b
    -                46c45cafd23213e5c6aabfe59d622904bcaa84d90fa9da47d522bef92a523a84
    -                28e1fec7cac1137532af968d413345dc3ef38b7d6e5f83594f31570ce12c3d8a
    -                2a046604ec433ae94cdf82eddd28fcf603fe605007420fbf34c917e7104fe1ad
    -                1ad45d346c2ac6058bed0f4c44d003e093e4e686a9dd4d80abbb716f7363f204
    -                ede2d0aadbf882db09bc75284fc29b6208b3b8d7110cf847e1cd9a1e04d14cfd
    -                23accde55a2975b5537614fe1809bfa01783c0e3bdc821eae70a5e4ddcf66b4a
    -                c27a3d76e12189a03eab3cd40feb892257213b1318bed0efeac00396546f314a
    -                97b9afc7eb3ef845b4d53bc8593184d734ec19c93fcc0431c5d74afc8f9eebae
    -                f12c7f186a464b0d1b6bdf7ebba592ef9f6d3b3af332a7f100f82619535d7ca1
    -                cd99e4134b50e84ea167948c244f928304f6d008bb7f8a10b218f46c227f5255
    -                980ea31a
    -                00000006
    -                00000003
    -                5490b78c72751e0485c63a1bea5313f0462907f953a8d3ce7e585426c07e608e
    -                33cfd90fa196727a43edb3759b712afb
    -                00000000
    -                00000003
    -                0cb7dce4975f968cae1c1affad81ef53fc2d68bed7d3c9bc83d85204a209e24b
    -                d73256ce79a2e8d2d0ba728a526248518d5201250ea5f831a58c2d03e7aa2fd5
    -                f4eb1081f5e8a7b49ab360caa46395d5c48a527cc84a2db4476194c13e6cbfa8
    -                c11e825f438552014a816e147410daa4ee0ed43c696e78c704f36e924a76008e
    -                e231372d7f50586276da32b3b340d5714d3d1ad1e12e12de00d0a67c61fb6226
    -                5b5a22baf87d2f22d9cbd79b2bc7c9cb0f90a034dd861f50cde7b41ba64df79d
    -                b6c288947156685454739621b526565851d66ad7a47929a97bf82932664db663
    -                550b4cea602c3afd0691cb363df0f8f1858d7296bc99d490df0ca5b5bc5d2a69
    -                ec20f1f85634b7a87b82b4d293d6996fa02678af04e42801871aa56138465452
    -                7f699809d424f62b3d0e4a4e106c3dec086854ba3f61d0edb799612df24ea4a6
    -                a07a7811abd4968500e344948d1293baf4d6a194905d5c526b16e4c4ff28bfb9
    -                b9e03d7a9f184c06441b0631f781f56d5a51f62f3fbc7c3769e32f68d623f406
    -                94fe7179b89289c24493041f4e2c653173cf3a8b2051453d31422bdd50af4a81
    -                2e7bdf63d04765a1ea6a397797a827b7c5ac38d58a7f6196ba5db478dad6c031
    -                143f7684b771a4fb7999152a69106c72642742d892233147e085f5e4793850bf
    -                a83660db5b53df4e67edbc37b4a6a076c419e02ed54b923d708f16d8561c5abb
    -                a10fde6c6043f88137bf80672273924336a81be63d44ec26a4afa761164a0c09
    -                640b1aff3ba0f4dc43d16b382d1135a57936a150323ea3587717a3dd0a8111b0
    -                0b875aed7c7be5250fd2ef9bfb968293ca8121d227efb07b8dff9dc819e6a5f7
    -                459fa5ea01f62b2a8e278e9ef2a7029b08df3a76198de1e840ddc15533195403
    -                197be0c8d1a086651e4dc09e3c59f4b3352662800af531e927b9e52e8a1d0631
    -                1df831a487760cfd6e7a713bdfb2a9326bea28f59067a989d1189889b8a6b9c4
    -                011f0d28113d9f6c2e506bd120bfc78223f6415cd657391dc3f9259e5d9f44b5
    -                4eae3ffbe634eb9880c16f6d67db25f0881fd59e5796c9152efc63c7cfd4e3df
    -                95b98f5aa6a9bce0615a34bf15114dd65e0f44ecc7835754ad6ddddc0f2b69f9
    -                2c41470fb6dbfcfdd1b61292b353665c6fe8601e120ce412bd643049802e3903
    -                f25504f80be1778e24d9166545e2da6552d4c409093a781e33447179fc260164
    -                8598234c932642aa4c307da2670c70fb4dbba29a4aa21fd2ff302364cb13bced
    -                84c0da69d60ce846095ef042f7213be8ff94c23b12e5e5f7bf4818c461355383
    -                c6fbb50e0988f992d82f75db4b98246aa6e6d50713c3b436add3b95670df646f
    -                ebe742cf69c6970b93c7acc86a868c979980e2dc313afcaa67d31ce5dd0c5d97
    -                b20f6fbaeaae2a1b2126e259c2d0b3268eaf96a6a42e3eb0dafb9780ec17c01c
    -                40a85efc413336bcae40324924a311b8645e6554004ac20d4c6334a505ae5c7b
    -                abec7871ee593d9ca8cfd9760417966892d916d9125a81822f96d3d3fb5ed343
    -                a6a8ac47a863dd3bdf502d9d5ffa040398788c446037b82e00392a00ebcc7c7b
    -                d81e85e5986422735ff38cb189dc7c24510a7287714d58aa7b3e645a9cd5bd44
    -                fe4a3573844f5df0ec015c83a15eb3c483b2570de8d105a1fdf6dea1edebd26a
    -                1b4303814b30f16bd064051d077f07e97e825372ed93a10d2022d2a8d93c085d
    -                862ad6006364ab5742fd3e3451ff62c1e8c966d200e18f3f55d79d1ea49d62ee
    -                cd2e2a6202cda533761451e34b691d45b5a6b2227856dfe27cfe777aa9069717
    -                3341aaa79f07975b73cf8c5a26baffaa867f1d41e7d866895f1ac652c19db1df
    -                3124d5d89668032c62c6862aefe101158705e3c735bb1f211eb5faccb167a11f
    -                5f2e043d8c7ae469a28759f25cb477fbd237c44a33a74dd89723aae046ae56a0
    -                b15d415184f0bdd947961a7d3e66480cc3b51d0ca2c1db86c327b0d3270ba864
    -                ed76406b22dc6d107bc172fb9df3513e07ca6365389e41f4a746f56240b921fc
    -                464d1b28d047026abdf970f2767e114da3ff0355a9ab0932f3a9a3097520f9e9
    -                3bf3b03e9b460a7846afe5f316188fe17751857d3bb43ea3a506c974f5d0270a
    -                e519d5ad24b407372f0323730bedcd660f9abb0acc1221ca9e2b0259b1cf4ed8
    -                c64b74776399928598a216ce6ef437056bb752d437347978369b7a578bc41077
    -                d57a6aec7258aabd4c623c03b1c03f5c73931e675667d0c10970f5c620fdaf4f
    -                80d59b70908b30c7a40114d67e92eb93ea34944fd12d6cc7df10bc0d1227999a
    -                200d3a9e92a01a8736ee839d0e72e59a709581e58c6bb03ff7585171f534b97c
    -                4a88937cb7c6a6bb9b1572fd3c2312057ff5986fbb4119a440600496497a91d3
    -                ab0e2b5a744eab30325471539fa9116fae25fc74fd17eb1b75329850ceeefc05
    -                20fc7dbbb35a679cc0c813a19abd5a5730d5b9f0c0bc08d2bbcaffaca6e7b670
    -                1b9f5dcced66b888e93f27c1586e3eb3637e75664f8b88fa2ea8408cf5b90a0d
    -                c9fe016cb773fc85e0b4c5e37a4dd9320fed177e0718862be9a1535274b70668
    -                eeae69369e3746dbea3e3b459f4d20d4fdfc534d5c79517b9c74d4095e4388a9
    -                b3c7ed169f83a079bf4a883cb2bf5d88b9196667f3e2eddc26ea24f192e5ee3e
    -                f68712a78d1ad086eb776a9be9b0301e50e019fb78c70ada132ab3a5bfd6df92
    -                e8a78d837f96ac5e7ff5ae5284d4add69b857bbe06312ac0f579d7f1d537ef5d
    -                b6cb3f775f6a40c85a57ba0f999196368eb0939e68fabfc913d29ff979a1a3e8
    -                74706d3448d12c2eac1f520d5c833138c67233a6109bc3f13d1c9a763c795cbd
    -                cf94a0682257a16401deecb7dc787be82ebec9938df10b1d7ffa147661b11a13
    -                2ed1a432ba87fd76a5be4ac11ebc04e7c151d37b9031e35a9cb7890c2dccaf88
    -                786f3186acbc3fa033ef3fcdf1a670453b07bb1e4bd96e0bd77749ba9c1ae577
    -                b5499b24430d7b3d3786a4dd04c7d69fd052f4a192bd58048b4aea01ad7a14a5
    -                45301c513045cffac021dd9a8640b184b86f915b5967a0996cd6e706e776da68
    -                00000006
    -                180968d5c2d73bddf40eb18e436c809891d2689205550e01993e1b9c0c767575
    -                2dd3d8c2c702aecf34ad3ef16e03b398f1e3d66e490c3d6e086bfbeda5efe599
    -                4cfa5b469a145858df60fed7c71fe8c1fbdf5fbbe5dbe85c9a51016bd9ccbe9b
    -                6bea3b494da9d308c8a85db2fa6848c7db1881615a99b452484c67f96be55785
    -                7b43336be8ff52c5ce5291806e2118337f9a25b26029ec4d1d8023961a5424a5
    -                ecf2b18beac1653790736e6f6a5c7a95ab77caf54ea06c0c11ad6981a2af0b7c
    -                a3e964dc09397caf0e78a63d57aeb5c3acb9c65894b134092a2643d992d53107
    -                5c43c911d5577be8fe88fa023a3e36f32f9333e3c6207ca1b0018c0e0f389827
    -                a7a4cb92d8b054a206adec09b35ea6615069fc7d49132549bab5548b9e1fe61d
    -                2b7a9ba0d6d3e0336f17f3caa18e0ea19d6cf0a9c0e48a83cf325369b6a091ba
    -                """);
    -        }
    -    }
    -
    -    // LMSigParameters.lms_sha256_m32_h20, LMOtsParameters.sha256_n32_w4);
    -    // LMSigParameters.lms_sha256_m32_h15, LMOtsParameters.sha256_n32_w4);
    -    @State(Scope.Benchmark)
    -    public static class test10 {
    -        byte[] pk;
    -        byte[] msg;
    -        byte[] sig;
    -
    -        @Param({"h20_w4_h15_w4"})
    -        private String test;
    -
    -        @Setup
    -        public void setup() throws Exception {
    -            pk = decode("""
    -                00000002
    -                00000008
    -                00000003
    -                cc453a482bbabfad998dbbacf34c0d89151995177fd38cdfa301b645fbad1675
    -                ff8083187b30a36242b11bac4bbb7e0c""");
    -            msg = decode("""
    -                466f75722073636f726520616e6420736576656e2079656172732061676f206f
    -                757220666174686572732062726f7567687420666f727468206f6e2074686973
    -                20636f6e74696e656e742061206e6577206e6174696f6e2c20636f6e63656976
    -                656420696e206c6962657274792c20616e642064656469636174656420746f20
    -                7468652070726f706f736974696f6e207468617420616c6c206d656e20617265
    -                206372656174656420657175616c2e204e6f772077652061726520656e676167
    -                656420696e206120677265617420636976696c207761722c2074657374696e67
    -                20776865746865722074686174206e6174696f6e2c206f7220616e79206e6174
    -                696f6e20736f20636f6e63656976656420616e6420736f206465646963617465
    -                642c2063616e206c6f6e6720656e647572652e20576520617265206d6574206f
    -                6e206120677265617420626174746c656669656c64206f662074686174207761
    -                722e205765206861766520636f6d6520746f206465646963617465206120706f
    -                7274696f6e206f662074686174206669656c6420617320612066696e616c2072
    -                657374696e6720706c61636520666f722074686f73652077686f206865726520
    -                67617665207468656972206c6976657320746861742074686174206e6174696f
    -                6e206d69676874206c6976652e20497420697320616c746f6765746865722066
    -                697474696e6720616e642070726f70657220746861742077652073686f756c64
    -                20646f20746869732e2042757420696e2061206c61726765722073656e736520
    -                77652063616e6e6f742064656469636174652c2077652063616e6e6f7420636f
    -                6e736563726174652c2077652063616e6e6f742068616c6c6f77207468697320
    -                67726f756e642e20546865206272617665206d656e2c206c6976696e6720616e
    -                6420646561642c2077686f207374727567676c65642068657265206861766520
    -                636f6e73656372617465642069742c206661722061626f7665206f757220706f
    -                6f7220706f77657220746f20616464206f7220646574726163742e2054686520
    -                776f726c642077696c6c206c6974746c65206e6f74652c206e6f72206c6f6e67
    -                2072656d656d6265722c20776861742077652073617920686572652c20627574
    -                2069742063616e206e6576657220666f72676574207768617420746865792064
    -                696420686572652e20497420697320666f7220757320746865206c6976696e67
    -                2c207261746865722c20746f2062652064656469636174656420686572652074
    -                6f2074686520756e66696e697368656420776f726b2077686963682074686579
    -                2077686f20666f75676874206865726520686176652074687573206661722073
    -                6f206e6f626c7920616476616e6365642e204974206973207261746865720a0a
    -                """);
    -            sig = decode("""
    -                00000001
    -                00000000
    -                00000003
    -                ae258cca017619f7c85179c0dde1f48122fe5b3adcd5ca14475308c6d6a87c8c
    -                6cbbbca7a2dbe83a7fa7a0814e3d692b66bec046ed590831e695e0391c0028c4
    -                9cd5e4e561c983d1640fe534964a4e5725705a4d907f5088b265e329011b8047
    -                330fcf0030724ce62edb5382e59af394eee06b0fe84d95ff8d22b0ba06c31876
    -                b85d29135bd4291f49db0f22c1a304ecdea5137b6b59c49cb053c6ec32b276f2
    -                9dea3ffe6c10f3e99e84b00221bdf587f703e81ffa90e9835839b693fc3e2b06
    -                1cb47c8e3392750c4f53461e419e151004df01da6d8bf8a7998e88089d18c487
    -                d1adabe4050214ae3c5aff0b2e7de19a734d6cc06ff060c5ca4ad5c68178fc7c
    -                bb66b7de65987ce1dc966f1a2f9fbe301f43e6790df0fa452884b3b9ea30fd33
    -                689cf76ae7eb4f6c79f6fae9e89cd9d0349928757dcdee074eacfeb3e1860d0f
    -                1e8f335be9d0ad131da1932730fbe5997a813439920d53c4a36c6ebbc4a2b8d6
    -                96fd511a6b92404421674f1b1b79298243c60bd524cfca71057377b0d0c318fd
    -                341759a91f4b47f5b0df61d1eb1533982707970789297a1af0bb2fedf8fbd582
    -                87708cc4c3304246313b323df92f36fa6fa516c333197253c860b2ea4eb92cef
    -                aa33311f2b9b3af958d67a9e466357f671a1255530fff1c2a7d976c26837bfd5
    -                d7d9d6ea5f87c81abedf1e1b83602250e2226f54eb8f3f1e00bcfcf241e655e1
    -                bf79b0d57b947c196f6c33360d303735d323406411416cd1fb2391d3adbbf0e4
    -                f0ac38767fc2e9ebcec97a5c80712bef5deeaad9c85fc4d024ffe7cba0608c98
    -                90b023852af96a6dfca090187a4f07447d89b1162d0a65e4cc7e2481b057e199
    -                0ed2ee333d2c4f26c6321e2b98017fedc0b42202caf469405678a63108359387
    -                aa240fe210d833914423e02d892fe26290dc2ba89bebdaa2273fe265b5d518dd
    -                5b406c33656466f865c1ffd671b46e2b9044c256798afb1e1d49dfc025aefc06
    -                d6cb1a968c5bb3e200944de6a81bce2ee450559fa3e302effeff2b4e919539ff
    -                3bbeca0575eb8abdc635fd330c1606b1c810029ed55d8a71253ca89587762629
    -                1aa537e4b0c155e7acbac37d1e447586adc56ad262b0ab2421291a28b4e664c1
    -                70750274d82b7850fdf745374c2c2eedf9828300b3b2b9f8d2d774063658ad05
    -                92ed8b8a26e8021ed63f413996d1c12c6a5e80a4fd1f6ede5f431974147d9116
    -                c356e49fb7cda7d35bde52b1c0efdab1dfea8db8b13c608a5545723ee3611456
    -                b21da6a343ca0c432a2353dbf926e2f3227e9659618cc6b46f46da614666f33f
    -                1d979c6d838b678fb027a2ea5ae601592cb28efe10918509418476639bfd1f0f
    -                7dd8bf91f7b28499dc72039218bfe37595e1741942e4a2f640a92dacd809521d
    -                df34aa2b549d2b666089a9df02d963347d565cc5fa1af7f700237db8a57f0cee
    -                4be997ef40f8ae0631877d07b71a4a76d3f6f53a737f14e2fb0f2222e8649144
    -                c3f8ac33595fd9290a2a0345eb1e4c06187ca4b5ac77098e473a07fe0cb58d88
    -                1967f7f645ae144a289744b0801165e9c47d5137f79d3538d6f3a45c962d06a0
    -                13248d125cc52ebd2f3e4ced0d7c1e2429425da6b6aedf96db2c2524522e95a1
    -                dd83db37e92f782b6db3c84ed3f55f32600003d9602c17b6280fc735787f8381
    -                853d02d4b03a97a9404bfe6cd4c58c1a67a70298f29094b454aeb1bc0d59e0d5
    -                e24015f9257d28554905003a687444ce51b19b7e46f4e56e899e3ecdb9415119
    -                924b0a28f383b7e8f817c6430dd9c7b13b6f93179f77c5678fe51098e4c0425e
    -                7d44cd2e82c07bff8b8e99ed08d86982ef7680f8ac3ac2228dd286a1acad546d
    -                43fed64175190ecc62f1662a2f2c29cf2effdc9f9a18e681e96cce1bfb41de22
    -                5b3c02ba65b4c5cc5591d5b17b64a3e8df530ea10627ed29d096f30934d10954
    -                a642548ff04651c9f24ba9c0496bdc1a8af76afc27eb3dc9e28247ab5fa7274f
    -                0cffad5af2cf50ecc35f0b466fd7b8c6973d1ace0cbde0d793cac473ff151aa8
    -                c9bc3d26beb8d819f21ed0ff1fe6af5be4cb4c61e1ed6897496fbbba14f2719d
    -                721742fa7249dd251e501b98936ab43d0fcf4b7a2d551471d3e663595e19e235
    -                674d7d525b6a5ae14ac45913cbfc51e80a7fe351d0cb24a8af1b970d309517df
    -                7a7dd6b12c6edbaab5addb1711abca1c412eb7270e9a8aeefbf7cc5ca22436dc
    -                75b0b5989e1c25f578f8d0aadbde0175e67b14ab05a4c5a5e061a030282f5415
    -                4eebb5a717854b02877ac1fbbb732e52b18dbecaacf16bbb74954f83c0aa470e
    -                35d099b7efb1e17beeeb87ec0b9e706c331f1b20f0a903dec2b7ca1c196b1d63
    -                e804513d3f474cbe6f9bbd2900b79b073011004c49d20f7420a01b7745d490c1
    -                0da63786119d895d58b44eb066d80c88907aaa211dfd82681634be98400099db
    -                8cb82b6d6172478cc2e63d4ea6dd48b47702b24b6fc7b49e09d87b61d15b59d0
    -                39a6d49b3e4896ebe0c83c70ee6926d498ace6148ef3449a7830a7ed4923866a
    -                3f479a708a7dc319c1161d0f29cf425682c389bb173f7681c193ac982c1e4012
    -                6a122b2c6e3fd20906c2921987b2a20d21c722c5fe899fc15089e7b7ddce4262
    -                be8acc27fc4b4b5176740f8f3adcf44240fd1d92c5b1db869bf0bc957175fad6
    -                2d8ad0368b9b47da61e5afffc4ed80ea49890178232dd021d94af7b15bd45059
    -                67bd91eaa2844169e89320c92914e27eda9800cb81b8ff11a52043439035a275
    -                53cf146c9c765b3d5f13bd348475a8bf9b3021168364b7cf0b35b4a2df95adda
    -                7d1d386021d0ddf9193934ae4f0958d2ef8b15a0278e5234aaa976a8ac6acc45
    -                7fff27c4d64da9d374ddccc55285069074ad79bedfb606c95a5d294e97a49571
    -                e4b89696b83a69b4c65568e7ba4b4da0903f819a75ee42f6539b4edd45a53dc4
    -                07c7028834837cb1665050f13b3f69560dec7f042d3d8979fb170257bc024764
    -                627d369086f127e1f5a95f45cf49817c2c699b8d0b20113259ed141e6c01e23e
    -                41a7bb7415f324ba3710534126db40da893b8df672bb16a752e873bc3203dd83
    -                00000008
    -                24bc09be9c410f127964bbf6430a7b42f53ffe22f04cde135d46a847de0844ac
    -                c15c1197f938dcb5adfdcceeb52f95ca113148d07192ab76d83185054df0b38d
    -                8f95cd789b916bf8f7d4b7094802df6ed52cc0573756df7258f12e439cfb1037
    -                01dd72bbdb60753be01822a1ea210eba7fdcea2c9736e79e11ce2e3b50f21a4e
    -                0d84d9c578bfcefb4087146a40c95922b2dd69d29103d9f50fe3368b19015172
    -                36922e837fe8bd50e8063e5f0c2d4a961f1816bf7a5b3eb7ba63761368cae83e
    -                f2fa4e03491acbbfd6d0a6048e3f2589e67aabeb32b3619085ff2d6a810065b0
    -                5a2f5526fe1f188ee80bdb9788f68c1e93cc2ea104e404faceef91fa6a28e27c
    -                e6c2a6a4b03b81c7ca9ce94f06ca7762cb344bc738add901e6496a3fe739343f
    -                aad8396b832ac93f039adad869401a2e590dda2d9c571e136b55053e8bd17af4
    -                2e5518ef8b8dea3d9fefb811e7248961af4f67921c5812bb87c27b22d1384109
    -                85f1f48d40e4c86a1cf7b1d47cb2c776aab2b980a8a1a5e14f6a6c3e823f8b91
    -                9d7de7705ba30357aad9b1d5e7c3404aee1fca2706bb97e94ee56ce826d631c0
    -                d03a93e676a557af5b3105c9cce0364907f1c7520a3a9d70ceef18bc86584df8
    -                c707e48982dcb6221aec3bbe75151d0c50662caf1b401466f089f464b23e4b10
    -                77f4c2ff6efd0ef42202fd51494093459329eccdf895e038c3f7e2325775c399
    -                4ee435f799d7cf0ba8308d018a1c748a5b96786d4b1090547165d30cd9e50c9e
    -                25122424b4d89b5f13949af9eadb7e9bfb95820bfd2053e339dd154593c8912c
    -                ede4bb64b3dad525f55bf6640d99876654d3a9666ab81b38f1e7d41036a2930a
    -                3b4ba370e6fb1cb4436eeffb3a1f4029eab69d47e328e3e50034e3facd1ab396
    -                00000007
    -                00000003
    -                ff29b4fe1b544b372b2922adf63187d1a8186efd415d82a993a79ecd884987fb
    -                984f03f786948f53a3632e75f622a334
    -                00000000
    -                00000003
    -                9818148e2b3f0b1b92424b8df20c31aaaf4d2d49997d481a2be32680e62eac63
    -                4dfc4d390876d14599c23d59822e0d6f525a9afbc8319f75de7370043d33e413
    -                7b9f1fbdaeb3e47bdbe29fb7e3247ee5a1c637bd739be597e5513b81e5b717bb
    -                593037bf97b4c1f216566a944bb19bdac86a5be82fc34eef1799e07d7035692e
    -                687024660a3a83fe17d73c919513c12660edd8af23975ba3816d027b7cff5e5e
    -                675f5375bb1eb6eed9e5cc49b962a97b1cf41d79422f2d8e290ff119d1cd562d
    -                e4f65dff4a7408b2eab21093d096707cbdbb70e8bf6394969e1e51700a500a98
    -                ca1fa371d96eb24b359db9af3d2a5e125e33b87edc22eca8764eefce39dae0b6
    -                db5504c256375a7b6bd8ffcaf48a1fa9b246bc9952f8374d8d65cf22439668b0
    -                3c02ef6fb4a1512dea8d7c38cbd8946114bbd57a0da2ffff326bb83873f4ea40
    -                09270671b0d9a88e10c9552ac580160d248daa7bc3a10cb393a1a2aca8ed55e6
    -                d6983861830557e7001d65d8656c07fa37b459a5bc3ff26c2109be9f395d1307
    -                8e27e75f85f388562f555060fc040650be7c5a4984bfb41fdf0ebc2da22a8719
    -                563aa522fe36af768d95d49da30c899f3409c8a6587403411eaf032a84354039
    -                1b136a795a0b3da15351ece2f62b7cc15d8f9e3bbacf29bd73e96c9761fd23ff
    -                ed75c8131721899b2b314c61537e3d324706de6dbb4adde305943ac6a2000e5f
    -                6e193f83b9381ade4d61a9ecb2591ece400ace7735eb6e0958d7d1c9b0ef4990
    -                2ec4592c935303c71049c44a518d65537cd903c95c37811501028a20b4aa4030
    -                2857c970a589260073ea093eb913a11ac42c67034d27fed38b300eede2ccb18f
    -                7df10d09d9cbeaccba52471fd01d42361343889e5725a7f2d23c723517337e94
    -                2f53fcefef8c4f091fc1a02790db7a987bdac6f67382619a84c003fb76f27e1f
    -                f070bb8b7786ce47d4455de311230a0e1dbccbb8bd37c45f36e84e3f15c1e4e9
    -                daa1b4a082f85a5c2c71371e39661792284357a7cc40451e39444e8c352185d9
    -                e7aa1e7524a1eff33b5839c2247b1430a517db6ef4963b23a1579a3803c0d2ae
    -                3568e0d83d551eb68dcd301e75f4cf38792cc504a94559c1b1a929975aaa38d6
    -                fee0aefd1aa4c99cb1412736b2f5978c21987e651e391c5b1e61cb84d92d3806
    -                cb5fe46edde39efbce75d0db86414e82f6ce07b6c304c7f7fa887d13a02e8f59
    -                57b8f07ae9b80a10b3f050902a230e5b33230473691af8c7c2630d899c8efa1e
    -                da5afd1db629318736132466c1970f9753200e05a30ee13e38b4a60e15fbac33
    -                986a6e7760c5805b4f488580db0008e574e173a34cc62fd52c9cd56980249a2f
    -                0c12238a0df04a06dc9895413b31fd0aa0d9eee50ce7fbc178f8719bd9df399f
    -                ce72a57e8571fcbfa4f174f0c37c053238bb9225d480547b34eaff09d00fd29a
    -                d2daf5b694ba4ca8a25e42f14f2cd7c10477ed29b22936989cb7135c8034f81e
    -                2552fd1d15f54ae69054fa03a36ff48d1ccec9c45dcf642dd4bd0e2aed42d4bc
    -                b3df5f9a10805347ec0524c13d49014ca1d983d7de40031f530a34ca1e8ba45b
    -                5b304303a71942388b61779ec6ecefab91cdf705c41d6c2fe72a6be231acc3b5
    -                496661b0d9f5908d0f39463b785a98348a0f9fcf714255e6d9c9c33549541567
    -                55980f2d96686e98f5a990f821504cf2a1c32d2b654f0071dfd85981d59da1a0
    -                ecac2d30b1e2833ea108982aeb059d8c2b7facbcc4391bdd88f900cfae20cfcf
    -                99fc75fd68a85bee6a75be7cf8f4b8a66d9bcab17094e51e745c9b8980b69cfc
    -                4d9bbacf338fbaddad1fbcee745ce30b8ea8316e597350bf1372353d38274c31
    -                34c9e3ddb3affb1f5d5b30a51c3dbbd7529446f4bba26eadf4aa53e7641f70ea
    -                60710d773b02d930a298f8c6957b71f6841a6391ae9d5d2ebee3600061c57244
    -                7ff9e16c211a5b71ab1e7ee811f70a76aaf8617648083959b327a8f15698ba87
    -                3387b492ae7a7ada5d78ae4fdfce67262cacdcaa0717c4e52d7ecd85491903db
    -                f64073dbc2a0f77ba5489f0af146ce8d4e1544f60cc51d2a9db84eb5d8b3da91
    -                c10ad2437744c8b3077d592e5b42baa7846d4250df4c98112b688813988a6759
    -                2fe7b707276dfbcf7cbe3daaf0be3c8c13917d4f2c70c6b6945e05457ce7018e
    -                c167bebefce80d10502f5a2164492a8602ee7db978c51f79612b5b9d69013105
    -                05bdcbbb66a385ed2702a630303fcc30900b8d9c345229f7d539185cd2cca328
    -                d40dbdf3511715cdf195c7565bfcd7ae7830374d4c77acf746874068f7f0ec3f
    -                bc22fdbd06fbd4a4bc018d6a81bdf9c5f3ec45c441333cee36e2f3d28f4d4ac4
    -                e45299a3ea7151e2f314ce1d8c7f8aff7be4886bf8ab8de2893f17baf2969125
    -                d4b8e4f036b3b60c88e0c08450a8e7ed005831f2030760d4a97c419a859ded43
    -                85e855bed5b966d1a97845fe8a6dc7467a2529ea005fbf0da3fd3efa28142c92
    -                058dcec7ec1e1f199ac8c777857295b34a33e2b678c04475b7dfeda7656dcc5c
    -                b948ff2368e989a4688c16ba02479ccb107f6fb27dc30f0e49b9641aff149d07
    -                c6afd31db92c8a5d0c0f4234aec0c0e1e05c7336378b387d1a70a4176dee6835
    -                74811cce4b20f0730ef92932d1d790b6cf73081da8c51b75ba8950579b92c117
    -                567f3a1fd8a049685a7aacd9cbb997a0aff7e6a34ea7e70fc8cf24b11f96d2f9
    -                ef5327eba013bea5cff327f3a5aece1b8a2fb45f80c2454a9cba86a55a1ef63c
    -                7862d07eb1274fb68b69db5a0cab9b5aba53595f6e0cf643efbf38ed33e7bdb7
    -                3f887e8bc0e50c003bb8523b7aa459bd0517fd3b502ad4fdaa22010cb6ac5bf9
    -                7d6ad67c2317a9d18fa8efc4c02345bba30bdfeb788c001ff4f9a899b0d11043
    -                454b52fc2828fc1891e149b42ef897608d95f568f3eb301023dbf18f40da3148
    -                45821078487199e71a6b48b2105851702fb6319052ca642ed6338c41cc8b3d95
    -                b101a08835e9352f71938d24f8789d32add82e7ede0fd1858330a451015f7e87
    -                9c5eb59c8e534beb771aee8b0fb2bf4937fdc9cf07d891ccda61ae4aad303282
    -                00000007
    -                2e0e7708bb0e589d2d818a8c0e2c53b3e59b9e43c7a194fd18d19ab1554a9f85
    -                90b31f08e2fe1b38486572cc3b36ddaa9d85b795fcd93acd531283688191b5f5
    -                a744b89faae49989127685cdc000e001a0d77df3a5c3061e312377b1050e7371
    -                24a68d2a00a848e141d274dccb8e4740d33ef7970494ed316447f8381ba06791
    -                001e90b7f36ef24e1dbbd68f7074ddd233d9e15cbd4efa4a249cb30fd3095c3d
    -                ed096e87d6c179ff8dbadb1bc6493bb6f944ccee2cbf24573017817e586475f0
    -                ed51bfe889b298a2fb76d16dde0c966a70a284dafa980442f870d640e11079d0
    -                a4f6834a62ba0a4eac4d7334f3c756ea6b0bd8eafad227b5b8eb4e937c32412f
    -                201780dbf5eab317f3a21293e653115bbffac4899830eb28e6e43c1a77b51884
    -                8f68887ccfa366175be2a88d3fc178e671073736bd94eb4e16720a6b3ee119b6
    -                dcba885ecb46126614c7a677c1662c4cadcda742f27fc01a8bd5af474ee4a29b
    -                4e25721bb931b8bf898afb3cb66d3fcab70b80005e737ec5bd88d5ced8941226
    -                720dd43655a9ba1d4bf0a723faa4bb3651ed2ea7e0bd08113e524777e6ec592a
    -                ba5cab16b084d208d20bf25ad9a7ae31bceb00b07ef20cab7d1f6883ac331c75
    -                a2aefb8230ae97dc34577785b123af406040d01fd072c493228d7583cd023c25
    +                2510a21e43c9b53b86557646b2c891ba432813ca61fffb57c4a8e598753542c1
    +                a179d3af5254a37c01eeb4393d626771858d06041c76f1960e754e9e04aeb91b
    +                1d9b7736193f49e15c47f44a8f1c8aca6133c34eeb682fdccf94886fe80d971a
    +                b4a0bb3b72197d2d5b2111da8647be1675983e8ed1c0d8ec7cada282dc698656
    +                95f1e8806c7892b65fc17103ee3b5366b3fe31e57e653336be283962f488eaa5
                     """);
             }
         }
    @@ -1844,78 +376,6 @@ public void setup(test02 test) throws Exception {
                 v = getVerifier(test.pk);
             }
         }
    -    @State(Scope.Thread)
    -    public static class verifier03 {
    -        Signature v;
    -
    -        @Setup
    -        public void setup(test03 test) throws Exception {
    -            v = getVerifier(test.pk);
    -        }
    -    }
    -    @State(Scope.Thread)
    -    public static class verifier04 {
    -        Signature v;
    -
    -        @Setup
    -        public void setup(test04 test) throws Exception {
    -            v = getVerifier(test.pk);
    -        }
    -    }
    -    @State(Scope.Thread)
    -    public static class verifier05 {
    -        Signature v;
    -
    -        @Setup
    -        public void setup(test05 test) throws Exception {
    -            v = getVerifier(test.pk);
    -        }
    -    }
    -    @State(Scope.Thread)
    -    public static class verifier06 {
    -        Signature v;
    -
    -        @Setup
    -        public void setup(test06 test) throws Exception {
    -            v = getVerifier(test.pk);
    -        }
    -    }
    -    @State(Scope.Thread)
    -    public static class verifier07 {
    -        Signature v;
    -
    -        @Setup
    -        public void setup(test07 test) throws Exception {
    -            v = getVerifier(test.pk);
    -        }
    -    }
    -    @State(Scope.Thread)
    -    public static class verifier08 {
    -        Signature v;
    -
    -        @Setup
    -        public void setup(test08 test) throws Exception {
    -            v = getVerifier(test.pk);
    -        }
    -    }
    -    @State(Scope.Thread)
    -    public static class verifier09 {
    -        Signature v;
    -
    -        @Setup
    -        public void setup(test09 test) throws Exception {
    -            v = getVerifier(test.pk);
    -        }
    -    }
    -    @State(Scope.Thread)
    -    public static class verifier10 {
    -        Signature v;
    -
    -        @Setup
    -        public void setup(test10 test) throws Exception {
    -            v = getVerifier(test.pk);
    -        }
    -    }
     
         @Benchmark
         public void verify01(test01 test, verifier01 v) throws Exception {
    @@ -1925,36 +385,4 @@ public void verify01(test01 test, verifier01 v) throws Exception {
         public void verify02(test02 test, verifier02 v) throws Exception {
             HSS.verify(v.v, test.pk, test.msg, test.sig);
         }
    -    @Benchmark
    -    public void verify03(test03 test, verifier03 v) throws Exception {
    -        HSS.verify(v.v, test.pk, test.msg, test.sig);
    -    }
    -    @Benchmark
    -    public void verify04(test04 test, verifier04 v) throws Exception {
    -        HSS.verify(v.v, test.pk, test.msg, test.sig);
    -    }
    -    @Benchmark
    -    public void verify05(test05 test, verifier05 v) throws Exception {
    -        HSS.verify(v.v, test.pk, test.msg, test.sig);
    -    }
    -    @Benchmark
    -    public void verify06(test06 test, verifier06 v) throws Exception {
    -        HSS.verify(v.v, test.pk, test.msg, test.sig);
    -    }
    -    @Benchmark
    -    public void verify07(test07 test, verifier07 v) throws Exception {
    -        HSS.verify(v.v, test.pk, test.msg, test.sig);
    -    }
    -    @Benchmark
    -    public void verify08(test08 test, verifier08 v) throws Exception {
    -        HSS.verify(v.v, test.pk, test.msg, test.sig);
    -    }
    -    @Benchmark
    -    public void verify09(test09 test, verifier09 v) throws Exception {
    -        HSS.verify(v.v, test.pk, test.msg, test.sig);
    -    }
    -    @Benchmark
    -    public void verify10(test10 test, verifier10 v) throws Exception {
    -        HSS.verify(v.v, test.pk, test.msg, test.sig);
    -    }
     }
    diff --git a/test/micro/org/openjdk/bench/javax/imageio/plugins/jpeg/LargeJpegReadWithProgressBench.java b/test/micro/org/openjdk/bench/javax/imageio/plugins/jpeg/LargeJpegReadWithProgressBench.java
    new file mode 100644
    index 000000000000..70f8020f358c
    --- /dev/null
    +++ b/test/micro/org/openjdk/bench/javax/imageio/plugins/jpeg/LargeJpegReadWithProgressBench.java
    @@ -0,0 +1,166 @@
    +/*
    + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
    + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    + *
    + * This code is free software; you can redistribute it and/or modify it
    + * under the terms of the GNU General Public License version 2 only, as
    + * published by the Free Software Foundation.
    + *
    + * This code is distributed in the hope that it will be useful, but WITHOUT
    + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    + * version 2 for more details (a copy is included in the LICENSE file that
    + * accompanied this code).
    + *
    + * You should have received a copy of the GNU General Public License version
    + * 2 along with this work; if not, write to the Free Software Foundation,
    + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    + *
    + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    + * or visit www.oracle.com if you need additional information or have any
    + * questions.
    + */
    +package org.openjdk.bench.javax.imageio.plugins.jpeg;
    +
    +import java.awt.Color;
    +import java.awt.image.BufferedImage;
    +import java.io.File;
    +import java.io.IOException;
    +import java.util.Iterator;
    +
    +import java.util.concurrent.TimeUnit;
    +
    +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.Scope;
    +import org.openjdk.jmh.annotations.Setup;
    +import org.openjdk.jmh.annotations.State;
    +import org.openjdk.jmh.annotations.Warmup;
    +import org.openjdk.jmh.infra.Blackhole;
    +
    +import javax.imageio.ImageIO;
    +import javax.imageio.ImageReader;
    +import javax.imageio.event.IIOReadProgressListener;
    +import javax.imageio.stream.ImageInputStream;
    +
    +/**
    + * Measure time taken to read large jpeg image
    + * make test TEST="micro:javax.imageio.plugins.jpeg.LargeJpegReadWithProgressBench"
    + */
    +@BenchmarkMode(Mode.AverageTime)
    +@OutputTimeUnit(TimeUnit.MILLISECONDS)
    +@Warmup(iterations = 5, time = 1)
    +@Measurement(iterations = 5, time = 1)
    +@Fork(3)
    +@State(Scope.Benchmark)
    +public class LargeJpegReadWithProgressBench {
    +
    +    private static final File pwd = new File(".");
    +    private static ImageReader reader;
    +
    +    @Setup
    +    public void setup() throws IOException {
    +        BufferedImage src = createSource();
    +        ImageInputStream iis = prepareInput(src);
    +        reader = null;
    +        Iterator it = ImageIO.getImageReadersByFormatName("jpeg");
    +        if (it.hasNext()) {
    +            reader = (ImageReader)it.next();
    +        } else {
    +            throw new RuntimeException("Could not find JPEG reader");
    +        }
    +        reader.setInput(iis);
    +        ImageReadProgressListener listener = new ImageReadProgressListener();
    +        reader.addIIOReadProgressListener(listener);
    +    }
    +
    +    @Benchmark
    +    public void readLargeJpegImage(Blackhole bh) throws IOException {
    +        reader.read(0);
    +    }
    +
    +    private static BufferedImage createSource() {
    +        int width = 2000;
    +        int height = 2000;
    +        int squareSize = 20;
    +
    +        Color red = Color.RED;
    +        Color green = Color.GREEN;
    +        BufferedImage image = new BufferedImage(width, height,
    +            BufferedImage.TYPE_INT_RGB);
    +        for (int y = 0; y < height; y++) {
    +            for (int x = 0; x < width; x++) {
    +                if (((x / squareSize) + (y / squareSize)) % 2 == 0) {
    +                    image.setRGB(x, y, red.getRGB());
    +                } else {
    +                    image.setRGB(x, y, green.getRGB());
    +                }
    +            }
    +        }
    +        return image;
    +    }
    +
    +    private static ImageInputStream prepareInput(BufferedImage src)
    +        throws IOException {
    +        File f = File.createTempFile("src_", ".jpeg", pwd);
    +        if (ImageIO.write(src, "jpeg", f)) {
    +            ImageInputStream iis = ImageIO.createImageInputStream(f);
    +            f.deleteOnExit();
    +            return iis;
    +        } else {
    +            throw new RuntimeException("Unable to write jpeg image");
    +        }
    +    }
    +}
    +
    +class ImageReadProgressListener implements IIOReadProgressListener {
    +    // This class is a no-op, it is added just to have a progress listener
    +    @Override
    +    public void sequenceStarted(ImageReader source, int minIndex) {
    +
    +    }
    +
    +    @Override
    +    public void sequenceComplete(ImageReader source) {
    +
    +    }
    +
    +    @Override
    +    public void imageStarted(ImageReader source, int imageIndex) {
    +
    +    }
    +
    +    @Override
    +    public void imageProgress(ImageReader source, float percentageDone) {
    +
    +    }
    +
    +    @Override
    +    public void imageComplete(ImageReader source) {
    +
    +    }
    +
    +    @Override
    +    public void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex) {
    +
    +    }
    +
    +    @Override
    +    public void thumbnailProgress(ImageReader source, float percentageDone) {
    +
    +    }
    +
    +    @Override
    +    public void thumbnailComplete(ImageReader source) {
    +
    +    }
    +
    +    @Override
    +    public void readAborted(ImageReader source) {
    +
    +    }
    +}
    diff --git a/test/micro/org/openjdk/bench/javax/imageio/plugins/jpeg/LargeJpegReadWriteBench.java b/test/micro/org/openjdk/bench/javax/imageio/plugins/jpeg/LargeJpegReadWriteBench.java
    new file mode 100644
    index 000000000000..8a84eab4da7e
    --- /dev/null
    +++ b/test/micro/org/openjdk/bench/javax/imageio/plugins/jpeg/LargeJpegReadWriteBench.java
    @@ -0,0 +1,141 @@
    +/*
    + * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
    + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    + *
    + * This code is free software; you can redistribute it and/or modify it
    + * under the terms of the GNU General Public License version 2 only, as
    + * published by the Free Software Foundation.
    + *
    + * This code is distributed in the hope that it will be useful, but WITHOUT
    + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    + * version 2 for more details (a copy is included in the LICENSE file that
    + * accompanied this code).
    + *
    + * You should have received a copy of the GNU General Public License version
    + * 2 along with this work; if not, write to the Free Software Foundation,
    + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    + *
    + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    + * or visit www.oracle.com if you need additional information or have any
    + * questions.
    + */
    +package org.openjdk.bench.javax.imageio.plugins.jpeg;
    +
    +import java.awt.Color;
    +import java.awt.image.BufferedImage;
    +import java.io.File;
    +import java.io.IOException;
    +import java.util.Iterator;
    +
    +import java.util.concurrent.TimeUnit;
    +
    +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.Scope;
    +import org.openjdk.jmh.annotations.Setup;
    +import org.openjdk.jmh.annotations.State;
    +import org.openjdk.jmh.annotations.Warmup;
    +import org.openjdk.jmh.infra.Blackhole;
    +
    +import javax.imageio.ImageIO;
    +import javax.imageio.ImageReader;
    +import javax.imageio.ImageWriter;
    +import javax.imageio.stream.ImageInputStream;
    +import javax.imageio.stream.ImageOutputStream;
    +
    +/**
    + * Measure time taken to read large jpeg image
    + * make test TEST="micro:javax.imageio.plugins.jpeg.LargeJpegReadWriteBench"
    + */
    +@BenchmarkMode(Mode.AverageTime)
    +@OutputTimeUnit(TimeUnit.MILLISECONDS)
    +@Warmup(iterations = 5, time = 1)
    +@Measurement(iterations = 5, time = 1)
    +@Fork(3)
    +@State(Scope.Benchmark)
    +public class LargeJpegReadWriteBench {
    +
    +    private static final File pwd = new File(".");
    +    private static ImageReader reader;
    +    private static ImageWriter writer;
    +    private static BufferedImage src;
    +
    +    @Setup
    +    public void setup() throws IOException {
    +        src = createSource();
    +        ImageInputStream iis = prepareInput(src);
    +        reader = null;
    +        Iterator readerIterator = ImageIO.getImageReadersByFormatName("jpeg");
    +        if (readerIterator.hasNext()) {
    +            reader = readerIterator.next();
    +        } else {
    +            throw new RuntimeException("Could not find JPEG reader");
    +        }
    +        reader.setInput(iis);
    +
    +        ImageOutputStream ios = prepareOutput(src);
    +        writer = null;
    +        Iterator writerIterator = ImageIO.getImageWritersByFormatName("jpeg");
    +        if (writerIterator.hasNext()) {
    +            writer = writerIterator.next();
    +        } else {
    +            throw new RuntimeException("Could not find JPEG writer");
    +        }
    +        writer.setOutput(ios);
    +    }
    +
    +    @Benchmark
    +    public void readLargeJpegImage(Blackhole bh) throws IOException {
    +        reader.read(0);
    +    }
    +
    +    @Benchmark
    +    public void writeLargeJpegImage(Blackhole bh) throws IOException {
    +        writer.write(src);
    +    }
    +
    +    private static BufferedImage createSource() {
    +        int width = 2000;
    +        int height = 2000;
    +        int squareSize = 20;
    +
    +        Color red = Color.RED;
    +        Color green = Color.GREEN;
    +        BufferedImage image = new BufferedImage(width, height,
    +            BufferedImage.TYPE_INT_RGB);
    +        for (int y = 0; y < height; y++) {
    +            for (int x = 0; x < width; x++) {
    +                if (((x / squareSize) + (y / squareSize)) % 2 == 0) {
    +                    image.setRGB(x, y, red.getRGB());
    +                } else {
    +                    image.setRGB(x, y, green.getRGB());
    +                }
    +            }
    +        }
    +        return image;
    +    }
    +
    +    private static ImageInputStream prepareInput(BufferedImage src)
    +        throws IOException {
    +        File f = File.createTempFile("src_", ".jpeg", pwd);
    +        if (ImageIO.write(src, "jpeg", f)) {
    +            ImageInputStream iis = ImageIO.createImageInputStream(f);
    +            f.deleteOnExit();
    +            return iis;
    +        } else {
    +            throw new RuntimeException("Unable to write jpeg image");
    +        }
    +    }
    +
    +    private static ImageOutputStream prepareOutput(BufferedImage src) throws IOException {
    +        File f = File.createTempFile("dest_", ".jpeg", pwd);
    +        ImageOutputStream ios = ImageIO.createImageOutputStream(f);
    +        f.deleteOnExit();
    +        return ios;
    +    }
    +}