diff --git a/.github/actions/build-jtreg/action.yml b/.github/actions/build-jtreg/action.yml index 0ba9937fb45..a9c046e9dd9 100644 --- a/.github/actions/build-jtreg/action.yml +++ b/.github/actions/build-jtreg/action.yml @@ -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 diff --git a/.github/actions/get-bundles/action.yml b/.github/actions/get-bundles/action.yml index 270d15159a0..a356aa9fd8d 100644 --- a/.github/actions/get-bundles/action.yml +++ b/.github/actions/get-bundles/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/actions/get-gtest/action.yml b/.github/actions/get-gtest/action.yml index d38d33eabd8..7a329460a6e 100644 --- a/.github/actions/get-gtest/action.yml +++ b/.github/actions/get-gtest/action.yml @@ -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 diff --git a/.github/actions/get-jtreg/action.yml b/.github/actions/get-jtreg/action.yml index 4bb671d25d1..36c895fc59d 100644 --- a/.github/actions/get-jtreg/action.yml +++ b/.github/actions/get-jtreg/action.yml @@ -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 diff --git a/.github/actions/get-msys2/action.yml b/.github/actions/get-msys2/action.yml index d93b6e3763b..308230ebf2e 100644 --- a/.github/actions/get-msys2/action.yml +++ b/.github/actions/get-msys2/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/actions/upload-bundles/action.yml b/.github/actions/upload-bundles/action.yml index ca5366f3d6c..78fb0a94bfd 100644 --- a/.github/actions/upload-bundles/action.yml +++ b/.github/actions/upload-bundles/action.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.github/workflows/build-alpine-linux.yml b/.github/workflows/build-alpine-linux.yml index 0d366a4bdd0..c39962fa07f 100644 --- a/.github/workflows/build-alpine-linux.yml +++ b/.github/workflows/build-alpine-linux.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ on: jobs: build-linux: name: build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: alpine:3.20 @@ -96,6 +96,8 @@ jobs: --with-boot-jdk=${{ steps.bootjdk.outputs.path }} --with-zlib=system --with-jmod-compress=zip-1 + --with-external-symbols-in-bundles=none + --with-native-debug-symbols-level=1 ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( echo "Dumping config.log:" && cat config.log && diff --git a/.github/workflows/build-cross-compile.yml b/.github/workflows/build-cross-compile.yml index b3c63f488a0..a0642d469aa 100644 --- a/.github/workflows/build-cross-compile.yml +++ b/.github/workflows/build-cross-compile.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ on: jobs: build-cross-compile: name: build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: fail-fast: false @@ -179,6 +179,8 @@ jobs: --openjdk-target=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}} --with-sysroot=sysroot --with-jmod-compress=zip-1 + --with-external-symbols-in-bundles=none + --with-native-debug-symbols-level=1 CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-${{ inputs.gcc-major-version }} CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-${{ inputs.gcc-major-version }} ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index f398625cb2c..791b53a3f04 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,7 @@ on: jobs: build-linux: name: build - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 strategy: fail-fast: false @@ -115,9 +115,21 @@ jobs: if [[ '${{ inputs.apt-architecture }}' != '' ]]; then sudo dpkg --add-architecture ${{ inputs.apt-architecture }} fi - sudo apt-get update - sudo apt-get install --only-upgrade apt - sudo apt-get install gcc-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} g++-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }} + sudo apt update + sudo apt install --only-upgrade apt + sudo apt install \ + gcc-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} \ + g++-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} \ + libasound2-dev${{ steps.arch.outputs.suffix }} \ + libcups2-dev${{ steps.arch.outputs.suffix }} \ + libfontconfig1-dev${{ steps.arch.outputs.suffix }} \ + libx11-dev${{ steps.arch.outputs.suffix }} \ + libxext-dev${{ steps.arch.outputs.suffix }} \ + libxrandr-dev${{ steps.arch.outputs.suffix }} \ + libxrender-dev${{ steps.arch.outputs.suffix }} \ + libxt-dev${{ steps.arch.outputs.suffix }} \ + libxtst-dev${{ steps.arch.outputs.suffix }} \ + ${{ inputs.apt-extra-packages }} sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }} - name: 'Configure' @@ -131,6 +143,8 @@ jobs: --with-gtest=${{ steps.gtest.outputs.path }} --with-zlib=system --with-jmod-compress=zip-1 + --with-external-symbols-in-bundles=none + --with-native-debug-symbols-level=1 ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( echo "Dumping config.log:" && cat config.log && diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 0a12df668e5..484e616fad7 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -110,6 +110,8 @@ jobs: --with-gtest=${{ steps.gtest.outputs.path }} --with-zlib=system --with-jmod-compress=zip-1 + --with-external-symbols-in-bundles=none + --with-native-debug-symbols-level=1 ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( echo "Dumping config.log:" && cat config.log && diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index a3091b94cef..4dafc016a99 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -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 @@ -134,6 +134,7 @@ jobs: --with-gtest=${{ steps.gtest.outputs.path }} --with-msvc-toolset-version=${{ inputs.msvc-toolset-version }} --with-jmod-compress=zip-1 + --with-external-symbols-in-bundles=none ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || ( echo "Dumping config.log:" && cat config.log && diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d1e8a8be3d..85ec75f343c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -57,7 +57,7 @@ jobs: prepare: name: 'Prepare the run' - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 env: # List of platforms to exclude by default EXCLUDED_PLATFORMS: 'alpine-linux-x64' @@ -405,7 +405,7 @@ jobs: with: platform: linux-x64 bootjdk-platform: linux-x64 - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }} debug-suffix: -debug @@ -419,7 +419,7 @@ jobs: with: platform: linux-x64 bootjdk-platform: linux-x64 - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }} static-suffix: "-static" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f2c8916a369..8f33454305e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/.jcheck/conf b/.jcheck/conf index 60881e74d2a..25af49f8ef8 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1,7 +1,7 @@ [general] project=jdk jbs=JDK -version=26 +version=27 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists,copyright diff --git a/README.md b/README.md index b3f30676b3c..e939f6a9ca4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Welcome to the JDK! For build instructions please see the -[online documentation](https://openjdk.org/groups/build/doc/building.html), +[online documentation](https://git.openjdk.org/jdk/blob/master/doc/building.md), or either of these files: - [doc/building.html](doc/building.html) (html version) diff --git a/bin/generate-symbol-data.sh b/bin/generate-symbol-data.sh index 283757a6918..14d8763ad81 100644 --- a/bin/generate-symbol-data.sh +++ b/bin/generate-symbol-data.sh @@ -38,7 +38,7 @@ # directory. # - open a terminal program and run these commands: # cd "${JDK_CHECKOUT}"/src/jdk.compiler/share/data/symbols -# bash ../../../../../make/scripts/generate-symbol-data.sh "${JDK_N_INSTALL}" +# bash ../../../../../bin/generate-symbol-data.sh "${JDK_N_INSTALL}" # - this command will generate or update data for "--release N" into the ${JDK_CHECKOUT}/src/jdk.compiler/share/data/symbols # directory, updating all registration necessary. If the goal was to update the data, and there are no # new or changed files in the ${JDK_CHECKOUT}/src/jdk.compiler/share/data/symbols directory after running this script, diff --git a/bin/update_copyright_year.sh b/bin/update_copyright_year.sh index fa7989d234b..fcdac6b935f 100644 --- a/bin/update_copyright_year.sh +++ b/bin/update_copyright_year.sh @@ -1,7 +1,7 @@ #!/bin/bash -f # -# Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 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,9 +23,13 @@ # questions. # -# Script to update the Copyright YEAR range in Mercurial & Git sources. +# Script to update the Copyright YEAR range in Git sources. # (Originally from xdono, Thanks!) +# To update Copyright years for changes in a specific branch, +# you use a command along these lines: +# $ git diff upstream/master... | lsdiff | cut -d '/' -f 2- | bash bin/update_copyright_year.sh -m - + #------------------------------------------------------------ copyright="Copyright" copyright_symbol="(c)" @@ -47,7 +51,7 @@ rm -f -r ${tmp} mkdir -p ${tmp} total=0 -usage="Usage: `basename "$0"` [-c company] [-y year] [-h|f]" +usage="Usage: `basename "$0"` [-c company] [-y year] [-m file] [-h|f]" Help() { # Display Help @@ -65,15 +69,18 @@ Help() echo "-b Specifies the base reference for change set lookup." echo "-f Updates the copyright for all change sets in a given year," echo " as specified by -y. Overrides -b flag." + echo "-m Read the list of modified files from the given file," + echo " use - to read from stdin" echo "-h Print this help." echo } full_year=false base_reference=master +modified_files_origin=""; # Process options -while getopts "b:c:fhy:" option; do +while getopts "b:c:fhm:y:" option; do case $option in b) # supplied base reference base_reference=${OPTARG} @@ -91,6 +98,9 @@ while getopts "b:c:fhy:" option; do y) # supplied company year year=${OPTARG} ;; + m) # modified files will be read from the given origin + modified_files_origin="${OPTARG}" + ;; \?) # illegal option echo "$usage" exit 1 @@ -110,18 +120,10 @@ git status &> /dev/null && git_found=true if [ "$git_found" != "true" ]; then echo "Error: Please execute script from within a JDK git repository." exit 1 -else - echo "Using Git version control system" - vcs_status=(git ls-files -m) - if [ "$full_year" = "true" ]; then - vcs_list_changesets=(git log --no-merges --since="${year}-01-01T00:00:00Z" --until="${year}-12-31T23:59:59Z" --pretty=tformat:"%H") - else - vcs_list_changesets=(git log --no-merges "${base_reference}..HEAD" --since="${year}-01-01T00:00:00Z" --until="${year}-12-31T23:59:59Z" --pretty=tformat:"%H") - fi - vcs_changeset_message=(git log -1 --pretty=tformat:"%B") # followed by ${changeset} - vcs_changeset_files=(git diff-tree --no-commit-id --name-only -r) # followed by ${changeset} fi +echo "Using Git version control system" + # Return true if it makes sense to edit this file saneFileToCheck() { @@ -168,6 +170,25 @@ updateFile() # file echo "${changed}" } +# Update the copyright year on files sent in stdin +updateFiles() # stdin: list of files to update +{ + count=0 + fcount=0 + while read i; do + fcount=`expr ${fcount} '+' 1` + if [ `updateFile "${i}"` = "true" ] ; then + count=`expr ${count} '+' 1` + fi + done + if [ ${count} -gt 0 ] ; then + printf " UPDATED year on %d of %d files.\n" ${count} ${fcount} + total=`expr ${total} '+' ${count}` + else + printf " None of the %d files were changed.\n" ${fcount} + fi +} + # Update the copyright year on all files changed by this changeset updateChangesetFiles() # changeset { @@ -178,18 +199,7 @@ updateChangesetFiles() # changeset | ${awk} -F' ' '{for(i=1;i<=NF;i++)print $i}' \ > ${files} if [ -f "${files}" -a -s "${files}" ] ; then - fcount=`cat ${files}| wc -l` - for i in `cat ${files}` ; do - if [ `updateFile "${i}"` = "true" ] ; then - count=`expr ${count} '+' 1` - fi - done - if [ ${count} -gt 0 ] ; then - printf " UPDATED year on %d of %d files.\n" ${count} ${fcount} - total=`expr ${total} '+' ${count}` - else - printf " None of the %d files were changed.\n" ${fcount} - fi + cat ${files} | updateFiles else printf " ERROR: No files changed in the changeset? Must be a mistake.\n" set -x @@ -204,67 +214,80 @@ updateChangesetFiles() # changeset } # Check if repository is clean +vcs_status=(git ls-files -m) previous=`"${vcs_status[@]}"|wc -l` if [ ${previous} -ne 0 ] ; then echo "WARNING: This repository contains previously edited working set files." echo " ${vcs_status[*]} | wc -l = `"${vcs_status[@]}" | wc -l`" fi -# Get all changesets this year -all_changesets=${tmp}/all_changesets -rm -f ${all_changesets} -"${vcs_list_changesets[@]}" > ${all_changesets} - -# Check changeset to see if it is Copyright only changes, filter changesets -if [ -s ${all_changesets} ] ; then - echo "Changesets made in ${year}: `cat ${all_changesets} | wc -l`" - index=0 - cat ${all_changesets} | while read changeset ; do - index=`expr ${index} '+' 1` - desc=${tmp}/desc.${changeset} - rm -f ${desc} - echo "------------------------------------------------" - "${vcs_changeset_message[@]}" "${changeset}" > ${desc} - printf "%d: %s\n%s\n" ${index} "${changeset}" "`cat ${desc}|head -1`" - if [ "${year}" = "2010" ] ; then - if cat ${desc} | grep -i -F "Added tag" > /dev/null ; then - printf " EXCLUDED tag changeset.\n" - elif cat ${desc} | grep -i -F rebrand > /dev/null ; then - printf " EXCLUDED rebrand changeset.\n" - elif cat ${desc} | grep -i -F copyright > /dev/null ; then - printf " EXCLUDED copyright changeset.\n" - else - updateChangesetFiles ${changeset} - fi - else - if cat ${desc} | grep -i -F "Added tag" > /dev/null ; then - printf " EXCLUDED tag changeset.\n" - elif cat ${desc} | grep -i -F "copyright year" > /dev/null ; then - printf " EXCLUDED copyright year changeset.\n" - else - updateChangesetFiles ${changeset} - fi - fi - rm -f ${desc} - done -fi - -if [ ${total} -gt 0 ] ; then - echo "---------------------------------------------" - echo "Updated the copyright year on a total of ${total} files." - if [ ${previous} -eq 0 ] ; then - echo "This count should match the count of modified files in the repository: ${vcs_status[*]}" - else - echo "WARNING: This repository contained previously edited working set files." - fi - echo " ${vcs_status[*]} | wc -l = `"${vcs_status[@]}" | wc -l`" +if [ "x$modified_files_origin" != "x" ]; then + cat $modified_files_origin | updateFiles else - echo "---------------------------------------------" - echo "No files were changed" - if [ ${previous} -ne 0 ] ; then - echo "WARNING: This repository contained previously edited working set files." - fi - echo " ${vcs_status[*]} | wc -l = `"${vcs_status[@]}" | wc -l`" + # Get all changesets this year + if [ "$full_year" = "true" ]; then + vcs_list_changesets=(git log --no-merges --since="${year}-01-01T00:00:00Z" --until="${year}-12-31T23:59:59Z" --pretty=tformat:"%H") + else + vcs_list_changesets=(git log --no-merges "${base_reference}..HEAD" --since="${year}-01-01T00:00:00Z" --until="${year}-12-31T23:59:59Z" --pretty=tformat:"%H") + fi + vcs_changeset_message=(git log -1 --pretty=tformat:"%B") # followed by ${changeset} + vcs_changeset_files=(git diff-tree --no-commit-id --name-only -r) # followed by ${changeset} + + all_changesets=${tmp}/all_changesets + rm -f ${all_changesets} + "${vcs_list_changesets[@]}" > ${all_changesets} + + # Check changeset to see if it is Copyright only changes, filter changesets + if [ -s ${all_changesets} ] ; then + echo "Changesets made in ${year}: `cat ${all_changesets} | wc -l`" + index=0 + cat ${all_changesets} | while read changeset ; do + index=`expr ${index} '+' 1` + desc=${tmp}/desc.${changeset} + rm -f ${desc} + echo "------------------------------------------------" + "${vcs_changeset_message[@]}" "${changeset}" > ${desc} + printf "%d: %s\n%s\n" ${index} "${changeset}" "`cat ${desc}|head -1`" + if [ "${year}" = "2010" ] ; then + if cat ${desc} | grep -i -F "Added tag" > /dev/null ; then + printf " EXCLUDED tag changeset.\n" + elif cat ${desc} | grep -i -F rebrand > /dev/null ; then + printf " EXCLUDED rebrand changeset.\n" + elif cat ${desc} | grep -i -F copyright > /dev/null ; then + printf " EXCLUDED copyright changeset.\n" + else + updateChangesetFiles ${changeset} + fi + else + if cat ${desc} | grep -i -F "Added tag" > /dev/null ; then + printf " EXCLUDED tag changeset.\n" + elif cat ${desc} | grep -i -F "copyright year" > /dev/null ; then + printf " EXCLUDED copyright year changeset.\n" + else + updateChangesetFiles ${changeset} + fi + fi + rm -f ${desc} + done + fi + + if [ ${total} -gt 0 ] ; then + echo "---------------------------------------------" + echo "Updated the copyright year on a total of ${total} files." + if [ ${previous} -eq 0 ] ; then + echo "This count should match the count of modified files in the repository: ${vcs_status[*]}" + else + echo "WARNING: This repository contained previously edited working set files." + fi + echo " ${vcs_status[*]} | wc -l = `"${vcs_status[@]}" | wc -l`" + else + echo "---------------------------------------------" + echo "No files were changed" + if [ ${previous} -ne 0 ] ; then + echo "WARNING: This repository contained previously edited working set files." + fi + echo " ${vcs_status[*]} | wc -l = `"${vcs_status[@]}" | wc -l`" + fi fi # Cleanup diff --git a/doc/building.html b/doc/building.html index 19313ebf43a..534888ef667 100644 --- a/doc/building.html +++ b/doc/building.html @@ -541,6 +541,11 @@ href="#apple-xcode">Apple Xcode on some strategies to deal with this.

It is recommended that you use at least macOS 14 and Xcode 15.4, but earlier versions may also work.

+

Starting with Xcode 26, introduced in macOS 26, the Metal toolchain +no longer comes bundled with Xcode, so it needs to be installed +separately. This can either be done via the Xcode's Settings/Components +UI, or in the command line calling +xcodebuild -downloadComponent metalToolchain.

The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. The JDK uses homebrew in the examples, but @@ -1380,10 +1385,9 @@ dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb . can specify it by --with-alsa.

X11

-

You will need X11 libraries suitable for your target system. -In most cases, using Debian's pre-built libraries work fine.

-

Note that X11 is needed even if you only want to build a headless -JDK.

+

When not building a headless JDK, you will need X11 libraries +suitable for your target system. In most cases, using Debian's +pre-built libraries work fine.

* - * @jls 5.7.1 Exact Testing Conversions - * @jls 5.7.2 Unconditionally Exact Testing Conversions - * @jls 15.20.2 The instanceof Operator + * @jls primitive-types-in-patterns-instanceof-switch-5.7.1 Exact Testing Conversions + * @jls primitive-types-in-patterns-instanceof-switch-5.7.2 Unconditionally Exact Testing Conversions + * @jls primitive-types-in-patterns-instanceof-switch-15.20.2 The {@code instanceof} Operator * * @implNote Some exactness checks describe a test which can be redirected * safely through one of the existing methods. Those are omitted too (i.e., diff --git a/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java b/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java index 30b6df0073e..087d2cc23a9 100644 --- a/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java +++ b/src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 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 @@ -188,13 +188,17 @@ public final class SwitchBootstraps { String invocationName, MethodType invocationType, Object... labels) { + requireNonNull(lookup); + requireNonNull(invocationType); + requireNonNull(labels); + Class selectorType = invocationType.parameterType(0); if (invocationType.parameterCount() != 2 || (!invocationType.returnType().equals(int.class)) || !invocationType.parameterType(1).equals(int.class)) throw new IllegalArgumentException("Illegal invocation type " + invocationType); - for (Object l : labels) { // implicit null-check + for (Object l : labels) { verifyLabel(l, selectorType); } @@ -292,6 +296,10 @@ public final class SwitchBootstraps { String invocationName, MethodType invocationType, Object... labels) { + requireNonNull(lookup); + requireNonNull(invocationType); + requireNonNull(labels); + if (invocationType.parameterCount() != 2 || (!invocationType.returnType().equals(int.class)) || invocationType.parameterType(0).isPrimitive() @@ -299,7 +307,7 @@ public final class SwitchBootstraps { || !invocationType.parameterType(1).equals(int.class)) throw new IllegalArgumentException("Illegal invocation type " + invocationType); - labels = labels.clone(); // implicit null check + labels = labels.clone(); Class enumClass = invocationType.parameterType(0); boolean constantsOnly = true; @@ -307,7 +315,7 @@ public final class SwitchBootstraps { for (int i = 0; i < len; i++) { Object convertedLabel = - convertEnumConstants(lookup, enumClass, labels[i]); + convertEnumConstants(enumClass, labels[i]); labels[i] = convertedLabel; if (constantsOnly) constantsOnly = convertedLabel instanceof EnumDesc; @@ -331,7 +339,7 @@ public final class SwitchBootstraps { return new ConstantCallSite(target); } - private static > Object convertEnumConstants(MethodHandles.Lookup lookup, Class enumClassTemplate, Object label) { + private static > Object convertEnumConstants(Class enumClassTemplate, Object label) { if (label == null) { throw new IllegalArgumentException("null label found"); } diff --git a/src/java.base/share/classes/java/net/Authenticator.java b/src/java.base/share/classes/java/net/Authenticator.java index fb33596feed..d7b64d4bc73 100644 --- a/src/java.base/share/classes/java/net/Authenticator.java +++ b/src/java.base/share/classes/java/net/Authenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 54d4cd55a9b..f7767655235 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 @@ ~Type (); + (--p)->~Type (); } length = size; } @@ -416,6 +478,7 @@ struct hb_vector_t } /* Allocate for size but don't adjust length. */ + HB_ALWAYS_INLINE_VECTOR_ALLOCS bool alloc (unsigned int size, bool exact=false) { if (unlikely (in_error ())) @@ -471,17 +534,64 @@ struct hb_vector_t return true; } + HB_ALWAYS_INLINE_VECTOR_ALLOCS bool alloc_exact (unsigned int size) { return alloc (size, true); } + HB_ALWAYS_INLINE_VECTOR_ALLOCS void clear () { resize (0); } - bool resize (int size_, bool initialize = true, bool exact = false) + template + HB_ALWAYS_INLINE_VECTOR_ALLOCS + bool allocate_from_pool (allocator_t *allocator, unsigned size, unsigned int initialize = true) + { + if (allocator) + { + assert (!length && !allocated); + arrayZ = (Type *) allocator->alloc (size * sizeof (Type), alignof (Type)); + if (unlikely (!arrayZ)) + { + set_error (); + return false; + } + if (initialize) + grow_vector (size, hb_prioritize); + else + length = size; + return true; + } + return resize_full ((int) size, initialize, true); + } + + template + HB_ALWAYS_INLINE_VECTOR_ALLOCS + bool duplicate_vector_from_pool (allocator_t *allocator, const hb_vector_t &other) + { + if (unlikely (!allocate_from_pool (allocator, other.length, false))) + return false; + length = 0; + copy_array (other.as_array ()); + return true; + } + + template + void shrink_back_to_pool (allocator_t *allocator, int size) + { + unsigned orig_length = length; + + shrink (size, false); + + if (allocator && !is_owned ()) + allocator->discard (arrayZ + length, (orig_length - length) * sizeof (Type)); + } + + HB_ALWAYS_INLINE_VECTOR_ALLOCS + bool resize_full (int size_, bool initialize, bool exact) { unsigned int size = size_ < 0 ? 0u : (unsigned int) size_; if (!alloc (size, exact)) @@ -501,9 +611,20 @@ struct hb_vector_t length = size; return true; } - bool resize_exact (int size_, bool initialize = true) + HB_ALWAYS_INLINE_VECTOR_ALLOCS + bool resize (int size_) { - return resize (size_, initialize, true); + return resize_full (size_, true, false); + } + HB_ALWAYS_INLINE_VECTOR_ALLOCS + bool resize_dirty (int size_) + { + return resize_full (size_, false, false); + } + HB_ALWAYS_INLINE_VECTOR_ALLOCS + bool resize_exact (int size_) + { + return resize_full (size_, true, true); } Type pop () @@ -544,7 +665,7 @@ struct hb_vector_t shrink_vector (size); - if (shrink_memory) + if (is_owned () && shrink_memory) alloc_exact (size); /* To force shrinking memory if needed. */ } diff --git a/src/java.desktop/share/native/libharfbuzz/hb-version.h b/src/java.desktop/share/native/libharfbuzz/hb-version.h index e41286d2d8c..c673d1e3612 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 11 +#define HB_VERSION_MAJOR 12 /** * HB_VERSION_MINOR: * * The minor component of the library version available at compile-time. */ -#define HB_VERSION_MINOR 2 +#define HB_VERSION_MINOR 3 /** * HB_VERSION_MICRO: * * The micro component of the library version available at compile-time. */ -#define HB_VERSION_MICRO 0 +#define HB_VERSION_MICRO 2 /** * HB_VERSION_STRING: * * A string literal containing the library version available at compile-time. */ -#define HB_VERSION_STRING "11.2.0" +#define HB_VERSION_STRING "12.3.2" /** * HB_VERSION_ATLEAST: diff --git a/src/java.desktop/share/native/libharfbuzz/hb.hh b/src/java.desktop/share/native/libharfbuzz/hb.hh index 8c430e5770d..7582abaa933 100644 --- a/src/java.desktop/share/native/libharfbuzz/hb.hh +++ b/src/java.desktop/share/native/libharfbuzz/hb.hh @@ -89,7 +89,6 @@ #pragma GCC diagnostic error "-Wstring-conversion" #pragma GCC diagnostic error "-Wswitch-enum" #pragma GCC diagnostic error "-Wtautological-overlap-compare" -#pragma GCC diagnostic error "-Wuninitialized" #pragma GCC diagnostic error "-Wunneeded-internal-declaration" #pragma GCC diagnostic error "-Wunused" #pragma GCC diagnostic error "-Wunused-local-typedefs" @@ -110,11 +109,21 @@ #pragma GCC diagnostic warning "-Wformat-signedness" #pragma GCC diagnostic warning "-Wignored-pragma-optimize" #pragma GCC diagnostic warning "-Wlogical-op" -#pragma GCC diagnostic warning "-Wmaybe-uninitialized" #pragma GCC diagnostic warning "-Wmissing-format-attribute" +#pragma GCC diagnostic warning "-Wpessimizing-move" #pragma GCC diagnostic warning "-Wundef" #pragma GCC diagnostic warning "-Wunsafe-loop-optimizations" #pragma GCC diagnostic warning "-Wunused-but-set-variable" +#ifdef __clang__ +// The following are too buggy on gcc +// https://github.com/harfbuzz/harfbuzz/issues/5589 +// https://github.com/harfbuzz/harfbuzz/pull/5367 +#pragma GCC diagnostic warning "-Wmaybe-uninitialized" +#pragma GCC diagnostic warning "-Wuninitialized" +#else +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#pragma GCC diagnostic ignored "-Wuninitialized" +#endif #endif /* Ignored currently, but should be fixed at some point. */ @@ -136,6 +145,7 @@ #pragma GCC diagnostic ignored "-Wformat-nonliteral" #pragma GCC diagnostic ignored "-Wformat-zero-length" #pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wpacked" // Erratic impl in clang #pragma GCC diagnostic ignored "-Wrange-loop-analysis" // https://github.com/harfbuzz/harfbuzz/issues/2834 #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -239,6 +249,8 @@ // clang defines it so no need. #ifdef __has_builtin #define hb_has_builtin __has_builtin +#elif defined(_MSC_VER) +#define hb_has_builtin(x) 0 #else #define hb_has_builtin(x) ((defined(__GNUC__) && __GNUC__ >= 5)) #endif @@ -314,6 +326,10 @@ #endif #endif +#ifndef HB_HOT +#define HB_HOT __attribute__((hot)) +#endif + /* * Borrowed from https://bugzilla.mozilla.org/show_bug.cgi?id=1215411 * HB_FALLTHROUGH is an annotation to suppress compiler warnings about switch @@ -553,4 +569,13 @@ extern "C" void hb_free_impl(void *ptr); #include "hb-vector.hh" // Requires: hb-array hb-null #include "hb-object.hh" // Requires: hb-atomic hb-mutex hb-vector + +/* 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) \ + HB_STMT_START { \ + if (!(x)) { fprintf(stderr, "Assertion failed: %s, at %s:%d\n", #x, __FILE__, __LINE__); abort(); } \ + } HB_STMT_END + + #endif /* HB_HH */ diff --git a/src/java.desktop/share/native/libjsound/Utilities.c b/src/java.desktop/share/native/libjsound/Utilities.c index 6e92813d53c..50ca18c0259 100644 --- a/src/java.desktop/share/native/libjsound/Utilities.c +++ b/src/java.desktop/share/native/libjsound/Utilities.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2007, 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 @@ -26,15 +26,6 @@ #include "Utilities.h" - -int UTIL_IsBigEndianPlatform() { -#ifdef _LITTLE_ENDIAN - return 0; -#else - return 1; -#endif -} - void ThrowJavaMessageException(JNIEnv *e, const char *exClass, const char *msg) { jclass newExcCls; diff --git a/src/java.desktop/share/native/libjsound/Utilities.h b/src/java.desktop/share/native/libjsound/Utilities.h index fbecab1e005..7cb0dcbdd4c 100644 --- a/src/java.desktop/share/native/libjsound/Utilities.h +++ b/src/java.desktop/share/native/libjsound/Utilities.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, 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 @@ -28,10 +28,6 @@ #include "SoundDefs.h" #include "Configure.h" // put flags for debug msgs etc. here -// return 1 if this platform is big endian, or 0 for little endian -int UTIL_IsBigEndianPlatform(); - - // ERROR PRINTS #ifdef USE_ERROR #define ERROR0(string) { fprintf(stdout, (string)); fflush(stdout); } diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_Fp.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_Fp.c index fa9a186d6d7..bc2df9b0b1a 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_Fp.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_Fp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 @@ -76,6 +76,7 @@ #include "mlib_ImageCheck.h" #include "mlib_SysMath.h" #include "mlib_ImageConv.h" +#include "safe_math.h" /***************************************************************/ static void mlib_ImageConvMxNMulAdd_F32(mlib_f32 *dst, @@ -272,6 +273,9 @@ mlib_status mlib_convMxNext_f32(mlib_image *dst, mlib_s32 nch = mlib_ImageGetChannels(dst); mlib_s32 i, j, j1, k; + if (!SAFE_TO_MULT(3, wid_e) || !SAFE_TO_ADD(3 * wid_e, m)) { + return MLIB_FAILURE; + } if (3 * wid_e + m > 1024) { dsa = mlib_malloc((3 * wid_e + m) * sizeof(mlib_d64)); @@ -629,6 +633,9 @@ mlib_status mlib_convMxNext_d64(mlib_image *dst, mlib_s32 nch = mlib_ImageGetChannels(dst); mlib_s32 i, j, j1, k; + if (!SAFE_TO_MULT(3, wid_e) || !SAFE_TO_ADD(3 * wid_e, m)) { + return MLIB_FAILURE; + } if (3 * wid_e + m > 1024) { dsa = mlib_malloc((3 * wid_e + m) * sizeof(mlib_d64)); diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_ext.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_ext.c index ee15935dcfe..5869b0a54af 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_ext.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConvMxN_ext.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 @@ -82,6 +82,7 @@ #include "mlib_image.h" #include "mlib_ImageConv.h" +#include "safe_math.h" /***************************************************************/ static void mlib_ImageConvMxNMulAdd_S32(mlib_d64 *dst, @@ -229,6 +230,9 @@ mlib_status mlib_convMxNext_s32(mlib_image *dst, /* internal buffer */ + if (!SAFE_TO_MULT(3, wid_e) || !SAFE_TO_ADD(3 * wid_e, m)) { + return MLIB_FAILURE; + } if (3 * wid_e + m > 1024) { dsa = mlib_malloc((3 * wid_e + m) * sizeof(mlib_d64)); diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16ext.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16ext.c index 57486b1cae5..00469d25719 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16ext.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16ext.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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,7 @@ #include "mlib_image.h" #include "mlib_ImageConv.h" #include "mlib_c_ImageConv.h" +#include "safe_math.h" /* * This define switches between functions of different data types @@ -260,8 +261,14 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst, if (max_hsize > hgt) max_hsize = hgt; shgt = hgt + (n - 1); + if (!SAFE_TO_ADD(max_hsize, (n - 1))) { + return MLIB_FAILURE; + } smax_hsize = max_hsize + (n - 1); + if (!SAFE_TO_ADD(smax_hsize, 1) || !SAFE_TO_MULT(2, (smax_hsize + 1))) { + return MLIB_FAILURE; + } bsize = 2 * (smax_hsize + 1); if (bsize > BUFF_SIZE) { @@ -509,8 +516,16 @@ mlib_status CONV_FUNC_MxN FREE_AND_RETURN_STATUS; } + if (!SAFE_TO_ADD(wid, (m - 1))) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } swid = wid + (m - 1); + if (!SAFE_TO_MULT((n + 3), swid)) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } bsize = (n + 3)*swid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { @@ -919,8 +934,14 @@ mlib_status CONV_FUNC_MxN_I chan1 = nchannel; chan2 = chan1 + chan1; + if (!SAFE_TO_ADD(wid, (m - 1))) { + return MLIB_FAILURE; + } swid = wid + (m - 1); + if (!SAFE_TO_MULT((n + 2), swid)) { + return MLIB_FAILURE; + } bsize = (n + 2)*swid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16nw.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16nw.c index 3b6985b7876..2e035d12453 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16nw.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_16nw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, 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 @@ -32,6 +32,7 @@ #include "mlib_image.h" #include "mlib_c_ImageConv.h" +#include "safe_math.h" /* This define switches between functions of different data types @@ -466,6 +467,10 @@ mlib_status CONV_FUNC(MxN)(mlib_image *dst, FREE_AND_RETURN_STATUS; } + if (!SAFE_TO_MULT((n + 3), wid)) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } bsize = (n + 3)*wid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_32nw.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_32nw.c index 380ed044878..bb264d9dcd2 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_32nw.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_32nw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, 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 @@ -33,6 +33,7 @@ #include "mlib_image.h" #include "mlib_ImageConv.h" +#include "safe_math.h" /***************************************************************/ #define CACHE_SIZE (64*1024) @@ -335,6 +336,10 @@ mlib_status CONV_FUNC(MxN)(mlib_image *dst, FREE_AND_RETURN_STATUS; } + if (!SAFE_TO_MULT((n + 2), wid)) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } bsize = (n + 2)*wid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8ext.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8ext.c index c8b58e6f138..136d5a2b814 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8ext.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8ext.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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,7 @@ #include "mlib_image.h" #include "mlib_ImageConv.h" #include "mlib_c_ImageConv.h" +#include "safe_math.h" /* * This define switches between functions of different data types @@ -245,8 +246,14 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst, if (max_hsize > hgt) max_hsize = hgt; shgt = hgt + (n - 1); + if (!SAFE_TO_ADD(max_hsize, (n - 1))) { + return MLIB_FAILURE; + } smax_hsize = max_hsize + (n - 1); + if (!SAFE_TO_ADD(smax_hsize, 1) || !SAFE_TO_MULT(2, (smax_hsize + 1))) { + return MLIB_FAILURE; + } bsize = 2 * (smax_hsize + 1); if (bsize > BUFF_SIZE) { @@ -494,8 +501,16 @@ mlib_status CONV_FUNC_MxN FREE_AND_RETURN_STATUS; } + if (!SAFE_TO_ADD(wid, (m - 1))) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } swid = wid + (m - 1); + if (!SAFE_TO_MULT((n + 3), swid)) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } bsize = (n + 3)*swid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { @@ -904,8 +919,14 @@ mlib_status CONV_FUNC_MxN_I chan1 = nchannel; chan2 = chan1 + chan1; + if (!SAFE_TO_ADD(wid, (m - 1))) { + return MLIB_FAILURE; + } swid = wid + (m - 1); + if (!SAFE_TO_MULT((n + 2), swid)) { + return MLIB_FAILURE; + } bsize = (n + 2)*swid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8nw.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8nw.c index f65fda45c58..c144404b0f4 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8nw.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_8nw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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,7 @@ #include "mlib_image.h" #include "mlib_ImageConv.h" #include "mlib_c_ImageConv.h" +#include "safe_math.h" /* This define switches between functions of different data types @@ -467,6 +468,10 @@ mlib_status CONV_FUNC(MxN)(mlib_image *dst, FREE_AND_RETURN_STATUS; } + if (!SAFE_TO_MULT((n + 3), wid)) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } bsize = (n + 3)*wid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16ext.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16ext.c index b2757979a84..81a06f2fc28 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16ext.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16ext.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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,7 @@ #include "mlib_image.h" #include "mlib_ImageConv.h" #include "mlib_c_ImageConv.h" +#include "safe_math.h" /* * This define switches between functions of different data types @@ -270,8 +271,14 @@ static mlib_status mlib_ImageConv1xN_ext(mlib_image *dst, if (max_hsize > hgt) max_hsize = hgt; shgt = hgt + (n - 1); + if (!SAFE_TO_ADD(max_hsize, (n - 1))) { + return MLIB_FAILURE; + } smax_hsize = max_hsize + (n - 1); + if (!SAFE_TO_ADD(smax_hsize, 1) || !SAFE_TO_MULT(2, (smax_hsize + 1))) { + return MLIB_FAILURE; + } bsize = 2 * (smax_hsize + 1); if (bsize > BUFF_SIZE) { @@ -519,8 +526,16 @@ mlib_status CONV_FUNC_MxN FREE_AND_RETURN_STATUS; } + if (!SAFE_TO_ADD(wid, (m - 1))) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } swid = wid + (m - 1); + if (!SAFE_TO_MULT((n + 3), swid)) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } bsize = (n + 3)*swid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { @@ -927,8 +942,14 @@ mlib_status CONV_FUNC_MxN_I chan1 = nchannel; chan2 = chan1 + chan1; + if (!SAFE_TO_ADD(wid, (m - 1))) { + return MLIB_FAILURE; + } swid = wid + (m - 1); + if (!SAFE_TO_MULT((n + 2), swid)) { + return MLIB_FAILURE; + } bsize = (n + 2)*swid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16nw.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16nw.c index a3234cf8959..49412c7d7ef 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16nw.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv_u16nw.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 @@ -32,6 +32,7 @@ #include "mlib_image.h" #include "mlib_c_ImageConv.h" +#include "safe_math.h" /* This define switches between functions of different data types @@ -466,6 +467,10 @@ mlib_status CONV_FUNC(MxN)(mlib_image *dst, FREE_AND_RETURN_STATUS; } + if (!SAFE_TO_MULT((n + 3), wid)) { + status = MLIB_FAILURE; + FREE_AND_RETURN_STATUS; + } bsize = (n + 3)*wid; if ((bsize > BUFF_SIZE) || (n > MAX_N)) { diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c index 2e77c20aa57..cfd5e3e671e 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,6 +50,7 @@ #include "mlib_image.h" #include "mlib_ImageLookUp.h" +#include "safe_math.h" /***************************************************************/ #define MAX_WIDTH 512 @@ -302,6 +303,9 @@ mlib_status mlib_ImageLookUp_Bit_U8_2(const mlib_u8 *src, mlib_u8 *buff = (mlib_u8*)buff_lcl, *buffs; mlib_u32 val0, val1; + if (!SAFE_TO_MULT(xsize, 2)) { + return MLIB_FAILURE; + } size = xsize * 2; if (size > MAX_WIDTH) { @@ -440,6 +444,9 @@ mlib_status mlib_ImageLookUp_Bit_U8_3(const mlib_u8 *src, mlib_u8 *buff = (mlib_u8*)buff_lcl, *buffs; mlib_u32 l0, h0, v0, l1, h1, v1, l2, h2, v2; + if (!SAFE_TO_MULT(3, xsize)) { + return MLIB_FAILURE; + } size = 3 * xsize; if (size > MAX_WIDTH) { @@ -583,6 +590,9 @@ mlib_status mlib_ImageLookUp_Bit_U8_4(const mlib_u8 *src, mlib_u8 *buff = (mlib_u8*)buff_lcl, *buffs; mlib_u32 l, h; + if (!SAFE_TO_MULT(xsize, 4)) { + return MLIB_FAILURE; + } size = xsize * 4; if (size > MAX_WIDTH) { diff --git a/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c b/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c index a6f4cfdd36e..72adc212af6 100644 --- a/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c +++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,6 +101,11 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, return MLIB_FAILURE; } + int intSize = sizeof(mlib_s32); + if (!SAFE_TO_MULT(dstHeight, intSize) || + !SAFE_TO_ADD(dstHeight * intSize, 7)) { + return MLIB_FAILURE; + } bsize0 = (dstHeight * sizeof(mlib_s32) + 7) & ~7; if (lineAddr == NULL) { @@ -109,6 +114,10 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param, param->buff_malloc = NULL; + if (!SAFE_TO_MULT(4, bsize0) || !SAFE_TO_ADD(4 * bsize0, bsize1)) { + return MLIB_FAILURE; + } + if ((4 * bsize0 + bsize1) > buff_size) { buff = param->buff_malloc = mlib_malloc(4 * bsize0 + bsize1); diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES index 2478fd0fc08..3bb1baecd23 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES +++ b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES @@ -6304,6 +6304,33 @@ Version 1.6.51 [November 21, 2025] Added GitHub Actions workflows for automated testing. Performed various refactorings and cleanups. +Version 1.6.52 [December 3, 2025] + Fixed CVE-2025-66293 (high severity): + Out-of-bounds read in `png_image_read_composite`. + (Reported by flyfish101 .) + Fixed the Paeth filter handling in the RISC-V RVV implementation. + (Reported by Filip Wasil; fixed by Liang Junzhao.) + Improved the performance of the RISC-V RVV implementation. + (Contributed by Liang Junzhao.) + Added allocation failure fuzzing to oss-fuzz. + (Contributed by Philippe Antoine.) + +Version 1.6.53 [December 5, 2025] + Fixed a build failure on RISC-V RVV caused by a misspelled intrinsic. + (Contributed by Alexander Smorkalov.) + Fixed a build failure with CMake 4.1 or newer, on Windows, when using + Visual C++ without MASM installed. + +Version 1.6.54 [January 12, 2026] + Fixed CVE-2026-22695 (medium severity): + Heap buffer over-read in `png_image_read_direct_scaled. + (Reported and fixed by Petr Simecek.) + Fixed CVE-2026-22801 (medium severity): + Integer truncation causing heap buffer over-read in `png_image_write_*`. + Implemented various improvements in oss-fuzz. + (Contributed by Philippe Antoine.) + + Send comments/corrections/commendations to png-mng-implement at lists.sf.net. Subscription is required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE index ea6df986cb6..1b765ae9f96 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE +++ b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE @@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE PNG Reference Library License version 2 --------------------------------------- - * Copyright (c) 1995-2025 The PNG Reference Library Authors. - * Copyright (c) 2018-2025 Cosmin Truta. + * Copyright (c) 1995-2026 The PNG Reference Library Authors. + * Copyright (c) 2018-2026 Cosmin Truta. * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. * Copyright (c) 1996-1997 Andreas Dilger. * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/README b/src/java.desktop/share/native/libsplashscreen/libpng/README index 5ea329ee3da..63d1376edf7 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.51 +README for libpng version 1.6.54 ================================ 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 7d85e7c8d5f..5636b4a754e 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/png.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.c @@ -29,7 +29,7 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Copyright (c) 2018-2025 Cosmin Truta + * Copyright (c) 2018-2026 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -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_51 Your_png_h_is_not_version_1_6_51; +typedef png_libpng_version_1_6_54 Your_png_h_is_not_version_1_6_54; /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the * corresponding macro definitions. This causes a compile time failure if @@ -130,7 +130,8 @@ png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) /* Function to allocate memory for zlib */ PNG_FUNCTION(voidpf /* PRIVATE */, -png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED) +png_zalloc,(voidpf png_ptr, uInt items, uInt size), + PNG_ALLOCATED) { png_alloc_size_t num_bytes = size; @@ -286,7 +287,8 @@ png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver) PNG_FUNCTION(png_structp /* PRIVATE */, png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED) + png_malloc_ptr malloc_fn, png_free_ptr free_fn), + PNG_ALLOCATED) { png_struct create_struct; # ifdef PNG_SETJMP_SUPPORTED @@ -390,7 +392,8 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr, /* Allocate the memory for an info_struct for the application. */ PNG_FUNCTION(png_infop,PNGAPI -png_create_info_struct,(png_const_structrp png_ptr),PNG_ALLOCATED) +png_create_info_struct,(png_const_structrp png_ptr), + PNG_ALLOCATED) { png_inforp info_ptr; @@ -846,8 +849,8 @@ png_get_copyright(png_const_structrp png_ptr) return PNG_STRING_COPYRIGHT #else return PNG_STRING_NEWLINE \ - "libpng version 1.6.51" PNG_STRING_NEWLINE \ - "Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \ + "libpng version 1.6.54" 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 \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ @@ -2286,8 +2289,8 @@ PNG_FP_End: int png_check_fp_string(png_const_charp string, size_t size) { - int state=0; - size_t char_index=0; + int state = 0; + size_t char_index = 0; if (png_check_fp_number(string, size, &state, &char_index) != 0 && (char_index == size || string[char_index] == 0)) diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.h b/src/java.desktop/share/native/libsplashscreen/libpng/png.h index d39ff73552c..ab8876a9626 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/png.h +++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.h @@ -29,9 +29,9 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * libpng version 1.6.51 + * libpng version 1.6.54 * - * Copyright (c) 2018-2025 Cosmin Truta + * Copyright (c) 2018-2026 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -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.51, November 2025: + * libpng versions 1.6.36, December 2018, through 1.6.54, January 2026: * Cosmin Truta * See also "Contributing Authors", below. */ @@ -55,8 +55,8 @@ * PNG Reference Library License version 2 * --------------------------------------- * - * * Copyright (c) 1995-2025 The PNG Reference Library Authors. - * * Copyright (c) 2018-2025 Cosmin Truta. + * * Copyright (c) 1995-2026 The PNG Reference Library Authors. + * * Copyright (c) 2018-2026 Cosmin Truta. * * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. * * Copyright (c) 1996-1997 Andreas Dilger. * * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -267,7 +267,7 @@ * ... * 1.5.30 15 10530 15.so.15.30[.0] * ... - * 1.6.51 16 10651 16.so.16.51[.0] + * 1.6.54 16 10654 16.so.16.54[.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.51" +#define PNG_LIBPNG_VER_STRING "1.6.54" #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 51 +#define PNG_LIBPNG_VER_RELEASE 54 /* 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 10651 /* 1.6.51 */ +#define PNG_LIBPNG_VER 10654 /* 1.6.54 */ /* 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_51; +typedef char *png_libpng_version_1_6_54; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -814,17 +814,22 @@ typedef png_row_info * * png_row_infopp; * modify the buffer it is passed. The 'read' function, on the other hand, is * expected to return the read data in the buffer. */ -typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp)); -typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, size_t)); -typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp)); -typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32, - int)); -typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32, - int)); +typedef PNG_CALLBACK(void, *png_error_ptr, + (png_structp, png_const_charp)); +typedef PNG_CALLBACK(void, *png_rw_ptr, + (png_structp, png_bytep, size_t)); +typedef PNG_CALLBACK(void, *png_flush_ptr, + (png_structp)); +typedef PNG_CALLBACK(void, *png_read_status_ptr, + (png_structp, png_uint_32, int)); +typedef PNG_CALLBACK(void, *png_write_status_ptr, + (png_structp, png_uint_32, int)); #ifdef PNG_PROGRESSIVE_READ_SUPPORTED -typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); -typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); +typedef PNG_CALLBACK(void, *png_progressive_info_ptr, + (png_structp, png_infop)); +typedef PNG_CALLBACK(void, *png_progressive_end_ptr, + (png_structp, png_infop)); /* The following callback receives png_uint_32 row_number, int pass for the * png_bytep data of the row. When transforming an interlaced image the @@ -836,19 +841,19 @@ typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); * find the output pixel (x,y) given an interlaced sub-image pixel * (row,col,pass). (See below for these macros.) */ -typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep, - png_uint_32, int)); +typedef PNG_CALLBACK(void, *png_progressive_row_ptr, + (png_structp, png_bytep, png_uint_32, int)); #endif #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) -typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop, - png_bytep)); +typedef PNG_CALLBACK(void, *png_user_transform_ptr, + (png_structp, png_row_infop, png_bytep)); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED -typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp, - png_unknown_chunkp)); +typedef PNG_CALLBACK(int, *png_user_chunk_ptr, + (png_structp, png_unknown_chunkp)); #endif #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED /* not used anywhere */ @@ -906,9 +911,10 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), (jmp_buf, int), typedef); * ignores the first argument) should be completely compatible with the * following. */ -typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp, - png_alloc_size_t)); -typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); +typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, + (png_structp, png_alloc_size_t)); +typedef PNG_CALLBACK(void, *png_free_ptr, + (png_structp, png_voidp)); /* Section 4: exported functions * Here are the function definitions most commonly used. This is not @@ -940,20 +946,22 @@ typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); */ /* Returns the version number of the library */ -PNG_EXPORT(1, png_uint_32, png_access_version_number, (void)); +PNG_EXPORT(1, png_uint_32, png_access_version_number, + (void)); /* Tell lib we have already handled the first magic bytes. * Handling more than 8 bytes from the beginning of the file is an error. */ -PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes)); +PNG_EXPORT(2, void, png_set_sig_bytes, + (png_structrp png_ptr, int num_bytes)); /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a * PNG file. Returns zero if the supplied bytes match the 8-byte PNG * signature, and non-zero otherwise. Having num_to_check == 0 or * start > 7 will always fail (i.e. return non-zero). */ -PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start, - size_t num_to_check)); +PNG_EXPORT(3, int, png_sig_cmp, + (png_const_bytep sig, size_t start, size_t num_to_check)); /* Simple signature checking function. This is the same as calling * png_check_sig(sig, n) := (png_sig_cmp(sig, 0, n) == 0). @@ -962,21 +970,21 @@ PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start, /* Allocate and initialize png_ptr struct for reading, and any other memory. */ PNG_EXPORTA(4, png_structp, png_create_read_struct, - (png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn), - PNG_ALLOCATED); + (png_const_charp user_png_ver, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn), + PNG_ALLOCATED); /* Allocate and initialize png_ptr struct for writing, and any other memory */ PNG_EXPORTA(5, png_structp, png_create_write_struct, - (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, - png_error_ptr warn_fn), - PNG_ALLOCATED); + (png_const_charp user_png_ver, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn), + PNG_ALLOCATED); PNG_EXPORT(6, size_t, png_get_compression_buffer_size, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); -PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr, - size_t size)); +PNG_EXPORT(7, void, png_set_compression_buffer_size, + (png_structrp png_ptr, size_t size)); /* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp * match up. @@ -989,8 +997,8 @@ PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr, * allocated by the library - the call will return NULL on a mismatch * indicating an ABI mismatch. */ -PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr, - png_longjmp_ptr longjmp_fn, size_t jmp_buf_size)); +PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, + (png_structrp png_ptr, png_longjmp_ptr longjmp_fn, size_t jmp_buf_size)); # define png_jmpbuf(png_ptr) \ (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf)))) #else @@ -1002,67 +1010,77 @@ PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr, * will use it; otherwise it will call PNG_ABORT(). This function was * added in libpng-1.5.0. */ -PNG_EXPORTA(9, void, png_longjmp, (png_const_structrp png_ptr, int val), - PNG_NORETURN); +PNG_EXPORTA(9, void, png_longjmp, + (png_const_structrp png_ptr, int val), + PNG_NORETURN); #ifdef PNG_READ_SUPPORTED /* Reset the compression stream */ -PNG_EXPORTA(10, int, png_reset_zstream, (png_structrp png_ptr), PNG_DEPRECATED); +PNG_EXPORTA(10, int, png_reset_zstream, + (png_structrp png_ptr), + PNG_DEPRECATED); #endif /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ #ifdef PNG_USER_MEM_SUPPORTED PNG_EXPORTA(11, png_structp, png_create_read_struct_2, - (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, - png_error_ptr warn_fn, + (png_const_charp user_png_ver, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), - PNG_ALLOCATED); + PNG_ALLOCATED); PNG_EXPORTA(12, png_structp, png_create_write_struct_2, - (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, - png_error_ptr warn_fn, + (png_const_charp user_png_ver, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), - PNG_ALLOCATED); + PNG_ALLOCATED); #endif /* Write the PNG file signature. */ -PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr)); +PNG_EXPORT(13, void, png_write_sig, + (png_structrp png_ptr)); /* Write a PNG chunk - size, type, (optional) data, CRC. */ -PNG_EXPORT(14, void, png_write_chunk, (png_structrp png_ptr, png_const_bytep - chunk_name, png_const_bytep data, size_t length)); +PNG_EXPORT(14, void, png_write_chunk, + (png_structrp png_ptr, + png_const_bytep chunk_name, png_const_bytep data, size_t length)); /* Write the start of a PNG chunk - length and chunk name. */ -PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr, +PNG_EXPORT(15, void, png_write_chunk_start, + (png_structrp png_ptr, png_const_bytep chunk_name, png_uint_32 length)); /* Write the data of a PNG chunk started with png_write_chunk_start(). */ -PNG_EXPORT(16, void, png_write_chunk_data, (png_structrp png_ptr, +PNG_EXPORT(16, void, png_write_chunk_data, + (png_structrp png_ptr, png_const_bytep data, size_t length)); /* Finish a chunk started with png_write_chunk_start() (includes CRC). */ -PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr)); +PNG_EXPORT(17, void, png_write_chunk_end, + (png_structrp png_ptr)); /* Allocate and initialize the info structure */ -PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_const_structrp png_ptr), - PNG_ALLOCATED); +PNG_EXPORTA(18, png_infop, png_create_info_struct, + (png_const_structrp png_ptr), + PNG_ALLOCATED); /* DEPRECATED: this function allowed init structures to be created using the * default allocation method (typically malloc). Use is deprecated in 1.6.0 and * the API will be removed in the future. */ -PNG_EXPORTA(19, void, png_info_init_3, (png_infopp info_ptr, - size_t png_info_struct_size), PNG_DEPRECATED); +PNG_EXPORTA(19, void, png_info_init_3, + (png_infopp info_ptr, size_t png_info_struct_size), + PNG_DEPRECATED); /* Writes all the PNG information before the image. */ PNG_EXPORT(20, void, png_write_info_before_PLTE, - (png_structrp png_ptr, png_const_inforp info_ptr)); + (png_structrp png_ptr, png_const_inforp info_ptr)); PNG_EXPORT(21, void, png_write_info, - (png_structrp png_ptr, png_const_inforp info_ptr)); + (png_structrp png_ptr, png_const_inforp info_ptr)); #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the information before the actual image data. */ PNG_EXPORT(22, void, png_read_info, - (png_structrp png_ptr, png_inforp info_ptr)); + (png_structrp png_ptr, png_inforp info_ptr)); #endif #ifdef PNG_TIME_RFC1123_SUPPORTED @@ -1072,45 +1090,54 @@ PNG_EXPORT(22, void, png_read_info, */ #if PNG_LIBPNG_VER < 10700 /* To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) */ -PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123, (png_structrp png_ptr, - png_const_timep ptime),PNG_DEPRECATED); +PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123, + (png_structrp png_ptr, png_const_timep ptime), + PNG_DEPRECATED); #endif -PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer, (char out[29], - png_const_timep ptime)); +PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer, + (char out[29], png_const_timep ptime)); #endif #ifdef PNG_CONVERT_tIME_SUPPORTED /* Convert from a struct tm to png_time */ -PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime, - const struct tm * ttime)); +PNG_EXPORT(24, void, png_convert_from_struct_tm, + (png_timep ptime, const struct tm * ttime)); /* Convert from time_t to png_time. Uses gmtime() */ -PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime)); +PNG_EXPORT(25, void, png_convert_from_time_t, + (png_timep ptime, time_t ttime)); #endif /* CONVERT_tIME */ #ifdef PNG_READ_EXPAND_SUPPORTED /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ -PNG_EXPORT(26, void, png_set_expand, (png_structrp png_ptr)); -PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structrp png_ptr)); -PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structrp png_ptr)); -PNG_EXPORT(29, void, png_set_tRNS_to_alpha, (png_structrp png_ptr)); +PNG_EXPORT(26, void, png_set_expand, + (png_structrp png_ptr)); +PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, + (png_structrp png_ptr)); +PNG_EXPORT(28, void, png_set_palette_to_rgb, + (png_structrp png_ptr)); +PNG_EXPORT(29, void, png_set_tRNS_to_alpha, + (png_structrp png_ptr)); #endif #ifdef PNG_READ_EXPAND_16_SUPPORTED /* Expand to 16-bit channels, forces conversion of palette to RGB and expansion * of a tRNS chunk if present. */ -PNG_EXPORT(221, void, png_set_expand_16, (png_structrp png_ptr)); +PNG_EXPORT(221, void, png_set_expand_16, + (png_structrp png_ptr)); #endif #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) /* Use blue, green, red order for pixels. */ -PNG_EXPORT(30, void, png_set_bgr, (png_structrp png_ptr)); +PNG_EXPORT(30, void, png_set_bgr, + (png_structrp png_ptr)); #endif #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED /* Expand the grayscale to 24-bit RGB if necessary. */ -PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr)); +PNG_EXPORT(31, void, png_set_gray_to_rgb, + (png_structrp png_ptr)); #endif #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED @@ -1120,18 +1147,20 @@ PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr)); #define PNG_ERROR_ACTION_ERROR 3 #define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/ -PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structrp png_ptr, +PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, + (png_structrp png_ptr, int error_action, double red, double green)) -PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structrp png_ptr, +PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, + (png_structrp png_ptr, int error_action, png_fixed_point red, png_fixed_point green)) -PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp - png_ptr)); +PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, + (png_const_structrp png_ptr)); #endif #ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED -PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, - png_colorp palette)); +PNG_EXPORT(35, void, png_build_grayscale_palette, + (int bit_depth, png_colorp palette)); #endif #ifdef PNG_READ_ALPHA_MODE_SUPPORTED @@ -1176,10 +1205,10 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, #define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ -PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode, - double output_gamma)) -PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr, - int mode, png_fixed_point output_gamma)) +PNG_FP_EXPORT(227, void, png_set_alpha_mode, + (png_structrp png_ptr, int mode, double output_gamma)) +PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, + (png_structrp png_ptr, int mode, png_fixed_point output_gamma)) #endif #if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) @@ -1269,51 +1298,57 @@ PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr, */ #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED -PNG_EXPORT(36, void, png_set_strip_alpha, (png_structrp png_ptr)); +PNG_EXPORT(36, void, png_set_strip_alpha, + (png_structrp png_ptr)); #endif #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \ defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) -PNG_EXPORT(37, void, png_set_swap_alpha, (png_structrp png_ptr)); +PNG_EXPORT(37, void, png_set_swap_alpha, + (png_structrp png_ptr)); #endif #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) -PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr)); +PNG_EXPORT(38, void, png_set_invert_alpha, + (png_structrp png_ptr)); #endif #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) /* Add a filler byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */ -PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler, - int flags)); +PNG_EXPORT(39, void, png_set_filler, + (png_structrp png_ptr, png_uint_32 filler, int flags)); /* The values of the PNG_FILLER_ defines should NOT be changed */ # define PNG_FILLER_BEFORE 0 # define PNG_FILLER_AFTER 1 /* Add an alpha byte to 8-bit or 16-bit Gray or 24-bit or 48-bit RGB images. */ -PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr, - png_uint_32 filler, int flags)); +PNG_EXPORT(40, void, png_set_add_alpha, + (png_structrp png_ptr, png_uint_32 filler, int flags)); #endif /* READ_FILLER || WRITE_FILLER */ #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) /* Swap bytes in 16-bit depth files. */ -PNG_EXPORT(41, void, png_set_swap, (png_structrp png_ptr)); +PNG_EXPORT(41, void, png_set_swap, + (png_structrp png_ptr)); #endif #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ -PNG_EXPORT(42, void, png_set_packing, (png_structrp png_ptr)); +PNG_EXPORT(42, void, png_set_packing, + (png_structrp png_ptr)); #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ defined(PNG_WRITE_PACKSWAP_SUPPORTED) /* Swap packing order of pixels in bytes. */ -PNG_EXPORT(43, void, png_set_packswap, (png_structrp png_ptr)); +PNG_EXPORT(43, void, png_set_packswap, + (png_structrp png_ptr)); #endif #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) /* Converts files to legal bit depths. */ -PNG_EXPORT(44, void, png_set_shift, (png_structrp png_ptr, png_const_color_8p - true_bits)); +PNG_EXPORT(44, void, png_set_shift, + (png_structrp png_ptr, png_const_color_8p true_bits)); #endif #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ @@ -1324,12 +1359,14 @@ PNG_EXPORT(44, void, png_set_shift, (png_structrp png_ptr, png_const_color_8p * necessary to call png_read_row or png_read_rows png_get_image_height * times for each pass. */ -PNG_EXPORT(45, int, png_set_interlace_handling, (png_structrp png_ptr)); +PNG_EXPORT(45, int, png_set_interlace_handling, + (png_structrp png_ptr)); #endif #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) /* Invert monochrome files */ -PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr)); +PNG_EXPORT(46, void, png_set_invert_mono, + (png_structrp png_ptr)); #endif #ifdef PNG_READ_BACKGROUND_SUPPORTED @@ -1338,10 +1375,12 @@ PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr)); * read. Doing so will result in unexpected behavior and possible warnings or * errors if the PNG file contains a bKGD chunk. */ -PNG_FP_EXPORT(47, void, png_set_background, (png_structrp png_ptr, +PNG_FP_EXPORT(47, void, png_set_background, + (png_structrp png_ptr, png_const_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma)) -PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr, +PNG_FIXED_EXPORT(215, void, png_set_background_fixed, + (png_structrp png_ptr, png_const_color_16p background_color, int background_gamma_code, int need_expand, png_fixed_point background_gamma)) #endif @@ -1354,20 +1393,23 @@ PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr, #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED /* Scale a 16-bit depth file down to 8-bit, accurately. */ -PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr)); +PNG_EXPORT(229, void, png_set_scale_16, + (png_structrp png_ptr)); #endif #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED #define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */ /* Strip the second byte of information from a 16-bit depth file. */ -PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr)); +PNG_EXPORT(48, void, png_set_strip_16, + (png_structrp png_ptr)); #endif #ifdef PNG_READ_QUANTIZE_SUPPORTED /* Turn on quantizing, and reduce the palette to the number of colors * available. */ -PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr, +PNG_EXPORT(49, void, png_set_quantize, + (png_structrp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_const_uint_16p histogram, int full_quantize)); #endif @@ -1389,82 +1431,92 @@ PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr, * API (floating point or fixed.) Notice, however, that the 'file_gamma' value * is the inverse of a 'screen gamma' value. */ -PNG_FP_EXPORT(50, void, png_set_gamma, (png_structrp png_ptr, +PNG_FP_EXPORT(50, void, png_set_gamma, + (png_structrp png_ptr, double screen_gamma, double override_file_gamma)) -PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structrp png_ptr, +PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, + (png_structrp png_ptr, png_fixed_point screen_gamma, png_fixed_point override_file_gamma)) #endif #ifdef PNG_WRITE_FLUSH_SUPPORTED /* Set how many lines between output flushes - 0 for no flushing */ -PNG_EXPORT(51, void, png_set_flush, (png_structrp png_ptr, int nrows)); +PNG_EXPORT(51, void, png_set_flush, + (png_structrp png_ptr, int nrows)); /* Flush the current PNG output buffer */ -PNG_EXPORT(52, void, png_write_flush, (png_structrp png_ptr)); +PNG_EXPORT(52, void, png_write_flush, + (png_structrp png_ptr)); #endif /* Optional update palette with requested transformations */ -PNG_EXPORT(53, void, png_start_read_image, (png_structrp png_ptr)); +PNG_EXPORT(53, void, png_start_read_image, + (png_structrp png_ptr)); /* Optional call to update the users info structure */ -PNG_EXPORT(54, void, png_read_update_info, (png_structrp png_ptr, - png_inforp info_ptr)); +PNG_EXPORT(54, void, png_read_update_info, + (png_structrp png_ptr, png_inforp info_ptr)); #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read one or more rows of image data. */ -PNG_EXPORT(55, void, png_read_rows, (png_structrp png_ptr, png_bytepp row, +PNG_EXPORT(55, void, png_read_rows, + (png_structrp png_ptr, png_bytepp row, png_bytepp display_row, png_uint_32 num_rows)); #endif #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read a row of data. */ -PNG_EXPORT(56, void, png_read_row, (png_structrp png_ptr, png_bytep row, - png_bytep display_row)); +PNG_EXPORT(56, void, png_read_row, + (png_structrp png_ptr, png_bytep row, png_bytep display_row)); #endif #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the whole image into memory at once. */ -PNG_EXPORT(57, void, png_read_image, (png_structrp png_ptr, png_bytepp image)); +PNG_EXPORT(57, void, png_read_image, + (png_structrp png_ptr, png_bytepp image)); #endif /* Write a row of image data */ -PNG_EXPORT(58, void, png_write_row, (png_structrp png_ptr, - png_const_bytep row)); +PNG_EXPORT(58, void, png_write_row, + (png_structrp png_ptr, png_const_bytep row)); /* Write a few rows of image data: (*row) is not written; however, the type * is declared as writeable to maintain compatibility with previous versions * of libpng and to allow the 'display_row' array from read_rows to be passed * unchanged to write_rows. */ -PNG_EXPORT(59, void, png_write_rows, (png_structrp png_ptr, png_bytepp row, - png_uint_32 num_rows)); +PNG_EXPORT(59, void, png_write_rows, + (png_structrp png_ptr, png_bytepp row, png_uint_32 num_rows)); /* Write the image data */ -PNG_EXPORT(60, void, png_write_image, (png_structrp png_ptr, png_bytepp image)); +PNG_EXPORT(60, void, png_write_image, + (png_structrp png_ptr, png_bytepp image)); /* Write the end of the PNG file. */ -PNG_EXPORT(61, void, png_write_end, (png_structrp png_ptr, - png_inforp info_ptr)); +PNG_EXPORT(61, void, png_write_end, + (png_structrp png_ptr, png_inforp info_ptr)); #ifdef PNG_SEQUENTIAL_READ_SUPPORTED /* Read the end of the PNG file. */ -PNG_EXPORT(62, void, png_read_end, (png_structrp png_ptr, png_inforp info_ptr)); +PNG_EXPORT(62, void, png_read_end, + (png_structrp png_ptr, png_inforp info_ptr)); #endif /* Free any memory associated with the png_info_struct */ -PNG_EXPORT(63, void, png_destroy_info_struct, (png_const_structrp png_ptr, - png_infopp info_ptr_ptr)); +PNG_EXPORT(63, void, png_destroy_info_struct, + (png_const_structrp png_ptr, png_infopp info_ptr_ptr)); /* Free any memory associated with the png_struct and the png_info_structs */ -PNG_EXPORT(64, void, png_destroy_read_struct, (png_structpp png_ptr_ptr, +PNG_EXPORT(64, void, png_destroy_read_struct, + (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); /* Free any memory associated with the png_struct and the png_info_structs */ -PNG_EXPORT(65, void, png_destroy_write_struct, (png_structpp png_ptr_ptr, - png_infopp info_ptr_ptr)); +PNG_EXPORT(65, void, png_destroy_write_struct, + (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); /* Set the libpng method of handling chunk CRC errors */ -PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action, - int ancil_action)); +PNG_EXPORT(66, void, png_set_crc_action, + (png_structrp png_ptr, int crit_action, int ancil_action)); /* Values for png_set_crc_action() say how to handle CRC errors in * ancillary and critical chunks, and whether to use the data contained @@ -1494,8 +1546,8 @@ PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action, /* Set the filtering method(s) used by libpng. Currently, the only valid * value for "method" is 0. */ -PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method, - int filters)); +PNG_EXPORT(67, void, png_set_filter, + (png_structrp png_ptr, int method, int filters)); #endif /* WRITE */ /* Flags for png_set_filter() to say which filters to use. The flags @@ -1524,11 +1576,14 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method, #ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */ -PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr, - int heuristic_method, int num_weights, png_const_doublep filter_weights, +PNG_FP_EXPORT(68, void, png_set_filter_heuristics, + (png_structrp png_ptr, + int heuristic_method, int num_weights, + png_const_doublep filter_weights, png_const_doublep filter_costs)) PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, - (png_structrp png_ptr, int heuristic_method, int num_weights, + (png_structrp png_ptr, + int heuristic_method, int num_weights, png_const_fixed_point_p filter_weights, png_const_fixed_point_p filter_costs)) #endif /* WRITE_WEIGHTED_FILTER */ @@ -1547,44 +1602,44 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, * these values may not correspond directly to the zlib compression levels. */ #ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED -PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr, - int level)); +PNG_EXPORT(69, void, png_set_compression_level, + (png_structrp png_ptr, int level)); -PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structrp png_ptr, - int mem_level)); +PNG_EXPORT(70, void, png_set_compression_mem_level, + (png_structrp png_ptr, int mem_level)); -PNG_EXPORT(71, void, png_set_compression_strategy, (png_structrp png_ptr, - int strategy)); +PNG_EXPORT(71, void, png_set_compression_strategy, + (png_structrp png_ptr, int strategy)); /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a * smaller value of window_bits if it can do so safely. */ -PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structrp png_ptr, - int window_bits)); +PNG_EXPORT(72, void, png_set_compression_window_bits, + (png_structrp png_ptr, int window_bits)); -PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr, - int method)); +PNG_EXPORT(73, void, png_set_compression_method, + (png_structrp png_ptr, int method)); #endif /* WRITE_CUSTOMIZE_COMPRESSION */ #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED /* Also set zlib parameters for compressing non-IDAT chunks */ -PNG_EXPORT(222, void, png_set_text_compression_level, (png_structrp png_ptr, - int level)); +PNG_EXPORT(222, void, png_set_text_compression_level, + (png_structrp png_ptr, int level)); -PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structrp png_ptr, - int mem_level)); +PNG_EXPORT(223, void, png_set_text_compression_mem_level, + (png_structrp png_ptr, int mem_level)); -PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structrp png_ptr, - int strategy)); +PNG_EXPORT(224, void, png_set_text_compression_strategy, + (png_structrp png_ptr, int strategy)); /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a * smaller value of window_bits if it can do so safely. */ PNG_EXPORT(225, void, png_set_text_compression_window_bits, - (png_structrp png_ptr, int window_bits)); + (png_structrp png_ptr, int window_bits)); -PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr, - int method)); +PNG_EXPORT(226, void, png_set_text_compression_method, + (png_structrp png_ptr, int method)); #endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */ #endif /* WRITE */ @@ -1599,7 +1654,8 @@ PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr, #ifdef PNG_STDIO_SUPPORTED /* Initialize the input/output for the PNG file to the default functions. */ -PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, FILE *fp)); +PNG_EXPORT(74, void, png_init_io, + (png_structrp png_ptr, FILE *fp)); #endif /* Replace the (error and abort), and warning functions with user @@ -1610,11 +1666,13 @@ PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, FILE *fp)); * default function will be used. */ -PNG_EXPORT(75, void, png_set_error_fn, (png_structrp png_ptr, +PNG_EXPORT(75, void, png_set_error_fn, + (png_structrp png_ptr, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); /* Return the user pointer associated with the error functions */ -PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structrp png_ptr)); +PNG_EXPORT(76, png_voidp, png_get_error_ptr, + (png_const_structrp png_ptr)); /* Replace the default data output functions with a user supplied one(s). * If buffered output is not used, then output_flush_fn can be set to NULL. @@ -1626,47 +1684,54 @@ PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structrp png_ptr)); * default flush function, which uses the standard *FILE structure, will * be used. */ -PNG_EXPORT(77, void, png_set_write_fn, (png_structrp png_ptr, png_voidp io_ptr, +PNG_EXPORT(77, void, png_set_write_fn, + (png_structrp png_ptr, + png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); /* Replace the default data input function with a user supplied one. */ -PNG_EXPORT(78, void, png_set_read_fn, (png_structrp png_ptr, png_voidp io_ptr, - png_rw_ptr read_data_fn)); +PNG_EXPORT(78, void, png_set_read_fn, + (png_structrp png_ptr, + png_voidp io_ptr, png_rw_ptr read_data_fn)); /* Return the user pointer associated with the I/O functions */ -PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_const_structrp png_ptr)); +PNG_EXPORT(79, png_voidp, png_get_io_ptr, + (png_const_structrp png_ptr)); -PNG_EXPORT(80, void, png_set_read_status_fn, (png_structrp png_ptr, - png_read_status_ptr read_row_fn)); +PNG_EXPORT(80, void, png_set_read_status_fn, + (png_structrp png_ptr, png_read_status_ptr read_row_fn)); -PNG_EXPORT(81, void, png_set_write_status_fn, (png_structrp png_ptr, - png_write_status_ptr write_row_fn)); +PNG_EXPORT(81, void, png_set_write_status_fn, + (png_structrp png_ptr, png_write_status_ptr write_row_fn)); #ifdef PNG_USER_MEM_SUPPORTED /* Replace the default memory allocation functions with user supplied one(s). */ -PNG_EXPORT(82, void, png_set_mem_fn, (png_structrp png_ptr, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn)); +PNG_EXPORT(82, void, png_set_mem_fn, + (png_structrp png_ptr, + png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn)); /* Return the user pointer associated with the memory functions */ -PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structrp png_ptr)); +PNG_EXPORT(83, png_voidp, png_get_mem_ptr, + (png_const_structrp png_ptr)); #endif #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED -PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structrp png_ptr, - png_user_transform_ptr read_user_transform_fn)); +PNG_EXPORT(84, void, png_set_read_user_transform_fn, + (png_structrp png_ptr, png_user_transform_ptr read_user_transform_fn)); #endif #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED -PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structrp png_ptr, - png_user_transform_ptr write_user_transform_fn)); +PNG_EXPORT(85, void, png_set_write_user_transform_fn, + (png_structrp png_ptr, png_user_transform_ptr write_user_transform_fn)); #endif #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED -PNG_EXPORT(86, void, png_set_user_transform_info, (png_structrp png_ptr, - png_voidp user_transform_ptr, int user_transform_depth, - int user_transform_channels)); +PNG_EXPORT(86, void, png_set_user_transform_info, + (png_structrp png_ptr, + png_voidp user_transform_ptr, + int user_transform_depth, int user_transform_channels)); /* Return the user pointer associated with the user transform functions */ PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); #endif #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED @@ -1681,8 +1746,10 @@ PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, * find the output pixel (x,y) given an interlaced sub-image pixel * (row,col,pass). (See below for these macros.) */ -PNG_EXPORT(217, png_uint_32, png_get_current_row_number, (png_const_structrp)); -PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp)); +PNG_EXPORT(217, png_uint_32, png_get_current_row_number, + (png_const_structrp)); +PNG_EXPORT(218, png_byte, png_get_current_pass_number, + (png_const_structrp)); #endif #ifdef PNG_READ_USER_CHUNKS_SUPPORTED @@ -1705,28 +1772,32 @@ PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp)); * See "INTERACTION WITH USER CHUNK CALLBACKS" below for important notes about * how this behavior will change in libpng 1.7 */ -PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr, +PNG_EXPORT(88, void, png_set_read_user_chunk_fn, + (png_structrp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); #endif #ifdef PNG_USER_CHUNKS_SUPPORTED -PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structrp png_ptr)); +PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, + (png_const_structrp png_ptr)); #endif #ifdef PNG_PROGRESSIVE_READ_SUPPORTED /* Sets the function callbacks for the push reader, and a pointer to a * user-defined structure available to the callback functions. */ -PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structrp png_ptr, +PNG_EXPORT(90, void, png_set_progressive_read_fn, + (png_structrp png_ptr, png_voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); /* Returns the user pointer associated with the push read functions */ PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); /* Function to be called when data becomes available */ -PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr, +PNG_EXPORT(92, void, png_process_data, + (png_structrp png_ptr, png_inforp info_ptr, png_bytep buffer, size_t buffer_size)); /* A function which may be called *only* within png_process_data to stop the @@ -1736,7 +1807,8 @@ PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr, * 'save' is set to true the routine will first save all the pending data and * will always return 0. */ -PNG_EXPORT(219, size_t, png_process_data_pause, (png_structrp, int save)); +PNG_EXPORT(219, size_t, png_process_data_pause, + (png_structrp, int save)); /* A function which may be called *only* outside (after) a call to * png_process_data. It returns the number of bytes of data to skip in the @@ -1744,45 +1816,53 @@ PNG_EXPORT(219, size_t, png_process_data_pause, (png_structrp, int save)); * application must skip than number of bytes of input data and pass the * following data to the next call to png_process_data. */ -PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp)); +PNG_EXPORT(220, png_uint_32, png_process_data_skip, + (png_structrp)); /* Function that combines rows. 'new_row' is a flag that should come from * the callback and be non-NULL if anything needs to be done; the library * stores its own version of the new data internally and ignores the passed * in value. */ -PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr, +PNG_EXPORT(93, void, png_progressive_combine_row, + (png_const_structrp png_ptr, png_bytep old_row, png_const_bytep new_row)); #endif /* PROGRESSIVE_READ */ -PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr, - png_alloc_size_t size), PNG_ALLOCATED); +PNG_EXPORTA(94, png_voidp, png_malloc, + (png_const_structrp png_ptr, png_alloc_size_t size), + PNG_ALLOCATED); /* Added at libpng version 1.4.0 */ -PNG_EXPORTA(95, png_voidp, png_calloc, (png_const_structrp png_ptr, - png_alloc_size_t size), PNG_ALLOCATED); +PNG_EXPORTA(95, png_voidp, png_calloc, + (png_const_structrp png_ptr, png_alloc_size_t size), + PNG_ALLOCATED); /* Added at libpng version 1.2.4 */ -PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_const_structrp png_ptr, - png_alloc_size_t size), PNG_ALLOCATED); +PNG_EXPORTA(96, png_voidp, png_malloc_warn, + (png_const_structrp png_ptr, png_alloc_size_t size), + PNG_ALLOCATED); /* Frees a pointer allocated by png_malloc() */ -PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr)); +PNG_EXPORT(97, void, png_free, + (png_const_structrp png_ptr, png_voidp ptr)); /* Free data that was allocated internally */ -PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_32 free_me, int num)); +PNG_EXPORT(98, void, png_free_data, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_uint_32 free_me, int num)); /* Reassign the responsibility for freeing existing data, whether allocated * by libpng or by the application; this works on the png_info structure passed * in, without changing the state for other png_info structures. */ -PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr, - png_inforp info_ptr, int freer, png_uint_32 mask)); +PNG_EXPORT(99, void, png_data_freer, + (png_const_structrp png_ptr, png_inforp info_ptr, + int freer, png_uint_32 mask)); /* Assignments for png_data_freer */ #define PNG_DESTROY_WILL_FREE_DATA 1 -#define PNG_SET_WILL_FREE_DATA 1 -#define PNG_USER_WILL_FREE_DATA 2 +#define PNG_SET_WILL_FREE_DATA 1 +#define PNG_USER_WILL_FREE_DATA 2 /* Flags for png_ptr->free_me and info_ptr->free_me */ #define PNG_FREE_HIST 0x0008U #define PNG_FREE_ICCP 0x0010U @@ -1802,36 +1882,42 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr, #define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ #ifdef PNG_USER_MEM_SUPPORTED -PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr, - png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED); -PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr, - png_voidp ptr), PNG_DEPRECATED); +PNG_EXPORTA(100, png_voidp, png_malloc_default, + (png_const_structrp png_ptr, png_alloc_size_t size), + PNG_ALLOCATED PNG_DEPRECATED); +PNG_EXPORTA(101, void, png_free_default, + (png_const_structrp png_ptr, png_voidp ptr), + PNG_DEPRECATED); #endif #ifdef PNG_ERROR_TEXT_SUPPORTED /* Fatal error in PNG image of libpng - can't continue */ -PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr, - png_const_charp error_message), PNG_NORETURN); +PNG_EXPORTA(102, void, png_error, + (png_const_structrp png_ptr, png_const_charp error_message), + PNG_NORETURN); /* The same, but the chunk name is prepended to the error string. */ -PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr, - png_const_charp error_message), PNG_NORETURN); +PNG_EXPORTA(103, void, png_chunk_error, + (png_const_structrp png_ptr, png_const_charp error_message), + PNG_NORETURN); #else /* Fatal error in PNG image of libpng - can't continue */ -PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN); +PNG_EXPORTA(104, void, png_err, + (png_const_structrp png_ptr), + PNG_NORETURN); # define png_error(s1,s2) png_err(s1) # define png_chunk_error(s1,s2) png_err(s1) #endif #ifdef PNG_WARNINGS_SUPPORTED /* Non-fatal error in libpng. Can continue, but may have a problem. */ -PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr, - png_const_charp warning_message)); +PNG_EXPORT(105, void, png_warning, + (png_const_structrp png_ptr, png_const_charp warning_message)); /* Non-fatal error in libpng, chunk name is prepended to message. */ -PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr, - png_const_charp warning_message)); +PNG_EXPORT(106, void, png_chunk_warning, + (png_const_structrp png_ptr, png_const_charp warning_message)); #else # define png_warning(s1,s2) ((void)(s1)) # define png_chunk_warning(s1,s2) ((void)(s1)) @@ -1840,17 +1926,17 @@ PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr, #ifdef PNG_BENIGN_ERRORS_SUPPORTED /* Benign error in libpng. Can continue, but may have a problem. * User can choose whether to handle as a fatal error or as a warning. */ -PNG_EXPORT(107, void, png_benign_error, (png_const_structrp png_ptr, - png_const_charp warning_message)); +PNG_EXPORT(107, void, png_benign_error, + (png_const_structrp png_ptr, png_const_charp warning_message)); #ifdef PNG_READ_SUPPORTED /* Same, chunk name is prepended to message (only during read) */ -PNG_EXPORT(108, void, png_chunk_benign_error, (png_const_structrp png_ptr, - png_const_charp warning_message)); +PNG_EXPORT(108, void, png_chunk_benign_error, + (png_const_structrp png_ptr, png_const_charp warning_message)); #endif PNG_EXPORT(109, void, png_set_benign_errors, - (png_structrp png_ptr, int allowed)); + (png_structrp png_ptr, int allowed)); #else # ifdef PNG_ALLOW_BENIGN_ERRORS # define png_benign_error png_warning @@ -1874,169 +1960,181 @@ PNG_EXPORT(109, void, png_set_benign_errors, * png_info_struct. */ /* Returns "flag" if chunk data is valid in info_ptr. */ -PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 flag)); +PNG_EXPORT(110, png_uint_32, png_get_valid, + (png_const_structrp png_ptr, png_const_inforp info_ptr, png_uint_32 flag)); /* Returns number of bytes needed to hold a transformed row. */ -PNG_EXPORT(111, size_t, png_get_rowbytes, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(111, size_t, png_get_rowbytes, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); #ifdef PNG_INFO_IMAGE_SUPPORTED /* Returns row_pointers, which is an array of pointers to scanlines that was * returned from png_read_png(). */ -PNG_EXPORT(112, png_bytepp, png_get_rows, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(112, png_bytepp, png_get_rows, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Set row_pointers, which is an array of pointers to scanlines for use * by png_write_png(). */ -PNG_EXPORT(113, void, png_set_rows, (png_const_structrp png_ptr, - png_inforp info_ptr, png_bytepp row_pointers)); +PNG_EXPORT(113, void, png_set_rows, + (png_const_structrp png_ptr, png_inforp info_ptr, png_bytepp row_pointers)); #endif /* Returns number of color channels in image. */ -PNG_EXPORT(114, png_byte, png_get_channels, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(114, png_byte, png_get_channels, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); #ifdef PNG_EASY_ACCESS_SUPPORTED /* Returns image width in pixels. */ -PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(115, png_uint_32, png_get_image_width, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Returns image height in pixels. */ -PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(116, png_uint_32, png_get_image_height, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Returns image bit_depth. */ -PNG_EXPORT(117, png_byte, png_get_bit_depth, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(117, png_byte, png_get_bit_depth, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Returns image color_type. */ -PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(118, png_byte, png_get_color_type, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Returns image filter_type. */ -PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(119, png_byte, png_get_filter_type, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Returns image interlace_type. */ -PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(120, png_byte, png_get_interlace_type, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Returns image compression_type. */ -PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(121, png_byte, png_get_compression_type, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Returns image resolution in pixels per meter, from pHYs chunk data. */ PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); /* Returns pixel aspect ratio, computed from pHYs chunk data. */ PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) + (png_const_structrp png_ptr, png_const_inforp info_ptr)) PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) + (png_const_structrp png_ptr, png_const_inforp info_ptr)) /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); #endif /* EASY_ACCESS */ #ifdef PNG_READ_SUPPORTED /* Returns pointer to signature string read from PNG header */ -PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structrp png_ptr, - png_const_inforp info_ptr)); +PNG_EXPORT(130, png_const_bytep, png_get_signature, + (png_const_structrp png_ptr, png_const_inforp info_ptr)); #endif #ifdef PNG_bKGD_SUPPORTED -PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structrp png_ptr, - png_inforp info_ptr, png_color_16p *background)); +PNG_EXPORT(131, png_uint_32, png_get_bKGD, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_color_16p *background)); #endif #ifdef PNG_bKGD_SUPPORTED -PNG_EXPORT(132, void, png_set_bKGD, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_color_16p background)); +PNG_EXPORT(132, void, png_set_bKGD, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_const_color_16p background)); #endif #ifdef PNG_cHRM_SUPPORTED -PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structrp png_ptr, - png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x, - double *red_y, double *green_x, double *green_y, double *blue_x, - double *blue_y)) -PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_const_structrp png_ptr, - png_const_inforp info_ptr, double *red_X, double *red_Y, double *red_Z, - double *green_X, double *green_Y, double *green_Z, double *blue_X, - double *blue_Y, double *blue_Z)) +PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + double *white_x, double *white_y, + double *red_x, double *red_y, + double *green_x, double *green_y, + double *blue_x, double *blue_y)) +PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + double *red_X, double *red_Y, double *red_Z, + double *green_X, double *green_Y, double *green_Z, + double *blue_X, double *blue_Y, double *blue_Z)) PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, + (png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)) PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, + (png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_red_X, png_fixed_point *int_red_Y, - png_fixed_point *int_red_Z, png_fixed_point *int_green_X, - png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, + png_fixed_point *int_red_Z, + png_fixed_point *int_green_X, png_fixed_point *int_green_Y, + png_fixed_point *int_green_Z, png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, png_fixed_point *int_blue_Z)) #endif #ifdef PNG_cHRM_SUPPORTED -PNG_FP_EXPORT(135, void, png_set_cHRM, (png_const_structrp png_ptr, - png_inforp info_ptr, - double white_x, double white_y, double red_x, double red_y, double green_x, - double green_y, double blue_x, double blue_y)) -PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr, - png_inforp info_ptr, double red_X, double red_Y, double red_Z, - double green_X, double green_Y, double green_Z, double blue_X, - double blue_Y, double blue_Z)) -PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, png_fixed_point int_white_x, - png_fixed_point int_white_y, png_fixed_point int_red_x, - png_fixed_point int_red_y, png_fixed_point int_green_x, - png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)) -PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, - png_fixed_point int_red_Z, png_fixed_point int_green_X, - png_fixed_point int_green_Y, png_fixed_point int_green_Z, +PNG_FP_EXPORT(135, void, png_set_cHRM, + (png_const_structrp png_ptr, png_inforp info_ptr, + double white_x, double white_y, + double red_x, double red_y, + double green_x, double green_y, + double blue_x, double blue_y)) +PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, + (png_const_structrp png_ptr, png_inforp info_ptr, + double red_X, double red_Y, double red_Z, + double green_X, double green_Y, double green_Z, + double blue_X, double blue_Y, double blue_Z)) +PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_fixed_point int_white_x, png_fixed_point int_white_y, + png_fixed_point int_red_x, png_fixed_point int_red_y, + png_fixed_point int_green_x, png_fixed_point int_green_y, + png_fixed_point int_blue_x, png_fixed_point int_blue_y)) +PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_fixed_point int_red_X, png_fixed_point int_red_Y, + png_fixed_point int_red_Z, + png_fixed_point int_green_X, png_fixed_point int_green_Y, + png_fixed_point int_green_Z, png_fixed_point int_blue_X, png_fixed_point int_blue_Y, png_fixed_point int_blue_Z)) #endif #ifdef PNG_cICP_SUPPORTED -PNG_EXPORT(250, png_uint_32, png_get_cICP, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_bytep colour_primaries, - png_bytep transfer_function, png_bytep matrix_coefficients, - png_bytep video_full_range_flag)); +PNG_EXPORT(250, png_uint_32, png_get_cICP, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + png_bytep colour_primaries, png_bytep transfer_function, + png_bytep matrix_coefficients, png_bytep video_full_range_flag)); #endif #ifdef PNG_cICP_SUPPORTED -PNG_EXPORT(251, void, png_set_cICP, (png_const_structrp png_ptr, - png_inforp info_ptr, png_byte colour_primaries, - png_byte transfer_function, png_byte matrix_coefficients, - png_byte video_full_range_flag)); +PNG_EXPORT(251, void, png_set_cICP, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_byte colour_primaries, png_byte transfer_function, + png_byte matrix_coefficients, png_byte video_full_range_flag)); #endif #ifdef PNG_cLLI_SUPPORTED -PNG_FP_EXPORT(252, png_uint_32, png_get_cLLI, (png_const_structrp png_ptr, - png_const_inforp info_ptr, double *maximum_content_light_level, - double *maximum_frame_average_light_level)) +PNG_FP_EXPORT(252, png_uint_32, png_get_cLLI, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + double *maximum_content_light_level, + double *maximum_frame_average_light_level)) PNG_FIXED_EXPORT(253, png_uint_32, png_get_cLLI_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, + (png_const_structrp png_ptr, png_const_inforp info_ptr, /* The values below are in cd/m2 (nits) and are scaled by 10,000; not * 100,000 as in the case of png_fixed_point. */ @@ -2045,11 +2143,12 @@ PNG_FIXED_EXPORT(253, png_uint_32, png_get_cLLI_fixed, #endif #ifdef PNG_cLLI_SUPPORTED -PNG_FP_EXPORT(254, void, png_set_cLLI, (png_const_structrp png_ptr, - png_inforp info_ptr, double maximum_content_light_level, - double maximum_frame_average_light_level)) -PNG_FIXED_EXPORT(255, void, png_set_cLLI_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, +PNG_FP_EXPORT(254, void, png_set_cLLI, + (png_const_structrp png_ptr, png_inforp info_ptr, + double maximum_content_light_level, + double maximum_frame_average_light_level)) +PNG_FIXED_EXPORT(255, void, png_set_cLLI_fixed, + (png_const_structrp png_ptr, png_inforp info_ptr, /* The values below are in cd/m2 (nits) and are scaled by 10,000; not * 100,000 as in the case of png_fixed_point. */ @@ -2058,64 +2157,73 @@ PNG_FIXED_EXPORT(255, void, png_set_cLLI_fixed, (png_const_structrp png_ptr, #endif #ifdef PNG_eXIf_SUPPORTED -PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr, - png_inforp info_ptr, png_bytep *exif)); -PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr, - png_inforp info_ptr, png_bytep exif)); +PNG_EXPORT(246, png_uint_32, png_get_eXIf, + (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep *exif)); +PNG_EXPORT(247, void, png_set_eXIf, + (png_const_structrp png_ptr, png_inforp info_ptr, png_bytep exif)); -PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif)); -PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_32 num_exif, png_bytep exif)); +PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + png_uint_32 *num_exif, png_bytep *exif)); +PNG_EXPORT(249, void, png_set_eXIf_1, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_uint_32 num_exif, png_bytep exif)); #endif #ifdef PNG_gAMA_SUPPORTED -PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr, - png_const_inforp info_ptr, double *file_gamma)) +PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + double *file_gamma)) PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, + (png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_file_gamma)) #endif #ifdef PNG_gAMA_SUPPORTED -PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr, - png_inforp info_ptr, double file_gamma)) -PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, png_fixed_point int_file_gamma)) +PNG_FP_EXPORT(139, void, png_set_gAMA, + (png_const_structrp png_ptr, png_inforp info_ptr, + double file_gamma)) +PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_fixed_point int_file_gamma)) #endif #ifdef PNG_hIST_SUPPORTED -PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_16p *hist)); -PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_uint_16p hist)); +PNG_EXPORT(141, png_uint_32, png_get_hIST, + (png_const_structrp png_ptr, png_inforp info_ptr, png_uint_16p *hist)); +PNG_EXPORT(142, void, png_set_hIST, + (png_const_structrp png_ptr, png_inforp info_ptr, png_const_uint_16p hist)); #endif -PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 *width, png_uint_32 *height, - int *bit_depth, int *color_type, int *interlace_method, - int *compression_method, int *filter_method)); +PNG_EXPORT(143, png_uint_32, png_get_IHDR, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + png_uint_32 *width, png_uint_32 *height, + int *bit_depth, int *color_type, + int *interlace_method, int *compression_method, int *filter_method)); -PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, - int color_type, int interlace_method, int compression_method, - int filter_method)); +PNG_EXPORT(144, void, png_set_IHDR, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_uint_32 width, png_uint_32 height, + int bit_depth, int color_type, + int interlace_method, int compression_method, int filter_method)); #ifdef PNG_mDCV_SUPPORTED -PNG_FP_EXPORT(256, png_uint_32, png_get_mDCV, (png_const_structrp png_ptr, - png_const_inforp info_ptr, +PNG_FP_EXPORT(256, png_uint_32, png_get_mDCV, + (png_const_structrp png_ptr, png_const_inforp info_ptr, /* The chromaticities of the mastering display. As cHRM, but independent of * the encoding endpoints in cHRM, or cICP, or iCCP. These values will * always be in the range 0 to 1.3107. */ - double *white_x, double *white_y, double *red_x, double *red_y, - double *green_x, double *green_y, double *blue_x, double *blue_y, + double *white_x, double *white_y, + double *red_x, double *red_y, + double *green_x, double *green_y, + double *blue_x, double *blue_y, /* Mastering display luminance in cd/m2 (nits). */ double *mastering_display_maximum_luminance, double *mastering_display_minimum_luminance)) PNG_FIXED_EXPORT(257, png_uint_32, png_get_mDCV_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, + (png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, @@ -2128,19 +2236,21 @@ PNG_FIXED_EXPORT(257, png_uint_32, png_get_mDCV_fixed, #endif #ifdef PNG_mDCV_SUPPORTED -PNG_FP_EXPORT(258, void, png_set_mDCV, (png_const_structrp png_ptr, - png_inforp info_ptr, +PNG_FP_EXPORT(258, void, png_set_mDCV, + (png_const_structrp png_ptr, png_inforp info_ptr, /* The chromaticities of the mastering display. As cHRM, but independent of * the encoding endpoints in cHRM, or cICP, or iCCP. */ - double white_x, double white_y, double red_x, double red_y, double green_x, - double green_y, double blue_x, double blue_y, + double white_x, double white_y, + double red_x, double red_y, + double green_x, double green_y, + double blue_x, double blue_y, /* Mastering display luminance in cd/m2 (nits). */ double mastering_display_maximum_luminance, double mastering_display_minimum_luminance)) -PNG_FIXED_EXPORT(259, void, png_set_mDCV_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, +PNG_FIXED_EXPORT(259, void, png_set_mDCV_fixed, + (png_const_structrp png_ptr, png_inforp info_ptr, /* The admissible range of these values is not the full range of a PNG * fixed point value. Negative values cannot be encoded and the maximum * value is about 1.3 */ @@ -2156,95 +2266,107 @@ PNG_FIXED_EXPORT(259, void, png_set_mDCV_fixed, (png_const_structrp png_ptr, #endif #ifdef PNG_oFFs_SUPPORTED -PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, - int *unit_type)); +PNG_EXPORT(145, png_uint_32, png_get_oFFs, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)); #endif #ifdef PNG_oFFs_SUPPORTED -PNG_EXPORT(146, void, png_set_oFFs, (png_const_structrp png_ptr, - png_inforp info_ptr, png_int_32 offset_x, png_int_32 offset_y, - int unit_type)); +PNG_EXPORT(146, void, png_set_oFFs, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_int_32 offset_x, png_int_32 offset_y, int unit_type)); #endif #ifdef PNG_pCAL_SUPPORTED -PNG_EXPORT(147, png_uint_32, png_get_pCAL, (png_const_structrp png_ptr, - png_inforp info_ptr, png_charp *purpose, png_int_32 *X0, - png_int_32 *X1, int *type, int *nparams, png_charp *units, - png_charpp *params)); +PNG_EXPORT(147, png_uint_32, png_get_pCAL, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_charp *purpose, png_int_32 *X0, png_int_32 *X1, + int *type, int *nparams, png_charp *units, png_charpp *params)); #endif #ifdef PNG_pCAL_SUPPORTED -PNG_EXPORT(148, void, png_set_pCAL, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_charp purpose, png_int_32 X0, png_int_32 X1, +PNG_EXPORT(148, void, png_set_pCAL, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, png_const_charp units, png_charpp params)); #endif #ifdef PNG_pHYs_SUPPORTED -PNG_EXPORT(149, png_uint_32, png_get_pHYs, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, - int *unit_type)); +PNG_EXPORT(149, png_uint_32, png_get_pHYs, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); #endif #ifdef PNG_pHYs_SUPPORTED -PNG_EXPORT(150, void, png_set_pHYs, (png_const_structrp png_ptr, - png_inforp info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); +PNG_EXPORT(150, void, png_set_pHYs, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_uint_32 res_x, png_uint_32 res_y, int unit_type)); #endif -PNG_EXPORT(151, png_uint_32, png_get_PLTE, (png_const_structrp png_ptr, - png_inforp info_ptr, png_colorp *palette, int *num_palette)); +PNG_EXPORT(151, png_uint_32, png_get_PLTE, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_colorp *palette, int *num_palette)); -PNG_EXPORT(152, void, png_set_PLTE, (png_structrp png_ptr, - png_inforp info_ptr, png_const_colorp palette, int num_palette)); +PNG_EXPORT(152, void, png_set_PLTE, + (png_structrp png_ptr, png_inforp info_ptr, + png_const_colorp palette, int num_palette)); #ifdef PNG_sBIT_SUPPORTED -PNG_EXPORT(153, png_uint_32, png_get_sBIT, (png_const_structrp png_ptr, - png_inforp info_ptr, png_color_8p *sig_bit)); +PNG_EXPORT(153, png_uint_32, png_get_sBIT, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_color_8p *sig_bit)); #endif #ifdef PNG_sBIT_SUPPORTED -PNG_EXPORT(154, void, png_set_sBIT, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_color_8p sig_bit)); +PNG_EXPORT(154, void, png_set_sBIT, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_const_color_8p sig_bit)); #endif #ifdef PNG_sRGB_SUPPORTED -PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structrp png_ptr, - png_const_inforp info_ptr, int *file_srgb_intent)); +PNG_EXPORT(155, png_uint_32, png_get_sRGB, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + int *file_srgb_intent)); #endif #ifdef PNG_sRGB_SUPPORTED -PNG_EXPORT(156, void, png_set_sRGB, (png_const_structrp png_ptr, - png_inforp info_ptr, int srgb_intent)); -PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_const_structrp png_ptr, - png_inforp info_ptr, int srgb_intent)); +PNG_EXPORT(156, void, png_set_sRGB, + (png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)); +PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, + (png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)); #endif #ifdef PNG_iCCP_SUPPORTED -PNG_EXPORT(158, png_uint_32, png_get_iCCP, (png_const_structrp png_ptr, - png_inforp info_ptr, png_charpp name, int *compression_type, +PNG_EXPORT(158, png_uint_32, png_get_iCCP, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_charpp name, int *compression_type, png_bytepp profile, png_uint_32 *proflen)); #endif #ifdef PNG_iCCP_SUPPORTED -PNG_EXPORT(159, void, png_set_iCCP, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_charp name, int compression_type, +PNG_EXPORT(159, void, png_set_iCCP, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_const_charp name, int compression_type, png_const_bytep profile, png_uint_32 proflen)); #endif #ifdef PNG_sPLT_SUPPORTED -PNG_EXPORT(160, int, png_get_sPLT, (png_const_structrp png_ptr, - png_inforp info_ptr, png_sPLT_tpp entries)); +PNG_EXPORT(160, int, png_get_sPLT, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_sPLT_tpp entries)); #endif #ifdef PNG_sPLT_SUPPORTED -PNG_EXPORT(161, void, png_set_sPLT, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_sPLT_tp entries, int nentries)); +PNG_EXPORT(161, void, png_set_sPLT, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_const_sPLT_tp entries, int nentries)); #endif #ifdef PNG_TEXT_SUPPORTED /* png_get_text also returns the number of text chunks in *num_text */ -PNG_EXPORT(162, int, png_get_text, (png_const_structrp png_ptr, - png_inforp info_ptr, png_textp *text_ptr, int *num_text)); +PNG_EXPORT(162, int, png_get_text, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_textp *text_ptr, int *num_text)); #endif /* Note while png_set_text() will accept a structure whose text, @@ -2255,35 +2377,41 @@ PNG_EXPORT(162, int, png_get_text, (png_const_structrp png_ptr, */ #ifdef PNG_TEXT_SUPPORTED -PNG_EXPORT(163, void, png_set_text, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_textp text_ptr, int num_text)); +PNG_EXPORT(163, void, png_set_text, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_const_textp text_ptr, int num_text)); #endif #ifdef PNG_tIME_SUPPORTED -PNG_EXPORT(164, png_uint_32, png_get_tIME, (png_const_structrp png_ptr, - png_inforp info_ptr, png_timep *mod_time)); +PNG_EXPORT(164, png_uint_32, png_get_tIME, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_timep *mod_time)); #endif #ifdef PNG_tIME_SUPPORTED -PNG_EXPORT(165, void, png_set_tIME, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_timep mod_time)); +PNG_EXPORT(165, void, png_set_tIME, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_const_timep mod_time)); #endif #ifdef PNG_tRNS_SUPPORTED -PNG_EXPORT(166, png_uint_32, png_get_tRNS, (png_const_structrp png_ptr, - png_inforp info_ptr, png_bytep *trans_alpha, int *num_trans, +PNG_EXPORT(166, png_uint_32, png_get_tRNS, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)); #endif #ifdef PNG_tRNS_SUPPORTED -PNG_EXPORT(167, void, png_set_tRNS, (png_structrp png_ptr, - png_inforp info_ptr, png_const_bytep trans_alpha, int num_trans, +PNG_EXPORT(167, void, png_set_tRNS, + (png_structrp png_ptr, png_inforp info_ptr, + png_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color)); #endif #ifdef PNG_sCAL_SUPPORTED -PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr, - png_const_inforp info_ptr, int *unit, double *width, double *height)) +PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + int *unit, double *width, double *height)) #if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \ defined(PNG_FLOATING_POINT_SUPPORTED) /* NOTE: this API is currently implemented using floating point arithmetic, @@ -2292,21 +2420,22 @@ PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr, * is highly recommended that png_get_sCAL_s be used instead. */ PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, - png_fixed_point *width, png_fixed_point *height)) + (png_const_structrp png_ptr, png_const_inforp info_ptr, + int *unit, png_fixed_point *width, png_fixed_point *height)) #endif PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, - (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, - png_charpp swidth, png_charpp sheight)); + (png_const_structrp png_ptr, png_const_inforp info_ptr, + int *unit, png_charpp swidth, png_charpp sheight)); -PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr, - png_inforp info_ptr, int unit, double width, double height)) -PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr, - png_inforp info_ptr, int unit, png_fixed_point width, - png_fixed_point height)) -PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr, - png_inforp info_ptr, int unit, - png_const_charp swidth, png_const_charp sheight)); +PNG_FP_EXPORT(170, void, png_set_sCAL, + (png_const_structrp png_ptr, png_inforp info_ptr, + int unit, double width, double height)) +PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, + (png_const_structrp png_ptr, png_inforp info_ptr, + int unit, png_fixed_point width, png_fixed_point height)) +PNG_EXPORT(171, void, png_set_sCAL_s, + (png_const_structrp png_ptr, png_inforp info_ptr, + int unit, png_const_charp swidth, png_const_charp sheight)); #endif /* sCAL */ #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED @@ -2409,7 +2538,8 @@ PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr, * be processed by libpng. */ #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED -PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr, +PNG_EXPORT(172, void, png_set_keep_unknown_chunks, + (png_structrp png_ptr, int keep, png_const_bytep chunk_list, int num_chunks)); #endif /* HANDLE_AS_UNKNOWN */ @@ -2417,14 +2547,14 @@ PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr, * the result is therefore true (non-zero) if special handling is required, * false for the default handling. */ -PNG_EXPORT(173, int, png_handle_as_unknown, (png_const_structrp png_ptr, - png_const_bytep chunk_name)); +PNG_EXPORT(173, int, png_handle_as_unknown, + (png_const_structrp png_ptr, png_const_bytep chunk_name)); #endif /* SET_UNKNOWN_CHUNKS */ #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED -PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr, - png_inforp info_ptr, png_const_unknown_chunkp unknowns, - int num_unknowns)); +PNG_EXPORT(174, void, png_set_unknown_chunks, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_const_unknown_chunkp unknowns, int num_unknowns)); /* NOTE: prior to 1.6.0 this routine set the 'location' field of the added * unknowns to the location currently stored in the png_struct. This is * invariably the wrong value on write. To fix this call the following API @@ -2435,43 +2565,47 @@ PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr, */ PNG_EXPORT(175, void, png_set_unknown_chunk_location, - (png_const_structrp png_ptr, png_inforp info_ptr, int chunk, int location)); + (png_const_structrp png_ptr, png_inforp info_ptr, + int chunk, int location)); -PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structrp png_ptr, - png_inforp info_ptr, png_unknown_chunkpp entries)); +PNG_EXPORT(176, int, png_get_unknown_chunks, + (png_const_structrp png_ptr, png_inforp info_ptr, + png_unknown_chunkpp entries)); #endif /* Png_free_data() will turn off the "valid" flag for anything it frees. * If you need to turn it off for a chunk that your application has freed, * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); */ -PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr, - png_inforp info_ptr, int mask)); +PNG_EXPORT(177, void, png_set_invalid, + (png_const_structrp png_ptr, png_inforp info_ptr, int mask)); #ifdef PNG_INFO_IMAGE_SUPPORTED /* The "params" pointer is currently not used and is for future expansion. */ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED -PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr, +PNG_EXPORT(178, void, png_read_png, + (png_structrp png_ptr, png_inforp info_ptr, int transforms, png_voidp params)); #endif #ifdef PNG_WRITE_SUPPORTED -PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr, +PNG_EXPORT(179, void, png_write_png, + (png_structrp png_ptr, png_inforp info_ptr, int transforms, png_voidp params)); #endif #endif PNG_EXPORT(180, png_const_charp, png_get_copyright, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); PNG_EXPORT(181, png_const_charp, png_get_header_ver, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); PNG_EXPORT(182, png_const_charp, png_get_header_version, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); PNG_EXPORT(183, png_const_charp, png_get_libpng_ver, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); #ifdef PNG_MNG_FEATURES_SUPPORTED -PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structrp png_ptr, - png_uint_32 mng_features_permitted)); +PNG_EXPORT(184, png_uint_32, png_permit_mng_features, + (png_structrp png_ptr, png_uint_32 mng_features_permitted)); #endif /* For use in png_set_keep_unknown, added to version 1.2.6 */ @@ -2485,71 +2619,74 @@ PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structrp png_ptr, * messages before passing them to the error or warning handler. */ #ifdef PNG_ERROR_NUMBERS_SUPPORTED -PNG_EXPORT(185, void, png_set_strip_error_numbers, (png_structrp png_ptr, - png_uint_32 strip_mode)); +PNG_EXPORT(185, void, png_set_strip_error_numbers, + (png_structrp png_ptr, png_uint_32 strip_mode)); #endif /* Added in libpng-1.2.6 */ #ifdef PNG_SET_USER_LIMITS_SUPPORTED -PNG_EXPORT(186, void, png_set_user_limits, (png_structrp png_ptr, +PNG_EXPORT(186, void, png_set_user_limits, + (png_structrp png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max)); PNG_EXPORT(187, png_uint_32, png_get_user_width_max, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); PNG_EXPORT(188, png_uint_32, png_get_user_height_max, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); /* Added in libpng-1.4.0 */ -PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structrp png_ptr, - png_uint_32 user_chunk_cache_max)); +PNG_EXPORT(189, void, png_set_chunk_cache_max, + (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)); PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); /* Added in libpng-1.4.1 */ -PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structrp png_ptr, - png_alloc_size_t user_chunk_cache_max)); +PNG_EXPORT(191, void, png_set_chunk_malloc_max, + (png_structrp png_ptr, png_alloc_size_t user_chunk_cache_max)); PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); #endif #if defined(PNG_INCH_CONVERSIONS_SUPPORTED) PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, - (png_const_structrp png_ptr, png_const_inforp info_ptr)); + (png_const_structrp png_ptr, png_const_inforp info_ptr)); PNG_FP_EXPORT(196, float, png_get_x_offset_inches, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) + (png_const_structrp png_ptr, png_const_inforp info_ptr)) #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) + (png_const_structrp png_ptr, png_const_inforp info_ptr)) #endif -PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structrp png_ptr, - png_const_inforp info_ptr)) +PNG_FP_EXPORT(197, float, png_get_y_offset_inches, + (png_const_structrp png_ptr, png_const_inforp info_ptr)) #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, - (png_const_structrp png_ptr, png_const_inforp info_ptr)) + (png_const_structrp png_ptr, png_const_inforp info_ptr)) #endif # ifdef PNG_pHYs_SUPPORTED -PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr, - png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, - int *unit_type)); +PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, + (png_const_structrp png_ptr, png_const_inforp info_ptr, + png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)); # endif /* pHYs */ #endif /* INCH_CONVERSIONS */ /* Added in libpng-1.4.0 */ #ifdef PNG_IO_STATE_SUPPORTED -PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr)); +PNG_EXPORT(199, png_uint_32, png_get_io_state, + (png_const_structrp png_ptr)); /* Removed from libpng 1.6; use png_get_io_chunk_type. */ -PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name, (png_structrp png_ptr), - PNG_DEPRECATED) +PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name, + (png_structrp png_ptr), + PNG_DEPRECATED) PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, - (png_const_structrp png_ptr)); + (png_const_structrp png_ptr)); /* The flags returned by png_get_io_state() are the following: */ # define PNG_IO_NONE 0x0000 /* no I/O at this moment */ @@ -2674,21 +2811,26 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, #endif /* READ_COMPOSITE_NODIV */ #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED -PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf)); -PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf)); -PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf)); +PNG_EXPORT(201, png_uint_32, png_get_uint_32, + (png_const_bytep buf)); +PNG_EXPORT(202, png_uint_16, png_get_uint_16, + (png_const_bytep buf)); +PNG_EXPORT(203, png_int_32, png_get_int_32, + (png_const_bytep buf)); #endif -PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_const_structrp png_ptr, - png_const_bytep buf)); +PNG_EXPORT(204, png_uint_32, png_get_uint_31, + (png_const_structrp png_ptr, png_const_bytep buf)); /* No png_get_int_16 -- may be added if there's a real need for it. */ /* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED -PNG_EXPORT(205, void, png_save_uint_32, (png_bytep buf, png_uint_32 i)); +PNG_EXPORT(205, void, png_save_uint_32, + (png_bytep buf, png_uint_32 i)); #endif #ifdef PNG_SAVE_INT_32_SUPPORTED -PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i)); +PNG_EXPORT(206, void, png_save_int_32, + (png_bytep buf, png_int_32 i)); #endif /* Place a 16-bit number into a buffer in PNG byte order. @@ -2696,7 +2838,8 @@ PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i)); * just to avoid potential problems on pre-ANSI C compilers. */ #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED -PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); +PNG_EXPORT(207, void, png_save_uint_16, + (png_bytep buf, unsigned int i)); /* No png_save_int_16 -- may be added if there's a real need for it. */ #endif @@ -2743,10 +2886,10 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED PNG_EXPORT(242, void, png_set_check_for_invalid_index, - (png_structrp png_ptr, int allowed)); + (png_structrp png_ptr, int allowed)); # ifdef PNG_GET_PALETTE_MAX_SUPPORTED -PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr, - png_const_infop info_ptr)); +PNG_EXPORT(243, int, png_get_palette_max, + (png_const_structp png_ptr, png_const_infop info_ptr)); # endif #endif /* CHECK_FOR_INVALID_INDEX */ @@ -3110,24 +3253,25 @@ typedef struct * the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.) */ #ifdef PNG_STDIO_SUPPORTED -PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image, - const char *file_name)); +PNG_EXPORT(234, int, png_image_begin_read_from_file, + (png_imagep image, const char *file_name)); /* The named file is opened for read and the image header is filled in * from the PNG header in the file. */ -PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image, - FILE *file)); +PNG_EXPORT(235, int, png_image_begin_read_from_stdio, + (png_imagep image, FILE *file)); /* The PNG header is read from the stdio FILE object. */ #endif /* STDIO */ -PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image, - png_const_voidp memory, size_t size)); +PNG_EXPORT(236, int, png_image_begin_read_from_memory, + (png_imagep image, png_const_voidp memory, size_t size)); /* The PNG header is read from the given memory buffer. */ -PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image, - png_const_colorp background, void *buffer, png_int_32 row_stride, - void *colormap)); +PNG_EXPORT(237, int, png_image_finish_read, + (png_imagep image, + png_const_colorp background, void *buffer, png_int_32 row_stride, + void *colormap)); /* Finish reading the image into the supplied buffer and clean up the * png_image structure. * @@ -3160,7 +3304,8 @@ PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image, * written to the colormap; this may be less than the original value. */ -PNG_EXPORT(238, void, png_image_free, (png_imagep image)); +PNG_EXPORT(238, void, png_image_free, + (png_imagep image)); /* Free any data allocated by libpng in image->opaque, setting the pointer to * NULL. May be called at any time after the structure is initialized. */ @@ -3184,14 +3329,16 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image)); * colormap_entries: set to the number of entries in the color-map (0 to 256) */ #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED -PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image, - const char *file, int convert_to_8bit, const void *buffer, - png_int_32 row_stride, const void *colormap)); +PNG_EXPORT(239, int, png_image_write_to_file, + (png_imagep image, + const char *file, int convert_to_8bit, const void *buffer, + png_int_32 row_stride, const void *colormap)); /* Write the image to the named file. */ -PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, - int convert_to_8_bit, const void *buffer, png_int_32 row_stride, - const void *colormap)); +PNG_EXPORT(240, int, png_image_write_to_stdio, + (png_imagep image, + FILE *file, int convert_to_8_bit, const void *buffer, + png_int_32 row_stride, const void *colormap)); /* Write the image to the given FILE object. */ #endif /* SIMPLIFIED_WRITE_STDIO */ @@ -3216,9 +3363,11 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, * notices) you need to use one of the other APIs. */ -PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory, - png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8_bit, - const void *buffer, png_int_32 row_stride, const void *colormap)); +PNG_EXPORT(245, int, png_image_write_to_memory, + (png_imagep image, + void *memory, png_alloc_size_t * PNG_RESTRICT memory_bytes, + int convert_to_8_bit, + const void *buffer, png_int_32 row_stride, const void *colormap)); /* Write the image to the given memory buffer. The function both writes the * whole PNG data stream to *memory and updates *memory_bytes with the count * of bytes written. @@ -3394,7 +3543,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option, * one to use is one more than this.) */ #ifdef PNG_EXPORT_LAST_ORDINAL - PNG_EXPORT_LAST_ORDINAL(259); + PNG_EXPORT_LAST_ORDINAL(259); #endif #ifdef __cplusplus diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h index 4bc5f7bb468..959c604edbc 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h @@ -29,9 +29,9 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * libpng version 1.6.51 + * libpng version 1.6.54 * - * Copyright (c) 2018-2025 Cosmin Truta + * Copyright (c) 2018-2026 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c index 44c86ebfef9..324d1951a52 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c @@ -78,7 +78,8 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message), } #else PNG_FUNCTION(void,PNGAPI -png_err,(png_const_structrp png_ptr),PNG_NORETURN) +png_err,(png_const_structrp png_ptr), + PNG_NORETURN) { /* Prior to 1.5.2 the error_fn received a NULL pointer, expressed * erroneously as '\0', instead of the empty string "". This was @@ -405,8 +406,8 @@ static const char png_digit[16] = { }; static void /* PRIVATE */ -png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp - error_message) +png_format_buffer(png_const_structrp png_ptr, png_charp buffer, + png_const_charp error_message) { png_uint_32 chunk_name = png_ptr->chunk_name; int iout = 0, ishift = 24; @@ -485,8 +486,8 @@ png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message) #ifdef PNG_READ_SUPPORTED #ifdef PNG_BENIGN_ERRORS_SUPPORTED void PNGAPI -png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp - error_message) +png_chunk_benign_error(png_const_structrp png_ptr, + png_const_charp error_message) { if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0) png_chunk_warning(png_ptr, error_message); @@ -543,7 +544,8 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error) #ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED PNG_FUNCTION(void, -png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN) +png_fixed_error,(png_const_structrp png_ptr, png_const_charp name), + PNG_NORETURN) { # define fixed_message "fixed point overflow in " # define fixed_message_ln ((sizeof fixed_message)-1) @@ -696,7 +698,8 @@ png_default_error,(png_const_structrp png_ptr, png_const_charp error_message), } PNG_FUNCTION(void,PNGAPI -png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN) +png_longjmp,(png_const_structrp png_ptr, int val), + PNG_NORETURN) { #ifdef PNG_SETJMP_SUPPORTED if (png_ptr != NULL && png_ptr->longjmp_fn != NULL && diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c index ed2e7f886f5..a5bdcd1b524 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c @@ -151,8 +151,8 @@ png_get_compression_type(png_const_structrp png_ptr, png_const_inforp info_ptr) } png_uint_32 PNGAPI -png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp - info_ptr) +png_get_x_pixels_per_meter(png_const_structrp png_ptr, + png_const_inforp info_ptr) { #ifdef PNG_pHYs_SUPPORTED png_debug(1, "in png_get_x_pixels_per_meter"); @@ -172,8 +172,8 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp } png_uint_32 PNGAPI -png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp - info_ptr) +png_get_y_pixels_per_meter(png_const_structrp png_ptr, + png_const_inforp info_ptr) { #ifdef PNG_pHYs_SUPPORTED png_debug(1, "in png_get_y_pixels_per_meter"); @@ -215,8 +215,8 @@ png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr) #ifdef PNG_FLOATING_POINT_SUPPORTED float PNGAPI -png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp - info_ptr) +png_get_pixel_aspect_ratio(png_const_structrp png_ptr, + png_const_inforp info_ptr) { #ifdef PNG_READ_pHYs_SUPPORTED png_debug(1, "in png_get_pixel_aspect_ratio"); @@ -766,7 +766,6 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr, } return 0; - } #endif diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h index 4cfae474751..b413b510acf 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h @@ -31,9 +31,9 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: */ -/* libpng version 1.6.51 */ +/* libpng version 1.6.54 */ -/* Copyright (c) 2018-2025 Cosmin Truta */ +/* Copyright (c) 2018-2026 Cosmin Truta */ /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c index 12b71bcbc02..8ec703616ec 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c @@ -75,7 +75,8 @@ png_destroy_png_struct(png_structrp png_ptr) * have the ability to do that. */ PNG_FUNCTION(png_voidp,PNGAPI -png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) +png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size), + PNG_ALLOCATED) { png_voidp ret; @@ -147,7 +148,8 @@ png_malloc_array_checked(png_const_structrp png_ptr, int nelements, PNG_FUNCTION(png_voidp /* PRIVATE */, png_malloc_array,(png_const_structrp png_ptr, int nelements, - size_t element_size),PNG_ALLOCATED) + size_t element_size), + PNG_ALLOCATED) { if (nelements <= 0 || element_size == 0) png_error(png_ptr, "internal error: array alloc"); @@ -157,7 +159,8 @@ png_malloc_array,(png_const_structrp png_ptr, int nelements, PNG_FUNCTION(png_voidp /* PRIVATE */, png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array, - int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED) + int old_elements, int add_elements, size_t element_size), + PNG_ALLOCATED) { /* These are internal errors: */ if (add_elements <= 0 || element_size == 0 || old_elements < 0 || @@ -196,7 +199,8 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array, * function png_malloc_default is also provided. */ PNG_FUNCTION(png_voidp,PNGAPI -png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) +png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size), + PNG_ALLOCATED) { png_voidp ret; @@ -270,7 +274,8 @@ png_free(png_const_structrp png_ptr, png_voidp ptr) } PNG_FUNCTION(void,PNGAPI -png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED) +png_free_default,(png_const_structrp png_ptr, png_voidp ptr), + PNG_DEPRECATED) { if (png_ptr == NULL || ptr == NULL) return; @@ -284,8 +289,8 @@ png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED) * of allocating and freeing memory. */ void PNGAPI -png_set_mem_fn(png_structrp png_ptr, png_voidp mem_ptr, png_malloc_ptr - malloc_fn, png_free_ptr free_fn) +png_set_mem_fn(png_structrp png_ptr, png_voidp mem_ptr, + png_malloc_ptr malloc_fn, png_free_ptr free_fn) { if (png_ptr != NULL) { diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h index dcd005efb34..ee91f58d4ba 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h @@ -1104,15 +1104,17 @@ extern "C" { */ /* Zlib support */ #define PNG_UNEXPECTED_ZLIB_RETURN (-7) -PNG_INTERNAL_FUNCTION(void, png_zstream_error,(png_structrp png_ptr, int ret), +PNG_INTERNAL_FUNCTION(void, png_zstream_error, + (png_structrp png_ptr, int ret), PNG_EMPTY); /* Used by the zlib handling functions to ensure that z_stream::msg is always * set before they return. */ #ifdef PNG_WRITE_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr, - png_compression_bufferp *list),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_free_buffer_list, + (png_structrp png_ptr, png_compression_bufferp *list), + PNG_EMPTY); /* Free the buffer list used by the compressed write code. */ #endif @@ -1124,22 +1126,25 @@ PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr, defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)) || \ (defined(PNG_sCAL_SUPPORTED) && \ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)) -PNG_INTERNAL_FUNCTION(png_fixed_point,png_fixed,(png_const_structrp png_ptr, - double fp, png_const_charp text),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_fixed_point, png_fixed, + (png_const_structrp png_ptr, double fp, png_const_charp text), + PNG_EMPTY); #endif #if defined(PNG_FLOATING_POINT_SUPPORTED) && \ !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \ (defined(PNG_cLLI_SUPPORTED) || defined(PNG_mDCV_SUPPORTED)) -PNG_INTERNAL_FUNCTION(png_uint_32,png_fixed_ITU,(png_const_structrp png_ptr, - double fp, png_const_charp text),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_uint_32, png_fixed_ITU, + (png_const_structrp png_ptr, double fp, png_const_charp text), + PNG_EMPTY); #endif /* Check the user version string for compatibility, returns false if the version * numbers aren't compatible. */ -PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr, - png_const_charp user_png_ver),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_user_version_check, + (png_structrp png_ptr, png_const_charp user_png_ver), + PNG_EMPTY); #ifdef PNG_READ_SUPPORTED /* should only be used on read */ /* Security: read limits on the largest allocations while reading a PNG. This @@ -1164,24 +1169,28 @@ PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr, * does, however, call the application provided allocator and that could call * png_error (although that would be a bug in the application implementation.) */ -PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr, - png_alloc_size_t size),PNG_ALLOCATED); +PNG_INTERNAL_FUNCTION(png_voidp, png_malloc_base, + (png_const_structrp png_ptr, png_alloc_size_t size), + PNG_ALLOCATED); #if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\ defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) /* Internal array allocator, outputs no error or warning messages on failure, * just returns NULL. */ -PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_array,(png_const_structrp png_ptr, - int nelements, size_t element_size),PNG_ALLOCATED); +PNG_INTERNAL_FUNCTION(png_voidp, png_malloc_array, + (png_const_structrp png_ptr, int nelements, size_t element_size), + PNG_ALLOCATED); /* The same but an existing array is extended by add_elements. This function * also memsets the new elements to 0 and copies the old elements. The old * array is not freed or altered. */ -PNG_INTERNAL_FUNCTION(png_voidp,png_realloc_array,(png_const_structrp png_ptr, - png_const_voidp array, int old_elements, int add_elements, - size_t element_size),PNG_ALLOCATED); +PNG_INTERNAL_FUNCTION(png_voidp, png_realloc_array, + (png_const_structrp png_ptr, + png_const_voidp array, int old_elements, int add_elements, + size_t element_size), + PNG_ALLOCATED); #endif /* text, sPLT or unknown chunks */ /* Magic to create a struct when there is no struct to call the user supplied @@ -1190,84 +1199,106 @@ PNG_INTERNAL_FUNCTION(png_voidp,png_realloc_array,(png_const_structrp png_ptr, * restriction so libpng has to assume that the 'free' handler, at least, might * call png_error. */ -PNG_INTERNAL_FUNCTION(png_structp,png_create_png_struct, - (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, - png_error_ptr warn_fn, png_voidp mem_ptr, png_malloc_ptr malloc_fn, - png_free_ptr free_fn),PNG_ALLOCATED); +PNG_INTERNAL_FUNCTION(png_structp, png_create_png_struct, + (png_const_charp user_png_ver, + png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, + png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), + PNG_ALLOCATED); /* Free memory from internal libpng struct */ -PNG_INTERNAL_FUNCTION(void,png_destroy_png_struct,(png_structrp png_ptr), +PNG_INTERNAL_FUNCTION(void, png_destroy_png_struct, + (png_structrp png_ptr), PNG_EMPTY); /* Free an allocated jmp_buf (always succeeds) */ -PNG_INTERNAL_FUNCTION(void,png_free_jmpbuf,(png_structrp png_ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_free_jmpbuf, + (png_structrp png_ptr), + PNG_EMPTY); /* Function to allocate memory for zlib. PNGAPI is disallowed. */ -PNG_INTERNAL_FUNCTION(voidpf,png_zalloc,(voidpf png_ptr, uInt items, uInt size), +PNG_INTERNAL_FUNCTION(voidpf, png_zalloc, + (voidpf png_ptr, uInt items, uInt size), PNG_ALLOCATED); /* Function to free memory for zlib. PNGAPI is disallowed. */ -PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_zfree, + (voidpf png_ptr, voidpf ptr), + PNG_EMPTY); /* Next four functions are used internally as callbacks. PNGCBAPI is required * but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to * PNGCBAPI at 1.5.0 */ -PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_read_data,(png_structp png_ptr, - png_bytep data, size_t length),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void PNGCBAPI, png_default_read_data, + (png_structp png_ptr, png_bytep data, size_t length), + PNG_EMPTY); #ifdef PNG_PROGRESSIVE_READ_SUPPORTED -PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_push_fill_buffer,(png_structp png_ptr, - png_bytep buffer, size_t length),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void PNGCBAPI, png_push_fill_buffer, + (png_structp png_ptr, png_bytep buffer, size_t length), + PNG_EMPTY); #endif -PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_write_data,(png_structp png_ptr, - png_bytep data, size_t length),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void PNGCBAPI, png_default_write_data, + (png_structp png_ptr, png_bytep data, size_t length), + PNG_EMPTY); #ifdef PNG_WRITE_FLUSH_SUPPORTED # ifdef PNG_STDIO_SUPPORTED -PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_flush,(png_structp png_ptr), +PNG_INTERNAL_FUNCTION(void PNGCBAPI, png_default_flush, + (png_structp png_ptr), PNG_EMPTY); # endif #endif /* Reset the CRC variable */ -PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_reset_crc, + (png_structrp png_ptr), + PNG_EMPTY); /* Write the "data" buffer to whatever output you are using */ -PNG_INTERNAL_FUNCTION(void,png_write_data,(png_structrp png_ptr, - png_const_bytep data, size_t length),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_data, + (png_structrp png_ptr, png_const_bytep data, size_t length), + PNG_EMPTY); /* Read and check the PNG file signature */ -PNG_INTERNAL_FUNCTION(void,png_read_sig,(png_structrp png_ptr, - png_inforp info_ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_sig, + (png_structrp png_ptr, png_inforp info_ptr), + PNG_EMPTY); /* Read the chunk header (length + type name) */ -PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr), +PNG_INTERNAL_FUNCTION(png_uint_32, png_read_chunk_header, + (png_structrp png_ptr), PNG_EMPTY); /* Read data from whatever input you are using into the "data" buffer */ -PNG_INTERNAL_FUNCTION(void,png_read_data,(png_structrp png_ptr, png_bytep data, - size_t length),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_data, + (png_structrp png_ptr, png_bytep data, size_t length), + PNG_EMPTY); /* Read bytes into buf, and update png_ptr->crc */ -PNG_INTERNAL_FUNCTION(void,png_crc_read,(png_structrp png_ptr, png_bytep buf, - png_uint_32 length),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_crc_read, + (png_structrp png_ptr, png_bytep buf, png_uint_32 length), + PNG_EMPTY); /* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */ -PNG_INTERNAL_FUNCTION(int,png_crc_finish,(png_structrp png_ptr, - png_uint_32 skip),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_crc_finish, + (png_structrp png_ptr, png_uint_32 skip), + PNG_EMPTY); /* Calculate the CRC over a section of data. Note that we are only * passing a maximum of 64K on systems that have this as a memory limit, * since this is the maximum buffer size we can specify. */ -PNG_INTERNAL_FUNCTION(void,png_calculate_crc,(png_structrp png_ptr, - png_const_bytep ptr, size_t length),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_calculate_crc, + (png_structrp png_ptr, png_const_bytep ptr, size_t length), + PNG_EMPTY); #ifdef PNG_WRITE_FLUSH_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_flush, + (png_structrp png_ptr), + PNG_EMPTY); #endif /* Write various chunks */ @@ -1275,68 +1306,86 @@ PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY); /* Write the IHDR chunk, and update the png_struct with the necessary * information. */ -PNG_INTERNAL_FUNCTION(void,png_write_IHDR,(png_structrp png_ptr, - png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, - int compression_method, int filter_method, int interlace_method),PNG_EMPTY); - -PNG_INTERNAL_FUNCTION(void,png_write_PLTE,(png_structrp png_ptr, - png_const_colorp palette, png_uint_32 num_pal),PNG_EMPTY); - -PNG_INTERNAL_FUNCTION(void,png_compress_IDAT,(png_structrp png_ptr, - png_const_bytep row_data, png_alloc_size_t row_data_length, int flush), +PNG_INTERNAL_FUNCTION(void, png_write_IHDR, + (png_structrp png_ptr, + png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, + int compression_method, int filter_method, int interlace_method), PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_write_IEND,(png_structrp png_ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_PLTE, + (png_structrp png_ptr, + png_const_colorp palette, png_uint_32 num_pal), + PNG_EMPTY); + +PNG_INTERNAL_FUNCTION(void, png_compress_IDAT, + (png_structrp png_ptr, + png_const_bytep row_data, png_alloc_size_t row_data_length, int flush), + PNG_EMPTY); + +PNG_INTERNAL_FUNCTION(void, png_write_IEND, + (png_structrp png_ptr), + PNG_EMPTY); #ifdef PNG_WRITE_gAMA_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_gAMA_fixed,(png_structrp png_ptr, - png_fixed_point file_gamma),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_gAMA_fixed, + (png_structrp png_ptr, png_fixed_point file_gamma), + PNG_EMPTY); #endif #ifdef PNG_WRITE_sBIT_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_sBIT,(png_structrp png_ptr, - png_const_color_8p sbit, int color_type),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_sBIT, + (png_structrp png_ptr, png_const_color_8p sbit, int color_type), + PNG_EMPTY); #endif #ifdef PNG_WRITE_cHRM_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr, - const png_xy *xy), PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_cHRM_fixed, + (png_structrp png_ptr, const png_xy *xy), + PNG_EMPTY); /* The xy value must have been previously validated */ #endif #ifdef PNG_WRITE_cICP_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_cICP,(png_structrp png_ptr, +PNG_INTERNAL_FUNCTION(void, png_write_cICP, + (png_structrp png_ptr, png_byte colour_primaries, png_byte transfer_function, - png_byte matrix_coefficients, png_byte video_full_range_flag), PNG_EMPTY); + png_byte matrix_coefficients, png_byte video_full_range_flag), + PNG_EMPTY); #endif #ifdef PNG_WRITE_cLLI_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_cLLI_fixed,(png_structrp png_ptr, - png_uint_32 maxCLL, png_uint_32 maxFALL), PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_cLLI_fixed, + (png_structrp png_ptr, png_uint_32 maxCLL, png_uint_32 maxFALL), + PNG_EMPTY); #endif #ifdef PNG_WRITE_mDCV_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_mDCV_fixed,(png_structrp png_ptr, - png_uint_16 red_x, png_uint_16 red_y, - png_uint_16 green_x, png_uint_16 green_y, - png_uint_16 blue_x, png_uint_16 blue_y, - png_uint_16 white_x, png_uint_16 white_y, - png_uint_32 maxDL, png_uint_32 minDL), PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_mDCV_fixed, + (png_structrp png_ptr, + png_uint_16 red_x, png_uint_16 red_y, + png_uint_16 green_x, png_uint_16 green_y, + png_uint_16 blue_x, png_uint_16 blue_y, + png_uint_16 white_x, png_uint_16 white_y, + png_uint_32 maxDL, png_uint_32 minDL), + PNG_EMPTY); #endif #ifdef PNG_WRITE_sRGB_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr, - int intent),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_sRGB, + (png_structrp png_ptr, int intent), + PNG_EMPTY); #endif #ifdef PNG_WRITE_eXIf_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr, - png_bytep exif, int num_exif),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_eXIf, + (png_structrp png_ptr, png_bytep exif, int num_exif), + PNG_EMPTY); #endif #ifdef PNG_WRITE_iCCP_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr, - png_const_charp name, png_const_bytep profile, png_uint_32 proflen), +PNG_INTERNAL_FUNCTION(void, png_write_iCCP, + (png_structrp png_ptr, + png_const_charp name, png_const_bytep profile, png_uint_32 proflen), PNG_EMPTY); /* Writes a previously 'set' profile. The profile argument is **not** * compressed. @@ -1344,82 +1393,106 @@ PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr, #endif #ifdef PNG_WRITE_sPLT_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_sPLT,(png_structrp png_ptr, - png_const_sPLT_tp palette),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_sPLT, + (png_structrp png_ptr, png_const_sPLT_tp palette), + PNG_EMPTY); #endif #ifdef PNG_WRITE_tRNS_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_tRNS,(png_structrp png_ptr, +PNG_INTERNAL_FUNCTION(void, png_write_tRNS, + (png_structrp png_ptr, png_const_bytep trans, png_const_color_16p values, int number, - int color_type),PNG_EMPTY); + int color_type), + PNG_EMPTY); #endif #ifdef PNG_WRITE_bKGD_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_bKGD,(png_structrp png_ptr, - png_const_color_16p values, int color_type),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_bKGD, + (png_structrp png_ptr, png_const_color_16p values, int color_type), + PNG_EMPTY); #endif #ifdef PNG_WRITE_hIST_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr, - png_const_uint_16p hist, int num_hist),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_hIST, + (png_structrp png_ptr, png_const_uint_16p hist, int num_hist), + PNG_EMPTY); #endif /* Chunks that have keywords */ #ifdef PNG_WRITE_tEXt_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr, - png_const_charp key, png_const_charp text, size_t text_len),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_tEXt, + (png_structrp png_ptr, + png_const_charp key, png_const_charp text, size_t text_len), + PNG_EMPTY); #endif #ifdef PNG_WRITE_zTXt_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp - key, png_const_charp text, int compression),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_zTXt, + (png_structrp png_ptr, + png_const_charp key, png_const_charp text, int compression), + PNG_EMPTY); #endif #ifdef PNG_WRITE_iTXt_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_iTXt,(png_structrp png_ptr, +PNG_INTERNAL_FUNCTION(void, png_write_iTXt, + (png_structrp png_ptr, int compression, png_const_charp key, png_const_charp lang, - png_const_charp lang_key, png_const_charp text),PNG_EMPTY); + png_const_charp lang_key, png_const_charp text), + PNG_EMPTY); #endif #ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */ -PNG_INTERNAL_FUNCTION(int,png_set_text_2,(png_const_structrp png_ptr, - png_inforp info_ptr, png_const_textp text_ptr, int num_text),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_set_text_2, + (png_const_structrp png_ptr, + png_inforp info_ptr, png_const_textp text_ptr, int num_text), + PNG_EMPTY); #endif #ifdef PNG_WRITE_oFFs_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_oFFs,(png_structrp png_ptr, - png_int_32 x_offset, png_int_32 y_offset, int unit_type),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_oFFs, + (png_structrp png_ptr, + png_int_32 x_offset, png_int_32 y_offset, int unit_type), + PNG_EMPTY); #endif #ifdef PNG_WRITE_pCAL_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_pCAL,(png_structrp png_ptr, - png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams, - png_const_charp units, png_charpp params),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_pCAL, + (png_structrp png_ptr, + png_charp purpose, png_int_32 X0, png_int_32 X1, + int type, int nparams, png_const_charp units, png_charpp params), + PNG_EMPTY); #endif #ifdef PNG_WRITE_pHYs_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_pHYs,(png_structrp png_ptr, +PNG_INTERNAL_FUNCTION(void, png_write_pHYs, + (png_structrp png_ptr, png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit, - int unit_type),PNG_EMPTY); + int unit_type), + PNG_EMPTY); #endif #ifdef PNG_WRITE_tIME_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_tIME,(png_structrp png_ptr, - png_const_timep mod_time),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_tIME, + (png_structrp png_ptr, png_const_timep mod_time), + PNG_EMPTY); #endif #ifdef PNG_WRITE_sCAL_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_write_sCAL_s,(png_structrp png_ptr, - int unit, png_const_charp width, png_const_charp height),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_sCAL_s, + (png_structrp png_ptr, + int unit, png_const_charp width, png_const_charp height), + PNG_EMPTY); #endif /* Called when finished processing a row of data */ -PNG_INTERNAL_FUNCTION(void,png_write_finish_row,(png_structrp png_ptr), - PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_finish_row, + (png_structrp png_ptr), + PNG_EMPTY); /* Internal use only. Called before first row of data */ -PNG_INTERNAL_FUNCTION(void,png_write_start_row,(png_structrp png_ptr), - PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_start_row, + (png_structrp png_ptr), + PNG_EMPTY); /* Combine a row of data, dealing with alpha, etc. if requested. 'row' is an * array of png_ptr->width pixels. If the image is not interlaced or this @@ -1447,8 +1520,9 @@ PNG_INTERNAL_FUNCTION(void,png_write_start_row,(png_structrp png_ptr), #ifndef PNG_USE_COMPILE_TIME_MASKS # define PNG_USE_COMPILE_TIME_MASKS 1 #endif -PNG_INTERNAL_FUNCTION(void,png_combine_row,(png_const_structrp png_ptr, - png_bytep row, int display),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_combine_row, + (png_const_structrp png_ptr, png_bytep row, int display), + PNG_EMPTY); #ifdef PNG_READ_INTERLACING_SUPPORTED /* Expand an interlaced row: the 'row_info' describes the pass data that has @@ -1457,170 +1531,230 @@ PNG_INTERNAL_FUNCTION(void,png_combine_row,(png_const_structrp png_ptr, * the pixels are *replicated* to the intervening space. This is essential for * the correct operation of png_combine_row, above. */ -PNG_INTERNAL_FUNCTION(void,png_do_read_interlace,(png_row_infop row_info, - png_bytep row, int pass, png_uint_32 transformations),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_read_interlace, + (png_row_infop row_info, + png_bytep row, int pass, png_uint_32 transformations), + PNG_EMPTY); #endif /* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */ #ifdef PNG_WRITE_INTERLACING_SUPPORTED /* Grab pixels out of a row for an interlaced pass */ -PNG_INTERNAL_FUNCTION(void,png_do_write_interlace,(png_row_infop row_info, - png_bytep row, int pass),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_write_interlace, + (png_row_infop row_info, png_bytep row, int pass), + PNG_EMPTY); #endif /* Unfilter a row: check the filter value before calling this, there is no point * calling it for PNG_FILTER_VALUE_NONE. */ -PNG_INTERNAL_FUNCTION(void,png_read_filter_row,(png_structrp pp, png_row_infop - row_info, png_bytep row, png_const_bytep prev_row, int filter),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row, + (png_structrp pp, png_row_infop row_info, + png_bytep row, png_const_bytep prev_row, int filter), + PNG_EMPTY); #if PNG_ARM_NEON_OPT > 0 -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,(png_row_infop row_info, - png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_neon,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_neon,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_neon,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_neon, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_neon, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_neon, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_neon, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_neon, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_neon, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_neon, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); #endif #if PNG_MIPS_MSA_IMPLEMENTATION == 1 -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info, - png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_msa,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_msa,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_msa,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_msa,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_msa, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_msa, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_msa, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_msa, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_msa, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_msa, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_msa, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); #endif #if PNG_MIPS_MMI_IMPLEMENTATION > 0 -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_mmi,(png_row_infop row_info, - png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_mmi,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_mmi,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_mmi,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_mmi,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_mmi,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_mmi,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_mmi, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_mmi, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_mmi, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_mmi, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_mmi, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_mmi, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_mmi, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); #endif #if PNG_POWERPC_VSX_OPT > 0 -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info, - png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_vsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_vsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_vsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_vsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_vsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_vsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_vsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); #endif #if PNG_INTEL_SSE_IMPLEMENTATION > 0 -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_sse2, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_sse2, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_sse2, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_sse2, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_sse2, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_sse2, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); #endif #if PNG_LOONGARCH_LSX_IMPLEMENTATION == 1 -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_lsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_lsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_lsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_lsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_lsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_lsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_lsx,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_lsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_lsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_lsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_lsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_lsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_lsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_lsx, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); #endif #if PNG_RISCV_RVV_IMPLEMENTATION == 1 -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_rvv,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_rvv,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_rvv,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_rvv,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_rvv,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_rvv,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_rvv,(png_row_infop - row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_up_rvv, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub3_rvv, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_sub4_rvv, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg3_rvv, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_avg4_rvv, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth3_rvv, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_filter_row_paeth4_rvv, + (png_row_infop row_info, png_bytep row, png_const_bytep prev_row), + PNG_EMPTY); #endif /* Choose the best filter to use and filter the row data */ -PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr, - png_row_infop row_info),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_write_find_filter, + (png_structrp png_ptr, png_row_infop row_info), + PNG_EMPTY); #ifdef PNG_SEQUENTIAL_READ_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr, - png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_IDAT_data, + (png_structrp png_ptr, png_bytep output, png_alloc_size_t avail_out), + PNG_EMPTY); /* Read 'avail_out' bytes of data from the IDAT stream. If the output buffer * is NULL the function checks, instead, for the end of the stream. In this * case a benign error will be issued if the stream end is not found or if * extra data has to be consumed. */ -PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr), +PNG_INTERNAL_FUNCTION(void, png_read_finish_IDAT, + (png_structrp png_ptr), PNG_EMPTY); /* This cleans up when the IDAT LZ stream does not end when the last image * byte is read; there is still some pending input. */ -PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr), +PNG_INTERNAL_FUNCTION(void, png_read_finish_row, + (png_structrp png_ptr), PNG_EMPTY); /* Finish a row while reading, dealing with interlacing passes, etc. */ #endif /* SEQUENTIAL_READ */ /* Initialize the row buffers, etc. */ -PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_start_row, + (png_structrp png_ptr), + PNG_EMPTY); #if ZLIB_VERNUM >= 0x1240 -PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush), - PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_zlib_inflate, + (png_structrp png_ptr, int flush), + PNG_EMPTY); # define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush) #else /* Zlib < 1.2.4 */ # define PNG_INFLATE(pp, flush) inflate(&(pp)->zstream, flush) @@ -1628,38 +1762,44 @@ PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush), #ifdef PNG_READ_TRANSFORMS_SUPPORTED /* Optional call to update the users info structure */ -PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr, - png_inforp info_ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_transform_info, + (png_structrp png_ptr, png_inforp info_ptr), + PNG_EMPTY); #endif /* Shared transform functions, defined in pngtran.c */ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \ defined(PNG_READ_STRIP_ALPHA_SUPPORTED) -PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info, - png_bytep row, int at_start),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_strip_channel, + (png_row_infop row_info, png_bytep row, int at_start), + PNG_EMPTY); #endif #ifdef PNG_16BIT_SUPPORTED #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) -PNG_INTERNAL_FUNCTION(void,png_do_swap,(png_row_infop row_info, - png_bytep row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_swap, + (png_row_infop row_info, png_bytep row), + PNG_EMPTY); #endif #endif #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ defined(PNG_WRITE_PACKSWAP_SUPPORTED) -PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info, - png_bytep row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_packswap, + (png_row_infop row_info, png_bytep row), + PNG_EMPTY); #endif #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) -PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info, - png_bytep row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_invert, + (png_row_infop row_info, png_bytep row), + PNG_EMPTY); #endif #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) -PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info, - png_bytep row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_bgr, + (png_row_infop row_info, png_bytep row), + PNG_EMPTY); #endif /* The following decodes the appropriate chunks, and does error correction, @@ -1680,25 +1820,27 @@ typedef enum handled_ok /* known, supported and handled without error */ } png_handle_result_code; -PNG_INTERNAL_FUNCTION(png_handle_result_code,png_handle_unknown, - (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep), - PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_handle_result_code, png_handle_unknown, + (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep), + PNG_EMPTY); /* This is the function that gets called for unknown chunks. The 'keep' * argument is either non-zero for a known chunk that has been set to be * handled as unknown or zero for an unknown chunk. By default the function * just skips the chunk or errors out if it is critical. */ -PNG_INTERNAL_FUNCTION(png_handle_result_code,png_handle_chunk, - (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_handle_result_code, png_handle_chunk, + (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length), + PNG_EMPTY); /* This handles the current chunk png_ptr->chunk_name with unread * data[length] and returns one of the above result codes. */ #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED) -PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling, - (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_chunk_unknown_handling, + (png_const_structrp png_ptr, png_uint_32 chunk_name), + PNG_EMPTY); /* Exactly as the API png_handle_as_unknown() except that the argument is a * 32-bit chunk name, not a string. */ @@ -1706,93 +1848,122 @@ PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling, /* Handle the transformations for reading and writing */ #ifdef PNG_READ_TRANSFORMS_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_do_read_transformations,(png_structrp png_ptr, - png_row_infop row_info),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_read_transformations, + (png_structrp png_ptr, png_row_infop row_info), + PNG_EMPTY); #endif #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_do_write_transformations,(png_structrp png_ptr, - png_row_infop row_info),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_write_transformations, + (png_structrp png_ptr, png_row_infop row_info), + PNG_EMPTY); #endif #ifdef PNG_READ_TRANSFORMS_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_init_read_transformations,(png_structrp png_ptr), - PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_init_read_transformations, + (png_structrp png_ptr), + PNG_EMPTY); #endif #ifdef PNG_PROGRESSIVE_READ_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_push_read_chunk,(png_structrp png_ptr, - png_inforp info_ptr),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_read_sig,(png_structrp png_ptr, - png_inforp info_ptr),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr), - PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr, - png_bytep buffer, size_t buffer_length),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr, - png_bytep buffer, size_t buffer_length),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr), - PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_have_info,(png_structrp png_ptr, - png_inforp info_ptr),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_have_end,(png_structrp png_ptr, - png_inforp info_ptr),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_have_row,(png_structrp png_ptr, - png_bytep row),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_push_read_end,(png_structrp png_ptr, - png_inforp info_ptr),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_process_some_data,(png_structrp png_ptr, - png_inforp info_ptr),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_read_push_finish_row,(png_structrp png_ptr), - PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_read_chunk, + (png_structrp png_ptr, png_inforp info_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_read_sig, + (png_structrp png_ptr, png_inforp info_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_check_crc, + (png_structrp png_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_save_buffer, + (png_structrp png_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_restore_buffer, + (png_structrp png_ptr, png_bytep buffer, size_t buffer_length), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_read_IDAT, + (png_structrp png_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_process_IDAT_data, + (png_structrp png_ptr, png_bytep buffer, size_t buffer_length), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_process_row, + (png_structrp png_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_have_info, + (png_structrp png_ptr, png_inforp info_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_have_end, + (png_structrp png_ptr, png_inforp info_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_have_row, + (png_structrp png_ptr, png_bytep row), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_push_read_end, + (png_structrp png_ptr, png_inforp info_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_process_some_data, + (png_structrp png_ptr, png_inforp info_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_read_push_finish_row, + (png_structrp png_ptr), + PNG_EMPTY); #endif /* PROGRESSIVE_READ */ #ifdef PNG_iCCP_SUPPORTED /* Routines for checking parts of an ICC profile. */ #ifdef PNG_READ_iCCP_SUPPORTED -PNG_INTERNAL_FUNCTION(int,png_icc_check_length,(png_const_structrp png_ptr, - png_const_charp name, png_uint_32 profile_length), PNG_EMPTY); -#endif /* READ_iCCP */ -PNG_INTERNAL_FUNCTION(int,png_icc_check_header,(png_const_structrp png_ptr, - png_const_charp name, png_uint_32 profile_length, - png_const_bytep profile /* first 132 bytes only */, int color_type), +PNG_INTERNAL_FUNCTION(int, png_icc_check_length, + (png_const_structrp png_ptr, + png_const_charp name, png_uint_32 profile_length), + PNG_EMPTY); +#endif /* READ_iCCP */ +PNG_INTERNAL_FUNCTION(int, png_icc_check_header, + (png_const_structrp png_ptr, + png_const_charp name, png_uint_32 profile_length, + png_const_bytep profile /* first 132 bytes only */, int color_type), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_icc_check_tag_table, + (png_const_structrp png_ptr, + png_const_charp name, png_uint_32 profile_length, + png_const_bytep profile /* header plus whole tag table */), PNG_EMPTY); -PNG_INTERNAL_FUNCTION(int,png_icc_check_tag_table,(png_const_structrp png_ptr, - png_const_charp name, png_uint_32 profile_length, - png_const_bytep profile /* header plus whole tag table */), PNG_EMPTY); #endif /* iCCP */ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_set_rgb_coefficients, (png_structrp png_ptr), +PNG_INTERNAL_FUNCTION(void, png_set_rgb_coefficients, + (png_structrp png_ptr), PNG_EMPTY); /* Set the rgb_to_gray coefficients from the cHRM Y values (if unset) */ #endif /* READ_RGB_TO_GRAY */ /* Added at libpng version 1.4.0 */ -PNG_INTERNAL_FUNCTION(void,png_check_IHDR,(png_const_structrp png_ptr, - png_uint_32 width, png_uint_32 height, int bit_depth, - int color_type, int interlace_type, int compression_type, - int filter_type),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_check_IHDR, + (png_const_structrp png_ptr, + png_uint_32 width, png_uint_32 height, int bit_depth, int color_type, + int interlace_type, int compression_type, int filter_type), + PNG_EMPTY); /* Added at libpng version 1.5.10 */ #if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \ defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED) -PNG_INTERNAL_FUNCTION(void,png_do_check_palette_indexes, - (png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_do_check_palette_indexes, + (png_structrp png_ptr, png_row_infop row_info), + PNG_EMPTY); #endif #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) -PNG_INTERNAL_FUNCTION(void,png_fixed_error,(png_const_structrp png_ptr, - png_const_charp name),PNG_NORETURN); +PNG_INTERNAL_FUNCTION(void, png_fixed_error, + (png_const_structrp png_ptr, png_const_charp name), + PNG_NORETURN); #endif /* Puts 'string' into 'buffer' at buffer[pos], taking care never to overwrite * the end. Always leaves the buffer nul terminated. Never errors out (and * there is no error code.) */ -PNG_INTERNAL_FUNCTION(size_t,png_safecat,(png_charp buffer, size_t bufsize, - size_t pos, png_const_charp string),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(size_t, png_safecat, + (png_charp buffer, size_t bufsize, size_t pos, png_const_charp string), + PNG_EMPTY); /* Various internal functions to handle formatted warning messages, currently * only implemented for warnings. @@ -1803,8 +1974,9 @@ PNG_INTERNAL_FUNCTION(size_t,png_safecat,(png_charp buffer, size_t bufsize, * Returns the pointer to the start of the formatted string. This utility only * does unsigned values. */ -PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start, - png_charp end, int format, png_alloc_size_t number),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_charp, png_format_number, + (png_const_charp start, png_charp end, int format, png_alloc_size_t number), + PNG_EMPTY); /* Convenience macro that takes an array: */ #define PNG_FORMAT_NUMBER(buffer,format,number) \ @@ -1836,23 +2008,26 @@ PNG_INTERNAL_FUNCTION(png_charp,png_format_number,(png_const_charp start, typedef char png_warning_parameters[PNG_WARNING_PARAMETER_COUNT][ PNG_WARNING_PARAMETER_SIZE]; -PNG_INTERNAL_FUNCTION(void,png_warning_parameter,(png_warning_parameters p, - int number, png_const_charp string),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_warning_parameter, + (png_warning_parameters p, int number, png_const_charp string), + PNG_EMPTY); /* Parameters are limited in size to PNG_WARNING_PARAMETER_SIZE characters, * including the trailing '\0'. */ -PNG_INTERNAL_FUNCTION(void,png_warning_parameter_unsigned, +PNG_INTERNAL_FUNCTION(void, png_warning_parameter_unsigned, (png_warning_parameters p, int number, int format, png_alloc_size_t value), PNG_EMPTY); /* Use png_alloc_size_t because it is an unsigned type as big as any we * need to output. Use the following for a signed value. */ -PNG_INTERNAL_FUNCTION(void,png_warning_parameter_signed, +PNG_INTERNAL_FUNCTION(void, png_warning_parameter_signed, (png_warning_parameters p, int number, int format, png_int_32 value), PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_formatted_warning,(png_const_structrp png_ptr, - png_warning_parameters p, png_const_charp message),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_formatted_warning, + (png_const_structrp png_ptr, + png_warning_parameters p, png_const_charp message), + PNG_EMPTY); /* 'message' follows the X/Open approach of using @1, @2 to insert * parameters previously supplied using the above functions. Errors in * specifying the parameters will simply result in garbage substitutions. @@ -1874,14 +2049,16 @@ PNG_INTERNAL_FUNCTION(void,png_formatted_warning,(png_const_structrp png_ptr, * If benign errors aren't supported they end up as the corresponding base call * (png_warning or png_error.) */ -PNG_INTERNAL_FUNCTION(void,png_app_warning,(png_const_structrp png_ptr, - png_const_charp message),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_app_warning, + (png_const_structrp png_ptr, png_const_charp message), + PNG_EMPTY); /* The application provided invalid parameters to an API function or called * an API function at the wrong time, libpng can completely recover. */ -PNG_INTERNAL_FUNCTION(void,png_app_error,(png_const_structrp png_ptr, - png_const_charp message),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_app_error, + (png_const_structrp png_ptr, png_const_charp message), + PNG_EMPTY); /* As above but libpng will ignore the call, or attempt some other partial * recovery from the error. */ @@ -1890,8 +2067,9 @@ PNG_INTERNAL_FUNCTION(void,png_app_error,(png_const_structrp png_ptr, # define png_app_error(pp,s) png_error(pp,s) #endif -PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr, - png_const_charp message, int error),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_chunk_report, + (png_const_structrp png_ptr, png_const_charp message, int error), + PNG_EMPTY); /* Report a recoverable issue in chunk data. On read this is used to report * a problem found while reading a particular chunk and the * png_chunk_benign_error or png_chunk_warning function is used as @@ -1917,14 +2095,17 @@ PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr, #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/) #ifdef PNG_FLOATING_POINT_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_ascii_from_fp,(png_const_structrp png_ptr, - png_charp ascii, size_t size, double fp, unsigned int precision), +PNG_INTERNAL_FUNCTION(void, png_ascii_from_fp, + (png_const_structrp png_ptr, + png_charp ascii, size_t size, double fp, unsigned int precision), PNG_EMPTY); #endif /* FLOATING_POINT */ #ifdef PNG_FIXED_POINT_SUPPORTED -PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr, - png_charp ascii, size_t size, png_fixed_point fp),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_ascii_from_fixed, + (png_const_structrp png_ptr, + png_charp ascii, size_t size, png_fixed_point fp), + PNG_EMPTY); #endif /* FIXED_POINT */ #endif /* sCAL */ @@ -2016,8 +2197,9 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr, * that omits the last character (i.e. set the size to the index of * the problem character.) This has not been tested within libpng. */ -PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string, - size_t size, int *statep, size_t *whereami),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_check_fp_number, + (png_const_charp string, size_t size, int *statep, size_t *whereami), + PNG_EMPTY); /* This is the same but it checks a complete string and returns true * only if it just contains a floating point number. As of 1.5.4 this @@ -2025,8 +2207,9 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string, * it was valid (otherwise it returns 0.) This can be used for testing * for negative or zero values using the sticky flag. */ -PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string, - size_t size),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_check_fp_string, + (png_const_charp string, size_t size), + PNG_EMPTY); #endif /* pCAL || sCAL */ #if defined(PNG_READ_GAMMA_SUPPORTED) ||\ @@ -2039,14 +2222,17 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string, * for overflow, true (1) if no overflow, in which case *res * holds the result. */ -PNG_INTERNAL_FUNCTION(int,png_muldiv,(png_fixed_point_p res, png_fixed_point a, - png_int_32 multiplied_by, png_int_32 divided_by),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_muldiv, + (png_fixed_point_p res, png_fixed_point a, + png_int_32 multiplied_by, png_int_32 divided_by), + PNG_EMPTY); /* Calculate a reciprocal - used for gamma values. This returns * 0 if the argument is 0 in order to maintain an undefined value; * there are no warnings. */ -PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a), +PNG_INTERNAL_FUNCTION(png_fixed_point, png_reciprocal, + (png_fixed_point a), PNG_EMPTY); #endif @@ -2055,11 +2241,13 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a), * values. Accuracy is suitable for gamma calculations but this is * not exact - use png_muldiv for that. Only required at present on read. */ -PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal2,(png_fixed_point a, - png_fixed_point b),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_fixed_point, png_reciprocal2, + (png_fixed_point a, png_fixed_point b), + PNG_EMPTY); /* Return true if the gamma value is significantly different from 1.0 */ -PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value), +PNG_INTERNAL_FUNCTION(int, png_gamma_significant, + (png_fixed_point gamma_value), PNG_EMPTY); /* PNGv3: 'resolve' the file gamma according to the new PNGv3 rules for colour @@ -2070,8 +2258,9 @@ PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value), * transforms. For this reason a gamma specified by png_set_gamma always takes * precedence. */ -PNG_INTERNAL_FUNCTION(png_fixed_point,png_resolve_file_gamma, - (png_const_structrp png_ptr),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_fixed_point, png_resolve_file_gamma, + (png_const_structrp png_ptr), + PNG_EMPTY); /* Internal fixed point gamma correction. These APIs are called as * required to convert single values - they don't need to be fast, @@ -2080,37 +2269,45 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_resolve_file_gamma, * While the input is an 'unsigned' value it must actually be the * correct bit value - 0..255 or 0..65535 as required. */ -PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_correct,(png_structrp png_ptr, - unsigned int value, png_fixed_point gamma_value),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(png_uint_16,png_gamma_16bit_correct,(unsigned int value, - png_fixed_point gamma_value),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(png_byte,png_gamma_8bit_correct,(unsigned int value, - png_fixed_point gamma_value),PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_destroy_gamma_table,(png_structrp png_ptr), +PNG_INTERNAL_FUNCTION(png_uint_16, png_gamma_correct, + (png_structrp png_ptr, unsigned int value, png_fixed_point gamma_value), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_uint_16, png_gamma_16bit_correct, + (unsigned int value, png_fixed_point gamma_value), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_byte, png_gamma_8bit_correct, + (unsigned int value, png_fixed_point gamma_value), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_destroy_gamma_table, + (png_structrp png_ptr), + PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_build_gamma_table, + (png_structrp png_ptr, int bit_depth), PNG_EMPTY); -PNG_INTERNAL_FUNCTION(void,png_build_gamma_table,(png_structrp png_ptr, - int bit_depth),PNG_EMPTY); #endif /* READ_GAMMA */ #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED /* Set the RGB coefficients if not already set by png_set_rgb_to_gray */ -PNG_INTERNAL_FUNCTION(void,png_set_rgb_coefficients,(png_structrp png_ptr), +PNG_INTERNAL_FUNCTION(void, png_set_rgb_coefficients, + (png_structrp png_ptr), PNG_EMPTY); #endif #if defined(PNG_cHRM_SUPPORTED) || defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) -PNG_INTERNAL_FUNCTION(int,png_XYZ_from_xy,(png_XYZ *XYZ, const png_xy *xy), +PNG_INTERNAL_FUNCTION(int, png_XYZ_from_xy, + (png_XYZ *XYZ, const png_xy *xy), PNG_EMPTY); #endif /* cHRM || READ_RGB_TO_GRAY */ #ifdef PNG_COLORSPACE_SUPPORTED -PNG_INTERNAL_FUNCTION(int,png_xy_from_XYZ,(png_xy *xy, const png_XYZ *XYZ), +PNG_INTERNAL_FUNCTION(int, png_xy_from_XYZ, + (png_xy *xy, const png_XYZ *XYZ), PNG_EMPTY); #endif /* SIMPLIFIED READ/WRITE SUPPORT */ #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\ - defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) + defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) /* The internal structure that png_image::opaque points to. */ typedef struct png_control { @@ -2138,28 +2335,34 @@ typedef struct png_control * errors that might occur. Returns true on success, false on failure (either * of the function or as a result of a png_error.) */ -PNG_INTERNAL_CALLBACK(void,png_safe_error,(png_structp png_ptr, - png_const_charp error_message),PNG_NORETURN); +PNG_INTERNAL_CALLBACK(void, png_safe_error, + (png_structp png_ptr, png_const_charp error_message), + PNG_NORETURN); #ifdef PNG_WARNINGS_SUPPORTED -PNG_INTERNAL_CALLBACK(void,png_safe_warning,(png_structp png_ptr, - png_const_charp warning_message),PNG_EMPTY); +PNG_INTERNAL_CALLBACK(void, png_safe_warning, + (png_structp png_ptr, png_const_charp warning_message), + PNG_EMPTY); #else # define png_safe_warning 0/*dummy argument*/ #endif -PNG_INTERNAL_FUNCTION(int,png_safe_execute,(png_imagep image, - int (*function)(png_voidp), png_voidp arg),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_safe_execute, + (png_imagep image, int (*function)(png_voidp), png_voidp arg), + PNG_EMPTY); /* Utility to log an error; this also cleans up the png_image; the function * always returns 0 (false). */ -PNG_INTERNAL_FUNCTION(int,png_image_error,(png_imagep image, - png_const_charp error_message),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(int, png_image_error, + (png_imagep image, png_const_charp error_message), + PNG_EMPTY); #ifndef PNG_SIMPLIFIED_READ_SUPPORTED /* png_image_free is used by the write code but not exported */ -PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, png_image_free, + (png_imagep image), + PNG_EMPTY); #endif /* !SIMPLIFIED_READ */ #endif /* SIMPLIFIED READ/WRITE */ @@ -2170,8 +2373,9 @@ PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY); * the generic code is used. */ #ifdef PNG_FILTER_OPTIMIZATIONS -PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr, - unsigned int bpp), PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, + (png_structp png_ptr, unsigned int bpp), + PNG_EMPTY); /* Just declare the optimization that will be used */ #else /* List *all* the possible optimizations here - this branch is required if @@ -2180,37 +2384,44 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr, */ # if PNG_ARM_NEON_OPT > 0 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon, - (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); + (png_structp png_ptr, unsigned int bpp), + PNG_EMPTY); #endif #if PNG_MIPS_MSA_IMPLEMENTATION == 1 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips, - (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); + (png_structp png_ptr, unsigned int bpp), + PNG_EMPTY); #endif # if PNG_MIPS_MMI_IMPLEMENTATION > 0 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_mips, - (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); + (png_structp png_ptr, unsigned int bpp), + PNG_EMPTY); # endif # if PNG_INTEL_SSE_IMPLEMENTATION > 0 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2, - (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); + (png_structp png_ptr, unsigned int bpp), + PNG_EMPTY); # endif #endif #if PNG_LOONGARCH_LSX_OPT > 0 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_lsx, - (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); + (png_structp png_ptr, unsigned int bpp), + PNG_EMPTY); #endif # if PNG_RISCV_RVV_IMPLEMENTATION == 1 PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_rvv, - (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); + (png_structp png_ptr, unsigned int bpp), + PNG_EMPTY); #endif -PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, - png_const_charp key, png_bytep new_key), PNG_EMPTY); +PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, + (png_structrp png_ptr, png_const_charp key, png_bytep new_key), + PNG_EMPTY); #if PNG_ARM_NEON_IMPLEMENTATION == 1 PNG_INTERNAL_FUNCTION(void, diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c index b53668a09ce..79fd9ad6a82 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c @@ -29,7 +29,7 @@ * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * - * Copyright (c) 2018-2025 Cosmin Truta + * Copyright (c) 2018-2026 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -52,7 +52,8 @@ /* Create a PNG structure for reading, and allocate any memory needed. */ PNG_FUNCTION(png_structp,PNGAPI png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr, - png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED) + png_error_ptr error_fn, png_error_ptr warn_fn), + PNG_ALLOCATED) { #ifndef PNG_USER_MEM_SUPPORTED png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr, @@ -68,7 +69,8 @@ png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr, PNG_FUNCTION(png_structp,PNGAPI png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, - png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED) + png_malloc_ptr malloc_fn, png_free_ptr free_fn), + PNG_ALLOCATED) { png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr, error_fn, warn_fn, mem_ptr, malloc_fn, free_fn); @@ -548,7 +550,6 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) if (png_ptr->read_row_fn != NULL) (*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass); - } #endif /* SEQUENTIAL_READ */ @@ -896,7 +897,7 @@ png_set_read_status_fn(png_structrp png_ptr, png_read_status_ptr read_row_fn) #ifdef PNG_INFO_IMAGE_SUPPORTED void PNGAPI png_read_png(png_structrp png_ptr, png_inforp info_ptr, - int transforms, voidp params) + int transforms, png_voidp params) { png_debug(1, "in png_read_png"); @@ -1133,19 +1134,20 @@ png_read_png(png_structrp png_ptr, png_inforp info_ptr, typedef struct { - /* Arguments: */ + /* Arguments */ png_imagep image; - png_voidp buffer; + png_voidp buffer; png_int_32 row_stride; - png_voidp colormap; + png_voidp colormap; png_const_colorp background; - /* Local variables: */ - png_voidp local_row; - png_voidp first_row; - ptrdiff_t row_bytes; /* step between rows */ - int file_encoding; /* E_ values above */ - png_fixed_point gamma_to_linear; /* For P_FILE, reciprocal of gamma */ - int colormap_processing; /* PNG_CMAP_ values above */ + + /* Instance variables */ + png_voidp local_row; + png_voidp first_row; + ptrdiff_t row_step; /* step between rows */ + int file_encoding; /* E_ values above */ + png_fixed_point gamma_to_linear; /* For P_FILE, reciprocal of gamma */ + int colormap_processing; /* PNG_CMAP_ values above */ } png_image_read_control; /* Do all the *safe* initialization - 'safe' means that png_error won't be @@ -2866,17 +2868,17 @@ png_image_read_and_map(png_voidp argument) } { - png_uint_32 height = image->height; - png_uint_32 width = image->width; - int proc = display->colormap_processing; - png_bytep first_row = png_voidcast(png_bytep, display->first_row); - ptrdiff_t step_row = display->row_bytes; + png_uint_32 height = image->height; + png_uint_32 width = image->width; + int proc = display->colormap_processing; + png_bytep first_row = png_voidcast(png_bytep, display->first_row); + ptrdiff_t row_step = display->row_step; int pass; for (pass = 0; pass < passes; ++pass) { - unsigned int startx, stepx, stepy; - png_uint_32 y; + unsigned int startx, stepx, stepy; + png_uint_32 y; if (png_ptr->interlaced == PNG_INTERLACE_ADAM7) { @@ -2900,7 +2902,7 @@ png_image_read_and_map(png_voidp argument) for (; ylocal_row); - png_bytep outrow = first_row + y * step_row; + png_bytep outrow = first_row + y * row_step; png_const_bytep end_row = outrow + width; /* Read read the libpng data into the temporary buffer. */ @@ -3109,20 +3111,20 @@ png_image_read_colormapped(png_voidp argument) */ { png_voidp first_row = display->buffer; - ptrdiff_t row_bytes = display->row_stride; + ptrdiff_t row_step = display->row_stride; - /* The following expression is designed to work correctly whether it gives - * a signed or an unsigned result. + /* The following adjustment is to ensure that calculations are correct, + * regardless whether row_step is positive or negative. */ - if (row_bytes < 0) + if (row_step < 0) { char *ptr = png_voidcast(char*, first_row); - ptr += (image->height-1) * (-row_bytes); + ptr += (image->height-1) * (-row_step); first_row = png_voidcast(png_voidp, ptr); } display->first_row = first_row; - display->row_bytes = row_bytes; + display->row_step = row_step; } if (passes == 0) @@ -3140,17 +3142,17 @@ png_image_read_colormapped(png_voidp argument) else { - png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes; + ptrdiff_t row_step = display->row_step; while (--passes >= 0) { - png_uint_32 y = image->height; - png_bytep row = png_voidcast(png_bytep, display->first_row); + png_uint_32 y = image->height; + png_bytep row = png_voidcast(png_bytep, display->first_row); for (; y > 0; --y) { png_read_row(png_ptr, row, NULL); - row += row_bytes; + row += row_step; } } @@ -3166,9 +3168,11 @@ png_image_read_direct_scaled(png_voidp argument) argument); png_imagep image = display->image; png_structrp png_ptr = image->opaque->png_ptr; + png_inforp info_ptr = image->opaque->info_ptr; png_bytep local_row = png_voidcast(png_bytep, display->local_row); png_bytep first_row = png_voidcast(png_bytep, display->first_row); - ptrdiff_t row_bytes = display->row_bytes; + ptrdiff_t row_step = display->row_step; + size_t row_bytes = png_get_rowbytes(png_ptr, info_ptr); int passes; /* Handle interlacing. */ @@ -3197,9 +3201,14 @@ png_image_read_direct_scaled(png_voidp argument) /* Read into local_row (gets transformed 8-bit data). */ png_read_row(png_ptr, local_row, NULL); - /* Copy from local_row to user buffer. */ - memcpy(output_row, local_row, (size_t)row_bytes); - output_row += row_bytes; + /* Copy from local_row to user buffer. + * Use row_bytes (i.e. the actual size in bytes of the row data) for + * copying into output_row. Use row_step for advancing output_row, + * to respect the caller's stride for padding or negative (bottom-up) + * layouts. + */ + memcpy(output_row, local_row, row_bytes); + output_row += row_step; } } @@ -3231,17 +3240,18 @@ png_image_read_composite(png_voidp argument) } { - png_uint_32 height = image->height; - png_uint_32 width = image->width; - ptrdiff_t step_row = display->row_bytes; + png_uint_32 height = image->height; + png_uint_32 width = image->width; + ptrdiff_t row_step = display->row_step; unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; + int optimize_alpha = (png_ptr->flags & PNG_FLAG_OPTIMIZE_ALPHA) != 0; int pass; for (pass = 0; pass < passes; ++pass) { - unsigned int startx, stepx, stepy; - png_uint_32 y; + unsigned int startx, stepx, stepy; + png_uint_32 y; if (png_ptr->interlaced == PNG_INTERLACE_ADAM7) { @@ -3273,7 +3283,7 @@ png_image_read_composite(png_voidp argument) png_read_row(png_ptr, inrow, NULL); outrow = png_voidcast(png_bytep, display->first_row); - outrow += y * step_row; + outrow += y * row_step; end_row = outrow + width * channels; /* Now do the composition on each pixel in this row. */ @@ -3292,20 +3302,44 @@ png_image_read_composite(png_voidp argument) if (alpha < 255) /* else just use component */ { - /* This is PNG_OPTIMIZED_ALPHA, the component value - * is a linear 8-bit value. Combine this with the - * current outrow[c] value which is sRGB encoded. - * Arithmetic here is 16-bits to preserve the output - * values correctly. - */ - component *= 257*255; /* =65535 */ - component += (255-alpha)*png_sRGB_table[outrow[c]]; + if (optimize_alpha != 0) + { + /* This is PNG_OPTIMIZED_ALPHA, the component value + * is a linear 8-bit value. Combine this with the + * current outrow[c] value which is sRGB encoded. + * Arithmetic here is 16-bits to preserve the output + * values correctly. + */ + component *= 257*255; /* =65535 */ + component += (255-alpha)*png_sRGB_table[outrow[c]]; - /* So 'component' is scaled by 255*65535 and is - * therefore appropriate for the sRGB to linear - * conversion table. - */ - component = PNG_sRGB_FROM_LINEAR(component); + /* Clamp to the valid range to defend against + * unforeseen cases where the data might be sRGB + * instead of linear premultiplied. + * (Belt-and-suspenders for CVE-2025-66293.) + */ + if (component > 255*65535) + component = 255*65535; + + /* So 'component' is scaled by 255*65535 and is + * therefore appropriate for the sRGB-to-linear + * conversion table. + */ + component = PNG_sRGB_FROM_LINEAR(component); + } + else + { + /* Compositing was already done on the palette + * entries. The data is sRGB premultiplied on black. + * Composite with the background in sRGB space. + * This is not gamma-correct, but matches what was + * done to the palette. + */ + png_uint_32 background = outrow[c]; + component += ((255-alpha) * background + 127) / 255; + if (component > 255) + component = 255; + } } outrow[c] = (png_byte)component; @@ -3394,12 +3428,12 @@ png_image_read_background(png_voidp argument) */ { png_bytep first_row = png_voidcast(png_bytep, display->first_row); - ptrdiff_t step_row = display->row_bytes; + ptrdiff_t row_step = display->row_step; for (pass = 0; pass < passes; ++pass) { - unsigned int startx, stepx, stepy; - png_uint_32 y; + unsigned int startx, stepx, stepy; + png_uint_32 y; if (png_ptr->interlaced == PNG_INTERLACE_ADAM7) { @@ -3426,7 +3460,7 @@ png_image_read_background(png_voidp argument) { png_bytep inrow = png_voidcast(png_bytep, display->local_row); - png_bytep outrow = first_row + y * step_row; + png_bytep outrow = first_row + y * row_step; png_const_bytep end_row = outrow + width; /* Read the row, which is packed: */ @@ -3471,7 +3505,7 @@ png_image_read_background(png_voidp argument) { png_bytep inrow = png_voidcast(png_bytep, display->local_row); - png_bytep outrow = first_row + y * step_row; + png_bytep outrow = first_row + y * row_step; png_const_bytep end_row = outrow + width; /* Read the row, which is packed: */ @@ -3517,9 +3551,9 @@ png_image_read_background(png_voidp argument) png_uint_16p first_row = png_voidcast(png_uint_16p, display->first_row); /* The division by two is safe because the caller passed in a - * stride which was multiplied by 2 (below) to get row_bytes. + * stride which was multiplied by 2 (below) to get row_step. */ - ptrdiff_t step_row = display->row_bytes / 2; + ptrdiff_t row_step = display->row_step / 2; unsigned int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0; unsigned int outchannels = 1U+preserve_alpha; @@ -3533,8 +3567,8 @@ png_image_read_background(png_voidp argument) for (pass = 0; pass < passes; ++pass) { - unsigned int startx, stepx, stepy; - png_uint_32 y; + unsigned int startx, stepx, stepy; + png_uint_32 y; /* The 'x' start and step are adjusted to output components here. */ @@ -3561,7 +3595,7 @@ png_image_read_background(png_voidp argument) for (; ybuffer; - ptrdiff_t row_bytes = display->row_stride; + ptrdiff_t row_step = display->row_stride; if (linear != 0) - row_bytes *= 2; + row_step *= 2; - /* The following expression is designed to work correctly whether it gives - * a signed or an unsigned result. + /* The following adjustment is to ensure that calculations are correct, + * regardless whether row_step is positive or negative. */ - if (row_bytes < 0) + if (row_step < 0) { char *ptr = png_voidcast(char*, first_row); - ptr += (image->height-1) * (-row_bytes); + ptr += (image->height - 1) * (-row_step); first_row = png_voidcast(png_voidp, ptr); } display->first_row = first_row; - display->row_bytes = row_bytes; + display->row_step = row_step; } if (do_local_compose != 0) @@ -4063,17 +4097,17 @@ png_image_read_direct(png_voidp argument) else { - png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes; + ptrdiff_t row_step = display->row_step; while (--passes >= 0) { - png_uint_32 y = image->height; - png_bytep row = png_voidcast(png_bytep, display->first_row); + png_uint_32 y = image->height; + png_bytep row = png_voidcast(png_bytep, display->first_row); for (; y > 0; --y) { png_read_row(png_ptr, row, NULL); - row += row_bytes; + row += row_step; } } diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c index a19615f49fe..7680fe64828 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c @@ -1149,8 +1149,8 @@ png_set_rgb_to_gray(png_structrp png_ptr, int error_action, double red, #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) void PNGAPI -png_set_read_user_transform_fn(png_structrp png_ptr, png_user_transform_ptr - read_user_transform_fn) +png_set_read_user_transform_fn(png_structrp png_ptr, + png_user_transform_ptr read_user_transform_fn) { png_debug(1, "in png_set_read_user_transform_fn"); @@ -1872,6 +1872,7 @@ png_init_read_transformations(png_structrp png_ptr) * transformations elsewhere. */ png_ptr->transformations &= ~(PNG_COMPOSE | PNG_GAMMA); + png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA; } /* color_type == PNG_COLOR_TYPE_PALETTE */ /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c index 07d53cb2c76..01bb0c8bedc 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c @@ -2415,7 +2415,7 @@ png_handle_tIME(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) static png_handle_result_code /* PRIVATE */ png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { - png_text text_info; + png_text text_info; png_bytep buffer; png_charp key; png_charp text; @@ -2488,8 +2488,8 @@ static png_handle_result_code /* PRIVATE */ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { png_const_charp errmsg = NULL; - png_bytep buffer; - png_uint_32 keyword_length; + png_bytep buffer; + png_uint_32 keyword_length; png_debug(1, "in png_handle_zTXt"); diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c index 2350057e70e..b9f6cb5d437 100644 --- a/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c +++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngtrans.c @@ -831,8 +831,8 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED void PNGAPI -png_set_user_transform_info(png_structrp png_ptr, png_voidp - user_transform_ptr, int user_transform_depth, int user_transform_channels) +png_set_user_transform_info(png_structrp png_ptr, png_voidp user_transform_ptr, + int user_transform_depth, int user_transform_channels) { png_debug(1, "in png_set_user_transform_info"); diff --git a/src/java.desktop/unix/classes/sun/awt/FcFontManager.java b/src/java.desktop/unix/classes/sun/awt/FcFontManager.java index 0d787ceb1af..707ea1c9ac7 100644 --- a/src/java.desktop/unix/classes/sun/awt/FcFontManager.java +++ b/src/java.desktop/unix/classes/sun/awt/FcFontManager.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java index 7bd6bcb306f..99036e1b2f5 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java index ede95bea3e8..bab0f34f90f 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java b/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java index 6b6e8ad0c6d..38dcc880be8 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDConstants.java b/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDConstants.java index 2e0fe9717d8..f5a3822f006 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDConstants.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java b/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java index ee1c5afcdf9..f14d8f958c5 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java b/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java index fa8f7f46fc1..c6e3725332c 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/Native.java b/src/java.desktop/unix/classes/sun/awt/X11/Native.java index 784328262b9..ed62e384660 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/Native.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/Native.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/UnsafeXDisposerRecord.java b/src/java.desktop/unix/classes/sun/awt/X11/UnsafeXDisposerRecord.java index 492fc0a0827..682f7cd5006 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/UnsafeXDisposerRecord.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/UnsafeXDisposerRecord.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/WindowDimensions.java b/src/java.desktop/unix/classes/sun/awt/X11/WindowDimensions.java index 38ae4efbac0..482635d2995 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/WindowDimensions.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/WindowDimensions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/WindowPropertyGetter.java b/src/java.desktop/unix/classes/sun/awt/X11/WindowPropertyGetter.java index c39802d08b8..10db025ba57 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/WindowPropertyGetter.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/WindowPropertyGetter.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XAWTLookAndFeel.java b/src/java.desktop/unix/classes/sun/awt/X11/XAWTLookAndFeel.java index 96aa097cb8f..c96f5411924 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XAWTLookAndFeel.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XAWTLookAndFeel.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XAWTXSettings.java b/src/java.desktop/unix/classes/sun/awt/X11/XAWTXSettings.java index ed333a0b4e7..abc2e900856 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XAWTXSettings.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XAWTXSettings.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XAtom.java b/src/java.desktop/unix/classes/sun/awt/X11/XAtom.java index c70183e8d4e..3a985542058 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XAtom.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XAtom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XAtomList.java b/src/java.desktop/unix/classes/sun/awt/X11/XAtomList.java index 2ac6d42719c..7ec335f9f4e 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XAtomList.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XAtomList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XAwtState.java b/src/java.desktop/unix/classes/sun/awt/X11/XAwtState.java index 16b2bc64120..35ed6e56e78 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XAwtState.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XAwtState.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java index d562ae52969..f8fcb30d8d8 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XBaseMenuWindow.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java index 8c0e5075ee0..c6d7b09959f 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XButtonPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XButtonPeer.java index 49827f4af30..dd1478f7885 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XButtonPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XButtonPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XCanvasPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XCanvasPeer.java index 13c6e9c35f6..c1c1f74508c 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XCanvasPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XCanvasPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XCheckboxPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XCheckboxPeer.java index f5bfc10120f..03e082de8aa 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XCheckboxPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XCheckboxPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java index 59011f4d729..f4dd3baacdd 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XClipboard.java b/src/java.desktop/unix/classes/sun/awt/X11/XClipboard.java index 156b128d857..09139dcfdb2 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XClipboard.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XClipboard.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java index ae99cb44760..1f6834d7c02 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XContentWindow.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XCreateWindowParams.java b/src/java.desktop/unix/classes/sun/awt/X11/XCreateWindowParams.java index a0365604b81..fd032822901 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XCreateWindowParams.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XCreateWindowParams.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XCustomCursor.java b/src/java.desktop/unix/classes/sun/awt/X11/XCustomCursor.java index d4cf4a2aa4b..7e8d1cf9255 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XCustomCursor.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XCustomCursor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDataTransferer.java b/src/java.desktop/unix/classes/sun/awt/X11/XDataTransferer.java index 7ec8e191ab5..4402ff41b6e 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDataTransferer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDataTransferer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java index d70a46517e1..ca3b1ebe15b 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java index f609e585369..0365b3842b0 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java index fb76ef2274a..fc0dc269b28 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDialogPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDnDConstants.java b/src/java.desktop/unix/classes/sun/awt/X11/XDnDConstants.java index b4a43b6df63..76589c74237 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDnDConstants.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDnDConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDnDDragSourceProtocol.java b/src/java.desktop/unix/classes/sun/awt/X11/XDnDDragSourceProtocol.java index 92a1244c631..c22735d997a 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDnDDragSourceProtocol.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDnDDragSourceProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDnDDropTargetProtocol.java b/src/java.desktop/unix/classes/sun/awt/X11/XDnDDropTargetProtocol.java index 4466d8d6eed..560749a4bfb 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDnDDropTargetProtocol.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDnDDropTargetProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java index 907f0efbc96..a51abb96b1a 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceProtocol.java b/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceProtocol.java index 24de318359f..b8563f28771 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceProtocol.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java index dbf27c55537..a7130fa7fe9 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XDropTargetContextPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedCanvasPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedCanvasPeer.java index 387b1e84f44..bc1b3ac9f4b 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedCanvasPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedCanvasPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxy.java b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxy.java index e2c37541201..db3c6fc1067 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxy.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java index 7204570afd7..efae47d6f23 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedClientHelper.java b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedClientHelper.java index 4a359644dfe..53ed0c15ec2 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedClientHelper.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedClientHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedServerTester.java b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedServerTester.java index b9f1caff48a..61c260e9e61 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbedServerTester.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbedServerTester.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java b/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java index 699c18c253b..f98a6a66bc7 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFramePeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFramePeer.java index d1e6e5ad979..78fad30f554 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFramePeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddedFramePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java b/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java index fe4c59b19b8..a03b37b7441 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XEmbeddingContainer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XErrorHandler.java b/src/java.desktop/unix/classes/sun/awt/X11/XErrorHandler.java index 8d2d4715ce1..e6b2b3b4f2c 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XErrorHandler.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XErrorHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XException.java b/src/java.desktop/unix/classes/sun/awt/X11/XException.java index 6577e6a45e6..4e6154d3fb6 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XException.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XFocusProxyWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/XFocusProxyWindow.java index e6096eba5f3..18d558d26ca 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XFocusProxyWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XFocusProxyWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XFontPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XFontPeer.java index 7e8271a7358..9717c0a8f30 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XFontPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XFontPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XGlobalCursorManager.java b/src/java.desktop/unix/classes/sun/awt/X11/XGlobalCursorManager.java index af77656706d..6b61ea22cc3 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XGlobalCursorManager.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XGlobalCursorManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XHorizontalScrollbar.java b/src/java.desktop/unix/classes/sun/awt/X11/XHorizontalScrollbar.java index 1f9cee8a7d9..71744522b8e 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XHorizontalScrollbar.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XHorizontalScrollbar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java index c68e6dbd239..98919b3dc56 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java b/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java index 332b9860c19..19dd6e87100 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XInputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XInputMethodDescriptor.java b/src/java.desktop/unix/classes/sun/awt/X11/XInputMethodDescriptor.java index d6fa0bdefd7..059ee8fe98f 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XInputMethodDescriptor.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XInputMethodDescriptor.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java index fb0e163ef8b..03e92d1b1b1 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XKeyboardFocusManagerPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XLabelPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XLabelPeer.java index 5575f521284..9011ab0130d 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XLabelPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XLabelPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XLightweightFramePeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XLightweightFramePeer.java index fb8880f36c5..b10f45b2ff8 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XLightweightFramePeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XLightweightFramePeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java index eb1e9eab039..81348327294 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XListPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XMSelection.java b/src/java.desktop/unix/classes/sun/awt/X11/XMSelection.java index b4345111d11..e1f9390fa62 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XMSelection.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XMSelection.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java index 2369e1c5614..0848cde81fa 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XMenuBarPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java index 1d8c594e04c..c88a38735f0 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XMenuItemPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XMenuPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XMenuPeer.java index 080193a70fd..21e5d907d0a 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XMenuPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XMenuPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java index 42f0de8eb6c..1aaee911218 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XMenuWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java b/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java index 04ff27759c9..32ae73ce29b 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XNETProtocol.java b/src/java.desktop/unix/classes/sun/awt/X11/XNETProtocol.java index 590dc43d322..312b5c8ccd8 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XNETProtocol.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XNETProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java index 9be81191770..13892dc41e9 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XPanelPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java index 1bde8734a70..4c2e6680f40 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XPopupMenuPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XPropertyCache.java b/src/java.desktop/unix/classes/sun/awt/X11/XPropertyCache.java index d00c06e5a6e..76116879441 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XPropertyCache.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XPropertyCache.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XQueryTree.java b/src/java.desktop/unix/classes/sun/awt/X11/XQueryTree.java index 8f566792abc..9c58133a70f 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XQueryTree.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XQueryTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java b/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java index 790023031bd..2ba1566ddbe 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XRepaintArea.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XRootWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/XRootWindow.java index 99062a57903..94e1b68ec5d 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XRootWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XRootWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XScrollPanePeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XScrollPanePeer.java index e02ddae753a..ff445259762 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XScrollPanePeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XScrollPanePeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XScrollbar.java b/src/java.desktop/unix/classes/sun/awt/X11/XScrollbar.java index 3ec52c8c4f0..1b1dddb0b8b 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XScrollbar.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XScrollbar.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XScrollbarPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XScrollbarPeer.java index 05088daa8e7..39fffd2e15e 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XScrollbarPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XScrollbarPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XSelection.java b/src/java.desktop/unix/classes/sun/awt/X11/XSelection.java index ef43cb2d243..f7a40312fe7 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XSelection.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XSelection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XSystemTrayPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XSystemTrayPeer.java index 01c2ec22ca3..473b638cb74 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XSystemTrayPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XSystemTrayPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java index 042a3e8ac21..0bd25fe26c6 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XTextAreaPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java index eab0817af23..78cd4a7e57d 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java @@ -138,8 +138,6 @@ import sun.awt.X11GraphicsDevice; import sun.awt.X11GraphicsEnvironment; import sun.awt.XSettings; import sun.awt.datatransfer.DataTransferer; -import sun.awt.screencast.ScreencastHelper; -import sun.awt.screencast.XdgDesktopPortal; import sun.awt.util.PerformanceLogger; import sun.awt.util.ThreadGroupUtils; import sun.font.FontConfigManager; @@ -1523,21 +1521,16 @@ public final class XToolkit extends UNIXToolkit implements Runnable { awtLock(); try { if (numberOfButtons == 0) { - if (XdgDesktopPortal.isRemoteDesktop() - && ScreencastHelper.isAvailable()) { + numberOfButtons = getNumberOfButtonsImpl(); + numberOfButtons = (numberOfButtons > MAX_BUTTONS_SUPPORTED) ? MAX_BUTTONS_SUPPORTED : numberOfButtons; + //4th and 5th buttons are for wheel and shouldn't be reported as buttons. + //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. + //If we have 3 physical buttons and a wheel, we report 3 buttons. + //If we have 1,2,3 physical buttons, we report it as is i.e. 1,2 or 3 respectively. + if (numberOfButtons >= 5) { + numberOfButtons -= 2; + } else if (numberOfButtons == 4 || numberOfButtons == 5) { numberOfButtons = 3; - } else { - numberOfButtons = getNumberOfButtonsImpl(); - numberOfButtons = (numberOfButtons > MAX_BUTTONS_SUPPORTED) ? MAX_BUTTONS_SUPPORTED : numberOfButtons; - //4th and 5th buttons are for wheel and shouldn't be reported as buttons. - //If we have more than 3 physical buttons and a wheel, we report N-2 buttons. - //If we have 3 physical buttons and a wheel, we report 3 buttons. - //If we have 1,2,3 physical buttons, we report it as is i.e. 1,2 or 3 respectively. - if (numberOfButtons >= 5) { - numberOfButtons -= 2; - } else if (numberOfButtons == 4 || numberOfButtons == 5) { - numberOfButtons = 3; - } } } //Assume don't have to re-query the number again and again. diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XToolkitThreadBlockedHandler.java b/src/java.desktop/unix/classes/sun/awt/X11/XToolkitThreadBlockedHandler.java index 82dc03d54a0..f0ee1c53972 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkitThreadBlockedHandler.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XToolkitThreadBlockedHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XTranslateCoordinates.java b/src/java.desktop/unix/classes/sun/awt/X11/XTranslateCoordinates.java index 5928e9ef628..e7796388db2 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XTranslateCoordinates.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XTranslateCoordinates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java index 443d7ea7c1f..9f0ac241f5b 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XVerticalScrollbar.java b/src/java.desktop/unix/classes/sun/awt/X11/XVerticalScrollbar.java index 4ecb86ea78a..57108f14b9f 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XVerticalScrollbar.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XVerticalScrollbar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XWINProtocol.java b/src/java.desktop/unix/classes/sun/awt/X11/XWINProtocol.java index 5d0bd01084e..bdf25522bea 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XWINProtocol.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XWINProtocol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java b/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java index 7165b1701fa..b79f2f9033f 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindow.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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XWindowAttributesData.java b/src/java.desktop/unix/classes/sun/awt/X11/XWindowAttributesData.java index ccf8edc70d0..dd1ad65862d 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XWindowAttributesData.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindowAttributesData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XWrapperBase.java b/src/java.desktop/unix/classes/sun/awt/X11/XWrapperBase.java index 438053e6353..f7f1fcd9f6c 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XWrapperBase.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XWrapperBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2007, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XlibUtil.java b/src/java.desktop/unix/classes/sun/awt/X11/XlibUtil.java index c2cdfc0433c..626a09f5603 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11/XlibUtil.java +++ b/src/java.desktop/unix/classes/sun/awt/X11/XlibUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11CustomCursor.java b/src/java.desktop/unix/classes/sun/awt/X11CustomCursor.java index 48223e291e5..d0ec3723dc4 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11CustomCursor.java +++ b/src/java.desktop/unix/classes/sun/awt/X11CustomCursor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11FontManager.java b/src/java.desktop/unix/classes/sun/awt/X11FontManager.java index 1d0452128df..817a9e011b6 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11FontManager.java +++ b/src/java.desktop/unix/classes/sun/awt/X11FontManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2022, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java b/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java index e8b311aa25b..bb5ab5ab350 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java b/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java index c4076949c0d..03f22574b05 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java +++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java b/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java index 86f0fd868f7..3b349904352 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java +++ b/src/java.desktop/unix/classes/sun/awt/X11InputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11InputMethodBase.java b/src/java.desktop/unix/classes/sun/awt/X11InputMethodBase.java index 674b909d213..d9eaa9629d1 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11InputMethodBase.java +++ b/src/java.desktop/unix/classes/sun/awt/X11InputMethodBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/awt/X11InputMethodDescriptor.java b/src/java.desktop/unix/classes/sun/awt/X11InputMethodDescriptor.java index 305d513de6d..e378ac2f79d 100644 --- a/src/java.desktop/unix/classes/sun/awt/X11InputMethodDescriptor.java +++ b/src/java.desktop/unix/classes/sun/awt/X11InputMethodDescriptor.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 diff --git a/src/java.desktop/unix/classes/sun/awt/XSettings.java b/src/java.desktop/unix/classes/sun/awt/XSettings.java index b36475c5cc1..8b5ff142c81 100644 --- a/src/java.desktop/unix/classes/sun/awt/XSettings.java +++ b/src/java.desktop/unix/classes/sun/awt/XSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/font/DelegateStrike.java b/src/java.desktop/unix/classes/sun/font/DelegateStrike.java index ea9c6b0eb0a..201ffebbb0d 100644 --- a/src/java.desktop/unix/classes/sun/font/DelegateStrike.java +++ b/src/java.desktop/unix/classes/sun/font/DelegateStrike.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, 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 @@ -116,10 +116,4 @@ final class DelegateStrike extends NativeStrike { GeneralPath getGlyphOutline(int glyphCode, float x, float y) { return delegateStrike.getGlyphOutline(glyphCode, x, y); } - - @Override - GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) { - return delegateStrike.getGlyphVectorOutline(glyphs, x, y); - } - } diff --git a/src/java.desktop/unix/classes/sun/font/DoubleByteEncoder.java b/src/java.desktop/unix/classes/sun/font/DoubleByteEncoder.java index d42b6eda80d..4c7ae6cff5a 100644 --- a/src/java.desktop/unix/classes/sun/font/DoubleByteEncoder.java +++ b/src/java.desktop/unix/classes/sun/font/DoubleByteEncoder.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 diff --git a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java index 27d6773105e..0bcdf17d527 100644 --- a/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java +++ b/src/java.desktop/unix/classes/sun/font/FcFontConfiguration.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 diff --git a/src/java.desktop/unix/classes/sun/font/FontConfigManager.java b/src/java.desktop/unix/classes/sun/font/FontConfigManager.java index c70fe7dd940..aa3693743c2 100644 --- a/src/java.desktop/unix/classes/sun/font/FontConfigManager.java +++ b/src/java.desktop/unix/classes/sun/font/FontConfigManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2020, 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 diff --git a/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java b/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java index f5a8fe8b3c0..6f4df1a6d01 100644 --- a/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java +++ b/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2022, 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 diff --git a/src/java.desktop/unix/classes/sun/font/NativeFont.java b/src/java.desktop/unix/classes/sun/font/NativeFont.java index 871db2a70d1..a3617fc3cd9 100644 --- a/src/java.desktop/unix/classes/sun/font/NativeFont.java +++ b/src/java.desktop/unix/classes/sun/font/NativeFont.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/font/NativeStrike.java b/src/java.desktop/unix/classes/sun/font/NativeStrike.java index 3e6996d83fe..ef2e70f61ee 100644 --- a/src/java.desktop/unix/classes/sun/font/NativeStrike.java +++ b/src/java.desktop/unix/classes/sun/font/NativeStrike.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 @@ -295,10 +295,4 @@ class NativeStrike extends PhysicalStrike { GeneralPath getGlyphOutline(int glyphCode, float x, float y) { return new GeneralPath(); } - - @Override - GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) { - return new GeneralPath(); - } - } diff --git a/src/java.desktop/unix/classes/sun/font/NativeStrikeDisposer.java b/src/java.desktop/unix/classes/sun/font/NativeStrikeDisposer.java index b19995a34f6..405add399fa 100644 --- a/src/java.desktop/unix/classes/sun/font/NativeStrikeDisposer.java +++ b/src/java.desktop/unix/classes/sun/font/NativeStrikeDisposer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, 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 diff --git a/src/java.desktop/unix/classes/sun/font/X11Dingbats.java b/src/java.desktop/unix/classes/sun/font/X11Dingbats.java index cef94fdf9c8..0a4eef31c4d 100644 --- a/src/java.desktop/unix/classes/sun/font/X11Dingbats.java +++ b/src/java.desktop/unix/classes/sun/font/X11Dingbats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/font/X11GB18030_0.java b/src/java.desktop/unix/classes/sun/font/X11GB18030_0.java index 7b06d785d99..0ddd22d121b 100644 --- a/src/java.desktop/unix/classes/sun/font/X11GB18030_0.java +++ b/src/java.desktop/unix/classes/sun/font/X11GB18030_0.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, 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 diff --git a/src/java.desktop/unix/classes/sun/font/X11GB18030_1.java b/src/java.desktop/unix/classes/sun/font/X11GB18030_1.java index 9f06ea30ac7..22eb73d29f1 100644 --- a/src/java.desktop/unix/classes/sun/font/X11GB18030_1.java +++ b/src/java.desktop/unix/classes/sun/font/X11GB18030_1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, 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 diff --git a/src/java.desktop/unix/classes/sun/font/X11GB2312.java b/src/java.desktop/unix/classes/sun/font/X11GB2312.java index 70643edbea3..d94d88fc37a 100644 --- a/src/java.desktop/unix/classes/sun/font/X11GB2312.java +++ b/src/java.desktop/unix/classes/sun/font/X11GB2312.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/font/X11GBK.java b/src/java.desktop/unix/classes/sun/font/X11GBK.java index 612b41c95c0..d246bdf6547 100644 --- a/src/java.desktop/unix/classes/sun/font/X11GBK.java +++ b/src/java.desktop/unix/classes/sun/font/X11GBK.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/font/X11Johab.java b/src/java.desktop/unix/classes/sun/font/X11Johab.java index ff79e4833f5..6ded1f41efb 100644 --- a/src/java.desktop/unix/classes/sun/font/X11Johab.java +++ b/src/java.desktop/unix/classes/sun/font/X11Johab.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, 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 diff --git a/src/java.desktop/unix/classes/sun/font/X11KSC5601.java b/src/java.desktop/unix/classes/sun/font/X11KSC5601.java index e1ffd133215..29adf818e15 100644 --- a/src/java.desktop/unix/classes/sun/font/X11KSC5601.java +++ b/src/java.desktop/unix/classes/sun/font/X11KSC5601.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/font/X11SunUnicode_0.java b/src/java.desktop/unix/classes/sun/font/X11SunUnicode_0.java index 89b568ecd0f..62a3e253908 100644 --- a/src/java.desktop/unix/classes/sun/font/X11SunUnicode_0.java +++ b/src/java.desktop/unix/classes/sun/font/X11SunUnicode_0.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, 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 diff --git a/src/java.desktop/unix/classes/sun/font/X11TextRenderer.java b/src/java.desktop/unix/classes/sun/font/X11TextRenderer.java index 86c9fd26a7f..068ac8de70a 100644 --- a/src/java.desktop/unix/classes/sun/font/X11TextRenderer.java +++ b/src/java.desktop/unix/classes/sun/font/X11TextRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/font/XMap.java b/src/java.desktop/unix/classes/sun/font/XMap.java index 5935ce1aa97..65cbc0f8825 100644 --- a/src/java.desktop/unix/classes/sun/font/XMap.java +++ b/src/java.desktop/unix/classes/sun/font/XMap.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 diff --git a/src/java.desktop/unix/classes/sun/font/XRGlyphCache.java b/src/java.desktop/unix/classes/sun/font/XRGlyphCache.java index 6c8ce7960cd..09eff046779 100644 --- a/src/java.desktop/unix/classes/sun/font/XRGlyphCache.java +++ b/src/java.desktop/unix/classes/sun/font/XRGlyphCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, 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 diff --git a/src/java.desktop/unix/classes/sun/font/XRGlyphCacheEntry.java b/src/java.desktop/unix/classes/sun/font/XRGlyphCacheEntry.java index 62956f488a8..10c52de4cf6 100644 --- a/src/java.desktop/unix/classes/sun/font/XRGlyphCacheEntry.java +++ b/src/java.desktop/unix/classes/sun/font/XRGlyphCacheEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/font/XRTextRenderer.java b/src/java.desktop/unix/classes/sun/font/XRTextRenderer.java index 8662b48cf3f..0a40cf3dd25 100644 --- a/src/java.desktop/unix/classes/sun/font/XRTextRenderer.java +++ b/src/java.desktop/unix/classes/sun/font/XRTextRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java index 1b7a4364ce4..58dadbfe01f 100644 --- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXGraphicsConfig.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java index b810a4d1e9a..3b947823b9f 100644 --- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java index 73974ab2703..7fd134b9c39 100644 --- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11PMBlitBgLoops.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11PMBlitBgLoops.java index f8ea7dd759a..9c20ada45aa 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11PMBlitBgLoops.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11PMBlitBgLoops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2008, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11PMBlitLoops.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11PMBlitLoops.java index a6effd74fe8..d18b4de2fd6 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11PMBlitLoops.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11PMBlitLoops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2007, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11Renderer.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11Renderer.java index 5c65c2f51da..5c68ea805a5 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11Renderer.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11Renderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2018, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java index 39e34e40b16..ba2aaa1fc82 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java index 70ec7f8724a..2fc8ed7a83a 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceDataProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java index 88609597f05..07660201cec 100644 --- a/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2022, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/DirtyRegion.java b/src/java.desktop/unix/classes/sun/java2d/xr/DirtyRegion.java index bc0cc0b7b77..2e91761b1b4 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/DirtyRegion.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/DirtyRegion.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/GrowableByteArray.java b/src/java.desktop/unix/classes/sun/java2d/xr/GrowableByteArray.java index 1a5b615c96d..c98f99e81c1 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/GrowableByteArray.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/GrowableByteArray.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/GrowableEltArray.java b/src/java.desktop/unix/classes/sun/java2d/xr/GrowableEltArray.java index 7ec0665db5c..2817ce2c9fc 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/GrowableEltArray.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/GrowableEltArray.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/GrowablePointArray.java b/src/java.desktop/unix/classes/sun/java2d/xr/GrowablePointArray.java index 1f3eb88e91c..a5d9bef4225 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/GrowablePointArray.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/GrowablePointArray.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/GrowableRectArray.java b/src/java.desktop/unix/classes/sun/java2d/xr/GrowableRectArray.java index e611aae4e3b..5b49c8f0aec 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/GrowableRectArray.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/GrowableRectArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/MaskTile.java b/src/java.desktop/unix/classes/sun/java2d/xr/MaskTile.java index d2d0f09ad0a..eec4e570cee 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/MaskTile.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/MaskTile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/MaskTileManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/MaskTileManager.java index 7e58e530353..ab1303eb50b 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/MaskTileManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/MaskTileManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/MutableInteger.java b/src/java.desktop/unix/classes/sun/java2d/xr/MutableInteger.java index 62bb8c255e9..8ebcdc55824 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/MutableInteger.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/MutableInteger.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XIDGenerator.java b/src/java.desktop/unix/classes/sun/java2d/xr/XIDGenerator.java index 359c4d9f536..3b2123d0898 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XIDGenerator.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XIDGenerator.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java index 589f17968c4..88a72e10fa9 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRBackendNative.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRColor.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRColor.java index eb1604374bb..41585619c6e 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRColor.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRColor.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java index 14182011345..9e315805aea 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRCompositeManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawImage.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawImage.java index c78303236c6..f7c0dd84c2d 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawImage.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawImage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawLine.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawLine.java index 6b76e4ee388..d1710892d4f 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawLine.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRDrawLine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java index 748286a0828..fd7e6ba28bf 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRGraphicsConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java index 0600f6c4bcf..bbfc5153e9a 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskBlit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java index 993b329e3bc..4dcc7713faa 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskFill.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskImage.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskImage.java index cae3b6af563..8b022649eda 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskImage.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRMaskImage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java index 260bd629094..2ce93d60a0d 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRPaints.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRPaints.java index 8720dca6094..7cac5bdafc5 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRPaints.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRPaints.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java index a142d9efda7..e1fbeca0f94 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2023, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRSolidSrcPict.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRSolidSrcPict.java index 8acad667203..352d00cc33b 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRSolidSrcPict.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRSolidSrcPict.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceData.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceData.java index 54ad6334076..a7d34c72b63 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceData.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceDataProxy.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceDataProxy.java index b05b90fe267..8f0d29ecec0 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceDataProxy.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceDataProxy.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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRUtils.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRUtils.java index 3a4887e167f..ef8a0eaf225 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRUtils.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRVolatileSurfaceManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRVolatileSurfaceManager.java index ad29d553055..14f3c895b99 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XRVolatileSurfaceManager.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRVolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022, 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 diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XcbRequestCounter.java b/src/java.desktop/unix/classes/sun/java2d/xr/XcbRequestCounter.java index 58369b5a866..4be3e61cb9b 100644 --- a/src/java.desktop/unix/classes/sun/java2d/xr/XcbRequestCounter.java +++ b/src/java.desktop/unix/classes/sun/java2d/xr/XcbRequestCounter.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 diff --git a/src/java.desktop/unix/classes/sun/print/AttributeClass.java b/src/java.desktop/unix/classes/sun/print/AttributeClass.java index f8eee08411b..3db6e310dd2 100644 --- a/src/java.desktop/unix/classes/sun/print/AttributeClass.java +++ b/src/java.desktop/unix/classes/sun/print/AttributeClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, 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 @@ -174,6 +174,30 @@ public final class AttributeClass { } + /** + * Returns 3 int values. + * xres, yres, resolution as either dpi or dpcm + * The resolution is just a single byte of data. + */ + public int[] getIntResolutionValue() { + int[] res = {0, 0, 0}; + byte[] bufArray = (byte[])myValue; + if (bufArray != null) { + int nBytes = 4; // 32-bit signed integer + for (int j=0; j<2; j++) { // 2 set of integers + byte[] intBytes = new byte[nBytes]; + // REMIND: # bytes should be 8 + for (int i=0; i< nBytes; i++) { + //+ 1 because the 1st byte is length + intBytes[i] = bufArray[i+(4*j)+1]; + } + res[j] = convertToInt(intBytes); + } + res[2] = (int)bufArray[9]; + } + return res; + } + /** * Returns String value. */ diff --git a/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java b/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java index a7f8d3dc24d..5ec90efbac6 100644 --- a/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java +++ b/src/java.desktop/unix/classes/sun/print/CUPSPrinter.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 diff --git a/src/java.desktop/unix/classes/sun/print/IPPPrintService.java b/src/java.desktop/unix/classes/sun/print/IPPPrintService.java index cdc8d6e4a0e..8a3b872b107 100644 --- a/src/java.desktop/unix/classes/sun/print/IPPPrintService.java +++ b/src/java.desktop/unix/classes/sun/print/IPPPrintService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, 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 @@ -141,7 +141,7 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService private MediaSizeName[] mediaSizeNames; private CustomMediaSizeName[] customMediaSizeNames; private int defaultMediaIndex; - private int[] rawResolutions = null; + private int[] ppdResolutions = null; private PrinterResolution[] printerResolutions = null; private boolean isCupsPrinter; private boolean init; @@ -205,8 +205,7 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService OrientationRequested.PORTRAIT, new PageRanges(1), //PresentationDirection, - // CUPS does not supply printer-resolution attribute - //new PrinterResolution(300, 300, PrinterResolution.DPI), + new PrinterResolution(300, 300, PrinterResolution.DPI), //PrintQuality.NORMAL, new RequestingUserName("", Locale.getDefault()), //SheetCollate.UNCOLLATED, //CUPS has no sheet collate? @@ -467,7 +466,9 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService : getSupportedOutputBins(); customMediaSizeNames = cps.getCustomMediaSizeNames(); defaultMediaIndex = cps.getDefaultMediaIndex(); - rawResolutions = cps.getRawResolutions(); + if (ppdResolutions == null) { + ppdResolutions = cps.getRawResolutions(); + } } urlConnection.disconnect(); init = true; @@ -821,14 +822,7 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService } } } else if (category == PrinterResolution.class) { - PrinterResolution[] supportedRes = getPrintResolutions(); - if (supportedRes == null) { - return null; - } - PrinterResolution []arr = - new PrinterResolution[supportedRes.length]; - System.arraycopy(supportedRes, 0, arr, 0, supportedRes.length); - return arr; + return getPrintResolutions(); } else if (category == OutputBin.class) { return Arrays.copyOf(outputBins, outputBins.length); } @@ -1137,8 +1131,6 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService catList.add(Chromaticity.class); } - // CUPS does not report printer resolution via IPP but it - // may be gleaned from the PPD. PrinterResolution[] supportedRes = getPrintResolutions(); if (supportedRes != null && (supportedRes.length > 0)) { catList.add(PrinterResolution.class); @@ -1264,7 +1256,6 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService } } - @Override public synchronized PrintServiceAttributeSet getAttributes() { if (!init) { @@ -1684,9 +1675,7 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService } else if (category == PrinterResolution.class) { PrinterResolution[] supportedRes = getPrintResolutions(); if ((supportedRes != null) && (supportedRes.length > 0)) { - return supportedRes[0]; - } else { - return new PrinterResolution(300, 300, PrinterResolution.DPI); + return supportedRes[0]; } } else if (category == OutputBin.class) { if (attribClass != null) { @@ -1697,26 +1686,40 @@ public final class IPPPrintService implements PrintService, SunPrinterJobService return null; } + /* Called only from contexts that have called initAttributes(). + * Try IPP first, and if that produces nothing, fall back to the PPD + */ private PrinterResolution[] getPrintResolutions() { + int[] rawResolutions = null; if (printerResolutions == null) { - if (rawResolutions == null) { - printerResolutions = new PrinterResolution[0]; - } else { - int numRes = rawResolutions.length / 2; - PrinterResolution[] pres = new PrinterResolution[numRes]; - for (int i=0; i < numRes; i++) { - pres[i] = new PrinterResolution(rawResolutions[i*2], - rawResolutions[i*2+1], - PrinterResolution.DPI); - } - printerResolutions = pres; + AttributeClass attribClass = (getAttMap != null) ? + getAttMap.get("printer-resolution-supported") + : null; + if (attribClass != null) { + rawResolutions = attribClass.getIntResolutionValue(); } + if (rawResolutions == null) { + rawResolutions = ppdResolutions; + } + if (rawResolutions == null) { + rawResolutions = new int[] { 300, 300, 3 } ; + } + int numRes = rawResolutions.length / 3; + PrinterResolution[] pres = new PrinterResolution[numRes]; + for (int i = 0; i < numRes; i++) { + int units = (rawResolutions[i*3+2] == 4) ? PrinterResolution.DPCM : PrinterResolution.DPI; + pres[i] = new PrinterResolution(rawResolutions[i*3], + rawResolutions[i*3+1], + units); + } + printerResolutions = pres; } - return printerResolutions; + return printerResolutions.clone(); } private boolean isSupportedResolution(PrinterResolution res) { - PrinterResolution[] supportedRes = getPrintResolutions(); + PrinterResolution[] supportedRes = + (PrinterResolution[])getSupportedAttributeValues(PrinterResolution.class, null, null); if (supportedRes != null) { for (int i=0; iNewObject(env, intCls, intCtr, 3); + CHECK_NULL(dpi); // NOTE: cupsGetPPD returns a pointer to a filename of a temporary file. // unlink() must be called to remove the file after using it. @@ -672,6 +691,7 @@ Java_sun_print_CUPSPrinter_getResolutions(JNIEnv *env, CHECK_NULL(ryObj); (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj); (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj); + (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, dpi); } for (i = 0; i < resolution->num_choices; i++) { @@ -700,6 +720,41 @@ Java_sun_print_CUPSPrinter_getResolutions(JNIEnv *env, CHECK_NULL(ryObj); (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj); (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj); + (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, dpi); + } + } + + } else { + ppd_attr_t *defresolution = j2d_ppdFindAttr(ppd, "DefaultResolution", NULL); + if (defresolution == NULL) { + defresolution = j2d_ppdFindAttr(ppd, "Resolution", NULL); + } + if (defresolution != NULL) { + int matches = sscanf(defresolution->value, "%dx%ddpi", &defx, &defy); + if (matches == 2) { + if (defx <= 0 || defy <= 0) { + defx = 0; + defy = 0; + } + } else { + matches = sscanf(defresolution->value, "%ddpi", &defx); + if (matches == 1) { + if (defx <= 0) { + defx = 0; + } else { + defy = defx; + } + } + } + if (defx > 0) { + jobject rxObj, ryObj; + rxObj = (*env)->NewObject(env, intCls, intCtr, defx); + CHECK_NULL(rxObj); + ryObj = (*env)->NewObject(env, intCls, intCtr, defy); + CHECK_NULL(ryObj); + (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, rxObj); + (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, ryObj); + (*env)->CallBooleanMethod(env, arrayList, arrListAddMID, dpi); } } } diff --git a/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h b/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h index 82e956d4074..3953a52042b 100644 --- a/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h +++ b/src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, 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 diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c index d3821504bfb..cb8e91a373b 100644 --- a/src/java.desktop/unix/native/common/awt/fontpath.c +++ b/src/java.desktop/unix/native/common/awt/fontpath.c @@ -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 diff --git a/src/java.desktop/unix/native/common/awt/utility/rect.h b/src/java.desktop/unix/native/common/awt/utility/rect.h index ceea38f4349..91b5a17ec58 100644 --- a/src/java.desktop/unix/native/common/awt/utility/rect.h +++ b/src/java.desktop/unix/native/common/awt/utility/rect.h @@ -28,7 +28,7 @@ #ifndef _AWT_RECT_H #define _AWT_RECT_H -#ifndef MACOSX +#if !defined(HEADLESS) && !defined(MACOSX) #include typedef XRectangle RECT_T; #else @@ -39,7 +39,7 @@ typedef struct { int width; int height; } RECT_T; -#endif /* !MACOSX */ +#endif /* !HEADLESS && !MACOSX */ #define RECT_EQ_X(r1,r2) ((r1).x==(r2).x && (r1).width==(r2).width) diff --git a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c index 356b52dfb34..cd07c347c9e 100644 --- a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c +++ b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c @@ -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 diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c index fc2dece1919..db2473e40da 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c +++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c index e5b2dfa6db9..6ed23ca7541 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c +++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c @@ -42,7 +42,6 @@ #include "debug_assert.h" static void *gtk3_libhandle = NULL; -static void *gthread_libhandle = NULL; static void transform_detail_string (const gchar *detail, GtkStyleContext *context); @@ -79,15 +78,6 @@ static void* dl_symbol(const char* name) return result; } -static void* dl_symbol_gthread(const char* name) -{ - void* result = dlsym(gthread_libhandle, name); - if (!result) - longjmp(j, NO_SYMBOL_EXCEPTION); - - return result; -} - gboolean gtk3_check(const char* lib_name, gboolean load) { if (gtk3_libhandle != NULL) { @@ -264,13 +254,6 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name) return FALSE; } - gthread_libhandle = dlopen(GTHREAD_LIB_VERSIONED, RTLD_LAZY | RTLD_LOCAL); - if (gthread_libhandle == NULL) { - gthread_libhandle = dlopen(GTHREAD_LIB, RTLD_LAZY | RTLD_LOCAL); - if (gthread_libhandle == NULL) - return FALSE; - } - if (setjmp(j) == 0) { fp_gtk_check_version = dl_symbol("gtk_check_version"); @@ -619,6 +602,9 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name) fp_g_uuid_string_is_valid = //since: 2.52 dl_symbol("g_uuid_string_is_valid"); fp_g_variant_print = dl_symbol("g_variant_print"); // since 2.24 + + fp_g_settings_new = dl_symbol("g_settings_new"); // since 2.26 + fp_g_settings_get_string = dl_symbol("g_settings_get_string"); // since 2.26 } fp_g_string_printf = dl_symbol("g_string_printf"); fp_g_strconcat = dl_symbol("g_strconcat"); @@ -634,9 +620,6 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name) dlclose(gtk3_libhandle); gtk3_libhandle = NULL; - dlclose(gthread_libhandle); - gthread_libhandle = NULL; - return NULL; } @@ -735,7 +718,6 @@ static int gtk3_unload() dlerror(); dlclose(gtk3_libhandle); - dlclose(gthread_libhandle); if ((gtk3_error = dlerror()) != NULL) { return FALSE; @@ -3008,6 +2990,37 @@ static GdkWindow* gtk3_get_window(void *widget) { return fp_gtk_widget_get_window((GtkWidget*)widget); } +static gboolean apply_theme_if_needed() { + if (!glib_version_2_68) { + return FALSE; + } + + GSettings *settings = fp_g_settings_new("org.gnome.desktop.interface"); + if (!settings) { + return FALSE; + } + + static gboolean wasDark = FALSE; + + gchar *scheme = fp_g_settings_get_string(settings, "color-scheme"); + const gboolean isDark = strcmp(scheme, "prefer-dark") == 0; + + fp_g_free(scheme); + fp_g_object_unref(settings); + + if (wasDark ^ isDark) { + GtkSettings* gtkSettings = fp_gtk_settings_get_default(); + if (!gtkSettings) { + return FALSE; + } + fp_g_object_set(gtkSettings, "gtk-application-prefer-dark-theme", isDark, NULL); + wasDark = isDark; + return TRUE; + } + + return FALSE; +} + static void gtk3_init(GtkApi* gtk) { gtk->version = GTK_3; @@ -3017,6 +3030,8 @@ static void gtk3_init(GtkApi* gtk) { gtk->gtk_check_version = fp_gtk_check_version; gtk->get_setting = >k3_get_setting; + gtk->apply_theme_if_needed = &apply_theme_if_needed; + gtk->paint_arrow = >k3_paint_arrow; gtk->paint_box = >k3_paint_box; gtk->paint_box_gap = >k3_paint_box_gap; diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h index d3a83677dd6..637a3198e43 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h +++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.h @@ -193,6 +193,7 @@ typedef void GtkMenuShell; typedef void GtkWidgetClass; typedef void PangoFontDescription; typedef void GtkSettings; +typedef void GSettings; typedef void GtkStyleProvider; typedef void cairo_pattern_t; typedef void cairo_t; @@ -633,6 +634,10 @@ static char* (*fp_pango_font_description_to_string)( const PangoFontDescription* fd); static GtkSettings* (*fp_gtk_settings_get_default)(); static GtkSettings* (*fp_gtk_widget_get_settings)(GtkWidget *widget); + +static GSettings *(*fp_g_settings_new)(const gchar *schema_id); +static gchar *(*fp_g_settings_get_string)(GSettings *settings, const gchar *key); + static GType (*fp_gtk_border_get_type)(); static void (*fp_gtk_arrow_set)(GtkWidget* arrow, GtkArrowType arrow_type, diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.h b/src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.h index 11ec245ce8b..37422094202 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.h +++ b/src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.h @@ -38,9 +38,6 @@ #define TRUE (!FALSE) #endif -#define GTHREAD_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gthread-2.0", "0") -#define GTHREAD_LIB JNI_LIB_NAME("gthread-2.0") - #define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip) #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) \ (_G_TYPE_CIC ((instance), (g_type), c_type)) @@ -544,6 +541,8 @@ typedef struct GtkApi { guint required_micro); jobject (*get_setting)(JNIEnv *env, Setting property); + gboolean (*apply_theme_if_needed)(); + void (*paint_arrow)(WidgetType widget_type, GtkStateType state_type, GtkShadowType shadow_type, const gchar *detail, gint x, gint y, gint width, gint height, @@ -850,9 +849,6 @@ typedef struct GtkApi { gboolean gtk_load(JNIEnv *env, GtkVersion version, gboolean verbose); gboolean gtk_check_version(GtkVersion version); -typedef struct _GThreadFunctions GThreadFunctions; -static gboolean (*fp_g_thread_get_initialized)(void); -static void (*fp_g_thread_init)(GThreadFunctions *vtable); static void (*fp_gdk_threads_init)(void); static void (*fp_gdk_threads_enter)(void); static void (*fp_gdk_threads_leave)(void); diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKEngine.c b/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKEngine.c index bb5c799f008..3b7b2880316 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKEngine.c +++ b/src/java.desktop/unix/native/libawt_xawt/awt/swing_GTKEngine.c @@ -388,3 +388,17 @@ Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeSetRangeValue( gtk->set_range_value(widget_type, value, min, max, visible); gtk->gdk_threads_leave(); } + +/* + * Class: com_sun_java_swing_plaf_gtk_GTKLookAndFeel + * Method: applyThemeIfNeeded + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL +Java_com_sun_java_swing_plaf_gtk_GTKLookAndFeel_applyThemeIfNeeded(JNIEnv *env, jobject this) { + gtk->gdk_threads_enter(); + const gboolean result = gtk->apply_theme_if_needed(); + gtk->gdk_threads_leave(); + + return result; +} diff --git a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c index 0ea86e3e9b3..ebb3e32890e 100644 --- a/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c +++ b/src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -339,7 +339,7 @@ Java_sun_java2d_xr_XRBackendNative_createPixmap(JNIEnv *env, jobject this, JNIEXPORT jint JNICALL Java_sun_java2d_xr_XRBackendNative_createPictureNative (JNIEnv *env, jclass cls, jint drawable, jlong formatPtr) { - XRenderPictureAttributes pict_attr; + XRenderPictureAttributes pict_attr = {0}; return XRenderCreatePicture(awt_display, (Drawable) drawable, (XRenderPictFormat *) jlong_to_ptr(formatPtr), 0, &pict_attr); diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/AnimationController.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/AnimationController.java index a91e1a97ee1..06574d17641 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/AnimationController.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/AnimationController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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,8 +39,6 @@ import com.sun.java.swing.plaf.windows.TMSchema.Part; import com.sun.java.swing.plaf.windows.TMSchema.Prop; import com.sun.java.swing.plaf.windows.XPStyle.Skin; -import sun.awt.AppContext; - /** * A class to help mimic Vista theme animations. The only kind of * animation it handles for now is 'transition' animation (this seems @@ -68,8 +66,7 @@ final class AnimationController implements ActionListener, PropertyChangeListene Boolean.getBoolean("swing.disablevistaanimation"); - private static final Object ANIMATION_CONTROLLER_KEY = - new StringBuilder("ANIMATION_CONTROLLER_KEY"); + private static AnimationController animationController; private final Map> animationStateMap = new WeakHashMap>(); @@ -80,13 +77,10 @@ final class AnimationController implements ActionListener, PropertyChangeListene new javax.swing.Timer(1000/30, this); private static synchronized AnimationController getAnimationController() { - AppContext appContext = AppContext.getAppContext(); - Object obj = appContext.get(ANIMATION_CONTROLLER_KEY); - if (obj == null) { - obj = new AnimationController(); - appContext.put(ANIMATION_CONTROLLER_KEY, obj); + if (animationController == null) { + animationController = new AnimationController(); } - return (AnimationController) obj; + return animationController; } private AnimationController() { @@ -316,8 +310,7 @@ final class AnimationController implements ActionListener, PropertyChangeListene timer.stop(); UIManager.removePropertyChangeListener(this); synchronized (AnimationController.class) { - AppContext.getAppContext() - .put(ANIMATION_CONTROLLER_KEY, null); + animationController = null; } } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/TMSchema.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/TMSchema.java index 93628d85766..7dcfe3d1ca8 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/TMSchema.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/TMSchema.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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsBorders.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsBorders.java index 31a490bebcc..81766db8116 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsBorders.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsBorders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, 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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsButtonUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsButtonUI.java index 33dea2b3b08..ee07276aa30 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsButtonUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, 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 @@ -47,8 +47,6 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicGraphicsUtils; -import sun.awt.AppContext; - import static com.sun.java.swing.plaf.windows.TMSchema.Part; import static com.sun.java.swing.plaf.windows.TMSchema.State; import static com.sun.java.swing.plaf.windows.XPStyle.Skin; @@ -69,20 +67,13 @@ public final class WindowsButtonUI extends BasicButtonUI private boolean defaults_initialized = false; - private static final Object WINDOWS_BUTTON_UI_KEY = new Object(); + private static final ComponentUI UI = new WindowsButtonUI(); // ******************************** // Create PLAF // ******************************** public static ComponentUI createUI(JComponent c) { - AppContext appContext = AppContext.getAppContext(); - WindowsButtonUI windowsButtonUI = - (WindowsButtonUI) appContext.get(WINDOWS_BUTTON_UI_KEY); - if (windowsButtonUI == null) { - windowsButtonUI = new WindowsButtonUI(); - appContext.put(WINDOWS_BUTTON_UI_KEY, windowsButtonUI); - } - return windowsButtonUI; + return UI; } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxUI.java index 3ead1228b0e..7cb2490fd76 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsCheckBoxUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, 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 @@ -30,8 +30,6 @@ import javax.swing.JComponent; import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; -import sun.awt.AppContext; - /** * Windows check box. * @@ -43,7 +41,7 @@ public final class WindowsCheckBoxUI extends WindowsRadioButtonUI // of BasicCheckBoxUI because we want to pick up all the // painting changes made in WindowsRadioButtonUI. - private static final Object WINDOWS_CHECK_BOX_UI_KEY = new Object(); + private static final ComponentUI UI = new WindowsCheckBoxUI(); private static final String propertyPrefix = "CheckBox" + "."; @@ -53,14 +51,7 @@ public final class WindowsCheckBoxUI extends WindowsRadioButtonUI // Create PLAF // ******************************** public static ComponentUI createUI(JComponent c) { - AppContext appContext = AppContext.getAppContext(); - WindowsCheckBoxUI windowsCheckBoxUI = - (WindowsCheckBoxUI) appContext.get(WINDOWS_CHECK_BOX_UI_KEY); - if (windowsCheckBoxUI == null) { - windowsCheckBoxUI = new WindowsCheckBoxUI(); - appContext.put(WINDOWS_CHECK_BOX_UI_KEY, windowsCheckBoxUI); - } - return windowsCheckBoxUI; + return UI; } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsClassicLookAndFeel.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsClassicLookAndFeel.java index 59eace01a4c..5716a875cd7 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsClassicLookAndFeel.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsClassicLookAndFeel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java index f37ce17d876..fdc9b03ae7d 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, 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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopIconUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopIconUI.java index 8da4bd7921b..47ecdf5747b 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopIconUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopIconUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java index 355f70b4607..79d81bad089 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, 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 @@ -80,10 +80,13 @@ public final class WindowsDesktopManager extends DefaultDesktopManager if (f.isMaximizable()) { if (!f.isMaximum()) { f.setMaximum(true); - } else if (f.isMaximum() && f.isIcon()) { - f.setIcon(false); } else { - f.setMaximum(false); + // If frame being activated is set to maximised + // and iconified, let it be maximised + // else remain non-maximised + if (f.isIcon()) { + f.setIcon(false); + } } } } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopPaneUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopPaneUI.java index 49ab809dddd..dabbe3fb992 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopPaneUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsEditorPaneUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsEditorPaneUI.java index abccb6b9a48..44cb0e9634c 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsEditorPaneUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsEditorPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java index b5859b08ea8..ba5b7cb58e2 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.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 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 915a361a3a1..91c2cbcd61d 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 @@ -905,10 +905,46 @@ public final class WindowsIconFactory implements Serializable 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/WindowsInternalFrameUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameUI.java index 5c331533af9..9db31ba38f9 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLabelUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLabelUI.java index d10f3f47c3c..4283f743b97 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLabelUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLabelUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, 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 @@ -34,7 +34,6 @@ import javax.swing.UIManager; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicLabelUI; -import sun.awt.AppContext; import sun.swing.MnemonicHandler; import sun.swing.SwingUtilities2; @@ -43,20 +42,13 @@ import sun.swing.SwingUtilities2; */ public final class WindowsLabelUI extends BasicLabelUI { - private static final Object WINDOWS_LABEL_UI_KEY = new Object(); + private static final ComponentUI UI = new WindowsLabelUI(); // ******************************** // Create PLAF // ******************************** public static ComponentUI createUI(JComponent c) { - AppContext appContext = AppContext.getAppContext(); - WindowsLabelUI windowsLabelUI = - (WindowsLabelUI) appContext.get(WINDOWS_LABEL_UI_KEY); - if (windowsLabelUI == null) { - windowsLabelUI = new WindowsLabelUI(); - appContext.put(WINDOWS_LABEL_UI_KEY, windowsLabelUI); - } - return windowsLabelUI; + return UI; } @Override diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java index d1ee714f362..ce7ed3177d1 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 f663d8d1e90..3d3cf5feee7 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, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 61f760d63c4..d15bc93a628 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 @@ -238,6 +238,15 @@ public final class WindowsMenuItemUI extends BasicMenuItemUI { 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 130b09227cc..a7aca0c5ccf 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 @@ -301,7 +301,7 @@ public final class WindowsMenuUI extends BasicMenuUI { JMenu menu = (JMenu)evt.getSource(); ButtonModel model = menu.getModel(); - if (menu.isRolloverEnabled()) { + if (menu.isRolloverEnabled() && menu.isTopLevelMenu()) { model.setRollover(false); menuItem.repaint(); } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsOptionPaneUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsOptionPaneUI.java index 5ced1659adf..05c1b177705 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsOptionPaneUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsOptionPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPasswordFieldUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPasswordFieldUI.java index 1f64c18e61f..6adf6e402ec 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPasswordFieldUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPasswordFieldUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java index 9d67278526a..576549ae482 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2014, 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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java index 4df236115fb..1361286df4a 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupWindow.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupWindow.java index b58ad07a57b..02705d7c3b7 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupWindow.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsPopupWindow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI.java index 8fdc1a315c9..c62a9ec8586 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRadioButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, 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 @@ -38,14 +38,12 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicGraphicsUtils; import javax.swing.plaf.basic.BasicRadioButtonUI; -import sun.awt.AppContext; - /** * Windows rendition of the component. */ public class WindowsRadioButtonUI extends BasicRadioButtonUI { - private static final Object WINDOWS_RADIO_BUTTON_UI_KEY = new Object(); + private static final ComponentUI UI = new WindowsRadioButtonUI(); protected int dashedRectGapX; protected int dashedRectGapY; @@ -60,14 +58,7 @@ public class WindowsRadioButtonUI extends BasicRadioButtonUI // Create PLAF // ******************************** public static ComponentUI createUI(JComponent c) { - AppContext appContext = AppContext.getAppContext(); - WindowsRadioButtonUI windowsRadioButtonUI = - (WindowsRadioButtonUI) appContext.get(WINDOWS_RADIO_BUTTON_UI_KEY); - if (windowsRadioButtonUI == null) { - windowsRadioButtonUI = new WindowsRadioButtonUI(); - appContext.put(WINDOWS_RADIO_BUTTON_UI_KEY, windowsRadioButtonUI); - } - return windowsRadioButtonUI; + return UI; } // ******************************** diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java index 19bfad0a1da..5e08dcf5605 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java index c8d62e52834..04a9f2e97cf 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsScrollPaneUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsScrollPaneUI.java index 393f7595402..48e7a8c02fb 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsScrollPaneUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsScrollPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSeparatorUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSeparatorUI.java index 9ce5db3b4ef..2a2caef60d2 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSeparatorUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java index 88dc91d572b..731775a2575 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java index bad66ce3a04..a8e2a2ddcf1 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSplitPaneDivider.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSplitPaneDivider.java index 95062ef586f..a132756bbee 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSplitPaneDivider.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSplitPaneDivider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2020, 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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSplitPaneUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSplitPaneUI.java index 8c50e391164..481fa466a5b 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSplitPaneUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsSplitPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java index 86e2ee1fc52..874b5c65c6e 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java index b670bd294b0..de8f18b4ea1 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextAreaUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextAreaUI.java index e695d9f6708..78cceff2a0c 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextAreaUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextAreaUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java index 508d260895c..5846dcb9f09 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextFieldUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextPaneUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextPaneUI.java index 7858a1195e8..2c645903e51 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextPaneUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java index 89180ffdd5f..62987e43ec8 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTextUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToggleButtonUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToggleButtonUI.java index 0f468fdf6b1..67eb5c1d6a0 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToggleButtonUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToggleButtonUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, 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 @@ -38,8 +38,6 @@ import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicGraphicsUtils; import javax.swing.plaf.basic.BasicToggleButtonUI; -import sun.awt.AppContext; - /** * A Windows toggle button. * @@ -54,19 +52,12 @@ public final class WindowsToggleButtonUI extends BasicToggleButtonUI protected Color focusColor; - private static final Object WINDOWS_TOGGLE_BUTTON_UI_KEY = new Object(); + private static final ComponentUI UI = new WindowsToggleButtonUI(); private boolean defaults_initialized = false; public static ComponentUI createUI(JComponent b) { - AppContext appContext = AppContext.getAppContext(); - WindowsToggleButtonUI windowsToggleButtonUI = - (WindowsToggleButtonUI) appContext.get(WINDOWS_TOGGLE_BUTTON_UI_KEY); - if (windowsToggleButtonUI == null) { - windowsToggleButtonUI = new WindowsToggleButtonUI(); - appContext.put(WINDOWS_TOGGLE_BUTTON_UI_KEY, windowsToggleButtonUI); - } - return windowsToggleButtonUI; + return UI; } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToolBarSeparatorUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToolBarSeparatorUI.java index 5350de9ae5c..47175b83d30 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToolBarSeparatorUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToolBarSeparatorUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, 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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToolBarUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToolBarUI.java index 68e077fa350..025c30c5c96 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToolBarUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsToolBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2006, 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 diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java index 6ab2352641f..78384bbd18a 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsTreeUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/XPStyle.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/XPStyle.java index 89751f6dc94..0731b038939 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/XPStyle.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/XPStyle.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 diff --git a/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java b/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java index c888106d779..46742f5fd59 100644 --- a/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java +++ b/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.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 diff --git a/src/java.desktop/windows/classes/sun/awt/Win32ColorModel24.java b/src/java.desktop/windows/classes/sun/awt/Win32ColorModel24.java index fe55cacf833..43fa22db878 100644 --- a/src/java.desktop/windows/classes/sun/awt/Win32ColorModel24.java +++ b/src/java.desktop/windows/classes/sun/awt/Win32ColorModel24.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 diff --git a/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java b/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java index 5084d0bcabe..da469f7208f 100644 --- a/src/java.desktop/windows/classes/sun/awt/Win32FontManager.java +++ b/src/java.desktop/windows/classes/sun/awt/Win32FontManager.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 diff --git a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsConfig.java b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsConfig.java index 31fc0847d3b..a00e664d269 100644 --- a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsConfig.java +++ b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java index fedc7f38980..d52c7689457 100644 --- a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java +++ b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java index 2e11d551059..9d09f13e525 100644 --- a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java +++ b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.java b/src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.java index 94a2c4df0a9..0dd40025222 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.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 diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java index 8b3218de667..1b3fb9a85e9 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WDataTransferer.java b/src/java.desktop/windows/classes/sun/awt/windows/WDataTransferer.java index 068d577995f..b8278279ae8 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WDataTransferer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WDataTransferer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, 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 diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WDefaultFontCharset.java b/src/java.desktop/windows/classes/sun/awt/windows/WDefaultFontCharset.java index 09c317c81f2..d66de5ebaa1 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WDefaultFontCharset.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WDefaultFontCharset.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java index 788c1477265..e5b628dd74b 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.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 @@ -38,6 +38,9 @@ import java.io.File; import java.io.IOException; import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import javax.swing.event.EventListenerList; import sun.awt.shell.ShellFolder; @@ -50,9 +53,11 @@ import sun.awt.shell.ShellFolder; */ final class WDesktopPeer implements DesktopPeer { /* Constants for the operation verbs */ - private static String ACTION_OPEN_VERB = "open"; - private static String ACTION_EDIT_VERB = "edit"; - private static String ACTION_PRINT_VERB = "print"; + private static final String ACTION_OPEN_VERB = "open"; + private static final String ACTION_EDIT_VERB = "edit"; + private static final String ACTION_PRINT_VERB = "print"; + private static final String ACTION_BROWSE_VERB = "browse"; + private static final String ACTION_MAIL_VERB = "mail"; private static native void init(); @@ -95,12 +100,12 @@ final class WDesktopPeer implements DesktopPeer { @Override public void mail(URI uri) throws IOException { - this.ShellExecute(uri, ACTION_OPEN_VERB); + this.ShellExecute(uri, ACTION_MAIL_VERB); } @Override public void browse(URI uri) throws IOException { - this.ShellExecute(uri, ACTION_OPEN_VERB); + this.launchUriInBrowser(uri); } private void ShellExecute(File file, String verb) throws IOException { @@ -121,6 +126,42 @@ final class WDesktopPeer implements DesktopPeer { } } + private void launchUriInBrowser(URI uri) throws IOException { + String defaultBrowser = getDefaultBrowser(); + if (defaultBrowser == null) { + throw new IOException("Failed to get default browser"); + } + + List cmdLineTokens = getCmdLineTokens(uri, defaultBrowser); + try { + ProcessBuilder pb = new ProcessBuilder(cmdLineTokens); + pb.start(); + } catch (Exception e) { + throw new IOException("Error launching Browser: ", e); + } + } + + private static List getCmdLineTokens(URI uri, String defaultBrowser) { + if (defaultBrowser.contains("%1")) { + defaultBrowser = defaultBrowser.replace("%1", uri.toString()); + } else { + defaultBrowser = defaultBrowser + " " + uri.toString(); + } + + List cmdLineTokens = new ArrayList<>(); + int firstIndex = defaultBrowser.indexOf("\""); + int secondIndex = defaultBrowser.indexOf("\"", firstIndex + 1); + + if (firstIndex == 0 && secondIndex != firstIndex) { + cmdLineTokens.add(defaultBrowser.substring(firstIndex, secondIndex + 1)); + defaultBrowser = defaultBrowser.substring(secondIndex + 1).trim(); + } + cmdLineTokens.addAll(Arrays.asList(defaultBrowser.split(" "))); + return cmdLineTokens; + } + + private static native String getDefaultBrowser(); + private static native String ShellExecute(String fileOrUri, String verb); private static final EventListenerList listenerList = new EventListenerList(); diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WDesktopProperties.java b/src/java.desktop/windows/classes/sun/awt/windows/WDesktopProperties.java index 6e3de090ee8..5c2e873c72b 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WDesktopProperties.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WDesktopProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, 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 diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WDragSourceContextPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WDragSourceContextPeer.java index 43a91c3c7ab..beb88623d88 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WDragSourceContextPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WDragSourceContextPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2009, 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 diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java b/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java index dcdee830edc..9a74a1c25f7 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java index bab79c38ff4..57d89647e10 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java b/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java index 0e4e5bd585e..a9237e21ff6 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WInputMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WLabelPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WLabelPeer.java index c5267e52793..f865b4f5c40 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WLabelPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WLabelPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WLightweightFramePeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WLightweightFramePeer.java index 994b81e372e..5651d952c03 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WLightweightFramePeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WLightweightFramePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, 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 diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WMenuItemPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WMenuItemPeer.java index f2961f79a04..4abb9fa84ae 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WMenuItemPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WMenuItemPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WMouseInfoPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WMouseInfoPeer.java index 4b785aaba69..6cd5be241a4 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WMouseInfoPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WMouseInfoPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, 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 diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WPopupMenuPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WPopupMenuPeer.java index d89cbcfa53a..bc0bb20d012 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WPopupMenuPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WPopupMenuPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 01be8587685..1da9db3a35b 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, 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 @@ -1733,6 +1733,10 @@ public final class WPrinterJob extends RasterPrinterJob if (isRangeSet) { attributes.add(new PageRanges(from, to)); setPageRange(from, to); + } else { + attributes.remove(PageRanges.class); + setPageRange(Pageable.UNKNOWN_NUMBER_OF_PAGES, + Pageable.UNKNOWN_NUMBER_OF_PAGES); } defaultCopies = false; attributes.add(new Copies(copies)); diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java index 3a0d7bf3a71..bb0cfcfb732 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WScrollPanePeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WScrollbarPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WScrollbarPeer.java index cfc227d29d6..908ec65cc7a 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WScrollbarPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WScrollbarPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java index d6c311d3f48..7cf92292a32 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WTrayIconPeer.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 diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java index 0ba2217dde5..f678be9f1ab 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WWindowPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WingDings.java b/src/java.desktop/windows/classes/sun/awt/windows/WingDings.java index ae7573ac4e2..d77a8f2eec3 100644 --- a/src/java.desktop/windows/classes/sun/awt/windows/WingDings.java +++ b/src/java.desktop/windows/classes/sun/awt/windows/WingDings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/font/NativeFont.java b/src/java.desktop/windows/classes/sun/font/NativeFont.java index 9b0e6492d67..80ae50e1cef 100644 --- a/src/java.desktop/windows/classes/sun/font/NativeFont.java +++ b/src/java.desktop/windows/classes/sun/font/NativeFont.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 diff --git a/src/java.desktop/windows/classes/sun/font/NativeStrike.java b/src/java.desktop/windows/classes/sun/font/NativeStrike.java index 7b2b947d722..eaf2eb5532f 100644 --- a/src/java.desktop/windows/classes/sun/font/NativeStrike.java +++ b/src/java.desktop/windows/classes/sun/font/NativeStrike.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 @@ -47,7 +47,6 @@ public class NativeStrike extends PhysicalStrike { throw new RuntimeException("NativeFont not used on Windows"); } - @Override void getGlyphImagePtrs(int[] glyphCodes, long[] images,int len) { } @@ -81,14 +80,9 @@ public class NativeStrike extends PhysicalStrike { Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) { return null; } + @Override GeneralPath getGlyphOutline(int glyphCode, float x, float y) { return null; } - - @Override - GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) { - return null; - } - } diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java index 9aa9837b191..3483d000c12 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBufImgOps.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBufImgOps.java index 7ca0130391b..a12b9dbd351 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBufImgOps.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBufImgOps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DContext.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DContext.java index 5d9b6c30b5b..504dea93f26 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DContext.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DDrawImage.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DDrawImage.java index e847c7ba7cd..33e375bc629 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DDrawImage.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DDrawImage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java index 8b001317dca..fc057eb2f1b 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java index 1c838d0d32d..2545f068855 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DMaskBlit.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DMaskBlit.java index 6ba766d2b13..16b55b761f5 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DMaskBlit.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DMaskBlit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DMaskFill.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DMaskFill.java index d00e3fe2ee1..0ea049a67ea 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DMaskFill.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DMaskFill.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DPaints.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DPaints.java index 74b7cfc6967..2690fb98d6b 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DPaints.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DPaints.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2014, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DRenderQueue.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DRenderQueue.java index be20e1c4e4c..f84ef6cf76c 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DRenderQueue.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DRenderQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DRenderer.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DRenderer.java index 7361a09973b..2e831567d50 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DRenderer.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java index 58dfd17dea7..d656108c286 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java index 374fce63db0..07eeafd3cb8 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceDataProxy.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceDataProxy.java index 6ea095666b3..97e8ad681ff 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceDataProxy.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceDataProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2014, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DTextRenderer.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DTextRenderer.java index 31b2cc207cd..4abc3c12d3d 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DTextRenderer.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DTextRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java index 0fedb478362..e2728184bb8 100644 --- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java +++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java index 40d2af5c12a..b59bebbe0d7 100644 --- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.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 diff --git a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java index 8f97980811f..bb0660ca3c8 100644 --- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java index c90f8102e7e..f8fc092127f 100644 --- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java +++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/windows/GDIBlitLoops.java b/src/java.desktop/windows/classes/sun/java2d/windows/GDIBlitLoops.java index 18d44ea6a49..bd90e9443c9 100644 --- a/src/java.desktop/windows/classes/sun/java2d/windows/GDIBlitLoops.java +++ b/src/java.desktop/windows/classes/sun/java2d/windows/GDIBlitLoops.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/windows/GDIRenderer.java b/src/java.desktop/windows/classes/sun/java2d/windows/GDIRenderer.java index 9bb3ba38b20..5820ed233da 100644 --- a/src/java.desktop/windows/classes/sun/java2d/windows/GDIRenderer.java +++ b/src/java.desktop/windows/classes/sun/java2d/windows/GDIRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, 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 diff --git a/src/java.desktop/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java b/src/java.desktop/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java index 38b57f77bce..59b490462f7 100644 --- a/src/java.desktop/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java +++ b/src/java.desktop/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.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 diff --git a/src/java.desktop/windows/classes/sun/print/PlatformPrinterJobProxy.java b/src/java.desktop/windows/classes/sun/print/PlatformPrinterJobProxy.java index 677831a9245..4a46f42f215 100644 --- a/src/java.desktop/windows/classes/sun/print/PlatformPrinterJobProxy.java +++ b/src/java.desktop/windows/classes/sun/print/PlatformPrinterJobProxy.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 diff --git a/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java b/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java index 7af6f1b61f8..6c8540fd67f 100644 --- a/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java +++ b/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.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 diff --git a/src/java.desktop/windows/classes/sun/print/Win32MediaTray.java b/src/java.desktop/windows/classes/sun/print/Win32MediaTray.java index 3cb8c858e39..1a5b2dd6601 100644 --- a/src/java.desktop/windows/classes/sun/print/Win32MediaTray.java +++ b/src/java.desktop/windows/classes/sun/print/Win32MediaTray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, 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 diff --git a/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java b/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java index cd4eec9926b..0afd0ed60c7 100644 --- a/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java +++ b/src/java.desktop/windows/classes/sun/print/Win32PrintJob.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 diff --git a/src/java.desktop/windows/classes/sun/print/Win32PrintService.java b/src/java.desktop/windows/classes/sun/print/Win32PrintService.java index 3bca5b581bb..1f5373c1f4b 100644 --- a/src/java.desktop/windows/classes/sun/print/Win32PrintService.java +++ b/src/java.desktop/windows/classes/sun/print/Win32PrintService.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 diff --git a/src/java.desktop/windows/classes/sun/swing/plaf/windows/ClassicSortArrowIcon.java b/src/java.desktop/windows/classes/sun/swing/plaf/windows/ClassicSortArrowIcon.java index f1180b3ae38..53f6c628712 100644 --- a/src/java.desktop/windows/classes/sun/swing/plaf/windows/ClassicSortArrowIcon.java +++ b/src/java.desktop/windows/classes/sun/swing/plaf/windows/ClassicSortArrowIcon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2014, 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 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 ba79523249c..ebb43b2f078 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, 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 @@ -30,6 +30,12 @@ #include #include #include "awt_Toolkit.h" +#include +#include // for AssocQueryStringW +#include +#include +#include +#include // for SaferiIsExecutableFileType #define BUFFER_LIMIT MAX_PATH+1 @@ -78,14 +84,23 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute LPCWSTR fileOrUri_c = JNU_GetStringPlatformChars(env, fileOrUri_j, NULL); CHECK_NULL_RETURN(fileOrUri_c, NULL); LPCWSTR verb_c = JNU_GetStringPlatformChars(env, verb_j, NULL); + if (verb_c == NULL) { JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c); return NULL; } + if (wcscmp(verb_c, L"open") == 0) { + BOOL isExecutable = SaferiIsExecutableFileType(fileOrUri_c, FALSE); + if (isExecutable) { + return env->NewStringUTF("Unsupported URI content"); + } + } + // set action verb for mail() to open before calling ShellExecute + LPCWSTR actionVerb = wcscmp(verb_c, L"mail") == 0 ? L"open" : verb_c; // 6457572: ShellExecute possibly changes FPU control word - saving it here unsigned oldcontrol87 = _control87(0, 0); - HINSTANCE retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL, + HINSTANCE retval = ::ShellExecute(NULL, actionVerb, fileOrUri_c, NULL, NULL, SW_SHOWNORMAL); DWORD error = ::GetLastError(); _control87(oldcontrol87, 0xffffffff); @@ -113,10 +128,38 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute return errmsg; } } - return NULL; } +/* + * Class: sun_awt_windows_WDesktopPeer + * Method: getDefaultBrowser + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_getDefaultBrowser +(JNIEnv *env, jclass cls) +{ + LPCWSTR fileExtension = L"https"; + WCHAR defaultBrowser_c [MAX_PATH]; + DWORD cchBuffer = MAX_PATH; + + // Use AssocQueryString to get the default browser + HRESULT hr = AssocQueryStringW( + ASSOCF_NONE, // No special flags + ASSOCSTR_COMMAND, // Request the command string + fileExtension, // File extension + NULL, // pszExtra (optional) + defaultBrowser_c, // Output buffer - result + &cchBuffer // Size of the output buffer + ); + + if (FAILED(hr)) { + return NULL; + } + + return JNU_NewStringPlatform(env, defaultBrowser_c); +} + /* * Class: sun_awt_windows_WDesktopPeer * Method: moveToTrash diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Dialog.h b/src/java.desktop/windows/native/libawt/windows/awt_Dialog.h index 91886c46a9a..c81e38fb3ac 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Dialog.h +++ b/src/java.desktop/windows/native/libawt/windows/awt_Dialog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.cpp b/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.cpp index 90d7854d0c8..0f46eb59001 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_GDIObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, 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 diff --git a/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp b/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp index 87087870b5d..d7e18e5eaf4 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_InputMethod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Mlib.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Mlib.cpp index 5b189796ed1..fcfcf477d0d 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_Mlib.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_Mlib.cpp @@ -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 diff --git a/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp b/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp index 9d45c3f083b..8d016d8b39f 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.desktop/windows/native/libawt/windows/awt_new.cpp b/src/java.desktop/windows/native/libawt/windows/awt_new.cpp index fdd1d79ba2c..3dff2e02c7f 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_new.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_new.cpp @@ -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 diff --git a/src/java.logging/share/classes/java/util/logging/ConsoleHandler.java b/src/java.logging/share/classes/java/util/logging/ConsoleHandler.java index 1561c7edebf..0fb0db09e27 100644 --- a/src/java.logging/share/classes/java/util/logging/ConsoleHandler.java +++ b/src/java.logging/share/classes/java/util/logging/ConsoleHandler.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 diff --git a/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java b/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java index c29ddf60213..e8bd455b31e 100644 --- a/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java +++ b/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.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 diff --git a/src/java.management/share/classes/javax/management/remote/JMXConnectorServer.java b/src/java.management/share/classes/javax/management/remote/JMXConnectorServer.java index 05fd8df8f55..2b9a78ed487 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXConnectorServer.java +++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, 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 diff --git a/src/java.management/share/classes/javax/management/remote/JMXConnectorServerMBean.java b/src/java.management/share/classes/javax/management/remote/JMXConnectorServerMBean.java index 4d8602bb81b..109b96f643e 100644 --- a/src/java.management/share/classes/javax/management/remote/JMXConnectorServerMBean.java +++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorServerMBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, 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 diff --git a/src/java.management/share/classes/sun/management/MemoryImpl.java b/src/java.management/share/classes/sun/management/MemoryImpl.java index 3e27ba2e5bb..5e5d1942b84 100644 --- a/src/java.management/share/classes/sun/management/MemoryImpl.java +++ b/src/java.management/share/classes/sun/management/MemoryImpl.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 diff --git a/src/java.management/share/classes/sun/management/VMManagement.java b/src/java.management/share/classes/sun/management/VMManagement.java index 3e227225ccd..29391cf53ba 100644 --- a/src/java.management/share/classes/sun/management/VMManagement.java +++ b/src/java.management/share/classes/sun/management/VMManagement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,6 +48,9 @@ public interface VMManagement { public boolean isGcNotificationSupported(); public boolean isRemoteDiagnosticCommandsSupported(); + // AOT Subsystem + public boolean endAOTRecording(); + // Class Loading Subsystem public long getTotalClassCount(); public int getLoadedClassCount(); diff --git a/src/java.management/share/classes/sun/management/VMManagementImpl.java b/src/java.management/share/classes/sun/management/VMManagementImpl.java index b8c7a2921d4..0fd0d8ad562 100644 --- a/src/java.management/share/classes/sun/management/VMManagementImpl.java +++ b/src/java.management/share/classes/sun/management/VMManagementImpl.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 @@ -117,6 +117,9 @@ class VMManagementImpl implements VMManagement { public native boolean isThreadCpuTimeEnabled(); public native boolean isThreadAllocatedMemoryEnabled(); + // AOT Subsystem + public native boolean endAOTRecording(); + // Class Loading Subsystem public int getLoadedClassCount() { long count = getTotalClassCount() - getUnloadedClassCount(); diff --git a/src/java.management/share/native/libmanagement/VMManagementImpl.c b/src/java.management/share/native/libmanagement/VMManagementImpl.c index d5141c71ee7..e6570d06bdd 100644 --- a/src/java.management/share/native/libmanagement/VMManagementImpl.c +++ b/src/java.management/share/native/libmanagement/VMManagementImpl.c @@ -101,6 +101,13 @@ Java_sun_management_VMManagementImpl_getVmArguments0 return JVM_GetVmArguments(env); } +JNIEXPORT jboolean JNICALL +Java_sun_management_VMManagementImpl_endAOTRecording + (JNIEnv *env, jobject dummy) +{ + return JVM_AOTEndRecording(env); +} + JNIEXPORT jlong JNICALL Java_sun_management_VMManagementImpl_getTotalClassCount (JNIEnv *env, jobject dummy) diff --git a/src/java.naming/share/classes/com/sun/jndi/ldap/DefaultResponseControlFactory.java b/src/java.naming/share/classes/com/sun/jndi/ldap/DefaultResponseControlFactory.java index 534aa95a916..1f82b4d9da6 100644 --- a/src/java.naming/share/classes/com/sun/jndi/ldap/DefaultResponseControlFactory.java +++ b/src/java.naming/share/classes/com/sun/jndi/ldap/DefaultResponseControlFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2003, 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 diff --git a/src/java.naming/share/classes/javax/naming/ldap/PagedResultsControl.java b/src/java.naming/share/classes/javax/naming/ldap/PagedResultsControl.java index 83391ba9c74..8e993f7ce74 100644 --- a/src/java.naming/share/classes/javax/naming/ldap/PagedResultsControl.java +++ b/src/java.naming/share/classes/javax/naming/ldap/PagedResultsControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 diff --git a/src/java.net.http/share/classes/java/net/http/HttpClient.java b/src/java.net.http/share/classes/java/net/http/HttpClient.java index a7a2171857d..9ecb048342b 100644 --- a/src/java.net.http/share/classes/java/net/http/HttpClient.java +++ b/src/java.net.http/share/classes/java/net/http/HttpClient.java @@ -312,10 +312,22 @@ public abstract class HttpClient implements AutoCloseable { * need to be established, for example if a connection can be reused * from a previous request, then this timeout duration has no effect. * + * @implSpec + * A connection timeout applies to the entire connection phase, from the + * moment a connection is requested until it is established. + * Implementations are recommended to ensure that the connection timeout + * covers any SSL/TLS handshakes. + * + * @implNote + * The built-in JDK implementation of the connection timeout covers any + * SSL/TLS handshakes. + * * @param duration the duration to allow the underlying connection to be * established * @return this builder * @throws IllegalArgumentException if the duration is non-positive + * @see HttpRequest.Builder#timeout(Duration) Configuring timeout for + * request execution */ public Builder connectTimeout(Duration duration); diff --git a/src/java.net.http/share/classes/java/net/http/HttpRequest.java b/src/java.net.http/share/classes/java/net/http/HttpRequest.java index c56328ba4b4..741573e06b3 100644 --- a/src/java.net.http/share/classes/java/net/http/HttpRequest.java +++ b/src/java.net.http/share/classes/java/net/http/HttpRequest.java @@ -258,12 +258,28 @@ public abstract class HttpRequest { * {@link HttpClient#sendAsync(java.net.http.HttpRequest, * java.net.http.HttpResponse.BodyHandler) HttpClient::sendAsync} * completes exceptionally with an {@code HttpTimeoutException}. The effect - * of not setting a timeout is the same as setting an infinite Duration, - * i.e. block forever. + * of not setting a timeout is the same as setting an infinite + * {@code Duration}, i.e., block forever. + * + * @implSpec + * A timeout applies to the duration measured from the instant the + * request execution starts to, at least, the instant an + * {@link HttpResponse} is constructed. The elapsed time includes + * obtaining a connection for transport and retrieving the response + * headers. + * + * @implNote + * The JDK built-in implementation applies timeout over the duration + * measured from the instant the request execution starts to the + * instant the response body is consumed, if present. This is + * implemented by stopping the timer after the response body subscriber + * completion. * * @param duration the timeout duration * @return this builder * @throws IllegalArgumentException if the duration is non-positive + * @see HttpClient.Builder#connectTimeout(Duration) Configuring + * timeout for connection establishment */ public abstract Builder timeout(Duration duration); diff --git a/src/java.net.http/share/classes/java/net/http/WebSocket.java b/src/java.net.http/share/classes/java/net/http/WebSocket.java index 313847cf449..84fc8472eef 100644 --- a/src/java.net.http/share/classes/java/net/http/WebSocket.java +++ b/src/java.net.http/share/classes/java/net/http/WebSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -144,6 +144,16 @@ public interface WebSocket { * {@link HttpTimeoutException}. If this method is not invoked then the * infinite timeout is assumed. * + * @implSpec + * A connection timeout applies to the entire connection phase, from the + * moment a connection is requested until it is established. + * Implementations are recommended to ensure that the connection timeout + * covers any WebSocket and SSL/TLS handshakes. + * + * @implNote + * The built-in JDK implementation of the connection timeout covers any + * WebSocket and SSL/TLS handshakes. + * * @param timeout * the timeout, non-{@linkplain Duration#isNegative() negative}, * non-{@linkplain Duration#ZERO ZERO} diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/ExchangeImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/ExchangeImpl.java index 74600e78557..c1ed01ff07a 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/ExchangeImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/ExchangeImpl.java @@ -581,6 +581,18 @@ abstract class ExchangeImpl { // Needed for HTTP/2 to subscribe a dummy subscriber and close the stream } + /** + * {@return {@code true}, if it is allowed to cancel the request timer on + * response body subscriber termination; {@code false}, otherwise} + * + * @param webSocket indicates if the associated request is a WebSocket handshake + * @param statusCode the status code of the associated response + */ + static boolean cancelTimerOnResponseBodySubscriberTermination( + boolean webSocket, int statusCode) { + return webSocket || statusCode < 100 || statusCode >= 200; + } + /* The following methods have separate HTTP/1.1 and HTTP/2 implementations */ abstract CompletableFuture> sendHeadersAsync(); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java index 02ce63b6314..72a47eca42c 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Exchange.java @@ -206,8 +206,15 @@ class Http1Exchange extends ExchangeImpl { */ static final class Http1ResponseBodySubscriber extends HttpBodySubscriberWrapper { final Http1Exchange exchange; - Http1ResponseBodySubscriber(BodySubscriber userSubscriber, Http1Exchange exchange) { + + private final boolean cancelTimerOnTermination; + + Http1ResponseBodySubscriber( + BodySubscriber userSubscriber, + boolean cancelTimerOnTermination, + Http1Exchange exchange) { super(userSubscriber); + this.cancelTimerOnTermination = cancelTimerOnTermination; this.exchange = exchange; } @@ -220,6 +227,14 @@ class Http1Exchange extends ExchangeImpl { protected void unregister() { exchange.unregisterResponseSubscriber(this); } + + @Override + protected void onTermination() { + if (cancelTimerOnTermination) { + exchange.exchange.multi.cancelTimer(); + } + } + } @Override @@ -459,9 +474,10 @@ class Http1Exchange extends ExchangeImpl { @Override Http1ResponseBodySubscriber createResponseSubscriber(BodyHandler handler, ResponseInfo response) { BodySubscriber subscriber = handler.apply(response); - Http1ResponseBodySubscriber bs = - new Http1ResponseBodySubscriber(subscriber, this); - return bs; + var cancelTimerOnTermination = + cancelTimerOnResponseBodySubscriberTermination( + exchange.request().isWebSocket(), response.statusCode()); + return new Http1ResponseBodySubscriber<>(subscriber, cancelTimerOnTermination, this); } @Override diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java index f9442df9ac4..35ce4972ed9 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java @@ -30,6 +30,7 @@ import java.lang.System.Logger.Level; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.net.http.HttpResponse.BodySubscriber; +import java.net.ProtocolException; import java.nio.ByteBuffer; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -46,6 +47,7 @@ import jdk.internal.net.http.common.MinimalFuture; import jdk.internal.net.http.common.Utils; import static java.net.http.HttpClient.Version.HTTP_1_1; import static java.net.http.HttpResponse.BodySubscribers.discarding; +import static jdk.internal.net.http.common.Utils.readContentLength; import static jdk.internal.net.http.common.Utils.wrapWithExtraDetail; import static jdk.internal.net.http.RedirectFilter.HTTP_NOT_MODIFIED; @@ -272,16 +274,31 @@ class Http1Response { } /** - * Read up to MAX_IGNORE bytes discarding + * Reads the body, if it is present and less than {@value MAX_IGNORE} bytes. + * Otherwise, just the connection is closed. */ public CompletableFuture ignoreBody(Executor executor) { - int clen = (int)headers.firstValueAsLong("Content-Length").orElse(-1); - if (clen == -1 || clen > MAX_IGNORE) { + + // Read the `Content-Length` header + long clen; + try { + clen = readContentLength(headers, "", -1); + } catch (ProtocolException pe) { + return MinimalFuture.failedFuture(pe); + } + + // Read the body, if it is present and less than `MAX_IGNORE` bytes. + // + // We proceed with reading the body even when `Content-Length: 0` to + // ensure that the happy path is taken, and upon success, the connection + // is returned back to the pool. + if (clen != -1 && clen <= MAX_IGNORE) { + return readBody(discarding(), !request.isWebSocket(), executor); + } else { connection.close(); return MinimalFuture.completedFuture(null); // not treating as error - } else { - return readBody(discarding(), !request.isWebSocket(), executor); } + } // Used for those response codes that have no body associated @@ -308,11 +325,28 @@ class Http1Response { this.return2Cache = return2Cache; final BodySubscriber subscriber = p; - final CompletableFuture cf = new MinimalFuture<>(); - long clen0 = headers.firstValueAsLong("Content-Length").orElse(-1L); - final long clen = fixupContentLen(clen0); + Consumer errorNotifier = error -> { + try { + subscriber.onError(error); + cf.completeExceptionally(error); + } finally { + asyncReceiver.setRetryOnError(false); + asyncReceiver.onReadError(error); + } + }; + + // Read the content length + long clen; + try { + long clen0 = readContentLength(headers, "", -1); + clen = fixupContentLen(clen0); + } catch (ProtocolException pe) { + errorNotifier.accept(pe); + connection.close(pe); + return cf; + } // expect-continue reads headers and body twice. // if we reach here, we must reset the headersReader state. @@ -398,12 +432,7 @@ class Http1Response { } }); - ResponseSubscribers.getBodyAsync(executor, p, cf, (t) -> { - subscriber.onError(t); - cf.completeExceptionally(t); - asyncReceiver.setRetryOnError(false); - asyncReceiver.onReadError(t); - }); + ResponseSubscribers.getBodyAsync(executor, p, cf, errorNotifier); return cf.whenComplete((s,t) -> { if (t != null) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java index 41a4a84958a..4625968682f 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java @@ -81,6 +81,8 @@ import jdk.internal.net.http.qpack.writers.HeaderFrameWriter; import jdk.internal.net.http.quic.streams.QuicBidiStream; import jdk.internal.net.http.quic.streams.QuicStreamReader; import jdk.internal.net.http.quic.streams.QuicStreamWriter; + +import static jdk.internal.net.http.common.Utils.readContentLength; import static jdk.internal.net.http.http3.ConnectionSettings.UNLIMITED_MAX_FIELD_SECTION_SIZE; /** @@ -554,8 +556,12 @@ final class Http3ExchangeImpl extends Http3Stream { } final class Http3StreamResponseSubscriber extends HttpBodySubscriberWrapper { - Http3StreamResponseSubscriber(BodySubscriber subscriber) { + + private final boolean cancelTimerOnTermination; + + Http3StreamResponseSubscriber(BodySubscriber subscriber, boolean cancelTimerOnTermination) { super(subscriber); + this.cancelTimerOnTermination = cancelTimerOnTermination; } @Override @@ -568,6 +574,13 @@ final class Http3ExchangeImpl extends Http3Stream { registerResponseSubscriber(this); } + @Override + protected void onTermination() { + if (cancelTimerOnTermination) { + exchange.multi.cancelTimer(); + } + } + @Override protected void logComplete(Throwable error) { if (error == null) { @@ -590,9 +603,10 @@ final class Http3ExchangeImpl extends Http3Stream { Http3StreamResponseSubscriber createResponseSubscriber(BodyHandler handler, ResponseInfo response) { if (debug.on()) debug.log("Creating body subscriber"); - Http3StreamResponseSubscriber subscriber = - new Http3StreamResponseSubscriber<>(handler.apply(response)); - return subscriber; + var cancelTimerOnTermination = + cancelTimerOnResponseBodySubscriberTermination( + exchange.request().isWebSocket(), response.statusCode()); + return new Http3StreamResponseSubscriber<>(handler.apply(response), cancelTimerOnTermination); } @Override @@ -1281,12 +1295,16 @@ final class Http3ExchangeImpl extends Http3Stream { if (Set.of("PUT", "DELETE", "OPTIONS", "TRACE").contains(method)) { throw new ProtocolException("push method not allowed pushId=" + pushId); } - long clen = promiseHeaders.firstValueAsLong("Content-Length").orElse(-1); + + // Read & validate `Content-Length` + long clen = readContentLength( + promiseHeaders, "illegal push headers for pushId=%s: ".formatted(pushId), -1); if (clen > 0) { - throw new ProtocolException("push headers contain non-zero Content-Length for pushId=" + pushId); + throw new ProtocolException("push headers contain non-zero \"Content-Length\" for pushId=" + pushId); } + if (promiseHeaders.firstValue("Transfer-Encoding").isPresent()) { - throw new ProtocolException("push headers contain Transfer-Encoding for pushId=" + pushId); + throw new ProtocolException("push headers contain \"Transfer-Encoding\" for pushId=" + pushId); } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http3Stream.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http3Stream.java index cdac68b47f1..14e440a0e33 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http3Stream.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http3Stream.java @@ -31,7 +31,6 @@ import java.net.ProtocolException; import java.net.http.HttpHeaders; import java.nio.ByteBuffer; import java.util.List; -import java.util.OptionalLong; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicInteger; @@ -58,6 +57,8 @@ import jdk.internal.net.http.quic.streams.QuicStreamReader; import static jdk.internal.net.http.Exchange.MAX_NON_FINAL_RESPONSES; import static jdk.internal.net.http.RedirectFilter.HTTP_NOT_MODIFIED; +import static jdk.internal.net.http.common.Utils.readContentLength; +import static jdk.internal.net.http.common.Utils.readStatusCode; /** * A common super class for the HTTP/3 request/response stream ({@link Http3ExchangeImpl} @@ -606,23 +607,17 @@ sealed abstract class Http3Stream extends ExchangeImpl permits Http3Exchan } int responseCode; - boolean finalResponse = false; try { - responseCode = (int) responseHeaders - .firstValueAsLong(":status") - .orElseThrow(() -> new IOException("no statuscode in response")); - } catch (IOException | NumberFormatException exception) { + responseCode = readStatusCode(responseHeaders, ""); + } catch (ProtocolException pe) { // RFC-9114: 4.1.2. Malformed Requests and Responses: // "Malformed requests or responses that are // detected MUST be treated as a stream error of type H3_MESSAGE_ERROR" - cancelImpl(exception, Http3Error.H3_MESSAGE_ERROR); - return; - } - if (responseCode < 100 || responseCode > 999) { - cancelImpl(new IOException("Unexpected :status header value"), Http3Error.H3_MESSAGE_ERROR); + cancelImpl(pe, Http3Error.H3_MESSAGE_ERROR); return; } + boolean finalResponse = false; if (responseCode >= 200) { responseState = ResponseState.PERMIT_TRAILER; finalResponse = true; @@ -653,23 +648,21 @@ sealed abstract class Http3Stream extends ExchangeImpl permits Http3Exchan responseHeaders); } - try { - OptionalLong cl = responseHeaders.firstValueAsLong("content-length"); - if (finalResponse && cl.isPresent()) { - long cll = cl.getAsLong(); - if (cll < 0) { - cancelImpl(new IOException("Invalid content-length value "+cll), Http3Error.H3_MESSAGE_ERROR); - return; - } - if (!(exchange.request().method().equalsIgnoreCase("HEAD") || responseCode == HTTP_NOT_MODIFIED)) { - // HEAD response and 304 response might have a content-length header, - // but it carries no meaning - contentLength = cll; - } + if (finalResponse) { + long cl; + try { + cl = readContentLength(responseHeaders, "", -1); + } catch (ProtocolException pe) { + cancelImpl(pe, Http3Error.H3_MESSAGE_ERROR); + return; + } + if (cl != -1 && + !(exchange.request().method().equalsIgnoreCase("HEAD") || + responseCode == HTTP_NOT_MODIFIED)) { + // HEAD response and 304 response might have a content-length header, + // but it carries no meaning + contentLength = cl; } - } catch (NumberFormatException nfe) { - cancelImpl(nfe, Http3Error.H3_MESSAGE_ERROR); - return; } if (Log.headers() || debug.on()) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java index d02930f4f31..ff130e90358 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java @@ -1880,6 +1880,13 @@ final class HttpClientImpl extends HttpClient implements Trackable { } } + // Visible for tests + List timers() { + synchronized (this) { + return new ArrayList<>(timeouts); + } + } + /** * Purges ( handles ) timer events that have passed their deadline, and * returns the amount of time, in milliseconds, until the next earliest diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java index ec621f7f955..671874b8fb5 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java @@ -25,12 +25,14 @@ package jdk.internal.net.http; -import java.io.IOError; import java.io.IOException; import java.lang.ref.WeakReference; import java.net.ConnectException; +import java.net.ProtocolException; +import java.net.ProtocolException; import java.net.http.HttpClient.Version; import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpHeaders; import java.net.http.StreamLimitException; import java.time.Duration; import java.util.List; @@ -48,7 +50,6 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.net.http.HttpClient; -import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodySubscriber; @@ -63,6 +64,7 @@ import jdk.internal.net.http.common.Utils; import static jdk.internal.net.http.common.MinimalFuture.completedFuture; import static jdk.internal.net.http.common.MinimalFuture.failedFuture; import static jdk.internal.net.http.AltSvcProcessor.processAltSvcHeader; +import static jdk.internal.net.http.common.Utils.readContentLength; /** @@ -254,7 +256,7 @@ class MultiExchange implements Cancelable { .map(ConnectTimeoutTracker::getRemaining); } - private void cancelTimer() { + void cancelTimer() { if (responseTimerEvent != null) { client.cancelTimer(responseTimerEvent); responseTimerEvent = null; @@ -359,13 +361,22 @@ class MultiExchange implements Cancelable { return r.statusCode == 204; } - private boolean bodyIsPresent(Response r) { - HttpHeaders headers = r.headers(); - if (headers.firstValueAsLong("Content-length").orElse(0L) != 0L) - return true; - if (headers.firstValue("Transfer-encoding").isPresent()) - return true; - return false; + private void ensureNoBody(HttpHeaders headers) throws ProtocolException { + + // Check `Content-Length` + var contentLength = readContentLength(headers, "", 0); + if (contentLength > 0) { + throw new ProtocolException( + "Unexpected \"Content-Length\" header in a 204 response: " + contentLength); + } + + // Check `Transfer-Encoding` + var transferEncoding = headers.firstValue("Transfer-Encoding"); + if (transferEncoding.isPresent()) { + throw new ProtocolException( + "Unexpected \"Transfer-Encoding\" header in a 204 response: " + transferEncoding.get()); + } + } // Call the user's body handler to get an empty body object @@ -404,13 +415,15 @@ class MultiExchange implements Cancelable { processAltSvcHeader(r, client(), currentreq); Exchange exch = getExchange(); if (bodyNotPermitted(r)) { - if (bodyIsPresent(r)) { - IOException ioe = new IOException( - "unexpected content length header with 204 response"); - exch.cancel(ioe); - return MinimalFuture.failedFuture(ioe); - } else - return handleNoBody(r, exch); + // No response body consumption is expected, we can cancel the timer right away + cancelTimer(); + try { + ensureNoBody(r.headers); + } catch (ProtocolException pe) { + exch.cancel(pe); + return MinimalFuture.failedFuture(pe); + } + return handleNoBody(r, exch); } return exch.readBodyAsync(responseHandler) .thenApply((T body) -> setNewResponse(r.request, r, body, exch)); @@ -467,6 +480,8 @@ class MultiExchange implements Cancelable { private CompletableFuture responseAsyncImpl(final boolean applyReqFilters) { if (currentreq.timeout().isPresent()) { + // Retried/Forwarded requests should reset the timer, if present + cancelTimer(); responseTimerEvent = ResponseTimerEvent.of(this); client.registerTimer(responseTimerEvent); } @@ -502,7 +517,6 @@ class MultiExchange implements Cancelable { } return completedFuture(response); } else { - cancelTimer(); setNewResponse(currentreq, response, null, exch); if (currentreq.isWebSocket()) { // need to close the connection and open a new one. @@ -520,11 +534,18 @@ class MultiExchange implements Cancelable { } }) .handle((response, ex) -> { // 5. handle errors and cancel any timer set - cancelTimer(); if (ex == null) { assert response != null; return completedFuture(response); } + + // Cancel the timer. Note that we only do so if the + // response has completed exceptionally. That is, we don't + // cancel the timer if there are no exceptions, since the + // response body might still get consumed, and it is + // still subject to the response timer. + cancelTimer(); + // all exceptions thrown are handled here final RetryContext retryCtx = checkRetryEligible(ex, exch); assert retryCtx != null : "retry context is null"; diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java index 9a7ccd8f3a1..9826b280438 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java @@ -61,6 +61,7 @@ import jdk.internal.net.http.hpack.DecodingCallback; import static jdk.internal.net.http.AltSvcProcessor.processAltSvcFrame; import static jdk.internal.net.http.Exchange.MAX_NON_FINAL_RESPONSES; +import static jdk.internal.net.http.common.Utils.readStatusCode; /** * Http/2 Stream handling. @@ -390,9 +391,10 @@ class Stream extends ExchangeImpl { @Override Http2StreamResponseSubscriber createResponseSubscriber(BodyHandler handler, ResponseInfo response) { - Http2StreamResponseSubscriber subscriber = - new Http2StreamResponseSubscriber<>(handler.apply(response)); - return subscriber; + var cancelTimerOnTermination = + cancelTimerOnResponseBodySubscriberTermination( + exchange.request().isWebSocket(), response.statusCode()); + return new Http2StreamResponseSubscriber<>(handler.apply(response), cancelTimerOnTermination); } // The Http2StreamResponseSubscriber is registered with the HttpClient @@ -614,18 +616,14 @@ class Stream extends ExchangeImpl { return null; } - protected void handleResponse(HeaderFrame hf) throws IOException { + protected void handleResponse(HeaderFrame hf) { HttpHeaders responseHeaders = responseHeadersBuilder.build(); if (!finalResponseCodeReceived) { try { - responseCode = (int) responseHeaders - .firstValueAsLong(":status") - .orElseThrow(() -> new ProtocolException(String.format( - "Stream %s PROTOCOL_ERROR: no status code in response", - streamid))); - } catch (ProtocolException cause) { - cancelImpl(cause, ResetFrame.PROTOCOL_ERROR); + responseCode = readStatusCode(responseHeaders, "Stream %s PROTOCOL_ERROR: ".formatted(streamid)); + } catch (ProtocolException pe) { + cancelImpl(pe, ResetFrame.PROTOCOL_ERROR); rspHeadersConsumer.reset(); return; } @@ -1694,6 +1692,11 @@ class Stream extends ExchangeImpl { .whenComplete((v, t) -> pushGroup.pushError(t)); } + @Override + Http2StreamResponseSubscriber createResponseSubscriber(BodyHandler handler, ResponseInfo response) { + return new Http2StreamResponseSubscriber(handler.apply(response), false); + } + @Override void completeResponse(Response r) { Log.logResponse(r::toString); @@ -1724,21 +1727,18 @@ class Stream extends ExchangeImpl { HttpHeaders responseHeaders = responseHeadersBuilder.build(); if (!finalPushResponseCodeReceived) { - responseCode = (int)responseHeaders - .firstValueAsLong(":status") - .orElse(-1); - - if (responseCode == -1) { - cancelImpl(new ProtocolException("No status code"), ResetFrame.PROTOCOL_ERROR); + try { + responseCode = readStatusCode(responseHeaders, ""); + if (responseCode >= 100 && responseCode < 200) { + String protocolErrorMsg = checkInterimResponseCountExceeded(); + if (protocolErrorMsg != null) { + throw new ProtocolException(protocolErrorMsg); + } + } + } catch (ProtocolException pe) { + cancelImpl(pe, ResetFrame.PROTOCOL_ERROR); rspHeadersConsumer.reset(); return; - } else if (responseCode >= 100 && responseCode < 200) { - String protocolErrorMsg = checkInterimResponseCountExceeded(); - if (protocolErrorMsg != null) { - cancelImpl(new ProtocolException(protocolErrorMsg), ResetFrame.PROTOCOL_ERROR); - rspHeadersConsumer.reset(); - return; - } } this.finalPushResponseCodeReceived = true; @@ -1924,8 +1924,12 @@ class Stream extends ExchangeImpl { } final class Http2StreamResponseSubscriber extends HttpBodySubscriberWrapper { - Http2StreamResponseSubscriber(BodySubscriber subscriber) { + + private final boolean cancelTimerOnTermination; + + Http2StreamResponseSubscriber(BodySubscriber subscriber, boolean cancelTimerOnTermination) { super(subscriber); + this.cancelTimerOnTermination = cancelTimerOnTermination; } @Override @@ -1938,6 +1942,13 @@ class Stream extends ExchangeImpl { unregisterResponseSubscriber(this); } + @Override + protected void onTermination() { + if (cancelTimerOnTermination) { + exchange.multi.cancelTimer(); + } + } + } private static final VarHandle DEREGISTERED; diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java index 1c483ce99f4..f1c1f6f2d2a 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/HttpBodySubscriberWrapper.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 @@ -33,7 +33,6 @@ import java.util.Objects; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import java.util.concurrent.Flow.Subscription; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.ReentrantLock; @@ -51,7 +50,6 @@ public class HttpBodySubscriberWrapper implements TrustedSubscriber { public static final Comparator> COMPARE_BY_ID = Comparator.comparing(HttpBodySubscriberWrapper::id); - public static final Flow.Subscription NOP = new Flow.Subscription() { @Override public void request(long n) { } @@ -75,7 +73,18 @@ public class HttpBodySubscriberWrapper implements TrustedSubscriber { this.userSubscriber = userSubscriber; } - private class SubscriptionWrapper implements Subscription { + /** + * A callback to be invoked before termination, whether due to the + * completion or failure of the subscriber, or cancellation of the + * subscription. To be precise, this method is called before + * {@link #onComplete()}, {@link #onError(Throwable) onError()}, or + * {@link #onCancel()}. + */ + protected void onTermination() { + // Do nothing + } + + private final class SubscriptionWrapper implements Subscription { final Subscription subscription; SubscriptionWrapper(Subscription s) { this.subscription = Objects.requireNonNull(s); @@ -92,6 +101,7 @@ public class HttpBodySubscriberWrapper implements TrustedSubscriber { subscription.cancel(); } finally { if (markCancelled()) { + onTermination(); onCancel(); } } @@ -284,6 +294,7 @@ public class HttpBodySubscriberWrapper implements TrustedSubscriber { */ public final void complete(Throwable t) { if (markCompleted()) { + onTermination(); logComplete(t); tryUnregister(); t = withError = Utils.getCompletionCause(t); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java index 20b0338215c..e5ea07c3b97 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java @@ -39,6 +39,7 @@ import java.lang.System.Logger.Level; import java.net.ConnectException; import java.net.Inet6Address; import java.net.InetSocketAddress; +import java.net.ProtocolException; import java.net.SocketAddress; import java.net.StandardSocketOptions; import java.net.Proxy; @@ -1354,6 +1355,47 @@ public final class Utils { } // -- toAsciiString-like support to encode path and query URI segments + public static int readStatusCode(HttpHeaders headers, String errorPrefix) throws ProtocolException { + var s = headers.firstValue(":status").orElse(null); + if (s == null) { + throw new ProtocolException(errorPrefix + "missing status code"); + } + Throwable t = null; + int i = 0; + try { + i = Integer.parseInt(s); + } catch (NumberFormatException nfe) { + t = nfe; + } + if (t != null || i < 100 || i > 999) { + var pe = new ProtocolException(errorPrefix + "invalid status code: " + s); + pe.initCause(t); + throw pe; + } + return i; + } + + public static long readContentLength(HttpHeaders headers, String errorPrefix, long defaultIfMissing) throws ProtocolException { + var k = "Content-Length"; + var s = headers.firstValue(k).orElse(null); + if (s == null) { + return defaultIfMissing; + } + Throwable t = null; + long i = 0; + try { + i = Long.parseLong(s); + } catch (NumberFormatException nfe) { + t = nfe; + } + if (t != null || i < 0) { + var pe = new ProtocolException("%sinvalid \"%s\": %s".formatted(errorPrefix, k, s)); + pe.initCause(t); + throw pe; + } + return i; + } + // Encodes all characters >= \u0080 into escaped, normalized UTF-8 octets, // assuming that s is otherwise legal // diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/quic/ConnectionTerminatorImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/quic/ConnectionTerminatorImpl.java index 7870f4f1d8e..5e2384dce27 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/quic/ConnectionTerminatorImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/quic/ConnectionTerminatorImpl.java @@ -344,10 +344,6 @@ final class ConnectionTerminatorImpl implements ConnectionTerminator { } } failHandshakeCFs(); - // remap the connection to a draining connection - final QuicEndpoint endpoint = this.connection.endpoint(); - assert endpoint != null : "QUIC endpoint is null"; - endpoint.draining(connection); discardConnectionState(); connection.streams.terminate(terminationCause); if (Log.quic()) { @@ -439,7 +435,7 @@ final class ConnectionTerminatorImpl implements ConnectionTerminator { final ProtectionRecord protectionRecord = ProtectionRecord.single(packet, connection::allocateDatagramForEncryption); // while sending the packet containing the CONNECTION_CLOSE frame, the pushDatagram will - // remap (or remove) the QuicConnectionImpl in QuicEndpoint. + // remap the QuicConnectionImpl in QuicEndpoint. connection.pushDatagram(protectionRecord); } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/quic/PeerConnIdManager.java b/src/java.net.http/share/classes/jdk/internal/net/http/quic/PeerConnIdManager.java index 065d045b57c..2bc759a920a 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/quic/PeerConnIdManager.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/quic/PeerConnIdManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 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,6 +28,7 @@ import java.nio.ByteBuffer; import java.util.ArrayDeque; import java.util.Collections; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.NavigableMap; import java.util.NavigableSet; @@ -276,6 +277,28 @@ final class PeerConnIdManager { } } + /** + * {@return the list of stateless reset tokens associated with active peer connection IDs} + */ + public List activeResetTokens() { + lock.lock(); + try { + // we only support one active connection ID at the time + PeerConnectionId cid = peerConnectionIds.get(activeConnIdSeq); + byte[] statelessResetToken = null; + if (cid != null) { + statelessResetToken = cid.getStatelessResetToken(); + } + if (statelessResetToken != null) { + return List.of(statelessResetToken); + } else { + return List.of(); + } + } finally { + lock.unlock(); + } + } + /** * {@return the active peer connection ID} */ diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicConnectionImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicConnectionImpl.java index 240f90852bc..edb94d5929a 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicConnectionImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicConnectionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2025, 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 @@ -174,17 +174,29 @@ public class QuicConnectionImpl extends QuicConnection implements QuicPacketRece public static final int SMALLEST_MAXIMUM_DATAGRAM_SIZE = QuicClient.SMALLEST_MAXIMUM_DATAGRAM_SIZE; + // The default value for the Quic maxInitialTimeout, in seconds. Will be clamped to [1, Integer.MAX_vALUE] public static final int DEFAULT_MAX_INITIAL_TIMEOUT = Math.clamp( Utils.getIntegerProperty("jdk.httpclient.quic.maxInitialTimeout", 30), 1, Integer.MAX_VALUE); + // The default value for the initial_max_data transport parameter that a QuicConnectionImpl + // will send to its peer, if no value is provided by the higher level protocol. public static final long DEFAULT_INITIAL_MAX_DATA = Math.clamp( Utils.getLongProperty("jdk.httpclient.quic.maxInitialData", 15 << 20), 0, 1L << 60); + // The default value for the initial_max_stream_data_bidi_local, initial_max_stream_data_bidi_remote, + // and initial_max_stream_data_uni transport parameters that a QuicConnectionImpl + // will send to its peer, if no value is provided by the higher level protocol. public static final long DEFAULT_INITIAL_STREAM_MAX_DATA = Math.clamp( Utils.getIntegerProperty("jdk.httpclient.quic.maxStreamInitialData", 6 << 20), 0, 1L << 60); + // The default value for the initial_max_streams_bidi transport parameter that a QuicConnectionImpl + // will send to its peer, if no value is provided by the higher level protocol. + // The Http3ClientImpl typically provides a value of 0, so this property has no effect + // on QuicConnectionImpl instances created on behalf of the HTTP/3 client public static final int DEFAULT_MAX_BIDI_STREAMS = - Utils.getIntegerProperty("jdk.httpclient.quic.maxBidiStreams", 100); + Utils.getIntegerProperty("jdk.internal.httpclient.quic.maxBidiStreams", 100); + // The default value for the initial_max_streams_uni transport parameter that a QuicConnectionImpl + // will send to its peer, if no value is provided by the higher level protocol. public static final int DEFAULT_MAX_UNI_STREAMS = Utils.getIntegerProperty("jdk.httpclient.quic.maxUniStreams", 100); public static final boolean USE_DIRECT_BUFFER_POOL = Utils.getBooleanProperty( @@ -1234,7 +1246,7 @@ public class QuicConnectionImpl extends QuicConnection implements QuicPacketRece final PacketSpace space = packetSpace(PacketNumberSpace.APPLICATION); final int maxDatagramSize = getMaxDatagramSize(); final QuicConnectionId peerConnectionId = peerConnectionId(); - final int dstIdLength = peerConnectionId().length(); + final int dstIdLength = peerConnectionId.length(); if (!canSend()) { return false; } @@ -1735,6 +1747,11 @@ public class QuicConnectionImpl extends QuicConnection implements QuicPacketRece return localConnIdManager.connectionIds(); } + @Override + public List activeResetTokens() { + return peerConnIdManager.activeResetTokens(); + } + LocalConnIdManager localConnectionIdManager() { return localConnIdManager; } @@ -2441,7 +2458,7 @@ public class QuicConnectionImpl extends QuicConnection implements QuicPacketRece } return; } - final QuicConnectionId currentPeerConnId = this.peerConnIdManager.getPeerConnId(); + final QuicConnectionId currentPeerConnId = peerConnectionId(); if (rt.sourceId().equals(currentPeerConnId)) { if (debug.on()) { debug.log("Invalid retry, same connection ID"); @@ -2799,7 +2816,7 @@ public class QuicConnectionImpl extends QuicConnection implements QuicPacketRece // a CONNECTION_CLOSE frame is being sent to the peer when the local // connection state is in DRAINING. This implies that the local endpoint // is responding to an incoming CONNECTION_CLOSE frame from the peer. - // we remove the connection from the endpoint for such cases. + // we switch this connection to one that does not respond to incoming packets. endpoint.pushClosedDatagram(this, peerAddress(), datagram); } else if (stateHandle.isMarked(QuicConnectionState.CLOSING)) { // a CONNECTION_CLOSE frame is being sent to the peer when the local diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicEndpoint.java b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicEndpoint.java index b1de5ef4bfd..ef342d4cb56 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicEndpoint.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2025, 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 @@ -1509,7 +1509,8 @@ public abstract sealed class QuicEndpoint implements AutoCloseable /** * Called to schedule sending of a datagram that contains a single {@code ConnectionCloseFrame} * sent in response to a {@code ConnectionClose} frame. - * This will completely remove the connection from the connection map. + * This will replace the {@link QuicConnectionImpl} with a {@link DrainingConnection} that + * will discard all incoming packets. * @param connection the connection being closed * @param destination the peer address * @param datagram the datagram @@ -1518,7 +1519,7 @@ public abstract sealed class QuicEndpoint implements AutoCloseable InetSocketAddress destination, ByteBuffer datagram) { if (debug.on()) debug.log("Pushing closed datagram for " + connection.logTag()); - removeConnection(connection); + draining(connection); pushDatagram(connection, destination, datagram); } @@ -1571,44 +1572,41 @@ public abstract sealed class QuicEndpoint implements AutoCloseable private void dropPeerIssuedResetTokensFor(QuicPacketReceiver connection) { // remove references to this connection from the map which holds the peer issued // reset tokens - peerIssuedResetTokens.values().removeIf(conn -> connection == conn); + connection.activeResetTokens().forEach(this::forgetStatelessResetToken); } - // remap peer issued stateless token from connection `from` to connection `to` - private void remapPeerIssuedResetToken(QuicPacketReceiver from, QuicPacketReceiver to) { - assert from != null; - assert to != null; - peerIssuedResetTokens.replaceAll((tok, c) -> c == from ? to : c); + // remap peer issued stateless tokens to connection `newReceiver` + private void remapPeerIssuedResetToken(QuicPacketReceiver newReceiver) { + assert newReceiver != null; + newReceiver.activeResetTokens().forEach(resetToken -> + associateStatelessResetToken(resetToken, newReceiver)); } - public void draining(final QuicPacketReceiver connection) { + public void draining(final QuicConnectionImpl connection) { // remap the connection to a DrainingConnection if (closed) return; + + final long idleTimeout = connection.peerPtoMs() * 3; // 3 PTO + connection.localConnectionIdManager().close(); + DrainingConnection draining = new DrainingConnection(connection.connectionIds(), + connection.activeResetTokens(), idleTimeout); + // we can ignore stateless reset in the draining state. + remapPeerIssuedResetToken(draining); + connection.connectionIds().forEach((id) -> - connections.compute(id, this::remapDraining)); + connections.compute(id, (i, r) -> remapDraining(i, r, draining))); + draining.startTimer(); assert !connections.containsValue(connection) : connection; } - private DrainingConnection remapDraining(QuicConnectionId id, QuicPacketReceiver conn) { + private DrainingConnection remapDraining(QuicConnectionId id, QuicPacketReceiver conn, DrainingConnection draining) { if (closed) return null; var debugOn = debug.on() && !Thread.currentThread().isVirtual(); - if (conn instanceof ClosingConnection closing) { + if (conn instanceof QuicConnectionImpl || conn instanceof ClosingConnection) { if (debugOn) debug.log("remapping %s to DrainingConnection", id); - final var draining = closing.toDraining(); - remapPeerIssuedResetToken(closing, draining); - draining.startTimer(); - return draining; - } else if (conn instanceof DrainingConnection draining) { - return draining; - } else if (conn instanceof QuicConnectionImpl impl) { - final long idleTimeout = impl.peerPtoMs() * 3; // 3 PTO - impl.localConnectionIdManager().close(); - if (debugOn) debug.log("remapping %s to DrainingConnection", id); - var draining = new DrainingConnection(conn.connectionIds(), idleTimeout); - // we can ignore stateless reset in the draining state. - remapPeerIssuedResetToken(impl, draining); - draining.startTimer(); return draining; + } else if (conn instanceof DrainingConnection d) { + return d; } else if (conn == null) { // connection absent (was probably removed), don't remap to draining if (debugOn) { @@ -1623,30 +1621,33 @@ public abstract sealed class QuicEndpoint implements AutoCloseable protected void closing(QuicConnectionImpl connection, ByteBuffer datagram) { if (closed) return; - ByteBuffer closing = ByteBuffer.allocate(datagram.limit()); - closing.put(datagram.slice()); - closing.flip(); + ByteBuffer closingDatagram = ByteBuffer.allocate(datagram.limit()); + closingDatagram.put(datagram.slice()); + closingDatagram.flip(); + + final long idleTimeout = connection.peerPtoMs() * 3; // 3 PTO + connection.localConnectionIdManager().close(); + var closingConnection = new ClosingConnection(connection.connectionIds(), + connection.activeResetTokens(), idleTimeout, datagram); + remapPeerIssuedResetToken(closingConnection); + connection.connectionIds().forEach((id) -> - connections.compute(id, (i, r) -> remapClosing(i, r, closing))); + connections.compute(id, (i, r) -> remapClosing(i, r, closingConnection))); + closingConnection.startTimer(); assert !connections.containsValue(connection) : connection; } - private ClosedConnection remapClosing(QuicConnectionId id, QuicPacketReceiver conn, ByteBuffer datagram) { + private ClosedConnection remapClosing(QuicConnectionId id, QuicPacketReceiver conn, ClosingConnection closingConnection) { if (closed) return null; var debugOn = debug.on() && !Thread.currentThread().isVirtual(); - if (conn instanceof ClosingConnection closing) { + if (conn instanceof QuicConnectionImpl) { + if (debugOn) debug.log("remapping %s to ClosingConnection", id); + return closingConnection; + } else if (conn instanceof ClosingConnection closing) { // we already have a closing datagram, drop the new one return closing; } else if (conn instanceof DrainingConnection draining) { return draining; - } else if (conn instanceof QuicConnectionImpl impl) { - final long idleTimeout = impl.peerPtoMs() * 3; // 3 PTO - impl.localConnectionIdManager().close(); - if (debugOn) debug.log("remapping %s to ClosingConnection", id); - var closing = new ClosingConnection(conn.connectionIds(), idleTimeout, datagram); - remapPeerIssuedResetToken(impl, closing); - closing.startTimer(); - return closing; } else if (conn == null) { // connection absent (was probably removed), don't remap to closing if (debugOn) { @@ -1746,6 +1747,7 @@ public abstract sealed class QuicEndpoint implements AutoCloseable // an instance of this class) final static long NO_IDLE_TIMEOUT = 2000; final List localConnectionIds; + private final List activeResetTokens; final long maxIdleTimeMs; final long id; int more = 1; @@ -1753,7 +1755,8 @@ public abstract sealed class QuicEndpoint implements AutoCloseable volatile Deadline deadline; volatile Deadline updatedDeadline; - ClosedConnection(List localConnectionIds, long maxIdleTimeMs) { + ClosedConnection(List localConnectionIds, List activeResetTokens, long maxIdleTimeMs) { + this.activeResetTokens = activeResetTokens; this.id = QuicTimerQueue.newEventId(); this.maxIdleTimeMs = maxIdleTimeMs == 0 ? NO_IDLE_TIMEOUT : maxIdleTimeMs; this.deadline = Deadline.MAX; @@ -1766,6 +1769,11 @@ public abstract sealed class QuicEndpoint implements AutoCloseable return localConnectionIds; } + @Override + public List activeResetTokens() { + return activeResetTokens; + } + @Override public final void processIncoming(SocketAddress source, ByteBuffer destConnId, HeadersType headersType, ByteBuffer buffer) { Deadline updated = updatedDeadline; @@ -1869,9 +1877,9 @@ public abstract sealed class QuicEndpoint implements AutoCloseable final ByteBuffer closePacket; - ClosingConnection(List localConnIdManager, long maxIdleTimeMs, + ClosingConnection(List localConnectionIds, List activeResetTokens, long maxIdleTimeMs, ByteBuffer closePacket) { - super(localConnIdManager, maxIdleTimeMs); + super(localConnectionIds, activeResetTokens, maxIdleTimeMs); this.closePacket = Objects.requireNonNull(closePacket); } @@ -1896,10 +1904,6 @@ public abstract sealed class QuicEndpoint implements AutoCloseable debug.log("ClosingConnection(%s): dropping %s packet", localConnectionIds, headersType); } } - - private DrainingConnection toDraining() { - return new DrainingConnection(localConnectionIds, maxIdleTimeMs); - } } /** @@ -1908,8 +1912,8 @@ public abstract sealed class QuicEndpoint implements AutoCloseable */ final class DrainingConnection extends ClosedConnection { - DrainingConnection(List localConnIdManager, long maxIdleTimeMs) { - super(localConnIdManager, maxIdleTimeMs); + DrainingConnection(List localConnectionIds, List activeResetTokens, long maxIdleTimeMs) { + super(localConnectionIds, activeResetTokens, maxIdleTimeMs); } @Override diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicPacketReceiver.java b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicPacketReceiver.java index 6652b44de3a..72f622731f3 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicPacketReceiver.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicPacketReceiver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, 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 @@ -51,6 +51,11 @@ public interface QuicPacketReceiver { */ List connectionIds(); + /** + * {@return a list of active peer stateless reset tokens for this connection) + */ + List activeResetTokens(); + /** * {@return the initial connection id assigned by the peer} * On the client side, this is always {@link Optional#empty()}. diff --git a/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java b/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java index ab6664b9d8f..a4475c8bd1e 100644 --- a/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java +++ b/src/java.rmi/share/classes/javax/rmi/ssl/SslRMIClientSocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ import java.net.Socket; import java.rmi.server.RMIClientSocketFactory; import java.util.StringTokenizer; import javax.net.SocketFactory; +import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; @@ -119,6 +120,16 @@ public class SslRMIClientSocketFactory // final SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(host, port); + + if (Boolean.parseBoolean( + System.getProperty("jdk.rmi.ssl.client.enableEndpointIdentification", "true"))) { + SSLParameters params = sslSocket.getSSLParameters(); + if (params == null) { + params = new SSLParameters(); + } + params.setEndpointIdentificationAlgorithm("HTTPS"); + sslSocket.setSSLParameters(params); + } // Set the SSLSocket Enabled Cipher Suites // final String enabledCipherSuites = diff --git a/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java b/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java index 7853d47c0d7..33bda82c15c 100644 --- a/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java +++ b/src/java.rmi/share/classes/sun/rmi/log/LogInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java index 7aaa8975185..3fba1dc4460 100644 --- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.java +++ b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5InitCredential.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 diff --git a/src/java.security.jgss/windows/man/kinit.md b/src/java.security.jgss/windows/man/kinit.md index 130bf7b007a..a32d6634e74 100644 --- a/src/java.security.jgss/windows/man/kinit.md +++ b/src/java.security.jgss/windows/man/kinit.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2005, 2024, 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 @@ -79,34 +79,34 @@ will compromise your password. You can specify one of the following commands. After the command, specify the options for it. -`-A` +[`-A`]{#option-A} : Doesn't include addresses. -`-f` +[`-f`]{#option-f} : Issues a forwardable ticket. -`-p` +[`-p`]{#option-p} : Issues a proxiable ticket. -`-c` *cache\_name* +[`-c`]{#option-c} *cache\_name* : The cache name (for example, `FILE:D:\temp\mykrb5cc`). -`-l` *lifetime* +[`-l`]{#option-l} *lifetime* : Sets the lifetime of a ticket. The value can be one of "h:m[:s]", "NdNhNmNs", and "N". See the [MIT krb5 Time Duration definition]( http://web.mit.edu/kerberos/krb5-1.17/doc/basic/date_format.html#duration) for more information. -`-r` *renewable\_time* +[`-r`]{#option-r} *renewable\_time* : Sets the total lifetime that a ticket can be renewed. -`-R` +[`-R`]{#option-R} : Renews a ticket. -`-k` +[`-k`]{#option-k} : Uses keytab -`-t` *keytab\_filename* +[`-t`]{#option-t} *keytab\_filename* : The keytab name (for example, `D:\winnt\profiles\duke\krb5.keytab`). *principal* diff --git a/src/java.security.jgss/windows/man/klist.md b/src/java.security.jgss/windows/man/klist.md index 67c84e65dec..c4874f7dc67 100644 --- a/src/java.security.jgss/windows/man/klist.md +++ b/src/java.security.jgss/windows/man/klist.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2005, 2024, 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 @@ -45,7 +45,7 @@ the contents of the credentials cache or keytab using the `klist` tool. The ## Commands -`-c` +[`-c`]{#option-c} : Specifies that the credential cache is to be listed. The following are the options for credential cache entries: @@ -62,7 +62,7 @@ the contents of the credentials cache or keytab using the `klist` tool. The `-n` : If the `-a` option is specified, don't reverse resolve addresses. -`-k` +[`-k`]{#option-k} : Specifies that key tab is to be listed. List the keytab entries. The following are the options for keytab entries: diff --git a/src/java.security.jgss/windows/man/ktab.md b/src/java.security.jgss/windows/man/ktab.md index d6817ab81cf..36e09d56e3e 100644 --- a/src/java.security.jgss/windows/man/ktab.md +++ b/src/java.security.jgss/windows/man/ktab.md @@ -1,5 +1,5 @@ --- -# Copyright (c) 2005, 2024, 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 @@ -72,12 +72,12 @@ send a keytab file over a network in the clear. ## Commands and Options -`-l` \[`-e`\] \[`-t`\] +[`-l`]{#command-l} \[`-e`\] \[`-t`\] : Lists the keytab name and entries. When `-e` is specified, the encryption type for each entry is displayed. When `-t` is specified, the timestamp for each entry is displayed. -`-a` *principal\_name* \[*password*\] \[`-n` *kvno*\] \[`-s` *salt* \| `-f`\] \[`-append`\] +[`-a`]{#command-a} *principal\_name* \[*password*\] \[`-n` *kvno*\] \[`-s` *salt* \| `-f`\] \[`-append`\] : Adds new key entries to the keytab for the given principal name with an optional *password*. If a *kvno* is specified, new keys' Key Version Numbers equal to the value, otherwise, automatically incrementing the Key @@ -90,7 +90,7 @@ send a keytab file over a network in the clear. on the command line or in a script.** This tool will prompt for a password if it isn't specified. -`-d` *principal\_name* \[`-f`\] \[`-e` *etype*\] \[*kvno* \| `all`\| `old`\] +[`-d`]{#command-d} *principal\_name* \[`-f`\] \[`-e` *etype*\] \[*kvno* \| `all`\| `old`\] : Deletes key entries from the keytab for the specified principal. No changes are made to the Kerberos database. @@ -115,7 +115,7 @@ send a keytab file over a network in the clear. This option can be used with the `-l`, `-a` or `-d` commands. -`-k` *keytab name* +[`-k`]{#option-k} *keytab name* : Specifies the keytab name and path with the `FILE:` prefix. ## Examples diff --git a/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java b/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java index c3d4cdcc54b..6a6c1bb3ce3 100644 --- a/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java +++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.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 @@ -24,6 +24,7 @@ */ package com.sun.security.sasl; +import java.io.Serial; import java.security.NoSuchAlgorithmException; import java.security.InvalidParameterException; import java.security.ProviderException; @@ -45,6 +46,7 @@ import static sun.security.util.SecurityConstants.PROVIDER_VER; public final class Provider extends java.security.Provider { + @Serial private static final long serialVersionUID = 8622598936488630849L; private static final String info = "Sun SASL provider" + diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/AuthenticationException.java b/src/java.security.sasl/share/classes/javax/security/sasl/AuthenticationException.java index b61981bc16f..c9c3a274c44 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/AuthenticationException.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/AuthenticationException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ package javax.security.sasl; +import java.io.Serial; + /** * This exception is thrown by a SASL mechanism implementation * to indicate that the SASL @@ -79,5 +81,6 @@ public class AuthenticationException extends SaslException { } /** Use serialVersionUID from JSR 28 RI for interoperability */ + @Serial private static final long serialVersionUID = -3579708765071815007L; } diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/AuthorizeCallback.java b/src/java.security.sasl/share/classes/javax/security/sasl/AuthorizeCallback.java index e0f323d36c9..a254159229b 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/AuthorizeCallback.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/AuthorizeCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, 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 @@ -25,6 +25,8 @@ package javax.security.sasl; +import java.io.Serial; + import javax.security.auth.callback.Callback; /** @@ -141,5 +143,6 @@ public class AuthorizeCallback implements Callback, java.io.Serializable { authorizedID = id; } + @Serial private static final long serialVersionUID = -2353344186490470805L; } diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/RealmCallback.java b/src/java.security.sasl/share/classes/javax/security/sasl/RealmCallback.java index af14158aa77..4d87b4da9d9 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/RealmCallback.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/RealmCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, 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 @@ -25,6 +25,8 @@ package javax.security.sasl; +import java.io.Serial; + import javax.security.auth.callback.TextInputCallback; /** @@ -63,5 +65,6 @@ public class RealmCallback extends TextInputCallback { super(prompt, defaultRealmInfo); } + @Serial private static final long serialVersionUID = -4342673378785456908L; } diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/RealmChoiceCallback.java b/src/java.security.sasl/share/classes/javax/security/sasl/RealmChoiceCallback.java index 61d9c0edd35..6a782268fb6 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/RealmChoiceCallback.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/RealmChoiceCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, 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 @@ -25,6 +25,8 @@ package javax.security.sasl; +import java.io.Serial; + import javax.security.auth.callback.ChoiceCallback; /** @@ -58,5 +60,6 @@ public class RealmChoiceCallback extends ChoiceCallback { super(prompt, choices, defaultChoice, multiple); } + @Serial private static final long serialVersionUID = -8588141348846281332L; } diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/SaslException.java b/src/java.security.sasl/share/classes/javax/security/sasl/SaslException.java index 0398d8d7277..4d07eb18d36 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/SaslException.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/SaslException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 @@ -26,6 +26,7 @@ package javax.security.sasl; import java.io.IOException; +import java.io.Serial; /** * This class represents an error that has occurred when using SASL. @@ -125,5 +126,6 @@ public class SaslException extends IOException { } /** Use serialVersionUID from JSR 28 RI for interoperability */ + @Serial private static final long serialVersionUID = 4579784287983423626L; } diff --git a/src/java.sql/share/classes/java/sql/Statement.java b/src/java.sql/share/classes/java/sql/Statement.java index 4da510f6749..3570e8734a6 100644 --- a/src/java.sql/share/classes/java/sql/Statement.java +++ b/src/java.sql/share/classes/java/sql/Statement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ICONST.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ICONST.java index b3eb14a9ddf..bfec96e1af7 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ICONST.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ICONST.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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java index 13ca0a84cfa..7c210773d33 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC.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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java index 9b94a1dcf2d..881a3f2ebea 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/ReferenceType.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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java index bcdb0f59f5c..906bbb88252 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java index 8555d69597b..d5a1b0edb35 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java index c5ae6af08c0..12799a16b8b 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java index c16620ec7b1..d3216907d2f 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java @@ -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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java index 48f7d63f353..dd5c24af4bf 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java @@ -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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java index 0affded17e3..a7bb6933e9d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java @@ -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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java index c93e05d74e4..4f7894780b4 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java @@ -1,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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java index 941c1c38c00..8d154bda1c6 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java @@ -1,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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java index 55484c2b10c..40dbeda7fcd 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java @@ -1,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. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties index 654a313f6c9..6d1d65731f2 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties @@ -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. # # # Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java index 2e2c30909ad..b297e229501 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/RegularExpression.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff --git a/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp b/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp index 62546b4dd78..fdd7ff524da 100644 --- a/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp +++ b/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, 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 @@ -226,9 +226,9 @@ int modify(bool enable) { printf("Couldn't create file: %s\n", path); perror("Error"); } else { - char str[100] = "assistive_technologies=com.sun.java.accessibility.AccessBridge\n"; - strcat_s(str, "screen_magnifier_present=true\n"); - fprintf(origFile, str); + fprintf(origFile, "%s", + "assistive_technologies=com.sun.java.accessibility.AccessBridge\n" + "screen_magnifier_present=true\n"); fclose(origFile); } } else { @@ -314,11 +314,11 @@ void printVersion() { pVSInfo->dwProductVersionMS & 0xFFFF, pVSInfo->dwProductVersionLS >> 16, pVSInfo->dwProductVersionLS & 0xFFFF ); - char outputString[100]; - strcpy_s(outputString, "jabswitch "); - strcat_s(outputString, versionString); - strcat_s(outputString, "\njabswitch enables or disables the Java Access Bridge.\n"); - printf(outputString); + printf( + "jabswitch %s\n" + "jabswitch enables or disables the Java Access Bridge.\n", + versionString + ); } int regEnable() { diff --git a/src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp b/src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp index b9cd8434fc7..256f123c83a 100644 --- a/src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp +++ b/src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp @@ -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 @@ -97,8 +97,7 @@ void logString(FILE *logfile, const char *msg, ...) { va_start(argprt, msg); vsnprintf(tmpbuf, sizeof(tmpbuf), msg, argprt); - fprintf(logfile, tmpbuf); - fprintf(logfile, "\n"); + fprintf(logfile, "%s\n", tmpbuf); fflush(logfile); } diff --git a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java index af8870ecf64..4a1cd3aba78 100644 --- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.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 @@ -26,11 +26,13 @@ package sun.tools.attach; import com.sun.tools.attach.AgentLoadException; import com.sun.tools.attach.AttachNotSupportedException; +import com.sun.tools.attach.AttachOperationFailedException; import com.sun.tools.attach.spi.AttachProvider; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -41,6 +43,9 @@ import java.util.regex.Pattern; import static java.nio.charset.StandardCharsets.UTF_8; +import sun.jvmstat.monitor.MonitoredHost; +import sun.jvmstat.monitor.MonitorException; + /* * Linux implementation of HotSpotVirtualMachine */ @@ -228,7 +233,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { // Return the socket file for the given process. private File findSocketFile(long pid, long ns_pid) throws AttachNotSupportedException, IOException { - return new File(findTargetProcessTmpDirectory(pid, ns_pid), ".java_pid" + ns_pid); + return new File(findTargetProcessTmpDirectory(pid), ".java_pid" + ns_pid); } // On Linux a simple handshake is used to start the attach mechanism @@ -243,39 +248,68 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { // Do not canonicalize the file path, or we will fail to attach to a VM in a container. f.createNewFile(); } catch (IOException _) { - f = new File(findTargetProcessTmpDirectory(pid, ns_pid), fn.toString()); + f = new File(findTargetProcessTmpDirectory(pid), fn.toString()); f.createNewFile(); } return f; } - private String findTargetProcessTmpDirectory(long pid, long ns_pid) throws AttachNotSupportedException, IOException { - final var procPidRoot = PROC.resolve(Long.toString(pid)).resolve(ROOT_TMP); + private String findTargetProcessTmpDirectory(long pid) throws IOException { + final var tmpOnProcPidRoot = PROC.resolve(Long.toString(pid)).resolve(ROOT_TMP); /* We need to handle at least 4 different cases: - * 1. Caller and target processes share PID namespace and root filesystem (host to host or container to - * container with both /tmp mounted between containers). - * 2. Caller and target processes share PID namespace and root filesystem but the target process has elevated - * privileges (host to host). - * 3. Caller and target processes share PID namespace but NOT root filesystem (container to container). - * 4. Caller and target processes share neither PID namespace nor root filesystem (host to container) + * 1. Caller and target processes share PID namespace and root + * filesystem (host to host or container to container with both /tmp + * mounted between containers). + * 2. Caller and target processes share PID namespace and root + * filesystem but the target process has elevated privileges + * (host to host). + * 3. Caller and target processes share PID namespace but NOT root + * filesystem (container to container). + * 4. Caller and target processes share neither PID namespace nor root + * filesystem (host to container) * - * if target is elevated, we cant use /proc//... so we have to fallback to /tmp, but that may not be shared - * with the target/attachee process, we can try, except in the case where the ns_pid also exists in this pid ns - * which is ambiguous, if we share /tmp with the intended target, the attach will succeed, if we do not, - * then we will potentially attempt to attach to some arbitrary process with the same pid (in this pid ns) - * as that of the intended target (in its * pid ns). - * - * so in that case we should prehaps throw - or risk sending SIGQUIT to some arbitrary process... which could kill it - * - * however we can also check the target pid's signal masks to see if it catches SIGQUIT and only do so if in - * fact it does ... this reduces the risk of killing an innocent process in the current ns as opposed to - * attaching to the actual target JVM ... c.f: checkCatchesAndSendQuitTo() below. - * - * note that if pid == ns_pid we are in a shared pid ns with the target and may (potentially) share /tmp + * if target is elevated, we cant use /proc//... so we have to + * fallback to /tmp, but that may not be shared with the target/attachee + * process, so we should check whether /tmp on both is same. This method + * would throw AttachOperationFailedException if they are different + * because we cannot make a connection with target VM. */ - return (Files.isWritable(procPidRoot) ? procPidRoot : TMPDIR).toString(); + try { + if (Files.isWritable(tmpOnProcPidRoot)) { + return tmpOnProcPidRoot.toString(); + } else if (Files.isSameFile(tmpOnProcPidRoot, TMPDIR)) { + return TMPDIR.toString(); + } else { + throw new AttachOperationFailedException("Unable to access the filesystem of the target process"); + } + } catch (IOException ioe) { + try { + boolean found = MonitoredHost.getMonitoredHost("//localhost") + .activeVms() + .stream() + .anyMatch(i -> pid == i.intValue()); + if (found) { + // We can use /tmp because target process is on same host + // even if we cannot access /proc//root. + // The process with capsh/setcap would fall this pattern. + return TMPDIR.toString(); + } + // Throw original IOE if target process not found on localhost. + throw ioe; + } catch (URISyntaxException e) { + // URISyntaxException is defined as a checked exception at + // MonitoredHost.getMonitoredHost() if the URI string poorly + // formed. However "//localhost" is hard-coded at here, so the + // exception should not happen. + throw new AssertionError("Unexpected exception", e); + } catch (MonitorException e) { + // Other exceptions (happened at MonitoredHost) would be wrapped + // with AttachOperationFailedException. + throw new AttachOperationFailedException("Unable to find target proces", e); + } + } } // Return the inner most namespaced PID if there is one, diff --git a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java index 5c786db1366..a7a348affe3 100644 --- a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java @@ -28,9 +28,13 @@ import com.sun.tools.attach.AgentLoadException; import com.sun.tools.attach.AttachNotSupportedException; import com.sun.tools.attach.spi.AttachProvider; +import sun.jvmstat.PlatformSupport; + import java.io.InputStream; import java.io.IOException; import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; import static java.nio.charset.StandardCharsets.UTF_8; @@ -39,14 +43,17 @@ import static java.nio.charset.StandardCharsets.UTF_8; */ @SuppressWarnings("restricted") public class VirtualMachineImpl extends HotSpotVirtualMachine { - // "tmpdir" is used as a global well-known location for the files - // .java_pid. and .attach_pid. It is important that this - // location is the same for all processes, otherwise the tools - // will not be able to find all Hotspot processes. - // This is intentionally not the same as java.io.tmpdir, since - // the latter can be changed by the user. - // Any changes to this needs to be synchronized with HotSpot. - private static final String tmpdir; + + /** + * HotSpot PerfData file prefix + */ + private static final String HSPERFDATA_PREFIX = "hsperfdata_"; + + /** + * Use platform specific methods for looking up temporary directories. + */ + private static final PlatformSupport platformSupport = PlatformSupport.getInstance(); + String socket_path; private OperationProperties props = new OperationProperties(VERSION_1); // updated in ctor @@ -67,10 +74,12 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { // Find the socket file. If not found then we attempt to start the // attach mechanism in the target VM by sending it a QUIT signal. // Then we attempt to find the socket file again. - File socket_file = new File(tmpdir, ".java_pid" + pid); + // In macOS the socket file is located in per-user temp directory. + String tempdir = getTempDirFromPid(pid); + File socket_file = new File(tempdir, ".java_pid" + pid); socket_path = socket_file.getPath(); if (!socket_file.exists()) { - File f = createAttachFile(pid); + File f = createAttachFile(tempdir, pid); try { checkCatchesAndSendQuitTo(pid, false); @@ -211,12 +220,34 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { } } - private File createAttachFile(int pid) throws IOException { + private File createAttachFile(String tmpdir, int pid) throws IOException { File f = new File(tmpdir, ".attach_pid" + pid); createAttachFile0(f.getPath()); return f; } + /* + * Returns a platform-specific temporary directory for a given process. + * In VMs running as unprivileged user it returns the default platform-specific + * temporary directory. In VMs running as root it searches over the list of + * temporary directories for one containing HotSpot PerfData directory. + */ + private String getTempDirFromPid(int pid) { + ProcessHandle ph = ProcessHandle.of(pid).orElse(null); + if (ph != null) { + String user = ph.info().user().orElse(null); + if (user != null) { + for (String dir : platformSupport.getTemporaryDirectories(pid)) { + Path fullPath = Path.of(dir, HSPERFDATA_PREFIX + user, String.valueOf(pid)); + if (Files.exists(fullPath)) { + return dir; + } + } + } + } + return PlatformSupport.getTemporaryDirectory(); + } + //-- native methods static native boolean checkCatchesAndSendQuitTo(int pid, boolean throwIfNotReady) throws IOException, AttachNotSupportedException; @@ -235,10 +266,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { static native void createAttachFile0(String path); - static native String getTempDir(); - static { System.loadLibrary("attach"); - tmpdir = getTempDir(); } } diff --git a/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c b/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c index d105d7d3b1b..5b2579eba39 100644 --- a/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c +++ b/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c @@ -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 @@ -335,27 +335,3 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_createAttachFile JNU_ReleaseStringPlatformChars(env, path, _path); } } - -/* - * Class: sun_tools_attach_BSDVirtualMachine - * Method: getTempDir - * Signature: (V)Ljava.lang.String; - */ -JNIEXPORT jstring JNICALL Java_sun_tools_attach_VirtualMachineImpl_getTempDir(JNIEnv *env, jclass cls) -{ - // This must be hard coded because it's the system's temporary - // directory not the java application's temp directory, ala java.io.tmpdir. - -#ifdef __APPLE__ - // macosx has a secure per-user temporary directory. - // Don't cache the result as this is only called once. - char path[PATH_MAX]; - int pathSize = confstr(_CS_DARWIN_USER_TEMP_DIR, path, PATH_MAX); - if (pathSize == 0 || pathSize > PATH_MAX) { - strlcpy(path, "/tmp", sizeof(path)); - } - return JNU_NewStringPlatform(env, path); -#else /* __APPLE__ */ - return (*env)->NewStringUTF(env, "/tmp"); -#endif /* __APPLE__ */ -} diff --git a/src/jdk.attach/share/classes/com/sun/tools/attach/AttachNotSupportedException.java b/src/jdk.attach/share/classes/com/sun/tools/attach/AttachNotSupportedException.java index 382c8a57b26..050c1030bf6 100644 --- a/src/jdk.attach/share/classes/com/sun/tools/attach/AttachNotSupportedException.java +++ b/src/jdk.attach/share/classes/com/sun/tools/attach/AttachNotSupportedException.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 diff --git a/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java b/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java index cbc4410907c..3f26c02c304 100644 --- a/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java +++ b/src/jdk.attach/share/classes/com/sun/tools/attach/AttachOperationFailedException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 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 @@ -50,4 +50,18 @@ public class AttachOperationFailedException extends IOException { public AttachOperationFailedException(String message) { super(message); } + + /** + * Constructs an AttachOperationFailedException with + * the specified cause. + * + * @param message the detail message. + * @param cause the cause of this exception. + * + * @since 27 + */ + public AttachOperationFailedException(String message, Throwable cause) { + super(message, cause); + } + } diff --git a/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP.java.template b/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP.java.template index f3d03a9e9c7..e4eb2feab9d 100644 --- a/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP.java.template +++ b/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_JP.java.template @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 diff --git a/src/jdk.compiler/share/classes/com/sun/source/tree/UsesTree.java b/src/jdk.compiler/share/classes/com/sun/source/tree/UsesTree.java index d14257de626..1878a868588 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/tree/UsesTree.java +++ b/src/jdk.compiler/share/classes/com/sun/source/tree/UsesTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, 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 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java index 65ce640ef76..bc597876778 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java @@ -91,6 +91,8 @@ public class JavacTaskImpl extends BasicJavacTask { @Override @DefinedBy(Api.COMPILER) public Boolean call() { + if (used.get()) + throw new IllegalStateException(); return doCall().isOK(); } @@ -207,7 +209,6 @@ public class JavacTaskImpl extends BasicJavacTask { // init JavaCompiler and queues compiler = JavaCompiler.instance(context); compiler.keepComments = true; - compiler.genEndPos = true; notYetEntered = new HashMap<>(); if (forParse) { compiler.initProcessAnnotations(processors, args.getFileObjects(), args.getClassNames()); @@ -245,6 +246,8 @@ public class JavacTaskImpl extends BasicJavacTask { @Override @DefinedBy(Api.COMPILER_TREE) public Iterable parse() { + if (used.get()) + throw new IllegalStateException(); Pair, Throwable> result = invocationHelper(this::parseInternal); if (result.snd == null) { return result.fst; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java index 22ee2393a02..6bc5d358b6f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java @@ -114,7 +114,6 @@ import com.sun.tools.javac.tree.DCTree.DCParam; import com.sun.tools.javac.tree.DCTree.DCReference; import com.sun.tools.javac.tree.DocCommentTable; import com.sun.tools.javac.tree.DocTreeMaker; -import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCBlock; import com.sun.tools.javac.tree.JCTree.JCCatch; @@ -240,8 +239,7 @@ public class JavacTrees extends DocTrees { @Override @DefinedBy(Api.COMPILER_TREE) public long getEndPosition(CompilationUnitTree file, Tree tree) { - EndPosTable endPosTable = ((JCCompilationUnit) file).endPositions; - return TreeInfo.getEndPos((JCTree) tree, endPosTable); + return TreeInfo.getEndPos((JCTree) tree); } @Override @DefinedBy(Api.COMPILER_TREE) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java index 3a8b4e5dbea..773c573c201 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java @@ -37,11 +37,7 @@ import java.util.Set; import java.util.stream.Stream; import com.sun.tools.javac.main.Option; -import com.sun.tools.javac.tree.JCTree.*; -import com.sun.tools.javac.util.Assert; import com.sun.tools.javac.util.Context; -import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; -import com.sun.tools.javac.util.JCDiagnostic.LintWarning; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Names; import com.sun.tools.javac.util.Options; @@ -178,6 +174,14 @@ public class Lint { /** * Categories of warnings that can be generated by the compiler. + * Each lint category has a logical name (a string), which is the string used e.g. in a {@code SuppressWarning} annotation. + * To ensure automation, the enum field name for a lint category string {@code C} should be obtained by: + *
    + *
  1. capitalize all the letters in {@code C}, and
  2. + *
  3. replacing any occurrence of {@code -} with {@code _}
  4. + *
+ * For instance, the lint category string {@code dangling-doc-comments} corresponds to the enum field + * {@code DANGLING_DOC_COMMENTS}. */ public enum LintCategory { /** @@ -320,7 +324,7 @@ public class Lint { /** * Warn about unchecked operations on raw types. */ - RAW("rawtypes"), + RAWTYPES("rawtypes"), /** * Warn about use of deprecated-for-removal items. diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintMapper.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintMapper.java index 06caa70d478..4f33bb92b41 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintMapper.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintMapper.java @@ -35,7 +35,6 @@ import java.util.function.Consumer; import javax.tools.JavaFileObject; -import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.*; import com.sun.tools.javac.tree.TreeInfo; @@ -134,9 +133,9 @@ public class LintMapper { * @param sourceFile source file * @param tree top-level declaration (class, package, or module) */ - public void calculateLints(JavaFileObject sourceFile, JCTree tree, EndPosTable endPositions) { + public void calculateLints(JavaFileObject sourceFile, JCTree tree) { Assert.check(rootLint != null); - fileInfoMap.get(sourceFile).afterAttr(tree, endPositions); + fileInfoMap.get(sourceFile).afterAttr(tree); } /** @@ -184,15 +183,15 @@ public class LintMapper { rootRange = new LintRange(rootLint); for (JCTree decl : tree.defs) { if (isTopLevelDecl(decl)) - unmappedDecls.add(new Span(decl, tree.endPositions)); + unmappedDecls.add(new Span(decl)); } } // After attribution: Discard the span from "unmappedDecls" and populate the declaration's subtree under "rootRange" - void afterAttr(JCTree tree, EndPosTable endPositions) { + void afterAttr(JCTree tree) { for (Iterator i = unmappedDecls.iterator(); i.hasNext(); ) { if (i.next().contains(tree.pos())) { - rootRange.populateSubtree(tree, endPositions); + rootRange.populateSubtree(tree); i.remove(); return; } @@ -225,8 +224,8 @@ public class LintMapper { static final Span MAXIMAL = new Span(Integer.MIN_VALUE, Integer.MAX_VALUE); - Span(JCTree tree, EndPosTable endPositions) { - this(TreeInfo.getStartPos(tree), TreeInfo.getEndPos(tree, endPositions)); + Span(JCTree tree) { + this(TreeInfo.getStartPos(tree), TreeInfo.getEndPos(tree)); } boolean contains(DiagnosticPosition pos) { @@ -256,8 +255,8 @@ public class LintMapper { } // Create a node representing the given declaration and its corresponding Lint configuration - LintRange(JCTree tree, EndPosTable endPositions, Lint lint) { - this(new Span(tree, endPositions), lint, new LinkedList<>()); + LintRange(JCTree tree, Lint lint) { + this(new Span(tree), lint, new LinkedList<>()); } // Find the most specific node in this tree (including me) that contains the given position, if any @@ -277,7 +276,7 @@ public class LintMapper { // Populate a sparse subtree corresponding to the given nested declaration. // Only when the Lint configuration differs from the parent is a node added. - void populateSubtree(JCTree tree, EndPosTable endPositions) { + void populateSubtree(JCTree tree) { new TreeScanner() { private LintRange currentNode = LintRange.this; @@ -320,7 +319,7 @@ public class LintMapper { // Add a new node here and proceed final LintRange previousNode = currentNode; - currentNode = new LintRange(tree, endPositions, newLint); + currentNode = new LintRange(tree, newLint); previousNode.children.add(currentNode); try { recursor.accept(tree); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java index d0cb45ebc09..84a823f785f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java @@ -158,6 +158,11 @@ public enum Source { * 26, tbd */ JDK26("26"), + + /** + * 27, tbd + */ + JDK27("27"), ; // Reduce code churn when appending new constants private static final Context.Key sourceKey = new Context.Key<>(); @@ -210,6 +215,7 @@ public enum Source { public Target requiredTarget() { return switch(this) { + case JDK27 -> Target.JDK1_27; case JDK26 -> Target.JDK1_26; case JDK25 -> Target.JDK1_25; case JDK24 -> Target.JDK1_24; @@ -366,6 +372,7 @@ public enum Source { case JDK24 -> RELEASE_24; case JDK25 -> RELEASE_25; case JDK26 -> RELEASE_26; + case JDK27 -> RELEASE_27; default -> null; }; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java index 6aae8eb855d..86319f20c73 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -1403,6 +1403,7 @@ public class TypeAnnotations { break; } } + scan(tree.dims); scan(tree.elems); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java index f5fdc1578b8..f865afe11fb 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, 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 @@ -1107,6 +1107,7 @@ public class Annotate { for (List dimAnnos : tree.dimAnnotations) enterTypeAnnotations(dimAnnos, env, sym, false); scan(tree.elemtype); + scan(tree.dims); scan(tree.elems); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index 3f72ada94e8..cdd88b22510 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -2762,8 +2762,7 @@ public class Attr extends JCTree.Visitor { clazzid1 = make.at(clazz.pos).Select(make.Type(encltype), ((JCIdent) clazzid).name); - EndPosTable endPosTable = this.env.toplevel.endPositions; - endPosTable.storeEnd(clazzid1, clazzid.getEndPosition(endPosTable)); + clazzid1.endpos = clazzid.getEndPosition(); if (clazz.hasTag(ANNOTATED_TYPE)) { JCAnnotatedType annoType = (JCAnnotatedType) clazz; List annos = annoType.annotations; @@ -4000,7 +3999,10 @@ public class Attr extends JCTree.Visitor { chk.checkCastable(tree.rhs.pos(), operator.type.getReturnType(), owntype); - chk.checkLossOfPrecision(tree.rhs.pos(), operand, owntype); + switch (tree.getTag()) { + case SL_ASG, SR_ASG, USR_ASG -> { } // we only use (at most) the lower 6 bits, so any integral type is OK + default -> chk.checkLossOfPrecision(tree.rhs.pos(), operand, owntype); + } chk.checkOutOfRangeShift(tree.rhs.pos(), operator, operand); } result = check(tree, owntype, KindSelector.VAL, resultInfo); @@ -4266,7 +4268,7 @@ public class Attr extends JCTree.Visitor { } List expectedRecordTypes; - if (site.tsym.kind == Kind.TYP && ((ClassSymbol) site.tsym).isRecord()) { + if (site.tsym instanceof ClassSymbol clazz && clazz.isRecord()) { ClassSymbol record = (ClassSymbol) site.tsym; expectedRecordTypes = record.getRecordComponents() .stream() @@ -5311,7 +5313,7 @@ public class Attr extends JCTree.Visitor { annotate.flush(); // Now that this tree is attributed, we can calculate the Lint configuration everywhere within it - lintMapper.calculateLints(env.toplevel.sourcefile, env.tree, env.toplevel.endPositions); + lintMapper.calculateLints(env.toplevel.sourcefile, env.tree); } public void attribPackage(DiagnosticPosition pos, PackageSymbol p) { @@ -5634,12 +5636,16 @@ public class Attr extends JCTree.Visitor { chk.validateRepeatable(c, repeatable, cbPos); } } else { - // Check that all extended classes and interfaces - // are compatible (i.e. no two define methods with same arguments - // yet different return types). (JLS 8.4.8.3) - chk.checkCompatibleSupertypes(tree.pos(), c.type); - chk.checkDefaultMethodClashes(tree.pos(), c.type); - chk.checkPotentiallyAmbiguousOverloads(tree, c.type); + try { + // Check that all extended classes and interfaces + // are compatible (i.e. no two define methods with same arguments + // yet different return types). (JLS 8.4.8.3) + chk.checkCompatibleSupertypes(tree.pos(), c.type); + chk.checkDefaultMethodClashes(tree.pos(), c.type); + chk.checkPotentiallyAmbiguousOverloads(tree, c.type); + } catch (CompletionFailure cf) { + chk.completionError(tree.pos(), cf); + } } // Check that class does not import the same parameterized interface diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ExhaustivenessComputer.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ExhaustivenessComputer.java index bbc330832f3..2a0bab1e330 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ExhaustivenessComputer.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ExhaustivenessComputer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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,11 +41,17 @@ import com.sun.tools.javac.code.Kinds.Kind; import com.sun.tools.javac.code.Type.TypeVar; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.SequencedSet; +import java.util.function.Consumer; import java.util.function.Predicate; import java.util.stream.Collectors; +import java.util.stream.Stream; import static java.util.stream.Collectors.groupingBy; +import static com.sun.tools.javac.code.Flags.RECORD; /** A class to compute exhaustiveness of set of switch cases. * @@ -55,6 +61,14 @@ import static java.util.stream.Collectors.groupingBy; * deletion without notice. */ public class ExhaustivenessComputer { + private static final long DEFAULT_MAX_BASE_CHECKS = 4_000_000; + + //when baseChecks is set to a value different that this, the checks + //will be counter, and if too many will happen, the process will be stopped + //when baseChecks is set to this value, there's no counting, and the + //process will not continue as long as needed + private static final long NO_BASE_CHECKS_COUNTING = -1; + protected static final Context.Key exhaustivenessKey = new Context.Key<>(); private final Symtab syms; @@ -62,6 +76,8 @@ public class ExhaustivenessComputer { private final Check chk; private final Infer infer; private final Map, Boolean> isSubtypeCache = new HashMap<>(); + private final long maxBaseChecks; + private long baseChecks = NO_BASE_CHECKS_COUNTING; public static ExhaustivenessComputer instance(Context context) { ExhaustivenessComputer instance = context.get(exhaustivenessKey); @@ -77,9 +93,22 @@ public class ExhaustivenessComputer { types = Types.instance(context); chk = Check.instance(context); infer = Infer.instance(context); + Options options = Options.instance(context); + String baseChecks = options.get("exhaustivityMaxBaseChecks"); + long computedMaxBaseChecks = DEFAULT_MAX_BASE_CHECKS; + + if (baseChecks != null) { + try { + computedMaxBaseChecks = Long.parseLong(baseChecks); + } catch (NumberFormatException _) { + //ignore invalid values and use the default maximum number of checks + } + } + + maxBaseChecks = computedMaxBaseChecks; } - public boolean exhausts(JCExpression selector, List cases) { + public ExhaustivenessResult exhausts(JCExpression selector, List cases) { Set patternSet = new HashSet<>(); Map> enum2Constants = new HashMap<>(); Set booleanLiterals = new HashSet<>(Set.of(0, 1)); @@ -113,7 +142,7 @@ public class ExhaustivenessComputer { } if (types.unboxedTypeOrType(selector.type).hasTag(TypeTag.BOOLEAN) && booleanLiterals.isEmpty()) { - return true; + return ExhaustivenessResult.ofExhaustive(); } for (Entry> e : enum2Constants.entrySet()) { @@ -121,47 +150,77 @@ public class ExhaustivenessComputer { patternSet.add(new BindingPattern(e.getKey().type)); } } - Set patterns = patternSet; - Set> seenFallback = new HashSet<>(); - boolean useHashes = true; try { - boolean repeat = true; - while (repeat) { - Set updatedPatterns; - updatedPatterns = reduceBindingPatterns(selector.type, patterns); - updatedPatterns = reduceNestedPatterns(updatedPatterns, useHashes); - updatedPatterns = reduceRecordPatterns(updatedPatterns); - updatedPatterns = removeCoveredRecordPatterns(updatedPatterns); - repeat = !updatedPatterns.equals(patterns); - if (checkCovered(selector.type, patterns)) { - return true; - } - if (!repeat) { - //there may be situation like: - //class B permits S1, S2 - //patterns: R(S1, B), R(S2, S2) - //this might be joined to R(B, S2), as B could be rewritten to S2 - //but hashing in reduceNestedPatterns will not allow that - //disable the use of hashing, and use subtyping in - //reduceNestedPatterns to handle situations like this: - repeat = useHashes && seenFallback.add(updatedPatterns); - useHashes = false; - } else { - //if a reduction happened, make sure hashing in reduceNestedPatterns - //is enabled, as the hashing speeds up the process significantly: - useHashes = true; - } - patterns = updatedPatterns; + CoverageResult coveredResult = computeCoverage(selector.type, patternSet, PatternEquivalence.STRICT); + if (coveredResult.covered()) { + return ExhaustivenessResult.ofExhaustive(); } - return checkCovered(selector.type, patterns); + + Set details = + this.computeMissingPatternDescriptions(selector.type, coveredResult.incompletePatterns()) + .stream() + .flatMap(pd -> { + if (pd instanceof BindingPattern bp && enum2Constants.containsKey(bp.type.tsym)) { + Symbol enumType = bp.type.tsym; + return enum2Constants.get(enumType).stream().map(c -> new EnumConstantPattern(bp.type, c.name)); + } else { + return Stream.of(pd); + } + }) + .collect(Collectors.toSet()); + + return ExhaustivenessResult.ofDetails(details); } catch (CompletionFailure cf) { chk.completionError(selector.pos(), cf); - return true; //error recovery - } finally { - isSubtypeCache.clear(); + return ExhaustivenessResult.ofExhaustive(); //error recovery } } + /* Given the set of patterns, runs the reductions of it as long as possible. + * If the (reduced) set of patterns covers the given selector type, returns + * covered == true, and incompletePatterns == null. + * If the (reduced) set of patterns does not cover the given selector type, + * returns covered == false, and incompletePatterns == the reduced set of patterns. + */ + private CoverageResult computeCoverage(Type selectorType, Set patterns, PatternEquivalence patternEquivalence) { + Set updatedPatterns; + Set> seenPatterns = new HashSet<>(); + boolean useHashes = true; + boolean repeat = true; + do { + updatedPatterns = reduceBindingPatterns(selectorType, patterns); + updatedPatterns = reduceNestedPatterns(updatedPatterns, useHashes, patternEquivalence); + updatedPatterns = reduceRecordPatterns(updatedPatterns); + updatedPatterns = removeCoveredRecordPatterns(updatedPatterns); + repeat = !updatedPatterns.equals(patterns); + if (checkCovered(selectorType, patterns)) { + return new CoverageResult(true, null); + } + if (!repeat) { + //there may be situation like: + //class B permits S1, S2 + //patterns: R(S1, B), R(S2, S2) + //this might be joined to R(B, S2), as B could be rewritten to S2 + //but hashing in reduceNestedPatterns will not allow that + //disable the use of hashing, and use subtyping in + //reduceNestedPatterns to handle situations like this: + repeat = useHashes && seenPatterns.add(updatedPatterns); + useHashes = false; + } else { + //if a reduction happened, make sure hashing in reduceNestedPatterns + //is enabled, as the hashing speeds up the process significantly: + useHashes = true; + } + patterns = updatedPatterns; + } while (repeat); + if (checkCovered(selectorType, patterns)) { + return new CoverageResult(true, null); + } + return new CoverageResult(false, patterns); + } + + private record CoverageResult(boolean covered, Set incompletePatterns) {} + private boolean checkCovered(Type seltype, Iterable patterns) { for (Type seltypeComponent : components(seltype)) { for (PatternDescription pd : patterns) { @@ -215,6 +274,7 @@ public class ExhaustivenessComputer { if (clazz.isSealed() && clazz.isAbstract() && //if a binding pattern for clazz already exists, no need to analyze it again: !existingBindings.contains(clazz)) { + ListBuffer bindings = new ListBuffer<>(); //do not reduce to types unrelated to the selector type: Type clazzType = clazz.type; if (components(selectorType).stream() @@ -222,16 +282,7 @@ public class ExhaustivenessComputer { continue; } - Set permitted = allPermittedSubTypes(clazz, csym -> { - Type instantiated; - if (csym.type.allparams().isEmpty()) { - instantiated = csym.type; - } else { - instantiated = infer.instantiatePatternType(selectorType, csym); - } - - return instantiated != null && types.isCastable(selectorType, instantiated); - }); + Set permitted = allPermittedSubTypes(clazz, isApplicableSubtypePredicate(selectorType)); //the set of pending permitted subtypes needed to cover clazz: Set pendingPermitted = new HashSet<>(permitted); @@ -263,7 +314,7 @@ public class ExhaustivenessComputer { } if (pendingPermitted.isEmpty()) { - toAdd.add(new BindingPattern(clazz.type)); + toAdd.add(new BindingPattern(clazz.type, Set.of())); } } } @@ -304,6 +355,49 @@ public class ExhaustivenessComputer { return permitted; } + private Predicate isApplicableSubtypePredicate(Type targetType) { + return csym -> { + Type instantiated = instantiatePatternType(targetType, csym); + + return instantiated != null && types.isCastable(targetType, instantiated); + }; + } + + private Type instantiatePatternType(Type targetType, TypeSymbol csym) { + if (csym.type.allparams().isEmpty()) { + return csym.type; + } else { + return infer.instantiatePatternType(targetType, csym); + } + } + + private Set leafPermittedSubTypes(TypeSymbol root, Predicate accept) { + Set permitted = new HashSet<>(); + List permittedSubtypesClosure = baseClasses(root); + + while (permittedSubtypesClosure.nonEmpty()) { + ClassSymbol current = permittedSubtypesClosure.head; + + permittedSubtypesClosure = permittedSubtypesClosure.tail; + + current.complete(); + + if (current.isSealed() && current.isAbstract()) { + for (Type t : current.getPermittedSubclasses()) { + ClassSymbol csym = (ClassSymbol) t.tsym; + + if (accept.test(csym)) { + permittedSubtypesClosure = permittedSubtypesClosure.prepend(csym); + } + } + } else { + permitted.add(current); + } + } + + return permitted; + } + private List baseClasses(TypeSymbol root) { if (root instanceof ClassSymbol clazz) { return List.of(clazz); @@ -336,7 +430,8 @@ public class ExhaustivenessComputer { * as pattern hashes cannot be used to speed up the matching process */ private Set reduceNestedPatterns(Set patterns, - boolean useHashes) { + boolean useHashes, + PatternEquivalence patternEquivalence) { /* implementation note: * finding a sub-set of patterns that only differ in a single * column is time-consuming task, so this method speeds it up by: @@ -386,13 +481,13 @@ public class ExhaustivenessComputer { RecordPattern rpOther = candidatesArr[nextCandidate]; if (rpOne.recordType.tsym == rpOther.recordType.tsym && - nestedComponentsEquivalent(rpOne, rpOther, mismatchingCandidate, useHashes)) { + nestedComponentsEquivalent(rpOne, rpOther, mismatchingCandidate, useHashes, patternEquivalence)) { join.append(rpOther); } } var nestedPatterns = join.stream().map(rp -> rp.nested[mismatchingCandidateFin]).collect(Collectors.toSet()); - var updatedPatterns = reduceNestedPatterns(nestedPatterns, useHashes); + var updatedPatterns = reduceNestedPatterns(nestedPatterns, useHashes, patternEquivalence); updatedPatterns = reduceRecordPatterns(updatedPatterns); updatedPatterns = removeCoveredRecordPatterns(updatedPatterns); @@ -403,16 +498,11 @@ public class ExhaustivenessComputer { current.removeAll(join); } - for (PatternDescription nested : updatedPatterns) { - PatternDescription[] newNested = - Arrays.copyOf(rpOne.nested, rpOne.nested.length); - newNested[mismatchingCandidateFin] = nested; - RecordPattern nue = new RecordPattern(rpOne.recordType(), - rpOne.fullComponentTypes(), - newNested, - new HashSet<>(join)); - current.add(nue); - } + generatePatternsWithReplacedNestedPattern(rpOne, + mismatchingCandidateFin, + updatedPatterns, + Set.copyOf(join), + current::add); } } } @@ -434,11 +524,32 @@ public class ExhaustivenessComputer { * - it's type is a supertype of the existing pattern's type * - it was produced by a reduction from a record pattern that is equivalent to * the existing pattern + * - only if PatternEquivalence is LOOSE and the type is the same of the type + * of an existing record pattern (the binding pattern may stand in place of + * a record pattern). This is only used to compute the missing patterns that + * would make the original pattern set exhaustive. + * + * For example, having (with mismatchingCandidate == 0): + * existing: R(A _, Box(var _)) {} + * cadidate: R(B _, Box(var _)) {} + * these are always equivalent; as all nested patterns except of + * component 0 are exactly equivalent + * + * existing: R(A _, SubtypeOfBox _) {} + * cadidate: R(A _, Box _) {} + * this is only equivalent when useHashes == false; Box _ could be replaced + * with a more specific SubtypeOfBox _ + * + * existing: R(A _, Box(var _)) {} + * cadidate: R(A _, Box _) {} + * this is only equivalent when useHashes == false and patternEquivalence == LOOSE; + * Box _ is accepted in place of the more specific record pattern */ private boolean nestedComponentsEquivalent(RecordPattern existing, RecordPattern candidate, int mismatchingCandidate, - boolean useHashes) { + boolean useHashes, + PatternEquivalence patternEquivalence) { NEXT_NESTED: for (int i = 0; i < existing.nested.length; i++) { if (i != mismatchingCandidate) { @@ -457,22 +568,28 @@ public class ExhaustivenessComputer { return false; } } else if (existing.nested[i] instanceof RecordPattern nestedExisting) { - java.util.List pendingReplacedPatterns = - new ArrayList<>(nestedCandidate.sourcePatterns()); + if (patternEquivalence == PatternEquivalence.LOOSE) { + if (!isSubtypeErasure(nestedExisting.recordType(), nestedCandidate.type)) { + return false; + } + } else { + java.util.List pendingReplacedPatterns = + new ArrayList<>(nestedCandidate.sourcePatterns()); - while (!pendingReplacedPatterns.isEmpty()) { - PatternDescription currentReplaced = pendingReplacedPatterns.removeLast(); + while (!pendingReplacedPatterns.isEmpty()) { + PatternDescription currentReplaced = pendingReplacedPatterns.removeLast(); - if (nestedExisting.equals(currentReplaced)) { - //candidate.nested[i] is substitutable for existing.nested[i] - //continue with the next nested pattern: - continue NEXT_NESTED; + if (nestedExisting.equals(currentReplaced)) { + //candidate.nested[i] is substitutable for existing.nested[i] + //continue with the next nested pattern: + continue NEXT_NESTED; + } + + pendingReplacedPatterns.addAll(currentReplaced.sourcePatterns()); } - pendingReplacedPatterns.addAll(currentReplaced.sourcePatterns()); + return false; } - - return false; } else { return false; } @@ -563,6 +680,8 @@ public class ExhaustivenessComputer { } private boolean isBpCovered(Type componentType, PatternDescription newNested) { + reportCheck(); + if (newNested instanceof BindingPattern bp) { Type seltype = types.erasure(componentType); Type pattype = types.erasure(bp.type); @@ -574,9 +693,18 @@ public class ExhaustivenessComputer { return false; } - sealed interface PatternDescription { + protected void reportCheck() { + if (baseChecks != NO_BASE_CHECKS_COUNTING && + ++baseChecks > maxBaseChecks) { + throw new TooManyChecksException(null); + } + } + + public sealed interface PatternDescription { + public Type type(); public Set sourcePatterns(); } + public PatternDescription makePatternDescription(Type selectorType, JCPattern pattern) { if (pattern instanceof JCBindingPattern binding) { Type type = !selectorType.isPrimitive() && types.isSubtype(selectorType, binding.type) @@ -586,9 +714,7 @@ public class ExhaustivenessComputer { Type[] componentTypes; if (!record.type.isErroneous()) { - componentTypes = ((ClassSymbol) record.type.tsym).getRecordComponents() - .map(r -> types.memberType(record.type, r)) - .toArray(s -> new Type[s]); + componentTypes = instantiatedComponentTypes(record.type); } else { componentTypes = record.nested.map(t -> types.createErrorType(t.type)).toArray(s -> new Type[s]);; @@ -611,7 +737,7 @@ public class ExhaustivenessComputer { throw Assert.error(); } } - record BindingPattern(Type type, Set sourcePatterns) implements PatternDescription { + public record BindingPattern(Type type, Set sourcePatterns) implements PatternDescription { public BindingPattern(Type type) { this(type, Set.of()); @@ -631,7 +757,7 @@ public class ExhaustivenessComputer { return type.tsym + " _"; } } - record RecordPattern(Type recordType, int _hashCode, Type[] fullComponentTypes, PatternDescription[] nested, Set sourcePatterns) implements PatternDescription { + public record RecordPattern(Type recordType, int _hashCode, Type[] fullComponentTypes, PatternDescription[] nested, Set sourcePatterns) implements PatternDescription { public RecordPattern(Type recordType, Type[] fullComponentTypes, PatternDescription[] nested) { this(recordType, fullComponentTypes, nested, Set.of()); @@ -673,5 +799,450 @@ public class ExhaustivenessComputer { .map(pd -> pd.toString()) .collect(Collectors.joining(", ")) + ")"; } + + @Override + public Type type() { + return recordType; + } + } + + public record EnumConstantPattern(Type enumType, Name enumConstant) implements PatternDescription { + + @Override + public Type type() { + return enumType(); + } + + @Override + public Set sourcePatterns() { + return Set.of(); + } + public String toString() { + return enumType() + "." + enumConstant(); + } + } + + public record ExhaustivenessResult(boolean exhaustive, Set notExhaustiveDetails) { + public static ExhaustivenessResult ofExhaustive() { + return new ExhaustivenessResult(true, null); + } + public static ExhaustivenessResult ofDetails(Set notExhaustiveDetails) { + return new ExhaustivenessResult(false, notExhaustiveDetails != null ? notExhaustiveDetails : Set.of()); + } + } + + //computation of missing patterns: + protected Set computeMissingPatternDescriptions(Type selectorType, + Set incompletePatterns) { + if (maxBaseChecks == 0) { + return Set.of(); + } + try { + baseChecks = 0; + PatternDescription defaultPattern = new BindingPattern(selectorType); + return expandMissingPatternDescriptions(selectorType, + selectorType, + defaultPattern, + incompletePatterns, + Set.of(defaultPattern)); + } catch (TooManyChecksException ex) { + return ex.missingPatterns != null ? ex.missingPatterns : Set.of(); + } finally { + baseChecks = NO_BASE_CHECKS_COUNTING; + } + } + + private Set expandMissingPatternDescriptions(Type selectorType, + Type targetType, + PatternDescription toExpand, + Set basePatterns, + Set inMissingPatterns) { + try { + return doExpandMissingPatternDescriptions(selectorType, targetType, + toExpand, basePatterns, + inMissingPatterns); + } catch (TooManyChecksException ex) { + if (ex.missingPatterns == null) { + ex = new TooManyChecksException(inMissingPatterns); + } + throw ex; + } + } + + private Set doExpandMissingPatternDescriptions(Type selectorType, + Type targetType, + PatternDescription toExpand, + Set basePatterns, + Set inMissingPatterns) { + if (toExpand instanceof BindingPattern bp) { + if (bp.type.tsym.isSealed()) { + //try to replace binding patterns for sealed types with all their immediate permitted applicable types: + List permitted = ((ClassSymbol) bp.type.tsym).getPermittedSubclasses(); + Set applicableDirectPermittedPatterns = + permitted.stream() + .map(type -> type.tsym) + .filter(isApplicableSubtypePredicate(targetType)) + .map(csym -> new BindingPattern(types.erasure(csym.type))) + .collect(Collectors.toCollection(LinkedHashSet::new)); + + //remove the permitted subtypes that are not needed to achieve exhaustivity + boolean reduced = + removeUnnecessaryPatterns(selectorType, bp, basePatterns, inMissingPatterns, applicableDirectPermittedPatterns); + + if (!reduced && !hasMatchingRecordPattern(basePatterns, inMissingPatterns, toExpand)) { + //if all immediate permitted subtypes are needed + //give up, and simply use the current pattern: + return inMissingPatterns; + } + + Set currentMissingPatterns = + replace(inMissingPatterns, toExpand, applicableDirectPermittedPatterns); + + //try to recursively expand on each viable pattern: + for (PatternDescription viable : applicableDirectPermittedPatterns) { + currentMissingPatterns = expandMissingPatternDescriptions(selectorType, targetType, + viable, basePatterns, + currentMissingPatterns); + } + + return currentMissingPatterns; + } else if ((bp.type.tsym.flags_field & Flags.RECORD) != 0 && + //only expand record types into record patterns if there's a chance it may change the outcome + //i.e. there is a record pattern in at the spot in the original base patterns: + hasMatchingRecordPattern(basePatterns, inMissingPatterns, toExpand)) { + //if there is a binding pattern at a place where the original based patterns + //have a record pattern, try to expand the binding pattern into a record pattern + //create all possible combinations of record pattern components: + Type[] componentTypes = instantiatedComponentTypes(bp.type); + List> combinatorialNestedTypes = List.of(List.nil()); + + for (Type componentType : componentTypes) { + List applicableLeafPermittedSubtypes; + + if (componentType.tsym.isSealed()) { + applicableLeafPermittedSubtypes = + leafPermittedSubTypes(componentType.tsym, + isApplicableSubtypePredicate(componentType)) + .stream() + .map(csym -> instantiatePatternType(componentType, csym)) + .collect(List.collector()); + } else { + applicableLeafPermittedSubtypes = List.of(componentType); + } + + List> newCombinatorialNestedTypes = List.nil(); + + for (List existing : combinatorialNestedTypes) { + for (Type nue : applicableLeafPermittedSubtypes) { + newCombinatorialNestedTypes = newCombinatorialNestedTypes.prepend(existing.append(nue)); + } + } + + combinatorialNestedTypes = newCombinatorialNestedTypes; + } + + Set combinatorialPatterns = + combinatorialNestedTypes.stream() + .map(combination -> new RecordPattern(bp.type, + componentTypes, + combination.map(BindingPattern::new) + .toArray(PatternDescription[]::new))) + .collect(Collectors.toCollection(LinkedHashSet::new)); + + removeUnnecessaryPatterns(selectorType, bp, basePatterns, inMissingPatterns, combinatorialPatterns); + + CoverageResult coverageResult = computeCoverage(targetType, combinatorialPatterns, PatternEquivalence.LOOSE); + + if (!coverageResult.covered()) { + //use the partially merged/combined patterns: + combinatorialPatterns = coverageResult.incompletePatterns(); + } + + //combine sealed subtypes into the supertype, if all is covered. + //but preserve more specific record types in positions where there are record patterns in the original patterns + //this is particularly important for the case where the sealed supertype only has one permitted type, the record + //the base type could be used instead of the record otherwise, which would produce less specific missing pattern: + Set sortedCandidates = + partialSortPattern(combinatorialPatterns, basePatterns, replace(inMissingPatterns, toExpand, combinatorialPatterns)); + + removeUnnecessaryPatterns(selectorType, bp, basePatterns, inMissingPatterns, sortedCandidates); + + Set currentMissingPatterns = + replace(inMissingPatterns, toExpand, sortedCandidates); + + for (PatternDescription addedPattern : sortedCandidates) { + if (addedPattern instanceof RecordPattern addedRP) { + for (int c = 0; c < addedRP.nested.length; c++) { + currentMissingPatterns = expandMissingPatternDescriptions(selectorType, + addedRP.fullComponentTypes[c], + addedRP.nested[c], + basePatterns, + currentMissingPatterns); + } + } + } + + return currentMissingPatterns; + } + } + return inMissingPatterns; + } + + /* + * Inside any pattern in {@code in}, in any nesting depth, replace + * pattern {@code what} with patterns {@code to}. + */ + private Set replace(Iterable in, + PatternDescription what, + Collection to) { + Set result = new HashSet<>(); + + for (PatternDescription pd : in) { + Collection replaced = replace(pd, what, to); + if (replaced != null) { + result.addAll(replaced); + } else { + result.add(pd); + } + } + + return result; + } + //where: + //null: no change + private Collection replace(PatternDescription in, + PatternDescription what, + Collection to) { + if (in == what) { + return to; + } else if (in instanceof RecordPattern rp) { + for (int c = 0; c < rp.nested.length; c++) { + Collection replaced = replace(rp.nested[c], what, to); + if (replaced != null) { + Set withReplaced = new HashSet<>(); + + generatePatternsWithReplacedNestedPattern(rp, c, replaced, Set.of(), withReplaced::add); + + return replace(withReplaced, what, to); + } + } + return null; + } else { + return null; //binding patterns have no children + } + } + + /* Out of "candidates" remove patterns that are not necessary to achieve exhaustiveness. + * Note that iteration order of "candidates" is important - if the set contains + * two pattern, out of which either, but not both, is needed to achieve exhaustiveness, + * the first one in the iteration order will be removed. + */ + private boolean removeUnnecessaryPatterns(Type selectorType, + PatternDescription toExpand, + Set basePatterns, + Set inMissingPatterns, + Set candidates) { + boolean reduced = false; + + for (Iterator it = candidates.iterator(); it.hasNext(); ) { + PatternDescription current = it.next(); + Set reducedAdded = new HashSet<>(candidates); + + reducedAdded.remove(current); + + Set combinedPatterns = + Stream.concat(basePatterns.stream(), + replace(inMissingPatterns, toExpand, reducedAdded).stream()) + .collect(Collectors.toSet()); + + if (computeCoverage(selectorType, combinedPatterns, PatternEquivalence.LOOSE).covered()) { + it.remove(); + reduced = true; + } + } + + return reduced; + } + /* + * Sort patterns so that those that are preferred for removal are in front + * of those that are preferred to remain (when there's a choice). + */ + private SequencedSet partialSortPattern(Set candidates, + Set basePatterns, + Set missingPatterns) { + SequencedSet sortedCandidates = new LinkedHashSet<>(); + + while (!candidates.isEmpty()) { + PatternDescription mostSpecific = null; + for (PatternDescription current : candidates) { + if (mostSpecific == null || + shouldAppearBefore(current, mostSpecific, basePatterns, missingPatterns)) { + mostSpecific = current; + } + } + sortedCandidates.add(mostSpecific); + candidates.remove(mostSpecific); + } + return sortedCandidates; + } + //where: + //true iff pd1 should appear before pd2 + //false otherwise + private boolean shouldAppearBefore(PatternDescription pd1, + PatternDescription pd2, + Set basePatterns, + Set missingPatterns) { + if (pd1 instanceof RecordPattern rp1 && pd2 instanceof RecordPattern rp2) { + for (int c = 0; c < rp1.nested.length; c++) { + if (shouldAppearBefore((BindingPattern) rp1.nested[c], + (BindingPattern) rp2.nested[c], + basePatterns, + missingPatterns)) { + return true; + } + } + } else if (pd1 instanceof BindingPattern bp1 && pd2 instanceof BindingPattern bp2) { + Type t1 = bp1.type(); + Type t2 = bp2.type(); + boolean t1IsImportantRecord = + (t1.tsym.flags_field & RECORD) != 0 && + hasMatchingRecordPattern(basePatterns, missingPatterns, bp1); + boolean t2IsImportantRecord = + (t2.tsym.flags_field & RECORD) != 0 && + hasMatchingRecordPattern(basePatterns, missingPatterns, bp2); + if (t1IsImportantRecord && !t2IsImportantRecord) { + return false; + } + if (!t1IsImportantRecord && t2IsImportantRecord) { + return true; + } + if (!types.isSameType(t1, t2) && types.isSubtype(t1, t2)) { + return true; + } + } + + return false; + } + + /* + * Do the {@code basePatterns} have a record pattern at a place that corresponds to + * position of pattern {@code query} inside {@code missingPatterns}? + */ + private boolean hasMatchingRecordPattern(Set basePatterns, + Set missingPatterns, + PatternDescription query) { + PatternDescription root = findRootContaining(missingPatterns, query); + + if (root == null) { + return false; + } + return basePatternsHaveRecordPatternOnThisSpot(basePatterns, root, query); + } + //where: + private PatternDescription findRootContaining(Set rootPatterns, + PatternDescription added) { + for (PatternDescription pd : rootPatterns) { + if (isUnderRoot(pd, added)) { + return pd; + } + } + + return null; + } + + private boolean basePatternsHaveRecordPatternOnThisSpot(Set basePatterns, + PatternDescription rootPattern, + PatternDescription added) { + if (rootPattern == added) { + return basePatterns.stream().anyMatch(pd -> pd instanceof RecordPattern); + } + if (!(rootPattern instanceof RecordPattern rootPatternRecord)) { + return false; + } + int index = -1; + for (int c = 0; c < rootPatternRecord.nested.length; c++) { + if (isUnderRoot(rootPatternRecord.nested[c], added)) { + index = c; + break; + } + } + // 'index' must be one of rootPatternRecord.nested; if not, `isUnderRoot` is inconsistent. + Assert.check(index != (-1)); + + int indexFin = index; + Set filteredBasePatterns = + basePatterns.stream() + .filter(pd -> pd instanceof RecordPattern) + .map(rp -> (RecordPattern) rp) + .filter(rp -> types.isSameType(rp.recordType(), rootPatternRecord.recordType())) + .map(rp -> rp.nested[indexFin]) + .collect(Collectors.toSet()); + + return basePatternsHaveRecordPatternOnThisSpot(filteredBasePatterns, rootPatternRecord.nested[index], added); + } + + private boolean isUnderRoot(PatternDescription root, PatternDescription searchFor) { + if (root == searchFor) { + return true; + } else if (root instanceof RecordPattern rp) { + for (int c = 0; c < rp.nested.length; c++) { + if (isUnderRoot(rp.nested[c], searchFor)) { + return true; + } + } + } + return false; + } + + /* + * Using {@code basePattern} as a starting point, generate new {@code + * RecordPattern}s, such that all corresponding components but one, are the + * same. The component described by the {@code replaceComponent} index is + * replaced with all {@code PatternDescription}s taken from {@code + * updatedNestedPatterns} and the resulting {@code RecordPatterns}s are sent + * to {@code target}. + */ + private void generatePatternsWithReplacedNestedPattern(RecordPattern basePattern, + int replaceComponent, + Iterable updatedNestedPatterns, + Set sourcePatterns, + Consumer target) { + for (PatternDescription nested : updatedNestedPatterns) { + PatternDescription[] newNested = + Arrays.copyOf(basePattern.nested, basePattern.nested.length); + newNested[replaceComponent] = nested; + target.accept(new RecordPattern(basePattern.recordType(), + basePattern.fullComponentTypes(), + newNested, + sourcePatterns)); + } + } + + /* For a given record type, return the record's component types, with their + * types instatiated according to the exact record type. + */ + private Type[] instantiatedComponentTypes(Type recordType) { + Type[] componentTypes = ((ClassSymbol) recordType.tsym).getRecordComponents() + .map(r -> types.memberType(recordType, r)) + .toArray(s -> new Type[s]); + return componentTypes; + } + + /* The strictness of determining the equivalent of patterns, used in + * nestedComponentsEquivalent. + */ + private enum PatternEquivalence { + STRICT, + LOOSE; + } + + protected static class TooManyChecksException extends RuntimeException { + private static final long serialVersionUID = 0L; + private transient final Set missingPatterns; + + public TooManyChecksException(Set missingPatterns) { + super(null, null, false, false); + this.missingPatterns = missingPatterns; + } } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java index e74aed6a357..cbcb474a37f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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,9 +50,15 @@ import static com.sun.tools.javac.code.Flags.BLOCK; import static com.sun.tools.javac.code.Kinds.Kind.*; import static com.sun.tools.javac.code.TypeTag.BOOLEAN; import static com.sun.tools.javac.code.TypeTag.VOID; +import com.sun.tools.javac.comp.ExhaustivenessComputer.BindingPattern; +import com.sun.tools.javac.comp.ExhaustivenessComputer.EnumConstantPattern; +import com.sun.tools.javac.comp.ExhaustivenessComputer.ExhaustivenessResult; +import com.sun.tools.javac.comp.ExhaustivenessComputer.PatternDescription; +import com.sun.tools.javac.comp.ExhaustivenessComputer.RecordPattern; import com.sun.tools.javac.resources.CompilerProperties.Fragments; import static com.sun.tools.javac.tree.JCTree.Tag.*; import com.sun.tools.javac.util.JCDiagnostic.Fragment; +import java.util.Arrays; /** This pass implements dataflow analysis for Java programs though * different AST visitor steps. Liveness analysis (see AliveAnalyzer) checks that @@ -696,9 +702,18 @@ public class Flow { tree.isExhaustive = tree.hasUnconditionalPattern || TreeInfo.isErrorEnumSwitch(tree.selector, tree.cases); if (exhaustiveSwitch) { - tree.isExhaustive |= exhaustiveness.exhausts(tree.selector, tree.cases); if (!tree.isExhaustive) { - log.error(tree, Errors.NotExhaustiveStatement); + ExhaustivenessResult exhaustivenessResult = exhaustiveness.exhausts(tree.selector, tree.cases); + + tree.isExhaustive = exhaustivenessResult.exhaustive(); + + if (!tree.isExhaustive) { + if (exhaustivenessResult.notExhaustiveDetails().isEmpty()) { + log.error(tree, Errors.NotExhaustiveStatement); + } else { + logNotExhaustiveError(tree.pos(), exhaustivenessResult, Errors.NotExhaustiveStatementDetails); + } + } } } if (!tree.hasUnconditionalPattern && !exhaustiveSwitch) { @@ -735,16 +750,54 @@ public class Flow { TreeInfo.isErrorEnumSwitch(tree.selector, tree.cases)) { tree.isExhaustive = true; } else { - tree.isExhaustive = exhaustiveness.exhausts(tree.selector, tree.cases); + ExhaustivenessResult exhaustivenessResult = exhaustiveness.exhausts(tree.selector, tree.cases); + + tree.isExhaustive = exhaustivenessResult.exhaustive(); + + if (!tree.isExhaustive) { + if (exhaustivenessResult.notExhaustiveDetails().isEmpty()) { + log.error(tree, Errors.NotExhaustive); + } else { + logNotExhaustiveError(tree.pos(), exhaustivenessResult, Errors.NotExhaustiveDetails); + } + } } - if (!tree.isExhaustive) { - log.error(tree, Errors.NotExhaustive); - } alive = prevAlive; alive = alive.or(resolveYields(tree, prevPendingExits)); } + private void logNotExhaustiveError(DiagnosticPosition pos, + ExhaustivenessResult exhaustivenessResult, + Error errorKey) { + List details = + exhaustivenessResult.notExhaustiveDetails() + .stream() + .map(this::patternToDiagnostic) + .sorted((d1, d2) -> d1.toString() + .compareTo(d2.toString())) + .collect(List.collector()); + JCDiagnostic main = diags.error(null, log.currentSource(), pos, errorKey); + JCDiagnostic d = new JCDiagnostic.MultilineDiagnostic(main, details); + log.report(d); + } + + private JCDiagnostic patternToDiagnostic(PatternDescription desc) { + Type patternType = types.erasure(desc.type()); + return diags.fragment(switch (desc) { + case BindingPattern _ -> + Fragments.BindingPattern(patternType); + case RecordPattern rp -> + Fragments.RecordPattern(patternType, + Arrays.stream(rp.nested()) + .map(this::patternToDiagnostic) + .toList()); + case EnumConstantPattern ep -> + Fragments.EnumConstantPattern(patternType, + ep.enumConstant()); + }); + } + public void visitTry(JCTry tree) { ListBuffer prevPendingExits = pendingExits; pendingExits = new ListBuffer<>(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java index b13c9e0fe2b..7d0c5192039 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java @@ -142,6 +142,9 @@ public class LambdaToMethod extends TreeTranslator { /** dump statistics about lambda code generation */ private final boolean dumpLambdaToMethodStats; + /** dump statistics about lambda deserialization code generation */ + private final boolean dumpLambdaDeserializationStats; + /** force serializable representation, for stress testing **/ private final boolean forceSerializable; @@ -187,6 +190,7 @@ public class LambdaToMethod extends TreeTranslator { transTypes = TransTypes.instance(context); Options options = Options.instance(context); dumpLambdaToMethodStats = options.isSet("debug.dumpLambdaToMethodStats"); + dumpLambdaDeserializationStats = options.isSet("debug.dumpLambdaDeserializationStats"); attr = Attr.instance(context); forceSerializable = options.isSet("forceSerializable"); boolean lineDebugInfo = @@ -714,8 +718,9 @@ public class LambdaToMethod extends TreeTranslator { String implMethodName = refSym.getQualifiedName().toString(); String implMethodSignature = typeSig(types.erasure(refSym.type)); + int implMethodKind = refSym.referenceKind(); JCExpression kindTest = eqTest(syms.intType, deserGetter("getImplMethodKind", syms.intType), - make.Literal(refSym.referenceKind())); + make.Literal(implMethodKind)); ListBuffer serArgs = new ListBuffer<>(); int i = 0; for (Type t : indyType.getParameterTypes()) { @@ -743,16 +748,16 @@ public class LambdaToMethod extends TreeTranslator { stmts = new ListBuffer<>(); kInfo.deserializeCases.put(implMethodName, stmts); } - /* ** - System.err.printf("+++++++++++++++++\n"); - System.err.printf("*functionalInterfaceClass: '%s'\n", functionalInterfaceClass); - System.err.printf("*functionalInterfaceMethodName: '%s'\n", functionalInterfaceMethodName); - System.err.printf("*functionalInterfaceMethodSignature: '%s'\n", functionalInterfaceMethodSignature); - System.err.printf("*implMethodKind: %d\n", implMethodKind); - System.err.printf("*implClass: '%s'\n", implClass); - System.err.printf("*implMethodName: '%s'\n", implMethodName); - System.err.printf("*implMethodSignature: '%s'\n", implMethodSignature); - ****/ + if (dumpLambdaDeserializationStats) { + log.note(pos, Notes.LambdaDeserializationStat( + functionalInterfaceClass, + functionalInterfaceMethodName, + functionalInterfaceMethodSignature, + implMethodKind, + implClass, + implMethodName, + implMethodSignature)); + } stmts.append(stmt); } @@ -1152,7 +1157,7 @@ public class LambdaToMethod extends TreeTranslator { propagateAnnos = false; break; case LOCAL_VAR: - ret = new VarSymbol(sym.flags() & FINAL, sym.name, sym.type, translatedSym); + ret = new VarSymbol(sym.flags(), sym.name, sym.type, translatedSym); ret.pos = sym.pos; // If sym.data == ElementKind.EXCEPTION_PARAMETER, // set ret.data = ElementKind.EXCEPTION_PARAMETER too. @@ -1164,7 +1169,8 @@ public class LambdaToMethod extends TreeTranslator { } break; case PARAM: - ret = new VarSymbol((sym.flags() & FINAL) | PARAMETER, sym.name, types.erasure(sym.type), translatedSym); + Assert.check((sym.flags() & PARAMETER) != 0); + ret = new VarSymbol(sym.flags(), sym.name, types.erasure(sym.type), translatedSym); ret.pos = sym.pos; break; default: diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java index 2db3435a382..69161fd682c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java @@ -48,7 +48,6 @@ import com.sun.tools.javac.tree.JCTree.*; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.jvm.Target; -import com.sun.tools.javac.tree.EndPosTable; import static com.sun.tools.javac.code.Flags.*; import static com.sun.tools.javac.code.Flags.BLOCK; @@ -156,10 +155,6 @@ public class Lower extends TreeTranslator { */ Env attrEnv; - /** A hash table mapping syntax trees to their ending source positions. - */ - EndPosTable endPosTable; - /* ************************************************************************ * Global mappings *************************************************************************/ @@ -2059,8 +2054,8 @@ public class Lower extends TreeTranslator { } else { make_at(tree.pos()); T result = super.translate(tree); - if (endPosTable != null && result != tree) { - endPosTable.replaceTree(tree, result); + if (result != null && result != tree) { + result.endpos = tree.endpos; } return result; } @@ -4352,7 +4347,6 @@ public class Lower extends TreeTranslator { try { attrEnv = env; this.make = make; - endPosTable = env.toplevel.endPositions; currentClass = null; currentRestype = null; currentMethodDef = null; @@ -4382,7 +4376,6 @@ public class Lower extends TreeTranslator { // note that recursive invocations of this method fail hard attrEnv = null; this.make = null; - endPosTable = null; currentClass = null; currentRestype = null; currentMethodDef = null; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java index 07f2a742bcb..d88180bb15c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -3843,12 +3843,15 @@ public class Resolve { Env env1 = env; boolean staticOnly = false; while (env1.outer != null) { + // If the local class is defined inside a static method, and the instance creation expression + // occurs in that same method, the creation occurs (technically) inside a static context, but that's ok. if (env1.info.scope.owner == owner) { return (staticOnly) ? new BadLocalClassCreation(c) : owner; + } else if (isStatic(env1) || env1.enclClass.sym.isStatic()) { + staticOnly = true; } - if (isStatic(env1)) staticOnly = true; env1 = env1.outer; } return owner.kind == MTH ? diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/CRTable.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/CRTable.java index 2cd4142c748..3092d16469d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/CRTable.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/CRTable.java @@ -32,7 +32,6 @@ import com.sun.tools.javac.tree.*; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.List; import com.sun.tools.javac.tree.JCTree.*; -import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.tree.JCTree.JCSwitchExpression; /** This class contains the CharacterRangeTable for some method @@ -57,10 +56,6 @@ implements CRTFlags { */ private Map positions = new HashMap<>(); - /** The object for ending positions stored in the parser. - */ - private EndPosTable endPosTable; - /** The tree of the method this table is intended for. * We should traverse this tree to get source ranges. */ @@ -68,9 +63,8 @@ implements CRTFlags { /** Constructor */ - public CRTable(JCTree.JCMethodDecl tree, EndPosTable endPosTable) { + public CRTable(JCTree.JCMethodDecl tree) { this.methodTree = tree; - this.endPosTable = endPosTable; } /** Create a new CRTEntry and add it to the entries. @@ -584,7 +578,7 @@ implements CRTFlags { */ public int endPos(JCTree tree) { if (tree == null) return Position.NOPOS; - return TreeInfo.getEndPos(tree, endPosTable); + return TreeInfo.getEndPos(tree); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java index e5adecdb107..ae1aab1cefd 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassFile.java @@ -130,6 +130,7 @@ public class ClassFile { V68(68, 0), // JDK 24 V69(69, 0), // JDK 25 V70(70, 0), // JDK 26 + V71(71, 0), // JDK 27 ; // Reduce code churn when appending new constants Version(int major, int minor) { this.major = major; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java index e40a2fbfcea..688ea1bd720 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -45,7 +45,6 @@ import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.jvm.Code.*; import com.sun.tools.javac.jvm.Items.*; import com.sun.tools.javac.resources.CompilerProperties.Errors; -import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.tree.JCTree.*; import static com.sun.tools.javac.code.Flags.*; @@ -162,11 +161,6 @@ public class Gen extends JCTree.Visitor { */ private int nerrs = 0; - /** An object containing mappings of syntax trees to their - * ending source positions. - */ - EndPosTable endPosTable; - boolean inCondSwitchExpression; Chain switchExpressionTrueChain; Chain switchExpressionFalseChain; @@ -455,7 +449,7 @@ public class Gen extends JCTree.Visitor { JCStatement init = make.at(vdef.pos()). Assignment(sym, vdef.init); initCode.append(init); - endPosTable.replaceTree(vdef, init); + init.endpos = vdef.endpos; initTAs.addAll(getAndRemoveNonFieldTAs(sym)); } else if (sym.getConstValue() == null) { // Initialize class (static) variables only if @@ -463,7 +457,7 @@ public class Gen extends JCTree.Visitor { JCStatement init = make.at(vdef.pos). Assignment(sym, vdef.init); clinitCode.append(init); - endPosTable.replaceTree(vdef, init); + init.endpos = vdef.endpos; clinitTAs.addAll(getAndRemoveNonFieldTAs(sym)); } else { checkStringConstant(vdef.init.pos(), sym.getConstValue()); @@ -1027,8 +1021,7 @@ public class Gen extends JCTree.Visitor { varDebugInfo, stackMap, debugCode, - genCrt ? new CRTable(tree, env.toplevel.endPositions) - : null, + genCrt ? new CRTable(tree) : null, syms, types, poolWriter); @@ -2478,7 +2471,6 @@ public class Gen extends JCTree.Visitor { attrEnv = env; ClassSymbol c = cdef.sym; this.toplevel = env.toplevel; - this.endPosTable = toplevel.endPositions; /* method normalizeDefs() can add references to external classes into the constant pool */ cdef.defs = normalizeDefs(cdef.defs, c); @@ -2508,7 +2500,6 @@ public class Gen extends JCTree.Visitor { attrEnv = null; this.env = null; toplevel = null; - endPosTable = null; nerrs = 0; qualifiedSymbolCache.clear(); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java index f60adcb3b80..b0a298fc845 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java @@ -113,6 +113,9 @@ public enum Target { /** JDK 26. */ JDK1_26("26", 70, 0), + + /** JDK 27. */ + JDK1_27("27", 71, 0), ; // Reduce code churn when appending new constants private static final Context.Key targetKey = new Context.Key<>(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java index 2469dc9e031..94292d9a348 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java @@ -438,8 +438,6 @@ public class JavaCompiler { sourceOutput = options.isSet(PRINTSOURCE); // used to be -s lineDebugInfo = options.isUnset(G_CUSTOM) || options.isSet(G_CUSTOM, "lines"); - genEndPos = options.isSet(XJCOV) || - context.get(DiagnosticListener.class) != null; devVerbose = options.isSet("dev"); processPcks = options.isSet("process.packages"); werrorAny = options.isSet(WERROR) || options.isSet(WERROR_CUSTOM, Option.LINT_CUSTOM_ALL); @@ -504,10 +502,6 @@ public class JavaCompiler { */ public boolean lineDebugInfo; - /** Switch: should we store the ending positions? - */ - public boolean genEndPos; - /** Switch: should we debug ignored exceptions */ protected boolean devVerbose; @@ -655,9 +649,8 @@ public class JavaCompiler { TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename); taskListener.started(e); keepComments = true; - genEndPos = true; } - Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, + Parser parser = parserFactory.newParser(content, keepComments(), lineDebugInfo, filename.isNameCompatible("module-info", Kind.SOURCE)); tree = parser.parseCompilationUnit(); if (verbose) { @@ -697,10 +690,7 @@ public class JavaCompiler { public JCTree.JCCompilationUnit parse(JavaFileObject filename) { JavaFileObject prev = log.useSource(filename); try { - JCTree.JCCompilationUnit t = parse(filename, readSource(filename)); - if (t.endPositions != null) - log.setEndPosTable(filename, t.endPositions); - return t; + return parse(filename, readSource(filename)); } finally { log.useSource(prev); } @@ -1162,7 +1152,6 @@ public class JavaCompiler { options.put("parameters", "parameters"); reader.saveParameterNames = true; keepComments = true; - genEndPos = true; if (!taskListener.isEmpty()) taskListener.started(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING)); deferredDiagnosticHandler = log.new DeferredDiagnosticHandler(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java index c14767a7a8c..664ebc4c9c6 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java @@ -33,6 +33,8 @@ import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; import java.text.Collator; +import java.util.Collection; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; @@ -45,7 +47,6 @@ import java.util.ServiceLoader; import java.util.Set; import java.util.StringJoiner; import java.util.TreeMap; -import java.util.TreeSet; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -323,12 +324,13 @@ public enum Option { @Override protected void help(Log log) { - StringJoiner sj = new StringJoiner(", "); + List releases = new ArrayList<>(); for(Source source : Source.values()) { if (source.isSupported()) - sj.add(source.name); + releases.add(source.name); } - super.help(log, log.localize(PrefixKind.JAVAC, descrKey, sj.toString())); + String formatted = formatAbbreviatedList(releases); + super.help(log, log.localize(PrefixKind.JAVAC, descrKey, formatted)); } }, @@ -344,12 +346,13 @@ public enum Option { @Override protected void help(Log log) { - StringJoiner sj = new StringJoiner(", "); + List releases = new ArrayList<>(); for(Target target : Target.values()) { if (target.isSupported()) - sj.add(target.name); + releases.add(target.name); } - super.help(log, log.localize(PrefixKind.JAVAC, descrKey, sj.toString())); + String formatted = formatAbbreviatedList(releases); + super.help(log, log.localize(PrefixKind.JAVAC, descrKey, formatted)); } }, @@ -364,15 +367,8 @@ public enum Option { false)) .collect(Collectors.toCollection(LinkedHashSet :: new)); - StringBuilder targets = new StringBuilder(); - String delim = ""; - for (String platform : platforms) { - targets.append(delim); - targets.append(platform); - delim = ", "; - } - - super.help(log, log.localize(PrefixKind.JAVAC, descrKey, targets.toString())); + String formatted = formatAbbreviatedList(platforms); + super.help(log, log.localize(PrefixKind.JAVAC, descrKey, formatted)); } }, @@ -1369,6 +1365,41 @@ public enum Option { log.printRawLines(WriterKind.STDOUT, LARGE_INDENT + descr.replace("\n", "\n" + LARGE_INDENT)); } + /** + * Formats a collection of values as an abbreviated, comma separated list + * for use in javac help output. + * + * This helper assumes that the supported values form a dense sequence + * between the fourth and the (n - 3)rd entries. + * That matches the current policy for these values but is not + * guaranteed, and should be reconsidered if the structure of the values changes. + * + * @param values the values to format + * @return a comma separated representation of the values + */ + private static String formatAbbreviatedList(Collection values) { + List list = (values instanceof List) + ? (List) values + : new ArrayList<>(values); + + int size = list.size(); + if (size == 0) { + return ""; + } + if (size <= 6) { + return String.join(", ", list); + } + StringJoiner sj = new StringJoiner(", "); + for (int i = 0; i < 3; i++) { + sj.add(list.get(i)); + } + sj.add("..."); + for (int i = size - 3; i < size; i++) { + sj.add(list.get(i)); + } + return sj.toString(); + } + /** * Composes the initial synopsis of one of the forms for this option. * @param name the name of this form of the option diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java index f40cb0fb6b7..babe372e7dc 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java @@ -33,7 +33,6 @@ import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle; import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; -import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.JCDiagnostic.*; @@ -1215,7 +1214,7 @@ public class JavaTokenizer extends UnicodeReader { this.cs = cs; this.pos = new SimpleDiagnosticPosition(pos) { @Override - public int getEndPosition(EndPosTable endPosTable) { + public int getEndPosition() { return endPos; } }; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java index d3539b53541..e78537c10f5 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -110,8 +110,7 @@ public class JavacParser implements Parser { /** The name table. */ private Names names; - /** End position mappings container */ - protected final AbstractEndPosTable endPosTable; + protected int errorEndPos = Position.NOPOS; /** A map associating "other nearby documentation comments" * with the preferred documentation comment for a declaration. */ @@ -167,9 +166,8 @@ public class JavacParser implements Parser { protected JavacParser(ParserFactory fac, Lexer S, boolean keepDocComments, - boolean keepLineMap, - boolean keepEndPositions) { - this(fac, S, keepDocComments, keepLineMap, keepEndPositions, false); + boolean keepLineMap) { + this(fac, S, keepDocComments, keepLineMap, false); } /** Construct a parser from a given scanner, tree factory and log. @@ -179,7 +177,6 @@ public class JavacParser implements Parser { Lexer S, boolean keepDocComments, boolean keepLineMap, - boolean keepEndPositions, boolean parseModuleInfo) { this.S = S; nextToken(); // prime the pump @@ -194,7 +191,6 @@ public class JavacParser implements Parser { this.docComments = newDocCommentTable(keepDocComments, fac); this.keepLineMap = keepLineMap; this.errorTree = F.Erroneous(); - this.endPosTable = newEndPosTable(keepEndPositions); this.allowYieldStatement = Feature.SWITCH_EXPRESSION.allowedInSource(source); this.allowRecords = Feature.RECORDS.allowedInSource(source); this.allowSealedTypes = Feature.SEALED_CLASSES.allowedInSource(source); @@ -218,19 +214,12 @@ public class JavacParser implements Parser { this.parseModuleInfo = false; this.docComments = parser.docComments; this.errorTree = F.Erroneous(); - this.endPosTable = newEndPosTable(false); this.allowYieldStatement = Feature.SWITCH_EXPRESSION.allowedInSource(source); this.allowRecords = Feature.RECORDS.allowedInSource(source); this.allowSealedTypes = Feature.SEALED_CLASSES.allowedInSource(source); updateUnexpectedTopLevelDefinitionStartError(false); } - protected AbstractEndPosTable newEndPosTable(boolean keepEndPositions) { - return keepEndPositions - ? new SimpleEndPosTable() - : new MinimalEndPosTable(); - } - protected DocCommentTable newDocCommentTable(boolean keepDocComments, ParserFactory fac) { return keepDocComments ? new LazyDocCommentTable(fac) : null; } @@ -271,16 +260,11 @@ public class JavacParser implements Parser { /** When terms are parsed, the mode determines which is expected: * mode = EXPR : an expression * mode = TYPE : a type - * mode = NOPARAMS : no parameters allowed for type - * mode = TYPEARG : type argument - * mode |= NOLAMBDA : lambdas are not allowed + * mode = NOLAMBDA : lambdas are not allowed */ protected static final int EXPR = 1 << 0; protected static final int TYPE = 1 << 1; - protected static final int NOPARAMS = 1 << 2; - protected static final int TYPEARG = 1 << 3; - protected static final int DIAMOND = 1 << 4; - protected static final int NOLAMBDA = 1 << 5; + protected static final int NOLAMBDA = 1 << 2; protected void setMode(int mode) { this.mode = mode; @@ -672,7 +656,7 @@ public class JavacParser implements Parser { var src = log.currentSource(); return c.getStyle() == Comment.CommentStyle.JAVADOC_LINE && c.getPos().getStartPosition() == 0 && - src.getLineNumber(pos.getEndPosition(src.getEndPosTable())) == 1; + src.getLineNumber(pos.getEndPosition()) == 1; } /** @@ -686,23 +670,26 @@ public class JavacParser implements Parser { /* -------- source positions ------- */ protected void setErrorEndPos(int errPos) { - endPosTable.setErrorEndPos(errPos); + if (errPos > errorEndPos) { + errorEndPos = errPos; + } } /** * Store ending position for a tree, the value of which is the greater of - * last error position in {@link #endPosTable} and the given ending position. + * {@link #errorEndPos} and the given ending position. * @param tree tree node * @param endpos the ending position to associate with {@code tree} * @return {@code tree} */ protected T storeEnd(T tree, int endpos) { - return endPosTable.storeEnd(tree, endpos); + tree.endpos = Math.max(endpos, errorEndPos); + return tree; } /** * Store current token's ending position for a tree, the value of which - * will be the greater of last error position in {@link #endPosTable} + * will be the greater of {@link #errorEndPos} * and the ending position of the current token. * @param tree tree node */ @@ -712,7 +699,7 @@ public class JavacParser implements Parser { /** * Store current token's ending position for a tree, the value of which - * will be the greater of last error position in {@link #endPosTable} + * will be the greater of {@link #errorEndPos} * and the ending position of the previous token. * @param tree tree node */ @@ -738,7 +725,7 @@ public class JavacParser implements Parser { * @param tree The tree node */ public int getEndPos(JCTree tree) { - return endPosTable.getEndPos(tree); + return tree.endpos; } @@ -1274,7 +1261,7 @@ public class JavacParser implements Parser { JCAnnotation typeAnno = F.at(decl.pos) .TypeAnnotation(decl.annotationType, decl.args); - endPosTable.replaceTree(decl, typeAnno); + typeAnno.endpos = decl.endpos; return typeAnno; }); type = insertAnnotationsToMostInner(type, typeAnnos, false); @@ -1363,7 +1350,7 @@ public class JavacParser implements Parser { } else { JCExpression t = F.at(litBuf.first().getStartPosition()).Literal(TypeTag.CLASS, litBuf.stream().map(lit -> (String)lit.getValue()).collect(Collectors.joining())); - storeEnd(t, litBuf.last().getEndPosition(endPosTable)); + storeEnd(t, litBuf.last().getEndPosition()); opStack.prepend(t); return true; } @@ -1439,12 +1426,6 @@ public class JavacParser implements Parser { int startMode = mode; List typeArgs = typeArgumentsOpt(EXPR); switch (token.kind) { - case QUES: - if (isMode(TYPE) && isMode(TYPEARG) && !isMode(NOPARAMS)) { - selectTypeMode(); - return typeArgument(); - } else - return illegal(); case PLUSPLUS: case SUBSUB: case BANG: case TILDE: case PLUS: case SUB: if (typeArgs == null && isMode(EXPR)) { TokenKind tk = token.kind; @@ -1522,7 +1503,7 @@ public class JavacParser implements Parser { if (isMode(EXPR)) { selectExprMode(); nextToken(); - if (token.kind == LT) typeArgs = typeArguments(false); + if (token.kind == LT) typeArgs = typeArguments(); t = creator(pos, typeArgs); typeArgs = null; } else return illegal(); @@ -1625,7 +1606,6 @@ public class JavacParser implements Parser { return illegal(); } int prevmode = mode; - setMode(mode & ~NOPARAMS); typeArgs = typeArgumentsOpt(EXPR); setMode(prevmode); if (isMode(EXPR)) { @@ -1653,7 +1633,7 @@ public class JavacParser implements Parser { selectExprMode(); int pos1 = token.pos; nextToken(); - if (token.kind == LT) typeArgs = typeArguments(false); + if (token.kind == LT) typeArgs = typeArguments(); t = innerCreator(pos1, typeArgs, t); typeArgs = null; break loop; @@ -1666,7 +1646,7 @@ public class JavacParser implements Parser { } // typeArgs saved for next loop iteration. t = toP(F.at(pos).Select(t, ident())); - if (token.pos <= endPosTable.errorEndPos && + if (token.pos <= errorEndPos && token.kind == MONKEYS_AT) { //error recovery, case like: //int i = expr. @@ -1704,7 +1684,7 @@ public class JavacParser implements Parser { nextToken(); selectTypeMode(); t = toP(F.at(token.pos).Select(t, ident())); - t = typeArgumentsOpt(t); + t = typeApplyOpt(t); } t = bracketsOpt(t); if (token.kind != COLCOL) { @@ -1721,7 +1701,7 @@ public class JavacParser implements Parser { } } if (typeArgs != null) illegal(); - t = typeArgumentsOpt(t); + t = typeApplyOpt(t); break; case BYTE: case SHORT: case CHAR: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: @@ -1880,7 +1860,7 @@ public class JavacParser implements Parser { selectExprMode(); int pos2 = token.pos; nextToken(); - if (token.kind == LT) typeArgs = typeArguments(false); + if (token.kind == LT) typeArgs = typeArguments(); t = innerCreator(pos2, typeArgs, t); typeArgs = null; } else { @@ -1890,7 +1870,7 @@ public class JavacParser implements Parser { tyannos = typeAnnotationsOpt(); } t = toP(F.at(pos1).Select(t, ident(true))); - if (token.pos <= endPosTable.errorEndPos && + if (token.pos <= errorEndPos && token.kind == MONKEYS_AT) { //error recovery, case like: //int i = expr. @@ -1900,7 +1880,7 @@ public class JavacParser implements Parser { if (tyannos != null && tyannos.nonEmpty()) { t = toP(F.at(tyannos.head.pos).AnnotatedType(tyannos, t)); } - t = argumentsOpt(typeArgs, typeArgumentsOpt(t)); + t = argumentsOpt(typeArgs, typeApplyOpt(t)); typeArgs = null; } } else if (isMode(EXPR) && token.kind == COLCOL) { @@ -2302,7 +2282,7 @@ public class JavacParser implements Parser { } else { int pos = token.pos; accept(DOT); - typeArgs = (token.kind == LT) ? typeArguments(false) : null; + typeArgs = (token.kind == LT) ? typeArguments() : null; t = toP(F.at(pos).Select(t, ident())); t = argumentsOpt(typeArgs, t); } @@ -2373,12 +2353,11 @@ public class JavacParser implements Parser { /** TypeArgumentsOpt = [ TypeArguments ] */ - JCExpression typeArgumentsOpt(JCExpression t) { + JCExpression typeApplyOpt(JCExpression t) { if (token.kind == LT && - isMode(TYPE) && - !isMode(NOPARAMS)) { + isMode(TYPE)) { selectTypeMode(); - return typeArguments(t, false); + return typeApply(t); } else { return t; } @@ -2389,12 +2368,11 @@ public class JavacParser implements Parser { List typeArgumentsOpt(int useMode) { if (token.kind == LT) { - if (!isMode(useMode) || - isMode(NOPARAMS)) { + if (!isMode(useMode)) { illegal(); } setMode(useMode); - return typeArguments(false); + return typeArguments(); } return null; } @@ -2404,35 +2382,29 @@ public class JavacParser implements Parser { * TypeArguments = "<" TypeArgument {"," TypeArgument} ">" * } */ - List typeArguments(boolean diamondAllowed) { + List typeArguments() { if (token.kind == LT) { nextToken(); - if (token.kind == GT && diamondAllowed) { - setMode(mode | DIAMOND); + ListBuffer args = new ListBuffer<>(); + args.append(!isMode(EXPR) ? typeArgument() : parseType()); + while (token.kind == COMMA) { nextToken(); - return List.nil(); - } else { - ListBuffer args = new ListBuffer<>(); args.append(!isMode(EXPR) ? typeArgument() : parseType()); - while (token.kind == COMMA) { - nextToken(); - args.append(!isMode(EXPR) ? typeArgument() : parseType()); - } - switch (token.kind) { - - case GTGTGTEQ: case GTGTEQ: case GTEQ: - case GTGTGT: case GTGT: - token = S.split(); - break; - case GT: - nextToken(); - break; - default: - args.append(syntaxError(token.pos, Errors.Expected2(GT, COMMA))); - break; - } - return args.toList(); } + switch (token.kind) { + + case GTGTGTEQ: case GTGTEQ: case GTEQ: + case GTGTGT: case GTGT: + token = S.split(); + break; + case GT: + nextToken(); + break; + default: + args.append(syntaxError(token.pos, Errors.Expected2(GT, COMMA))); + break; + } + return args.toList(); } else { return List.of(syntaxError(token.pos, Errors.Expected(LT))); } @@ -2480,12 +2452,23 @@ public class JavacParser implements Parser { return result; } - JCTypeApply typeArguments(JCExpression t, boolean diamondAllowed) { + JCTypeApply typeApply(JCExpression t) { int pos = token.pos; - List args = typeArguments(diamondAllowed); + List args = typeArguments(); return toP(F.at(pos).TypeApply(t, args)); } + JCTypeApply typeApplyOrDiamond(JCExpression t) { + if (peekToken(GT)) { + int pos = token.pos; + accept(LT); + accept(GT); + return toP(F.at(pos).TypeApply(t, List.nil())); + } else { + return typeApply(t); + } + } + /** * BracketsOpt = { [Annotations] "[" "]" }* * @@ -2542,7 +2525,7 @@ public class JavacParser implements Parser { int pos = token.pos; nextToken(); accept(CLASS); - if (token.pos == endPosTable.errorEndPos) { + if (token.pos == errorEndPos) { // error recovery Name name; if (LAX_IDENTIFIER.test(token.kind)) { @@ -2585,7 +2568,7 @@ public class JavacParser implements Parser { selectExprMode(); List typeArgs = null; if (token.kind == LT) { - typeArgs = typeArguments(false); + typeArgs = typeArguments(); } Name refName; ReferenceMode refMode; @@ -2622,15 +2605,13 @@ public class JavacParser implements Parser { int prevmode = mode; selectTypeMode(); - boolean diamondFound = false; int lastTypeargsPos = -1; if (token.kind == LT) { lastTypeargsPos = token.pos; - t = typeArguments(t, true); - diamondFound = isMode(DIAMOND); + t = typeApplyOrDiamond(t); } while (token.kind == DOT) { - if (diamondFound) { + if (TreeInfo.isDiamond(t)) { //cannot select after a diamond illegal(); } @@ -2645,8 +2626,7 @@ public class JavacParser implements Parser { if (token.kind == LT) { lastTypeargsPos = token.pos; - t = typeArguments(t, true); - diamondFound = isMode(DIAMOND); + t = typeApplyOrDiamond(t); } } setMode(prevmode); @@ -2657,7 +2637,7 @@ public class JavacParser implements Parser { } JCExpression e = arrayCreatorRest(newpos, t); - if (diamondFound) { + if (TreeInfo.isDiamond(t)) { reportSyntaxError(lastTypeargsPos, Errors.CannotCreateArrayWithDiamond); return toP(F.at(newpos).Erroneous(List.of(e))); } @@ -2702,7 +2682,7 @@ public class JavacParser implements Parser { if (token.kind == LT) { int prevmode = mode; - t = typeArguments(t, true); + t = typeApplyOrDiamond(t); setMode(prevmode); } return classCreatorRest(newpos, encl, typeArgs, t); @@ -2879,7 +2859,7 @@ public class JavacParser implements Parser { // error recovery if (token.pos == lastErrPos) return stats.toList(); - if (token.pos <= endPosTable.errorEndPos) { + if (token.pos <= errorEndPos) { skip(false, true, true, true); lastErrPos = token.pos; } @@ -4057,7 +4037,7 @@ public class JavacParser implements Parser { boolean firstTypeDecl = true; // have we seen a class, enum, or interface declaration yet? boolean isImplicitClass = false; OUTER: while (token.kind != EOF) { - if (token.pos <= endPosTable.errorEndPos) { + if (token.pos <= errorEndPos) { // error recovery skip(firstTypeDecl, false, false, false); if (token.kind == EOF) @@ -4168,7 +4148,6 @@ public class JavacParser implements Parser { toplevel.docComments = docComments; if (keepLineMap) toplevel.lineMap = S.getLineMap(); - toplevel.endPositions = this.endPosTable; return toplevel; } @@ -4588,7 +4567,7 @@ public class JavacParser implements Parser { hasStructuralErrors = true; } defs.append(enumeratorDeclaration(enumName)); - if (token.pos <= endPosTable.errorEndPos) { + if (token.pos <= errorEndPos) { // error recovery skip(false, true, true, false); } else { @@ -4611,7 +4590,7 @@ public class JavacParser implements Parser { wasError = false; defs.appendList(classOrInterfaceOrRecordBodyDeclaration(null, enumName, false, false)); - if (token.pos <= endPosTable.errorEndPos) { + if (token.pos <= errorEndPos) { // error recovery skip(false, true, true, false); } @@ -4708,7 +4687,7 @@ public class JavacParser implements Parser { */ List classInterfaceOrRecordBody(Name className, boolean isInterface, boolean isRecord) { accept(LBRACE); - if (token.pos <= endPosTable.errorEndPos) { + if (token.pos <= errorEndPos) { // error recovery skip(false, true, false, false); if (token.kind == LBRACE) @@ -4719,7 +4698,7 @@ public class JavacParser implements Parser { ListBuffer defs = new ListBuffer<>(); while (token.kind != RBRACE && token.kind != EOF) { defs.appendList(classOrInterfaceOrRecordBodyDeclaration(null, className, isInterface, isRecord)); - if (token.pos <= endPosTable.errorEndPos) { + if (token.pos <= errorEndPos) { // error recovery skip(false, true, true, false); } @@ -5079,7 +5058,7 @@ public class JavacParser implements Parser { boolean unclosedParameterList; if (!isRecord || name != names.init || token.kind == LPAREN) { params = formalParameters(); - unclosedParameterList = token.pos == endPosTable.errorEndPos; + unclosedParameterList = token.pos == errorEndPos; if (!isVoid) type = bracketsOpt(type); if (token.kind == THROWS) { nextToken(); @@ -5105,7 +5084,7 @@ public class JavacParser implements Parser { defaultValue = null; accept(SEMI, tk -> Errors.Expected2(LBRACE, SEMI)); } - if (token.pos <= endPosTable.errorEndPos) { + if (token.pos <= errorEndPos) { // error recovery // look if there is a probable missing opening brace, // and if yes, parse as a block @@ -5643,70 +5622,4 @@ public class JavacParser implements Parser { unexpectedTopLevelDefinitionStartError = Errors.Expected3(CLASS, INTERFACE, ENUM); } } - - /** - * A straightforward {@link EndPosTable} implementation. - */ - protected static class SimpleEndPosTable extends AbstractEndPosTable { - - private final IntHashTable endPosMap = new IntHashTable(); - - @Override - public T storeEnd(T tree, int endpos) { - endPosMap.put(tree, Math.max(endpos, errorEndPos)); - return tree; - } - - @Override - public int getEndPos(JCTree tree) { - int value = endPosMap.get(tree); - // As long as Position.NOPOS==-1, this just returns value. - return (value == -1) ? Position.NOPOS : value; - } - - @Override - public int replaceTree(JCTree oldTree, JCTree newTree) { - int pos = endPosMap.remove(oldTree); - if (pos != -1 && newTree != null) { - storeEnd(newTree, pos); - } - return pos; - } - } - - /** - * A minimal implementation that only stores what's required. - */ - protected static class MinimalEndPosTable extends SimpleEndPosTable { - - @Override - public T storeEnd(T tree, int endpos) { - switch (tree.getTag()) { - case MODULEDEF: - case PACKAGEDEF: - case CLASSDEF: - case METHODDEF: - case VARDEF: - break; - default: - return tree; - } - return super.storeEnd(tree, endpos); - } - } - - protected abstract static class AbstractEndPosTable implements EndPosTable { - - /** - * Store the last error position. - */ - public int errorEndPos = Position.NOPOS; - - @Override - public void setErrorEndPos(int errPos) { - if (errPos > errorEndPos) { - errorEndPos = errPos; - } - } - } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/ParserFactory.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/ParserFactory.java index f9e187315ba..d06dd2cacda 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/ParserFactory.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/ParserFactory.java @@ -28,7 +28,6 @@ package com.sun.tools.javac.parser; import java.util.Locale; import com.sun.tools.javac.api.JavacTrees; -import com.sun.tools.javac.code.Lint; import com.sun.tools.javac.code.Preview; import com.sun.tools.javac.code.Source; import com.sun.tools.javac.tree.DocTreeMaker; @@ -89,13 +88,9 @@ public class ParserFactory { this.trees = JavacTrees.instance(context); } - public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) { - return newParser(input, keepDocComments, keepEndPos, keepLineMap, false); - } - - public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap, boolean parseModuleInfo) { + public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepLineMap, boolean parseModuleInfo) { Lexer lexer = scannerFactory.newScanner(input, keepDocComments); - return new JavacParser(this, lexer, keepDocComments, keepLineMap, keepEndPos, parseModuleInfo); + return new JavacParser(this, lexer, keepDocComments, keepLineMap, parseModuleInfo); } public JavacTrees getTrees() { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java index 7aaf035fd36..bcc9ccd0113 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java @@ -55,7 +55,7 @@ import com.sun.tools.javac.util.StringUtils; * deletion without notice. */ @SupportedAnnotationTypes("*") -@SupportedSourceVersion(SourceVersion.RELEASE_26) +@SupportedSourceVersion(SourceVersion.RELEASE_27) public class PrintingProcessor extends AbstractProcessor { PrintWriter writer; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index 95a7546e2b3..bb81916becb 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 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 @@ -1476,6 +1476,26 @@ compiler.err.not.exhaustive=\ compiler.err.not.exhaustive.statement=\ the switch statement does not cover all possible input values +compiler.err.not.exhaustive.details=\ + the switch expression does not cover all possible input values\n\ + missing patterns: + +compiler.err.not.exhaustive.statement.details=\ + the switch statement does not cover all possible input values\n\ + missing patterns: + +# 0: type +compiler.misc.binding.pattern=\ + {0} _ + +# 0: type, 1: list of diagnostic +compiler.misc.record.pattern=\ + {0}({1}) + +# 0: type, 1: name +compiler.misc.enum.constant.pattern=\ + {0}.{1} + compiler.err.initializer.must.be.able.to.complete.normally=\ initializer must be able to complete normally @@ -1701,6 +1721,17 @@ compiler.note.mref.stat.1=\ alternate metafactory = {0}\n\ bridge method = {1} +# 0: string, 1: string, 2: string, 3: number, 4: string, 5: string, 6: string +compiler.note.lambda.deserialization.stat=\ + Generating lambda deserialization\n\ + functionalInterfaceClass: {0}\n\ + functionalInterfaceMethodName: {1}\n\ + functionalInterfaceMethodSignature:{2}\n\ + implMethodKind: {3}\n\ + implClass: {4}\n\ + implMethodName: {5}\n\ + implMethodSignature: {6} + compiler.note.note=\ Note:\u0020 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties index 0787c839cb4..b8fa413adba 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties @@ -292,10 +292,10 @@ compiler.err.annotation.decl.not.allowed.here=Annotationsschnittstellendeklarati compiler.err.cant.inherit.from.final=Erben aus finalem {0}-Element nicht möglich # 0: symbol or name -compiler.err.cant.ref.before.ctor.called={0} kann nicht referenziert werden, bevor der Supertypkonstruktor aufgerufen wurde +compiler.err.cant.ref.before.ctor.called=Referenz zu {0} darf nur nach einem expliziten Konstruktoraufruf angezeigt werden # 0: symbol or name -compiler.err.cant.assign.initialized.before.ctor.called=Initialisiertes Feld "{0}" kann nicht zugewiesen werden, bevor der Supertypkonstruktor aufgerufen wurde +compiler.err.cant.assign.initialized.before.ctor.called=Zuweisung zu initialisiertem Feld "{0}" darf nur nach einem expliziten Konstruktoraufruf angezeigt werden compiler.err.cant.select.static.class.from.param.type=Statische Klasse kann nicht aus einem parametrisierten Typ ausgewählt werden @@ -649,11 +649,14 @@ compiler.err.limit.string.overflow=UTF8-Darstellung für Zeichenfolge "{0}..." i compiler.err.malformed.fp.lit=Nicht wohlgeformtes Gleitkommaliteral -compiler.err.method.does.not.override.superclass=Methode überschreibt oder implementiert keine Methode aus einem Supertyp +# 0: symbol, 1: symbol +compiler.err.method.does.not.override.superclass={0} in {1} überschreibt oder implementiert keine Methode aus einem Supertyp -compiler.err.static.methods.cannot.be.annotated.with.override=Statische Methoden können nicht mit @Override-Annotation versehen werden +# 0: symbol, 1: symbol +compiler.err.static.methods.cannot.be.annotated.with.override=Statische Methode {0} in {1} kann nicht mit @Override-Annotation versehen werden -compiler.err.missing.meth.body.or.decl.abstract=Methodenbody fehlt oder als abstrakt deklarieren +# 0: symbol, 1: symbol +compiler.err.missing.meth.body.or.decl.abstract=In Methode {0} in {1} fehlt ein Methodenbody, oder sie muss als abstrakt deklariert werden compiler.err.missing.ret.stmt=Rückgabeanweisung fehlt @@ -1139,6 +1142,7 @@ compiler.err.multi-module.outdir.cannot.be.exploded.module=Im Modus für mehrere # 0: path # lint: path +# flags: default-enabled compiler.warn.outdir.is.in.exploded.module=Das Ausgabeverzeichnis befindet sich in einem entpackten Modul: {0} # 0: file object @@ -1198,6 +1202,7 @@ compiler.warn.output.file.clash=Ausgabedatei mehrmals geschrieben: {0} ## The following string will appear before all messages keyed as: ## "compiler.note". +# flags: mandatory compiler.note.compressed.diags=Einige Meldungen wurden vereinfacht. Wiederholen Sie die Kompilierung mit -Xdiags:verbose, um die vollständige Ausgabe abzurufen # 0: boolean, 1: symbol @@ -1378,17 +1383,17 @@ compiler.warn.incubating.modules=Inkubatormodul(e) verwendet: {0} # 0: symbol, 1: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated={0} in {1} ist veraltet # 0: symbol, 1: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal={0} in {1} ist veraltet und wurde zum Entfernen markiert # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview={0} ist eine Vorschau-API, die in einem zukünftigen Release entfernt werden kann. # 0: symbol @@ -1396,7 +1401,7 @@ compiler.err.is.preview={0} ist eine Vorschau-API, die standardmäßig deaktivie # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview.reflective={0} ist eine reflektive Vorschau-API, die in einem zukünftigen Release entfernt werden kann. # 0: symbol, 1: symbol @@ -1405,12 +1410,12 @@ compiler.warn.restricted.method={0}.{1} ist eine eingeschränkte Methode.\n(Eing # 0: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.module=Modul {0} ist veraltet # 0: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal.module=Modul {0} ist veraltet und wurde zum Entfernen markiert # 0: symbol @@ -1583,10 +1588,12 @@ compiler.warn.static.not.qualified.by.type2={0} (statisch) darf nicht als Member # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.bootclasspath=Bootstrap Classpath ist nicht zusammen mit -source {0} festgelegt\n{1} # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.system.modules.path=Systemmodulpfad ist nicht zusammen mit -source {0} festgelegt\n{1} # 0: string @@ -1603,10 +1610,12 @@ compiler.misc.source.no.system.modules.path.with.target=Wenn Sie den Speicherort # 0: string # lint: options +# flags: default-enabled compiler.warn.option.obsolete.source=Quellwert {0} ist veraltet und wird in einem zukünftigen Release entfernt # 0: target # lint: options +# flags: default-enabled compiler.warn.option.obsolete.target=Zielwert {0} ist veraltet und wird in einem zukünftigen Release entfernt # 0: string, 1: string @@ -1616,12 +1625,17 @@ compiler.err.option.removed.source=Quelloption {0} wird nicht mehr unterstützt. compiler.err.option.removed.target=Zieloption {0} wird nicht mehr unterstützt. Verwenden Sie {1} oder höher. # lint: options +# flags: default-enabled compiler.warn.option.obsolete.suppression=Verwenden Sie -Xlint:-options, um Warnungen zu veralteten Optionen zu unterdrücken. # 0: name, 1: number, 2: number, 3: number, 4: number # lint: classfile compiler.warn.future.attr={0}-Attribut, das in Klassendateien der Version {1}.{2} eingeführt wurde, wird in Klassendateien der Version {3}.{4} ignoriert +# 0: symbol, 1: file object +# lint: classfile +compiler.warn.inconsistent.inner.classes=InnerClasses-Attribut für {0} in {1} inkonsistent mit Quellcode\n({1} muss möglicherweise mit {0} neu kompiliert werden) + # lint: requires-automatic compiler.warn.requires.automatic=Erfordert Direktive für ein automatisches Modul @@ -1706,17 +1720,21 @@ compiler.warn.try.resource.not.referenced=Automatisch schließbare Ressource {0} # lint: try compiler.warn.try.resource.throws.interrupted.exc=Automatisch schließbare Ressource {0} umfasst die Mitgliedsmethode close(), die InterruptedException auslösen könnte +# 0: type +# lint: try +compiler.warn.try.resource.can.throw.interrupted.exc=close()-Methode kann InterruptedException in automatisch schließbarer Klasse {0} auslösen + # lint: unchecked compiler.warn.unchecked.assign=Nicht geprüfte Zuweisung: {0} zu {1} # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.assign.to.var=Nicht geprüfte Zuweisung zu Variable {0} als Mitglied des Raw-Typs {1} # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.call.mbr.of.raw.type=Nicht geprüfter Aufruf von {0} als Mitglied des Raw-Typs {1} # lint: unchecked @@ -1724,17 +1742,17 @@ compiler.warn.unchecked.cast.to.type=Nicht geprüftes Casting zu Typ {0} # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.meth.invocation.applied=Nicht geprüfter Methodenaufruf: {0} {1} in {4} {5} wird auf die angegebenen Typen angewendet\nErforderlich: {2}\nErmittelt: {3} # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.generic.array.creation=Nicht geprüfte Erstellung eines generischen Arrays für varargs-Parameter des Typs {0} # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.varargs.non.reifiable.type=Möglich Heap-Beschädigung aus parametrisiertem vararg-Typ {0} # 0: symbol @@ -1772,6 +1790,10 @@ compiler.err.no.zipfs.for.archive=Kein Dateisystemprovider zur Verarbeitung dies # lint: divzero compiler.warn.div.zero=Division durch Null +# 0: type, 1: long, 2: number +# lint: lossy-conversions +compiler.warn.bit.shift.out.of.range=Das Verschieben von {0} um {1} Bit entspricht einer Verschiebung um {2} Bit + # lint: empty compiler.warn.empty.if=Leere Anweisung nach "if" @@ -2023,7 +2045,7 @@ compiler.misc.prob.found.req=Inkompatible Typen: {0} # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.prob.found.req={0}\nErforderlich: {2}\nErmittelt: {1} # 0: type, 1: type @@ -2297,12 +2319,12 @@ compiler.err.override.incompatible.ret={0}\nRückgabetyp {1} ist nicht mit {2} k # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.ret={0}\nRückgabetyp erfordert eine nicht geprüfte Konvertierung von {1} in {2} # 0: message segment, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.thrown={0}\nAußer Kraft gesetzte Methode löst nicht {1} aus # 0: symbol @@ -2377,16 +2399,17 @@ compiler.err.preview.feature.disabled.classfile=Klassendatei für {0} verwendet # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use={0} ist ein Vorschaufeature, das in einem zukünftigen Release entfernt werden kann. # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use.plural={0} sind ein Vorschaufeature, das in einem zukünftigen Release entfernt werden kann. # 0: file object (classfile), 1: string (expected version) # lint: preview +# flags: mandatory compiler.warn.preview.feature.use.classfile=Klassendatei für {0} verwendet Vorschaufeatures von Java SE {1}. compiler.misc.feature.modules=Module @@ -2783,6 +2806,7 @@ compiler.err.bad.name.for.option=Ungültiger Name im Wert für {0}-Option: "{1}" # 0: option name, 1: symbol # lint: options +# flags: default-enabled compiler.warn.module.for.option.not.found=Modulname in {0}-Option nicht gefunden: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATH kann nur beim Kompilieren des unbenannten Moduls oder beim Kompilieren im Kontext eines automatischen Moduls verwendet werden @@ -2794,6 +2818,7 @@ compiler.err.add.exports.with.release=Export eines Packages aus Systemmodul {0} compiler.err.add.reads.with.release=Hinzufügen von Lese-Edges für Systemmodul {0} ist mit --release nicht zulässig # lint: options +# flags: default-enabled compiler.warn.addopens.ignored=--add-opens hat zur Kompilierungszeit keine Auswirkungen compiler.misc.locn.module_source_path=Modulquellpfad @@ -3060,7 +3085,7 @@ compiler.err.incorrect.number.of.nested.patterns=Falsche Anzahl verschachtelter # 0: kind name, 1: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.declared.using.preview={0} {1} ist mit einem Vorschaufeature deklariert, das in einem zukünftigen Release entfernt werden kann. # lint: identity diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties index 291d8aeeec5..89bdc893a43 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties @@ -292,10 +292,10 @@ compiler.err.annotation.decl.not.allowed.here=ここでは注釈インタフェ compiler.err.cant.inherit.from.final=final {0}からは継承できません # 0: symbol or name -compiler.err.cant.ref.before.ctor.called=スーパータイプのコンストラクタの呼出し前は{0}を参照できません +compiler.err.cant.ref.before.ctor.called={0}への参照は、明示的なコンストラクタの呼出しの後にのみ表示されます # 0: symbol or name -compiler.err.cant.assign.initialized.before.ctor.called=スーパータイプのコンストラクタの呼出し前は、初期化されたフィールド''{0}''を割り当てられません +compiler.err.cant.assign.initialized.before.ctor.called=初期化されたフィールド''{0}''への割当ては、明示的なコンストラクタの呼出しの後にのみ表示されます compiler.err.cant.select.static.class.from.param.type=パラメータにされた型からstaticクラスを選択することはできません @@ -649,11 +649,14 @@ compiler.err.limit.string.overflow=文字列"{0}..."のUTF8表現が、定数プ compiler.err.malformed.fp.lit=浮動小数点リテラルが不正です -compiler.err.method.does.not.override.superclass=メソッドはスーパータイプのメソッドをオーバーライドまたは実装しません +# 0: symbol, 1: symbol +compiler.err.method.does.not.override.superclass={1}の{0}はスーパータイプのメソッドをオーバーライドまたは実装しません -compiler.err.static.methods.cannot.be.annotated.with.override=staticメソッドは@Overrideで注釈付けすることはできません +# 0: symbol, 1: symbol +compiler.err.static.methods.cannot.be.annotated.with.override={1}のstaticメソッド{0}は@Overrideで注釈付けすることはできません -compiler.err.missing.meth.body.or.decl.abstract=メソッド本体がないか、abstractとして宣言されています +# 0: symbol, 1: symbol +compiler.err.missing.meth.body.or.decl.abstract={1}のメソッド{0}にメソッド本体がないか、abstractを宣言する必要があります compiler.err.missing.ret.stmt=return文が指定されていません @@ -1139,6 +1142,7 @@ compiler.err.multi-module.outdir.cannot.be.exploded.module=複数モジュール # 0: path # lint: path +# flags: default-enabled compiler.warn.outdir.is.in.exploded.module=出力ディレクトリは展開したモジュール内です: {0} # 0: file object @@ -1198,6 +1202,7 @@ compiler.warn.output.file.clash=出力ファイルへの書込みが複数回あ ## The following string will appear before all messages keyed as: ## "compiler.note". +# flags: mandatory compiler.note.compressed.diags=一部のメッセージは簡略化されています。-Xdiags:verboseで再コンパイルして完全な出力を取得してください # 0: boolean, 1: symbol @@ -1378,17 +1383,17 @@ compiler.warn.incubating.modules=実験的なモジュールを使用してい # 0: symbol, 1: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated={1}の{0}は推奨されません # 0: symbol, 1: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal={1}の{0}は推奨されておらず、削除用にマークされています # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview={0}はプレビューAPIであり、今後のリリースで削除される可能性があります。 # 0: symbol @@ -1396,7 +1401,7 @@ compiler.err.is.preview={0}はプレビューAPIであり、デフォルトで # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview.reflective={0}はリフレクティブ・プレビューAPIであり、今後のリリースで削除される可能性があります。 # 0: symbol, 1: symbol @@ -1405,12 +1410,12 @@ compiler.warn.restricted.method={0}.{1}は制限されたメソッドです。\n # 0: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.module=モジュール{0}は推奨されません # 0: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal.module=モジュール{0}は推奨されておらず、削除用にマークされています # 0: symbol @@ -1583,10 +1588,12 @@ compiler.warn.static.not.qualified.by.type2=static {0}を匿名クラスのメ # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.bootclasspath=ブートストラップ・クラス・パスが-source {0}と一緒に設定されていません\n{1} # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.system.modules.path=システム・モジュールの場所が-source {0}と一緒に設定されていません\n{1} # 0: string @@ -1603,10 +1610,12 @@ compiler.misc.source.no.system.modules.path.with.target=システム・モジュ # 0: string # lint: options +# flags: default-enabled compiler.warn.option.obsolete.source=ソース値{0}は廃止されていて、今後のリリースで削除される予定です # 0: target # lint: options +# flags: default-enabled compiler.warn.option.obsolete.target=ターゲット値{0}は廃止されていて、今後のリリースで削除される予定です # 0: string, 1: string @@ -1616,12 +1625,17 @@ compiler.err.option.removed.source=ソース・オプション{0}は現在サポ compiler.err.option.removed.target=ターゲット・オプション{0}は現在サポートされていません。{1}以降を使用してください。 # lint: options +# flags: default-enabled compiler.warn.option.obsolete.suppression=廃止されたオプションについての警告を表示しないようにするには、-Xlint:オプションを使用します。 # 0: name, 1: number, 2: number, 3: number, 4: number # lint: classfile compiler.warn.future.attr=バージョン{1}.{2}のクラス・ファイルで導入された{0}属性は、バージョン{3}.{4}のクラス・ファイルでは無視されます +# 0: symbol, 1: file object +# lint: classfile +compiler.warn.inconsistent.inner.classes={1}の{0}のInnerClasses属性はソース・コードと一貫性がありません\n({1}は{0}で再コンパイルする必要がある場合があります) + # lint: requires-automatic compiler.warn.requires.automatic=自動モジュールにはディレクティブが必要です @@ -1706,17 +1720,21 @@ compiler.warn.try.resource.not.referenced=自動クローズ可能なリソー # lint: try compiler.warn.try.resource.throws.interrupted.exc=自動クローズ可能なリソース{0}に、InterruptedExceptionをスローする可能性があるメンバー・メソッドclose()があります +# 0: type +# lint: try +compiler.warn.try.resource.can.throw.interrupted.exc=close()メソッドは、自動クローズ可能なクラス{0}でInterruptedExceptionをスローできます + # lint: unchecked compiler.warn.unchecked.assign={0}から{1}への無検査代入です # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.assign.to.var=raw型{1}のメンバーとして変数{0}への無検査代入です # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.call.mbr.of.raw.type=raw型{1}のメンバーとしての{0}への無検査呼出しです # lint: unchecked @@ -1724,17 +1742,17 @@ compiler.warn.unchecked.cast.to.type=型{0}への無検査キャストです # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.meth.invocation.applied=無検査メソッド呼出し: {4} {5}の{0} {1}は指定された型に適用されます\n期待値: {2}\n検出値: {3} # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.generic.array.creation=型{0}の可変引数パラメータに対する総称型配列の無検査作成です # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.varargs.non.reifiable.type=パラメータ化された可変引数型{0}からのヒープ汚染の可能性があります # 0: symbol @@ -1772,6 +1790,10 @@ compiler.err.no.zipfs.for.archive=このファイルの処理に使用できる # lint: divzero compiler.warn.div.zero=ゼロで除算 +# 0: type, 1: long, 2: number +# lint: lossy-conversions +compiler.warn.bit.shift.out.of.range={0}を{1}ビットでシフトすることは、{2}ビットでシフトすることと同等です + # lint: empty compiler.warn.empty.if=if以降が空の文です @@ -2023,7 +2045,7 @@ compiler.misc.prob.found.req=不適合な型: {0} # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.prob.found.req={0}\n期待値: {2}\n検出値: {1} # 0: type, 1: type @@ -2297,12 +2319,12 @@ compiler.err.override.incompatible.ret={0}\n戻り値の型{1}は{2}と互換性 # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.ret={0}\n戻り値の型は{1}から{2}への無検査変換が必要です # 0: message segment, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.thrown={0}\nオーバーライドされたメソッドは{1}をスローしません # 0: symbol @@ -2377,16 +2399,17 @@ compiler.err.preview.feature.disabled.classfile={0}のクラス・ファイル # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use={0}はプレビュー機能であり、今後のリリースで削除される可能性があります。 # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use.plural={0}はプレビュー機能であり、今後のリリースで削除される可能性があります。 # 0: file object (classfile), 1: string (expected version) # lint: preview +# flags: mandatory compiler.warn.preview.feature.use.classfile={0}のクラス・ファイルはJava SE {1}のプレビュー機能を使用します。 compiler.misc.feature.modules=モジュール @@ -2783,6 +2806,7 @@ compiler.err.bad.name.for.option={0}オプションの値に含まれる名前 # 0: option name, 1: symbol # lint: options +# flags: default-enabled compiler.warn.module.for.option.not.found={0}オプション内にモジュール名が見つかりません: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATHは、名前のないモジュールのコンパイル時または自動モジュールのコンテキストでのコンパイル時のみ使用できます @@ -2794,6 +2818,7 @@ compiler.err.add.exports.with.release=システム・モジュール{0}からの compiler.err.add.reads.with.release=システム・モジュール{0}の読取りエッジの追加は--releaseを指定して実行できません # lint: options +# flags: default-enabled compiler.warn.addopens.ignored=--add-opensは、コンパイル時には無効です compiler.misc.locn.module_source_path=モジュール・ソース・パス @@ -3060,7 +3085,7 @@ compiler.err.incorrect.number.of.nested.patterns=ネスト・パターンの数 # 0: kind name, 1: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.declared.using.preview={0} {1}はプレビュー機能を使用して宣言されており、今後のリリースで削除される可能性があります。 # lint: identity diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties index 268ce26bd49..900557a29da 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties @@ -292,10 +292,10 @@ compiler.err.annotation.decl.not.allowed.here=此处不允许批注接口声明 compiler.err.cant.inherit.from.final=无法从最终{0}进行继承 # 0: symbol or name -compiler.err.cant.ref.before.ctor.called=无法在调用超类型构造器之前引用{0} +compiler.err.cant.ref.before.ctor.called=对 {0} 的引用只能在显式调用构造器后出现 # 0: symbol or name -compiler.err.cant.assign.initialized.before.ctor.called=无法在调用超类型构造器之前分配初始化字段 ''{0}'' +compiler.err.cant.assign.initialized.before.ctor.called=对初始化字段 ''{0}'' 的分配只能在显式调用构造器后显示 compiler.err.cant.select.static.class.from.param.type=无法从参数化的类型中选择静态类 @@ -649,11 +649,14 @@ compiler.err.limit.string.overflow=对于常量池来说, 字符串 "{0}..." 的 compiler.err.malformed.fp.lit=浮点文字的格式错误 -compiler.err.method.does.not.override.superclass=方法不会覆盖或实现超类型的方法 +# 0: symbol, 1: symbol +compiler.err.method.does.not.override.superclass={1} 中的 {0} 不会覆盖或实现超类型中的方法 -compiler.err.static.methods.cannot.be.annotated.with.override=不能使用 @Override 对静态方法进行批注 +# 0: symbol, 1: symbol +compiler.err.static.methods.cannot.be.annotated.with.override=不能使用 @Override 对 {1} 中的静态方法 {0} 进行批注 -compiler.err.missing.meth.body.or.decl.abstract=缺少方法主体, 或声明抽象 +# 0: symbol, 1: symbol +compiler.err.missing.meth.body.or.decl.abstract={1} 中的方法 {0} 缺少方法主体,或者应声明为抽象方法 compiler.err.missing.ret.stmt=缺少返回语句 @@ -1139,6 +1142,7 @@ compiler.err.multi-module.outdir.cannot.be.exploded.module=在多模块模式下 # 0: path # lint: path +# flags: default-enabled compiler.warn.outdir.is.in.exploded.module=输出目录位于展开的模块中: {0} # 0: file object @@ -1198,6 +1202,7 @@ compiler.warn.output.file.clash=多次写入输出文件:{0} ## The following string will appear before all messages keyed as: ## "compiler.note". +# flags: mandatory compiler.note.compressed.diags=某些消息已经过简化; 请使用 -Xdiags:verbose 重新编译以获得完整输出 # 0: boolean, 1: symbol @@ -1378,17 +1383,17 @@ compiler.warn.incubating.modules=使用 incubating 模块: {0} # 0: symbol, 1: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated={1}中的{0}已过时 # 0: symbol, 1: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal={1} 中的 {0} 已过时, 且标记为待删除 # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview={0} 是预览 API,可能会在未来发行版中删除。 # 0: symbol @@ -1396,7 +1401,7 @@ compiler.err.is.preview={0} 是预览 API,默认情况下处于禁用状态。 # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview.reflective={0} 是反射预览 API,可能会在未来发行版中删除。 # 0: symbol, 1: symbol @@ -1405,12 +1410,12 @@ compiler.warn.restricted.method={0}.{1} 是受限制的方法。\n(受限制 # 0: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.module=模块 {0} 已过时 # 0: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal.module=模块 {0} 已过时, 且标记为待删除 # 0: symbol @@ -1583,10 +1588,12 @@ compiler.warn.static.not.qualified.by.type2=static {0} 不应用作匿名类的 # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.bootclasspath=未与 -source {0} 一起设置引导类路径\n{1} # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.system.modules.path=未与 -source {0} 一起设置系统模块的位置\n{1} # 0: string @@ -1603,10 +1610,12 @@ compiler.misc.source.no.system.modules.path.with.target=不设置系统模块的 # 0: string # lint: options +# flags: default-enabled compiler.warn.option.obsolete.source=源值 {0} 已过时,将在未来发行版中删除 # 0: target # lint: options +# flags: default-enabled compiler.warn.option.obsolete.target=目标值 {0} 已过时,将在未来发行版中删除 # 0: string, 1: string @@ -1616,12 +1625,17 @@ compiler.err.option.removed.source=不再支持源选项 {0}。请使用 {1} 或 compiler.err.option.removed.target=不再支持目标选项 {0}。请使用 {1} 或更高版本。 # lint: options +# flags: default-enabled compiler.warn.option.obsolete.suppression=要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。 # 0: name, 1: number, 2: number, 3: number, 4: number # lint: classfile compiler.warn.future.attr={1}.{2} 版类文件中引入的 {0} 属性在 {3}.{4} 版类文件中被忽略 +# 0: symbol, 1: file object +# lint: classfile +compiler.warn.inconsistent.inner.classes={1} 中 {0} 的 InnerClasses 属性与源代码不一致\n(可能需要使用 {0} 重新编译 {1}) + # lint: requires-automatic compiler.warn.requires.automatic=需要自动模块的指令 @@ -1706,17 +1720,21 @@ compiler.warn.try.resource.not.referenced=不能在相应的 try 语句的正文 # lint: try compiler.warn.try.resource.throws.interrupted.exc=可自动关闭的资源{0}包含的成员方法 close() 可能抛出 InterruptedException +# 0: type +# lint: try +compiler.warn.try.resource.can.throw.interrupted.exc=在可自动关闭的类 {0} 中,close() 方法可能抛出 InterruptedException + # lint: unchecked compiler.warn.unchecked.assign=未经检查的分配: 将{0}分配给{1} # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.assign.to.var=对作为原始类型{1}的成员的变量{0}的分配未经过检查 # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.call.mbr.of.raw.type=对作为原始类型{1}的成员的{0}的调用未经过检查 # lint: unchecked @@ -1724,17 +1742,17 @@ compiler.warn.unchecked.cast.to.type=向类型{0}的转换未经过检查 # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.meth.invocation.applied=方法调用未经过检查: 将{4} {5}中的{0} {1}应用到给定的类型\n需要: {2}\n找到: {3} # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.generic.array.creation=对于类型为{0}的 varargs 参数, 泛型数组创建未经过检查 # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.varargs.non.reifiable.type=参数化 vararg 类型{0}的堆可能已受污染 # 0: symbol @@ -1772,6 +1790,10 @@ compiler.err.no.zipfs.for.archive=没有任何文件系统提供方可处理此 # lint: divzero compiler.warn.div.zero=除数为零 +# 0: type, 1: long, 2: number +# lint: lossy-conversions +compiler.warn.bit.shift.out.of.range=按 {1} 位移动 {0} 相当于按 {2} 位移动 + # lint: empty compiler.warn.empty.if=if 之后没有语句 @@ -2023,7 +2045,7 @@ compiler.misc.prob.found.req=不兼容的类型: {0} # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.prob.found.req={0}\n需要: {2}\n找到: {1} # 0: type, 1: type @@ -2297,12 +2319,12 @@ compiler.err.override.incompatible.ret={0}\n返回类型{1}与{2}不兼容 # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.ret={0}\n返回类型需要从{1}到{2}的未经检查的转换 # 0: message segment, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.thrown={0}\n被覆盖的方法未抛出{1} # 0: symbol @@ -2377,16 +2399,17 @@ compiler.err.preview.feature.disabled.classfile={0} 的类文件使用 Java SE { # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use={0} 是预览功能,可能会在未来发行版中删除。 # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use.plural={0} 是预览功能,可能会在未来发行版中删除。 # 0: file object (classfile), 1: string (expected version) # lint: preview +# flags: mandatory compiler.warn.preview.feature.use.classfile={0} 的类文件使用 Java SE {1} 的预览功能。 compiler.misc.feature.modules=模块 @@ -2783,6 +2806,7 @@ compiler.err.bad.name.for.option={0} 选项的值中有错误的名称: ''{1}'' # 0: option name, 1: symbol # lint: options +# flags: default-enabled compiler.warn.module.for.option.not.found=找不到 {0} 选项中的模块名称: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATH 只能在编译未命名模块或在自动模块的上下文中编译时使用 @@ -2794,6 +2818,7 @@ compiler.err.add.exports.with.release=不允许在使用 --release 时从系统 compiler.err.add.reads.with.release=不允许在使用 --release 时为系统模块 {0} 添加读取维边: # lint: options +# flags: default-enabled compiler.warn.addopens.ignored=--add-opens 在编译时没有任何效果 compiler.misc.locn.module_source_path=模块源路径 @@ -3060,7 +3085,7 @@ compiler.err.incorrect.number.of.nested.patterns=嵌套模式数不正确\n需 # 0: kind name, 1: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.declared.using.preview={0} {1} 是使用预览功能声明的,可能会在未来发行版中删除。 # lint: identity diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties index d5ee9469d22..7824772b1f3 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties @@ -100,7 +100,8 @@ javac.opt.arg.Werror=\ (,)* javac.opt.Werror.custom=\ Specify lint categories for which warnings should terminate compilation,\n\ - separated by comma. Precede a key by ''-'' to exclude the specified category.\n\ + separated by comma.\n\ + Precede a key by ''-'' to exclude the specified category.\n\ Use --help-lint to see the supported keys. javac.opt.A=\ Options to pass to annotation processors @@ -358,7 +359,8 @@ javac.opt.prefer=\ are found for an implicitly compiled class # L10N: do not localize: ''preview'' javac.opt.preview=\ - Enable preview language features. Also disables the ''preview'' lint category.\n\ + Enable preview language features.\n\ + Also disables the ''preview'' lint category.\n\ To be used in conjunction with either -source or --release. javac.opt.AT=\ Read options and filenames from file diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties index 1a00fad1dd0..b36ad3d00ac 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties @@ -60,6 +60,8 @@ javac.opt.target=Generiert Klassendateien, die sich für das angegebene Java SE- javac.opt.release=Kompiliert für das angegebene Java SE-Release.\nUnterstützte Releases: \n {0} javac.opt.source=Liefert Quellkompatibilität mit dem angegebenen Release von Java SE.\nUnterstützte Releases: \n {0} javac.opt.Werror=Kompilierung beenden, wenn Warnungen auftreten +javac.opt.arg.Werror=(,)* +javac.opt.Werror.custom=Geben Sie Lint-Kategorien, für die die Kompilierung durch Warnungen beendet werden soll,\ndurch Komma getrennt an. \nStellen Sie einem Schlüssel "-" voran, um die angegebene Kategorie auszuschließen. Verwenden Sie --help-lint, um die unterstützten Schlüssel anzuzeigen. javac.opt.A=Optionen zur Übergabe an die Annotationsprozessoren javac.opt.implicit=Gibt an, ob Klassendateien für implizit referenzierte Dateien generiert werden javac.opt.pkginfo=Gibt an, wie package-info-Dateien behandelt werden sollen @@ -97,12 +99,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=Dem Bootstrap Classpath voranstellen javac.opt.Xbootclasspath.a=An Bootstrap Classpath anhängen -javac.opt.Xlint=Empfohlene Warnungskategorien aktivieren -javac.opt.Xlint.all=Alle Warnungskategorien aktivieren -javac.opt.Xlint.none=Alle Warnungskategorien deaktivieren +javac.opt.Xlint=Aktivieren Sie empfohlene Lint-Warnungskategorien. In diesem Release werden alle\nverfügbaren Lint-Warnungskategorien empfohlen. +javac.opt.Xlint.all=Alle Lint-Warnungskategorien aktivieren +javac.opt.Xlint.none=Alle Lint-Warnungskategorien deaktivieren #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=Durch Komma getrennte Warnungskategorien, die aktiviert oder deaktiviert werden sollen.\nStellen Sie einem Schlüssel "-" voran, um die angegebene Warnung zu deaktivieren.\nVerwenden Sie "--help-lint", um die unterstützten Schlüssel anzuzeigen. +javac.opt.Xlint.custom=Lint-Warnungskategorien, die aktiviert oder deaktiviert werden sollen, durch Komma getrennt. \nStellen Sie einem Schlüssel "-" voran, um die angegebene Kategorie zu deaktivieren. Verwenden Sie\n''--help-lint'', um unterstützte Schlüssel und die standardmäßig aktivierten\nKategorien anzuzeigen. javac.opt.Xlint.desc.auxiliaryclass=Warnt vor Auxiliary-Klassen, die in einer Quelldatei verborgen sind und aus anderen Dateien heraus verwendet werden. javac.opt.Xlint.desc.cast=Warnt vor unnötigen Umwandlungen mit Cast. @@ -129,7 +131,7 @@ javac.opt.Xlint.desc.finally=Warnt vor Finally-Klauseln, die nicht normal beende javac.opt.Xlint.desc.incubating=Warnt vor der Verwendung von Inkubatormodulen. -javac.opt.Xlint.desc.lossy-conversions=Warnung über möglichen Verlust von Konvertierungen in zusammengesetzten Zuweisungen. +javac.opt.Xlint.desc.lossy-conversions=Warnung über möglichen Verlust von Konvertierungen in zusammengesetzten Zuweisungen und Bitverschiebungsvorgängen. javac.opt.Xlint.desc.module=Warnt vor Problemen im Zusammenhang mit dem Modulsystem. @@ -175,11 +177,10 @@ javac.opt.Xlint.desc.preview=Warnt vor Verwendung von Vorschausprachfeatures. javac.opt.Xlint.desc.restricted=Warnt vor der Verwendung eingeschränkter Methoden. -# L10N: do not localize: identity synchronization -javac.opt.Xlint.desc.synchronization=Warnt vor Synchronisierungsversuchen mit Instanzen wertbasierter Klassen.\n Dieser Schlüssel ist ein veralteter Alias für die Kategorie "identity", die dieselben Verwendungen und\n Effekte hat. Benutzern wird empfohlen, die Kategorie "identity" für alle zukünftigen\n und vorhandenen Verwendungen von "synchronization" zu verwenden. - javac.opt.Xlint.desc.identity=Warnt vor Verwendungen wertbasierter Klassen, wenn eine Identitätsklasse erwartet wird. +javac.opt.Xlint.alias.of=Veralteter Alias für "{0}" mit identischem Effekt. Benutzern wird empfohlen,\n "{0}" anstatt "{1}" für alle aktuellen und zukünftigen Verwendungen zu nutzen. + javac.opt.Xdoclint=Empfohlene Prüfungen für Probleme in javadoc-Kommentaren aktivieren # L10N: do not localize: all none javac.opt.Xdoclint.subopts = (all|none|[-])[/] @@ -195,14 +196,17 @@ javac.opt.Xdoclint.package.desc=Aktiviert oder deaktiviert Prüfungen in bestimm javac.opt.Xstdout=Leitet die Standardausgabe um javac.opt.X=Gibt Hilfe zu zusätzlichen Optionen aus javac.opt.help=Gibt diese Hilfemeldung aus -javac.opt.help.lint=Gibt die unterstützten Schlüssel für -Xlint aus +javac.opt.help.lint=Gibt die unterstützten Schlüssel für -Xlint und -Werror aus javac.opt.help.lint.header=Die unterstützten Schlüssel für -Xlint sind: +javac.opt.help.lint.enabled.by.default=Die folgenden Lint-Warnungskategorien sind standardmäßig aktiviert: +javac.opt.help.lint.footer=Kategorien und die zugehörigen Aliasnamen können austauschbar verwendet werden. Beispiel: Das Kennzeichen\n"-Xlint:{0},{1}" wäre redundant. javac.opt.print=Gibt eine Textdarstellung der angegebenen Typen aus javac.opt.printRounds=Gibt Informationen zu Durchläufen der Annotationsverarbeitung aus javac.opt.printProcessorInfo=Gibt Informationen dazu aus, welche Annotationen ein Prozessor\nverarbeiten soll javac.opt.userpathsfirst=Durchsucht classpath und sourcepath vor anstatt nach bootclasspath nach Klassen javac.opt.prefer=Gibt an, welche Datei gelesen werden soll, wenn sowohl eine Quell- als auch eine Klassendatei für eine implizit kompilierte Klasse gefunden werden -javac.opt.preview=Aktiviert Vorschausprachfeatures.\nWird in Verbindung mit -source oder --release verwendet. +# L10N: do not localize: ''preview'' +javac.opt.preview=Aktiviert Vorschausprachfeatures. \nDeaktiviert auch die Lint-Kategorie ''preview''. \nWird in Verbindung mit -source oder --release verwendet. javac.opt.AT=Liest Optionen und Dateinamen aus Datei javac.opt.diags=Wählt einen Diagnosemodus aus javac.opt.addExports=Gibt an, dass ein Package als aus seinem definierenden Modul in\nweitere Module oder, wenn ALL-UNNAMED lautet, in alle unbenannten Module\nexportiert betrachtet werden soll. diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties index 3b967d368ae..3ae7ab1690e 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties @@ -59,7 +59,9 @@ javac.opt.profile=使用されているAPIが、指定したプロファイル javac.opt.target=指定されたJava SEリリースに適したクラス・ファイルを生成します。サポートされているリリース: \n {0} javac.opt.release=指定されたJava SEリリースに対してコンパイルします。サポートされているリリース: \n {0} javac.opt.source=指定されたJava SEリリースとソースの互換性を保持します。サポートされているリリース: \n {0} -javac.opt.Werror=警告が発生した場合にコンパイルを終了する +javac.opt.Werror=警告が発生した場合にコンパイルを終了します +javac.opt.arg.Werror=<キー>(,<キー>)* +javac.opt.Werror.custom=コンパイルを終了する警告のlintカテゴリを\nコンマで区切って指定します。\n指定したカテゴリを除外するには、キーの前に''-''を指定します。\nサポートされているキーを表示するには--help-lintを使用します。 javac.opt.A=注釈プロセッサに渡されるオプション javac.opt.implicit=暗黙的に参照されるファイルについてクラス・ファイルを生成するかどうかを指定する javac.opt.pkginfo=package-infoファイルの処理を指定する @@ -97,12 +99,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=ブートストラップ・クラス・パスの先頭に付加する javac.opt.Xbootclasspath.a=ブートストラップ・クラス・パスに追加する -javac.opt.Xlint=推奨の警告カテゴリを有効にします -javac.opt.Xlint.all=すべての警告カテゴリを有効にします -javac.opt.Xlint.none=すべての警告カテゴリを無効にします +javac.opt.Xlint=推奨lint警告カテゴリを有効にします。このリリースでは、\n使用可能なすべてのlint警告カテゴリが推奨されます。 +javac.opt.Xlint.all=すべてのlint警告カテゴリを有効にします +javac.opt.Xlint.none=すべてのlint警告カテゴリを無効にします #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=有効または無効にする警告カテゴリ(カンマ区切り)。\n指定した警告を無効にするには、キーの前に''-''を指定します。\nサポートされているキーを表示するには--help-lintを使用します。 +javac.opt.Xlint.custom=有効または無効にするLint警告カテゴリ(カンマ区切り)。\n指定されたカテゴリを無効にするには、キーの前に''-''を指定します。サポートされているキーと\nデフォルトで有効になっているカテゴリを表示するには、\n''--help-lint''を使用します。 javac.opt.Xlint.desc.auxiliaryclass=ソース・ファイルで非表示になっているが他のファイルから使用されている補助クラスについて警告します。 javac.opt.Xlint.desc.cast=不要なキャストの使用について警告します。 @@ -129,7 +131,7 @@ javac.opt.Xlint.desc.finally=正常に完了しないfinally節について警 javac.opt.Xlint.desc.incubating=実験的なモジュールの使用について警告します。 -javac.opt.Xlint.desc.lossy-conversions=複合代入における精度が失われる可能性がある変換についての警告。 +javac.opt.Xlint.desc.lossy-conversions=複合代入およびビット・シフト操作における精度が失われている可能性がある変換についての警告。 javac.opt.Xlint.desc.module=モジュール・システム関連の問題について警告します。 @@ -175,11 +177,10 @@ javac.opt.Xlint.desc.preview=プレビュー言語機能の使用について警 javac.opt.Xlint.desc.restricted=制限されたメソッドの使用について警告します。 -# L10N: do not localize: identity synchronization -javac.opt.Xlint.desc.synchronization=値ベース・クラスのインスタンスでの同期の試行について警告します。\n このキーは、''identity''の非推奨のエイリアスであり、同じ使用方法と効果を\n 持ちます。ユーザーには、今後および既存の''synchronization''の使用に対して''identity''カテゴリを\n 使用することをお薦めします。 - javac.opt.Xlint.desc.identity=アイデンティティ・クラスが必要な場所での値ベース・クラスの使用について警告します。 +javac.opt.Xlint.alias.of=同じ効果を持つ''{0}''の非推奨の別名。ユーザーは現在および将来のすべての使用で\n ''{1}''のかわりに''{0}''の使用が推奨されます。 + javac.opt.Xdoclint=javadocコメントの問題に関する推奨チェックを有効にします # L10N: do not localize: all none javac.opt.Xdoclint.subopts = (all|none|[-])[/] @@ -195,14 +196,17 @@ javac.opt.Xdoclint.package.desc=特定のパッケージのチェックを有効 javac.opt.Xstdout=標準出力をリダイレクトする javac.opt.X=追加オプションのヘルプを出力します javac.opt.help=このヘルプ・メッセージを出力します -javac.opt.help.lint=-Xlintにサポートされているキーを出力します +javac.opt.help.lint=-Xlintおよび-Werrorにサポートされているキーを出力します javac.opt.help.lint.header=-Xlintにサポートされているキーは次のとおりです: +javac.opt.help.lint.enabled.by.default=次のlint警告カテゴリはデフォルトで有効になっています: +javac.opt.help.lint.footer=カテゴリとその別名は同じ意味で使用できます。たとえば、フラグ\n''-Xlint:{0},{1}''は冗長です。 javac.opt.print=指定した型のテキスト表示を出力する javac.opt.printRounds=注釈処理の往復についての情報を印刷する javac.opt.printProcessorInfo=プロセッサが処理を依頼される注釈についての情報を印刷する javac.opt.userpathsfirst=ブート・クラスパスの後ではなく、ブート・クラスパスの前にクラスのクラスパスおよびソース・パスを検索する javac.opt.prefer=暗黙的にコンパイルされるクラスについて、ソース・ファイルとクラス・ファイルの両方が見つかった際どちらを読み込むか指定する -javac.opt.preview=プレビュー言語機能を有効にします。-sourceまたは--releaseとともに使用されます。 +# L10N: do not localize: ''preview'' +javac.opt.preview=プレビュー言語機能を有効にします。\nまた、''preview'' lintカテゴリも無効にします。\n-sourceまたは--releaseとともに使用されます。 javac.opt.AT=ファイルからの読取りオプションおよびファイル名 javac.opt.diags=診断モードの選択 javac.opt.addExports=がALL-UNNAMEDである場合、その定義モジュールから、追加モジュールまたは\n すべての名前のないモジュールにエクスポート済とみなされるようにパッケージを指定します。 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties index a24b5511c9c..447d0d26239 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties @@ -59,7 +59,9 @@ javac.opt.profile=检查使用的 API 在指定的配置文件中是否可用。 javac.opt.target=生成适合指定的 Java SE 发行版的类文件。支持的发行版:{0} javac.opt.release=为指定的 Java SE 发行版编译。支持的发行版:{0} javac.opt.source=提供与指定的 Java SE 发行版的源兼容性。支持的发行版:{0} -javac.opt.Werror=出现警告时终止编译 +javac.opt.Werror=出现任何警告时终止编译 +javac.opt.arg.Werror=<键>(,<键>)* +javac.opt.Werror.custom=指定出现警告时应终止编译的 lint 类别,\n以逗号分隔。\n在关键字前面加上 ''-'' 可排除指定的类别。\n使用 --help-lint 可查看支持的关键字。 javac.opt.A=传递给批注处理程序的选项 javac.opt.implicit=指定是否为隐式引用文件生成类文件 javac.opt.pkginfo=指定 package-info 文件的处理 @@ -97,12 +99,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=置于引导类路径之前 javac.opt.Xbootclasspath.a=置于引导类路径之后 -javac.opt.Xlint=启用建议的警告类别 -javac.opt.Xlint.all=启用所有警告类别 -javac.opt.Xlint.none=禁用所有警告类别 +javac.opt.Xlint=启用建议的 lint 警告类别。在此发行版中,\n建议使用所有可用的 lint 警告类别。 +javac.opt.Xlint.all=启用所有 lint 警告类别 +javac.opt.Xlint.none=禁用所有 lint 警告类别 #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=要启用或禁用的警告类别(以逗号分隔)。\n在关键字前面加上 ''-'' 可禁用指定的警告。\n使用 --help-lint 可查看受支持的关键字。 +javac.opt.Xlint.custom=要启用或禁用的 lint 警告类别(以逗号分隔)。\n在关键字前面加上 ''-'' 可禁用指定的类别。\n使用 ''--help-lint'' 可显示支持的关键字和\n默认情况下启用的类别。 javac.opt.Xlint.desc.auxiliaryclass=有关辅助类在源文件中隐藏, 但在其他文件中使用的警告。 javac.opt.Xlint.desc.cast=有关使用了不必要转换的警告。 @@ -129,7 +131,7 @@ javac.opt.Xlint.desc.finally=有关 finally 子句未正常终止的警告。 javac.opt.Xlint.desc.incubating=有关使用 incubating 模块的警告。 -javac.opt.Xlint.desc.lossy-conversions=有关复合赋值中的转换可能会有损失的警告。 +javac.opt.Xlint.desc.lossy-conversions=有关复合赋值和移位操作中的转换可能会有损失的警告。 javac.opt.Xlint.desc.module=有关模块系统相关问题的警告。 @@ -175,11 +177,10 @@ javac.opt.Xlint.desc.preview=有关使用预览语言功能的警告。 javac.opt.Xlint.desc.restricted=有关使用受限制方法的警告。 -# L10N: do not localize: identity synchronization -javac.opt.Xlint.desc.synchronization=有关尝试在基于值的类的实例上同步的警告。\n 此密钥是 ''identity'' 的已过时别名,具有相同的用法和\n 效果。建议用户在 ''synchronization'' 的所有未来和现有\n 用法中使用 ''identity'' 类别。 - javac.opt.Xlint.desc.identity=有关在需要身份类的情况下使用基于值的类的警告。 +javac.opt.Xlint.alias.of=具有相同效果的 ''{0}'' 的别名已过时。建议用户当前和将来\n 都使用 ''{0}'' 而不是 ''{1}''。 + javac.opt.Xdoclint=为 javadoc 注释中的问题启用建议的检查 # L10N: do not localize: all none javac.opt.Xdoclint.subopts = (all|none|[-])[/] @@ -195,14 +196,17 @@ javac.opt.Xdoclint.package.desc=在特定的程序包中启用或禁用检查。 javac.opt.Xstdout=重定向标准输出 javac.opt.X=输出额外选项的帮助 javac.opt.help=输出此帮助消息 -javac.opt.help.lint=输出 -Xlint 支持的关键字 +javac.opt.help.lint=输出 -Xlint 和 -Werror 支持的关键字 javac.opt.help.lint.header=-Xlint 支持的关键字包括: +javac.opt.help.lint.enabled.by.default=默认情况下会启用以下 lint 警告类别: +javac.opt.help.lint.footer=类别及其别名可以互换使用;例如,标记\n''-Xlint:{0},{1}'' 将是冗余的。 javac.opt.print=输出指定类型的文本表示 javac.opt.printRounds=输出有关批注处理循环的信息 javac.opt.printProcessorInfo=输出有关请求处理程序处理哪些批注的信息 javac.opt.userpathsfirst=在引导类路径之前而不是之后搜索类的类路径和源路径 javac.opt.prefer=指定读取文件, 当同时找到隐式编译类的源文件和类文件时 -javac.opt.preview=启用预览语言功能。要与 -source 或 --release 一起使用。 +# L10N: do not localize: ''preview'' +javac.opt.preview=启用预览语言功能。\n还禁用''preview''lint 类别。\n要与 -source 或 --release 一起使用。 javac.opt.AT=从文件读取选项和文件名 javac.opt.diags=选择诊断模式 javac.opt.addExports=指定被视为已从其定义模块导出到其他模块或者导出到所有\n 未命名模块 (如果 为 ALL-UNNAMED) 的程序包。 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties index 1edda5da22f..bb0f14ab833 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties @@ -111,6 +111,9 @@ launcher.err.cant.access.main.method=kein Zugriff auf Methode "main" in Klasse: # 0: string launcher.err.cant.find.constructor=No-Argument-Konstruktor nicht gefunden in Klasse: {0} +# 0: string +launcher.err.cant.use.private.constructor=Kein nicht privater Null-Argument-Konstruktor in Klasse {0} gefunden\nEntfernen Sie die Eigenschaft "private" aus dem vorhandenen Konstruktor, oder definieren Sie ihn als:\n public {0}() + # 0: string launcher.err.cant.access.constructor=Kein Zugriff auf No-Argument-Konstruktor in Klasse: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties index be1feb4a8a9..ed940e731bd 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties @@ -111,6 +111,9 @@ launcher.err.cant.access.main.method=クラスのメイン・メソッドにア # 0: string launcher.err.cant.find.constructor=クラスに引数なしのコンストラクタが見つかりません: {0} +# 0: string +launcher.err.cant.use.private.constructor=非privateのゼロ引数コンストラクタがクラス{0}に見つかりません\n既存のコンストラクタからprivateを削除するか、次のように定義してください:\n public {0}() + # 0: string launcher.err.cant.access.constructor=クラスの引数なしのコンストラクタにアクセスできません: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties index 5367036d82f..1fafa95c146 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties @@ -111,6 +111,9 @@ launcher.err.cant.access.main.method=无法访问类 {0} 中的 main 方法 # 0: string launcher.err.cant.find.constructor=在类 {0} 中找不到无参数构造器 +# 0: string +launcher.err.cant.use.private.constructor=在类 {0} 中未找到 non-private 零参数构造器\n请从现有构造器中删除 private,或者定义为:\n public {0}() + # 0: string launcher.err.cant.access.constructor=无法访问类 {0} 中的无参数构造器 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java index a999786f119..023e5c74b3a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DCTree.java @@ -305,7 +305,7 @@ public abstract class DCTree implements DocTree { } @Override - public int getEndPosition(EndPosTable endPosTable) { + public int getEndPosition() { return comment.getSourcePos(end); } }; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/EndPosTable.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/EndPosTable.java deleted file mode 100644 index 83fe402c0a7..00000000000 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/EndPosTable.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javac.tree; - -import com.sun.tools.javac.util.Position; - -/** - * Specifies the methods to access a mappings of syntax trees to end positions. - * - *

- * Implementations must store end positions for at least these node types: - *

    - *
  • {@link JCTree.JCModuleDecl} - *
  • {@link JCTree.JCPackageDecl} - *
  • {@link JCTree.JCClassDecl} - *
  • {@link JCTree.JCMethodDecl} - *
  • {@link JCTree.JCVariableDecl} - *
- * - *

This is NOT part of any supported API. - * If you write code that depends on this, you do so at your own - * risk. This code and its internal interfaces are subject to change - * or deletion without notice.

- */ -public interface EndPosTable { - - /** - * This method will return the end position of a given tree, otherwise a - * Positions.NOPOS will be returned. - * @param tree JCTree - * @return position of the source tree or Positions.NOPOS for non-existent mapping - */ - int getEndPos(JCTree tree); - - /** - * Store ending position for a tree, the value of which is the greater of - * last error position and the given ending position. - * @param tree The tree. - * @param endpos The ending position to associate with the tree. - * @return the {@code tree} - */ - T storeEnd(T tree, int endpos); - - /** - * Set the error position during the parsing phases, the value of which - * will be set only if it is greater than the last stored error position. - * @param errPos The error position - */ - void setErrorEndPos(int errPos); - - /** - * Give an old tree and a new tree, the old tree will be replaced with - * the new tree, the position of the new tree will be that of the old - * tree. - * @param oldtree a JCTree to be replaced - * @param newtree a JCTree to be replaced with, or null to just remove {@code oldtree} - * @return position of the old tree or Positions.NOPOS for non-existent mapping - */ - int replaceTree(JCTree oldtree, JCTree newtree); -} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java index 6501fd5d96c..e0a99a6f103 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java @@ -431,6 +431,10 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition { */ public int pos; + /* The (encoded) end position in the source file. @see util.Position. + */ + public int endpos = Position.NOPOS; + /* The type of this node. */ public Type type; @@ -514,8 +518,8 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition { } // for default DiagnosticPosition - public int getEndPosition(EndPosTable endPosTable) { - return noNoPos(TreeInfo.getEndPos(this, endPosTable)); + public int getEndPosition() { + return noNoPos(TreeInfo.getEndPos(this)); } private int noNoPos(int position) { @@ -552,9 +556,6 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition { /** A table that stores all documentation comments indexed by the tree * nodes they refer to. defined only if option -s is set. */ public DocCommentTable docComments = null; - /* An object encapsulating ending positions of source ranges indexed by - * the tree nodes they belong to. Defined only if option -Xjcov is set. */ - public EndPosTable endPositions = null; protected JCCompilationUnit(List defs) { this.defs = defs; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java index 3f73bfd2296..aa616f3f580 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java @@ -31,7 +31,6 @@ import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Symbol.RecordComponent; -import com.sun.tools.javac.comp.AttrContext; import com.sun.tools.javac.comp.Env; import com.sun.tools.javac.tree.JCTree.*; import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*; @@ -647,18 +646,13 @@ public class TreeInfo { /** The end position of given tree, given a table of end positions generated by the parser */ - public static int getEndPos(JCTree tree, EndPosTable endPosTable) { + public static int getEndPos(JCTree tree) { if (tree == null) return Position.NOPOS; - if (endPosTable == null) { - // fall back on limited info in the tree - return endPos(tree); - } - - int mapPos = endPosTable.getEndPos(tree); - if (mapPos != Position.NOPOS) - return mapPos; + int endpos = tree.endpos; + if (endpos != Position.NOPOS) + return endpos; switch(tree.getTag()) { case BITOR_ASG: case BITXOR_ASG: case BITAND_ASG: @@ -678,57 +672,57 @@ public class TreeInfo { case COMPL: case PREINC: case PREDEC: - return getEndPos(((JCOperatorExpression) tree).getOperand(RIGHT), endPosTable); + return getEndPos(((JCOperatorExpression) tree).getOperand(RIGHT)); case CASE: - return getEndPos(((JCCase) tree).stats.last(), endPosTable); + return getEndPos(((JCCase) tree).stats.last()); case CATCH: - return getEndPos(((JCCatch) tree).body, endPosTable); + return getEndPos(((JCCatch) tree).body); case CONDEXPR: - return getEndPos(((JCConditional) tree).falsepart, endPosTable); + return getEndPos(((JCConditional) tree).falsepart); case FORLOOP: - return getEndPos(((JCForLoop) tree).body, endPosTable); + return getEndPos(((JCForLoop) tree).body); case FOREACHLOOP: - return getEndPos(((JCEnhancedForLoop) tree).body, endPosTable); + return getEndPos(((JCEnhancedForLoop) tree).body); case IF: { JCIf node = (JCIf)tree; if (node.elsepart == null) { - return getEndPos(node.thenpart, endPosTable); + return getEndPos(node.thenpart); } else { - return getEndPos(node.elsepart, endPosTable); + return getEndPos(node.elsepart); } } case LABELLED: - return getEndPos(((JCLabeledStatement) tree).body, endPosTable); + return getEndPos(((JCLabeledStatement) tree).body); case MODIFIERS: - return getEndPos(((JCModifiers) tree).annotations.last(), endPosTable); + return getEndPos(((JCModifiers) tree).annotations.last()); case SYNCHRONIZED: - return getEndPos(((JCSynchronized) tree).body, endPosTable); + return getEndPos(((JCSynchronized) tree).body); case TOPLEVEL: - return getEndPos(((JCCompilationUnit) tree).defs.last(), endPosTable); + return getEndPos(((JCCompilationUnit) tree).defs.last()); case TRY: { JCTry node = (JCTry)tree; if (node.finalizer != null) { - return getEndPos(node.finalizer, endPosTable); + return getEndPos(node.finalizer); } else if (!node.catchers.isEmpty()) { - return getEndPos(node.catchers.last(), endPosTable); + return getEndPos(node.catchers.last()); } else { - return getEndPos(node.body, endPosTable); + return getEndPos(node.body); } } case WILDCARD: - return getEndPos(((JCWildcard) tree).inner, endPosTable); + return getEndPos(((JCWildcard) tree).inner); case TYPECAST: - return getEndPos(((JCTypeCast) tree).expr, endPosTable); + return getEndPos(((JCTypeCast) tree).expr); case TYPETEST: - return getEndPos(((JCInstanceOf) tree).pattern, endPosTable); + return getEndPos(((JCInstanceOf) tree).pattern); case WHILELOOP: - return getEndPos(((JCWhileLoop) tree).body, endPosTable); + return getEndPos(((JCWhileLoop) tree).body); case ANNOTATED_TYPE: - return getEndPos(((JCAnnotatedType) tree).underlyingType, endPosTable); + return getEndPos(((JCAnnotatedType) tree).underlyingType); case ERRONEOUS: { JCErroneous node = (JCErroneous)tree; if (node.errs != null && node.errs.nonEmpty()) - return getEndPos(node.errs.last(), endPosTable); + return getEndPos(node.errs.last()); } } return Position.NOPOS; @@ -745,8 +739,8 @@ public class TreeInfo { public JCTree getTree() { return tree; } public int getStartPosition() { return TreeInfo.getStartPos(tree); } public int getPreferredPosition() { return endPos; } - public int getEndPosition(EndPosTable endPosTable) { - return TreeInfo.getEndPos(tree, endPosTable); + public int getEndPosition() { + return TreeInfo.getEndPos(tree); } }; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/DiagnosticSource.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/DiagnosticSource.java index baae3101811..3339900733f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/DiagnosticSource.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/DiagnosticSource.java @@ -31,7 +31,6 @@ import java.nio.CharBuffer; import javax.tools.JavaFileObject; import com.sun.tools.javac.file.JavacFileManager; -import com.sun.tools.javac.tree.EndPosTable; import static com.sun.tools.javac.util.LayoutCharacters.*; @@ -127,16 +126,6 @@ public class DiagnosticSource { } } - public EndPosTable getEndPosTable() { - return endPosTable; - } - - public void setEndPosTable(EndPosTable t) { - if (endPosTable != null && endPosTable != t) - throw new IllegalStateException("endPosTable already set"); - endPosTable = t; - } - /** Find the line in the buffer that contains the current position * @param pos Character offset into the buffer */ @@ -197,8 +186,6 @@ public class DiagnosticSource { /** The underlying file object. */ protected JavaFileObject fileObject; - protected EndPosTable endPosTable; - /** A soft reference to the content of the file object. */ protected SoftReference refBuf; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java deleted file mode 100644 index 409dc703d60..00000000000 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/IntHashTable.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.javac.util; - -/** - * A hash table that maps Object to int. - * - * This is a custom hash table optimised for the Object {@literal ->} int - * maps. This is done to avoid unnecessary object allocation in the image set. - * - * @author Charles Turner - * @author Per Bothner - */ -public class IntHashTable { - private static final int DEFAULT_INITIAL_SIZE = 64; - protected Object[] objs; // the domain set - protected int[] ints; // the image set - protected int mask; // used to clip int's into the domain - protected int num_bindings; // the number of mappings (including DELETED) - private static final Object DELETED = new Object(); - - /** - * Construct an Object {@literal ->} int hash table. - * - * The default size of the hash table is 64 mappings. - */ - public IntHashTable() { - objs = new Object[DEFAULT_INITIAL_SIZE]; - ints = new int[DEFAULT_INITIAL_SIZE]; - mask = DEFAULT_INITIAL_SIZE - 1; - } - - /** - * Construct an Object {@literal ->} int hash table with a specified amount of mappings. - * @param capacity The number of default mappings in this hash table. - */ - public IntHashTable(int capacity) { - int log2Size = 4; - while (capacity > (1 << log2Size)) { - log2Size++; - } - capacity = 1 << log2Size; - objs = new Object[capacity]; - ints = new int[capacity]; - mask = capacity - 1; - } - - /** - * Compute the hash code of a given object. - * - * @param key The object whose hash code is to be computed. - * @return zero if the object is null, otherwise the identityHashCode - */ - protected int hash(Object key) { - return System.identityHashCode(key); - } - - /** - * Find either the index of a key's value, or the index of an available space. - * - * @param key The key to whose index you want to find. - * @return Either the index of the key's value, or an index pointing to - * unoccupied space. - */ - protected int lookup(Object key) { - Object node; - int hash = hash(key); - int hash1 = hash ^ (hash >>> 15); - int hash2 = (hash ^ (hash << 6)) | 1; //ensure coprimeness - int deleted = -1; - for (int i = hash1 & mask;; i = (i + hash2) & mask) { - node = objs[i]; - if (node == key) - return i; - if (node == null) - return deleted >= 0 ? deleted : i; - if (node == DELETED && deleted < 0) - deleted = i; - } - } - - /** - * Return the value to which the specified key is mapped. - * - * @param key The key to whose value you want to find. - * @return A non-negative integer if the value is found. - * Otherwise, it is -1. - */ - public int get(Object key) { - int index = lookup(key); - Object node = objs[index]; - return node == null || node == DELETED ? -1 : ints[index]; - } - - /** - * Associates the specified key with the specified value in this map. - * - * @param key key with which the specified value is to be associated. - * @param value value to be associated with the specified key. - * @return previous value associated with specified key, or -1 if there was - * no mapping for key. - */ - public int put(Object key, int value) { - int index = lookup(key); - Object old = objs[index]; - if (old == null || old == DELETED) { - objs[index] = key; - ints[index] = value; - if (old != DELETED) - num_bindings++; - if (3 * num_bindings >= 2 * objs.length) - rehash(); - return -1; - } else { // update existing mapping - int oldValue = ints[index]; - ints[index] = value; - return oldValue; - } - } - - /** - * Remove the mapping(key and value) of the specified key. - * - * @param key the key to whose value you want to remove. - * @return the removed value associated with the specified key, - * or -1 if there was no mapping for the specified key. - */ - public int remove(Object key) { - int index = lookup(key); - Object old = objs[index]; - if (old == null || old == DELETED) - return -1; - objs[index] = DELETED; - return ints[index]; - } - - /** - * Expand the hash table when it exceeds the load factor. - * - * Rehash the existing objects. - */ - protected void rehash() { - Object[] oldObjsTable = objs; - int[] oldIntsTable = ints; - int newCapacity = oldObjsTable.length << 1; - objs = new Object[newCapacity]; - ints = new int[newCapacity]; - mask = newCapacity - 1; - num_bindings = 0; // this is recomputed below - Object key; - for (int i = oldIntsTable.length; --i >= 0;) { - key = oldObjsTable[i]; - if (key != null && key != DELETED) - put(key, oldIntsTable[i]); - } - } - - /** - * Removes all mappings from this map. - */ - public void clear() { - for (int i = objs.length; --i >= 0;) { - objs[i] = null; - } - num_bindings = 0; - } -} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java index c9f529eae55..328183c0cb3 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java @@ -38,7 +38,6 @@ import javax.tools.JavaFileObject; import com.sun.tools.javac.api.DiagnosticFormatter; import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.code.Type; -import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.util.DefinedBy.Api; @@ -364,10 +363,8 @@ public class JCDiagnostic implements Diagnostic { /** Get the position within the file that most accurately defines the * location for the diagnostic. */ int getPreferredPosition(); - /** If there is a tree node, and if endPositions are available, get - * the end position of the tree node. Otherwise, just returns the - * same as getPreferredPosition(). */ - int getEndPosition(EndPosTable endPosTable); + /** If there is a tree node, get the end position of the tree node. */ + int getEndPosition(); /** Get the position that determines which Lint configuration applies. */ default int getLintPosition() { return getStartPosition(); @@ -389,8 +386,8 @@ public class JCDiagnostic implements Diagnostic { return orig.getPreferredPosition(); } @Override - public int getEndPosition(EndPosTable endPosTable) { - return orig.getEndPosition(endPosTable); + public int getEndPosition() { + return orig.getEndPosition(); } @Override public int getLintPosition() { @@ -421,7 +418,7 @@ public class JCDiagnostic implements Diagnostic { return pos; } - public int getEndPosition(EndPosTable endPosTable) { + public int getEndPosition() { return pos; } @@ -747,7 +744,7 @@ public class JCDiagnostic implements Diagnostic { } protected int getIntEndPosition() { - return (position == null ? Position.NOPOS : position.getEndPosition(source.getEndPosTable())); + return (position == null ? Position.NOPOS : position.getEndPosition()); } @DefinedBy(Api.COMPILER) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java index a4109a35ccb..b061d2283a0 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java @@ -55,7 +55,6 @@ import com.sun.tools.javac.comp.AttrContext; import com.sun.tools.javac.comp.Env; import com.sun.tools.javac.main.Main; import com.sun.tools.javac.main.Option; -import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.*; import com.sun.tools.javac.tree.TreeInfo; @@ -594,11 +593,6 @@ public class Log extends AbstractLog { return diagListener != null; } - public void setEndPosTable(JavaFileObject name, EndPosTable endPosTable) { - Assert.checkNonNull(name); - getSource(name).setEndPosTable(endPosTable); - } - /** Return current sourcefile. */ public JavaFileObject currentSourceFile() { diff --git a/src/jdk.compiler/share/data/symbols/README b/src/jdk.compiler/share/data/symbols/README index 4c9f38f77b0..50f68bbe2f2 100644 --- a/src/jdk.compiler/share/data/symbols/README +++ b/src/jdk.compiler/share/data/symbols/README @@ -1,3 +1,3 @@ This directory contains history data for -release. -Please see $JDK_TOP_DIR/make/scripts/generate-symbol-data.sh for main usage. +Please see $JDK_TOP_DIR/bin/generate-symbol-data.sh for main usage. diff --git a/src/jdk.compiler/share/data/symbols/java.base-Q.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-Q.sym.txt new file mode 100644 index 00000000000..9166b505c51 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/java.base-Q.sym.txt @@ -0,0 +1,606 @@ +# +# 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.base +header exports java/io,java/lang,java/lang/annotation,java/lang/classfile,java/lang/classfile/attribute,java/lang/classfile/constantpool,java/lang/classfile/instruction,java/lang/constant,java/lang/foreign,java/lang/invoke,java/lang/module,java/lang/ref,java/lang/reflect,java/lang/runtime,java/math,java/net,java/net/spi,java/nio,java/nio/channels,java/nio/channels/spi,java/nio/charset,java/nio/charset/spi,java/nio/file,java/nio/file/attribute,java/nio/file/spi,java/security,java/security/cert,java/security/interfaces,java/security/spec,java/text,java/text/spi,java/time,java/time/chrono,java/time/format,java/time/temporal,java/time/zone,java/util,java/util/concurrent,java/util/concurrent/atomic,java/util/concurrent/locks,java/util/function,java/util/jar,java/util/random,java/util/regex,java/util/spi,java/util/stream,java/util/zip,javax/crypto,javax/crypto/interfaces,javax/crypto/spec,javax/net,javax/net/ssl,javax/security/auth,javax/security/auth/callback,javax/security/auth/login,javax/security/auth/spi,javax/security/auth/x500,javax/security/cert,jdk/internal/event[jdk.jfr],jdk/internal/javac[java.compiler\u005C;u002C;jdk.compiler],jdk/internal/vm/vector[jdk.incubator.vector] extraModulePackages jdk/internal/access/foreign,jdk/internal/classfile/impl,jdk/internal/constant,jdk/internal/foreign/abi,jdk/internal/foreign/abi/aarch64/linux,jdk/internal/foreign/abi/aarch64/macos,jdk/internal/foreign/abi/aarch64/windows,jdk/internal/foreign/abi/fallback,jdk/internal/foreign/abi/ppc64/aix,jdk/internal/foreign/abi/ppc64/linux,jdk/internal/foreign/abi/riscv64/linux,jdk/internal/foreign/abi/s390/linux,jdk/internal/foreign/abi/x64/sysv,jdk/internal/foreign/abi/x64/windows,jdk/internal/foreign/layout,jdk/internal/lang,sun/nio,sun/nio/ch,sun/net,jdk/internal/foreign,jdk/internal/foreign,sun/net,sun/nio/ch uses java/lang/System$LoggerFinder,java/net/ContentHandlerFactory,java/net/spi/InetAddressResolverProvider,java/net/spi/URLStreamHandlerProvider,java/nio/channels/spi/AsynchronousChannelProvider,java/nio/channels/spi/SelectorProvider,java/nio/charset/spi/CharsetProvider,java/nio/file/spi/FileSystemProvider,java/nio/file/spi/FileTypeDetector,java/security/Provider,java/text/spi/BreakIteratorProvider,java/text/spi/CollatorProvider,java/text/spi/DateFormatProvider,java/text/spi/DateFormatSymbolsProvider,java/text/spi/DecimalFormatSymbolsProvider,java/text/spi/NumberFormatProvider,java/time/chrono/AbstractChronology,java/time/chrono/Chronology,java/time/zone/ZoneRulesProvider,java/util/spi/CalendarDataProvider,java/util/spi/CalendarNameProvider,java/util/spi/CurrencyNameProvider,java/util/spi/LocaleNameProvider,java/util/spi/ResourceBundleControlProvider,java/util/spi/ResourceBundleProvider,java/util/spi/TimeZoneNameProvider,java/util/spi/ToolProvider,javax/security/auth/spi/LoginModule,jdk/internal/io/JdkConsoleProvider,jdk/internal/logger/DefaultLoggerFinder,sun/text/spi/JavaTimeDateTimePatternProvider,sun/util/locale/provider/LocaleDataMetaInfo,sun/util/resources/LocaleData$LocaleDataResourceBundleProvider,sun/util/spi/CalendarProvider provides interface\u0020;java/nio/file/spi/FileSystemProvider\u0020;impls\u0020;jdk/internal/jrtfs/JrtFileSystemProvider target macos-aarch64 flags 8000 + +class name java/lang/Character$UnicodeBlock +field name SIDETIC descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name SHARADA_SUPPLEMENT descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name TOLONG_SIKI descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name BERIA_ERFE descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name TANGUT_COMPONENTS_SUPPLEMENT descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name MISCELLANEOUS_SYMBOLS_SUPPLEMENT descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name TAI_YO descriptor Ljava/lang/Character$UnicodeBlock; flags 19 +field name CJK_UNIFIED_IDEOGRAPHS_EXTENSION_J descriptor Ljava/lang/Character$UnicodeBlock; flags 19 + +class name java/lang/Character$UnicodeScript +field name SIDETIC descriptor Ljava/lang/Character$UnicodeScript; flags 4019 +field name TOLONG_SIKI descriptor Ljava/lang/Character$UnicodeScript; flags 4019 +field name BERIA_ERFE descriptor Ljava/lang/Character$UnicodeScript; flags 4019 +field name TAI_YO descriptor Ljava/lang/Character$UnicodeScript; flags 4019 + +class name java/lang/Class +header extends java/lang/Object implements java/io/Serializable,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor$OfField,java/lang/constant/Constable flags 31 signature Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/reflect/GenericDeclaration;Ljava/lang/reflect/Type;Ljava/lang/reflect/AnnotatedElement;Ljava/lang/invoke/TypeDescriptor$OfField;>;Ljava/lang/constant/Constable; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/reflect/AccessFlag$Location outerClass java/lang/reflect/AccessFlag innerClassName Location flags 4019 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/TypeDescriptor$OfField outerClass java/lang/invoke/TypeDescriptor innerClassName OfField flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/ClassLoader +header extends java/lang/Object flags 421 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/LazyConstant +header extends java/lang/Object implements java/util/function/Supplier sealed true permittedSubclasses jdk/internal/lang/LazyConstantImpl flags 601 signature Ljava/lang/Object;Ljava/util/function/Supplier; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LAZY_CONSTANTS;) +method name orElse descriptor (Ljava/lang/Object;)Ljava/lang/Object; flags 401 signature (TT;)TT; +method name get descriptor ()Ljava/lang/Object; flags 401 signature ()TT; +method name isInitialized descriptor ()Z flags 401 +method name equals descriptor (Ljava/lang/Object;)Z flags 401 +method name hashCode descriptor ()I flags 401 +method name toString descriptor ()Ljava/lang/String; flags 401 +method name of descriptor (Ljava/util/function/Supplier;)Ljava/lang/LazyConstant; flags 9 signature (Ljava/util/function/Supplier<+TT;>;)Ljava/lang/LazyConstant; + +class name java/lang/Math +-method name sinh descriptor (D)D +method name sinh descriptor (D)D flags 9 runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name java/lang/Object +header flags 21 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; + +class name java/lang/Process +header extends java/lang/Object implements java/io/Closeable flags 421 +innerclass innerClass java/util/concurrent/ForkJoinPool$ManagedBlocker outerClass java/util/concurrent/ForkJoinPool innerClassName ManagedBlocker flags 609 +innerclass innerClass java/lang/ProcessHandle$Info outerClass java/lang/ProcessHandle innerClassName Info flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name close descriptor ()V thrownTypes java/io/IOException flags 1 + +-class name java/lang/StableValue + +class name java/lang/String +field name UNICODE_CASEFOLD_ORDER descriptor Ljava/util/Comparator; flags 19 signature Ljava/util/Comparator; +method name equalsFoldCase descriptor (Ljava/lang/String;)Z flags 1 +method name compareToFoldCase descriptor (Ljava/lang/String;)I flags 1 + +class name java/lang/Thread +-method name stop descriptor ()V + +class name java/lang/classfile/ClassFile +field name JAVA_26_VERSION descriptor I constantValue 70 flags 19 + +class name java/lang/classfile/Signature$ClassTypeSig +-method name of descriptor (Ljava/lang/classfile/Signature$ClassTypeSig;Ljava/lang/constant/ClassDesc;[Ljava/lang/classfile/Signature$TypeArg;)Ljava/lang/classfile/Signature$ClassTypeSig; +method name of descriptor (Ljava/lang/classfile/Signature$ClassTypeSig;Ljava/lang/constant/ClassDesc;[Ljava/lang/classfile/Signature$TypeArg;)Ljava/lang/classfile/Signature$ClassTypeSig; flags 89 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="26") + +-class name java/lang/constant/AsTypeMethodHandleDesc + +class name java/lang/constant/ConstantDescs +header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/constant/DirectMethodHandleDesc$Kind outerClass java/lang/constant/DirectMethodHandleDesc innerClassName Kind flags 4019 + +class name java/lang/constant/DynamicConstantDesc +header extends java/lang/Object implements java/lang/constant/ConstantDesc flags 421 signature Ljava/lang/Object;Ljava/lang/constant/ConstantDesc; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +innerclass innerClass java/lang/Enum$EnumDesc outerClass java/lang/Enum innerClassName EnumDesc flags 19 +innerclass innerClass java/lang/invoke/VarHandle$VarHandleDesc outerClass java/lang/invoke/VarHandle innerClassName VarHandleDesc flags 19 + +class name java/lang/constant/MethodHandleDesc +header extends java/lang/Object implements java/lang/constant/ConstantDesc sealed true permittedSubclasses jdk/internal/constant/AsTypeMethodHandleDesc,java/lang/constant/DirectMethodHandleDesc flags 601 +innerclass innerClass java/lang/constant/DirectMethodHandleDesc$Kind outerClass java/lang/constant/DirectMethodHandleDesc innerClassName Kind flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/invoke/BoundMethodHandle +header extends java/lang/invoke/MethodHandle flags 420 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; + +class name java/lang/invoke/DelegatingMethodHandle +header extends java/lang/invoke/MethodHandle sealed true permittedSubclasses java/lang/invoke/MethodHandleImpl$AsVarargsCollector,java/lang/invoke/MethodHandleImpl$WrappedMember,java/lang/invoke/MethodHandleImpl$IntrinsicMethodHandle,java/lang/invoke/MethodHandleImpl$CountingWrapper flags 420 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandleImpl$AsVarargsCollector outerClass java/lang/invoke/MethodHandleImpl innerClassName AsVarargsCollector flags 18 +innerclass innerClass java/lang/invoke/MethodHandleImpl$WrappedMember outerClass java/lang/invoke/MethodHandleImpl innerClassName WrappedMember flags 18 +innerclass innerClass java/lang/invoke/MethodHandleImpl$IntrinsicMethodHandle outerClass java/lang/invoke/MethodHandleImpl innerClassName IntrinsicMethodHandle flags 18 +innerclass innerClass java/lang/invoke/MethodHandleImpl$CountingWrapper outerClass java/lang/invoke/MethodHandleImpl innerClassName CountingWrapper flags 18 + +class name java/lang/invoke/DirectMethodHandle +header extends java/lang/invoke/MethodHandle nestMembers java/lang/invoke/DirectMethodHandle$StaticAccessor,java/lang/invoke/DirectMethodHandle$Accessor,java/lang/invoke/DirectMethodHandle$Constructor,java/lang/invoke/DirectMethodHandle$Interface,java/lang/invoke/DirectMethodHandle$Special sealed true permittedSubclasses java/lang/invoke/DirectMethodHandle$Special,java/lang/invoke/DirectMethodHandle$Interface,java/lang/invoke/DirectMethodHandle$Constructor,java/lang/invoke/DirectMethodHandle$Accessor,java/lang/invoke/DirectMethodHandle$StaticAccessor flags 20 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/DirectMethodHandle$Special outerClass java/lang/invoke/DirectMethodHandle innerClassName Special flags 18 +innerclass innerClass java/lang/invoke/DirectMethodHandle$Interface outerClass java/lang/invoke/DirectMethodHandle innerClassName Interface flags 18 +innerclass innerClass java/lang/invoke/DirectMethodHandle$StaticAccessor outerClass java/lang/invoke/DirectMethodHandle innerClassName StaticAccessor flags 18 +innerclass innerClass java/lang/invoke/DirectMethodHandle$Accessor outerClass java/lang/invoke/DirectMethodHandle innerClassName Accessor flags 18 +innerclass innerClass java/lang/invoke/DirectMethodHandle$Constructor outerClass java/lang/invoke/DirectMethodHandle innerClassName Constructor flags 18 + +class name java/lang/invoke/DirectMethodHandle$Constructor +header extends java/lang/invoke/DirectMethodHandle nestHost java/lang/invoke/DirectMethodHandle flags 30 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/DirectMethodHandle$Constructor outerClass java/lang/invoke/DirectMethodHandle innerClassName Constructor flags 18 + +class name java/lang/invoke/LambdaForm +header extends java/lang/Object flags 20 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; + +class name java/lang/invoke/LambdaMetafactory +header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/invoke/MethodHandle +header extends java/lang/Object implements java/lang/constant/Constable sealed true permittedSubclasses java/lang/invoke/NativeMethodHandle,java/lang/invoke/DirectMethodHandle,java/lang/invoke/DelegatingMethodHandle,java/lang/invoke/BoundMethodHandle flags 421 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +innerclass innerClass java/lang/constant/DirectMethodHandleDesc$Kind outerClass java/lang/constant/DirectMethodHandleDesc innerClassName Kind flags 4019 + +class name java/lang/invoke/MethodHandleImpl +header extends java/lang/Object nestMembers java/lang/invoke/MethodHandleImpl$IntrinsicMethodHandle,java/lang/invoke/MethodHandleImpl$WrappedMember,java/lang/invoke/MethodHandleImpl$CountingWrapper,java/lang/invoke/MethodHandleImpl$AsVarargsCollector flags 420 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandleImpl$AsVarargsCollector outerClass java/lang/invoke/MethodHandleImpl innerClassName AsVarargsCollector flags 18 +innerclass innerClass java/lang/invoke/MethodHandleImpl$CountingWrapper outerClass java/lang/invoke/MethodHandleImpl innerClassName CountingWrapper flags 18 +innerclass innerClass java/lang/invoke/MethodHandleImpl$WrappedMember outerClass java/lang/invoke/MethodHandleImpl innerClassName WrappedMember flags 18 +innerclass innerClass java/lang/invoke/MethodHandleImpl$IntrinsicMethodHandle outerClass java/lang/invoke/MethodHandleImpl innerClassName IntrinsicMethodHandle flags 18 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/invoke/MethodHandleImpl$AsVarargsCollector +header extends java/lang/invoke/DelegatingMethodHandle nestHost java/lang/invoke/MethodHandleImpl flags 30 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandleImpl$AsVarargsCollector outerClass java/lang/invoke/MethodHandleImpl innerClassName AsVarargsCollector flags 18 + +class name java/lang/invoke/MethodHandleImpl$CountingWrapper +header extends java/lang/invoke/DelegatingMethodHandle nestHost java/lang/invoke/MethodHandleImpl flags 30 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandleImpl$CountingWrapper outerClass java/lang/invoke/MethodHandleImpl innerClassName CountingWrapper flags 18 + +class name java/lang/invoke/MethodHandleImpl$IntrinsicMethodHandle +header extends java/lang/invoke/DelegatingMethodHandle nestHost java/lang/invoke/MethodHandleImpl flags 30 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandleImpl$IntrinsicMethodHandle outerClass java/lang/invoke/MethodHandleImpl innerClassName IntrinsicMethodHandle flags 18 + +class name java/lang/invoke/MethodHandleImpl$WrappedMember +header extends java/lang/invoke/DelegatingMethodHandle nestHost java/lang/invoke/MethodHandleImpl flags 30 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandleImpl$WrappedMember outerClass java/lang/invoke/MethodHandleImpl innerClassName WrappedMember flags 18 + +class name java/lang/invoke/MethodHandles +header extends java/lang/Object nestMembers java/lang/invoke/MethodHandles$Lookup,java/lang/invoke/MethodHandles$Lookup$ClassOption flags 31 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +innerclass innerClass java/lang/invoke/VarHandle$AccessMode outerClass java/lang/invoke/VarHandle innerClassName AccessMode flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup$ClassOption outerClass java/lang/invoke/MethodHandles$Lookup innerClassName ClassOption flags 4019 + +class name java/lang/invoke/StringConcatFactory +header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/module/ModuleDescriptor +header extends java/lang/Object implements java/lang/Comparable nestMembers java/lang/module/ModuleDescriptor$Builder,java/lang/module/ModuleDescriptor$Version,java/lang/module/ModuleDescriptor$Provides,java/lang/module/ModuleDescriptor$Opens,java/lang/module/ModuleDescriptor$Opens$Modifier,java/lang/module/ModuleDescriptor$Exports,java/lang/module/ModuleDescriptor$Exports$Modifier,java/lang/module/ModuleDescriptor$Requires,java/lang/module/ModuleDescriptor$Requires$Modifier,java/lang/module/ModuleDescriptor$Modifier flags 31 signature Ljava/lang/Object;Ljava/lang/Comparable; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/module/ModuleDescriptor$Version outerClass java/lang/module/ModuleDescriptor innerClassName Version flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Modifier outerClass java/lang/module/ModuleDescriptor innerClassName Modifier flags 4019 +innerclass innerClass java/lang/reflect/AccessFlag$Location outerClass java/lang/reflect/AccessFlag innerClassName Location flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Builder outerClass java/lang/module/ModuleDescriptor innerClassName Builder flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Provides outerClass java/lang/module/ModuleDescriptor innerClassName Provides flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Opens outerClass java/lang/module/ModuleDescriptor innerClassName Opens flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Exports outerClass java/lang/module/ModuleDescriptor innerClassName Exports flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Requires outerClass java/lang/module/ModuleDescriptor innerClassName Requires flags 19 +innerclass innerClass java/lang/module/ModuleDescriptor$Opens$Modifier outerClass java/lang/module/ModuleDescriptor$Opens innerClassName Modifier flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Exports$Modifier outerClass java/lang/module/ModuleDescriptor$Exports innerClassName Modifier flags 4019 +innerclass innerClass java/lang/module/ModuleDescriptor$Requires$Modifier outerClass java/lang/module/ModuleDescriptor$Requires innerClassName Modifier flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/ref/PhantomReference +header extends java/lang/ref/Reference flags 21 signature Ljava/lang/ref/Reference; runtimeTypeAnnotations @Ljdk/internal/RequiresIdentity;{typeParameterIndex=I0,targetType="CLASS_TYPE_PARAMETER"} + +class name java/lang/ref/Reference +header extends java/lang/Object sealed true permittedSubclasses java/lang/ref/PhantomReference,java/lang/ref/SoftReference,java/lang/ref/WeakReference,java/lang/ref/FinalReference flags 421 signature Ljava/lang/Object; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; runtimeTypeAnnotations @Ljdk/internal/RequiresIdentity;{typeParameterIndex=I0,targetType="CLASS_TYPE_PARAMETER"} +-method name get descriptor ()Ljava/lang/Object; +method name get descriptor ()Ljava/lang/Object; flags 1 signature ()TT; + +class name java/lang/ref/ReferenceQueue +header extends java/lang/Object flags 21 signature Ljava/lang/Object; runtimeTypeAnnotations @Ljdk/internal/RequiresIdentity;{typeParameterIndex=I0,targetType="CLASS_TYPE_PARAMETER"} + +class name java/lang/ref/SoftReference +header extends java/lang/ref/Reference flags 21 signature Ljava/lang/ref/Reference; runtimeTypeAnnotations @Ljdk/internal/RequiresIdentity;{typeParameterIndex=I0,targetType="CLASS_TYPE_PARAMETER"} + +class name java/lang/ref/WeakReference +header extends java/lang/ref/Reference flags 21 signature Ljava/lang/ref/Reference; runtimeTypeAnnotations @Ljdk/internal/RequiresIdentity;{typeParameterIndex=I0,targetType="CLASS_TYPE_PARAMETER"} + +class name java/lang/reflect/ClassFileFormatVersion +field name RELEASE_26 descriptor Ljava/lang/reflect/ClassFileFormatVersion; flags 4019 + +class name java/lang/reflect/Field +header extends java/lang/reflect/AccessibleObject implements java/lang/reflect/Member flags 31 +innerclass innerClass java/lang/reflect/AccessFlag$Location outerClass java/lang/reflect/AccessFlag innerClassName Location flags 4019 +innerclass innerClass java/lang/StackWalker$Option outerClass java/lang/StackWalker innerClassName Option flags 4019 +innerclass innerClass java/lang/StackWalker$StackFrame outerClass java/lang/StackWalker innerClassName StackFrame flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/lang/runtime/ObjectMethods +header extends java/lang/Object flags 31 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +innerclass innerClass java/lang/classfile/ClassFile$Option outerClass java/lang/classfile/ClassFile innerClassName Option flags 609 +innerclass innerClass java/lang/classfile/ClassFile$ClassHierarchyResolverOption outerClass java/lang/classfile/ClassFile innerClassName ClassHierarchyResolverOption flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup$ClassOption outerClass java/lang/invoke/MethodHandles$Lookup innerClassName ClassOption flags 4019 + +class name java/math/BigInteger +method name rootn descriptor (I)Ljava/math/BigInteger; flags 1 +method name rootnAndRemainder descriptor (I)[Ljava/math/BigInteger; flags 1 + +class name java/net/DatagramSocketImpl +-method name setTTL descriptor (B)V +-method name getTTL descriptor ()B + +class name java/net/MulticastSocket +-method name setTTL descriptor (B)V +-method name getTTL descriptor ()B +-method name send descriptor (Ljava/net/DatagramPacket;B)V + +class name java/net/ServerSocket +-method name setPerformancePreferences descriptor (III)V +method name setPerformancePreferences descriptor (III)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="26") + +class name java/net/Socket +-method name setPerformancePreferences descriptor (III)V +method name setPerformancePreferences descriptor (III)V flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="26") + +class name java/net/SocketImpl +-method name setPerformancePreferences descriptor (III)V +method name setPerformancePreferences descriptor (III)V flags 4 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="26") + +class name java/net/SocketPermission +header extends java/security/Permission implements java/io/Serializable flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="26") +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/net/URI +header extends java/lang/Object implements java/lang/Comparable,java/io/Serializable flags 31 signature Ljava/lang/Object;Ljava/lang/Comparable;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/text/Normalizer$Form outerClass java/text/Normalizer innerClassName Form flags 4019 + +class name java/net/URL +header extends java/lang/Object implements java/io/Serializable flags 31 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/ScopedValue$Carrier outerClass java/lang/ScopedValue innerClassName Carrier flags 19 +innerclass innerClass java/lang/ScopedValue$CallableOp outerClass java/lang/ScopedValue innerClassName CallableOp flags 609 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/nio/ByteOrder +header extends java/lang/Enum flags 4031 signature Ljava/lang/Enum; +-field name BIG_ENDIAN descriptor Ljava/nio/ByteOrder; +-field name LITTLE_ENDIAN descriptor Ljava/nio/ByteOrder; +-method name toString descriptor ()Ljava/lang/String; +field name LITTLE_ENDIAN descriptor Ljava/nio/ByteOrder; flags 4019 +field name BIG_ENDIAN descriptor Ljava/nio/ByteOrder; flags 4019 +method name values descriptor ()[Ljava/nio/ByteOrder; flags 9 +method name valueOf descriptor (Ljava/lang/String;)Ljava/nio/ByteOrder; flags 9 methodParameters 8000:null + +class name java/nio/DirectByteBuffer +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectCharBufferS +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectCharBufferU +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectDoubleBufferS +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectDoubleBufferU +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectFloatBufferS +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectFloatBufferU +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectIntBufferS +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectIntBufferU +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectLongBufferS +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectLongBufferU +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectShortBufferS +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/DirectShortBufferU +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 1 + +class name java/nio/charset/Charset +header extends java/lang/Object implements java/lang/Comparable flags 421 signature Ljava/lang/Object;Ljava/lang/Comparable; +innerclass innerClass java/lang/ScopedValue$Carrier outerClass java/lang/ScopedValue innerClassName Carrier flags 19 +innerclass innerClass java/lang/ScopedValue$CallableOp outerClass java/lang/ScopedValue innerClassName CallableOp flags 609 + +class name java/security/DEREncodable +header extends java/lang/Object sealed true permittedSubclasses java/security/AsymmetricKey,java/security/KeyPair,java/security/spec/PKCS8EncodedKeySpec,java/security/spec/X509EncodedKeySpec,javax/crypto/EncryptedPrivateKeyInfo,java/security/cert/X509Certificate,java/security/cert/X509CRL,java/security/PEM flags 601 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) + +class name java/security/PEM +header extends java/lang/Record implements java/security/DEREncodable record true flags 31 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +recordcomponent name type descriptor Ljava/lang/String; +recordcomponent name content descriptor Ljava/lang/String; +recordcomponent name leadingData descriptor [B +innerclass innerClass java/util/Base64$Decoder outerClass java/util/Base64 innerClassName Decoder flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name descriptor (Ljava/lang/String;Ljava/lang/String;[B)V flags 1 methodParameters 8000:type,8000:content,8000:leadingData +method name descriptor (Ljava/lang/String;Ljava/lang/String;)V flags 1 +method name toString descriptor ()Ljava/lang/String; flags 11 +method name decode descriptor ()[B flags 11 +method name hashCode descriptor ()I flags 11 +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name type descriptor ()Ljava/lang/String; flags 1 +method name content descriptor ()Ljava/lang/String; flags 1 +method name leadingData descriptor ()[B flags 1 + +class name java/security/PEMDecoder +header extends java/lang/Object flags 31 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +innerclass innerClass java/lang/ref/Cleaner$Cleanable outerClass java/lang/ref/Cleaner innerClassName Cleanable flags 609 +innerclass innerClass java/util/Base64$Decoder outerClass java/util/Base64 innerClassName Decoder flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +-class name java/security/PEMRecord + +class name java/security/SecureRandom +method name nextLong descriptor ()J flags 1 + +class name java/time/Duration +field name MIN descriptor Ljava/time/Duration; flags 19 +field name MAX descriptor Ljava/time/Duration; flags 19 + +class name java/time/Instant +method name plusSaturating descriptor (Ljava/time/Duration;)Ljava/time/Instant; flags 1 + +class name java/util/AbstractMap +header extends java/lang/Object implements java/util/Map nestMembers java/util/AbstractMap$SimpleImmutableEntry,java/util/AbstractMap$SimpleEntry flags 421 signature Ljava/lang/Object;Ljava/util/Map; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/util/AbstractMap$SimpleImmutableEntry outerClass java/util/AbstractMap innerClassName SimpleImmutableEntry flags 9 +innerclass innerClass java/util/AbstractMap$SimpleEntry outerClass java/util/AbstractMap innerClassName SimpleEntry flags 9 + +class name java/util/Collections +header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; + +class name java/util/Comparator +method name max descriptor (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (TU;TU;)TU; +method name min descriptor (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (TU;TU;)TU; + +class name java/util/List +method name ofLazy descriptor (ILjava/util/function/IntFunction;)Ljava/util/List; flags 9 signature (ILjava/util/function/IntFunction<+TE;>;)Ljava/util/List; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LAZY_CONSTANTS;) + +class name java/util/Locale +header extends java/lang/Object implements java/lang/Cloneable,java/io/Serializable nestMembers java/util/Locale$LanguageRange,java/util/Locale$FilteringMode,java/util/Locale$Builder,java/util/Locale$Category,java/util/Locale$IsoCountryCode flags 31 +innerclass innerClass java/util/Locale$Category outerClass java/util/Locale innerClassName Category flags 4019 +innerclass innerClass java/util/Locale$IsoCountryCode outerClass java/util/Locale innerClassName IsoCountryCode flags 4019 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 +innerclass innerClass java/util/Locale$FilteringMode outerClass java/util/Locale innerClassName FilteringMode flags 4019 +innerclass innerClass java/util/Locale$LanguageRange outerClass java/util/Locale innerClassName LanguageRange flags 19 +innerclass innerClass java/util/Locale$Builder outerClass java/util/Locale innerClassName Builder flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/Locale$IsoCountryCode +header extends java/lang/Enum nestHost java/util/Locale flags 4031 signature Ljava/lang/Enum; +innerclass innerClass java/util/Locale$IsoCountryCode outerClass java/util/Locale innerClassName IsoCountryCode flags 4019 + +class name java/util/Map +method name ofLazy descriptor (Ljava/util/Set;Ljava/util/function/Function;)Ljava/util/Map; flags 9 signature (Ljava/util/Set<+TK;>;Ljava/util/function/Function<-TK;+TV;>;)Ljava/util/Map; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LAZY_CONSTANTS;) + +class name java/util/UUID +method name ofEpochMillis descriptor (J)Ljava/util/UUID; flags 9 + +class name java/util/WeakHashMap +header extends java/util/AbstractMap implements java/util/Map flags 21 signature Ljava/util/AbstractMap;Ljava/util/Map; runtimeTypeAnnotations @Ljdk/internal/RequiresIdentity;{typeParameterIndex=I0,targetType="CLASS_TYPE_PARAMETER"} +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 + +class name java/util/concurrent/ConcurrentHashMap +header extends java/util/AbstractMap implements java/util/concurrent/ConcurrentMap,java/io/Serializable nestMembers java/util/concurrent/ConcurrentHashMap$EntrySetView,java/util/concurrent/ConcurrentHashMap$ValuesView,java/util/concurrent/ConcurrentHashMap$KeySetView,java/util/concurrent/ConcurrentHashMap$CollectionView flags 21 signature Ljava/util/AbstractMap;Ljava/util/concurrent/ConcurrentMap;Ljava/io/Serializable; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/util/concurrent/ConcurrentHashMap$KeySetView outerClass java/util/concurrent/ConcurrentHashMap innerClassName KeySetView flags 19 +innerclass innerClass java/util/concurrent/ConcurrentHashMap$ValuesView outerClass java/util/concurrent/ConcurrentHashMap innerClassName ValuesView flags 18 +innerclass innerClass java/util/concurrent/ConcurrentHashMap$EntrySetView outerClass java/util/concurrent/ConcurrentHashMap innerClassName EntrySetView flags 18 +innerclass innerClass java/io/ObjectOutputStream$PutField outerClass java/io/ObjectOutputStream innerClassName PutField flags 409 +innerclass innerClass java/util/AbstractMap$SimpleImmutableEntry outerClass java/util/AbstractMap innerClassName SimpleImmutableEntry flags 9 +innerclass innerClass java/util/concurrent/ConcurrentHashMap$CollectionView outerClass java/util/concurrent/ConcurrentHashMap innerClassName CollectionView flags 408 + +class name java/util/concurrent/CopyOnWriteArraySet +header extends java/util/AbstractSet implements java/io/Serializable flags 21 signature Ljava/util/AbstractSet;Ljava/io/Serializable; +innerclass innerClass java/io/ObjectInputStream$GetField outerClass java/io/ObjectInputStream innerClassName GetField flags 409 + +class name java/util/concurrent/StructuredTaskScope +-method name open descriptor (Ljava/util/concurrent/StructuredTaskScope$Joiner;Ljava/util/function/Function;)Ljava/util/concurrent/StructuredTaskScope; +method name open descriptor (Ljava/util/concurrent/StructuredTaskScope$Joiner;Ljava/util/function/UnaryOperator;)Ljava/util/concurrent/StructuredTaskScope; flags 9 signature (Ljava/util/concurrent/StructuredTaskScope$Joiner<-TT;+TR;>;Ljava/util/function/UnaryOperator;)Ljava/util/concurrent/StructuredTaskScope; + +class name java/util/concurrent/StructuredTaskScope$Joiner +header extends java/lang/Object nestHost java/util/concurrent/StructuredTaskScope flags 601 signature Ljava/lang/Object; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;STRUCTURED_CONCURRENCY;) +innerclass innerClass java/util/concurrent/StructuredTaskScope$Subtask outerClass java/util/concurrent/StructuredTaskScope innerClassName Subtask flags 609 +innerclass innerClass java/util/concurrent/StructuredTaskScope$Subtask$State outerClass java/util/concurrent/StructuredTaskScope$Subtask innerClassName State flags 4019 +innerclass innerClass java/util/concurrent/StructuredTaskScope$TimeoutException outerClass java/util/concurrent/StructuredTaskScope innerClassName TimeoutException flags 19 +innerclass innerClass java/util/concurrent/StructuredTaskScope$Joiner outerClass java/util/concurrent/StructuredTaskScope innerClassName Joiner flags 609 +-method name onFork descriptor (Ljava/util/concurrent/StructuredTaskScope$Subtask;)Z +-method name onComplete descriptor (Ljava/util/concurrent/StructuredTaskScope$Subtask;)Z +-method name allSuccessfulOrThrow descriptor ()Ljava/util/concurrent/StructuredTaskScope$Joiner; +-method name anySuccessfulResultOrThrow descriptor ()Ljava/util/concurrent/StructuredTaskScope$Joiner; +-method name allUntil descriptor (Ljava/util/function/Predicate;)Ljava/util/concurrent/StructuredTaskScope$Joiner; +method name onFork descriptor (Ljava/util/concurrent/StructuredTaskScope$Subtask;)Z flags 1 signature (Ljava/util/concurrent/StructuredTaskScope$Subtask;)Z +method name onComplete descriptor (Ljava/util/concurrent/StructuredTaskScope$Subtask;)Z flags 1 signature (Ljava/util/concurrent/StructuredTaskScope$Subtask;)Z +method name onTimeout descriptor ()V flags 1 +method name allSuccessfulOrThrow descriptor ()Ljava/util/concurrent/StructuredTaskScope$Joiner; flags 9 signature ()Ljava/util/concurrent/StructuredTaskScope$Joiner;>; +method name anySuccessfulOrThrow descriptor ()Ljava/util/concurrent/StructuredTaskScope$Joiner; flags 9 signature ()Ljava/util/concurrent/StructuredTaskScope$Joiner; +method name allUntil descriptor (Ljava/util/function/Predicate;)Ljava/util/concurrent/StructuredTaskScope$Joiner; flags 9 signature (Ljava/util/function/Predicate;>;)Ljava/util/concurrent/StructuredTaskScope$Joiner;>;>; + +class name java/util/concurrent/StructuredTaskScopeImpl +header extends java/lang/Object implements java/util/concurrent/StructuredTaskScope nestMembers java/util/concurrent/StructuredTaskScopeImpl$ConfigImpl,java/util/concurrent/StructuredTaskScopeImpl$SubtaskImpl flags 30 signature Ljava/lang/Object;Ljava/util/concurrent/StructuredTaskScope; +innerclass innerClass java/util/concurrent/StructuredTaskScope$Joiner outerClass java/util/concurrent/StructuredTaskScope innerClassName Joiner flags 609 +innerclass innerClass java/util/concurrent/StructuredTaskScopeImpl$ConfigImpl outerClass java/util/concurrent/StructuredTaskScopeImpl innerClassName ConfigImpl flags 18 +innerclass innerClass java/util/concurrent/StructuredTaskScope$Configuration outerClass java/util/concurrent/StructuredTaskScope innerClassName Configuration flags 609 +innerclass innerClass java/util/concurrent/StructuredTaskScopeImpl$SubtaskImpl outerClass java/util/concurrent/StructuredTaskScopeImpl innerClassName SubtaskImpl flags 18 +innerclass innerClass java/util/concurrent/StructuredTaskScope$Subtask outerClass java/util/concurrent/StructuredTaskScope innerClassName Subtask flags 609 +innerclass innerClass java/util/concurrent/StructuredTaskScope$Subtask$State outerClass java/util/concurrent/StructuredTaskScope$Subtask innerClassName State flags 4019 +innerclass innerClass java/util/concurrent/StructuredTaskScope$FailedException outerClass java/util/concurrent/StructuredTaskScope innerClassName FailedException flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/concurrent/StructuredTaskScopeImpl$SubtaskImpl +header extends java/lang/Object implements java/util/concurrent/StructuredTaskScope$Subtask,java/lang/Runnable nestHost java/util/concurrent/StructuredTaskScopeImpl flags 30 signature Ljava/lang/Object;Ljava/util/concurrent/StructuredTaskScope$Subtask;Ljava/lang/Runnable; +innerclass innerClass java/util/concurrent/StructuredTaskScopeImpl$SubtaskImpl outerClass java/util/concurrent/StructuredTaskScopeImpl innerClassName SubtaskImpl flags 18 +innerclass innerClass java/lang/Thread$State outerClass java/lang/Thread innerClassName State flags 4019 +innerclass innerClass java/util/concurrent/StructuredTaskScope$Subtask outerClass java/util/concurrent/StructuredTaskScope innerClassName Subtask flags 609 +innerclass innerClass java/util/concurrent/StructuredTaskScope$Subtask$State outerClass java/util/concurrent/StructuredTaskScope$Subtask innerClassName State flags 4019 + +class name java/util/concurrent/ThreadLocalRandom +method name nextGaussian descriptor ()D flags 1 + +class name java/util/jar/JarFile +header extends java/util/zip/ZipFile flags 21 +innerclass innerClass java/lang/Runtime$Version outerClass java/lang/Runtime innerClassName Version flags 19 +innerclass innerClass java/util/jar/Attributes$Name outerClass java/util/jar/Attributes innerClassName Name flags 9 +innerclass innerClass java/lang/ScopedValue$Carrier outerClass java/lang/ScopedValue innerClassName Carrier flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name java/util/stream/Collectors +header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/util/stream/Collector$Characteristics outerClass java/util/stream/Collector innerClassName Characteristics flags 4019 +innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + +class name javax/crypto/EncryptedPrivateKeyInfo +header extends java/lang/Object implements java/security/DEREncodable flags 21 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name encryptKey descriptor (Ljava/security/PrivateKey;[CLjava/lang/String;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/Provider;)Ljavax/crypto/EncryptedPrivateKeyInfo; +-method name encryptKey descriptor (Ljava/security/PrivateKey;[C)Ljavax/crypto/EncryptedPrivateKeyInfo; +-method name encryptKey descriptor (Ljava/security/PrivateKey;Ljava/security/Key;Ljava/lang/String;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/Provider;Ljava/security/SecureRandom;)Ljavax/crypto/EncryptedPrivateKeyInfo; +-method name getKey descriptor ([C)Ljava/security/PrivateKey; +-method name getKey descriptor (Ljava/security/Key;Ljava/security/Provider;)Ljava/security/PrivateKey; +method name encrypt descriptor (Ljava/security/DEREncodable;[CLjava/lang/String;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/Provider;)Ljavax/crypto/EncryptedPrivateKeyInfo; flags 9 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name encrypt descriptor (Ljava/security/DEREncodable;[C)Ljavax/crypto/EncryptedPrivateKeyInfo; flags 9 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name encrypt descriptor (Ljava/security/DEREncodable;Ljava/security/Key;Ljava/lang/String;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/Provider;Ljava/security/SecureRandom;)Ljavax/crypto/EncryptedPrivateKeyInfo; flags 9 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name getKey descriptor ([C)Ljava/security/PrivateKey; thrownTypes java/security/NoSuchAlgorithmException,java/security/InvalidKeyException flags 1 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name getKey descriptor (Ljava/security/Key;Ljava/security/Provider;)Ljava/security/PrivateKey; thrownTypes java/security/NoSuchAlgorithmException,java/security/InvalidKeyException flags 1 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name getKeyPair descriptor ([C)Ljava/security/KeyPair; thrownTypes java/security/NoSuchAlgorithmException,java/security/InvalidKeyException flags 1 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +method name getKeyPair descriptor (Ljava/security/Key;Ljava/security/Provider;)Ljava/security/KeyPair; thrownTypes java/security/NoSuchAlgorithmException,java/security/InvalidKeyException flags 1 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) + +class name javax/crypto/spec/HPKEParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 31 +field name KEM_DHKEM_P_256_HKDF_SHA256 descriptor I constantValue 16 flags 19 +field name KEM_DHKEM_P_384_HKDF_SHA384 descriptor I constantValue 17 flags 19 +field name KEM_DHKEM_P_521_HKDF_SHA512 descriptor I constantValue 18 flags 19 +field name KEM_DHKEM_X25519_HKDF_SHA256 descriptor I constantValue 32 flags 19 +field name KEM_DHKEM_X448_HKDF_SHA512 descriptor I constantValue 33 flags 19 +field name KDF_HKDF_SHA256 descriptor I constantValue 1 flags 19 +field name KDF_HKDF_SHA384 descriptor I constantValue 2 flags 19 +field name KDF_HKDF_SHA512 descriptor I constantValue 3 flags 19 +field name AEAD_AES_128_GCM descriptor I constantValue 1 flags 19 +field name AEAD_AES_256_GCM descriptor I constantValue 2 flags 19 +field name AEAD_CHACHA20_POLY1305 descriptor I constantValue 3 flags 19 +field name EXPORT_ONLY descriptor I constantValue 65535 flags 19 +method name of descriptor (III)Ljavax/crypto/spec/HPKEParameterSpec; flags 9 +method name withInfo descriptor ([B)Ljavax/crypto/spec/HPKEParameterSpec; flags 1 +method name withPsk descriptor (Ljavax/crypto/SecretKey;[B)Ljavax/crypto/spec/HPKEParameterSpec; flags 1 +method name withEncapsulation descriptor ([B)Ljavax/crypto/spec/HPKEParameterSpec; flags 1 +method name withAuthKey descriptor (Ljava/security/AsymmetricKey;)Ljavax/crypto/spec/HPKEParameterSpec; flags 1 +method name kem_id descriptor ()I flags 1 +method name kdf_id descriptor ()I flags 1 +method name aead_id descriptor ()I flags 1 +method name info descriptor ()[B flags 1 +method name psk descriptor ()Ljavax/crypto/SecretKey; flags 1 +method name psk_id descriptor ()[B flags 1 +method name authKey descriptor ()Ljava/security/AsymmetricKey; flags 1 +method name encapsulation descriptor ()[B flags 1 +method name toString descriptor ()Ljava/lang/String; flags 1 + +class name jdk/internal/classfile/impl/DirectCodeBuilder +header extends jdk/internal/classfile/impl/AbstractDirectBuilder implements jdk/internal/classfile/impl/TerminalCodeBuilder flags 31 signature Ljdk/internal/classfile/impl/AbstractDirectBuilder;Ljdk/internal/classfile/impl/TerminalCodeBuilder; +innerclass innerClass jdk/internal/classfile/impl/AbstractPseudoInstruction$ExceptionCatchImpl outerClass jdk/internal/classfile/impl/AbstractPseudoInstruction innerClassName ExceptionCatchImpl flags 19 +innerclass innerClass java/lang/classfile/Opcode$Kind outerClass java/lang/classfile/Opcode innerClassName Kind flags 4019 + +class name jdk/internal/classfile/impl/SignaturesImpl +method name nextIdentifierEnd descriptor (Ljava/lang/String;I)I flags 9 +method name validateIdentifier descriptor (Ljava/lang/String;)Ljava/lang/String; flags 9 +method name validatePackageSpecifierPlusIdentifier descriptor (Ljava/lang/String;)Ljava/lang/String; flags 9 +method name validateNonVoid descriptor (Ljava/lang/classfile/Signature;)Ljava/lang/classfile/Signature; flags 9 +method name validateArgumentList descriptor ([Ljava/lang/classfile/Signature;)Ljava/util/List; flags 9 signature ([Ljava/lang/classfile/Signature;)Ljava/util/List; +method name validateArgumentList descriptor (Ljava/util/List;)Ljava/util/List; flags 9 signature (Ljava/util/List;)Ljava/util/List; + +class name jdk/internal/classfile/impl/Util +header extends java/lang/Object nestMembers jdk/internal/classfile/impl/Util$WritableLocalVariable,jdk/internal/classfile/impl/Util$Writable flags 31 +innerclass innerClass java/lang/classfile/AttributeMapper$AttributeStability outerClass java/lang/classfile/AttributeMapper innerClassName AttributeStability flags 4019 +innerclass innerClass java/lang/classfile/ClassFile$AttributesProcessingOption outerClass java/lang/classfile/ClassFile innerClassName AttributesProcessingOption flags 4019 +innerclass innerClass java/lang/classfile/Opcode$Kind outerClass java/lang/classfile/Opcode innerClassName Kind flags 4019 +innerclass innerClass jdk/internal/classfile/impl/AbstractPoolEntry$Utf8EntryImpl outerClass jdk/internal/classfile/impl/AbstractPoolEntry innerClassName Utf8EntryImpl flags 19 +innerclass innerClass jdk/internal/classfile/impl/Util$Writable outerClass jdk/internal/classfile/impl/Util innerClassName Writable flags 608 +innerclass innerClass jdk/internal/classfile/impl/Util$WritableLocalVariable outerClass jdk/internal/classfile/impl/Util innerClassName WritableLocalVariable flags 608 +innerclass innerClass java/lang/reflect/AccessFlag$Location outerClass java/lang/reflect/AccessFlag innerClassName Location flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name sanitizeU1List descriptor (Ljava/util/List;)Ljava/util/List; flags 9 signature (Ljava/util/List;)Ljava/util/List; +method name sanitizeU2List descriptor (Ljava/util/Collection;)Ljava/util/List; flags 9 signature (Ljava/util/Collection;)Ljava/util/List; +method name sanitizeParameterAnnotations descriptor (Ljava/util/List;)Ljava/util/List; flags 9 signature (Ljava/util/List;>;)Ljava/util/List;>; +method name checkU1 descriptor (ILjava/lang/String;)I flags 9 +method name checkU2 descriptor (ILjava/lang/String;)C flags 9 +method name outOfRangeException descriptor (ILjava/lang/String;Ljava/lang/String;)Ljava/lang/IllegalArgumentException; flags 9 +method name checkFlags descriptor (I)C flags 9 + +class name jdk/internal/constant/AsTypeMethodHandleDesc +header extends java/lang/constant/DynamicConstantDesc implements java/lang/constant/MethodHandleDesc flags 31 signature Ljava/lang/constant/DynamicConstantDesc;Ljava/lang/constant/MethodHandleDesc; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +innerclass innerClass java/lang/constant/DirectMethodHandleDesc$Kind outerClass java/lang/constant/DirectMethodHandleDesc innerClassName Kind flags 4019 +method name descriptor (Ljava/lang/constant/MethodHandleDesc;Ljava/lang/constant/MethodTypeDesc;)V flags 1 +method name invocationType descriptor ()Ljava/lang/constant/MethodTypeDesc; flags 1 +method name resolveConstantDesc descriptor (Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/invoke/MethodHandle; thrownTypes java/lang/ReflectiveOperationException flags 1 +method name toString descriptor ()Ljava/lang/String; flags 1 +method name resolveConstantDesc descriptor (Ljava/lang/invoke/MethodHandles$Lookup;)Ljava/lang/Object; thrownTypes java/lang/ReflectiveOperationException flags 1041 methodParameters 1000:null + +class name jdk/internal/constant/PrimitiveClassDescImpl +header extends java/lang/constant/DynamicConstantDesc implements java/lang/constant/ClassDesc flags 31 signature Ljava/lang/constant/DynamicConstantDesc;>;Ljava/lang/constant/ClassDesc; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +innerclass innerClass java/lang/invoke/TypeDescriptor$OfField outerClass java/lang/invoke/TypeDescriptor innerClassName OfField flags 609 + +class name jdk/internal/lang/LazyConstantImpl +header extends java/lang/Object implements java/lang/LazyConstant flags 31 signature Ljava/lang/Object;Ljava/lang/LazyConstant; runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; +method name get descriptor ()Ljava/lang/Object; flags 1 signature ()TT; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name orElse descriptor (Ljava/lang/Object;)Ljava/lang/Object; flags 1 signature (TT;)TT; runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name isInitialized descriptor ()Z flags 1 runtimeAnnotations @Ljdk/internal/vm/annotation/ForceInline; +method name toString descriptor ()Ljava/lang/String; flags 1 +method name ofLazy descriptor (Ljava/util/function/Supplier;)Ljdk/internal/lang/LazyConstantImpl; flags 9 signature (Ljava/util/function/Supplier<+TT;>;)Ljdk/internal/lang/LazyConstantImpl; + +-class name jdk/internal/lang/stable/StableValueImpl + +class name jdk/internal/vm/vector/VectorSupport +-method name loadWithMap descriptor (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/Object;JLjdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljava/lang/Object;I[IILjdk/internal/vm/vector/VectorSupport$VectorSpecies;Ljdk/internal/vm/vector/VectorSupport$LoadVectorOperationWithMap;)Ljdk/internal/vm/vector/VectorSupport$Vector; +-method name storeWithMap descriptor (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjava/lang/Class;Ljava/lang/Object;JLjdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljava/lang/Object;I[IILjdk/internal/vm/vector/VectorSupport$StoreVectorOperationWithMap;)V +method name loadWithMap descriptor (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjava/lang/Class;ILjava/lang/Object;JLjdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljava/lang/Object;I[IILjdk/internal/vm/vector/VectorSupport$VectorSpecies;Ljdk/internal/vm/vector/VectorSupport$LoadVectorOperationWithMap;)Ljdk/internal/vm/vector/VectorSupport$Vector; flags 9 signature ;W:Ljdk/internal/vm/vector/VectorSupport$Vector;S:Ljdk/internal/vm/vector/VectorSupport$VectorSpecies;M:Ljdk/internal/vm/vector/VectorSupport$VectorMask;E:Ljava/lang/Object;>(Ljava/lang/Class<+TV;>;Ljava/lang/Class;Ljava/lang/Class;ILjava/lang/Class<+Ljdk/internal/vm/vector/VectorSupport$Vector;>;ILjava/lang/Object;JTW;TW;TW;TW;TM;TC;I[IITS;Ljdk/internal/vm/vector/VectorSupport$LoadVectorOperationWithMap;)TV; runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; +method name storeWithMap descriptor (Ljava/lang/Class;Ljava/lang/Class;Ljava/lang/Class;ILjava/lang/Class;ILjava/lang/Object;JLjdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$Vector;Ljdk/internal/vm/vector/VectorSupport$VectorMask;Ljava/lang/Object;I[IILjdk/internal/vm/vector/VectorSupport$StoreVectorOperationWithMap;)V flags 9 signature ;W:Ljdk/internal/vm/vector/VectorSupport$Vector;M:Ljdk/internal/vm/vector/VectorSupport$VectorMask;E:Ljava/lang/Object;>(Ljava/lang/Class<+TV;>;Ljava/lang/Class;Ljava/lang/Class;ILjava/lang/Class<+Ljdk/internal/vm/vector/VectorSupport$Vector;>;ILjava/lang/Object;JTW;TV;TM;TC;I[IILjdk/internal/vm/vector/VectorSupport$StoreVectorOperationWithMap;)V runtimeAnnotations @Ljdk/internal/vm/annotation/IntrinsicCandidate; + +class name sun/nio/Cleaner +header extends java/lang/Object flags 601 +method name clean descriptor ()V flags 401 + +class name sun/nio/ch/DirectBuffer +-method name cleaner descriptor ()Ljdk/internal/ref/Cleaner; +method name cleaner descriptor ()Lsun/nio/Cleaner; flags 401 + diff --git a/src/jdk.compiler/share/data/symbols/java.compiler-Q.sym.txt b/src/jdk.compiler/share/data/symbols/java.compiler-Q.sym.txt new file mode 100644 index 00000000000..cb6ad893ace --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/java.compiler-Q.sym.txt @@ -0,0 +1,85 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name javax/lang/model/SourceVersion +field name RELEASE_26 descriptor Ljavax/lang/model/SourceVersion; flags 4019 + +class name javax/lang/model/util/AbstractAnnotationValueVisitor14 +header extends javax/lang/model/util/AbstractAnnotationValueVisitor9 flags 421 signature Ljavax/lang/model/util/AbstractAnnotationValueVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/AbstractAnnotationValueVisitorPreview +header extends javax/lang/model/util/AbstractAnnotationValueVisitor14 flags 421 signature Ljavax/lang/model/util/AbstractAnnotationValueVisitor14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/AbstractElementVisitor14 +header extends javax/lang/model/util/AbstractElementVisitor9 flags 421 signature Ljavax/lang/model/util/AbstractElementVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/AbstractElementVisitorPreview +header extends javax/lang/model/util/AbstractElementVisitor14 flags 421 signature Ljavax/lang/model/util/AbstractElementVisitor14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/AbstractTypeVisitor14 +header extends javax/lang/model/util/AbstractTypeVisitor9 flags 421 signature Ljavax/lang/model/util/AbstractTypeVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/AbstractTypeVisitorPreview +header extends javax/lang/model/util/AbstractTypeVisitor14 flags 421 signature Ljavax/lang/model/util/AbstractTypeVisitor14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/ElementKindVisitor14 +header extends javax/lang/model/util/ElementKindVisitor9 flags 21 signature Ljavax/lang/model/util/ElementKindVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/ElementKindVisitorPreview +header extends javax/lang/model/util/ElementKindVisitor14 flags 21 signature Ljavax/lang/model/util/ElementKindVisitor14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/ElementScanner14 +header extends javax/lang/model/util/ElementScanner9 flags 21 signature Ljavax/lang/model/util/ElementScanner9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/ElementScannerPreview +header extends javax/lang/model/util/ElementScanner14 flags 21 signature Ljavax/lang/model/util/ElementScanner14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/SimpleAnnotationValueVisitor14 +header extends javax/lang/model/util/SimpleAnnotationValueVisitor9 flags 21 signature Ljavax/lang/model/util/SimpleAnnotationValueVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/SimpleAnnotationValueVisitorPreview +header extends javax/lang/model/util/SimpleAnnotationValueVisitor14 flags 21 signature Ljavax/lang/model/util/SimpleAnnotationValueVisitor14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/SimpleElementVisitor14 +header extends javax/lang/model/util/SimpleElementVisitor9 flags 21 signature Ljavax/lang/model/util/SimpleElementVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/SimpleElementVisitorPreview +header extends javax/lang/model/util/SimpleElementVisitor14 flags 21 signature Ljavax/lang/model/util/SimpleElementVisitor14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/SimpleTypeVisitor14 +header extends javax/lang/model/util/SimpleTypeVisitor9 flags 21 signature Ljavax/lang/model/util/SimpleTypeVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/SimpleTypeVisitorPreview +header extends javax/lang/model/util/SimpleTypeVisitor14 flags 21 signature Ljavax/lang/model/util/SimpleTypeVisitor14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/TypeKindVisitor14 +header extends javax/lang/model/util/TypeKindVisitor9 flags 21 signature Ljavax/lang/model/util/TypeKindVisitor9; runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + +class name javax/lang/model/util/TypeKindVisitorPreview +header extends javax/lang/model/util/TypeKindVisitor14 flags 21 signature Ljavax/lang/model/util/TypeKindVisitor14; classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;LANGUAGE_MODEL;,reflective=Ztrue) runtimeAnnotations @Ljavax/annotation/processing/SupportedSourceVersion;(value=eLjavax/lang/model/SourceVersion;RELEASE_26;) + diff --git a/src/jdk.compiler/share/data/symbols/java.desktop-Q.sym.txt b/src/jdk.compiler/share/data/symbols/java.desktop-Q.sym.txt new file mode 100644 index 00000000000..f75ff5b3fac --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/java.desktop-Q.sym.txt @@ -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. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name java.desktop +header exports java/awt,java/awt/color,java/awt/desktop,java/awt/dnd,java/awt/event,java/awt/font,java/awt/geom,java/awt/im,java/awt/im/spi,java/awt/image,java/awt/image/renderable,java/awt/print,java/beans,java/beans/beancontext,javax/accessibility,javax/imageio,javax/imageio/event,javax/imageio/metadata,javax/imageio/plugins/bmp,javax/imageio/plugins/jpeg,javax/imageio/plugins/tiff,javax/imageio/spi,javax/imageio/stream,javax/print,javax/print/attribute,javax/print/attribute/standard,javax/print/event,javax/sound,javax/sound/midi,javax/sound/midi/spi,javax/sound/sampled,javax/sound/sampled/spi,javax/swing,javax/swing/border,javax/swing/colorchooser,javax/swing/event,javax/swing/filechooser,javax/swing/plaf,javax/swing/plaf/basic,javax/swing/plaf/metal,javax/swing/plaf/multi,javax/swing/plaf/nimbus,javax/swing/plaf/synth,javax/swing/table,javax/swing/text,javax/swing/text/html,javax/swing/text/html/parser,javax/swing/text/rtf,javax/swing/tree,javax/swing/undo extraModulePackages sun/print requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.prefs\u0020;flags\u0020;0,name\u0020;java.datatransfer\u0020;flags\u0020;20,name\u0020;java.xml\u0020;flags\u0020;20 uses java/awt/im/spi/InputMethodDescriptor,javax/accessibility/AccessibilityProvider,javax/imageio/spi/ImageInputStreamSpi,javax/imageio/spi/ImageOutputStreamSpi,javax/imageio/spi/ImageReaderSpi,javax/imageio/spi/ImageTranscoderSpi,javax/imageio/spi/ImageWriterSpi,javax/print/PrintServiceLookup,javax/print/StreamPrintServiceFactory,javax/sound/midi/spi/MidiDeviceProvider,javax/sound/midi/spi/MidiFileReader,javax/sound/midi/spi/MidiFileWriter,javax/sound/midi/spi/SoundbankReader,javax/sound/sampled/spi/AudioFileReader,javax/sound/sampled/spi/AudioFileWriter,javax/sound/sampled/spi/FormatConversionProvider,javax/sound/sampled/spi/MixerProvider,sun/swing/InteropProvider provides interface\u0020;sun/datatransfer/DesktopDatatransferService\u0020;impls\u0020;sun/awt/datatransfer/DesktopDatatransferServiceImpl,interface\u0020;java/net/ContentHandlerFactory\u0020;impls\u0020;sun/awt/www/content/MultimediaContentHandlers,interface\u0020;javax/print/PrintServiceLookup\u0020;impls\u0020;sun/print/PrintServiceLookupProvider,interface\u0020;javax/print/StreamPrintServiceFactory\u0020;impls\u0020;sun/print/PSStreamPrinterFactory,interface\u0020;javax/sound/midi/spi/MidiDeviceProvider\u0020;impls\u0020;com/sun/media/sound/MidiInDeviceProvider\u005C;u002C;com/sun/media/sound/MidiOutDeviceProvider\u005C;u002C;com/sun/media/sound/RealTimeSequencerProvider\u005C;u002C;com/sun/media/sound/SoftProvider,interface\u0020;javax/sound/midi/spi/MidiFileReader\u0020;impls\u0020;com/sun/media/sound/StandardMidiFileReader,interface\u0020;javax/sound/midi/spi/MidiFileWriter\u0020;impls\u0020;com/sun/media/sound/StandardMidiFileWriter,interface\u0020;javax/sound/midi/spi/SoundbankReader\u0020;impls\u0020;com/sun/media/sound/AudioFileSoundbankReader\u005C;u002C;com/sun/media/sound/DLSSoundbankReader\u005C;u002C;com/sun/media/sound/JARSoundbankReader\u005C;u002C;com/sun/media/sound/SF2SoundbankReader,interface\u0020;javax/sound/sampled/spi/AudioFileReader\u0020;impls\u0020;com/sun/media/sound/AiffFileReader\u005C;u002C;com/sun/media/sound/AuFileReader\u005C;u002C;com/sun/media/sound/SoftMidiAudioFileReader\u005C;u002C;com/sun/media/sound/WaveFileReader\u005C;u002C;com/sun/media/sound/WaveFloatFileReader\u005C;u002C;com/sun/media/sound/WaveExtensibleFileReader,interface\u0020;javax/sound/sampled/spi/AudioFileWriter\u0020;impls\u0020;com/sun/media/sound/AiffFileWriter\u005C;u002C;com/sun/media/sound/AuFileWriter\u005C;u002C;com/sun/media/sound/WaveFileWriter\u005C;u002C;com/sun/media/sound/WaveFloatFileWriter,interface\u0020;javax/sound/sampled/spi/FormatConversionProvider\u0020;impls\u0020;com/sun/media/sound/AlawCodec\u005C;u002C;com/sun/media/sound/AudioFloatFormatConverter\u005C;u002C;com/sun/media/sound/PCMtoPCMCodec\u005C;u002C;com/sun/media/sound/UlawCodec,interface\u0020;javax/sound/sampled/spi/MixerProvider\u0020;impls\u0020;com/sun/media/sound/DirectAudioDeviceProvider\u005C;u002C;com/sun/media/sound/PortMixerProvider target macos-aarch64 flags 8000 + +-class name java/applet/Applet + +-class name java/applet/Applet$AccessibleApplet + +-class name java/applet/AppletContext + +-class name java/applet/AppletStub + +-class name java/applet/AudioClip + +class name java/awt/Robot +field name DEFAULT_DELAY descriptor I constantValue 20 flags 19 +field name DEFAULT_STEP_LENGTH descriptor I constantValue 2 flags 19 +method name click descriptor (I)V flags 1 +method name click descriptor ()V flags 1 +method name waitForIdle descriptor (I)V flags 1 +method name glide descriptor (II)V flags 1 +method name glide descriptor (IIII)V flags 1 +method name glide descriptor (IIIIII)V flags 1 +method name type descriptor (I)V flags 21 +method name type descriptor (C)V flags 21 + +-class name java/beans/AppletInitializer + +class name java/beans/Beans +-method name instantiate descriptor (Ljava/lang/ClassLoader;Ljava/lang/String;Ljava/beans/beancontext/BeanContext;Ljava/beans/AppletInitializer;)Ljava/lang/Object; + +class name javax/imageio/spi/ServiceRegistry +-method name finalize descriptor ()V + +class name javax/imageio/stream/FileCacheImageInputStream +-method name finalize descriptor ()V + +class name javax/imageio/stream/FileImageInputStream +-method name finalize descriptor ()V + +class name javax/imageio/stream/FileImageOutputStream +-method name finalize descriptor ()V + +class name javax/imageio/stream/ImageInputStreamImpl +-method name finalize descriptor ()V + +class name javax/imageio/stream/MemoryCacheImageInputStream +-method name finalize descriptor ()V + +-class name javax/swing/JApplet + +-class name javax/swing/JApplet$AccessibleJApplet + +class name javax/swing/JTable +-method name setShowGrid descriptor (Z)V +method name setShowGrid descriptor (Z)V flags 1 runtimeAnnotations @Ljava/beans/BeanProperty;(description="Whether\u005C;u0020;grid\u005C;u0020;lines\u005C;u0020;are\u005C;u0020;drawn\u005C;u0020;around\u005C;u0020;the\u005C;u0020;cells.") + +class name javax/swing/RepaintManager +-method name addDirtyRegion descriptor (Ljava/applet/Applet;IIII)V + +class name javax/swing/plaf/synth/SynthPasswordFieldUI +-method name installKeyboardActions descriptor ()V + diff --git a/src/jdk.compiler/share/data/symbols/java.management-Q.sym.txt b/src/jdk.compiler/share/data/symbols/java.management-Q.sym.txt new file mode 100644 index 00000000000..03dacce810b --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/java.management-Q.sym.txt @@ -0,0 +1,37 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/lang/management/MemoryMXBean +method name getTotalGcCpuTime descriptor ()J flags 1 + +class name javax/management/modelmbean/DescriptorSupport +-method name descriptor (Ljava/lang/String;)V +-method name toXMLString descriptor ()Ljava/lang/String; + +-class name javax/management/modelmbean/XMLParseException + diff --git a/src/jdk.compiler/share/data/symbols/java.net.http-Q.sym.txt b/src/jdk.compiler/share/data/symbols/java.net.http-Q.sym.txt new file mode 100644 index 00000000000..bddf5c8d137 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/java.net.http-Q.sym.txt @@ -0,0 +1,125 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/net/http/HttpClient$Version +field name HTTP_3 descriptor Ljava/net/http/HttpClient$Version; flags 4019 + +class name java/net/http/HttpOption +header extends java/lang/Object nestMembers java/net/http/HttpOption$Http3DiscoveryMode sealed true permittedSubclasses java/net/http/HttpRequestOptionImpl flags 601 signature Ljava/lang/Object; +innerclass innerClass java/net/http/HttpOption$Http3DiscoveryMode outerClass java/net/http/HttpOption innerClassName Http3DiscoveryMode flags 4019 +field name H3_DISCOVERY descriptor Ljava/net/http/HttpOption; flags 19 signature Ljava/net/http/HttpOption; +method name name descriptor ()Ljava/lang/String; flags 401 +method name type descriptor ()Ljava/lang/Class; flags 401 signature ()Ljava/lang/Class; + +class name java/net/http/HttpOption$Http3DiscoveryMode +header extends java/lang/Enum nestHost java/net/http/HttpOption flags 4031 signature Ljava/lang/Enum; +innerclass innerClass java/net/http/HttpOption$Http3DiscoveryMode outerClass java/net/http/HttpOption innerClassName Http3DiscoveryMode flags 4019 +field name ANY descriptor Ljava/net/http/HttpOption$Http3DiscoveryMode; flags 4019 +field name ALT_SVC descriptor Ljava/net/http/HttpOption$Http3DiscoveryMode; flags 4019 +field name HTTP_3_URI_ONLY descriptor Ljava/net/http/HttpOption$Http3DiscoveryMode; flags 4019 +method name values descriptor ()[Ljava/net/http/HttpOption$Http3DiscoveryMode; flags 9 +method name valueOf descriptor (Ljava/lang/String;)Ljava/net/http/HttpOption$Http3DiscoveryMode; flags 9 methodParameters 8000:null + +class name java/net/http/HttpRequest +header extends java/lang/Object nestMembers java/net/http/HttpRequest$BodyPublishers,java/net/http/HttpRequest$BodyPublisher,java/net/http/HttpRequest$Builder flags 421 +innerclass innerClass java/net/http/HttpRequest$Builder outerClass java/net/http/HttpRequest innerClassName Builder flags 609 +innerclass innerClass java/net/http/HttpRequest$BodyPublishers outerClass java/net/http/HttpRequest innerClassName BodyPublishers flags 9 +innerclass innerClass java/net/http/HttpRequest$BodyPublisher outerClass java/net/http/HttpRequest innerClassName BodyPublisher flags 609 +innerclass innerClass java/net/http/HttpClient$Version outerClass java/net/http/HttpClient innerClassName Version flags 4019 +innerclass innerClass java/net/http/HttpOption$Http3DiscoveryMode outerClass java/net/http/HttpOption innerClassName Http3DiscoveryMode flags 4019 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name getOption descriptor (Ljava/net/http/HttpOption;)Ljava/util/Optional; flags 1 signature (Ljava/net/http/HttpOption;)Ljava/util/Optional; + +class name java/net/http/HttpRequest$BodyPublishers +method name ofFileChannel descriptor (Ljava/nio/channels/FileChannel;JJ)Ljava/net/http/HttpRequest$BodyPublisher; thrownTypes java/io/IOException flags 9 + +class name java/net/http/HttpRequest$Builder +method name setOption descriptor (Ljava/net/http/HttpOption;Ljava/lang/Object;)Ljava/net/http/HttpRequest$Builder; flags 1 signature (Ljava/net/http/HttpOption;TT;)Ljava/net/http/HttpRequest$Builder; + +class name java/net/http/HttpRequestOptionImpl +header extends java/lang/Record implements java/net/http/HttpOption record true flags 30 signature Ljava/lang/Record;Ljava/net/http/HttpOption; +recordcomponent name type descriptor Ljava/lang/Class; signature Ljava/lang/Class; +recordcomponent name name descriptor Ljava/lang/String; +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name toString descriptor ()Ljava/lang/String; flags 1 +method name hashCode descriptor ()I flags 11 +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name type descriptor ()Ljava/lang/Class; flags 1 signature ()Ljava/lang/Class; +method name name descriptor ()Ljava/lang/String; flags 1 + +class name java/net/http/HttpResponse +header extends java/lang/Object nestMembers java/net/http/HttpResponse$BodySubscribers,java/net/http/HttpResponse$BodySubscriber,java/net/http/HttpResponse$PushPromiseHandler,java/net/http/HttpResponse$PushPromiseHandler$PushId,java/net/http/HttpResponse$PushPromiseHandler$PushId$Http3PushId,java/net/http/HttpResponse$BodyHandlers,java/net/http/HttpResponse$BodyHandler,java/net/http/HttpResponse$ResponseInfo flags 601 signature Ljava/lang/Object; +innerclass innerClass java/net/http/HttpResponse$BodySubscribers outerClass java/net/http/HttpResponse innerClassName BodySubscribers flags 9 +innerclass innerClass java/net/http/HttpResponse$BodySubscriber outerClass java/net/http/HttpResponse innerClassName BodySubscriber flags 609 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler outerClass java/net/http/HttpResponse innerClassName PushPromiseHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$BodyHandlers outerClass java/net/http/HttpResponse innerClassName BodyHandlers flags 9 +innerclass innerClass java/net/http/HttpResponse$BodyHandler outerClass java/net/http/HttpResponse innerClassName BodyHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$ResponseInfo outerClass java/net/http/HttpResponse innerClassName ResponseInfo flags 609 +innerclass innerClass java/net/http/HttpClient$Version outerClass java/net/http/HttpClient innerClassName Version flags 4019 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler$PushId outerClass java/net/http/HttpResponse$PushPromiseHandler innerClassName PushId flags 609 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler$PushId$Http3PushId outerClass java/net/http/HttpResponse$PushPromiseHandler$PushId innerClassName Http3PushId flags 19 + +class name java/net/http/HttpResponse$PushPromiseHandler +header extends java/lang/Object nestHost java/net/http/HttpResponse flags 601 signature Ljava/lang/Object; +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler outerClass java/net/http/HttpResponse innerClassName PushPromiseHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler$PushId outerClass java/net/http/HttpResponse$PushPromiseHandler innerClassName PushId flags 609 +innerclass innerClass java/net/http/HttpResponse$BodyHandler outerClass java/net/http/HttpResponse innerClassName BodyHandler flags 609 +method name applyPushPromise descriptor (Ljava/net/http/HttpRequest;Ljava/net/http/HttpRequest;Ljava/net/http/HttpResponse$PushPromiseHandler$PushId;Ljava/util/function/Function;)V flags 1 signature (Ljava/net/http/HttpRequest;Ljava/net/http/HttpRequest;Ljava/net/http/HttpResponse$PushPromiseHandler$PushId;Ljava/util/function/Function;Ljava/util/concurrent/CompletableFuture;>;>;)V +method name notifyAdditionalPromise descriptor (Ljava/net/http/HttpRequest;Ljava/net/http/HttpResponse$PushPromiseHandler$PushId;)V flags 1 + +class name java/net/http/HttpResponse$PushPromiseHandler$PushId +header extends java/lang/Object nestHost java/net/http/HttpResponse sealed true permittedSubclasses java/net/http/HttpResponse$PushPromiseHandler$PushId$Http3PushId flags 601 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler outerClass java/net/http/HttpResponse innerClassName PushPromiseHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler$PushId outerClass java/net/http/HttpResponse$PushPromiseHandler innerClassName PushId flags 609 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler$PushId$Http3PushId outerClass java/net/http/HttpResponse$PushPromiseHandler$PushId innerClassName Http3PushId flags 19 + +class name java/net/http/HttpResponse$PushPromiseHandler$PushId$Http3PushId +header extends java/lang/Record implements java/net/http/HttpResponse$PushPromiseHandler$PushId nestHost java/net/http/HttpResponse record true flags 31 +recordcomponent name pushId descriptor J +recordcomponent name connectionLabel descriptor Ljava/lang/String; +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler outerClass java/net/http/HttpResponse innerClassName PushPromiseHandler flags 609 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler$PushId outerClass java/net/http/HttpResponse$PushPromiseHandler innerClassName PushId flags 609 +innerclass innerClass java/net/http/HttpResponse$PushPromiseHandler$PushId$Http3PushId outerClass java/net/http/HttpResponse$PushPromiseHandler$PushId innerClassName Http3PushId flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name descriptor (JLjava/lang/String;)V flags 1 methodParameters 0:pushId,0:connectionLabel +method name toString descriptor ()Ljava/lang/String; flags 11 +method name hashCode descriptor ()I flags 11 +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name pushId descriptor ()J flags 1 +method name connectionLabel descriptor ()Ljava/lang/String; flags 1 + +class name java/net/http/StreamLimitException +header extends java/io/IOException flags 31 +innerclass innerClass java/net/http/HttpClient$Version outerClass java/net/http/HttpClient innerClassName Version flags 4019 +method name descriptor (Ljava/net/http/HttpClient$Version;Ljava/lang/String;)V flags 1 +method name version descriptor ()Ljava/net/http/HttpClient$Version; flags 11 + +class name java/net/http/UnsupportedProtocolVersionException +header extends java/io/IOException flags 31 +method name descriptor (Ljava/lang/String;)V flags 1 + diff --git a/src/jdk.compiler/share/data/symbols/java.sql-Q.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-Q.sym.txt new file mode 100644 index 00000000000..a8f41a27db0 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/java.sql-Q.sym.txt @@ -0,0 +1,64 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/sql/Array +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +method name close descriptor ()V thrownTypes java/sql/SQLException flags 1 + +class name java/sql/Blob +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +method name close descriptor ()V thrownTypes java/sql/SQLException flags 1 + +class name java/sql/Clob +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +method name close descriptor ()V thrownTypes java/sql/SQLException flags 1 + +class name java/sql/Connection +method name enquoteLiteral descriptor (Ljava/lang/String;)Ljava/lang/String; thrownTypes java/sql/SQLException flags 1 +method name enquoteIdentifier descriptor (Ljava/lang/String;Z)Ljava/lang/String; thrownTypes java/sql/SQLException flags 1 +method name isSimpleIdentifier descriptor (Ljava/lang/String;)Z thrownTypes java/sql/SQLException flags 1 +method name enquoteNCharLiteral descriptor (Ljava/lang/String;)Ljava/lang/String; thrownTypes java/sql/SQLException flags 1 + +class name java/sql/JDBCType +field name DECFLOAT descriptor Ljava/sql/JDBCType; flags 4019 +field name JSON descriptor Ljava/sql/JDBCType; flags 4019 + +class name java/sql/SQLPermission +header extends java/security/BasicPermission flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="26") + +class name java/sql/SQLXML +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +method name close descriptor ()V thrownTypes java/sql/SQLException flags 1 + +class name java/sql/Statement +header extends java/lang/Object implements java/sql/Wrapper,java/lang/AutoCloseable flags 601 classAnnotations @Ljdk/Profile+Annotation;(value=I2) + +class name java/sql/Types +field name DECFLOAT descriptor I constantValue 2015 flags 19 +field name JSON descriptor I constantValue 2016 flags 19 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.httpserver-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.httpserver-Q.sym.txt new file mode 100644 index 00000000000..70cc330edca --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.httpserver-Q.sym.txt @@ -0,0 +1,32 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name com/sun/net/httpserver/HttpExchange +field name RSPBODY_EMPTY descriptor J constantValue -1 flags 19 +field name RSPBODY_CHUNKED descriptor J constantValue 0 flags 19 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-Q.sym.txt new file mode 100644 index 00000000000..2d774f83cf1 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-Q.sym.txt @@ -0,0 +1,43 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/internal/foreign/AbstractMemorySegmentImpl +header extends java/lang/Object implements java/lang/foreign/MemorySegment,java/lang/foreign/SegmentAllocator sealed true permittedSubclasses jdk/internal/foreign/HeapMemorySegmentImpl,jdk/internal/foreign/NativeMemorySegmentImpl flags 421 +innerclass innerClass java/lang/foreign/ValueLayout$OfByte outerClass java/lang/foreign/ValueLayout innerClassName OfByte flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfBoolean outerClass java/lang/foreign/ValueLayout innerClassName OfBoolean flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfChar outerClass java/lang/foreign/ValueLayout innerClassName OfChar flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfShort outerClass java/lang/foreign/ValueLayout innerClassName OfShort flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfInt outerClass java/lang/foreign/ValueLayout innerClassName OfInt flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfFloat outerClass java/lang/foreign/ValueLayout innerClassName OfFloat flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfLong outerClass java/lang/foreign/ValueLayout innerClassName OfLong flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfDouble outerClass java/lang/foreign/ValueLayout innerClassName OfDouble flags 609 +innerclass innerClass java/lang/foreign/MemorySegment$Scope outerClass java/lang/foreign/MemorySegment innerClassName Scope flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name apply descriptor (Ljava/lang/String;Ljava/util/List;)Ljava/lang/RuntimeException; +-method name apply descriptor (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + diff --git a/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-Q.sym.txt new file mode 100644 index 00000000000..223be24ab56 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.incubator.vector-Q.sym.txt @@ -0,0 +1,32 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/incubator/vector/VectorOperators +-field name SUADD descriptor Ljdk/incubator/vector/VectorOperators$Binary; +field name SUADD descriptor Ljdk/incubator/vector/VectorOperators$Associative; flags 19 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.jartool-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jartool-Q.sym.txt new file mode 100644 index 00000000000..47838de0844 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.jartool-Q.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jartool +header exports jdk/security/jarsigner requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.internal.opt\u0020;flags\u0020;0 provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;sun/tools/jar/JarToolProvider target macos-aarch64 moduleMainClass sun/tools/jar/Main flags 8000 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.jdeps-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jdeps-Q.sym.txt new file mode 100644 index 00000000000..e5d0bb627e5 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.jdeps-Q.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jdeps +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.compiler\u0020;flags\u0020;0,name\u0020;jdk.compiler\u0020;flags\u0020;0,name\u0020;jdk.internal.opt\u0020;flags\u0020;0 uses com/sun/tools/javac/platform/PlatformProvider provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;com/sun/tools/javap/Main$JavapToolProvider\u005C;u002C;com/sun/tools/jdeps/Main$JDepsToolProvider\u005C;u002C;com/sun/tools/jnativescan/Main$Provider target macos-aarch64 flags 8000 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.jfr-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jfr-Q.sym.txt new file mode 100644 index 00000000000..2e3c13ea64c --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.jfr-Q.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jfr +header exports jdk/jfr,jdk/jfr/consumer requires name\u0020;java.base\u0020;flags\u0020;8000 target macos-aarch64 moduleMainClass jdk/jfr/internal/tool/Main flags 8000 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.jlink-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jlink-Q.sym.txt new file mode 100644 index 00000000000..e3e9eadf355 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.jlink-Q.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jlink +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.internal.opt\u0020;flags\u0020;0,name\u0020;jdk.jdeps\u0020;flags\u0020;0 uses jdk/tools/jlink/plugin/Plugin provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/tools/jmod/Main$JmodToolProvider\u005C;u002C;jdk/tools/jlink/internal/Main$JlinkToolProvider,interface\u0020;jdk/tools/jlink/plugin/Plugin\u0020;impls\u0020;jdk/tools/jlink/internal/plugins/DefaultStripDebugPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludePlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeJmodSectionPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/LegalNoticeFilePlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/SystemModulesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/OrderResourcesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/DefaultCompressPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ExcludeVMPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/AddOptionsPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/VendorBugURLPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/VendorVMBugURLPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/VendorVersionPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/CDSPlugin\u005C;u002C;jdk/tools/jlink/internal/plugins/SaveJlinkArgfilesPlugin target macos-aarch64 flags 8000 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.jpackage-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jpackage-Q.sym.txt new file mode 100644 index 00000000000..27fd9e69203 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.jpackage-Q.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jpackage +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.internal.opt\u0020;flags\u0020;0,name\u0020;jdk.jlink\u0020;flags\u0020;0,name\u0020;java.naming\u0020;flags\u0020;0,name\u0020;java.desktop\u0020;flags\u0020;0 uses jdk/jpackage/internal/cli/CliBundlingEnvironment provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/jpackage/internal/cli/Main$Provider,interface\u0020;jdk/jpackage/internal/cli/CliBundlingEnvironment\u0020;impls\u0020;jdk/jpackage/internal/MacBundlingEnvironment target macos-aarch64 moduleMainClass jdk/jpackage/main/Main flags 8000 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.jshell-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jshell-Q.sym.txt new file mode 100644 index 00000000000..1dff60fc776 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.jshell-Q.sym.txt @@ -0,0 +1,169 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jshell +header exports jdk/jshell,jdk/jshell/execution,jdk/jshell/spi,jdk/jshell/tool requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;java.logging\u0020;flags\u0020;0,name\u0020;jdk.compiler\u0020;flags\u0020;0,name\u0020;jdk.internal.ed\u0020;flags\u0020;0,name\u0020;jdk.internal.le\u0020;flags\u0020;0,name\u0020;jdk.internal.md\u0020;flags\u0020;0,name\u0020;jdk.internal.opt\u0020;flags\u0020;0,name\u0020;java.compiler\u0020;flags\u0020;20,name\u0020;java.prefs\u0020;flags\u0020;20,name\u0020;jdk.jdi\u0020;flags\u0020;20 uses jdk/jshell/spi/ExecutionControlProvider,jdk/internal/editor/spi/BuildInEditorProvider provides interface\u0020;javax/tools/Tool\u0020;impls\u0020;jdk/internal/jshell/tool/JShellToolProvider,interface\u0020;jdk/jshell/spi/ExecutionControlProvider\u0020;impls\u0020;jdk/jshell/execution/JdiExecutionControlProvider\u005C;u002C;jdk/jshell/execution/LocalExecutionControlProvider\u005C;u002C;jdk/jshell/execution/FailOverExecutionControlProvider,interface\u0020;jdk/internal/io/JdkConsoleProvider\u0020;impls\u0020;jdk/jshell/execution/impl/ConsoleImpl$ConsoleProviderImpl target macos-aarch64 moduleMainClass jdk/internal/jshell/tool/JShellToolProvider flags 8000 + +class name jdk/jshell/SourceCodeAnalysis +header extends java/lang/Object nestMembers jdk/jshell/SourceCodeAnalysis$Attribute,jdk/jshell/SourceCodeAnalysis$Highlight,jdk/jshell/SourceCodeAnalysis$SnippetWrapper,jdk/jshell/SourceCodeAnalysis$QualifiedNames,jdk/jshell/SourceCodeAnalysis$Documentation,jdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor,jdk/jshell/SourceCodeAnalysis$CompletionContext,jdk/jshell/SourceCodeAnalysis$CompletionState,jdk/jshell/SourceCodeAnalysis$ElementSuggestion,jdk/jshell/SourceCodeAnalysis$Suggestion,jdk/jshell/SourceCodeAnalysis$Completeness,jdk/jshell/SourceCodeAnalysis$CompletionInfo flags 421 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Attribute outerClass jdk/jshell/SourceCodeAnalysis innerClassName Attribute flags 4019 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Highlight outerClass jdk/jshell/SourceCodeAnalysis innerClassName Highlight flags 19 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$SnippetWrapper outerClass jdk/jshell/SourceCodeAnalysis innerClassName SnippetWrapper flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$QualifiedNames outerClass jdk/jshell/SourceCodeAnalysis innerClassName QualifiedNames flags 19 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Documentation outerClass jdk/jshell/SourceCodeAnalysis innerClassName Documentation flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor outerClass jdk/jshell/SourceCodeAnalysis innerClassName ElementSuggestionConvertor flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionContext outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionContext flags 4019 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionState outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionState flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$ElementSuggestion outerClass jdk/jshell/SourceCodeAnalysis innerClassName ElementSuggestion flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Suggestion outerClass jdk/jshell/SourceCodeAnalysis innerClassName Suggestion flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Completeness outerClass jdk/jshell/SourceCodeAnalysis innerClassName Completeness flags 4019 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionInfo outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionInfo flags 609 +method name completionSuggestions descriptor (Ljava/lang/String;ILjdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor;)Ljava/util/List; flags 401 signature (Ljava/lang/String;ILjdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor;)Ljava/util/List; + +class name jdk/jshell/SourceCodeAnalysis$CompletionContext +header extends java/lang/Enum nestHost jdk/jshell/SourceCodeAnalysis flags 4031 signature Ljava/lang/Enum; +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionContext outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionContext flags 4019 +field name ANNOTATION_ATTRIBUTE descriptor Ljdk/jshell/SourceCodeAnalysis$CompletionContext; flags 4019 +field name NO_PAREN descriptor Ljdk/jshell/SourceCodeAnalysis$CompletionContext; flags 4019 +field name TYPES_AS_ANNOTATIONS descriptor Ljdk/jshell/SourceCodeAnalysis$CompletionContext; flags 4019 +field name QUALIFIED descriptor Ljdk/jshell/SourceCodeAnalysis$CompletionContext; flags 4019 +method name values descriptor ()[Ljdk/jshell/SourceCodeAnalysis$CompletionContext; flags 9 +method name valueOf descriptor (Ljava/lang/String;)Ljdk/jshell/SourceCodeAnalysis$CompletionContext; flags 9 methodParameters 8000:null + +class name jdk/jshell/SourceCodeAnalysis$CompletionState +header extends java/lang/Object nestHost jdk/jshell/SourceCodeAnalysis sealed true permittedSubclasses jdk/jshell/SourceCodeAnalysisImpl$CompletionStateImpl flags 601 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionState outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionState flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionContext outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionContext flags 4019 +innerclass innerClass jdk/jshell/SourceCodeAnalysisImpl$CompletionStateImpl outerClass jdk/jshell/SourceCodeAnalysisImpl innerClassName CompletionStateImpl flags 18 +method name availableUsingSimpleName descriptor (Ljavax/lang/model/element/Element;)Z flags 401 +method name completionContext descriptor ()Ljava/util/Set; flags 401 signature ()Ljava/util/Set; +method name selectorType descriptor ()Ljavax/lang/model/type/TypeMirror; flags 401 +method name elementUtils descriptor ()Ljavax/lang/model/util/Elements; flags 401 +method name typeUtils descriptor ()Ljavax/lang/model/util/Types; flags 401 + +class name jdk/jshell/SourceCodeAnalysis$Documentation +method name activeParameterIndex descriptor ()I flags 1 + +class name jdk/jshell/SourceCodeAnalysis$ElementSuggestion +header extends java/lang/Object nestHost jdk/jshell/SourceCodeAnalysis sealed true permittedSubclasses jdk/jshell/SourceCodeAnalysisImpl$ElementSuggestionImpl flags 601 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$ElementSuggestion outerClass jdk/jshell/SourceCodeAnalysis innerClassName ElementSuggestion flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysisImpl$ElementSuggestionImpl outerClass jdk/jshell/SourceCodeAnalysisImpl innerClassName ElementSuggestionImpl flags 18 +method name element descriptor ()Ljavax/lang/model/element/Element; flags 401 +method name keyword descriptor ()Ljava/lang/String; flags 401 +method name matchesType descriptor ()Z flags 401 +method name anchor descriptor ()I flags 401 +method name documentation descriptor ()Ljava/util/function/Supplier; flags 401 signature ()Ljava/util/function/Supplier; + +class name jdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor +header extends java/lang/Object nestHost jdk/jshell/SourceCodeAnalysis flags 601 signature Ljava/lang/Object; +innerclass innerClass jdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor outerClass jdk/jshell/SourceCodeAnalysis innerClassName ElementSuggestionConvertor flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionState outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionState flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$ElementSuggestion outerClass jdk/jshell/SourceCodeAnalysis innerClassName ElementSuggestion flags 609 +method name convert descriptor (Ljdk/jshell/SourceCodeAnalysis$CompletionState;Ljava/util/List;)Ljava/util/List; flags 401 signature (Ljdk/jshell/SourceCodeAnalysis$CompletionState;Ljava/util/List<+Ljdk/jshell/SourceCodeAnalysis$ElementSuggestion;>;)Ljava/util/List; + +class name jdk/jshell/SourceCodeAnalysisImpl +header extends jdk/jshell/SourceCodeAnalysis nestMembers jdk/jshell/SourceCodeAnalysisImpl$CompletionStateImpl,jdk/jshell/SourceCodeAnalysisImpl$ElementSuggestionImpl flags 20 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Completeness outerClass jdk/jshell/SourceCodeAnalysis innerClassName Completeness flags 4019 +innerclass innerClass com/sun/source/tree/Tree$Kind outerClass com/sun/source/tree/Tree innerClassName Kind flags 4019 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor outerClass jdk/jshell/SourceCodeAnalysis innerClassName ElementSuggestionConvertor flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysisImpl$ElementSuggestionImpl outerClass jdk/jshell/SourceCodeAnalysisImpl innerClassName ElementSuggestionImpl flags 18 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionState outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionState flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionContext outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionContext flags 4019 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$QualifiedNames outerClass jdk/jshell/SourceCodeAnalysis innerClassName QualifiedNames flags 19 +innerclass innerClass javax/tools/JavaFileManager$Location outerClass javax/tools/JavaFileManager innerClassName Location flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionInfo outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionInfo flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Documentation outerClass jdk/jshell/SourceCodeAnalysis innerClassName Documentation flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Highlight outerClass jdk/jshell/SourceCodeAnalysis innerClassName Highlight flags 19 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Attribute outerClass jdk/jshell/SourceCodeAnalysis innerClassName Attribute flags 4019 +innerclass innerClass jdk/jshell/SourceCodeAnalysisImpl$CompletionStateImpl outerClass jdk/jshell/SourceCodeAnalysisImpl innerClassName CompletionStateImpl flags 18 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$ElementSuggestion outerClass jdk/jshell/SourceCodeAnalysis innerClassName ElementSuggestion flags 609 +innerclass innerClass java/lang/Thread$UncaughtExceptionHandler outerClass java/lang/Thread innerClassName UncaughtExceptionHandler flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$Suggestion outerClass jdk/jshell/SourceCodeAnalysis innerClassName Suggestion flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$SnippetWrapper outerClass jdk/jshell/SourceCodeAnalysis innerClassName SnippetWrapper flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name analyzeCompletion descriptor (Ljava/lang/String;)Ljdk/jshell/SourceCodeAnalysis$CompletionInfo; flags 1 +method name completionSuggestions descriptor (Ljava/lang/String;I[I)Ljava/util/List; flags 1 signature (Ljava/lang/String;I[I)Ljava/util/List; +method name completionSuggestions descriptor (Ljava/lang/String;ILjdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor;)Ljava/util/List; flags 1 signature (Ljava/lang/String;ILjdk/jshell/SourceCodeAnalysis$ElementSuggestionConvertor;)Ljava/util/List; +method name wrapper descriptor (Ljdk/jshell/Snippet;)Ljdk/jshell/SourceCodeAnalysis$SnippetWrapper; flags 1 +method name wrappers descriptor (Ljava/lang/String;)Ljava/util/List; flags 1 signature (Ljava/lang/String;)Ljava/util/List; +method name sourceToSnippets descriptor (Ljava/lang/String;)Ljava/util/List; flags 1 signature (Ljava/lang/String;)Ljava/util/List; +method name dependents descriptor (Ljdk/jshell/Snippet;)Ljava/util/Collection; flags 1 signature (Ljdk/jshell/Snippet;)Ljava/util/Collection; +method name highlights descriptor (Ljava/lang/String;)Ljava/util/List; flags 1 signature (Ljava/lang/String;)Ljava/util/List; +method name documentation descriptor (Ljava/lang/String;IZ)Ljava/util/List; flags 1 signature (Ljava/lang/String;IZ)Ljava/util/List; +method name close descriptor ()V flags 1 +method name analyzeType descriptor (Ljava/lang/String;I)Ljava/lang/String; flags 1 +method name listQualifiedNames descriptor (Ljava/lang/String;I)Ljdk/jshell/SourceCodeAnalysis$QualifiedNames; flags 1 +method name suspendIndexing descriptor ()V flags 1 +method name resumeIndexing descriptor ()V flags 1 +method name waitBackgroundTaskFinished descriptor ()V thrownTypes java/lang/Exception flags 1 +method name waitCurrentBackgroundTasksFinished descriptor ()V thrownTypes java/lang/Exception flags 9 + +class name jdk/jshell/SourceCodeAnalysisImpl$CompletionStateImpl +header extends java/lang/Object implements jdk/jshell/SourceCodeAnalysis$CompletionState nestHost jdk/jshell/SourceCodeAnalysisImpl flags 30 +innerclass innerClass jdk/jshell/SourceCodeAnalysisImpl$CompletionStateImpl outerClass jdk/jshell/SourceCodeAnalysisImpl innerClassName CompletionStateImpl flags 18 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionState outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionState flags 609 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$CompletionContext outerClass jdk/jshell/SourceCodeAnalysis innerClassName CompletionContext flags 4019 +method name descriptor (Ljava/util/Collection;Ljava/util/Set;Ljavax/lang/model/type/TypeMirror;Ljavax/lang/model/util/Elements;Ljavax/lang/model/util/Types;)V flags 1 signature (Ljava/util/Collection<+Ljavax/lang/model/element/Element;>;Ljava/util/Set;Ljavax/lang/model/type/TypeMirror;Ljavax/lang/model/util/Elements;Ljavax/lang/model/util/Types;)V +method name availableUsingSimpleName descriptor (Ljavax/lang/model/element/Element;)Z flags 1 +method name completionContext descriptor ()Ljava/util/Set; flags 1 signature ()Ljava/util/Set; +method name selectorType descriptor ()Ljavax/lang/model/type/TypeMirror; flags 1 +method name elementUtils descriptor ()Ljavax/lang/model/util/Elements; flags 1 +method name typeUtils descriptor ()Ljavax/lang/model/util/Types; flags 1 + +class name jdk/jshell/SourceCodeAnalysisImpl$ElementSuggestionImpl +header extends java/lang/Record implements jdk/jshell/SourceCodeAnalysis$ElementSuggestion nestHost jdk/jshell/SourceCodeAnalysisImpl record true flags 30 +recordcomponent name element descriptor Ljavax/lang/model/element/Element; +recordcomponent name keyword descriptor Ljava/lang/String; +recordcomponent name matchesType descriptor Z +recordcomponent name anchor descriptor I +recordcomponent name documentation descriptor Ljava/util/function/Supplier; signature Ljava/util/function/Supplier; +innerclass innerClass jdk/jshell/SourceCodeAnalysisImpl$ElementSuggestionImpl outerClass jdk/jshell/SourceCodeAnalysisImpl innerClassName ElementSuggestionImpl flags 18 +innerclass innerClass jdk/jshell/SourceCodeAnalysis$ElementSuggestion outerClass jdk/jshell/SourceCodeAnalysis innerClassName ElementSuggestion flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +method name toString descriptor ()Ljava/lang/String; flags 11 +method name hashCode descriptor ()I flags 11 +method name equals descriptor (Ljava/lang/Object;)Z flags 11 +method name element descriptor ()Ljavax/lang/model/element/Element; flags 1 +method name keyword descriptor ()Ljava/lang/String; flags 1 +method name matchesType descriptor ()Z flags 1 +method name anchor descriptor ()I flags 1 +method name documentation descriptor ()Ljava/util/function/Supplier; flags 1 signature ()Ljava/util/function/Supplier; + +class name jdk/jshell/execution/LocalExecutionControl +header extends jdk/jshell/execution/DirectExecutionControl flags 21 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassBytecodes outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassBytecodes flags 19 +innerclass innerClass java/lang/classfile/ClassFile$Option outerClass java/lang/classfile/ClassFile innerClassName Option flags 609 +innerclass innerClass java/lang/classfile/ClassFile$ClassHierarchyResolverOption outerClass java/lang/classfile/ClassFile innerClassName ClassHierarchyResolverOption flags 609 +innerclass innerClass jdk/jshell/spi/ExecutionControl$StoppedException outerClass jdk/jshell/spi/ExecutionControl innerClassName StoppedException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$InternalException outerClass jdk/jshell/spi/ExecutionControl innerClassName InternalException flags 9 +innerclass innerClass java/lang/classfile/CodeBuilder$BlockCodeBuilder outerClass java/lang/classfile/CodeBuilder innerClassName BlockCodeBuilder flags 609 +innerclass innerClass jdk/jshell/spi/ExecutionControl$ClassInstallException outerClass jdk/jshell/spi/ExecutionControl innerClassName ClassInstallException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$NotImplementedException outerClass jdk/jshell/spi/ExecutionControl innerClassName NotImplementedException flags 9 +innerclass innerClass jdk/jshell/spi/ExecutionControl$EngineTerminationException outerClass jdk/jshell/spi/ExecutionControl innerClassName EngineTerminationException flags 9 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.jsobject-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jsobject-Q.sym.txt new file mode 100644 index 00000000000..c8b83f6800b --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.jsobject-Q.sym.txt @@ -0,0 +1,34 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +-module name jdk.jsobject + +-class name netscape/javascript/JSException + +-class name netscape/javascript/JSObject + diff --git a/src/jdk.compiler/share/data/symbols/jdk.localedata-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.localedata-Q.sym.txt new file mode 100644 index 00000000000..71d9c3fea14 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.localedata-Q.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.localedata +header requires name\u0020;java.base\u0020;flags\u0020;8000 provides interface\u0020;sun/util/locale/provider/LocaleDataMetaInfo\u0020;impls\u0020;sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo\u005C;u002C;sun/util/resources/provider/NonBaseLocaleDataMetaInfo,interface\u0020;sun/util/resources/LocaleData$LocaleDataResourceBundleProvider\u0020;impls\u0020;sun/util/resources/provider/LocaleDataProvider target macos-aarch64 flags 8000 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.management-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.management-Q.sym.txt new file mode 100644 index 00000000000..6d553af80d5 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.management-Q.sym.txt @@ -0,0 +1,32 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/management/HotSpotAOTCacheMXBean +header extends java/lang/Object implements java/lang/management/PlatformManagedObject flags 601 +method name endRecording descriptor ()Z flags 401 + diff --git a/src/jdk.compiler/share/data/symbols/symbols b/src/jdk.compiler/share/data/symbols/symbols index 34619bed887..f31e521513c 100644 --- a/src/jdk.compiler/share/data/symbols/symbols +++ b/src/jdk.compiler/share/data/symbols/symbols @@ -29,7 +29,7 @@ #command used to generate this file: #build.tools.symbolgenerator.CreateSymbols build-description-incremental symbols include.list # -generate platforms 8:9:A:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P +generate platforms 8:9:A:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q platform version 8 files java.activation-8.sym.txt:java.base-8.sym.txt:java.compiler-8.sym.txt:java.corba-8.sym.txt:java.datatransfer-8.sym.txt:java.desktop-8.sym.txt:java.instrument-8.sym.txt:java.logging-8.sym.txt:java.management-8.sym.txt:java.management.rmi-8.sym.txt:java.naming-8.sym.txt:java.prefs-8.sym.txt:java.rmi-8.sym.txt:java.scripting-8.sym.txt:java.security.jgss-8.sym.txt:java.security.sasl-8.sym.txt:java.sql-8.sym.txt:java.sql.rowset-8.sym.txt:java.transaction-8.sym.txt:java.xml-8.sym.txt:java.xml.bind-8.sym.txt:java.xml.crypto-8.sym.txt:java.xml.ws-8.sym.txt:java.xml.ws.annotation-8.sym.txt:jdk.httpserver-8.sym.txt:jdk.management-8.sym.txt:jdk.net-8.sym.txt:jdk.scripting.nashorn-8.sym.txt:jdk.sctp-8.sym.txt:jdk.security.auth-8.sym.txt:jdk.security.jgss-8.sym.txt platform version 9 base 8 files java.activation-9.sym.txt:java.base-9.sym.txt:java.compiler-9.sym.txt:java.corba-9.sym.txt:java.datatransfer-9.sym.txt:java.desktop-9.sym.txt:java.instrument-9.sym.txt:java.logging-9.sym.txt:java.management-9.sym.txt:java.management.rmi-9.sym.txt:java.naming-9.sym.txt:java.prefs-9.sym.txt:java.rmi-9.sym.txt:java.scripting-9.sym.txt:java.se-9.sym.txt:java.se.ee-9.sym.txt:java.security.jgss-9.sym.txt:java.security.sasl-9.sym.txt:java.smartcardio-9.sym.txt:java.sql-9.sym.txt:java.sql.rowset-9.sym.txt:java.transaction-9.sym.txt:java.xml-9.sym.txt:java.xml.bind-9.sym.txt:java.xml.crypto-9.sym.txt:java.xml.ws-9.sym.txt:java.xml.ws.annotation-9.sym.txt:jdk.accessibility-9.sym.txt:jdk.attach-9.sym.txt:jdk.charsets-9.sym.txt:jdk.compiler-9.sym.txt:jdk.crypto.cryptoki-9.sym.txt:jdk.crypto.ec-9.sym.txt:jdk.dynalink-9.sym.txt:jdk.editpad-9.sym.txt:jdk.hotspot.agent-9.sym.txt:jdk.httpserver-9.sym.txt:jdk.incubator.httpclient-9.sym.txt:jdk.jartool-9.sym.txt:jdk.javadoc-9.sym.txt:jdk.jcmd-9.sym.txt:jdk.jconsole-9.sym.txt:jdk.jdeps-9.sym.txt:jdk.jdi-9.sym.txt:jdk.jdwp.agent-9.sym.txt:jdk.jlink-9.sym.txt:jdk.jshell-9.sym.txt:jdk.jsobject-9.sym.txt:jdk.jstatd-9.sym.txt:jdk.localedata-9.sym.txt:jdk.management-9.sym.txt:jdk.management.agent-9.sym.txt:jdk.naming.dns-9.sym.txt:jdk.naming.rmi-9.sym.txt:jdk.net-9.sym.txt:jdk.pack-9.sym.txt:jdk.policytool-9.sym.txt:jdk.rmic-9.sym.txt:jdk.scripting.nashorn-9.sym.txt:jdk.sctp-9.sym.txt:jdk.security.auth-9.sym.txt:jdk.security.jgss-9.sym.txt:jdk.unsupported-9.sym.txt:jdk.xml.dom-9.sym.txt:jdk.zipfs-9.sym.txt platform version A base 9 files java.activation-A.sym.txt:java.base-A.sym.txt:java.compiler-A.sym.txt:java.corba-A.sym.txt:java.datatransfer-A.sym.txt:java.desktop-A.sym.txt:java.instrument-A.sym.txt:java.logging-A.sym.txt:java.management-A.sym.txt:java.management.rmi-A.sym.txt:java.naming-A.sym.txt:java.prefs-A.sym.txt:java.rmi-A.sym.txt:java.scripting-A.sym.txt:java.se-A.sym.txt:java.se.ee-A.sym.txt:java.security.jgss-A.sym.txt:java.security.sasl-A.sym.txt:java.smartcardio-A.sym.txt:java.sql-A.sym.txt:java.sql.rowset-A.sym.txt:java.transaction-A.sym.txt:java.xml-A.sym.txt:java.xml.bind-A.sym.txt:java.xml.crypto-A.sym.txt:java.xml.ws-A.sym.txt:java.xml.ws.annotation-A.sym.txt:jdk.accessibility-A.sym.txt:jdk.attach-A.sym.txt:jdk.charsets-A.sym.txt:jdk.compiler-A.sym.txt:jdk.crypto.cryptoki-A.sym.txt:jdk.crypto.ec-A.sym.txt:jdk.dynalink-A.sym.txt:jdk.editpad-A.sym.txt:jdk.hotspot.agent-A.sym.txt:jdk.httpserver-A.sym.txt:jdk.incubator.httpclient-A.sym.txt:jdk.jartool-A.sym.txt:jdk.javadoc-A.sym.txt:jdk.jcmd-A.sym.txt:jdk.jconsole-A.sym.txt:jdk.jdeps-A.sym.txt:jdk.jdi-A.sym.txt:jdk.jdwp.agent-A.sym.txt:jdk.jlink-A.sym.txt:jdk.jshell-A.sym.txt:jdk.jsobject-A.sym.txt:jdk.jstatd-A.sym.txt:jdk.localedata-A.sym.txt:jdk.management-A.sym.txt:jdk.management.agent-A.sym.txt:jdk.naming.dns-A.sym.txt:jdk.naming.rmi-A.sym.txt:jdk.net-A.sym.txt:jdk.pack-A.sym.txt:jdk.policytool-A.sym.txt:jdk.rmic-A.sym.txt:jdk.scripting.nashorn-A.sym.txt:jdk.sctp-A.sym.txt:jdk.security.auth-A.sym.txt:jdk.security.jgss-A.sym.txt:jdk.unsupported-A.sym.txt:jdk.xml.dom-A.sym.txt:jdk.zipfs-A.sym.txt @@ -48,3 +48,4 @@ platform version M base L files java.base-M.sym.txt:java.compiler-M.sym.txt:java platform version N base M files java.base-N.sym.txt:java.compiler-N.sym.txt:java.desktop-N.sym.txt:java.management-N.sym.txt:java.management.rmi-N.sym.txt:jdk.compiler-N.sym.txt:jdk.httpserver-N.sym.txt:jdk.incubator.foreign-N.sym.txt:jdk.javadoc-N.sym.txt:jdk.jshell-N.sym.txt:jdk.localedata-N.sym.txt:jdk.unsupported-N.sym.txt platform version O base N files java.base-O.sym.txt:java.compiler-O.sym.txt:java.datatransfer-O.sym.txt:java.desktop-O.sym.txt:java.instrument-O.sym.txt:java.logging-O.sym.txt:java.management-O.sym.txt:java.management.rmi-O.sym.txt:java.naming-O.sym.txt:java.net.http-O.sym.txt:java.prefs-O.sym.txt:java.rmi-O.sym.txt:java.scripting-O.sym.txt:java.se-O.sym.txt:java.security.jgss-O.sym.txt:java.security.sasl-O.sym.txt:java.smartcardio-O.sym.txt:java.sql-O.sym.txt:java.sql.rowset-O.sym.txt:java.transaction.xa-O.sym.txt:java.xml-O.sym.txt:java.xml.crypto-O.sym.txt:jdk.accessibility-O.sym.txt:jdk.attach-O.sym.txt:jdk.charsets-O.sym.txt:jdk.compiler-O.sym.txt:jdk.crypto.cryptoki-O.sym.txt:jdk.dynalink-O.sym.txt:jdk.editpad-O.sym.txt:jdk.hotspot.agent-O.sym.txt:jdk.httpserver-O.sym.txt:jdk.incubator.foreign-O.sym.txt:jdk.incubator.vector-O.sym.txt:jdk.jartool-O.sym.txt:jdk.javadoc-O.sym.txt:jdk.jcmd-O.sym.txt:jdk.jconsole-O.sym.txt:jdk.jdeps-O.sym.txt:jdk.jdi-O.sym.txt:jdk.jdwp.agent-O.sym.txt:jdk.jfr-O.sym.txt:jdk.jlink-O.sym.txt:jdk.jpackage-O.sym.txt:jdk.jshell-O.sym.txt:jdk.jsobject-O.sym.txt:jdk.jstatd-O.sym.txt:jdk.localedata-O.sym.txt:jdk.management-O.sym.txt:jdk.management.agent-O.sym.txt:jdk.management.jfr-O.sym.txt:jdk.naming.dns-O.sym.txt:jdk.naming.rmi-O.sym.txt:jdk.net-O.sym.txt:jdk.nio.mapmode-O.sym.txt:jdk.sctp-O.sym.txt:jdk.security.auth-O.sym.txt:jdk.security.jgss-O.sym.txt:jdk.unsupported-O.sym.txt:jdk.xml.dom-O.sym.txt:jdk.zipfs-O.sym.txt platform version P base O files java.base-P.sym.txt:java.compiler-P.sym.txt:java.desktop-P.sym.txt:java.logging-P.sym.txt:java.management-P.sym.txt:java.net.http-P.sym.txt:java.security.jgss-P.sym.txt:java.xml.crypto-P.sym.txt:jdk.attach-P.sym.txt:jdk.compiler-P.sym.txt:jdk.incubator.foreign-P.sym.txt:jdk.incubator.vector-P.sym.txt:jdk.jdi-P.sym.txt:jdk.jfr-P.sym.txt:jdk.jpackage-P.sym.txt:jdk.jshell-P.sym.txt:jdk.net-P.sym.txt:jdk.security.jgss-P.sym.txt +platform version Q base P files java.base-Q.sym.txt:java.compiler-Q.sym.txt:java.desktop-Q.sym.txt:java.management-Q.sym.txt:java.net.http-Q.sym.txt:java.sql-Q.sym.txt:jdk.httpserver-Q.sym.txt:jdk.incubator.foreign-Q.sym.txt:jdk.incubator.vector-Q.sym.txt:jdk.jartool-Q.sym.txt:jdk.jdeps-Q.sym.txt:jdk.jfr-Q.sym.txt:jdk.jlink-Q.sym.txt:jdk.jpackage-Q.sym.txt:jdk.jshell-Q.sym.txt:jdk.jsobject-Q.sym.txt:jdk.localedata-Q.sym.txt:jdk.management-Q.sym.txt diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Cipher.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Cipher.java index 9c923b76215..39827af42e5 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Cipher.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Cipher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, 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 @@ -1198,7 +1198,9 @@ final class P11Cipher extends CipherSpi { } private void handleException(PKCS11Exception e) - throws ShortBufferException, IllegalBlockSizeException { + throws ShortBufferException, IllegalBlockSizeException, + BadPaddingException { + if (e.match(CKR_BUFFER_TOO_SMALL)) { throw (ShortBufferException) (new ShortBufferException().initCause(e)); @@ -1206,6 +1208,9 @@ final class P11Cipher extends CipherSpi { e.match(CKR_ENCRYPTED_DATA_LEN_RANGE)) { throw (IllegalBlockSizeException) (new IllegalBlockSizeException(e.toString()).initCause(e)); + } else if (e.match(CKR_ENCRYPTED_DATA_INVALID)) { + throw (BadPaddingException) + (new BadPaddingException(e.toString()).initCause(e)); } } diff --git a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c index d969fabffd0..052c7011860 100644 --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_crypt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -184,9 +184,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Encrypt if (directIn != 0) { inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn); - } else { + } else if (jIn != NULL) { inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL); + // may happen if out of memory if (inBufP == NULL) { return 0; } + } else { + inBufP = NULL; } if (directOut != 0) { @@ -194,7 +197,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Encrypt } else { outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); if (outBufP == NULL) { - if (directIn == 0) { + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } return 0; @@ -208,7 +211,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Encrypt (CK_BYTE_PTR)(outBufP + jOutOfs), &ckEncryptedLen); - if (directIn == 0) { + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } if (directOut == 0) { @@ -251,9 +254,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1EncryptUpdate if (directIn != 0) { inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn); - } else { + } else if (jIn != NULL) { inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL); + // may happen if out of memory if (inBufP == NULL) { return 0; } + } else { + inBufP = NULL; } if (directOut != 0) { @@ -261,7 +267,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1EncryptUpdate } else { outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); if (outBufP == NULL) { - if (directIn == 0) { + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } return 0; @@ -275,7 +281,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1EncryptUpdate (CK_BYTE_PTR)(outBufP + jOutOfs), &ckEncryptedPartLen); - if (directIn == 0) { + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } if (directOut == 0) { @@ -462,9 +468,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Decrypt if (directIn != 0) { inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn); - } else { + } else if (jIn != NULL) { inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL); + // may happen if out of memory if (inBufP == NULL) { return 0; } + } else { + inBufP = NULL; } if (directOut != 0) { @@ -472,7 +481,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Decrypt } else { outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); if (outBufP == NULL) { - if (directIn == 0) { + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } return 0; @@ -485,7 +494,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1Decrypt (CK_BYTE_PTR)(outBufP + jOutOfs), &ckOutLen); - if (directIn == 0) { + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } if (directOut == 0) { @@ -528,9 +537,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptUpdate if (directIn != 0) { inBufP = (CK_BYTE_PTR) jlong_to_ptr(directIn); - } else { + } else if (jIn != NULL) { inBufP = (*env)->GetPrimitiveArrayCritical(env, jIn, NULL); + // may happen if out of memory if (inBufP == NULL) { return 0; } + } else { + inBufP = NULL; } if (directOut != 0) { @@ -538,7 +550,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptUpdate } else { outBufP = (*env)->GetPrimitiveArrayCritical(env, jOut, NULL); if (outBufP == NULL) { - if (directIn == 0) { + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } return 0; @@ -551,7 +563,7 @@ Java_sun_security_pkcs11_wrapper_PKCS11_C_1DecryptUpdate (CK_BYTE_PTR)(outBufP + jOutOfs), &ckDecryptedPartLen); - if (directIn == 0) { + if (directIn == 0 && inBufP != NULL) { (*env)->ReleasePrimitiveArrayCritical(env, jIn, inBufP, JNI_ABORT); } if (directOut == 0) { diff --git a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c index e9bcf597a03..f61b8a5fb49 100644 --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -100,6 +100,12 @@ Java_sun_security_pkcs11_wrapper_PKCS11_initializeLibrary #ifndef NO_CALLBACKS if (notifyListLock == NULL) { notifyListLock = createLockObject(env); + + /* Return immediately if lock creation failed or an exception is pending. */ + if (notifyListLock == NULL || (*env)->ExceptionCheck(env)) { + TRACE0("DEBUG: createLockObject failed, aborting initialization\n"); + return; + } } #endif diff --git a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c index f2e1a46565d..e540f3b5ed9 100644 --- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c +++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. */ /* Copyright (c) 2002 Graz University of Technology. All rights reserved. @@ -929,6 +929,11 @@ JNIEXPORT jlong JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DeriveKey rv = (*ckpFunctions->C_DeriveKey)(ckSessionHandle, ckpMechanism, ckBaseKeyHandle, ckpAttributes, ckAttributesLength, phKey); + /* If derivation failed, do not attempt copy-back */ + if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { + goto cleanup; + } + jKeyHandle = ckLongToJLong(ckKeyHandle); switch (ckpMechanism->mechanism) { @@ -956,8 +961,9 @@ JNIEXPORT jlong JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_C_1DeriveKey // empty break; } - if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) { - jKeyHandle =0L; + /* Do not continue if any copy-back operation raised an exception */ + if ((*env)->ExceptionCheck(env)) { + goto cleanup; } cleanup: diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp index 8df08c49e09..6c94992e1e2 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/DwarfParser.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020, 2021, NTT DATA. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -219,16 +219,3 @@ JNIEXPORT jint JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_get DwarfParser *parser = reinterpret_cast(get_dwarf_context(env, this_obj)); return parser->get_bp_cfa_offset(); } - -/* - * Class: sun_jvm_hotspot_debugger_linux_amd64_DwarfParser - * Method: isBPOffsetAvailable - * Signature: ()Z - */ -extern "C" -JNIEXPORT jboolean JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_isBPOffsetAvailable - (JNIEnv *env, jobject this_obj) { - DwarfParser *parser = reinterpret_cast(get_dwarf_context(env, this_obj)); - return parser->is_bp_offset_available(); -} - diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.cpp index 4b8c5e55f63..caf948019af 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.cpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.cpp @@ -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. * Copyright (c) 2019, 2021, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp index a0c54230530..2636bdf691a 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020, NTT DATA. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -99,12 +99,11 @@ bool DwarfParser::process_cie(unsigned char *start_of_entry, uint32_t id) { // Clear state _current_pc = 0L; - _cfa_reg = RSP; + _cfa_reg = MAX_VALUE; _return_address_reg = RA; _cfa_offset = 0; - _ra_cfa_offset = 0; - _bp_cfa_offset = 0; - _bp_offset_available = false; + _ra_cfa_offset = 8; + _bp_cfa_offset = INT_MAX; parse_dwarf_instructions(0L, static_cast(-1L), end); @@ -119,8 +118,8 @@ void DwarfParser::parse_dwarf_instructions(uintptr_t begin, uintptr_t pc, const /* for remember state */ enum DWARF_Register rem_cfa_reg = MAX_VALUE; int rem_cfa_offset = 0; - int rem_ra_cfa_offset = 0; - int rem_bp_cfa_offset = 0; + int rem_ra_cfa_offset = 8; + int rem_bp_cfa_offset = INT_MAX; while ((_buf < end) && (_current_pc < pc)) { unsigned char op = *_buf++; @@ -147,7 +146,6 @@ void DwarfParser::parse_dwarf_instructions(uintptr_t begin, uintptr_t pc, const enum DWARF_Register reg = static_cast(opa); if (reg == RBP) { _bp_cfa_offset = operand1 * _data_factor; - _bp_offset_available = true; } else if (reg == RA) { _ra_cfa_offset = operand1 * _data_factor; } @@ -184,6 +182,14 @@ void DwarfParser::parse_dwarf_instructions(uintptr_t begin, uintptr_t pc, const } break; } + case 0x07: { // DW_CFA_undefined + enum DWARF_Register reg = static_cast(read_leb(false)); + // We are only interested in BP here because CFA and RA should not be undefined. + if (reg == RBP) { + _bp_cfa_offset = INT_MAX; + } + break; + } case 0x0d: {// DW_CFA_def_cfa_register _cfa_reg = static_cast(read_leb(false)); break; diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.hpp b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.hpp index a047ffae247..a2692738ce1 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.hpp +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/dwarf.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020, NTT DATA. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,7 +73,6 @@ class DwarfParser { int _cfa_offset; int _ra_cfa_offset; int _bp_cfa_offset; - bool _bp_offset_available; uintptr_t read_leb(bool sign); uint64_t get_entry_length(); @@ -86,15 +85,14 @@ class DwarfParser { DwarfParser(lib_info *lib) : _lib(lib), _buf(NULL), _encoding(0), - _cfa_reg(RSP), + _cfa_reg(MAX_VALUE), _return_address_reg(RA), _code_factor(0), _data_factor(0), _current_pc(0L), _cfa_offset(0), - _ra_cfa_offset(0), - _bp_cfa_offset(0), - _bp_offset_available(false) {}; + _ra_cfa_offset(8), + _bp_cfa_offset(INT_MAX) {}; ~DwarfParser() {} bool process_dwarf(const uintptr_t pc); @@ -102,7 +100,6 @@ class DwarfParser { int get_cfa_offset() { return _cfa_offset; } int get_ra_cfa_offset() { return _ra_cfa_offset; } int get_bp_cfa_offset() { return _bp_cfa_offset; } - bool is_bp_offset_available() { return _bp_offset_available; } bool is_in(long pc) { return (_lib->exec_start <= pc) && (pc < _lib->exec_end); diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c b/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c index 07cbb46d045..c8f3fb2ed4c 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, 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 @@ -550,14 +550,33 @@ uintptr_t search_symbol(struct symtab* symtab, uintptr_t base, return (uintptr_t) NULL; } +static bool is_in(uintptr_t offset, struct elf_symbol* sym) { + if (sym->size == 0 && offset == sym->offset) { + // offset points to the top of the symbol. + // Some functions have size 0. For example, __restore_rt() (signal trampoline + // in glibc) would be detected as out of the function incorrectly, even if it + // points to the top of the instruction address, because the size of + // __restore_rt() is 0 (you can see this with "readelf -s libc.so.6" when + // debug symbols are available). + // Hence we need to treat this as a special case if the function size is 0, + // only the exact symbol address should be treated as inside. + return true; + } else if (offset >= sym->offset && offset < sym->offset + sym->size) { + // offset is in address range of the symbol + return true; + } + + // offset is out of address range of the symbol + return false; +} + const char* nearest_symbol(struct symtab* symtab, uintptr_t offset, uintptr_t* poffset) { int n = 0; if (!symtab) return NULL; for (; n < symtab->num_symbols; n++) { struct elf_symbol* sym = &(symtab->symbols[n]); - if (sym->name != NULL && - offset >= sym->offset && offset < sym->offset + sym->size) { + if (sym->name != NULL && is_in(offset, sym)) { if (poffset) *poffset = (offset - sym->offset); return sym->name; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java index 897ea5da85f..e1715b5e024 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java index 4ffd0434e86..cb708f9b284 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.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. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java index 81e620ff1fb..a6ef3b72544 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/Debugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2022, 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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java index c119e374d66..01a71c8f44c 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -86,18 +86,22 @@ class BsdCDebugger implements CDebugger { String cpu = dbg.getCPU(); if (cpu.equals("amd64") || cpu.equals("x86_64")) { AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); + Address rsp = context.getRegisterAsAddress(AMD64ThreadContext.RSP); + if (rsp == null) return null; Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP); if (rbp == null) return null; Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP); if (pc == null) return null; - return new BsdAMD64CFrame(dbg, rbp, pc); + return new BsdAMD64CFrame(dbg, rsp, rbp, pc); } else if (cpu.equals("aarch64")) { AARCH64ThreadContext context = (AARCH64ThreadContext) thread.getContext(); + Address sp = context.getRegisterAsAddress(AARCH64ThreadContext.SP); + if (sp == null) return null; Address fp = context.getRegisterAsAddress(AARCH64ThreadContext.FP); if (fp == null) return null; Address pc = context.getRegisterAsAddress(AARCH64ThreadContext.PC); if (pc == null) return null; - return new BsdAARCH64CFrame(dbg, fp, pc); + return new BsdAARCH64CFrame(dbg, sp, fp, pc); } else { throw new DebuggerException(cpu + " is not yet supported"); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java index c4a3a4850ff..3dbcd8b8112 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, 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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java index ebc5c7d716e..185148b39b4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Red Hat Inc. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,15 +26,19 @@ package sun.jvm.hotspot.debugger.bsd.aarch64; +import sun.jvm.hotspot.code.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.aarch64.*; import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.basic.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.runtime.aarch64.*; public final class BsdAARCH64CFrame extends BasicCFrame { - public BsdAARCH64CFrame(BsdDebugger dbg, Address fp, Address pc) { + public BsdAARCH64CFrame(BsdDebugger dbg, Address sp, Address fp, Address pc) { super(dbg.getCDebugger()); + this.sp = sp; this.fp = fp; this.pc = pc; this.dbg = dbg; @@ -54,28 +58,65 @@ public final class BsdAARCH64CFrame extends BasicCFrame { return fp; } + @Override public CFrame sender(ThreadProxy thread) { - AARCH64ThreadContext context = (AARCH64ThreadContext) thread.getContext(); - Address rsp = context.getRegisterAsAddress(AARCH64ThreadContext.SP); + return sender(thread, null, null, null); + } - if ((fp == null) || fp.lessThan(rsp)) { + @Override + public CFrame sender(ThreadProxy thread, Address nextSP, Address nextFP, Address nextPC) { + // Check fp + // Skip if both nextFP and nextPC are given - do not need to load from fp. + if (nextFP == null && nextPC == null) { + if (fp == null) { + return null; + } + + // Check alignment of fp + if (dbg.getAddressValue(fp) % (2 * ADDRESS_SIZE) != 0) { + return null; + } + } + + if (nextFP == null) { + nextFP = fp.getAddressAt(0); + } + if (nextFP == null) { return null; } - // Check alignment of fp - if (dbg.getAddressValue(fp) % (2 * ADDRESS_SIZE) != 0) { - return null; + if (nextPC == null) { + nextPC = fp.getAddressAt(ADDRESS_SIZE); } - - Address nextFP = fp.getAddressAt(0 * ADDRESS_SIZE); - if (nextFP == null || nextFP.lessThanOrEqual(fp)) { - return null; - } - Address nextPC = fp.getAddressAt(1 * ADDRESS_SIZE); if (nextPC == null) { return null; } - return new BsdAARCH64CFrame(dbg, nextFP, nextPC); + + if (nextSP == null) { + CodeCache cc = VM.getVM().getCodeCache(); + CodeBlob currentBlob = cc.findBlobUnsafe(pc()); + + // This case is different from HotSpot. See JDK-8371194 for details. + if (currentBlob != null && (currentBlob.isContinuationStub() || currentBlob.isNativeMethod())) { + // Use FP since it should always be valid for these cases. + // TODO: These should be walked as Frames not CFrames. + nextSP = fp.addOffsetTo(2 * ADDRESS_SIZE); + } else { + CodeBlob codeBlob = cc.findBlobUnsafe(nextPC); + boolean useCodeBlob = codeBlob != null && codeBlob.getFrameSize() > 0; + nextSP = useCodeBlob ? nextFP.addOffsetTo((2 * ADDRESS_SIZE) - codeBlob.getFrameSize()) : nextFP; + } + } + if (nextSP == null) { + return null; + } + + return new BsdAARCH64CFrame(dbg, nextSP, nextFP, nextPC); + } + + @Override + public Frame toFrame() { + return new AARCH64Frame(sp, fp, pc); } // package/class internals only diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/amd64/BsdAMD64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/amd64/BsdAMD64CFrame.java index 8d0d94b11b7..9077e0007a5 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/amd64/BsdAMD64CFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/amd64/BsdAMD64CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, 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,10 +29,13 @@ import sun.jvm.hotspot.debugger.amd64.*; import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.basic.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.runtime.amd64.*; public final class BsdAMD64CFrame extends BasicCFrame { - public BsdAMD64CFrame(BsdDebugger dbg, Address rbp, Address rip) { + public BsdAMD64CFrame(BsdDebugger dbg, Address rsp, Address rbp, Address rip) { super(dbg.getCDebugger()); + this.rsp = rsp; this.rbp = rbp; this.rip = rip; this.dbg = dbg; @@ -52,32 +55,49 @@ public final class BsdAMD64CFrame extends BasicCFrame { return rbp; } + @Override public CFrame sender(ThreadProxy thread) { - AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); - Address rsp = context.getRegisterAsAddress(AMD64ThreadContext.RSP); + return sender(thread, null, null, null); + } - if ( (rbp == null) || rbp.lessThan(rsp) ) { - return null; + @Override + public CFrame sender(ThreadProxy thread, Address sp, Address fp, Address pc) { + // Check fp + // Skip if both fp and pc are given - do not need to load from rbp. + if (fp == null && pc == null) { + if (rbp == null) { + return null; + } + + // Check alignment of rbp + if (dbg.getAddressValue(rbp) % ADDRESS_SIZE != 0) { + return null; + } } - // Check alignment of rbp - if (dbg.getAddressValue(rbp) % ADDRESS_SIZE != 0) { + Address nextRSP = sp != null ? sp : rbp.addOffsetTo(2 * ADDRESS_SIZE); + if (nextRSP == null) { return null; } - - Address nextRBP = rbp.getAddressAt( 0 * ADDRESS_SIZE); - if (nextRBP == null || nextRBP.lessThanOrEqual(rbp)) { + Address nextRBP = fp != null ? fp : rbp.getAddressAt(0); + if (nextRBP == null) { return null; } - Address nextPC = rbp.getAddressAt( 1 * ADDRESS_SIZE); + Address nextPC = pc != null ? pc : rbp.getAddressAt(ADDRESS_SIZE); if (nextPC == null) { return null; } - return new BsdAMD64CFrame(dbg, nextRBP, nextPC); + return new BsdAMD64CFrame(dbg, nextRSP, nextRBP, nextPC); + } + + @Override + public Frame toFrame() { + return new AMD64Frame(rsp, rbp, rip); } // package/class internals only private static final int ADDRESS_SIZE = 8; + private Address rsp; private Address rip; private Address rbp; private BsdDebugger dbg; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java index e3543503216..15f6615421c 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Red Hat Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -81,11 +81,7 @@ class LinuxCDebugger implements CDebugger { String cpu = dbg.getCPU(); if (cpu.equals("amd64")) { AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); - Address sp = context.getRegisterAsAddress(AMD64ThreadContext.RSP); - if (sp == null) return null; - Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP); - if (pc == null) return null; - return LinuxAMD64CFrame.getTopFrame(dbg, sp, pc, context); + return LinuxAMD64CFrame.getTopFrame(dbg, context); } else if (cpu.equals("ppc64")) { PPC64ThreadContext context = (PPC64ThreadContext) thread.getContext(); Address sp = context.getRegisterAsAddress(PPC64ThreadContext.SP); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebugger.java index 1106d846eca..a53b8a0a282 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -33,6 +33,14 @@ import sun.jvm.hotspot.debugger.cdbg.*; by the architecture-specific subpackages. */ public interface LinuxDebugger extends JVMDebugger { + // SIGHANDLER_NAMES holds the name of signal handler. + public static final List SIGHANDLER_NAMES = List.of( + // For AMD64 + // - sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c in glibc + // - gdb/amd64-linux-tdep.c in GDB + "__restore_rt" + ); + public String addressValueToString(long address) throws DebuggerException; public boolean readJBoolean(long address) throws DebuggerException; public byte readJByte(long address) throws DebuggerException; @@ -52,6 +60,7 @@ public interface LinuxDebugger extends JVMDebugger { public long[] getThreadIntegerRegisterSet(int lwp_id) throws DebuggerException; public long getAddressValue(Address addr) throws DebuggerException; public Address findLibPtrByAddress(Address pc); + public boolean isSignalTrampoline(Address pc); // For LinuxCDebugger public List getThreadList(); diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java index 261df12c8f1..9a75511e44d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -130,6 +130,12 @@ public class LinuxDebuggerLocal extends DebuggerBase implements LinuxDebugger { : new LinuxAddress(this, ptr); } + @Override + public boolean isSignalTrampoline(Address pc) { + var sym = lookup(getAddressValue(pc)); + return sym == null ? false : SIGHANDLER_NAMES.contains(sym.getName()); + } + // Note on Linux threads are really processes. When target process is // attached by a serviceability agent thread, only that thread can do // ptrace operations on the target. This is because from kernel's point diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java index 88863e76285..d20b998aa64 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/LinuxThreadContextFactory.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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java index 3b63ee0a21e..53351c918d3 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/DwarfParser.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2020, NTT DATA. + * Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2026, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,9 +66,15 @@ public class DwarfParser { processDwarf0(pc.asLongValue()); } + /** + * @return true if BP offset is declared in DWARF instructions. + */ + public boolean isBPOffsetAvailable() { + return getBasePointerOffsetFromCFA() != Integer.MAX_VALUE; + } + public native int getCFARegister(); public native int getCFAOffset(); public native int getReturnAddressOffsetFromCFA(); public native int getBasePointerOffsetFromCFA(); - public native boolean isBPOffsetAvailable(); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java index 612203634f3..4d3d9d5998d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2025, 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 @@ -24,9 +24,12 @@ package sun.jvm.hotspot.debugger.linux.amd64; +import java.util.function.Function; + import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.amd64.*; import sun.jvm.hotspot.debugger.linux.*; +import sun.jvm.hotspot.debugger.linux.amd64.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.basic.*; import sun.jvm.hotspot.runtime.*; @@ -34,9 +37,12 @@ import sun.jvm.hotspot.runtime.amd64.*; public final class LinuxAMD64CFrame extends BasicCFrame { - public static LinuxAMD64CFrame getTopFrame(LinuxDebugger dbg, Address rsp, Address rip, ThreadContext context) { + private static LinuxAMD64CFrame getFrameFromReg(LinuxDebugger dbg, Function getreg) { + Address rip = getreg.apply(AMD64ThreadContext.RIP); + Address rsp = getreg.apply(AMD64ThreadContext.RSP); + Address rbp = getreg.apply(AMD64ThreadContext.RBP); Address libptr = dbg.findLibPtrByAddress(rip); - Address cfa = context.getRegisterAsAddress(AMD64ThreadContext.RBP); + Address cfa = null; DwarfParser dwarf = null; if (libptr != null) { // Native frame @@ -47,41 +53,47 @@ public final class LinuxAMD64CFrame extends BasicCFrame { // DWARF processing should succeed when the frame is native // but it might fail if Common Information Entry (CIE) has language // personality routine and/or Language Specific Data Area (LSDA). - return new LinuxAMD64CFrame(dbg, rsp, cfa, rip, dwarf, true); + return new LinuxAMD64CFrame(dbg, rsp, rbp, cfa, rip, dwarf, true); } - cfa = context.getRegisterAsAddress(dwarf.getCFARegister()) - .addOffsetTo(dwarf.getCFAOffset()); + cfa = getreg.apply(dwarf.getCFARegister()) + .addOffsetTo(dwarf.getCFAOffset()); } - return (cfa == null) ? null - : new LinuxAMD64CFrame(dbg, rsp, cfa, rip, dwarf); + return (rbp == null && cfa == null) + ? null + : new LinuxAMD64CFrame(dbg, rsp, rbp, cfa, rip, dwarf); } - private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address cfa, Address rip, DwarfParser dwarf) { - this(dbg, rsp, cfa, rip, dwarf, false); + public static LinuxAMD64CFrame getTopFrame(LinuxDebugger dbg, ThreadContext context) { + return getFrameFromReg(dbg, context::getRegisterAsAddress); } - private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address cfa, Address rip, DwarfParser dwarf, boolean finalFrame) { - this(dbg, rsp, cfa, rip, dwarf, finalFrame, false); + private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address rbp, Address cfa, Address rip, DwarfParser dwarf) { + this(dbg, rsp, rbp, cfa, rip, dwarf, false); } - private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address cfa, Address rip, DwarfParser dwarf, boolean finalFrame, boolean use1ByteBeforeToLookup) { + private LinuxAMD64CFrame(LinuxDebugger dbg, Address rsp, Address rbp, Address cfa, Address rip, DwarfParser dwarf, boolean use1ByteBeforeToLookup) { super(dbg.getCDebugger()); this.rsp = rsp; + this.rbp = rbp; this.cfa = cfa; this.rip = rip; this.dbg = dbg; this.dwarf = dwarf; - this.finalFrame = finalFrame; this.use1ByteBeforeToLookup = use1ByteBeforeToLookup; } // override base class impl to avoid ELF parsing public ClosestSymbol closestSymbolToPC() { Address symAddr = use1ByteBeforeToLookup ? pc().addOffsetTo(-1) : pc(); - // try native lookup in debugger. - return dbg.lookup(dbg.getAddressValue(symAddr)); + var sym = dbg.lookup(dbg.getAddressValue(symAddr)); + + // Returns a special symbol if the address is signal handler, + // otherwise returns closest symbol generated by LinuxDebugger. + return dbg.isSignalTrampoline(symAddr) + ? new ClosestSymbol(sym.getName() + " ", 0) + : sym; } public Address pc() { @@ -89,77 +101,74 @@ public final class LinuxAMD64CFrame extends BasicCFrame { } public Address localVariableBase() { - return cfa; + return (dwarf != null && dwarf.isBPOffsetAvailable()) + ? cfa.addOffsetTo(dwarf.getBasePointerOffsetFromCFA()) + : rbp; } - private Address getNextPC(boolean useDwarf) { + private Address getNextPC() { try { - long offs = useDwarf ? dwarf.getReturnAddressOffsetFromCFA() - : ADDRESS_SIZE; - return cfa.getAddressAt(offs); + return dwarf == null + ? rbp.getAddressAt(ADDRESS_SIZE) // Java frame + : cfa.getAddressAt(dwarf.getReturnAddressOffsetFromCFA()); // Native frame } catch (UnmappedAddressException | UnalignedAddressException e) { return null; } } - private boolean isValidFrame(Address nextCFA, boolean isNative) { - // CFA should never be null. - // nextCFA must be greater than current CFA, if frame is native. - // Java interpreter frames can share the CFA (frame pointer). - return nextCFA != null && - (!isNative || (isNative && nextCFA.greaterThan(cfa))); + private boolean isValidFrame(Address nextCFA, Address nextRBP) { + // Both CFA and RBP must not be null. + if (nextCFA == null && nextRBP == null) { + return false; + } + + // RBP must not be null if CFA is null - it happens between Java frame and Native frame. + // We cannot validate RBP value because it might be used as GPR. Thus returns true + // if RBP is not null. + if (nextCFA == null && nextRBP != null) { + return true; + } + + // nextCFA must be greater than current CFA. + if (nextCFA != null && nextCFA.greaterThanOrEqual(cfa)) { + return true; + } + + // Otherwise, the frame is not valid. + return false; } private Address getNextRSP() { - // next RSP should be previous slot of return address. - var bp = dwarf == null ? cfa.addOffsetTo(ADDRESS_SIZE) // top of BP points callser BP - : cfa.addOffsetTo(dwarf.getReturnAddressOffsetFromCFA()); - return bp.addOffsetTo(ADDRESS_SIZE); + return dwarf == null ? rbp.addOffsetTo(2 * ADDRESS_SIZE) // Java frame - skip saved BP and RA + : cfa.addOffsetTo(dwarf.getReturnAddressOffsetFromCFA()) + .addOffsetTo(ADDRESS_SIZE); // Native frame } - private Address getNextCFA(DwarfParser nextDwarf, ThreadContext context, Address senderFP, Address senderPC) { - Address nextCFA; - boolean isNative = false; - - if (senderFP == null) { - senderFP = cfa.getAddressAt(0); // RBP by default + private Address getNextRBP(Address senderFP) { + if (senderFP != null) { + return senderFP; + } else if (dwarf == null) { // Current frame is Java + return rbp.getAddressAt(0); + } else { // Current frame is Native + return dwarf.isBPOffsetAvailable() + ? cfa.getAddressAt(dwarf.getBasePointerOffsetFromCFA()) + : rbp; } + } - if (VM.getVM().getCodeCache().contains(senderPC)) { // Next frame is Java - nextCFA = (dwarf == null) ? senderFP // Current frame is Java - : cfa.getAddressAt(dwarf.getBasePointerOffsetFromCFA()); // Current frame is Native - } else { // Next frame is Native - if (VM.getVM().getCodeCache().contains(pc())) { // Current frame is Java - nextCFA = senderFP.addOffsetTo(-nextDwarf.getBasePointerOffsetFromCFA()); - } else { // Current frame is Native - if (nextDwarf == null) { // maybe runtime entrypoint (_start()) - throw new DebuggerException("nextDwarf is null even though native call"); - } - - isNative = true; - int nextCFAReg = nextDwarf.getCFARegister(); - if (nextCFAReg == AMD64ThreadContext.RBP) { - Address rbp = dwarf.isBPOffsetAvailable() ? cfa.addOffsetTo(dwarf.getBasePointerOffsetFromCFA()) - : context.getRegisterAsAddress(AMD64ThreadContext.RBP); - Address nextRBP = rbp.getAddressAt(0); - nextCFA = nextRBP.addOffsetTo(-nextDwarf.getBasePointerOffsetFromCFA()); - } else if (nextCFAReg == AMD64ThreadContext.RSP) { - nextCFA = getNextRSP().addOffsetTo(nextDwarf.getCFAOffset()); - } else { - throw new DebuggerException("Unsupported CFA register: " + nextCFAReg); - } - } - } - - // Sanity check for next CFA address - try { - nextCFA.getAddressAt(0); - } catch (Exception e) { - // return null if next CFA address is invalid + private Address getNextCFA(DwarfParser nextDwarf, Address senderFP, Address senderPC) { + if (nextDwarf == null) { // Next frame is Java + // CFA is not available on Java frame return null; } - return isValidFrame(nextCFA, isNative) ? nextCFA : null; + // Next frame is Native + int nextCFAReg = nextDwarf.getCFARegister(); + return switch(nextCFAReg){ + case AMD64ThreadContext.RBP -> getNextRBP(senderFP).addOffsetTo(nextDwarf.getCFAOffset()); + case AMD64ThreadContext.RSP -> getNextRSP().addOffsetTo(nextDwarf.getCFAOffset()); + default -> throw new DebuggerException("Unsupported CFA register: " + nextCFAReg); + }; } @Override @@ -169,8 +178,10 @@ public final class LinuxAMD64CFrame extends BasicCFrame { @Override public CFrame sender(ThreadProxy th, Address sp, Address fp, Address pc) { - if (finalFrame) { - return null; + if (dbg.isSignalTrampoline(pc())) { + // RSP points signal context + // https://github.com/torvalds/linux/blob/v6.17/arch/x86/kernel/signal.c#L94 + return getFrameFromReg(dbg, r -> LinuxAMD64ThreadContext.getRegFromSignalTrampoline(this.rsp, r.intValue())); } ThreadContext context = th.getContext(); @@ -179,8 +190,7 @@ public final class LinuxAMD64CFrame extends BasicCFrame { if (nextRSP == null) { return null; } - - Address nextPC = pc != null ? pc : getNextPC(dwarf != null); + Address nextPC = pc != null ? pc : getNextPC(); if (nextPC == null) { return null; } @@ -203,11 +213,23 @@ public final class LinuxAMD64CFrame extends BasicCFrame { } } + Address nextRBP = getNextRBP(fp); + try { - Address nextCFA = getNextCFA(nextDwarf, context, fp, nextPC); - return new LinuxAMD64CFrame(dbg, nextRSP, nextCFA, nextPC, nextDwarf, false, fallback); - } catch (DebuggerException _) { - return null; + Address nextCFA = getNextCFA(nextDwarf, fp, nextPC); + return isValidFrame(nextCFA, nextRBP) + ? new LinuxAMD64CFrame(dbg, nextRSP, nextRBP, nextCFA, nextPC, nextDwarf, fallback) + : null; + } catch (DebuggerException e) { + if (dbg.isSignalTrampoline(nextPC)) { + // We can through the caller frame if it is signal trampoline. + // getNextCFA() might fail because DwarfParser cannot find out CFA register. + return new LinuxAMD64CFrame(dbg, nextRSP, nextRBP, null, nextPC, nextDwarf, fallback); + } + + // Rethrow the original exception if getNextCFA() failed + // and the caller is not signal trampoline. + throw e; } } @@ -231,16 +253,16 @@ public final class LinuxAMD64CFrame extends BasicCFrame { @Override public Frame toFrame() { - return new AMD64Frame(rsp, cfa, rip); + return new AMD64Frame(rsp, localVariableBase(), rip); } // package/class internals only private static final int ADDRESS_SIZE = 8; private Address rsp; + private Address rbp; private Address rip; private Address cfa; private LinuxDebugger dbg; private DwarfParser dwarf; - private boolean finalFrame; private boolean use1ByteBeforeToLookup; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64ThreadContext.java index 3884bab796b..8b2a7301cf2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64ThreadContext.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64ThreadContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 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 @@ -27,6 +27,7 @@ package sun.jvm.hotspot.debugger.linux.amd64; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.amd64.*; import sun.jvm.hotspot.debugger.linux.*; +import sun.jvm.hotspot.runtime.*; public class LinuxAMD64ThreadContext extends AMD64ThreadContext { private LinuxDebugger debugger; @@ -43,4 +44,23 @@ public class LinuxAMD64ThreadContext extends AMD64ThreadContext { public Address getRegisterAsAddress(int index) { return debugger.newAddress(getRegister(index)); } + + public static Address getRegFromSignalTrampoline(Address sp, int index) { + // ucontext_t is located at top of stack. + // See definition of rt_sigframe in arch/x86/include/asm/sigframe.h + // in Linux Kernel. + Address addrUCMContext = sp.addOffsetTo(40); // offsetof(ucontext_t, uc_mcontext) = 40 + Address addrGRegs = addrUCMContext; // gregs is located at top of ucontext_t + + // They are from sys/ucontext.h + final int REG_RBP = 10; + final int REG_RSP = 15; + final int REG_RIP = 16; + return switch(index) { + case AMD64ThreadContext.RBP -> addrGRegs.getAddressAt(REG_RBP * VM.getVM().getAddressSize()); + case AMD64ThreadContext.RSP -> addrGRegs.getAddressAt(REG_RSP * VM.getVM().getAddressSize()); + case AMD64ThreadContext.RIP -> addrGRegs.getAddressAt(REG_RIP * VM.getVM().getAddressSize()); + default -> throw new IllegalArgumentException("Unsupported register index: " + index); + }; + } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java index 3833680d96c..851dc5ad09c 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java index 6fbea538488..46edb2f55b2 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, 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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java index b45dbd23405..9ed05b31319 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java index 76125e33e80..b0d158f409d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, 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 @@ -60,11 +60,11 @@ public class ParallelScavengeHeap extends CollectedHeap { // Accessors public PSYoungGen youngGen() { - return VMObjectFactory.newObject(PSYoungGen.class, youngGenField.getValue()); + return VMObjectFactory.newObject(PSYoungGen.class, youngGenField.getValue(addr)); } public PSOldGen oldGen() { - return VMObjectFactory.newObject(PSOldGen.class, oldGenField.getValue()); + return VMObjectFactory.newObject(PSOldGen.class, oldGenField.getValue(addr)); } public long capacity() { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java index 918d34940f4..0550052dff4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GCCause.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java index 9d5c0dec9fb..94200e31b7e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/FileMapInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index 0cd743372d5..785bb85e640 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -62,6 +62,16 @@ public class InstanceKlass extends Klass { private static int CLASS_STATE_FULLY_INITIALIZED; private static int CLASS_STATE_INITIALIZATION_ERROR; + public long getAccessFlags() { return accessFlags.getValue(this); } + // Convenience routine + public AccessFlags getAccessFlagsObj() { return new AccessFlags(getAccessFlags()); } + + public boolean isPublic() { return getAccessFlagsObj().isPublic(); } + public boolean isFinal() { return getAccessFlagsObj().isFinal(); } + public boolean isInterface() { return getAccessFlagsObj().isInterface(); } + public boolean isAbstract() { return getAccessFlagsObj().isAbstract(); } + public boolean isSuper() { return getAccessFlagsObj().isSuper(); } + public boolean isSynthetic() { return getAccessFlagsObj().isSynthetic(); } private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("InstanceKlass"); @@ -88,6 +98,7 @@ public class InstanceKlass extends Klass { breakpoints = type.getAddressField("_breakpoints"); } headerSize = type.getSize(); + accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); // read internal field flags constants FIELD_FLAG_IS_INITIALIZED = db.lookupIntConstant("FieldInfo::FieldFlags::_ff_initialized"); @@ -150,6 +161,7 @@ public class InstanceKlass extends Klass { private static CIntField initState; private static CIntField itableLen; private static CIntField nestHostIndex; + private static CIntField accessFlags; private static AddressField breakpoints; // type safe enum for ClassState from instanceKlass.hpp @@ -499,7 +511,7 @@ public class InstanceKlass extends Klass { } } - public boolean implementsInterface(Klass k) { + public boolean implementsInterface(InstanceKlass k) { if (Assert.ASSERTS_ENABLED) { Assert.that(k.isInterface(), "should not reach here"); } @@ -511,7 +523,7 @@ public class InstanceKlass extends Klass { return false; } - boolean computeSubtypeOf(Klass k) { + boolean computeSubtypeOf(InstanceKlass k) { if (k.isInterface()) { return implementsInterface(k); } else { @@ -535,6 +547,7 @@ public class InstanceKlass extends Klass { visitor.doCInt(nonstaticOopMapSize, true); visitor.doCInt(initState, true); visitor.doCInt(itableLen, true); + visitor.doCInt(accessFlags, true); } /* diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java index 1b8a9d0ef69..561c4683d29 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.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 @@ -57,7 +57,6 @@ public class Klass extends Metadata implements ClassConstants { superField = new MetadataField(type.getAddressField("_super"), 0); layoutHelper = new IntField(type.getJIntField("_layout_helper"), 0); name = type.getAddressField("_name"); - accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); try { traceIDField = type.getField("_trace_id"); } catch(Exception e) { @@ -95,7 +94,6 @@ public class Klass extends Metadata implements ClassConstants { private static MetadataField superField; private static IntField layoutHelper; private static AddressField name; - private static CIntField accessFlags; private static MetadataField subklass; private static MetadataField nextSibling; private static MetadataField nextLink; @@ -117,9 +115,6 @@ public class Klass extends Metadata implements ClassConstants { public Klass getJavaSuper() { return null; } public int getLayoutHelper() { return layoutHelper.getValue(this); } public Symbol getName() { return getSymbol(name); } - public long getAccessFlags() { return accessFlags.getValue(this); } - // Convenience routine - public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); } public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); } public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); } public Klass getNextLinkKlass() { return (Klass) nextLink.getValue(this); } @@ -175,7 +170,6 @@ public class Klass extends Metadata implements ClassConstants { visitor.doMetadata(superField, true); visitor.doInt(layoutHelper, true); // visitor.doOop(name, true); - visitor.doCInt(accessFlags, true); visitor.doMetadata(subklass, true); visitor.doMetadata(nextSibling, true); visitor.doCInt(vtableLen, true); @@ -205,12 +199,4 @@ public class Klass extends Metadata implements ClassConstants { // The subclasses override this to produce the correct form, eg // Ljava/lang/String; For ArrayKlasses getName itself is the signature. public String signature() { return getName().asString(); } - - // Convenience routines - public boolean isPublic() { return getAccessFlagsObj().isPublic(); } - public boolean isFinal() { return getAccessFlagsObj().isFinal(); } - public boolean isInterface() { return getAccessFlagsObj().isInterface(); } - public boolean isAbstract() { return getAccessFlagsObj().isAbstract(); } - public boolean isSuper() { return getAccessFlagsObj().isSuper(); } - public boolean isSynthetic() { return getAccessFlagsObj().isSynthetic(); } } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java index a4cdb671959..c71cb3156ea 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.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 @@ -107,7 +107,7 @@ public class ObjectHeap { /** iterate objects of given Klass. param 'includeSubtypes' tells whether to * include objects of subtypes or not */ - public void iterateObjectsOfKlass(HeapVisitor visitor, final Klass k, boolean includeSubtypes) { + public void iterateObjectsOfKlass(HeapVisitor visitor, final InstanceKlass k, boolean includeSubtypes) { if (includeSubtypes) { if (k.isFinal()) { // do the simpler "exact" klass loop @@ -124,7 +124,7 @@ public class ObjectHeap { } /** iterate objects of given Klass (objects of subtypes included) */ - public void iterateObjectsOfKlass(HeapVisitor visitor, final Klass k) { + public void iterateObjectsOfKlass(HeapVisitor visitor, final InstanceKlass k) { iterateObjectsOfKlass(visitor, k, true); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ConcurrentLocksPrinter.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ConcurrentLocksPrinter.java index fa28a96e333..c4abb3e946d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ConcurrentLocksPrinter.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ConcurrentLocksPrinter.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 @@ -64,7 +64,7 @@ public class ConcurrentLocksPrinter { private void fillLocks() { VM vm = VM.getVM(); SystemDictionary sysDict = vm.getSystemDictionary(); - Klass absOwnSyncKlass = sysDict.getAbstractOwnableSynchronizerKlass(); + InstanceKlass absOwnSyncKlass = sysDict.getAbstractOwnableSynchronizerKlass(); ObjectHeap heap = vm.getObjectHeap(); // may be not loaded at all if (absOwnSyncKlass != null) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/StackValueCollection.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/StackValueCollection.java index a2808bfff31..f6d33d3c7e8 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/StackValueCollection.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/StackValueCollection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java index e23e63806bd..11f03a6003e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.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 @@ -76,9 +76,10 @@ public class ThreadLocalAllocBuffer extends VMObject { private long endReserve() { long labAlignmentReserve = VM.getVM().getLabAlignmentReserve(); + long reserveForAllocationPrefetch = VM.getVM().getReserveForAllocationPrefetch(); long heapWordSize = VM.getVM().getHeapWordSize(); - return labAlignmentReserve * heapWordSize; + return Math.max(labAlignmentReserve, reserveForAllocationPrefetch) * heapWordSize; } /** Support for iteration over heap -- not sure how this will diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java index 046225d0ae3..b48547fa3ae 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java @@ -123,6 +123,7 @@ public class VM { private int invocationEntryBCI; private ReversePtrs revPtrs; private VMRegImpl vmregImpl; + private int reserveForAllocationPrefetch; private int labAlignmentReserve; // System.getProperties from debuggee VM @@ -445,6 +446,8 @@ public class VM { boolType = (CIntegerType) db.lookupType("bool"); Type threadLocalAllocBuffer = db.lookupType("ThreadLocalAllocBuffer"); + CIntegerField reserveForAllocationPrefetchField = threadLocalAllocBuffer.getCIntegerField("_reserve_for_allocation_prefetch"); + reserveForAllocationPrefetch = (int)reserveForAllocationPrefetchField.getCInteger(intType); Type collectedHeap = db.lookupType("CollectedHeap"); CIntegerField labAlignmentReserveField = collectedHeap.getCIntegerField("_lab_alignment_reserve"); @@ -907,6 +910,10 @@ public class VM { return vmInternalInfo; } + public int getReserveForAllocationPrefetch() { + return reserveForAllocationPrefetch; + } + public int getLabAlignmentReserve() { return labAlignmentReserve; } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64CurrentFrameGuess.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64CurrentFrameGuess.java index e85973773dc..030d502075d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64CurrentFrameGuess.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64CurrentFrameGuess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, 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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64RegisterMap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64RegisterMap.java index b1ae1e8a001..dd8834f3d38 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64RegisterMap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/amd64/AMD64RegisterMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, 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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java index a2cdac72add..483c3e5dfde 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/linux_amd64/LinuxAMD64JavaThreadPDAccess.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/linux_amd64/LinuxAMD64JavaThreadPDAccess.java index f8672066189..5eb39ed66a8 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/linux_amd64/LinuxAMD64JavaThreadPDAccess.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/linux_amd64/LinuxAMD64JavaThreadPDAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, 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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_amd64/Win32AMD64JavaThreadPDAccess.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_amd64/Win32AMD64JavaThreadPDAccess.java index a573b9a383a..9e47bf57602 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_amd64/Win32AMD64JavaThreadPDAccess.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_amd64/Win32AMD64JavaThreadPDAccess.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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java index b7c470e3477..0e65a41c571 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.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 @@ -90,7 +90,7 @@ public class ClassLoaderStats extends Tool { VM vm = VM.getVM(); ObjectHeap heap = vm.getObjectHeap(); - Klass classLoaderKlass = vm.getSystemDictionary().getClassLoaderKlass(); + InstanceKlass classLoaderKlass = vm.getSystemDictionary().getClassLoaderKlass(); try { heap.iterateObjectsOfKlass(new DefaultHeapVisitor() { public boolean doObj(Oop oop) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java index 76b8595e3b2..05044ec8afc 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2022, 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 diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java index 53fa5204349..2ca720dd573 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2022, 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 diff --git a/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp b/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp index 74be5db0d79..f2994c0d827 100644 --- a/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp +++ b/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp @@ -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 diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Authenticator.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Authenticator.java index ddef30f0c5c..6bb97e0799a 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Authenticator.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Authenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, 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 @@ -40,7 +40,7 @@ public abstract class Authenticator { /** * Constructor for subclasses to call. */ - protected Authenticator () { } + protected Authenticator() { } /** * Base class for return type from {@link #authenticate(HttpExchange)} method. @@ -50,7 +50,7 @@ public abstract class Authenticator { /** * Constructor for subclasses to call. */ - protected Result () {} + protected Result() {} } /** @@ -67,7 +67,7 @@ public abstract class Authenticator { * @param responseCode the response code to associate with this * {@code Failure} instance */ - public Failure (int responseCode) { + public Failure(int responseCode) { this.responseCode = responseCode; } @@ -94,7 +94,7 @@ public abstract class Authenticator { * * @param p the authenticated user you wish to set as {@code Principal} */ - public Success (HttpPrincipal p) { + public Success(HttpPrincipal p) { principal = p; } @@ -126,7 +126,7 @@ public abstract class Authenticator { * @param responseCode the response code to associate with this * {@code Retry} instance */ - public Retry (int responseCode) { + public Retry(int responseCode) { this.responseCode = responseCode; } @@ -158,5 +158,5 @@ public abstract class Authenticator { * @param exch the {@code HttpExchange} upon which authenticate is called * @return the result */ - public abstract Result authenticate (HttpExchange exch); + public abstract Result authenticate(HttpExchange exch); } diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/BasicAuthenticator.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/BasicAuthenticator.java index b2cf78dd992..8c306888370 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/BasicAuthenticator.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/BasicAuthenticator.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 @@ -35,7 +35,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; /** * BasicAuthenticator provides an implementation of HTTP Basic * authentication. It is an abstract class and must be extended - * to provide an implementation of {@link #checkCredentials(String,String)} + * to provide an implementation of {@link #checkCredentials(String, String)} * which is called to verify each incoming request. * * @since 1.6 @@ -104,34 +104,34 @@ public abstract class BasicAuthenticator extends Authenticator { * * @return the authenticator's realm string */ - public String getRealm () { + public String getRealm() { return realm; } - public Result authenticate (HttpExchange t) + public Result authenticate(HttpExchange t) { Headers rmap = t.getRequestHeaders(); /* * look for auth token */ - String auth = rmap.getFirst ("Authorization"); + String auth = rmap.getFirst("Authorization"); if (auth == null) { setAuthHeader(t); - return new Authenticator.Retry (401); + return new Authenticator.Retry(401); } - int sp = auth.indexOf (' '); + int sp = auth.indexOf(' '); if (sp == -1 || !auth.substring(0, sp).equalsIgnoreCase("Basic")) { - return new Authenticator.Failure (401); + return new Authenticator.Failure(401); } byte[] b = Base64.getDecoder().decode(auth.substring(sp+1)); - String userpass = new String (b, charset); - int colon = userpass.indexOf (':'); - String uname = userpass.substring (0, colon); - String pass = userpass.substring (colon+1); + String userpass = new String(b, charset); + int colon = userpass.indexOf(':'); + String uname = userpass.substring(0, colon); + String pass = userpass.substring(colon+1); - if (checkCredentials (uname, pass)) { - return new Authenticator.Success ( - new HttpPrincipal ( + if (checkCredentials(uname, pass)) { + return new Authenticator.Success( + new HttpPrincipal( uname, realm ) ); @@ -146,7 +146,7 @@ public abstract class BasicAuthenticator extends Authenticator { Headers map = t.getResponseHeaders(); var authString = "Basic realm=" + "\"" + realm + "\"" + (isUTF8 ? ", charset=\"UTF-8\"" : ""); - map.set ("WWW-Authenticate", authString); + map.set("WWW-Authenticate", authString); } /** @@ -159,6 +159,6 @@ public abstract class BasicAuthenticator extends Authenticator { * @param password the password from the request * @return {@code true} if the credentials are valid, {@code false} otherwise */ - public abstract boolean checkCredentials (String username, String password); + public abstract boolean checkCredentials(String username, String password); } diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java index 7dacefcb59b..906e8448c54 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, 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,7 +53,7 @@ public abstract class Filter { /** * Constructor for subclasses to call. */ - protected Filter () {} + protected Filter() {} /** * A chain of filters associated with a {@link HttpServer}. @@ -76,7 +76,7 @@ public abstract class Filter { * @param handler the {@link HttpHandler} that will be invoked after * the final {@code Filter} has finished */ - public Chain (List filters, HttpHandler handler) { + public Chain(List filters, HttpHandler handler) { iter = filters.listIterator(); this.handler = handler; } @@ -93,12 +93,12 @@ public abstract class Filter { * @throws IOException if an I/O error occurs * @throws NullPointerException if exchange is {@code null} */ - public void doFilter (HttpExchange exchange) throws IOException { + public void doFilter(HttpExchange exchange) throws IOException { if (!iter.hasNext()) { - handler.handle (exchange); + handler.handle(exchange); } else { Filter f = iter.next(); - f.doFilter (exchange, this); + f.doFilter(exchange, this); } } } @@ -135,14 +135,14 @@ public abstract class Filter { * must be rethrown again * @throws NullPointerException if either exchange or chain are {@code null} */ - public abstract void doFilter (HttpExchange exchange, Chain chain) + public abstract void doFilter(HttpExchange exchange, Chain chain) throws IOException; /** * Returns a short description of this {@code Filter}. * * @return a {@code String} describing the {@code Filter} */ - public abstract String description (); + public abstract String description(); /** * Returns a pre-processing {@code Filter} with the given description and diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java index 7d11bd42c94..9389aae8691 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java @@ -36,6 +36,7 @@ import java.util.Set; import java.util.function.BiFunction; import java.util.stream.Collectors; import sun.net.httpserver.UnmodifiableHeaders; +import sun.net.httpserver.Utils; /** * HTTP request and response headers are represented by this class which @@ -62,9 +63,9 @@ import sun.net.httpserver.UnmodifiableHeaders; *
    *
  • {@link #getFirst(String)} returns a single valued header or the first * value of a multi-valued header. - *
  • {@link #add(String,String)} adds the given header value to the list + *
  • {@link #add(String, String)} adds the given header value to the list * for the given key. - *
  • {@link #set(String,String)} sets the given header field to the single + *
  • {@link #set(String, String)} sets the given header field to the single * value given overwriting any existing values in the value list. *
* @@ -80,9 +81,9 @@ import sun.net.httpserver.UnmodifiableHeaders; * {@code null} keys will never be present in HTTP request or response headers. * @since 1.6 */ -public class Headers implements Map> { +public class Headers implements Map> { - HashMap> map; + HashMap> map; /** * Creates an empty instance of {@code Headers}. @@ -99,7 +100,7 @@ public class Headers implements Map> { * null. * @since 18 */ - public Headers(Map> headers) { + public Headers(Map> headers) { Objects.requireNonNull(headers); var h = headers.entrySet().stream() .collect(Collectors.toUnmodifiableMap( @@ -216,8 +217,13 @@ public class Headers implements Map> { @Override public List put(String key, List value) { + // checkHeader is called in this class to fail fast + // It also must be called in sendResponseHeaders because + // Headers instances internal state can be modified + // external to these methods. + Utils.checkHeader(key, false); for (String v : value) - checkValue(v); + Utils.checkHeader(v, true); return map.put(normalize(key), value); } @@ -229,40 +235,17 @@ public class Headers implements Map> { * @param value the value to add to the header */ public void add(String key, String value) { - checkValue(value); + Utils.checkHeader(key, false); + Utils.checkHeader(value, true); String k = normalize(key); List l = map.get(k); if (l == null) { l = new LinkedList<>(); - map.put(k,l); + map.put(k, l); } l.add(value); } - private static void checkValue(String value) { - int len = value.length(); - for (int i=0; i= len - 2) { - throw new IllegalArgumentException("Illegal CR found in header"); - } - char c1 = value.charAt(i+1); - char c2 = value.charAt(i+2); - if (c1 != '\n') { - throw new IllegalArgumentException("Illegal char found after CR in header"); - } - if (c2 != ' ' && c2 != '\t') { - throw new IllegalArgumentException("No whitespace found after CRLF in header"); - } - i+=2; - } else if (c == '\n') { - throw new IllegalArgumentException("Illegal LF found in header"); - } - } - } - /** * Sets the given {@code value} as the sole header value for the given * {@code key}. If the mapping does not already exist, then it is created. @@ -304,7 +287,7 @@ public class Headers implements Map> { public void replaceAll(BiFunction, ? extends List> function) { var f = function.andThen(values -> { Objects.requireNonNull(values); - values.forEach(Headers::checkValue); + values.forEach(value -> Utils.checkHeader(value, true)); return values; }); Map.super.replaceAll(f); @@ -372,7 +355,7 @@ public class Headers implements Map> { * null. * @since 18 */ - public static Headers of(Map> headers) { + public static Headers of(Map> headers) { return new UnmodifiableHeaders(new Headers(headers)); } } diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpContext.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpContext.java index 12529d88385..1c9e41e866c 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpContext.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpContext.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 @@ -90,7 +90,7 @@ public abstract class HttpContext { * * @return a {@code Map} containing the attributes of this context */ - public abstract Map getAttributes() ; + public abstract Map getAttributes() ; /** * Returns this context's {@link List} of {@linkplain Filter filters}. This diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java index 7ea43c0418e..a56c20b53af 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java @@ -48,7 +48,7 @@ import java.net.URI; * should be closed. *
  • {@link #getResponseHeaders()} to set any response headers, except * content-length. - *
  • {@link #sendResponseHeaders(int,long)} to send the response headers. + *
  • {@link #sendResponseHeaders(int, long)} to send the response headers. * Must be called before next step. *
  • {@link #getResponseBody()} to get a {@link OutputStream} to * send the response body. When the response body has been written, the @@ -73,7 +73,7 @@ public abstract class HttpExchange implements AutoCloseable, Request { /* * Symbolic values for the responseLength parameter of - * sendResponseHeaders(int,long) + * sendResponseHeaders(int, long) */ /** @@ -163,7 +163,7 @@ public abstract class HttpExchange implements AutoCloseable, Request { /** * Returns a stream to which the response body must be - * written. {@link #sendResponseHeaders(int,long)}) must be called prior to + * written. {@link #sendResponseHeaders(int, long)}) must be called prior to * calling this method. Multiple calls to this method (for the same exchange) * will return the same stream. In order to correctly terminate each exchange, * the output stream must be closed, even if no response body is being sent. diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandler.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandler.java index 1f1fc129c9d..447001a4f53 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandler.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, 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,5 +44,5 @@ public interface HttpHandler { * @throws NullPointerException if exchange is {@code null} * @throws IOException if an I/O error occurs */ - public abstract void handle (HttpExchange exchange) throws IOException; + public abstract void handle(HttpExchange exchange) throws IOException; } diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java index 8ed0172690f..a0271fed146 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, 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,7 +44,7 @@ import java.util.concurrent.Executor; * a root URI path which represents the location of the application or service * on this server. The mapping of a handler to a {@code HttpServer} is * encapsulated by a {@link HttpContext} object. HttpContexts are created by - * calling {@link #createContext(String,HttpHandler)}. + * calling {@link #createContext(String, HttpHandler)}. * Any request for which no handler can be found is rejected with a 404 response. * Management of threads can be done external to this object by providing a * {@link java.util.concurrent.Executor} object. If none is provided a default @@ -117,13 +117,13 @@ public abstract class HttpServer { * Creates a {@code HttpServer} instance which is initially not bound to any * local address/port. The {@code HttpServer} is acquired from the currently * installed {@link HttpServerProvider}. The server must be bound using - * {@link #bind(InetSocketAddress,int)} before it can be used. + * {@link #bind(InetSocketAddress, int)} before it can be used. * * @throws IOException if an I/O error occurs * @return an instance of {@code HttpServer} */ public static HttpServer create() throws IOException { - return create (null, 0); + return create(null, 0); } /** @@ -149,7 +149,7 @@ public abstract class HttpServer { public static HttpServer create(InetSocketAddress addr, int backlog) throws IOException { HttpServerProvider provider = HttpServerProvider.provider(); - return provider.createHttpServer (addr, backlog); + return provider.createHttpServer(addr, backlog); } /** diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsConfigurator.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsConfigurator.java index 8cd9e3affa2..7f329e02f47 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsConfigurator.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsConfigurator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, 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 @@ -38,11 +38,11 @@ import javax.net.ssl.SSLParameters; *

    The following example shows how this may be done: * *

    - * SSLContext sslContext = SSLContext.getInstance (....);
    + * SSLContext sslContext = SSLContext.getInstance(....);
      * HttpsServer server = HttpsServer.create();
      *
    - * server.setHttpsConfigurator (new HttpsConfigurator(sslContext) {
    - *     public void configure (HttpsParameters params) {
    + * server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
    + *     public void configure(HttpsParameters params) {
      *
      *         // get the remote address if needed
      *         InetSocketAddress remote = params.getClientAddress();
    @@ -51,7 +51,7 @@ import javax.net.ssl.SSLParameters;
      *
      *         // get the default parameters
      *         SSLParameters sslparams = c.getDefaultSSLParameters();
    - *         if (remote.equals (...) ) {
    + *         if (remote.equals(...)) {
      *             // modify the default set for client x
      *         }
      *
    @@ -74,7 +74,7 @@ public class HttpsConfigurator {
          */
         public HttpsConfigurator(SSLContext context) {
             if (context == null) {
    -            throw new NullPointerException ("null SSLContext");
    +            throw new NullPointerException("null SSLContext");
             }
             this.context = context;
         }
    @@ -107,6 +107,6 @@ public class HttpsConfigurator {
         * @since 1.6
         */
         public void configure(HttpsParameters params) {
    -        params.setSSLParameters (getSSLContext().getDefaultSSLParameters());
    +        params.setSSLParameters(getSSLContext().getDefaultSSLParameters());
         }
     }
    diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java
    index 7b3dafd5582..192b8c3d697 100644
    --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java
    +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2005, 2021, 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
    @@ -57,7 +57,7 @@ public abstract class HttpsServer extends HttpServer {
          * Creates a {@code HttpsServer} instance which is initially not bound to any
          * local address/port. The {@code HttpsServer} is acquired from the currently
          * installed {@link HttpServerProvider}. The server must be bound using
    -     * {@link #bind(InetSocketAddress,int)} before it can be used. The server
    +     * {@link #bind(InetSocketAddress, int)} before it can be used. The server
          * must also have a {@code HttpsConfigurator} established with
          * {@link #setHttpsConfigurator(HttpsConfigurator)}.
          *
    @@ -80,7 +80,7 @@ public abstract class HttpsServer extends HttpServer {
          * established with {@link #setHttpsConfigurator(HttpsConfigurator)}.
          *
          * @param addr the address to listen on, if {@code null} then
    -     *             {@link #bind(InetSocketAddress,int)} must be called to set
    +     *             {@link #bind(InetSocketAddress, int)} must be called to set
          *             the address
          * @param backlog the socket backlog. If this value is less than or equal to
          *               zero, then a system default value is used.
    diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/SimpleFileServer.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/SimpleFileServer.java
    index 551f24d3cf0..ba93b81db5a 100644
    --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/SimpleFileServer.java
    +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/SimpleFileServer.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
    @@ -55,7 +55,7 @@ import sun.net.httpserver.simpleserver.OutputFilter;
      *
      * 

    Simple file server

    * - *

    The {@link #createFileServer(InetSocketAddress,Path,OutputLevel) createFileServer} + *

    The {@link #createFileServer(InetSocketAddress, Path, OutputLevel) createFileServer} * static factory method returns an {@link HttpServer HttpServer} that is a * simple out-of-the-box file server. The server comes with an initial handler * that serves files from a given directory path (and its subdirectories). diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/package-info.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/package-info.java index 3b9de3520fb..466b76a6c4a 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/package-info.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, 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 @@ -117,26 +117,25 @@ The following code shows how the SSLContext is then used in a HttpsConfigurator and how the SSLContext and HttpsConfigurator are linked to the HttpsServer.

    -    server.setHttpsConfigurator (new HttpsConfigurator(sslContext) {
    -        public void configure (HttpsParameters params) {
    +   server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
    +       public void configure(HttpsParameters params) {
     
    -        // get the remote address if needed
    -        InetSocketAddress remote = params.getClientAddress();
    +           // get the remote address if needed
    +           InetSocketAddress remote = params.getClientAddress();
     
    -        SSLContext c = getSSLContext();
    +           SSLContext c = getSSLContext();
     
    -        // get the default parameters
    -        SSLParameters sslparams = c.getDefaultSSLParameters();
    -        if (remote.equals (...) ) {
    -            // modify the default set for client x
    -        }
    +           // get the default parameters
    +           SSLParameters sslparams = c.getDefaultSSLParameters();
    +           if (remote.equals(...)) {
    +               // modify the default set for client x
    +           }
     
    -        params.setSSLParameters(sslparams);
    -        // statement above could throw IAE if any params invalid.
    -        // eg. if app has a UI and parameters supplied by a user.
    -
    -        }
    -    });
    +           params.setSSLParameters(sslparams);
    +           // statement above could throw IAE if any params invalid.
    +           // eg. if app has a UI and parameters supplied by a user.
    +       }
    +   });
        
    @since 1.6 */ diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java index d025e90cf87..9d73f0e7340 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.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 @@ -152,7 +152,7 @@ public abstract class HttpServerProvider { * * @return The system-wide default HttpServerProvider */ - public static HttpServerProvider provider () { + public static HttpServerProvider provider() { synchronized (lock) { if (provider != null) return provider; diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java index 468fa19fe16..4641325af92 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java @@ -33,48 +33,48 @@ public class AuthFilter extends Filter { private Authenticator authenticator; - public AuthFilter (Authenticator authenticator) { + public AuthFilter(Authenticator authenticator) { this.authenticator = authenticator; } - public String description () { + public String description() { return "Authentication filter"; } - public void setAuthenticator (Authenticator a) { + public void setAuthenticator(Authenticator a) { authenticator = a; } - public void consumeInput (HttpExchange t) throws IOException { + public void consumeInput(HttpExchange t) throws IOException { InputStream i = t.getRequestBody(); byte[] b = new byte [4096]; - while (i.read (b) != -1); - i.close (); + while (i.read(b) != -1); + i.close(); } /** * The filter's implementation, which is invoked by the server */ - public void doFilter (HttpExchange t, Filter.Chain chain) throws IOException + public void doFilter(HttpExchange t, Filter.Chain chain) throws IOException { if (authenticator != null) { - Authenticator.Result r = authenticator.authenticate (t); + Authenticator.Result r = authenticator.authenticate(t); if (r instanceof Authenticator.Success) { Authenticator.Success s = (Authenticator.Success)r; - ExchangeImpl e = ExchangeImpl.get (t); - e.setPrincipal (s.getPrincipal()); - chain.doFilter (t); + ExchangeImpl e = ExchangeImpl.get(t); + e.setPrincipal(s.getPrincipal()); + chain.doFilter(t); } else if (r instanceof Authenticator.Retry) { Authenticator.Retry ry = (Authenticator.Retry)r; - consumeInput (t); - t.sendResponseHeaders (ry.getResponseCode(), RSPBODY_EMPTY); + consumeInput(t); + t.sendResponseHeaders(ry.getResponseCode(), RSPBODY_EMPTY); } else if (r instanceof Authenticator.Failure) { Authenticator.Failure f = (Authenticator.Failure)r; - consumeInput (t); - t.sendResponseHeaders (f.getResponseCode(), RSPBODY_EMPTY); + consumeInput(t); + t.sendResponseHeaders(f.getResponseCode(), RSPBODY_EMPTY); } } else { - chain.doFilter (t); + chain.doFilter(t); } } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedInputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedInputStream.java index 34ac72e1fee..0c003378d77 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedInputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, 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 @@ -31,7 +31,7 @@ import com.sun.net.httpserver.*; import com.sun.net.httpserver.spi.*; class ChunkedInputStream extends LeftOverInputStream { - ChunkedInputStream (ExchangeImpl t, InputStream src) { + ChunkedInputStream(ExchangeImpl t, InputStream src) { super (t, src); } @@ -48,7 +48,7 @@ class ChunkedInputStream extends LeftOverInputStream { */ private static final int MAX_CHUNK_HEADER_SIZE = 2050; - private int numeric (char[] arr, int nchars) throws IOException { + private int numeric(char[] arr, int nchars) throws IOException { assert arr.length >= nchars; int len = 0; for (int i=0; i='A' && c<= 'F') { val = c - 'A' + 10; } else { - throw new IOException ("invalid chunk length"); + throw new IOException("invalid chunk length"); } len = len * 16 + val; } @@ -71,10 +71,10 @@ class ChunkedInputStream extends LeftOverInputStream { /* read the chunk header line and return the chunk length * any chunk extensions are ignored */ - private int readChunkHeader () throws IOException { + private int readChunkHeader() throws IOException { boolean gotCR = false; int c; - char[] len_arr = new char [16]; + char[] len_arr = new char[16]; int len_size = 0; boolean end_of_len = false; int read = 0; @@ -85,11 +85,11 @@ class ChunkedInputStream extends LeftOverInputStream { if ((len_size == len_arr.length -1) || (read > MAX_CHUNK_HEADER_SIZE)) { - throw new IOException ("invalid chunk header"); + throw new IOException("invalid chunk header"); } if (gotCR) { if (ch == LF) { - int l = numeric (len_arr, len_size); + int l = numeric(len_arr, len_size); return l; } else { gotCR = false; @@ -107,10 +107,10 @@ class ChunkedInputStream extends LeftOverInputStream { } } } - throw new IOException ("end of stream reading chunk header"); + throw new IOException("end of stream reading chunk header"); } - protected int readImpl (byte[]b, int off, int len) throws IOException { + protected int readImpl(byte[] b, int off, int len) throws IOException { if (eof) { return -1; } @@ -119,7 +119,7 @@ class ChunkedInputStream extends LeftOverInputStream { if (remaining == 0) { eof = true; consumeCRLF(); - t.getServerImpl().requestCompleted (t.getConnection()); + t.getServerImpl().requestCompleted(t.getConnection()); return -1; } needToReadHeader = false; @@ -140,15 +140,15 @@ class ChunkedInputStream extends LeftOverInputStream { return n; } - private void consumeCRLF () throws IOException { + private void consumeCRLF() throws IOException { char c; c = (char)in.read(); /* CR */ if (c != CR) { - throw new IOException ("invalid chunk end"); + throw new IOException("invalid chunk end"); } c = (char)in.read(); /* LF */ if (c != LF) { - throw new IOException ("invalid chunk end"); + throw new IOException("invalid chunk end"); } } @@ -158,7 +158,7 @@ class ChunkedInputStream extends LeftOverInputStream { * limitation for the moment. It only affects potential efficiency * rather than correctness. */ - public int available () throws IOException { + public int available() throws IOException { if (eof || closed) { return 0; } @@ -170,17 +170,17 @@ class ChunkedInputStream extends LeftOverInputStream { * have been read from the underlying channel * and buffered internally */ - public boolean isDataBuffered () throws IOException { + public boolean isDataBuffered() throws IOException { assert eof; return in.available() > 0; } - public boolean markSupported () {return false;} + public boolean markSupported() {return false;} - public void mark (int l) { + public void mark(int l) { } - public void reset () throws IOException { - throw new IOException ("mark/reset not supported"); + public void reset() throws IOException { + throw new IOException("mark/reset not supported"); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java index e8e84eb8edd..fd1a940c0a5 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java @@ -57,14 +57,14 @@ class ChunkedOutputStream extends FilterOutputStream private byte[] buf = new byte [CHUNK_SIZE+OFFSET+2]; ExchangeImpl t; - ChunkedOutputStream (ExchangeImpl t, OutputStream src) { - super (src); + ChunkedOutputStream(ExchangeImpl t, OutputStream src) { + super(src); this.t = t; } - public void write (int b) throws IOException { + public void write(int b) throws IOException { if (closed) { - throw new StreamClosedException (); + throw new StreamClosedException(); } buf [pos++] = (byte)b; count ++; @@ -74,23 +74,23 @@ class ChunkedOutputStream extends FilterOutputStream assert count < CHUNK_SIZE; } - public void write (byte[]b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { Objects.checkFromIndexSize(off, len, b.length); if (len == 0) { return; } if (closed) { - throw new StreamClosedException (); + throw new StreamClosedException(); } int remain = CHUNK_SIZE - count; if (len > remain) { - System.arraycopy (b,off,buf,pos,remain); + System.arraycopy(b, off, buf, pos, remain); count = CHUNK_SIZE; writeChunk(); len -= remain; off += remain; while (len >= CHUNK_SIZE) { - System.arraycopy (b,off,buf,OFFSET,CHUNK_SIZE); + System.arraycopy(b, off, buf, OFFSET, CHUNK_SIZE); len -= CHUNK_SIZE; off += CHUNK_SIZE; count = CHUNK_SIZE; @@ -98,7 +98,7 @@ class ChunkedOutputStream extends FilterOutputStream } } if (len > 0) { - System.arraycopy (b,off,buf,pos,len); + System.arraycopy(b, off, buf, pos, len); count += len; pos += len; } @@ -112,8 +112,8 @@ class ChunkedOutputStream extends FilterOutputStream * chunk does not have to be CHUNK_SIZE bytes * count must == number of user bytes (<= CHUNK_SIZE) */ - private void writeChunk () throws IOException { - char[] c = Integer.toHexString (count).toCharArray(); + private void writeChunk() throws IOException { + char[] c = Integer.toHexString(count).toCharArray(); int clen = c.length; int startByte = 4 - clen; int i; @@ -124,12 +124,12 @@ class ChunkedOutputStream extends FilterOutputStream buf[startByte + (i++)] = '\n'; buf[startByte + (i++) + count] = '\r'; buf[startByte + (i++) + count] = '\n'; - out.write (buf, startByte, i+count); + out.write(buf, startByte, i+count); count = 0; pos = OFFSET; } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } @@ -156,12 +156,12 @@ class ChunkedOutputStream extends FilterOutputStream } Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent (e); + t.getHttpContext().getServerImpl().addEvent(e); } - public void flush () throws IOException { + public void flush() throws IOException { if (closed) { - throw new StreamClosedException (); + throw new StreamClosedException(); } if (count > 0) { writeChunk(); diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java index 6b86b8fa5bd..c5391343f96 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, 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 @@ -64,7 +64,7 @@ class Code { public static final int HTTP_GATEWAY_TIMEOUT = 504; public static final int HTTP_VERSION = 505; - static String msg (int code) { + static String msg(int code) { switch (code) { case HTTP_OK: return " OK"; diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.java index cbedb6ca860..96b55575928 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.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 @@ -31,30 +31,30 @@ class ContextList { private final LinkedList list = new LinkedList<>(); - public synchronized void add (HttpContextImpl ctx) { + public synchronized void add(HttpContextImpl ctx) { assert ctx.getPath() != null; if (contains(ctx)) { - throw new IllegalArgumentException ("cannot add context to list"); + throw new IllegalArgumentException("cannot add context to list"); } - list.add (ctx); + list.add(ctx); } boolean contains(HttpContextImpl ctx) { return findContext(ctx.getProtocol(), ctx.getPath(), true) != null; } - public synchronized int size () { + public synchronized int size() { return list.size(); } /* initially contexts are located only by protocol:path. * Context with longest prefix matches (currently case-sensitive) */ - synchronized HttpContextImpl findContext (String protocol, String path) { - return findContext (protocol, path, false); + synchronized HttpContextImpl findContext(String protocol, String path) { + return findContext(protocol, path, false); } - synchronized HttpContextImpl findContext (String protocol, String path, boolean exact) { + synchronized HttpContextImpl findContext(String protocol, String path, boolean exact) { protocol = protocol.toLowerCase(Locale.ROOT); String longest = ""; HttpContextImpl lc = null; @@ -63,7 +63,7 @@ class ContextList { continue; } String cpath = ctx.getPath(); - if (exact && !cpath.equals (path)) { + if (exact && !cpath.equals(path)) { continue; } else if (!exact && !path.startsWith(cpath)) { continue; @@ -76,25 +76,25 @@ class ContextList { return lc; } - public synchronized void remove (String protocol, String path) + public synchronized void remove(String protocol, String path) throws IllegalArgumentException { - HttpContextImpl ctx = findContext (protocol, path, true); + HttpContextImpl ctx = findContext(protocol, path, true); if (ctx == null) { - throw new IllegalArgumentException ("cannot remove element from list"); + throw new IllegalArgumentException("cannot remove element from list"); } - list.remove (ctx); + list.remove(ctx); } - public synchronized void remove (HttpContextImpl context) + public synchronized void remove(HttpContextImpl context) throws IllegalArgumentException { for (HttpContextImpl ctx: list) { - if (ctx.equals (context)) { - list.remove (ctx); + if (ctx.equals(context)) { + list.remove(ctx); return; } } - throw new IllegalArgumentException ("no such context in list"); + throw new IllegalArgumentException("no such context in list"); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/DefaultHttpServerProvider.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/DefaultHttpServerProvider.java index fe746befb9f..7b54ef45e72 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/DefaultHttpServerProvider.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/DefaultHttpServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 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 @@ -31,11 +31,11 @@ import com.sun.net.httpserver.*; import com.sun.net.httpserver.spi.*; public class DefaultHttpServerProvider extends HttpServerProvider { - public HttpServer createHttpServer (InetSocketAddress addr, int backlog) throws IOException { - return new HttpServerImpl (addr, backlog); + public HttpServer createHttpServer(InetSocketAddress addr, int backlog) throws IOException { + return new HttpServerImpl(addr, backlog); } - public HttpsServer createHttpsServer (InetSocketAddress addr, int backlog) throws IOException { - return new HttpsServerImpl (addr, backlog); + public HttpsServer createHttpsServer(InetSocketAddress addr, int backlog) throws IOException { + return new HttpsServerImpl(addr, backlog); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java index 17dff13d4e5..ad6805938a2 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java @@ -82,12 +82,12 @@ class ExchangeImpl { PlaceholderOutputStream uos_orig; boolean sentHeaders; /* true after response headers sent */ - final Map attributes; + final Map attributes; int rcode = -1; HttpPrincipal principal; ServerImpl server; - ExchangeImpl ( + ExchangeImpl( String m, URI u, Request req, long len, HttpConnection connection ) throws IOException { this.req = req; @@ -107,23 +107,23 @@ class ExchangeImpl { server.startExchange(); } - public Headers getRequestHeaders () { + public Headers getRequestHeaders() { return reqHdrs; } - public Headers getResponseHeaders () { + public Headers getResponseHeaders() { return rspHdrs; } - public URI getRequestURI () { + public URI getRequestURI() { return uri; } - public String getRequestMethod (){ + public String getRequestMethod() { return method; } - public HttpContextImpl getHttpContext (){ + public HttpContextImpl getHttpContext() { return connection.getHttpContext(); } @@ -131,7 +131,7 @@ class ExchangeImpl { return HEAD.equals(getRequestMethod()); } - public void close () { + public void close() { if (closed) { return; } @@ -160,38 +160,38 @@ class ExchangeImpl { } } - public InputStream getRequestBody () { + public InputStream getRequestBody() { if (uis != null) { return uis; } if (reqContentLen == -1L) { - uis_orig = new ChunkedInputStream (this, ris); + uis_orig = new ChunkedInputStream(this, ris); uis = uis_orig; } else { - uis_orig = new FixedLengthInputStream (this, ris, reqContentLen); + uis_orig = new FixedLengthInputStream(this, ris, reqContentLen); uis = uis_orig; } return uis; } - LeftOverInputStream getOriginalInputStream () { + LeftOverInputStream getOriginalInputStream() { return uis_orig; } - public int getResponseCode () { + public int getResponseCode() { return rcode; } - public OutputStream getResponseBody () { + public OutputStream getResponseBody() { /* TODO. Change spec to remove restriction below. Filters * cannot work with this restriction * * if (!sentHeaders) { - * throw new IllegalStateException ("headers not sent"); + * throw new IllegalStateException("headers not sent"); * } */ if (uos == null) { - uos_orig = new PlaceholderOutputStream (null); + uos_orig = new PlaceholderOutputStream(null); uos = uos_orig; } return uos; @@ -202,37 +202,40 @@ class ExchangeImpl { * returned from the 1st call to getResponseBody() * The "real" ouputstream is then placed inside this */ - PlaceholderOutputStream getPlaceholderResponseBody () { + PlaceholderOutputStream getPlaceholderResponseBody() { getResponseBody(); return uos_orig; } - public void sendResponseHeaders (int rCode, long contentLen) + private static final byte[] CRLF = new byte[] {0x0D, 0x0A}; + + public void sendResponseHeaders(int rCode, long contentLen) throws IOException { final Logger logger = server.getLogger(); if (sentHeaders) { - throw new IOException ("headers already sent"); + throw new IOException("headers already sent"); } this.rcode = rCode; - String statusLine = "HTTP/1.1 "+rCode+Code.msg(rCode)+"\r\n"; + String statusLine = "HTTP/1.1 " + rCode + Code.msg(rCode); ByteArrayOutputStream tmpout = new ByteArrayOutputStream(); PlaceholderOutputStream o = getPlaceholderResponseBody(); - tmpout.write (bytes(statusLine, 0), 0, statusLine.length()); + tmpout.write(bytes(statusLine, false, 0), 0, statusLine.length()); + tmpout.write(CRLF); boolean noContentToSend = false; // assume there is content boolean noContentLengthHeader = false; // must not send Content-length is set rspHdrs.set("Date", FORMATTER.format(Instant.now())); /* check for response type that is not allowed to send a body */ - if ((rCode>=100 && rCode <200) /* informational */ + if ((rCode >= 100 && rCode < 200) /* informational */ ||(rCode == 204) /* no content */ ||(rCode == 304)) /* not modified */ { if (contentLen != RSPBODY_EMPTY) { - String msg = "sendResponseHeaders: rCode = "+ rCode + String msg = "sendResponseHeaders: rCode = " + rCode + ": forcing contentLen = RSPBODY_EMPTY"; - logger.log (Level.WARNING, msg); + logger.log(Level.WARNING, msg); } contentLen = RSPBODY_EMPTY; noContentLengthHeader = (rCode != 304); @@ -245,19 +248,19 @@ class ExchangeImpl { if (contentLen >= 0) { String msg = "sendResponseHeaders: being invoked with a content length for a HEAD request"; - logger.log (Level.WARNING, msg); + logger.log(Level.WARNING, msg); } noContentToSend = true; contentLen = 0; - o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen)); + o.setWrappedStream(new FixedLengthOutputStream(this, ros, contentLen)); } else { /* not a HEAD request or 304 response */ if (contentLen == RSPBODY_CHUNKED) { if (http10) { - o.setWrappedStream (new UndefLengthOutputStream (this, ros)); + o.setWrappedStream(new UndefLengthOutputStream(this, ros)); close = true; } else { - rspHdrs.set ("Transfer-encoding", "chunked"); - o.setWrappedStream (new ChunkedOutputStream (this, ros)); + rspHdrs.set("Transfer-encoding", "chunked"); + o.setWrappedStream(new ChunkedOutputStream(this, ros)); } } else { if (contentLen == RSPBODY_EMPTY) { @@ -267,7 +270,7 @@ class ExchangeImpl { if (!noContentLengthHeader) { rspHdrs.set("Content-length", Long.toString(contentLen)); } - o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen)); + o.setWrappedStream(new FixedLengthOutputStream(this, ros, contentLen)); } } @@ -280,12 +283,12 @@ class ExchangeImpl { Optional.ofNullable(rspHdrs.get("Connection")) .map(List::stream).orElse(Stream.empty()); if (conheader.anyMatch("close"::equalsIgnoreCase)) { - logger.log (Level.DEBUG, "Connection: close requested by handler"); + logger.log(Level.DEBUG, "Connection: close requested by handler"); close = true; } } - write (rspHdrs, tmpout); + write(rspHdrs, tmpout); this.rspContentLen = contentLen; tmpout.writeTo(ros); sentHeaders = true; @@ -294,41 +297,47 @@ class ExchangeImpl { ros.flush(); close(); } - server.logReply (rCode, req.requestLine(), null); + server.logReply(rCode, req.requestLine(), null); } - void write (Headers map, OutputStream os) throws IOException { - Set>> entries = map.entrySet(); - for (Map.Entry> entry : entries) { + void write(Headers map, OutputStream os) throws IOException { + Set>> entries = map.entrySet(); + for (Map.Entry> entry : entries) { String key = entry.getKey(); byte[] buf; List values = entry.getValue(); for (String val : values) { int i = key.length(); - buf = bytes (key, 2); + buf = bytes(key, true, 2); buf[i++] = ':'; buf[i++] = ' '; - os.write (buf, 0, i); - buf = bytes (val, 2); + os.write(buf, 0, i); + buf = bytes(val, false, 2); i = val.length(); buf[i++] = '\r'; buf[i++] = '\n'; - os.write (buf, 0, i); + os.write(buf, 0, i); } } - os.write ('\r'); - os.write ('\n'); + os.write('\r'); + os.write('\n'); } - private byte[] rspbuf = new byte [128]; // used by bytes() + private byte[] rspbuf = new byte[128]; // used by bytes() /** * convert string to byte[], using rspbuf * Make sure that at least "extra" bytes are free at end * of rspbuf. Reallocate rspbuf if not big enough. * caller must check return value to see if rspbuf moved + * + * Header values are supposed to be limited to 7-bit ASCII + * but 8-bit has to be allowed (for ISO_8859_1). For efficiency + * we just down cast 16 bit Java chars to byte. We don't allow + * any character that can't be encoded in 8 bits. */ - private byte[] bytes (String s, int extra) { + private byte[] bytes(String s, boolean isKey, int extra) throws IOException { + Utils.checkHeader(s, !isKey); int slen = s.length(); if (slen+extra > rspbuf.length) { int diff = slen + extra - rspbuf.length; @@ -341,27 +350,27 @@ class ExchangeImpl { return rspbuf; } - public InetSocketAddress getRemoteAddress (){ + public InetSocketAddress getRemoteAddress() { Socket s = connection.getChannel().socket(); InetAddress ia = s.getInetAddress(); int port = s.getPort(); - return new InetSocketAddress (ia, port); + return new InetSocketAddress(ia, port); } - public InetSocketAddress getLocalAddress (){ + public InetSocketAddress getLocalAddress() { Socket s = connection.getChannel().socket(); InetAddress ia = s.getLocalAddress(); int port = s.getLocalPort(); - return new InetSocketAddress (ia, port); + return new InetSocketAddress(ia, port); } - public String getProtocol (){ + public String getProtocol() { String reqline = req.requestLine(); - int index = reqline.lastIndexOf (' '); - return reqline.substring (index+1); + int index = reqline.lastIndexOf(' '); + return reqline.substring(index+1); } - public SSLSession getSSLSession () { + public SSLSession getSSLSession() { SSLEngine e = connection.getSSLEngine(); if (e == null) { return null; @@ -369,11 +378,11 @@ class ExchangeImpl { return e.getSession(); } - public Object getAttribute (String name) { + public Object getAttribute(String name) { return attributes.get(Objects.requireNonNull(name, "null name parameter")); } - public void setAttribute (String name, Object value) { + public void setAttribute(String name, Object value) { var key = Objects.requireNonNull(name, "null name parameter"); if (value != null) { attributes.put(key, value); @@ -382,7 +391,7 @@ class ExchangeImpl { } } - public void setStreams (InputStream i, OutputStream o) { + public void setStreams(InputStream i, OutputStream o) { assert uis != null; if (i != null) { uis = i; @@ -395,23 +404,23 @@ class ExchangeImpl { /** * PP */ - HttpConnection getConnection () { + HttpConnection getConnection() { return connection; } - ServerImpl getServerImpl () { + ServerImpl getServerImpl() { return getHttpContext().getServerImpl(); } - public HttpPrincipal getPrincipal () { + public HttpPrincipal getPrincipal() { return principal; } - void setPrincipal (HttpPrincipal principal) { + void setPrincipal(HttpPrincipal principal) { this.principal = principal; } - static ExchangeImpl get (HttpExchange t) { + static ExchangeImpl get(HttpExchange t) { if (t instanceof HttpExchangeImpl) { return ((HttpExchangeImpl)t).getExchangeImpl(); } else { @@ -432,37 +441,37 @@ class PlaceholderOutputStream extends java.io.OutputStream { OutputStream wrapped; - PlaceholderOutputStream (OutputStream os) { + PlaceholderOutputStream(OutputStream os) { wrapped = os; } - void setWrappedStream (OutputStream os) { + void setWrappedStream(OutputStream os) { wrapped = os; } - boolean isWrapped () { + boolean isWrapped() { return wrapped != null; } - private void checkWrap () throws IOException { + private void checkWrap() throws IOException { if (wrapped == null) { - throw new IOException ("response headers not sent yet"); + throw new IOException("response headers not sent yet"); } } public void write(int b) throws IOException { checkWrap(); - wrapped.write (b); + wrapped.write(b); } public void write(byte b[]) throws IOException { checkWrap(); - wrapped.write (b); + wrapped.write(b); } public void write(byte b[], int off, int len) throws IOException { checkWrap(); - wrapped.write (b, off, len); + wrapped.write(b, off, len); } public void flush() throws IOException { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthInputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthInputStream.java index ac6fb7be005..100ba9e1b3b 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthInputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, 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 @@ -39,15 +39,15 @@ import com.sun.net.httpserver.spi.*; class FixedLengthInputStream extends LeftOverInputStream { private long remaining; - FixedLengthInputStream (ExchangeImpl t, InputStream src, long len) { - super (t, src); + FixedLengthInputStream(ExchangeImpl t, InputStream src, long len) { + super(t, src); if (len < 0) { throw new IllegalArgumentException("Content-Length: " + len); } this.remaining = len; } - protected int readImpl (byte[]b, int off, int len) throws IOException { + protected int readImpl(byte[] b, int off, int len) throws IOException { eof = (remaining == 0L); if (eof) { @@ -60,7 +60,7 @@ class FixedLengthInputStream extends LeftOverInputStream { if (n > -1) { remaining -= n; if (remaining == 0) { - t.getServerImpl().requestCompleted (t.getConnection()); + t.getServerImpl().requestCompleted(t.getConnection()); } } if (n < 0 && !eof) @@ -68,7 +68,7 @@ class FixedLengthInputStream extends LeftOverInputStream { return n; } - public int available () throws IOException { + public int available() throws IOException { if (eof) { return 0; } @@ -76,12 +76,12 @@ class FixedLengthInputStream extends LeftOverInputStream { return n < remaining? n: (int)remaining; } - public boolean markSupported () {return false;} + public boolean markSupported() {return false;} - public void mark (int l) { + public void mark(int l) { } - public void reset () throws IOException { - throw new IOException ("mark/reset not supported"); + public void reset() throws IOException { + throw new IOException("mark/reset not supported"); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java index f800bdaba18..95de03d27fa 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java @@ -42,7 +42,7 @@ class FixedLengthOutputStream extends FilterOutputStream private boolean closed = false; ExchangeImpl t; - FixedLengthOutputStream (ExchangeImpl t, OutputStream src, long len) { + FixedLengthOutputStream(ExchangeImpl t, OutputStream src, long len) { super (src); if (len < 0) { throw new IllegalArgumentException("Content-Length: " + len); @@ -51,9 +51,9 @@ class FixedLengthOutputStream extends FilterOutputStream this.remaining = len; } - public void write (int b) throws IOException { + public void write(int b) throws IOException { if (closed) { - throw new IOException ("stream closed"); + throw new IOException("stream closed"); } if (remaining == 0) { throw new StreamClosedException(); @@ -62,30 +62,30 @@ class FixedLengthOutputStream extends FilterOutputStream remaining --; } - public void write (byte[]b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { Objects.checkFromIndexSize(off, len, b.length); if (len == 0) { return; } if (closed) { - throw new IOException ("stream closed"); + throw new IOException("stream closed"); } if (len > remaining) { // stream is still open, caller can retry - throw new IOException ("too many bytes to write to stream"); + throw new IOException("too many bytes to write to stream"); } out.write(b, off, len); remaining -= len; } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } closed = true; if (remaining > 0) { t.close(); - throw new IOException ("insufficient bytes written to stream"); + throw new IOException("insufficient bytes written to stream"); } flush(); LeftOverInputStream is = t.getOriginalInputStream(); @@ -95,7 +95,7 @@ class FixedLengthOutputStream extends FilterOutputStream } catch (IOException e) {} } Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent (e); + t.getHttpContext().getServerImpl().addEvent(e); } // flush is a pass-through diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.java index 38aabe1136e..2be4a37d432 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.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 @@ -73,14 +73,14 @@ class HttpConnection { return sb.toString(); } - HttpConnection () { + HttpConnection() { } - void setChannel (SocketChannel c) { + void setChannel(SocketChannel c) { chan = c; } - void setContext (HttpContextImpl ctx) { + void setContext(HttpContextImpl ctx) { context = ctx; } @@ -88,11 +88,11 @@ class HttpConnection { return state; } - void setState (State s) { + void setState(State s) { state = s; } - void setParameters ( + void setParameters( InputStream in, OutputStream rawout, SocketChannel chan, SSLEngine engine, SSLStreams sslStreams, SSLContext sslContext, String protocol, HttpContextImpl context, InputStream raw @@ -110,21 +110,21 @@ class HttpConnection { this.logger = context.getLogger(); } - SocketChannel getChannel () { + SocketChannel getChannel() { return chan; } - synchronized void close () { + synchronized void close() { if (closed) { return; } closed = true; if (logger != null && chan != null) { - logger.log (Level.TRACE, "Closing connection: " + chan.toString()); + logger.log(Level.TRACE, "Closing connection: " + chan.toString()); } if (!chan.isOpen()) { - ServerImpl.dprint ("Channel already closed"); + ServerImpl.dprint("Channel already closed"); return; } try { @@ -133,65 +133,65 @@ class HttpConnection { raw.close(); } } catch (IOException e) { - ServerImpl.dprint (e); + ServerImpl.dprint(e); } try { if (rawout != null) { rawout.close(); } } catch (IOException e) { - ServerImpl.dprint (e); + ServerImpl.dprint(e); } try { if (sslStreams != null) { sslStreams.close(); } } catch (IOException e) { - ServerImpl.dprint (e); + ServerImpl.dprint(e); } try { chan.close(); } catch (IOException e) { - ServerImpl.dprint (e); + ServerImpl.dprint(e); } } /* remaining is the number of bytes left on the lowest level inputstream * after the exchange is finished */ - void setRemaining (int r) { + void setRemaining(int r) { remaining = r; } - int getRemaining () { + int getRemaining() { return remaining; } - SelectionKey getSelectionKey () { + SelectionKey getSelectionKey() { return selectionKey; } - InputStream getInputStream () { + InputStream getInputStream() { return i; } - OutputStream getRawOutputStream () { + OutputStream getRawOutputStream() { return rawout; } - String getProtocol () { + String getProtocol() { return protocol; } - SSLEngine getSSLEngine () { + SSLEngine getSSLEngine() { return engine; } - SSLContext getSSLContext () { + SSLContext getSSLContext() { return sslContext; } - HttpContextImpl getHttpContext () { + HttpContextImpl getHttpContext() { return context; } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpContextImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpContextImpl.java index f1583954115..10cd116a3a0 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpContextImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpContextImpl.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 @@ -35,7 +35,7 @@ import com.sun.net.httpserver.*; * to a {@link HttpHandler} which is invoked to handle requests destined * for the protocol/path on the associated HttpServer. *

    - * HttpContext instances are created by {@link HttpServer#createContext(String,String,HttpHandler,Object)} + * HttpContext instances are created by {@link HttpServer#createContext(String, String, HttpHandler, Object)} *

    */ class HttpContextImpl extends HttpContext { @@ -44,7 +44,7 @@ class HttpContextImpl extends HttpContext { private final String protocol; private final ServerImpl server; private final AuthFilter authfilter; - private final Map attributes = new ConcurrentHashMap<>(); + private final Map attributes = new ConcurrentHashMap<>(); /* system filters, not visible to applications */ private final List sfilters = new CopyOnWriteArrayList<>(); /* user filters, set by applications */ @@ -55,35 +55,35 @@ class HttpContextImpl extends HttpContext { /** * constructor is package private. */ - HttpContextImpl (String protocol, String path, HttpHandler cb, ServerImpl server) { + HttpContextImpl(String protocol, String path, HttpHandler cb, ServerImpl server) { if (path == null || protocol == null || path.length() < 1 || path.charAt(0) != '/') { - throw new IllegalArgumentException ("Illegal value for path or protocol"); + throw new IllegalArgumentException("Illegal value for path or protocol"); } this.protocol = protocol.toLowerCase(Locale.ROOT); this.path = path; - if (!this.protocol.equals ("http") && !this.protocol.equals ("https")) { - throw new IllegalArgumentException ("Illegal value for protocol"); + if (!this.protocol.equals("http") && !this.protocol.equals("https")) { + throw new IllegalArgumentException("Illegal value for protocol"); } this.handler = cb; this.server = server; authfilter = new AuthFilter(null); - sfilters.add (authfilter); + sfilters.add(authfilter); } /** * returns the handler for this context * @return the HttpHandler for this context */ - public HttpHandler getHandler () { + public HttpHandler getHandler() { return handler; } - public void setHandler (HttpHandler h) { + public void setHandler(HttpHandler h) { if (h == null) { - throw new NullPointerException ("Null handler parameter"); + throw new NullPointerException("Null handler parameter"); } if (handler != null) { - throw new IllegalArgumentException ("handler already set"); + throw new IllegalArgumentException("handler already set"); } handler = h; } @@ -100,11 +100,11 @@ class HttpContextImpl extends HttpContext { * returns the server this context was created with * @return this context's server */ - public HttpServer getServer () { + public HttpServer getServer() { return server.getWrapper(); } - ServerImpl getServerImpl () { + ServerImpl getServerImpl() { return server; } @@ -124,29 +124,29 @@ class HttpContextImpl extends HttpContext { * Every attribute stored in this Map will be visible to * every HttpExchange processed by this context */ - public Map getAttributes() { + public Map getAttributes() { return attributes; } - public List getFilters () { + public List getFilters() { return ufilters; } - List getSystemFilters () { + List getSystemFilters() { return sfilters; } - public Authenticator setAuthenticator (Authenticator auth) { + public Authenticator setAuthenticator(Authenticator auth) { Authenticator old = authenticator; authenticator = auth; - authfilter.setAuthenticator (auth); + authfilter.setAuthenticator(auth); return old; } - public Authenticator getAuthenticator () { + public Authenticator getAuthenticator() { return authenticator; } - Logger getLogger () { + Logger getLogger() { return server.getLogger(); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpError.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpError.java index de9dfba8cfb..b201c822193 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpError.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpError.java @@ -1,5 +1,5 @@ /* - * 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 @@ -31,7 +31,7 @@ package sun.net.httpserver; class HttpError extends RuntimeException { private static final long serialVersionUID = 8769596371344178179L; - public HttpError (String msg) { - super (msg); + public HttpError(String msg) { + super(msg); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java index 420ef3d9e64..d4606019c56 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, 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 @@ -38,82 +38,82 @@ class HttpExchangeImpl extends HttpExchange { ExchangeImpl impl; - HttpExchangeImpl (ExchangeImpl impl) { + HttpExchangeImpl(ExchangeImpl impl) { this.impl = impl; } - public Headers getRequestHeaders () { + public Headers getRequestHeaders() { return impl.getRequestHeaders(); } - public Headers getResponseHeaders () { + public Headers getResponseHeaders() { return impl.getResponseHeaders(); } - public URI getRequestURI () { + public URI getRequestURI() { return impl.getRequestURI(); } - public String getRequestMethod (){ + public String getRequestMethod() { return impl.getRequestMethod(); } - public HttpContextImpl getHttpContext (){ + public HttpContextImpl getHttpContext() { return impl.getHttpContext(); } - public void close () { + public void close() { impl.close(); } - public InputStream getRequestBody () { + public InputStream getRequestBody() { return impl.getRequestBody(); } - public int getResponseCode () { + public int getResponseCode() { return impl.getResponseCode(); } - public OutputStream getResponseBody () { + public OutputStream getResponseBody() { return impl.getResponseBody(); } - public void sendResponseHeaders (int rCode, long contentLen) + public void sendResponseHeaders(int rCode, long contentLen) throws IOException { - impl.sendResponseHeaders (rCode, contentLen); + impl.sendResponseHeaders(rCode, contentLen); } - public InetSocketAddress getRemoteAddress (){ + public InetSocketAddress getRemoteAddress() { return impl.getRemoteAddress(); } - public InetSocketAddress getLocalAddress (){ + public InetSocketAddress getLocalAddress() { return impl.getLocalAddress(); } - public String getProtocol (){ + public String getProtocol() { return impl.getProtocol(); } - public Object getAttribute (String name) { - return impl.getAttribute (name); + public Object getAttribute(String name) { + return impl.getAttribute(name); } - public void setAttribute (String name, Object value) { - impl.setAttribute (name, value); + public void setAttribute(String name, Object value) { + impl.setAttribute(name, value); } - public void setStreams (InputStream i, OutputStream o) { - impl.setStreams (i, o); + public void setStreams(InputStream i, OutputStream o) { + impl.setStreams(i, o); } - public HttpPrincipal getPrincipal () { + public HttpPrincipal getPrincipal() { return impl.getPrincipal(); } - ExchangeImpl getExchangeImpl () { + ExchangeImpl getExchangeImpl() { return impl; } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpServerImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpServerImpl.java index dd09957c0c6..93ace4e7bd2 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpServerImpl.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 @@ -35,50 +35,50 @@ public class HttpServerImpl extends HttpServer { ServerImpl server; - HttpServerImpl () throws IOException { - this (new InetSocketAddress(80), 0); + HttpServerImpl() throws IOException { + this(new InetSocketAddress(80), 0); } - HttpServerImpl ( + HttpServerImpl( InetSocketAddress addr, int backlog ) throws IOException { - server = new ServerImpl (this, "http", addr, backlog); + server = new ServerImpl(this, "http", addr, backlog); } - public void bind (InetSocketAddress addr, int backlog) throws IOException { - server.bind (addr, backlog); + public void bind(InetSocketAddress addr, int backlog) throws IOException { + server.bind(addr, backlog); } - public void start () { + public void start() { server.start(); } - public void setExecutor (Executor executor) { + public void setExecutor(Executor executor) { server.setExecutor(executor); } - public Executor getExecutor () { + public Executor getExecutor() { return server.getExecutor(); } - public void stop (int delay) { - server.stop (delay); + public void stop(int delay) { + server.stop(delay); } - public HttpContextImpl createContext (String path, HttpHandler handler) { - return server.createContext (path, handler); + public HttpContextImpl createContext(String path, HttpHandler handler) { + return server.createContext(path, handler); } - public HttpContextImpl createContext (String path) { - return server.createContext (path); + public HttpContextImpl createContext(String path) { + return server.createContext(path); } - public void removeContext (String path) throws IllegalArgumentException { - server.removeContext (path); + public void removeContext(String path) throws IllegalArgumentException { + server.removeContext(path); } - public void removeContext (HttpContext context) throws IllegalArgumentException { - server.removeContext (context); + public void removeContext(HttpContext context) throws IllegalArgumentException { + server.removeContext(context); } public InetSocketAddress getAddress() { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java index f7f43d7feca..939b88d3928 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, 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 @@ -38,86 +38,86 @@ class HttpsExchangeImpl extends HttpsExchange { ExchangeImpl impl; - HttpsExchangeImpl (ExchangeImpl impl) throws IOException { + HttpsExchangeImpl(ExchangeImpl impl) throws IOException { this.impl = impl; } - public Headers getRequestHeaders () { + public Headers getRequestHeaders() { return impl.getRequestHeaders(); } - public Headers getResponseHeaders () { + public Headers getResponseHeaders() { return impl.getResponseHeaders(); } - public URI getRequestURI () { + public URI getRequestURI() { return impl.getRequestURI(); } - public String getRequestMethod (){ + public String getRequestMethod() { return impl.getRequestMethod(); } - public HttpContextImpl getHttpContext (){ + public HttpContextImpl getHttpContext() { return impl.getHttpContext(); } - public void close () { + public void close() { impl.close(); } - public InputStream getRequestBody () { + public InputStream getRequestBody() { return impl.getRequestBody(); } - public int getResponseCode () { + public int getResponseCode() { return impl.getResponseCode(); } - public OutputStream getResponseBody () { + public OutputStream getResponseBody() { return impl.getResponseBody(); } - public void sendResponseHeaders (int rCode, long contentLen) + public void sendResponseHeaders(int rCode, long contentLen) throws IOException { - impl.sendResponseHeaders (rCode, contentLen); + impl.sendResponseHeaders(rCode, contentLen); } - public InetSocketAddress getRemoteAddress (){ + public InetSocketAddress getRemoteAddress() { return impl.getRemoteAddress(); } - public InetSocketAddress getLocalAddress (){ + public InetSocketAddress getLocalAddress() { return impl.getLocalAddress(); } - public String getProtocol (){ + public String getProtocol() { return impl.getProtocol(); } - public SSLSession getSSLSession () { - return impl.getSSLSession (); + public SSLSession getSSLSession() { + return impl.getSSLSession(); } - public Object getAttribute (String name) { - return impl.getAttribute (name); + public Object getAttribute(String name) { + return impl.getAttribute(name); } - public void setAttribute (String name, Object value) { - impl.setAttribute (name, value); + public void setAttribute(String name, Object value) { + impl.setAttribute(name, value); } - public void setStreams (InputStream i, OutputStream o) { - impl.setStreams (i, o); + public void setStreams(InputStream i, OutputStream o) { + impl.setStreams(i, o); } - public HttpPrincipal getPrincipal () { + public HttpPrincipal getPrincipal() { return impl.getPrincipal(); } - ExchangeImpl getExchangeImpl () { + ExchangeImpl getExchangeImpl() { return impl; } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsServerImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsServerImpl.java index 97312ec29e6..8ef179c1194 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsServerImpl.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 @@ -35,58 +35,58 @@ public class HttpsServerImpl extends HttpsServer { ServerImpl server; - HttpsServerImpl () throws IOException { - this (new InetSocketAddress(443), 0); + HttpsServerImpl() throws IOException { + this(new InetSocketAddress(443), 0); } - HttpsServerImpl ( + HttpsServerImpl( InetSocketAddress addr, int backlog ) throws IOException { - server = new ServerImpl (this, "https", addr, backlog); + server = new ServerImpl(this, "https", addr, backlog); } - public void setHttpsConfigurator (HttpsConfigurator config) { - server.setHttpsConfigurator (config); + public void setHttpsConfigurator(HttpsConfigurator config) { + server.setHttpsConfigurator(config); } - public HttpsConfigurator getHttpsConfigurator () { + public HttpsConfigurator getHttpsConfigurator() { return server.getHttpsConfigurator(); } - public void bind (InetSocketAddress addr, int backlog) throws IOException { - server.bind (addr, backlog); + public void bind(InetSocketAddress addr, int backlog) throws IOException { + server.bind(addr, backlog); } - public void start () { + public void start() { server.start(); } - public void setExecutor (Executor executor) { + public void setExecutor(Executor executor) { server.setExecutor(executor); } - public Executor getExecutor () { + public Executor getExecutor() { return server.getExecutor(); } - public void stop (int delay) { - server.stop (delay); + public void stop(int delay) { + server.stop(delay); } - public HttpContextImpl createContext (String path, HttpHandler handler) { - return server.createContext (path, handler); + public HttpContextImpl createContext(String path, HttpHandler handler) { + return server.createContext(path, handler); } - public HttpContextImpl createContext (String path) { - return server.createContext (path); + public HttpContextImpl createContext(String path) { + return server.createContext(path); } - public void removeContext (String path) throws IllegalArgumentException { - server.removeContext (path); + public void removeContext(String path) throws IllegalArgumentException { + server.removeContext(path); } - public void removeContext (HttpContext context) throws IllegalArgumentException { - server.removeContext (context); + public void removeContext(HttpContext context) throws IllegalArgumentException { + server.removeContext(context); } public InetSocketAddress getAddress() { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/LeftOverInputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/LeftOverInputStream.java index 772fa621076..ea904835770 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/LeftOverInputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/LeftOverInputStream.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 @@ -45,47 +45,47 @@ abstract class LeftOverInputStream extends FilterInputStream { final ServerImpl server; protected boolean closed = false; protected boolean eof = false; - byte[] one = new byte [1]; + byte[] one = new byte[1]; private static final int MAX_SKIP_BUFFER_SIZE = 2048; - public LeftOverInputStream (ExchangeImpl t, InputStream src) { - super (src); + public LeftOverInputStream(ExchangeImpl t, InputStream src) { + super(src); this.t = t; this.server = t.getServerImpl(); } /** * if bytes are left over buffered on *the UNDERLYING* stream */ - public boolean isDataBuffered () throws IOException { + public boolean isDataBuffered() throws IOException { assert eof; return super.available() > 0; } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } closed = true; if (!eof) { - eof = drain (ServerConfig.getDrainAmount()); + eof = drain(ServerConfig.getDrainAmount()); } } - public boolean isClosed () { + public boolean isClosed() { return closed; } - public boolean isEOF () { + public boolean isEOF() { return eof; } - protected abstract int readImpl (byte[]b, int off, int len) throws IOException; + protected abstract int readImpl(byte[] b, int off, int len) throws IOException; - public synchronized int read () throws IOException { + public synchronized int read() throws IOException { if (closed) { - throw new IOException ("Stream is closed"); + throw new IOException("Stream is closed"); } - int c = readImpl (one, 0, 1); + int c = readImpl(one, 0, 1); if (c == -1 || c == 0) { return c; } else { @@ -93,11 +93,11 @@ abstract class LeftOverInputStream extends FilterInputStream { } } - public synchronized int read (byte[]b, int off, int len) throws IOException { + public synchronized int read(byte[] b, int off, int len) throws IOException { if (closed) { - throw new IOException ("Stream is closed"); + throw new IOException("Stream is closed"); } - return readImpl (b, off, len); + return readImpl(b, off, len); } @Override @@ -132,7 +132,7 @@ abstract class LeftOverInputStream extends FilterInputStream { * is at eof (ie. all bytes were read) or false if not * (still bytes to be read) */ - public boolean drain (long l) throws IOException { + public boolean drain(long l) throws IOException { while (l > 0) { long skip = skip(l); if (skip <= 0) break; // might return 0 if isFinishing or EOF diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java index 6c0c2c271ed..75eeb29f015 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ package sun.net.httpserver; +import java.net.ProtocolException; import java.nio.*; import java.io.*; import java.nio.channels.*; @@ -39,15 +40,18 @@ class Request { static final int BUF_LEN = 2048; static final byte CR = 13; static final byte LF = 10; + static final byte FIRST_CHAR = 32; private String startLine; private SocketChannel chan; private InputStream is; private OutputStream os; private final int maxReqHeaderSize; + private final boolean firstClearRequest; - Request (InputStream rawInputStream, OutputStream rawout) throws IOException { + Request(InputStream rawInputStream, OutputStream rawout, boolean firstClearRequest) throws IOException { this.maxReqHeaderSize = ServerConfig.getMaxReqHeaderSize(); + this.firstClearRequest = firstClearRequest; is = rawInputStream; os = rawout; do { @@ -57,15 +61,15 @@ class Request { } - char[] buf = new char [BUF_LEN]; + char[] buf = new char[BUF_LEN]; int pos; StringBuffer lineBuf; - public InputStream inputStream () { + public InputStream inputStream() { return is; } - public OutputStream outputStream () { + public OutputStream outputStream() { return os; } @@ -74,10 +78,29 @@ class Request { * Not used for reading headers. */ - public String readLine () throws IOException { + public String readLine() throws IOException { boolean gotCR = false, gotLF = false; pos = 0; lineBuf = new StringBuffer(); long lsize = 32; + + // For the first request that comes on a clear connection + // we will check that the first non CR/LF char on the + // request line is eligible. This should be the first char + // of a method name, so it should be at least greater or equal + // to 32 (FIRST_CHAR) which is the space character. + // The main goal here is to fail fast if we receive 0x16 (22) which + // happens to be the first byte of a TLS handshake record. + // This is typically what would be received if a TLS client opened + // a TLS connection on a non-TLS server. + // If we receive 0x16 we should close the connection immediately as + // it indicates we're receiving a ClientHello on a clear + // connection, and we will never receive the expected CRLF that + // terminates the first request line. + // Though we could check only for 0x16, any characters < 32 + // (excluding CRLF) is not expected at this position in a + // request line, so we can still fail here early if any of + // those are detected. + int offset = 0; while (!gotLF) { int c = is.read(); if (c == -1) { @@ -88,15 +111,27 @@ class Request { gotLF = true; } else { gotCR = false; - consume (CR); - consume (c); + consume(CR); + if (firstClearRequest && offset == 0) { + if (c < FIRST_CHAR) { + throw new ProtocolException("Unexpected start of request line"); + } + offset++; + } + consume(c); lsize = lsize + 2; } } else { if (c == CR) { gotCR = true; } else { - consume (c); + if (firstClearRequest && offset == 0) { + if (c < FIRST_CHAR) { + throw new ProtocolException("Unexpected start of request line"); + } + offset++; + } + consume(c); lsize = lsize + 1; } } @@ -106,13 +141,13 @@ class Request { ServerConfig.getMaxReqHeaderSize() + "."); } } - lineBuf.append (buf, 0, pos); - return new String (lineBuf); + lineBuf.append(buf, 0, pos); + return new String(lineBuf); } - private void consume (int c) throws IOException { + private void consume(int c) throws IOException { if (pos == BUF_LEN) { - lineBuf.append (buf); + lineBuf.append(buf); pos = 0; } buf[pos++] = (char)c; @@ -121,13 +156,13 @@ class Request { /** * returns the request line (first line of a request) */ - public String requestLine () { + public String requestLine() { return startLine; } Headers hdrs = null; @SuppressWarnings("fallthrough") - Headers headers () throws IOException { + Headers headers() throws IOException { if (hdrs != null) { return hdrs; } @@ -239,7 +274,7 @@ class Request { if (k == null) { // Headers disallows null keys, use empty string k = ""; // instead to represent invalid key } - hdrs.add (k,v); + hdrs.add(k, v); len = 0; } return hdrs; @@ -262,21 +297,21 @@ class Request { ServerImpl server; static final int BUFSIZE = 8 * 1024; - public ReadStream (ServerImpl server, SocketChannel chan) throws IOException { + public ReadStream(ServerImpl server, SocketChannel chan) throws IOException { this.channel = chan; this.server = server; - chanbuf = ByteBuffer.allocate (BUFSIZE); + chanbuf = ByteBuffer.allocate(BUFSIZE); chanbuf.clear(); one = new byte[1]; closed = marked = reset = false; } - public synchronized int read (byte[] b) throws IOException { - return read (b, 0, b.length); + public synchronized int read(byte[] b) throws IOException { + return read(b, 0, b.length); } - public synchronized int read () throws IOException { - int result = read (one, 0, 1); + public synchronized int read() throws IOException { + int result = read(one, 0, 1); if (result == 1) { return one[0] & 0xFF; } else { @@ -284,12 +319,12 @@ class Request { } } - public synchronized int read (byte[] b, int off, int srclen) throws IOException { + public synchronized int read(byte[] b, int off, int srclen) throws IOException { int canreturn, willreturn; if (closed) - throw new IOException ("Stream closed"); + throw new IOException("Stream closed"); if (eof) { return -1; @@ -300,30 +335,30 @@ class Request { Objects.checkFromIndexSize(off, srclen, b.length); if (reset) { /* satisfy from markBuf */ - canreturn = markBuf.remaining (); + canreturn = markBuf.remaining(); willreturn = canreturn>srclen ? srclen : canreturn; markBuf.get(b, off, willreturn); if (canreturn == willreturn) { reset = false; } } else { /* satisfy from channel */ - chanbuf.clear (); + chanbuf.clear(); if (srclen < BUFSIZE) { - chanbuf.limit (srclen); + chanbuf.limit(srclen); } do { - willreturn = channel.read (chanbuf); + willreturn = channel.read(chanbuf); } while (willreturn == 0); if (willreturn == -1) { eof = true; return -1; } - chanbuf.flip (); + chanbuf.flip(); chanbuf.get(b, off, willreturn); if (marked) { /* copy into markBuf */ try { - markBuf.put (b, off, willreturn); + markBuf.put(b, off, willreturn); } catch (BufferOverflowException e) { marked = false; } @@ -332,14 +367,14 @@ class Request { return willreturn; } - public boolean markSupported () { + public boolean markSupported() { return true; } /* Does not query the OS socket */ - public synchronized int available () throws IOException { + public synchronized int available() throws IOException { if (closed) - throw new IOException ("Stream is closed"); + throw new IOException("Stream is closed"); if (eof) return -1; @@ -350,31 +385,31 @@ class Request { return chanbuf.remaining(); } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } - channel.close (); + channel.close(); closed = true; } - public synchronized void mark (int readlimit) { + public synchronized void mark(int readlimit) { if (closed) return; this.readlimit = readlimit; - markBuf = ByteBuffer.allocate (readlimit); + markBuf = ByteBuffer.allocate(readlimit); marked = true; reset = false; } - public synchronized void reset () throws IOException { + public synchronized void reset() throws IOException { if (closed ) return; if (!marked) - throw new IOException ("Stream not marked"); + throw new IOException("Stream not marked"); marked = false; reset = true; - markBuf.flip (); + markBuf.flip(); } } @@ -386,50 +421,50 @@ class Request { byte[] one; ServerImpl server; - public WriteStream (ServerImpl server, SocketChannel channel) throws IOException { + public WriteStream(ServerImpl server, SocketChannel channel) throws IOException { this.channel = channel; this.server = server; assert channel.isBlocking(); closed = false; one = new byte [1]; - buf = ByteBuffer.allocate (4096); + buf = ByteBuffer.allocate(4096); } - public synchronized void write (int b) throws IOException { + public synchronized void write(int b) throws IOException { one[0] = (byte)b; write (one, 0, 1); } - public synchronized void write (byte[] b) throws IOException { + public synchronized void write(byte[] b) throws IOException { write (b, 0, b.length); } - public synchronized void write (byte[] b, int off, int len) throws IOException { + public synchronized void write(byte[] b, int off, int len) throws IOException { int l = len; if (closed) - throw new IOException ("stream is closed"); + throw new IOException("stream is closed"); int cap = buf.capacity(); if (cap < len) { int diff = len - cap; - buf = ByteBuffer.allocate (2*(cap+diff)); + buf = ByteBuffer.allocate(2*(cap+diff)); } buf.clear(); - buf.put (b, off, len); - buf.flip (); + buf.put(b, off, len); + buf.flip(); int n; - while ((n = channel.write (buf)) < l) { + while ((n = channel.write(buf)) < l) { l -= n; if (l == 0) return; } } - public void close () throws IOException { + public void close() throws IOException { if (closed) return; - //server.logStackTrace ("Request.OS.close: isOpen="+channel.isOpen()); - channel.close (); + //server.logStackTrace("Request.OS.close: isOpen="+channel.isOpen()); + channel.close(); closed = true; } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java index 5cc16befa96..5f5eef0c684 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.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 @@ -53,35 +53,35 @@ class SSLStreams { /* held by thread doing the hand-shake on this connection */ Lock handshaking = new ReentrantLock(); - SSLStreams (ServerImpl server, SSLContext sslctx, SocketChannel chan) throws IOException { + SSLStreams(ServerImpl server, SSLContext sslctx, SocketChannel chan) throws IOException { this.server = server; this.sslctx= sslctx; this.chan= chan; InetSocketAddress addr = (InetSocketAddress)chan.socket().getRemoteSocketAddress(); - engine = sslctx.createSSLEngine (addr.getHostName(), addr.getPort()); - engine.setUseClientMode (false); + engine = sslctx.createSSLEngine(addr.getHostName(), addr.getPort()); + engine.setUseClientMode(false); HttpsConfigurator cfg = server.getHttpsConfigurator(); - configureEngine (cfg, addr); - wrapper = new EngineWrapper (chan, engine); + configureEngine(cfg, addr); + wrapper = new EngineWrapper(chan, engine); } @SuppressWarnings("deprecation") - private void configureEngine(HttpsConfigurator cfg, InetSocketAddress addr){ + private void configureEngine(HttpsConfigurator cfg, InetSocketAddress addr) { if (cfg != null) { - Parameters params = new Parameters (cfg, addr); + Parameters params = new Parameters(cfg, addr); //BEGIN_TIGER_EXCLUDE - cfg.configure (params); + cfg.configure(params); SSLParameters sslParams = params.getSSLParameters(); if (sslParams != null) { - engine.setSSLParameters (sslParams); + engine.setSSLParameters(sslParams); } else //END_TIGER_EXCLUDE { /* tiger compatibility */ if (params.getCipherSuites() != null) { try { - engine.setEnabledCipherSuites ( + engine.setEnabledCipherSuites( params.getCipherSuites() ); } catch (IllegalArgumentException e) { /* LOG */} @@ -93,7 +93,7 @@ class SSLStreams { } if (params.getProtocols() != null) { try { - engine.setEnabledProtocols ( + engine.setEnabledProtocols( params.getProtocols() ); } catch (IllegalArgumentException e) { /* LOG */} @@ -106,11 +106,11 @@ class SSLStreams { InetSocketAddress addr; HttpsConfigurator cfg; - Parameters (HttpsConfigurator cfg, InetSocketAddress addr) { + Parameters(HttpsConfigurator cfg, InetSocketAddress addr) { this.addr = addr; this.cfg = cfg; } - public InetSocketAddress getClientAddress () { + public InetSocketAddress getClientAddress() { return addr; } public HttpsConfigurator getHttpsConfigurator() { @@ -118,10 +118,10 @@ class SSLStreams { } //BEGIN_TIGER_EXCLUDE SSLParameters params; - public void setSSLParameters (SSLParameters p) { + public void setSSLParameters(SSLParameters p) { params = p; } - SSLParameters getSSLParameters () { + SSLParameters getSSLParameters() { return params; } //END_TIGER_EXCLUDE @@ -130,14 +130,14 @@ class SSLStreams { /** * cleanup resources allocated inside this object */ - void close () throws IOException { + void close() throws IOException { wrapper.close(); } /** * return the SSL InputStream */ - InputStream getInputStream () throws IOException { + InputStream getInputStream() throws IOException { if (is == null) { is = new InputStream(); } @@ -147,14 +147,14 @@ class SSLStreams { /** * return the SSL OutputStream */ - OutputStream getOutputStream () throws IOException { + OutputStream getOutputStream() throws IOException { if (os == null) { os = new OutputStream(); } return os; } - SSLEngine getSSLEngine () { + SSLEngine getSSLEngine() { return engine; } @@ -183,11 +183,11 @@ class SSLStreams { PACKET, APPLICATION }; - private ByteBuffer allocate (BufType type) { - return allocate (type, -1); + private ByteBuffer allocate(BufType type) { + return allocate(type, -1); } - private ByteBuffer allocate (BufType type, int len) { + private ByteBuffer allocate(BufType type, int len) { assert engine != null; synchronized (this) { int size; @@ -210,7 +210,7 @@ class SSLStreams { } size = app_buf_size; } - return ByteBuffer.allocate (size); + return ByteBuffer.allocate(size); } } @@ -222,10 +222,10 @@ class SSLStreams { * flip is set to true if the old buffer needs to be flipped * before it is copied. */ - private ByteBuffer realloc (ByteBuffer b, boolean flip, BufType type) { + private ByteBuffer realloc(ByteBuffer b, boolean flip, BufType type) { synchronized (this) { int nsize = 2 * b.capacity(); - ByteBuffer n = allocate (type, nsize); + ByteBuffer n = allocate(type, nsize); if (flip) { b.flip(); } @@ -252,7 +252,7 @@ class SSLStreams { boolean closed = false; int u_remaining; // the number of bytes left in unwrap_src after an unwrap() - EngineWrapper (SocketChannel chan, SSLEngine engine) throws IOException { + EngineWrapper(SocketChannel chan, SSLEngine engine) throws IOException { this.chan = chan; this.engine = engine; wrapLock = new Object(); @@ -261,7 +261,7 @@ class SSLStreams { wrap_dst = allocate(BufType.PACKET); } - void close () throws IOException { + void close() throws IOException { } /* try to wrap and send the data in src. Handles OVERFLOW. @@ -275,17 +275,17 @@ class SSLStreams { WrapperResult wrapAndSendX(ByteBuffer src, boolean ignoreClose) throws IOException { if (closed && !ignoreClose) { - throw new IOException ("Engine is closed"); + throw new IOException("Engine is closed"); } Status status; WrapperResult r = new WrapperResult(); synchronized (wrapLock) { wrap_dst.clear(); do { - r.result = engine.wrap (src, wrap_dst); + r.result = engine.wrap(src, wrap_dst); status = r.result.getStatus(); if (status == Status.BUFFER_OVERFLOW) { - wrap_dst = realloc (wrap_dst, true, BufType.PACKET); + wrap_dst = realloc(wrap_dst, true, BufType.PACKET); } } while (status == Status.BUFFER_OVERFLOW); if (status == Status.CLOSED && !ignoreClose) { @@ -296,7 +296,7 @@ class SSLStreams { int l = wrap_dst.remaining(); assert l == r.result.bytesProduced(); while (l>0) { - l -= chan.write (wrap_dst); + l -= chan.write(wrap_dst); } } } @@ -313,7 +313,7 @@ class SSLStreams { WrapperResult r = new WrapperResult(); r.buf = dst; if (closed) { - throw new IOException ("Engine is closed"); + throw new IOException("Engine is closed"); } boolean needData; if (u_remaining > 0) { @@ -329,19 +329,19 @@ class SSLStreams { do { if (needData) { do { - x = chan.read (unwrap_src); + x = chan.read(unwrap_src); } while (x == 0); if (x == -1) { - throw new IOException ("connection closed for reading"); + throw new IOException("connection closed for reading"); } unwrap_src.flip(); } - r.result = engine.unwrap (unwrap_src, r.buf); + r.result = engine.unwrap(unwrap_src, r.buf); status = r.result.getStatus(); if (status == Status.BUFFER_UNDERFLOW) { if (unwrap_src.limit() == unwrap_src.capacity()) { /* buffer not big enough */ - unwrap_src = realloc ( + unwrap_src = realloc( unwrap_src, false, BufType.PACKET ); } else { @@ -349,12 +349,12 @@ class SSLStreams { * data off the channel. Reset pointers * for reading off SocketChannel */ - unwrap_src.position (unwrap_src.limit()); - unwrap_src.limit (unwrap_src.capacity()); + unwrap_src.position(unwrap_src.limit()); + unwrap_src.limit(unwrap_src.capacity()); } needData = true; } else if (status == Status.BUFFER_OVERFLOW) { - r.buf = realloc (r.buf, true, BufType.APPLICATION); + r.buf = realloc(r.buf, true, BufType.APPLICATION); needData = false; } else if (status == Status.CLOSED) { closed = true; @@ -374,13 +374,13 @@ class SSLStreams { * all of the given user data has been sent and any handshake has been * completed. Caller should check if engine has been closed. */ - public WrapperResult sendData (ByteBuffer src) throws IOException { + public WrapperResult sendData(ByteBuffer src) throws IOException { WrapperResult r=null; while (src.remaining() > 0) { r = wrapper.wrapAndSend(src); Status status = r.result.getStatus(); if (status == Status.CLOSED) { - doClosure (); + doClosure(); return r; } HandshakeStatus hs_status = r.result.getHandshakeStatus(); @@ -399,16 +399,16 @@ class SSLStreams { * and returned. This call handles handshaking automatically. * Caller should check if engine has been closed. */ - public WrapperResult recvData (ByteBuffer dst) throws IOException { + public WrapperResult recvData(ByteBuffer dst) throws IOException { /* we wait until some user data arrives */ WrapperResult r = null; assert dst.position() == 0; while (dst.position() == 0) { - r = wrapper.recvAndUnwrap (dst); + r = wrapper.recvAndUnwrap(dst); dst = (r.buf != dst) ? r.buf: dst; Status status = r.result.getStatus(); if (status == Status.CLOSED) { - doClosure (); + doClosure(); return r; } @@ -416,7 +416,7 @@ class SSLStreams { if (hs_status != HandshakeStatus.FINISHED && hs_status != HandshakeStatus.NOT_HANDSHAKING) { - doHandshake (hs_status); + doHandshake(hs_status); } } dst.flip(); @@ -426,7 +426,7 @@ class SSLStreams { /* we've received a close notify. Need to call wrap to send * the response */ - void doClosure () throws IOException { + void doClosure() throws IOException { try { handshaking.lock(); ByteBuffer tmp = allocate(BufType.APPLICATION); @@ -435,8 +435,8 @@ class SSLStreams { HandshakeStatus hs; do { tmp.clear(); - tmp.flip (); - r = wrapper.wrapAndSendX (tmp, true); + tmp.flip(); + r = wrapper.wrapAndSendX(tmp, true); hs = r.result.getHandshakeStatus(); st = r.result.getStatus(); } while (st != Status.CLOSED && @@ -452,7 +452,7 @@ class SSLStreams { * is called with no data to send then there must be no problem */ @SuppressWarnings("fallthrough") - void doHandshake (HandshakeStatus hs_status) throws IOException { + void doHandshake(HandshakeStatus hs_status) throws IOException { try { handshaking.lock(); ByteBuffer tmp = allocate(BufType.APPLICATION); @@ -478,7 +478,7 @@ class SSLStreams { case NEED_UNWRAP: tmp.clear(); - r = wrapper.recvAndUnwrap (tmp); + r = wrapper.recvAndUnwrap(tmp); if (r.buf != tmp) { tmp = r.buf; } @@ -507,27 +507,27 @@ class SSLStreams { boolean needData = true; - InputStream () { - bbuf = allocate (BufType.APPLICATION); + InputStream() { + bbuf = allocate(BufType.APPLICATION); } - public int read (byte[] buf, int off, int len) throws IOException { + public int read(byte[] buf, int off, int len) throws IOException { if (closed) { - throw new IOException ("SSL stream is closed"); + throw new IOException("SSL stream is closed"); } if (eof) { return -1; } - int available=0; + int available = 0; if (!needData) { available = bbuf.remaining(); - needData = (available==0); + needData = (available == 0); } if (needData) { bbuf.clear(); - WrapperResult r = recvData (bbuf); - bbuf = r.buf== bbuf? bbuf: r.buf; - if ((available=bbuf.remaining()) == 0) { + WrapperResult r = recvData(bbuf); + bbuf = r.buf == bbuf ? bbuf: r.buf; + if ((available = bbuf.remaining()) == 0) { eof = true; return -1; } else { @@ -538,26 +538,26 @@ class SSLStreams { if (len > available) { len = available; } - bbuf.get (buf, off, len); + bbuf.get(buf, off, len); return len; } - public int available () throws IOException { + public int available() throws IOException { return bbuf.remaining(); } - public boolean markSupported () { + public boolean markSupported() { return false; /* not possible with SSLEngine */ } - public void reset () throws IOException { - throw new IOException ("mark/reset not supported"); + public void reset() throws IOException { + throw new IOException("mark/reset not supported"); } - public long skip (long s) throws IOException { + public long skip(long s) throws IOException { int n = (int)s; if (closed) { - throw new IOException ("SSL stream is closed"); + throw new IOException("SSL stream is closed"); } if (eof) { return 0; @@ -565,13 +565,13 @@ class SSLStreams { int ret = n; while (n > 0) { if (bbuf.remaining() >= n) { - bbuf.position (bbuf.position()+n); + bbuf.position(bbuf.position()+n); return ret; } else { n -= bbuf.remaining(); bbuf.clear(); - WrapperResult r = recvData (bbuf); - bbuf = r.buf==bbuf? bbuf: r.buf; + WrapperResult r = recvData(bbuf); + bbuf = r.buf == bbuf ? bbuf: r.buf; } } return ret; /* not reached */ @@ -582,22 +582,22 @@ class SSLStreams { * before this is called. Otherwise an exception will be thrown. * [Note. May need to revisit this. not quite the normal close() semantics */ - public void close () throws IOException { + public void close() throws IOException { eof = true; - engine.closeInbound (); + engine.closeInbound(); } - public int read (byte[] buf) throws IOException { - return read (buf, 0, buf.length); + public int read(byte[] buf) throws IOException { + return read(buf, 0, buf.length); } byte single[] = new byte [1]; - public int read () throws IOException { + public int read() throws IOException { if (eof) { return -1; } - int n = read (single, 0, 1); + int n = read(single, 0, 1); if (n <= 0) { return -1; } else { @@ -622,28 +622,28 @@ class SSLStreams { public void write(int b) throws IOException { single[0] = (byte)b; - write (single, 0, 1); + write(single, 0, 1); } public void write(byte b[]) throws IOException { - write (b, 0, b.length); + write(b, 0, b.length); } public void write(byte b[], int off, int len) throws IOException { if (closed) { - throw new IOException ("output stream is closed"); + throw new IOException("output stream is closed"); } while (len > 0) { int l = len > buf.capacity() ? buf.capacity() : len; buf.clear(); - buf.put (b, off, l); + buf.put(b, off, l); len -= l; off += l; buf.flip(); - WrapperResult r = sendData (buf); + WrapperResult r = sendData(buf); if (r.result.getStatus() == Status.CLOSED) { closed = true; if (len > 0) { - throw new IOException ("output stream is closed"); + throw new IOException("output stream is closed"); } } } @@ -654,13 +654,13 @@ class SSLStreams { } public void close() throws IOException { - WrapperResult r=null; + WrapperResult r = null; engine.closeOutbound(); closed = true; HandshakeStatus stat = HandshakeStatus.NEED_WRAP; buf.clear(); while (stat == HandshakeStatus.NEED_WRAP) { - r = wrapper.wrapAndSend (buf); + r = wrapper.wrapAndSend(buf); stat = r.result.getHandshakeStatus(); } assert r.result.getStatus() == Status.CLOSED 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 217ae86f5d3..e8c8d336e03 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java @@ -45,6 +45,7 @@ import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.net.BindException; import java.net.InetSocketAddress; +import java.net.ProtocolException; import java.net.ServerSocket; import java.net.URI; import java.net.URISyntaxException; @@ -128,61 +129,61 @@ class ServerImpl { private final Logger logger; private Thread dispatcherThread; - ServerImpl ( + ServerImpl( HttpServer wrapper, String protocol, InetSocketAddress addr, int backlog ) throws IOException { this.protocol = protocol; this.wrapper = wrapper; - this.logger = System.getLogger ("com.sun.net.httpserver"); - ServerConfig.checkLegacyProperties (logger); - https = protocol.equalsIgnoreCase ("https"); + this.logger = System.getLogger("com.sun.net.httpserver"); + ServerConfig.checkLegacyProperties(logger); + https = protocol.equalsIgnoreCase("https"); this.address = addr; contexts = new ContextList(); schan = ServerSocketChannel.open(); if (addr != null) { ServerSocket socket = schan.socket(); - socket.bind (addr, backlog); + socket.bind(addr, backlog); bound = true; } - selector = Selector.open (); - schan.configureBlocking (false); - listenerKey = schan.register (selector, SelectionKey.OP_ACCEPT); + selector = Selector.open(); + schan.configureBlocking(false); + listenerKey = schan.register(selector, SelectionKey.OP_ACCEPT); dispatcher = new Dispatcher(); - idleConnections = Collections.synchronizedSet (new HashSet()); - allConnections = Collections.synchronizedSet (new HashSet()); - reqConnections = Collections.synchronizedSet (new HashSet()); - rspConnections = Collections.synchronizedSet (new HashSet()); + idleConnections = Collections.synchronizedSet(new HashSet()); + allConnections = Collections.synchronizedSet(new HashSet()); + reqConnections = Collections.synchronizedSet(new HashSet()); + rspConnections = Collections.synchronizedSet(new HashSet()); newlyAcceptedConnections = Collections.synchronizedSet(new HashSet<>()); - timer = new Timer ("idle-timeout-task", true); - timer.schedule (new IdleTimeoutTask(), IDLE_TIMER_TASK_SCHEDULE, IDLE_TIMER_TASK_SCHEDULE); + timer = new Timer("idle-timeout-task", true); + timer.schedule(new IdleTimeoutTask(), IDLE_TIMER_TASK_SCHEDULE, IDLE_TIMER_TASK_SCHEDULE); if (reqRspTimeoutEnabled) { - timer1 = new Timer ("req-rsp-timeout-task", true); - timer1.schedule (new ReqRspTimeoutTask(), REQ_RSP_TIMER_SCHEDULE, REQ_RSP_TIMER_SCHEDULE); + timer1 = new Timer("req-rsp-timeout-task", true); + timer1.schedule(new ReqRspTimeoutTask(), REQ_RSP_TIMER_SCHEDULE, REQ_RSP_TIMER_SCHEDULE); logger.log(Level.DEBUG, "HttpServer request/response timeout task schedule ms: ", REQ_RSP_TIMER_SCHEDULE); - logger.log (Level.DEBUG, "MAX_REQ_TIME: "+MAX_REQ_TIME); - logger.log (Level.DEBUG, "MAX_RSP_TIME: "+MAX_RSP_TIME); + logger.log(Level.DEBUG, "MAX_REQ_TIME: "+MAX_REQ_TIME); + logger.log(Level.DEBUG, "MAX_RSP_TIME: "+MAX_RSP_TIME); } events = new ArrayList<>(); - logger.log (Level.DEBUG, "HttpServer created "+protocol+" "+ addr); + logger.log(Level.DEBUG, "HttpServer created "+protocol+" "+ addr); } - public void bind (InetSocketAddress addr, int backlog) throws IOException { + public void bind(InetSocketAddress addr, int backlog) throws IOException { if (bound) { - throw new BindException ("HttpServer already bound"); + throw new BindException("HttpServer already bound"); } if (addr == null) { - throw new NullPointerException ("null address"); + throw new NullPointerException("null address"); } ServerSocket socket = schan.socket(); - socket.bind (addr, backlog); + socket.bind(addr, backlog); bound = true; } - public void start () { + public void start() { if (!bound || started || finished()) { - throw new IllegalStateException ("server in wrong state"); + throw new IllegalStateException("server in wrong state"); } if (executor == null) { executor = new DefaultExecutor(); @@ -192,39 +193,39 @@ class ServerImpl { dispatcherThread.start(); } - public void setExecutor (Executor executor) { + public void setExecutor(Executor executor) { if (started) { - throw new IllegalStateException ("server already started"); + throw new IllegalStateException("server already started"); } this.executor = executor; } private static class DefaultExecutor implements Executor { - public void execute (Runnable task) { + public void execute(Runnable task) { task.run(); } } - public Executor getExecutor () { + public Executor getExecutor() { return executor; } - public void setHttpsConfigurator (HttpsConfigurator config) { + public void setHttpsConfigurator(HttpsConfigurator config) { if (config == null) { - throw new NullPointerException ("null HttpsConfigurator"); + throw new NullPointerException("null HttpsConfigurator"); } if (started) { - throw new IllegalStateException ("server already started"); + throw new IllegalStateException("server already started"); } this.httpsConfig = config; sslContext = config.getSSLContext(); } - public HttpsConfigurator getHttpsConfigurator () { + public HttpsConfigurator getHttpsConfigurator() { return httpsConfig; } - private final boolean finished(){ + private final boolean finished() { // if the latch is 0, the server is finished return finishedLatch.getCount() == 0; } @@ -242,9 +243,9 @@ class ServerImpl { * * @param delay maximum delay to wait for exchanges completion, in seconds */ - public void stop (int delay) { + public void stop(int delay) { if (delay < 0) { - throw new IllegalArgumentException ("negative delay parameter"); + throw new IllegalArgumentException("negative delay parameter"); } logger.log(Level.TRACE, "stopping"); @@ -298,49 +299,49 @@ class ServerImpl { Dispatcher dispatcher; - public synchronized HttpContextImpl createContext (String path, HttpHandler handler) { + public synchronized HttpContextImpl createContext(String path, HttpHandler handler) { if (handler == null || path == null) { - throw new NullPointerException ("null handler, or path parameter"); + throw new NullPointerException("null handler, or path parameter"); } - HttpContextImpl context = new HttpContextImpl (protocol, path, handler, this); - contexts.add (context); - logger.log (Level.DEBUG, "context created: " + path); + HttpContextImpl context = new HttpContextImpl(protocol, path, handler, this); + contexts.add(context); + logger.log(Level.DEBUG, "context created: " + path); return context; } - public synchronized HttpContextImpl createContext (String path) { + public synchronized HttpContextImpl createContext(String path) { if (path == null) { - throw new NullPointerException ("null path parameter"); + throw new NullPointerException("null path parameter"); } - HttpContextImpl context = new HttpContextImpl (protocol, path, null, this); - contexts.add (context); - logger.log (Level.DEBUG, "context created: " + path); + HttpContextImpl context = new HttpContextImpl(protocol, path, null, this); + contexts.add(context); + logger.log(Level.DEBUG, "context created: " + path); return context; } - public synchronized void removeContext (String path) throws IllegalArgumentException { + public synchronized void removeContext(String path) throws IllegalArgumentException { if (path == null) { - throw new NullPointerException ("null path parameter"); + throw new NullPointerException("null path parameter"); } - contexts.remove (protocol, path); - logger.log (Level.DEBUG, "context removed: " + path); + contexts.remove(protocol, path); + logger.log(Level.DEBUG, "context removed: " + path); } - public synchronized void removeContext (HttpContext context) throws IllegalArgumentException { + public synchronized void removeContext(HttpContext context) throws IllegalArgumentException { if (!(context instanceof HttpContextImpl)) { - throw new IllegalArgumentException ("wrong HttpContext type"); + throw new IllegalArgumentException("wrong HttpContext type"); } - contexts.remove ((HttpContextImpl)context); - logger.log (Level.DEBUG, "context removed: " + context.getPath()); + contexts.remove((HttpContextImpl)context); + logger.log(Level.DEBUG, "context removed: " + context.getPath()); } public InetSocketAddress getAddress() { return (InetSocketAddress) schan.socket().getLocalSocketAddress(); } - void addEvent (Event r) { + void addEvent(Event r) { synchronized (lolock) { - events.add (r); + events.add(r); selector.wakeup(); } } @@ -413,7 +414,7 @@ class ServerImpl { */ class Dispatcher implements Runnable { - private void handleEvent (Event r) { + private void handleEvent(Event r) { // Stopping marking the state as finished if stop is requested, // termination is in progress and exchange count is 0 @@ -450,22 +451,22 @@ class ServerImpl { requestCompleted(c); } } - responseCompleted (c); + responseCompleted(c); if (t.close) { c.close(); - allConnections.remove (c); + allConnections.remove(c); } else { if (is.isDataBuffered()) { /* don't re-enable the interestops, just handle it */ - requestStarted (c); - handle (c.getChannel(), c); + requestStarted(c); + handle(c.getChannel(), c); } else { - connsToRegister.add (c); + connsToRegister.add(c); } } } } catch (IOException e) { - logger.log ( + logger.log( Level.TRACE, "Dispatcher (1)", e ); c.close(); @@ -474,18 +475,18 @@ class ServerImpl { final ArrayList connsToRegister = new ArrayList<>(); - void reRegister (HttpConnection c) { + void reRegister(HttpConnection c) { /* re-register with selector */ try { SocketChannel chan = c.getChannel(); - chan.configureBlocking (false); - SelectionKey key = chan.register (selector, SelectionKey.OP_READ); - key.attach (c); + chan.configureBlocking(false); + SelectionKey key = chan.register(selector, SelectionKey.OP_READ); + key.attach(c); c.selectionKey = key; markIdle(c); } catch (IOException e) { dprint(e); - logger.log (Level.TRACE, "Dispatcher(8)", e); + logger.log(Level.TRACE, "Dispatcher (8)", e); c.close(); } } @@ -504,7 +505,7 @@ class ServerImpl { if (list != null) { for (Event r: list) { - handleEvent (r); + handleEvent(r); } } @@ -525,7 +526,7 @@ class ServerImpl { for (final SelectionKey key : selected.toArray(SelectionKey[]::new)) { // remove the key from the original selected keys (live) Set selected.remove(key); - if (key.equals (listenerKey)) { + if (key.equals(listenerKey)) { if (terminating) { continue; } @@ -546,15 +547,15 @@ class ServerImpl { if (ServerConfig.noDelay()) { chan.socket().setTcpNoDelay(true); } - chan.configureBlocking (false); + chan.configureBlocking(false); SelectionKey newkey = - chan.register (selector, SelectionKey.OP_READ); - HttpConnection c = new HttpConnection (); + chan.register(selector, SelectionKey.OP_READ); + HttpConnection c = new HttpConnection(); c.selectionKey = newkey; - c.setChannel (chan); - newkey.attach (c); + c.setChannel(chan); + newkey.attach(c); markNewlyAccepted(c); - allConnections.add (c); + allConnections.add(c); } } else { try { @@ -563,7 +564,7 @@ class ServerImpl { HttpConnection conn = (HttpConnection)key.attachment(); key.cancel(); - chan.configureBlocking (true); + chan.configureBlocking(true); // check if connection is being closed if (newlyAcceptedConnections.remove(conn) || idleConnections.remove(conn)) { @@ -571,7 +572,7 @@ class ServerImpl { // connection. In either case, we mark that the request // has now started on this connection. requestStarted(conn); - handle (chan, conn); + handle(chan, conn); } } else { assert false : "Unexpected non-readable key:" + key; @@ -586,56 +587,56 @@ class ServerImpl { // call the selector just to process the cancelled keys selector.selectNow(); } catch (IOException e) { - logger.log (Level.TRACE, "Dispatcher (4)", e); + logger.log(Level.TRACE, "Dispatcher (4)", e); } catch (Exception e) { - logger.log (Level.TRACE, "Dispatcher (7)", e); + logger.log(Level.TRACE, "Dispatcher (7)", e); } } - try {selector.close(); } catch (Exception e) {} + try { selector.close(); } catch (Exception e) {} } - private void handleException (SelectionKey key, Exception e) { + private void handleException(SelectionKey key, Exception e) { HttpConnection conn = (HttpConnection)key.attachment(); if (e != null) { - logger.log (Level.TRACE, "Dispatcher (2)", e); + logger.log(Level.TRACE, "Dispatcher (2)", e); } closeConnection(conn); } - public void handle (SocketChannel chan, HttpConnection conn) + public void handle(SocketChannel chan, HttpConnection conn) { try { - Exchange t = new Exchange (chan, protocol, conn); - executor.execute (t); + Exchange t = new Exchange(chan, protocol, conn); + executor.execute(t); } catch (HttpError e1) { - logger.log (Level.TRACE, "Dispatcher (4)", e1); + logger.log(Level.TRACE, "Dispatcher (4)", e1); closeConnection(conn); } catch (IOException e) { - logger.log (Level.TRACE, "Dispatcher (5)", e); + logger.log(Level.TRACE, "Dispatcher (5)", e); closeConnection(conn); } catch (Throwable e) { - logger.log (Level.TRACE, "Dispatcher (6)", e); + logger.log(Level.TRACE, "Dispatcher (6)", e); closeConnection(conn); } } } - static boolean debug = ServerConfig.debugEnabled (); + static boolean debug = ServerConfig.debugEnabled(); - static synchronized void dprint (String s) { + static synchronized void dprint(String s) { if (debug) { - System.out.println (s); + System.out.println(s); } } - static synchronized void dprint (Exception e) { + static synchronized void dprint(Exception e) { if (debug) { - System.out.println (e); + System.out.println(e); e.printStackTrace(); } } - Logger getLogger () { + Logger getLogger() { return logger; } @@ -675,13 +676,13 @@ class ServerImpl { HttpContextImpl ctx; boolean rejected = false; - Exchange (SocketChannel chan, String protocol, HttpConnection conn) throws IOException { + Exchange(SocketChannel chan, String protocol, HttpConnection conn) throws IOException { this.chan = chan; this.connection = conn; this.protocol = protocol; } - public void run () { + public void run() { /* context will be null for new connections */ logger.log(Level.TRACE, "exchange started"); @@ -702,7 +703,7 @@ class ServerImpl { String requestLine = null; SSLStreams sslStreams = null; try { - if (context != null ) { + if (context != null) { this.rawin = connection.getInputStream(); this.rawout = connection.getRawOutputStream(); newconnection = false; @@ -711,21 +712,21 @@ class ServerImpl { newconnection = true; if (https) { if (sslContext == null) { - logger.log (Level.WARNING, + logger.log(Level.WARNING, "SSL connection received. No https context created"); - throw new HttpError ("No SSL context established"); + throw new HttpError("No SSL context established"); } - sslStreams = new SSLStreams (ServerImpl.this, sslContext, chan); + sslStreams = new SSLStreams(ServerImpl.this, sslContext, chan); rawin = sslStreams.getInputStream(); rawout = sslStreams.getOutputStream(); engine = sslStreams.getSSLEngine(); connection.sslStreams = sslStreams; } else { rawin = new BufferedInputStream( - new Request.ReadStream ( + new Request.ReadStream( ServerImpl.this, chan )); - rawout = new Request.WriteStream ( + rawout = new Request.WriteStream( ServerImpl.this, chan ); } @@ -733,7 +734,16 @@ class ServerImpl { connection.raw = rawin; connection.rawout = rawout; } - Request req = new Request (rawin, rawout); + + Request req; + try { + req = new Request(rawin, rawout, newconnection && !https); + } catch (ProtocolException pe) { + logger.log(Level.DEBUG, "closing due to: " + pe); + reject(Code.HTTP_BAD_REQUEST, "", pe.getMessage()); + return; + } + requestLine = req.requestLine(); if (requestLine == null) { /* connection closed */ @@ -742,31 +752,31 @@ class ServerImpl { return; } logger.log(Level.DEBUG, "Exchange request line: {0}", requestLine); - int space = requestLine.indexOf (' '); + int space = requestLine.indexOf(' '); if (space == -1) { - reject (Code.HTTP_BAD_REQUEST, + reject(Code.HTTP_BAD_REQUEST, requestLine, "Bad request line"); return; } - String method = requestLine.substring (0, space); + String method = requestLine.substring(0, space); int start = space+1; space = requestLine.indexOf(' ', start); if (space == -1) { - reject (Code.HTTP_BAD_REQUEST, + reject(Code.HTTP_BAD_REQUEST, requestLine, "Bad request line"); return; } - String uriStr = requestLine.substring (start, space); + String uriStr = requestLine.substring(start, space); URI uri; try { - uri = new URI (uriStr); + uri = new URI(uriStr); } catch (URISyntaxException e3) { reject(Code.HTTP_BAD_REQUEST, requestLine, "URISyntaxException thrown"); return; } start = space+1; - String version = requestLine.substring (start); + String version = requestLine.substring(start); Headers headers = req.headers(); /* check key for illegal characters */ for (var k : headers.keySet()) { @@ -817,32 +827,32 @@ class ServerImpl { requestCompleted(connection); } } - ctx = contexts.findContext (protocol, uri.getPath()); + ctx = contexts.findContext(protocol, uri.getPath()); if (ctx == null) { - reject (Code.HTTP_NOT_FOUND, + reject(Code.HTTP_NOT_FOUND, requestLine, "No context found for request"); return; } - connection.setContext (ctx); + connection.setContext(ctx); if (ctx.getHandler() == null) { - reject (Code.HTTP_INTERNAL_ERROR, + reject(Code.HTTP_INTERNAL_ERROR, requestLine, "No handler for context"); return; } - tx = new ExchangeImpl ( + tx = new ExchangeImpl( method, uri, req, clen, connection ); String chdr = headers.getFirst("Connection"); Headers rheaders = tx.getResponseHeaders(); - if (chdr != null && chdr.equalsIgnoreCase ("close")) { + if (chdr != null && chdr.equalsIgnoreCase("close")) { tx.close = true; } - if (version.equalsIgnoreCase ("http/1.0")) { + if (version.equalsIgnoreCase("http/1.0")) { tx.http10 = true; if (chdr == null) { tx.close = true; - rheaders.set ("Connection", "close"); + rheaders.set("Connection", "close"); } else if (chdr.equalsIgnoreCase("keep-alive")) { rheaders.set("Connection", "keep-alive"); int idleSeconds = (int) (ServerConfig.getIdleIntervalMillis() / 1000); @@ -852,7 +862,7 @@ class ServerImpl { } if (newconnection) { - connection.setParameters ( + connection.setParameters( rawin, rawout, chan, engine, sslStreams, sslContext, protocol, ctx, rawin ); @@ -863,9 +873,9 @@ class ServerImpl { * be involved in this process. */ String exp = headers.getFirst("Expect"); - if (exp != null && exp.equalsIgnoreCase ("100-continue")) { - logReply (100, requestLine, null); - sendReply ( + if (exp != null && exp.equalsIgnoreCase("100-continue")) { + logReply(100, requestLine, null); + sendReply( Code.HTTP_CONTINUE, false, null ); } @@ -880,19 +890,19 @@ class ServerImpl { final List uf = ctx.getFilters(); final Filter.Chain sc = new Filter.Chain(sf, ctx.getHandler()); - final Filter.Chain uc = new Filter.Chain(uf, new LinkHandler (sc)); + final Filter.Chain uc = new Filter.Chain(uf, new LinkHandler(sc)); /* set up the two stream references */ tx.getRequestBody(); tx.getResponseBody(); if (https) { - uc.doFilter (new HttpsExchangeImpl (tx)); + uc.doFilter(new HttpsExchangeImpl(tx)); } else { - uc.doFilter (new HttpExchangeImpl (tx)); + uc.doFilter(new HttpExchangeImpl(tx)); } } catch (Exception e) { - logger.log (Level.TRACE, "ServerImpl.Exchange", e); + logger.log(Level.TRACE, "ServerImpl.Exchange", e); if (tx == null || !tx.writefinished) { closeConnection(connection); } @@ -907,59 +917,59 @@ class ServerImpl { class LinkHandler implements HttpHandler { Filter.Chain nextChain; - LinkHandler (Filter.Chain nextChain) { + LinkHandler(Filter.Chain nextChain) { this.nextChain = nextChain; } - public void handle (HttpExchange exchange) throws IOException { - nextChain.doFilter (exchange); + public void handle(HttpExchange exchange) throws IOException { + nextChain.doFilter(exchange); } } - void reject (int code, String requestStr, String message) { + void reject(int code, String requestStr, String message) { rejected = true; - logReply (code, requestStr, message); - sendReply ( + logReply(code, requestStr, message); + sendReply( code, true, "

    "+code+Code.msg(code)+"

    "+message ); } - void sendReply ( + void sendReply( int code, boolean closeNow, String text) { try { - StringBuilder builder = new StringBuilder (512); - builder.append ("HTTP/1.1 ") - .append (code).append (Code.msg(code)).append ("\r\n"); + StringBuilder builder = new StringBuilder(512); + builder.append("HTTP/1.1 ") + .append(code).append(Code.msg(code)).append("\r\n"); if (text != null && text.length() != 0) { - builder.append ("Content-Length: ") - .append (text.length()).append ("\r\n") - .append ("Content-Type: text/html\r\n"); + builder.append("Content-Length: ") + .append(text.length()).append("\r\n") + .append("Content-Type: text/html\r\n"); } else { - builder.append ("Content-Length: 0\r\n"); + builder.append("Content-Length: 0\r\n"); text = ""; } if (closeNow) { - builder.append ("Connection: close\r\n"); + builder.append("Connection: close\r\n"); } - builder.append ("\r\n").append (text); + builder.append("\r\n").append(text); String s = builder.toString(); byte[] b = s.getBytes(ISO_8859_1); - rawout.write (b); + rawout.write(b); rawout.flush(); if (closeNow) { closeConnection(connection); } } catch (IOException e) { - logger.log (Level.TRACE, "ServerImpl.sendReply", e); + logger.log(Level.TRACE, "ServerImpl.sendReply", e); closeConnection(connection); } } } - void logReply (int code, String requestStr, String text) { + void logReply(int code, String requestStr, String text) { if (!logger.isLoggable(Level.DEBUG)) { return; } @@ -968,18 +978,18 @@ class ServerImpl { } String r; if (requestStr.length() > 80) { - r = requestStr.substring (0, 80) + ""; + r = requestStr.substring(0, 80) + ""; } else { r = requestStr; } String message = r + " [" + code + " " + Code.msg(code) + "] ("+text+")"; - logger.log (Level.DEBUG, message); + logger.log(Level.DEBUG, message); } private int exchangeCount = 0; - synchronized void startExchange () { + synchronized void startExchange() { exchangeCount ++; } @@ -987,20 +997,20 @@ class ServerImpl { return exchangeCount; } - synchronized int endExchange () { + synchronized int endExchange() { exchangeCount --; assert exchangeCount >= 0; return exchangeCount; } - HttpServer getWrapper () { + HttpServer getWrapper() { return wrapper; } - void requestStarted (HttpConnection c) { + void requestStarted(HttpConnection c) { c.reqStartedTime = System.currentTimeMillis(); - c.setState (State.REQUEST); - reqConnections.add (c); + c.setState(State.REQUEST); + reqConnections.add(c); } void markIdle(HttpConnection c) { @@ -1037,21 +1047,21 @@ class ServerImpl { // that ensures the client reads the response in a timely // fashion. - void requestCompleted (HttpConnection c) { + void requestCompleted(HttpConnection c) { State s = c.getState(); assert s == State.REQUEST : "State is not REQUEST ("+s+")"; - reqConnections.remove (c); + reqConnections.remove(c); c.rspStartedTime = System.currentTimeMillis(); - rspConnections.add (c); - c.setState (State.RESPONSE); + rspConnections.add(c); + c.setState(State.RESPONSE); } // called after response has been sent - void responseCompleted (HttpConnection c) { + void responseCompleted(HttpConnection c) { State s = c.getState(); assert s == State.RESPONSE : "State is not RESPONSE ("+s+")"; - rspConnections.remove (c); - c.setState (State.IDLE); + rspConnections.remove(c); + c.setState(State.IDLE); } /** @@ -1059,7 +1069,7 @@ class ServerImpl { * TimerTask run every CLOCK_TICK ms */ class IdleTimeoutTask extends TimerTask { - public void run () { + public void run() { closeConnections(idleConnections, IDLE_INTERVAL); // if any newly accepted connection has been idle (i.e. no byte has been sent on that // connection during the configured idle timeout period) then close it as well @@ -1095,20 +1105,20 @@ class ServerImpl { class ReqRspTimeoutTask extends TimerTask { // runs every TIMER_MILLIS - public void run () { + public void run() { ArrayList toClose = new ArrayList<>(); final long currentTime = System.currentTimeMillis(); synchronized (reqConnections) { if (MAX_REQ_TIME != -1) { for (HttpConnection c : reqConnections) { if (currentTime - c.reqStartedTime >= MAX_REQ_TIME) { - toClose.add (c); + toClose.add(c); } } for (HttpConnection c : toClose) { - logger.log (Level.DEBUG, "closing: no request: " + c); - reqConnections.remove (c); - allConnections.remove (c); + logger.log(Level.DEBUG, "closing: no request: " + c); + reqConnections.remove(c); + allConnections.remove(c); c.close(); } } @@ -1118,13 +1128,13 @@ class ServerImpl { if (MAX_RSP_TIME != -1) { for (HttpConnection c : rspConnections) { if (currentTime - c.rspStartedTime >= MAX_RSP_TIME) { - toClose.add (c); + toClose.add(c); } } for (HttpConnection c : toClose) { - logger.log (Level.DEBUG, "closing: no response: " + c); - rspConnections.remove (c); - allConnections.remove (c); + logger.log(Level.DEBUG, "closing: no response: " + c); + rspConnections.remove(c); + allConnections.remove(c); c.close(); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java index 7bfc39c84a1..ecda32ecc31 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java @@ -40,30 +40,30 @@ class UndefLengthOutputStream extends FilterOutputStream private boolean closed = false; ExchangeImpl t; - UndefLengthOutputStream (ExchangeImpl t, OutputStream src) { - super (src); + UndefLengthOutputStream(ExchangeImpl t, OutputStream src) { + super(src); this.t = t; } - public void write (int b) throws IOException { + public void write(int b) throws IOException { if (closed) { - throw new IOException ("stream closed"); + throw new IOException("stream closed"); } out.write(b); } - public void write (byte[]b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { Objects.checkFromIndexSize(off, len, b.length); if (len == 0) { return; } if (closed) { - throw new IOException ("stream closed"); + throw new IOException("stream closed"); } out.write(b, off, len); } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } @@ -76,7 +76,7 @@ class UndefLengthOutputStream extends FilterOutputStream } catch (IOException e) {} } Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent (e); + t.getHttpContext().getServerImpl().addEvent(e); } // flush is a pass-through diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/UnmodifiableHeaders.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/UnmodifiableHeaders.java index 91bfc186828..503004b35e0 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/UnmodifiableHeaders.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/UnmodifiableHeaders.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 @@ -62,32 +62,32 @@ public class UnmodifiableHeaders extends Headers { @Override public List put(String key, List value) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void add(String key, String value) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void set(String key, String value) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public List remove(Object key) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void putAll(Map> t) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void clear() { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override @@ -106,19 +106,19 @@ public class UnmodifiableHeaders extends Headers { @Override public boolean replace(String key, List oldValue, List newValue) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void replaceAll(BiFunction, ? extends List> function) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override - public boolean equals(Object o) {return headers.equals(o);} + public boolean equals(Object o) { return headers.equals(o); } @Override - public int hashCode() {return headers.hashCode();} + public int hashCode() { return headers.hashCode(); } @Override public String toString() { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/Utils.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/Utils.java index 43dadb84a90..41834172f27 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/Utils.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/Utils.java @@ -88,4 +88,37 @@ public class Utils { } return true; } + + /* Throw IAE if illegal character found. isValue is true if String is + * a value. Otherwise it is header name + */ + public static void checkHeader(String str, boolean isValue) { + int len = str.length(); + for (int i=0; i= len - 2) { + throw new IllegalArgumentException("Illegal CR found in header"); + } + char c1 = str.charAt(i+1); + char c2 = str.charAt(i+2); + if (c1 != '\n') { + throw new IllegalArgumentException("Illegal char found after CR in header"); + } + if (c2 != ' ' && c2 != '\t') { + throw new IllegalArgumentException("No whitespace found after CRLF in header"); + } + i+=2; + } else if (c == '\n') { + throw new IllegalArgumentException("Illegal LF found in header"); + } else if (c > 255) { + throw new IllegalArgumentException("Illegal character found in header"); + } + } + } + } 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 3a3654d4a73..cbf032e8398 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 @@ -367,7 +367,7 @@ public final class FileServerHandler implements HttpHandler { // A non-exhaustive map of reserved-HTML and special characters to their // equivalent entity. - private static final Map RESERVED_CHARS = Map.of( + private static final Map RESERVED_CHARS = Map.of( (int) '&' , "&" , (int) '<' , "<" , (int) '>' , ">" , diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java index 30297b24db0..5b762edfd3b 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractMask.java @@ -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 @@ -73,7 +73,7 @@ abstract class AbstractMask extends VectorMask { int laneCount = vsp.laneCount(); i = VectorIntrinsics.checkFromIndexSize(i, laneCount, bits.length); VectorSupport.store( - vsp.maskType(), vsp.elementType(), laneCount, + vsp.maskType(), vsp.laneTypeOrdinal(), laneCount, bits, (long) i + Unsafe.ARRAY_BOOLEAN_BASE_OFFSET, false, this, bits, i, (c, idx, s) -> System.arraycopy(s.getBits(), 0, c, (int) idx, s.length())); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractShuffle.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractShuffle.java index 19ee4bb0074..075400a0d4a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractShuffle.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractShuffle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2025, 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 @@ -53,7 +53,7 @@ abstract class AbstractShuffle extends VectorShuffle { @ForceInline final AbstractVector toBitsVectorTemplate() { AbstractSpecies dsp = vspecies().asIntegral(); - Class etype = dsp.elementType(); + int etype = dsp.laneTypeOrdinal(); Class rvtype = dsp.dummyVector().getClass(); return VectorSupport.convert(VectorSupport.VECTOR_OP_REINTERPRET, getClass(), etype, length(), diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractSpecies.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractSpecies.java index bdc72c64ce5..0f9edbe450c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractSpecies.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractSpecies.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, 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 @@ -144,6 +144,12 @@ abstract class AbstractSpecies extends jdk.internal.vm.vector.VectorSupport.V return (Class) laneType.elementType; } + @ForceInline + @SuppressWarnings("unchecked") + //NOT FINAL: SPECIALIZED + int laneTypeOrdinal() { + return laneType.ordinal(); + } // FIXME: appeal to general method (see https://bugs.openjdk.org/browse/JDK-6176992) // replace usages of this method and remove @ForceInline diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java index 45773cd29db..80260c2bd30 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/AbstractVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, 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 @@ -84,6 +84,9 @@ abstract class AbstractVector extends Vector { /*package-private*/ abstract AbstractSpecies vspecies(); + /*package-private*/ + abstract int laneTypeOrdinal(); + @Override @ForceInline public final VectorSpecies species() { @@ -182,7 +185,44 @@ abstract class AbstractVector extends Vector { final AbstractVector asVectorRawTemplate(LaneType laneType) { // NOTE: This assumes that convert0('X') // respects REGISTER_ENDIAN order. - return convert0('X', vspecies().withLanes(laneType)); + return convert0('X', vspecies().withLanes(laneType)).swapIfNeeded(vspecies()); + } + + @ForceInline + protected static VectorShuffle normalizeSubLanesForSpecies(AbstractSpecies targetSpecies, int subLanesPerSrc) { + final int lanes = targetSpecies.laneCount(); + + if ((lanes % subLanesPerSrc) != 0) { + throw new IllegalArgumentException("laneCount " + lanes + " not divisible by subLanesPerSrc " + subLanesPerSrc); + } + + // Each group corresponds to one source lane. + // For each group, reverse the lanes inside that group. + final int groups = lanes / subLanesPerSrc; + int[] map = new int[lanes]; + for (int g = 0; g < groups; ++g) { + int base = g * subLanesPerSrc; + for (int j = 0; j < subLanesPerSrc; ++j) { + map[base + j] = base + (subLanesPerSrc - 1 - j); + } + } + return VectorShuffle.fromArray(targetSpecies, map, 0); + } + + @ForceInline + protected final int subLanesToSwap(AbstractSpecies srcSpecies) { + if (java.nio.ByteOrder.nativeOrder() != ByteOrder.BIG_ENDIAN) { + return -1; + } + int sBytes = srcSpecies.elementSize(); + int tBytes = vspecies().elementSize(); + + // No lane reordering needed for same size or widening reinterprets + if (sBytes == tBytes || (sBytes % tBytes) != 0) { + return -1; + } + int subLanesPerSrc = sBytes / tBytes; + return subLanesPerSrc; } /*package-private*/ @@ -199,9 +239,9 @@ abstract class AbstractVector extends Vector { /*package-private*/ @ForceInline final VectorShuffle bitsToShuffleTemplate(AbstractSpecies dsp) { - Class etype = vspecies().elementType(); + int etype = vspecies().laneTypeOrdinal(); Class dvtype = dsp.shuffleType(); - Class dtype = dsp.asIntegral().elementType(); + int dtype = dsp.asIntegral().laneTypeOrdinal(); int dlength = dsp.dummyVector().length(); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, getClass(), etype, length(), @@ -242,6 +282,9 @@ abstract class AbstractVector extends Vector { /*package-private*/ abstract AbstractVector maybeSwap(ByteOrder bo); + /*package-private*/ + abstract AbstractVector swapIfNeeded(AbstractSpecies srcSpecies); + /*package-private*/ @ForceInline VectorShuffle swapBytesShuffle() { @@ -722,10 +765,10 @@ abstract class AbstractVector extends Vector { AbstractVector convert0(char kind, AbstractSpecies rsp) { // Derive some JIT-time constants: Class vtype; - Class etype; // fill in after switch (constant) + int etype; // fill in after switch (constant) int vlength; // fill in after switch (mark type profile?) Class rvtype; // fill in after switch (mark type profile) - Class rtype; + int rtype; int rlength; switch (kind) { case 'Z': // lane-wise size change, maybe with sign clip @@ -733,9 +776,9 @@ abstract class AbstractVector extends Vector { AbstractSpecies vsp = this.vspecies(); AbstractSpecies vspi = vsp.asIntegral(); AbstractVector biti = vspi == vsp ? this : this.convert0('X', vspi); - rtype = rspi.elementType(); + rtype = rspi.laneTypeOrdinal(); rlength = rspi.laneCount(); - etype = vspi.elementType(); + etype = vspi.laneTypeOrdinal(); vlength = vspi.laneCount(); rvtype = rspi.dummyVector().getClass(); vtype = vspi.dummyVector().getClass(); @@ -747,9 +790,9 @@ abstract class AbstractVector extends Vector { AbstractVector::defaultUCast); return (rspi == rsp ? bitv.check0(rsp) : bitv.convert0('X', rsp)); case 'C': // lane-wise cast (but not identity) - rtype = rsp.elementType(); + rtype = rsp.laneTypeOrdinal(); rlength = rsp.laneCount(); - etype = this.elementType(); // (profile) + etype = this.vspecies().laneTypeOrdinal(); // (profile) vlength = this.length(); // (profile) rvtype = rsp.dummyVector().getClass(); // (profile) vtype = this.getClass(); @@ -759,9 +802,9 @@ abstract class AbstractVector extends Vector { this, rsp, AbstractVector::defaultCast); case 'X': // reinterpret cast, not lane-wise if lane sizes differ - rtype = rsp.elementType(); + rtype = rsp.laneTypeOrdinal(); rlength = rsp.laneCount(); - etype = this.elementType(); // (profile) + etype = this.vspecies().laneTypeOrdinal(); // (profile) vlength = this.length(); // (profile) rvtype = rsp.dummyVector().getClass(); // (profile) vtype = this.getClass(); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java index 3569ed00f1f..0b710938ede 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte128Vector.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 @@ -119,6 +119,13 @@ final class Byte128Vector extends ByteVector { return (byte[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -541,7 +548,7 @@ final class Byte128Vector extends ByteVector { @ForceInline public byte laneHelper(int i) { return (byte) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { byte[] vecarr = vec.vec(); @@ -576,7 +583,7 @@ final class Byte128Vector extends ByteVector { @ForceInline public Byte128Vector withLaneHelper(int i, byte e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { byte[] res = v.vec().clone(); @@ -680,8 +687,8 @@ final class Byte128Vector extends ByteVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -691,7 +698,7 @@ final class Byte128Vector extends ByteVector { /*package-private*/ Byte128Mask indexPartiallyInUpperRange(long offset, long limit) { return (Byte128Mask) VectorSupport.indexPartiallyInUpperRange( - Byte128Mask.class, byte.class, VLENGTH, offset, limit, + Byte128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Byte128Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -707,7 +714,7 @@ final class Byte128Vector extends ByteVector { @ForceInline public Byte128Mask compress() { return (Byte128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Byte128Vector.class, Byte128Mask.class, ETYPE, VLENGTH, null, this, + Byte128Vector.class, Byte128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -719,7 +726,7 @@ final class Byte128Vector extends ByteVector { public Byte128Mask and(VectorMask mask) { Objects.requireNonNull(mask); Byte128Mask m = (Byte128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Byte128Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Byte128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -729,7 +736,7 @@ final class Byte128Vector extends ByteVector { public Byte128Mask or(VectorMask mask) { Objects.requireNonNull(mask); Byte128Mask m = (Byte128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Byte128Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Byte128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -739,7 +746,7 @@ final class Byte128Vector extends ByteVector { public Byte128Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Byte128Mask m = (Byte128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Byte128Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Byte128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -749,21 +756,21 @@ final class Byte128Vector extends ByteVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte128Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte128Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte128Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -773,7 +780,7 @@ final class Byte128Vector extends ByteVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Byte128Mask.class, byte.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Byte128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -783,7 +790,7 @@ final class Byte128Vector extends ByteVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Byte128Mask.class, byte.class, VLENGTH, + return VectorSupport.extract(Byte128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -792,7 +799,7 @@ final class Byte128Vector extends ByteVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Byte128Mask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_ne, Byte128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Byte128Mask)m).getBits())); } @@ -800,7 +807,7 @@ final class Byte128Vector extends ByteVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Byte128Mask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_overflow, Byte128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Byte128Mask)m).getBits())); } @@ -808,7 +815,7 @@ final class Byte128Vector extends ByteVector { @ForceInline /*package-private*/ static Byte128Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Byte128Mask.class, byte.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Byte128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java index 70a3306731e..6b0e57f8b8f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte256Vector.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 @@ -119,6 +119,13 @@ final class Byte256Vector extends ByteVector { return (byte[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -557,7 +564,7 @@ final class Byte256Vector extends ByteVector { @ForceInline public byte laneHelper(int i) { return (byte) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { byte[] vecarr = vec.vec(); @@ -608,7 +615,7 @@ final class Byte256Vector extends ByteVector { @ForceInline public Byte256Vector withLaneHelper(int i, byte e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { byte[] res = v.vec().clone(); @@ -712,8 +719,8 @@ final class Byte256Vector extends ByteVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -723,7 +730,7 @@ final class Byte256Vector extends ByteVector { /*package-private*/ Byte256Mask indexPartiallyInUpperRange(long offset, long limit) { return (Byte256Mask) VectorSupport.indexPartiallyInUpperRange( - Byte256Mask.class, byte.class, VLENGTH, offset, limit, + Byte256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Byte256Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -739,7 +746,7 @@ final class Byte256Vector extends ByteVector { @ForceInline public Byte256Mask compress() { return (Byte256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Byte256Vector.class, Byte256Mask.class, ETYPE, VLENGTH, null, this, + Byte256Vector.class, Byte256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -751,7 +758,7 @@ final class Byte256Vector extends ByteVector { public Byte256Mask and(VectorMask mask) { Objects.requireNonNull(mask); Byte256Mask m = (Byte256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Byte256Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Byte256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -761,7 +768,7 @@ final class Byte256Vector extends ByteVector { public Byte256Mask or(VectorMask mask) { Objects.requireNonNull(mask); Byte256Mask m = (Byte256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Byte256Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Byte256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -771,7 +778,7 @@ final class Byte256Vector extends ByteVector { public Byte256Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Byte256Mask m = (Byte256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Byte256Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Byte256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -781,21 +788,21 @@ final class Byte256Vector extends ByteVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte256Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte256Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte256Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -805,7 +812,7 @@ final class Byte256Vector extends ByteVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Byte256Mask.class, byte.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Byte256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -815,7 +822,7 @@ final class Byte256Vector extends ByteVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Byte256Mask.class, byte.class, VLENGTH, + return VectorSupport.extract(Byte256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -824,7 +831,7 @@ final class Byte256Vector extends ByteVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Byte256Mask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_ne, Byte256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Byte256Mask)m).getBits())); } @@ -832,7 +839,7 @@ final class Byte256Vector extends ByteVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Byte256Mask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_overflow, Byte256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Byte256Mask)m).getBits())); } @@ -840,7 +847,7 @@ final class Byte256Vector extends ByteVector { @ForceInline /*package-private*/ static Byte256Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Byte256Mask.class, byte.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Byte256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java index a093fe18289..b1df6949e3a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte512Vector.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 @@ -119,6 +119,13 @@ final class Byte512Vector extends ByteVector { return (byte[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -589,7 +596,7 @@ final class Byte512Vector extends ByteVector { @ForceInline public byte laneHelper(int i) { return (byte) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { byte[] vecarr = vec.vec(); @@ -672,7 +679,7 @@ final class Byte512Vector extends ByteVector { @ForceInline public Byte512Vector withLaneHelper(int i, byte e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { byte[] res = v.vec().clone(); @@ -776,8 +783,8 @@ final class Byte512Vector extends ByteVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -787,7 +794,7 @@ final class Byte512Vector extends ByteVector { /*package-private*/ Byte512Mask indexPartiallyInUpperRange(long offset, long limit) { return (Byte512Mask) VectorSupport.indexPartiallyInUpperRange( - Byte512Mask.class, byte.class, VLENGTH, offset, limit, + Byte512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Byte512Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -803,7 +810,7 @@ final class Byte512Vector extends ByteVector { @ForceInline public Byte512Mask compress() { return (Byte512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Byte512Vector.class, Byte512Mask.class, ETYPE, VLENGTH, null, this, + Byte512Vector.class, Byte512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -815,7 +822,7 @@ final class Byte512Vector extends ByteVector { public Byte512Mask and(VectorMask mask) { Objects.requireNonNull(mask); Byte512Mask m = (Byte512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Byte512Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Byte512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -825,7 +832,7 @@ final class Byte512Vector extends ByteVector { public Byte512Mask or(VectorMask mask) { Objects.requireNonNull(mask); Byte512Mask m = (Byte512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Byte512Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Byte512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -835,7 +842,7 @@ final class Byte512Vector extends ByteVector { public Byte512Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Byte512Mask m = (Byte512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Byte512Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Byte512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -845,21 +852,21 @@ final class Byte512Vector extends ByteVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte512Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte512Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte512Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -869,7 +876,7 @@ final class Byte512Vector extends ByteVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Byte512Mask.class, byte.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Byte512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -879,7 +886,7 @@ final class Byte512Vector extends ByteVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Byte512Mask.class, byte.class, VLENGTH, + return VectorSupport.extract(Byte512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -888,7 +895,7 @@ final class Byte512Vector extends ByteVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Byte512Mask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_ne, Byte512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Byte512Mask)m).getBits())); } @@ -896,7 +903,7 @@ final class Byte512Vector extends ByteVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Byte512Mask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_overflow, Byte512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Byte512Mask)m).getBits())); } @@ -904,7 +911,7 @@ final class Byte512Vector extends ByteVector { @ForceInline /*package-private*/ static Byte512Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Byte512Mask.class, byte.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Byte512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java index cd75ee9f610..dfd16e1812a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Byte64Vector.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 @@ -119,6 +119,13 @@ final class Byte64Vector extends ByteVector { return (byte[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -533,7 +540,7 @@ final class Byte64Vector extends ByteVector { @ForceInline public byte laneHelper(int i) { return (byte) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { byte[] vecarr = vec.vec(); @@ -560,7 +567,7 @@ final class Byte64Vector extends ByteVector { @ForceInline public Byte64Vector withLaneHelper(int i, byte e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { byte[] res = v.vec().clone(); @@ -664,8 +671,8 @@ final class Byte64Vector extends ByteVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -675,7 +682,7 @@ final class Byte64Vector extends ByteVector { /*package-private*/ Byte64Mask indexPartiallyInUpperRange(long offset, long limit) { return (Byte64Mask) VectorSupport.indexPartiallyInUpperRange( - Byte64Mask.class, byte.class, VLENGTH, offset, limit, + Byte64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Byte64Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -691,7 +698,7 @@ final class Byte64Vector extends ByteVector { @ForceInline public Byte64Mask compress() { return (Byte64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Byte64Vector.class, Byte64Mask.class, ETYPE, VLENGTH, null, this, + Byte64Vector.class, Byte64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -703,7 +710,7 @@ final class Byte64Vector extends ByteVector { public Byte64Mask and(VectorMask mask) { Objects.requireNonNull(mask); Byte64Mask m = (Byte64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Byte64Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Byte64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -713,7 +720,7 @@ final class Byte64Vector extends ByteVector { public Byte64Mask or(VectorMask mask) { Objects.requireNonNull(mask); Byte64Mask m = (Byte64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Byte64Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Byte64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -723,7 +730,7 @@ final class Byte64Vector extends ByteVector { public Byte64Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Byte64Mask m = (Byte64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Byte64Mask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Byte64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -733,21 +740,21 @@ final class Byte64Vector extends ByteVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte64Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Byte64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte64Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Byte64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte64Mask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Byte64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -757,7 +764,7 @@ final class Byte64Vector extends ByteVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Byte64Mask.class, byte.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Byte64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -767,7 +774,7 @@ final class Byte64Vector extends ByteVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Byte64Mask.class, byte.class, VLENGTH, + return VectorSupport.extract(Byte64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -776,7 +783,7 @@ final class Byte64Vector extends ByteVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Byte64Mask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_ne, Byte64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Byte64Mask)m).getBits())); } @@ -784,7 +791,7 @@ final class Byte64Vector extends ByteVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Byte64Mask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_overflow, Byte64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Byte64Mask)m).getBits())); } @@ -792,7 +799,7 @@ final class Byte64Vector extends ByteVector { @ForceInline /*package-private*/ static Byte64Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Byte64Mask.class, byte.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Byte64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java index 3ac62409a95..8c3cc68cece 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteMaxVector.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 @@ -119,6 +119,13 @@ final class ByteMaxVector extends ByteVector { return (byte[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -526,7 +533,7 @@ final class ByteMaxVector extends ByteVector { @ForceInline public byte laneHelper(int i) { return (byte) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { byte[] vecarr = vec.vec(); @@ -546,7 +553,7 @@ final class ByteMaxVector extends ByteVector { @ForceInline public ByteMaxVector withLaneHelper(int i, byte e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { byte[] res = v.vec().clone(); @@ -650,8 +657,8 @@ final class ByteMaxVector extends ByteVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -661,7 +668,7 @@ final class ByteMaxVector extends ByteVector { /*package-private*/ ByteMaxMask indexPartiallyInUpperRange(long offset, long limit) { return (ByteMaxMask) VectorSupport.indexPartiallyInUpperRange( - ByteMaxMask.class, byte.class, VLENGTH, offset, limit, + ByteMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (ByteMaxMask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -677,7 +684,7 @@ final class ByteMaxVector extends ByteVector { @ForceInline public ByteMaxMask compress() { return (ByteMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - ByteMaxVector.class, ByteMaxMask.class, ETYPE, VLENGTH, null, this, + ByteMaxVector.class, ByteMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -689,7 +696,7 @@ final class ByteMaxVector extends ByteVector { public ByteMaxMask and(VectorMask mask) { Objects.requireNonNull(mask); ByteMaxMask m = (ByteMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, ByteMaxMask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, ByteMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -699,7 +706,7 @@ final class ByteMaxVector extends ByteVector { public ByteMaxMask or(VectorMask mask) { Objects.requireNonNull(mask); ByteMaxMask m = (ByteMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, ByteMaxMask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, ByteMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -709,7 +716,7 @@ final class ByteMaxVector extends ByteVector { public ByteMaxMask xor(VectorMask mask) { Objects.requireNonNull(mask); ByteMaxMask m = (ByteMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, ByteMaxMask.class, null, byte.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, ByteMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -719,21 +726,21 @@ final class ByteMaxVector extends ByteVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, ByteMaxMask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, ByteMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, ByteMaxMask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, ByteMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, ByteMaxMask.class, byte.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, ByteMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -743,7 +750,7 @@ final class ByteMaxVector extends ByteVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, ByteMaxMask.class, byte.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, ByteMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -753,7 +760,7 @@ final class ByteMaxVector extends ByteVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(ByteMaxMask.class, byte.class, VLENGTH, + return VectorSupport.extract(ByteMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -762,7 +769,7 @@ final class ByteMaxVector extends ByteVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, ByteMaxMask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_ne, ByteMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((ByteMaxMask)m).getBits())); } @@ -770,7 +777,7 @@ final class ByteMaxVector extends ByteVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, ByteMaxMask.class, byte.class, VLENGTH, + return VectorSupport.test(BT_overflow, ByteMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((ByteMaxMask)m).getBits())); } @@ -778,7 +785,7 @@ final class ByteMaxVector extends ByteVector { @ForceInline /*package-private*/ static ByteMaxMask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(ByteMaxMask.class, byte.class, VLENGTH, + return VectorSupport.fromBitsCoerced(ByteMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java index 08406fef518..64d8e3a8252 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.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 @@ -59,6 +59,10 @@ public abstract class ByteVector extends AbstractVector { static final ValueLayout.OfByte ELEMENT_LAYOUT = ValueLayout.JAVA_BYTE.withByteAlignment(1); + static final int LANE_TYPE_ORDINAL = LT_BYTE; + + static final int LANEBITS_TYPE_ORDINAL = LT_BYTE; + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -573,7 +577,7 @@ public abstract class ByteVector extends AbstractVector { @ForceInline public static ByteVector zero(VectorSpecies species) { ByteSpecies vsp = (ByteSpecies) species; - return VectorSupport.fromBitsCoerced(vsp.vectorType(), byte.class, species.length(), + return VectorSupport.fromBitsCoerced(vsp.vectorType(), LANE_TYPE_ORDINAL, species.length(), 0, MODE_BROADCAST, vsp, ((bits_, s_) -> s_.rvOp(i -> bits_))); } @@ -695,7 +699,7 @@ public abstract class ByteVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), null, byte.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, UN_IMPL.find(op, opc, ByteVector::unaryOperations)); } @@ -723,7 +727,7 @@ public abstract class ByteVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), maskClass, byte.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, UN_IMPL.find(op, opc, ByteVector::unaryOperations)); } @@ -796,7 +800,7 @@ public abstract class ByteVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), null, byte.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, null, BIN_IMPL.find(op, opc, ByteVector::binaryOperations)); } @@ -847,7 +851,7 @@ public abstract class ByteVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), maskClass, byte.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, m, BIN_IMPL.find(op, opc, ByteVector::binaryOperations)); } @@ -1034,7 +1038,7 @@ public abstract class ByteVector extends AbstractVector { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), null, byte.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, e, null, BIN_INT_IMPL.find(op, opc, ByteVector::broadcastIntOperations)); } @@ -1055,7 +1059,7 @@ public abstract class ByteVector extends AbstractVector { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), maskClass, byte.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, e, m, BIN_INT_IMPL.find(op, opc, ByteVector::broadcastIntOperations)); } @@ -1132,7 +1136,7 @@ public abstract class ByteVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), null, byte.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, tother, null, TERN_IMPL.find(op, opc, ByteVector::ternaryOperations)); } @@ -1172,7 +1176,7 @@ public abstract class ByteVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), maskClass, byte.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, tother, m, TERN_IMPL.find(op, opc, ByteVector::ternaryOperations)); } @@ -2070,7 +2074,7 @@ public abstract class ByteVector extends AbstractVector { that.check(this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, byte.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, null, (cond, v0, v1, m1) -> { AbstractMask m @@ -2092,7 +2096,7 @@ public abstract class ByteVector extends AbstractVector { m.check(maskType, this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, byte.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, m, (cond, v0, v1, m1) -> { AbstractMask cmpM @@ -2223,7 +2227,7 @@ public abstract class ByteVector extends AbstractVector { blendTemplate(Class maskType, ByteVector v, M m) { v.check(this); return VectorSupport.blend( - getClass(), maskType, byte.class, length(), + getClass(), maskType, laneTypeOrdinal(), length(), this, v, m, (v0, v1, m_) -> v0.bOp(v1, m_, (i, a, b) -> b)); } @@ -2240,7 +2244,7 @@ public abstract class ByteVector extends AbstractVector { // make sure VLENGTH*scale doesn't overflow: vsp.checkScale(scale); return VectorSupport.indexVector( - getClass(), byte.class, length(), + getClass(), laneTypeOrdinal(), length(), this, scale, vsp, (v, scale_, s) -> { @@ -2432,7 +2436,7 @@ public abstract class ByteVector extends AbstractVector { ByteVector rearrangeTemplate(Class shuffletype, S shuffle) { Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( - getClass(), shuffletype, null, byte.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2459,7 +2463,7 @@ public abstract class ByteVector extends AbstractVector { Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( - getClass(), shuffletype, masktype, byte.class, length(), + getClass(), shuffletype, masktype, laneTypeOrdinal(), length(), this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2485,7 +2489,7 @@ public abstract class ByteVector extends AbstractVector { VectorMask valid = shuffle.laneIsValid(); ByteVector r0 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, byte.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); @@ -2493,7 +2497,7 @@ public abstract class ByteVector extends AbstractVector { })); ByteVector r1 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, byte.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2543,7 +2547,7 @@ public abstract class ByteVector extends AbstractVector { ByteVector compressTemplate(Class masktype, M m) { m.check(masktype, this); return (ByteVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, - byte.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> compressHelper(v1, m1)); } @@ -2562,7 +2566,7 @@ public abstract class ByteVector extends AbstractVector { ByteVector expandTemplate(Class masktype, M m) { m.check(masktype, this); return (ByteVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, - byte.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> expandHelper(v1, m1)); } @@ -2577,7 +2581,7 @@ public abstract class ByteVector extends AbstractVector { /*package-private*/ @ForceInline final ByteVector selectFromTemplate(ByteVector v) { - return (ByteVector)VectorSupport.selectFromOp(getClass(), null, byte.class, + return (ByteVector)VectorSupport.selectFromOp(getClass(), null, laneTypeOrdinal(), length(), this, v, null, (v1, v2, _m) -> v2.rearrange(v1.toShuffle())); @@ -2597,7 +2601,7 @@ public abstract class ByteVector extends AbstractVector { ByteVector selectFromTemplate(ByteVector v, Class masktype, M m) { m.check(masktype, this); - return (ByteVector)VectorSupport.selectFromOp(getClass(), masktype, byte.class, + return (ByteVector)VectorSupport.selectFromOp(getClass(), masktype, laneTypeOrdinal(), length(), this, v, m, (v1, v2, _m) -> v2.rearrange(v1.toShuffle(), _m)); @@ -2615,7 +2619,7 @@ public abstract class ByteVector extends AbstractVector { /*package-private*/ @ForceInline final ByteVector selectFromTemplate(ByteVector v1, ByteVector v2) { - return VectorSupport.selectFromTwoVectorOp(getClass(), byte.class, length(), this, v1, v2, + return VectorSupport.selectFromTwoVectorOp(getClass(), laneTypeOrdinal(), length(), this, v1, v2, (vec1, vec2, vec3) -> selectFromTwoVectorHelper(vec1, vec2, vec3)); } @@ -2835,7 +2839,7 @@ public abstract class ByteVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), maskClass, byte.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, REDUCE_IMPL.find(op, opc, ByteVector::reductionOperations))); } @@ -2853,7 +2857,7 @@ public abstract class ByteVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), null, byte.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, REDUCE_IMPL.find(op, opc, ByteVector::reductionOperations))); } @@ -2873,9 +2877,9 @@ public abstract class ByteVector extends AbstractVector { case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (byte) Math.max(a, b))); case VECTOR_OP_UMIN: return (v, m) -> - toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (byte) VectorMath.minUnsigned(a, b))); + toBits(v.rOp(UMAX_VALUE, m, (i, a, b) -> (byte) VectorMath.minUnsigned(a, b))); case VECTOR_OP_UMAX: return (v, m) -> - toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (byte) VectorMath.maxUnsigned(a, b))); + toBits(v.rOp(UMIN_VALUE, m, (i, a, b) -> (byte) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_SUADD: return (v, m) -> toBits(v.rOp((byte)0, m, (i, a, b) -> (byte) VectorMath.addSaturatingUnsigned(a, b))); case VECTOR_OP_AND: return (v, m) -> @@ -2890,6 +2894,8 @@ public abstract class ByteVector extends AbstractVector { private static final byte MIN_OR_INF = Byte.MIN_VALUE; private static final byte MAX_OR_INF = Byte.MAX_VALUE; + private static final byte UMIN_VALUE = (byte)0; // Minimum unsigned value + private static final byte UMAX_VALUE = (byte)-1; // Maximum unsigned value public @Override abstract long reduceLanesToLong(VectorOperators.Associative op); public @Override abstract long reduceLanesToLong(VectorOperators.Associative op, @@ -3143,7 +3149,7 @@ public abstract class ByteVector extends AbstractVector { } return VectorSupport.loadWithMap( - vectorType, null, byte.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), lsp.vectorType(), lsp.length(), a, ARRAY_BASE, vix0, vix1, vix2, vix3, null, a, offset, indexMap, mapOffset, vsp, @@ -3478,7 +3484,7 @@ public abstract class ByteVector extends AbstractVector { offset = checkFromIndexSize(offset, length(), a.length); ByteSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, @@ -3632,7 +3638,7 @@ public abstract class ByteVector extends AbstractVector { ByteSpecies vsp = vspecies(); ByteVector normalized = this.and((byte) 1); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, booleanArrayAddress(a, offset), false, normalized, a, offset, @@ -3845,7 +3851,7 @@ public abstract class ByteVector extends AbstractVector { ByteVector fromArray0Template(byte[] a, int offset) { ByteSpecies vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -3862,7 +3868,7 @@ public abstract class ByteVector extends AbstractVector { m.check(species()); ByteSpecies vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -3918,7 +3924,7 @@ public abstract class ByteVector extends AbstractVector { } return VectorSupport.loadWithMap( - vectorType, maskClass, byte.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), lsp.vectorType(), lsp.length(), a, ARRAY_BASE, vix0, vix1, vix2, vix3, m, a, offset, indexMap, mapOffset, vsp, @@ -3935,7 +3941,7 @@ public abstract class ByteVector extends AbstractVector { ByteVector fromBooleanArray0Template(boolean[] a, int offset) { ByteSpecies vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, booleanArrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -3952,7 +3958,7 @@ public abstract class ByteVector extends AbstractVector { m.check(species()); ByteSpecies vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, booleanArrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -3966,7 +3972,7 @@ public abstract class ByteVector extends AbstractVector { ByteVector fromMemorySegment0Template(MemorySegment ms, long offset) { ByteSpecies vsp = vspecies(); return ScopedMemoryAccess.loadFromMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, vsp, (msp, off, s) -> { return s.ldLongOp((MemorySegment) msp, off, ByteVector::memorySegmentGet); @@ -3982,7 +3988,7 @@ public abstract class ByteVector extends AbstractVector { ByteSpecies vsp = vspecies(); m.check(vsp); return ScopedMemoryAccess.loadFromMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, m, vsp, offsetInRange, (msp, off, s, vm) -> { return s.ldLongOp((MemorySegment) msp, off, vm, ByteVector::memorySegmentGet); @@ -4000,7 +4006,7 @@ public abstract class ByteVector extends AbstractVector { void intoArray0Template(byte[] a, int offset) { ByteSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, (arr, off, v) @@ -4017,7 +4023,7 @@ public abstract class ByteVector extends AbstractVector { m.check(species()); ByteSpecies vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -4036,7 +4042,7 @@ public abstract class ByteVector extends AbstractVector { ByteSpecies vsp = vspecies(); ByteVector normalized = this.and((byte) 1); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, booleanArrayAddress(a, offset), false, normalized, m, a, offset, (arr, off, v, vm) @@ -4049,7 +4055,7 @@ public abstract class ByteVector extends AbstractVector { void intoMemorySegment0(MemorySegment ms, long offset) { ByteSpecies vsp = vspecies(); ScopedMemoryAccess.storeIntoMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), this, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v) -> { @@ -4066,7 +4072,7 @@ public abstract class ByteVector extends AbstractVector { ByteSpecies vsp = vspecies(); m.check(vsp); ScopedMemoryAccess.storeIntoMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), this, m, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v, vm) -> { @@ -4099,6 +4105,14 @@ public abstract class ByteVector extends AbstractVector { return this; } + /*package-private*/ + @Override + @ForceInline + final + ByteVector swapIfNeeded(AbstractSpecies srcSpecies) { + return this; + } + static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_BYTE_INDEX_SCALE); static final long ARRAY_BASE = @@ -4279,7 +4293,7 @@ public abstract class ByteVector extends AbstractVector { final ByteVector broadcastBits(long bits) { return (ByteVector) VectorSupport.fromBitsCoerced( - vectorType, byte.class, laneCount, + vectorType, laneTypeOrdinal(), laneCount, bits, MODE_BROADCAST, this, (bits_, s_) -> s_.rvOp(i -> bits_)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java index eaf77d59a23..f00efcf5163 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double128Vector.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 @@ -119,6 +119,13 @@ final class Double128Vector extends DoubleVector { return (double[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -516,7 +523,7 @@ final class Double128Vector extends DoubleVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { double[] vecarr = vec.vec(); @@ -537,7 +544,7 @@ final class Double128Vector extends DoubleVector { @ForceInline public Double128Vector withLaneHelper(int i, double e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Double.doubleToRawLongBits(e), (v, ix, bits) -> { double[] res = v.vec().clone(); @@ -641,8 +648,8 @@ final class Double128Vector extends DoubleVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -652,7 +659,7 @@ final class Double128Vector extends DoubleVector { /*package-private*/ Double128Mask indexPartiallyInUpperRange(long offset, long limit) { return (Double128Mask) VectorSupport.indexPartiallyInUpperRange( - Double128Mask.class, double.class, VLENGTH, offset, limit, + Double128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Double128Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -668,7 +675,7 @@ final class Double128Vector extends DoubleVector { @ForceInline public Double128Mask compress() { return (Double128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Double128Vector.class, Double128Mask.class, ETYPE, VLENGTH, null, this, + Double128Vector.class, Double128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -680,7 +687,7 @@ final class Double128Vector extends DoubleVector { public Double128Mask and(VectorMask mask) { Objects.requireNonNull(mask); Double128Mask m = (Double128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Double128Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Double128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -690,7 +697,7 @@ final class Double128Vector extends DoubleVector { public Double128Mask or(VectorMask mask) { Objects.requireNonNull(mask); Double128Mask m = (Double128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Double128Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Double128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -700,7 +707,7 @@ final class Double128Vector extends DoubleVector { public Double128Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Double128Mask m = (Double128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Double128Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Double128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -710,21 +717,21 @@ final class Double128Vector extends DoubleVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double128Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double128Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double128Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -734,7 +741,7 @@ final class Double128Vector extends DoubleVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Double128Mask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Double128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -744,7 +751,7 @@ final class Double128Vector extends DoubleVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Double128Mask.class, double.class, VLENGTH, + return VectorSupport.extract(Double128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -753,7 +760,7 @@ final class Double128Vector extends DoubleVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Double128Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, Double128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Double128Mask)m).getBits())); } @@ -761,7 +768,7 @@ final class Double128Vector extends DoubleVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Double128Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, Double128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Double128Mask)m).getBits())); } @@ -769,7 +776,7 @@ final class Double128Vector extends DoubleVector { @ForceInline /*package-private*/ static Double128Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Double128Mask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Double128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java index cf9c8794ce4..0f145bf06e2 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double256Vector.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 @@ -119,6 +119,13 @@ final class Double256Vector extends DoubleVector { return (double[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -518,7 +525,7 @@ final class Double256Vector extends DoubleVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { double[] vecarr = vec.vec(); @@ -541,7 +548,7 @@ final class Double256Vector extends DoubleVector { @ForceInline public Double256Vector withLaneHelper(int i, double e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Double.doubleToRawLongBits(e), (v, ix, bits) -> { double[] res = v.vec().clone(); @@ -645,8 +652,8 @@ final class Double256Vector extends DoubleVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -656,7 +663,7 @@ final class Double256Vector extends DoubleVector { /*package-private*/ Double256Mask indexPartiallyInUpperRange(long offset, long limit) { return (Double256Mask) VectorSupport.indexPartiallyInUpperRange( - Double256Mask.class, double.class, VLENGTH, offset, limit, + Double256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Double256Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -672,7 +679,7 @@ final class Double256Vector extends DoubleVector { @ForceInline public Double256Mask compress() { return (Double256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Double256Vector.class, Double256Mask.class, ETYPE, VLENGTH, null, this, + Double256Vector.class, Double256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -684,7 +691,7 @@ final class Double256Vector extends DoubleVector { public Double256Mask and(VectorMask mask) { Objects.requireNonNull(mask); Double256Mask m = (Double256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Double256Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Double256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -694,7 +701,7 @@ final class Double256Vector extends DoubleVector { public Double256Mask or(VectorMask mask) { Objects.requireNonNull(mask); Double256Mask m = (Double256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Double256Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Double256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -704,7 +711,7 @@ final class Double256Vector extends DoubleVector { public Double256Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Double256Mask m = (Double256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Double256Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Double256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -714,21 +721,21 @@ final class Double256Vector extends DoubleVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double256Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double256Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double256Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -738,7 +745,7 @@ final class Double256Vector extends DoubleVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Double256Mask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Double256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -748,7 +755,7 @@ final class Double256Vector extends DoubleVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Double256Mask.class, double.class, VLENGTH, + return VectorSupport.extract(Double256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -757,7 +764,7 @@ final class Double256Vector extends DoubleVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Double256Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, Double256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Double256Mask)m).getBits())); } @@ -765,7 +772,7 @@ final class Double256Vector extends DoubleVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Double256Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, Double256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Double256Mask)m).getBits())); } @@ -773,7 +780,7 @@ final class Double256Vector extends DoubleVector { @ForceInline /*package-private*/ static Double256Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Double256Mask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Double256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java index a7a86c25841..581a3ac7329 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double512Vector.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 @@ -119,6 +119,13 @@ final class Double512Vector extends DoubleVector { return (double[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -522,7 +529,7 @@ final class Double512Vector extends DoubleVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { double[] vecarr = vec.vec(); @@ -549,7 +556,7 @@ final class Double512Vector extends DoubleVector { @ForceInline public Double512Vector withLaneHelper(int i, double e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Double.doubleToRawLongBits(e), (v, ix, bits) -> { double[] res = v.vec().clone(); @@ -653,8 +660,8 @@ final class Double512Vector extends DoubleVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -664,7 +671,7 @@ final class Double512Vector extends DoubleVector { /*package-private*/ Double512Mask indexPartiallyInUpperRange(long offset, long limit) { return (Double512Mask) VectorSupport.indexPartiallyInUpperRange( - Double512Mask.class, double.class, VLENGTH, offset, limit, + Double512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Double512Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -680,7 +687,7 @@ final class Double512Vector extends DoubleVector { @ForceInline public Double512Mask compress() { return (Double512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Double512Vector.class, Double512Mask.class, ETYPE, VLENGTH, null, this, + Double512Vector.class, Double512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -692,7 +699,7 @@ final class Double512Vector extends DoubleVector { public Double512Mask and(VectorMask mask) { Objects.requireNonNull(mask); Double512Mask m = (Double512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Double512Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Double512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -702,7 +709,7 @@ final class Double512Vector extends DoubleVector { public Double512Mask or(VectorMask mask) { Objects.requireNonNull(mask); Double512Mask m = (Double512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Double512Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Double512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -712,7 +719,7 @@ final class Double512Vector extends DoubleVector { public Double512Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Double512Mask m = (Double512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Double512Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Double512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -722,21 +729,21 @@ final class Double512Vector extends DoubleVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double512Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double512Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double512Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -746,7 +753,7 @@ final class Double512Vector extends DoubleVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Double512Mask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Double512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -756,7 +763,7 @@ final class Double512Vector extends DoubleVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Double512Mask.class, double.class, VLENGTH, + return VectorSupport.extract(Double512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -765,7 +772,7 @@ final class Double512Vector extends DoubleVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Double512Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, Double512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Double512Mask)m).getBits())); } @@ -773,7 +780,7 @@ final class Double512Vector extends DoubleVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Double512Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, Double512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Double512Mask)m).getBits())); } @@ -781,7 +788,7 @@ final class Double512Vector extends DoubleVector { @ForceInline /*package-private*/ static Double512Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Double512Mask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Double512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java index df6b627cc18..9535f112ada 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Double64Vector.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 @@ -119,6 +119,13 @@ final class Double64Vector extends DoubleVector { return (double[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -515,7 +522,7 @@ final class Double64Vector extends DoubleVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { double[] vecarr = vec.vec(); @@ -535,7 +542,7 @@ final class Double64Vector extends DoubleVector { @ForceInline public Double64Vector withLaneHelper(int i, double e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Double.doubleToRawLongBits(e), (v, ix, bits) -> { double[] res = v.vec().clone(); @@ -639,8 +646,8 @@ final class Double64Vector extends DoubleVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -650,7 +657,7 @@ final class Double64Vector extends DoubleVector { /*package-private*/ Double64Mask indexPartiallyInUpperRange(long offset, long limit) { return (Double64Mask) VectorSupport.indexPartiallyInUpperRange( - Double64Mask.class, double.class, VLENGTH, offset, limit, + Double64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Double64Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -666,7 +673,7 @@ final class Double64Vector extends DoubleVector { @ForceInline public Double64Mask compress() { return (Double64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Double64Vector.class, Double64Mask.class, ETYPE, VLENGTH, null, this, + Double64Vector.class, Double64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -678,7 +685,7 @@ final class Double64Vector extends DoubleVector { public Double64Mask and(VectorMask mask) { Objects.requireNonNull(mask); Double64Mask m = (Double64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Double64Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Double64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -688,7 +695,7 @@ final class Double64Vector extends DoubleVector { public Double64Mask or(VectorMask mask) { Objects.requireNonNull(mask); Double64Mask m = (Double64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Double64Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Double64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -698,7 +705,7 @@ final class Double64Vector extends DoubleVector { public Double64Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Double64Mask m = (Double64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Double64Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Double64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -708,21 +715,21 @@ final class Double64Vector extends DoubleVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double64Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Double64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double64Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Double64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double64Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Double64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -732,7 +739,7 @@ final class Double64Vector extends DoubleVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Double64Mask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Double64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -742,7 +749,7 @@ final class Double64Vector extends DoubleVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Double64Mask.class, double.class, VLENGTH, + return VectorSupport.extract(Double64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -751,7 +758,7 @@ final class Double64Vector extends DoubleVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Double64Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, Double64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Double64Mask)m).getBits())); } @@ -759,7 +766,7 @@ final class Double64Vector extends DoubleVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Double64Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, Double64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Double64Mask)m).getBits())); } @@ -767,7 +774,7 @@ final class Double64Vector extends DoubleVector { @ForceInline /*package-private*/ static Double64Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Double64Mask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Double64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java index 47be1f609d8..8daa77dfc49 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleMaxVector.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 @@ -119,6 +119,13 @@ final class DoubleMaxVector extends DoubleVector { return (double[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -514,7 +521,7 @@ final class DoubleMaxVector extends DoubleVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { double[] vecarr = vec.vec(); @@ -534,7 +541,7 @@ final class DoubleMaxVector extends DoubleVector { @ForceInline public DoubleMaxVector withLaneHelper(int i, double e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Double.doubleToRawLongBits(e), (v, ix, bits) -> { double[] res = v.vec().clone(); @@ -638,8 +645,8 @@ final class DoubleMaxVector extends DoubleVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -649,7 +656,7 @@ final class DoubleMaxVector extends DoubleVector { /*package-private*/ DoubleMaxMask indexPartiallyInUpperRange(long offset, long limit) { return (DoubleMaxMask) VectorSupport.indexPartiallyInUpperRange( - DoubleMaxMask.class, double.class, VLENGTH, offset, limit, + DoubleMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (DoubleMaxMask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -665,7 +672,7 @@ final class DoubleMaxVector extends DoubleVector { @ForceInline public DoubleMaxMask compress() { return (DoubleMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - DoubleMaxVector.class, DoubleMaxMask.class, ETYPE, VLENGTH, null, this, + DoubleMaxVector.class, DoubleMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -677,7 +684,7 @@ final class DoubleMaxVector extends DoubleVector { public DoubleMaxMask and(VectorMask mask) { Objects.requireNonNull(mask); DoubleMaxMask m = (DoubleMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, DoubleMaxMask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, DoubleMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -687,7 +694,7 @@ final class DoubleMaxVector extends DoubleVector { public DoubleMaxMask or(VectorMask mask) { Objects.requireNonNull(mask); DoubleMaxMask m = (DoubleMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, DoubleMaxMask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, DoubleMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -697,7 +704,7 @@ final class DoubleMaxVector extends DoubleVector { public DoubleMaxMask xor(VectorMask mask) { Objects.requireNonNull(mask); DoubleMaxMask m = (DoubleMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, DoubleMaxMask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, DoubleMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -707,21 +714,21 @@ final class DoubleMaxVector extends DoubleVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, DoubleMaxMask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, DoubleMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, DoubleMaxMask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, DoubleMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, DoubleMaxMask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, DoubleMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -731,7 +738,7 @@ final class DoubleMaxVector extends DoubleVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, DoubleMaxMask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, DoubleMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -741,7 +748,7 @@ final class DoubleMaxVector extends DoubleVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(DoubleMaxMask.class, double.class, VLENGTH, + return VectorSupport.extract(DoubleMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -750,7 +757,7 @@ final class DoubleMaxVector extends DoubleVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, DoubleMaxMask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, DoubleMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((DoubleMaxMask)m).getBits())); } @@ -758,7 +765,7 @@ final class DoubleMaxVector extends DoubleVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, DoubleMaxMask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, DoubleMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((DoubleMaxMask)m).getBits())); } @@ -766,7 +773,7 @@ final class DoubleMaxVector extends DoubleVector { @ForceInline /*package-private*/ static DoubleMaxMask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(DoubleMaxMask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(DoubleMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java index 786cd089ebe..70be5f829f0 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.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 @@ -59,6 +59,10 @@ public abstract class DoubleVector extends AbstractVector { static final ValueLayout.OfDouble ELEMENT_LAYOUT = ValueLayout.JAVA_DOUBLE.withByteAlignment(1); + static final int LANE_TYPE_ORDINAL = LT_DOUBLE; + + static final int LANEBITS_TYPE_ORDINAL = LT_LONG; + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -562,7 +566,7 @@ public abstract class DoubleVector extends AbstractVector { @ForceInline public static DoubleVector zero(VectorSpecies species) { DoubleSpecies vsp = (DoubleSpecies) species; - return VectorSupport.fromBitsCoerced(vsp.vectorType(), double.class, species.length(), + return VectorSupport.fromBitsCoerced(vsp.vectorType(), LANE_TYPE_ORDINAL, species.length(), toBits(0.0f), MODE_BROADCAST, vsp, ((bits_, s_) -> s_.rvOp(i -> bits_))); } @@ -684,7 +688,7 @@ public abstract class DoubleVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), null, double.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, UN_IMPL.find(op, opc, DoubleVector::unaryOperations)); } @@ -712,7 +716,7 @@ public abstract class DoubleVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), maskClass, double.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, UN_IMPL.find(op, opc, DoubleVector::unaryOperations)); } @@ -801,7 +805,7 @@ public abstract class DoubleVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), null, double.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, null, BIN_IMPL.find(op, opc, DoubleVector::binaryOperations)); } @@ -839,7 +843,7 @@ public abstract class DoubleVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), maskClass, double.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, m, BIN_IMPL.find(op, opc, DoubleVector::binaryOperations)); } @@ -1021,7 +1025,7 @@ public abstract class DoubleVector extends AbstractVector { tother.check(this); int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), null, double.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, tother, null, TERN_IMPL.find(op, opc, DoubleVector::ternaryOperations)); } @@ -1056,7 +1060,7 @@ public abstract class DoubleVector extends AbstractVector { int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), maskClass, double.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, tother, m, TERN_IMPL.find(op, opc, DoubleVector::ternaryOperations)); } @@ -1928,7 +1932,7 @@ public abstract class DoubleVector extends AbstractVector { that.check(this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, double.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, null, (cond, v0, v1, m1) -> { AbstractMask m @@ -1950,7 +1954,7 @@ public abstract class DoubleVector extends AbstractVector { m.check(maskType, this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, double.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, m, (cond, v0, v1, m1) -> { AbstractMask cmpM @@ -2077,7 +2081,7 @@ public abstract class DoubleVector extends AbstractVector { blendTemplate(Class maskType, DoubleVector v, M m) { v.check(this); return VectorSupport.blend( - getClass(), maskType, double.class, length(), + getClass(), maskType, laneTypeOrdinal(), length(), this, v, m, (v0, v1, m_) -> v0.bOp(v1, m_, (i, a, b) -> b)); } @@ -2094,7 +2098,7 @@ public abstract class DoubleVector extends AbstractVector { // make sure VLENGTH*scale doesn't overflow: vsp.checkScale(scale); return VectorSupport.indexVector( - getClass(), double.class, length(), + getClass(), laneTypeOrdinal(), length(), this, scale, vsp, (v, scale_, s) -> { @@ -2286,7 +2290,7 @@ public abstract class DoubleVector extends AbstractVector { DoubleVector rearrangeTemplate(Class shuffletype, S shuffle) { Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( - getClass(), shuffletype, null, double.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2313,7 +2317,7 @@ public abstract class DoubleVector extends AbstractVector { Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( - getClass(), shuffletype, masktype, double.class, length(), + getClass(), shuffletype, masktype, laneTypeOrdinal(), length(), this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2339,7 +2343,7 @@ public abstract class DoubleVector extends AbstractVector { VectorMask valid = shuffle.laneIsValid(); DoubleVector r0 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, double.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); @@ -2347,7 +2351,7 @@ public abstract class DoubleVector extends AbstractVector { })); DoubleVector r1 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, double.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2391,7 +2395,7 @@ public abstract class DoubleVector extends AbstractVector { DoubleVector compressTemplate(Class masktype, M m) { m.check(masktype, this); return (DoubleVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, - double.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> compressHelper(v1, m1)); } @@ -2410,7 +2414,7 @@ public abstract class DoubleVector extends AbstractVector { DoubleVector expandTemplate(Class masktype, M m) { m.check(masktype, this); return (DoubleVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, - double.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> expandHelper(v1, m1)); } @@ -2425,7 +2429,7 @@ public abstract class DoubleVector extends AbstractVector { /*package-private*/ @ForceInline final DoubleVector selectFromTemplate(DoubleVector v) { - return (DoubleVector)VectorSupport.selectFromOp(getClass(), null, double.class, + return (DoubleVector)VectorSupport.selectFromOp(getClass(), null, laneTypeOrdinal(), length(), this, v, null, (v1, v2, _m) -> v2.rearrange(v1.toShuffle())); @@ -2445,7 +2449,7 @@ public abstract class DoubleVector extends AbstractVector { DoubleVector selectFromTemplate(DoubleVector v, Class masktype, M m) { m.check(masktype, this); - return (DoubleVector)VectorSupport.selectFromOp(getClass(), masktype, double.class, + return (DoubleVector)VectorSupport.selectFromOp(getClass(), masktype, laneTypeOrdinal(), length(), this, v, m, (v1, v2, _m) -> v2.rearrange(v1.toShuffle(), _m)); @@ -2463,7 +2467,7 @@ public abstract class DoubleVector extends AbstractVector { /*package-private*/ @ForceInline final DoubleVector selectFromTemplate(DoubleVector v1, DoubleVector v2) { - return VectorSupport.selectFromTwoVectorOp(getClass(), double.class, length(), this, v1, v2, + return VectorSupport.selectFromTwoVectorOp(getClass(), laneTypeOrdinal(), length(), this, v1, v2, (vec1, vec2, vec3) -> selectFromTwoVectorHelper(vec1, vec2, vec3)); } @@ -2661,7 +2665,7 @@ public abstract class DoubleVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), maskClass, double.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, REDUCE_IMPL.find(op, opc, DoubleVector::reductionOperations))); } @@ -2679,7 +2683,7 @@ public abstract class DoubleVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), null, double.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, REDUCE_IMPL.find(op, opc, DoubleVector::reductionOperations))); } @@ -2936,7 +2940,7 @@ public abstract class DoubleVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, null, double.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, null, a, offset, indexMap, mapOffset, vsp, @@ -3119,7 +3123,7 @@ public abstract class DoubleVector extends AbstractVector { offset = checkFromIndexSize(offset, length(), a.length); DoubleSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, @@ -3227,7 +3231,7 @@ public abstract class DoubleVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), null, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, null, @@ -3354,7 +3358,7 @@ public abstract class DoubleVector extends AbstractVector { DoubleVector fromArray0Template(double[] a, int offset) { DoubleSpecies vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -3371,7 +3375,7 @@ public abstract class DoubleVector extends AbstractVector { m.check(species()); DoubleSpecies vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -3422,7 +3426,7 @@ public abstract class DoubleVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, maskClass, double.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, m, a, offset, indexMap, mapOffset, vsp, @@ -3439,7 +3443,7 @@ public abstract class DoubleVector extends AbstractVector { DoubleVector fromMemorySegment0Template(MemorySegment ms, long offset) { DoubleSpecies vsp = vspecies(); return ScopedMemoryAccess.loadFromMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, vsp, (msp, off, s) -> { return s.ldLongOp((MemorySegment) msp, off, DoubleVector::memorySegmentGet); @@ -3455,7 +3459,7 @@ public abstract class DoubleVector extends AbstractVector { DoubleSpecies vsp = vspecies(); m.check(vsp); return ScopedMemoryAccess.loadFromMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, m, vsp, offsetInRange, (msp, off, s, vm) -> { return s.ldLongOp((MemorySegment) msp, off, vm, DoubleVector::memorySegmentGet); @@ -3473,7 +3477,7 @@ public abstract class DoubleVector extends AbstractVector { void intoArray0Template(double[] a, int offset) { DoubleSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, (arr, off, v) @@ -3490,7 +3494,7 @@ public abstract class DoubleVector extends AbstractVector { m.check(species()); DoubleSpecies vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -3538,7 +3542,7 @@ public abstract class DoubleVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, m, @@ -3557,7 +3561,7 @@ public abstract class DoubleVector extends AbstractVector { void intoMemorySegment0(MemorySegment ms, long offset) { DoubleSpecies vsp = vspecies(); ScopedMemoryAccess.storeIntoMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), this, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v) -> { @@ -3574,7 +3578,7 @@ public abstract class DoubleVector extends AbstractVector { DoubleSpecies vsp = vspecies(); m.check(vsp); ScopedMemoryAccess.storeIntoMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), this, m, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v, vm) -> { @@ -3612,6 +3616,18 @@ public abstract class DoubleVector extends AbstractVector { return this; } + @Override + @ForceInline + final + DoubleVector swapIfNeeded(AbstractSpecies srcSpecies) { + int subLanesPerSrc = subLanesToSwap(srcSpecies); + if (subLanesPerSrc < 0) { + return this; + } + VectorShuffle shuffle = normalizeSubLanesForSpecies(this.vspecies(), subLanesPerSrc); + return (DoubleVector) this.rearrange(shuffle); + } + static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_DOUBLE_INDEX_SCALE); static final long ARRAY_BASE = @@ -3778,7 +3794,7 @@ public abstract class DoubleVector extends AbstractVector { final DoubleVector broadcastBits(long bits) { return (DoubleVector) VectorSupport.fromBitsCoerced( - vectorType, double.class, laneCount, + vectorType, laneTypeOrdinal(), laneCount, bits, MODE_BROADCAST, this, (bits_, s_) -> s_.rvOp(i -> bits_)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java index fdfd234cb47..62c7d535fc7 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float128Vector.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 @@ -119,6 +119,13 @@ final class Float128Vector extends FloatVector { return (float[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -518,7 +525,7 @@ final class Float128Vector extends FloatVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { float[] vecarr = vec.vec(); @@ -541,7 +548,7 @@ final class Float128Vector extends FloatVector { @ForceInline public Float128Vector withLaneHelper(int i, float e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Float.floatToRawIntBits(e), (v, ix, bits) -> { float[] res = v.vec().clone(); @@ -645,8 +652,8 @@ final class Float128Vector extends FloatVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -656,7 +663,7 @@ final class Float128Vector extends FloatVector { /*package-private*/ Float128Mask indexPartiallyInUpperRange(long offset, long limit) { return (Float128Mask) VectorSupport.indexPartiallyInUpperRange( - Float128Mask.class, float.class, VLENGTH, offset, limit, + Float128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Float128Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -672,7 +679,7 @@ final class Float128Vector extends FloatVector { @ForceInline public Float128Mask compress() { return (Float128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Float128Vector.class, Float128Mask.class, ETYPE, VLENGTH, null, this, + Float128Vector.class, Float128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -684,7 +691,7 @@ final class Float128Vector extends FloatVector { public Float128Mask and(VectorMask mask) { Objects.requireNonNull(mask); Float128Mask m = (Float128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Float128Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Float128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -694,7 +701,7 @@ final class Float128Vector extends FloatVector { public Float128Mask or(VectorMask mask) { Objects.requireNonNull(mask); Float128Mask m = (Float128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Float128Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Float128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -704,7 +711,7 @@ final class Float128Vector extends FloatVector { public Float128Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Float128Mask m = (Float128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Float128Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Float128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -714,21 +721,21 @@ final class Float128Vector extends FloatVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float128Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float128Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float128Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -738,7 +745,7 @@ final class Float128Vector extends FloatVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Float128Mask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Float128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -748,7 +755,7 @@ final class Float128Vector extends FloatVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Float128Mask.class, float.class, VLENGTH, + return VectorSupport.extract(Float128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -757,7 +764,7 @@ final class Float128Vector extends FloatVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Float128Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, Float128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Float128Mask)m).getBits())); } @@ -765,7 +772,7 @@ final class Float128Vector extends FloatVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Float128Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, Float128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Float128Mask)m).getBits())); } @@ -773,7 +780,7 @@ final class Float128Vector extends FloatVector { @ForceInline /*package-private*/ static Float128Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Float128Mask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Float128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java index 335cbef2331..dfdd2a304c6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java @@ -260,6 +260,9 @@ public final class Float16 * Float#toString(float)} in the handling of special values * (signed zeros, infinities, and NaN) and the generation of a * decimal string that will convert back to the argument value. + * However, the range for plain notation is defined to be the interval + * [10-3, 103) rather than the interval used + * for {@code float} and {@code double}. * * @param f16 the {@code Float16} to be converted. * @return a string representation of the argument. @@ -2106,7 +2109,7 @@ public final class Float16 int h = (int) (f * 107_375L >>> 30); int l = f - 10_000 * h; - if (0 < e && e <= 7) { + if (0 < e && e <= 3) { return toChars1(h, l, e); } if (-3 < e && e <= 0) { diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java index 2543382ca14..f41194500f9 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float256Vector.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 @@ -119,6 +119,13 @@ final class Float256Vector extends FloatVector { return (float[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -522,7 +529,7 @@ final class Float256Vector extends FloatVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { float[] vecarr = vec.vec(); @@ -549,7 +556,7 @@ final class Float256Vector extends FloatVector { @ForceInline public Float256Vector withLaneHelper(int i, float e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Float.floatToRawIntBits(e), (v, ix, bits) -> { float[] res = v.vec().clone(); @@ -653,8 +660,8 @@ final class Float256Vector extends FloatVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -664,7 +671,7 @@ final class Float256Vector extends FloatVector { /*package-private*/ Float256Mask indexPartiallyInUpperRange(long offset, long limit) { return (Float256Mask) VectorSupport.indexPartiallyInUpperRange( - Float256Mask.class, float.class, VLENGTH, offset, limit, + Float256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Float256Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -680,7 +687,7 @@ final class Float256Vector extends FloatVector { @ForceInline public Float256Mask compress() { return (Float256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Float256Vector.class, Float256Mask.class, ETYPE, VLENGTH, null, this, + Float256Vector.class, Float256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -692,7 +699,7 @@ final class Float256Vector extends FloatVector { public Float256Mask and(VectorMask mask) { Objects.requireNonNull(mask); Float256Mask m = (Float256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Float256Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Float256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -702,7 +709,7 @@ final class Float256Vector extends FloatVector { public Float256Mask or(VectorMask mask) { Objects.requireNonNull(mask); Float256Mask m = (Float256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Float256Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Float256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -712,7 +719,7 @@ final class Float256Vector extends FloatVector { public Float256Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Float256Mask m = (Float256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Float256Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Float256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -722,21 +729,21 @@ final class Float256Vector extends FloatVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float256Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float256Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float256Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -746,7 +753,7 @@ final class Float256Vector extends FloatVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Float256Mask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Float256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -756,7 +763,7 @@ final class Float256Vector extends FloatVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Float256Mask.class, float.class, VLENGTH, + return VectorSupport.extract(Float256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -765,7 +772,7 @@ final class Float256Vector extends FloatVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Float256Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, Float256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Float256Mask)m).getBits())); } @@ -773,7 +780,7 @@ final class Float256Vector extends FloatVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Float256Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, Float256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Float256Mask)m).getBits())); } @@ -781,7 +788,7 @@ final class Float256Vector extends FloatVector { @ForceInline /*package-private*/ static Float256Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Float256Mask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Float256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java index 627b1e0a237..c2fced0fdae 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float512Vector.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 @@ -119,6 +119,13 @@ final class Float512Vector extends FloatVector { return (float[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -530,7 +537,7 @@ final class Float512Vector extends FloatVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { float[] vecarr = vec.vec(); @@ -565,7 +572,7 @@ final class Float512Vector extends FloatVector { @ForceInline public Float512Vector withLaneHelper(int i, float e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Float.floatToRawIntBits(e), (v, ix, bits) -> { float[] res = v.vec().clone(); @@ -669,8 +676,8 @@ final class Float512Vector extends FloatVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -680,7 +687,7 @@ final class Float512Vector extends FloatVector { /*package-private*/ Float512Mask indexPartiallyInUpperRange(long offset, long limit) { return (Float512Mask) VectorSupport.indexPartiallyInUpperRange( - Float512Mask.class, float.class, VLENGTH, offset, limit, + Float512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Float512Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -696,7 +703,7 @@ final class Float512Vector extends FloatVector { @ForceInline public Float512Mask compress() { return (Float512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Float512Vector.class, Float512Mask.class, ETYPE, VLENGTH, null, this, + Float512Vector.class, Float512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -708,7 +715,7 @@ final class Float512Vector extends FloatVector { public Float512Mask and(VectorMask mask) { Objects.requireNonNull(mask); Float512Mask m = (Float512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Float512Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Float512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -718,7 +725,7 @@ final class Float512Vector extends FloatVector { public Float512Mask or(VectorMask mask) { Objects.requireNonNull(mask); Float512Mask m = (Float512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Float512Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Float512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -728,7 +735,7 @@ final class Float512Vector extends FloatVector { public Float512Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Float512Mask m = (Float512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Float512Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Float512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -738,21 +745,21 @@ final class Float512Vector extends FloatVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float512Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float512Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float512Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -762,7 +769,7 @@ final class Float512Vector extends FloatVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Float512Mask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Float512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -772,7 +779,7 @@ final class Float512Vector extends FloatVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Float512Mask.class, float.class, VLENGTH, + return VectorSupport.extract(Float512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -781,7 +788,7 @@ final class Float512Vector extends FloatVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Float512Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, Float512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Float512Mask)m).getBits())); } @@ -789,7 +796,7 @@ final class Float512Vector extends FloatVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Float512Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, Float512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Float512Mask)m).getBits())); } @@ -797,7 +804,7 @@ final class Float512Vector extends FloatVector { @ForceInline /*package-private*/ static Float512Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Float512Mask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Float512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java index 3360fdb537a..67676c828d6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float64Vector.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 @@ -119,6 +119,13 @@ final class Float64Vector extends FloatVector { return (float[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -516,7 +523,7 @@ final class Float64Vector extends FloatVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { float[] vecarr = vec.vec(); @@ -537,7 +544,7 @@ final class Float64Vector extends FloatVector { @ForceInline public Float64Vector withLaneHelper(int i, float e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Float.floatToRawIntBits(e), (v, ix, bits) -> { float[] res = v.vec().clone(); @@ -641,8 +648,8 @@ final class Float64Vector extends FloatVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -652,7 +659,7 @@ final class Float64Vector extends FloatVector { /*package-private*/ Float64Mask indexPartiallyInUpperRange(long offset, long limit) { return (Float64Mask) VectorSupport.indexPartiallyInUpperRange( - Float64Mask.class, float.class, VLENGTH, offset, limit, + Float64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Float64Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -668,7 +675,7 @@ final class Float64Vector extends FloatVector { @ForceInline public Float64Mask compress() { return (Float64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Float64Vector.class, Float64Mask.class, ETYPE, VLENGTH, null, this, + Float64Vector.class, Float64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -680,7 +687,7 @@ final class Float64Vector extends FloatVector { public Float64Mask and(VectorMask mask) { Objects.requireNonNull(mask); Float64Mask m = (Float64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Float64Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Float64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -690,7 +697,7 @@ final class Float64Vector extends FloatVector { public Float64Mask or(VectorMask mask) { Objects.requireNonNull(mask); Float64Mask m = (Float64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Float64Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Float64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -700,7 +707,7 @@ final class Float64Vector extends FloatVector { public Float64Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Float64Mask m = (Float64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Float64Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Float64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -710,21 +717,21 @@ final class Float64Vector extends FloatVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float64Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Float64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float64Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Float64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float64Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Float64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -734,7 +741,7 @@ final class Float64Vector extends FloatVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Float64Mask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Float64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -744,7 +751,7 @@ final class Float64Vector extends FloatVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Float64Mask.class, float.class, VLENGTH, + return VectorSupport.extract(Float64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -753,7 +760,7 @@ final class Float64Vector extends FloatVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Float64Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, Float64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Float64Mask)m).getBits())); } @@ -761,7 +768,7 @@ final class Float64Vector extends FloatVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Float64Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, Float64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Float64Mask)m).getBits())); } @@ -769,7 +776,7 @@ final class Float64Vector extends FloatVector { @ForceInline /*package-private*/ static Float64Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Float64Mask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Float64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java index 4a72661ce8b..35e4c83ebde 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatMaxVector.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 @@ -119,6 +119,13 @@ final class FloatMaxVector extends FloatVector { return (float[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -514,7 +521,7 @@ final class FloatMaxVector extends FloatVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { float[] vecarr = vec.vec(); @@ -534,7 +541,7 @@ final class FloatMaxVector extends FloatVector { @ForceInline public FloatMaxVector withLaneHelper(int i, float e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)Float.floatToRawIntBits(e), (v, ix, bits) -> { float[] res = v.vec().clone(); @@ -638,8 +645,8 @@ final class FloatMaxVector extends FloatVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -649,7 +656,7 @@ final class FloatMaxVector extends FloatVector { /*package-private*/ FloatMaxMask indexPartiallyInUpperRange(long offset, long limit) { return (FloatMaxMask) VectorSupport.indexPartiallyInUpperRange( - FloatMaxMask.class, float.class, VLENGTH, offset, limit, + FloatMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (FloatMaxMask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -665,7 +672,7 @@ final class FloatMaxVector extends FloatVector { @ForceInline public FloatMaxMask compress() { return (FloatMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - FloatMaxVector.class, FloatMaxMask.class, ETYPE, VLENGTH, null, this, + FloatMaxVector.class, FloatMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -677,7 +684,7 @@ final class FloatMaxVector extends FloatVector { public FloatMaxMask and(VectorMask mask) { Objects.requireNonNull(mask); FloatMaxMask m = (FloatMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, FloatMaxMask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, FloatMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -687,7 +694,7 @@ final class FloatMaxVector extends FloatVector { public FloatMaxMask or(VectorMask mask) { Objects.requireNonNull(mask); FloatMaxMask m = (FloatMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, FloatMaxMask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, FloatMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -697,7 +704,7 @@ final class FloatMaxVector extends FloatVector { public FloatMaxMask xor(VectorMask mask) { Objects.requireNonNull(mask); FloatMaxMask m = (FloatMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, FloatMaxMask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, FloatMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -707,21 +714,21 @@ final class FloatMaxVector extends FloatVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, FloatMaxMask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, FloatMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, FloatMaxMask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, FloatMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, FloatMaxMask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, FloatMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -731,7 +738,7 @@ final class FloatMaxVector extends FloatVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, FloatMaxMask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, FloatMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -741,7 +748,7 @@ final class FloatMaxVector extends FloatVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(FloatMaxMask.class, float.class, VLENGTH, + return VectorSupport.extract(FloatMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -750,7 +757,7 @@ final class FloatMaxVector extends FloatVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, FloatMaxMask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, FloatMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((FloatMaxMask)m).getBits())); } @@ -758,7 +765,7 @@ final class FloatMaxVector extends FloatVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, FloatMaxMask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, FloatMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((FloatMaxMask)m).getBits())); } @@ -766,7 +773,7 @@ final class FloatMaxVector extends FloatVector { @ForceInline /*package-private*/ static FloatMaxMask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(FloatMaxMask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(FloatMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java index b481d5a51d7..ee9cb9119fd 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.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 @@ -59,6 +59,10 @@ public abstract class FloatVector extends AbstractVector { static final ValueLayout.OfFloat ELEMENT_LAYOUT = ValueLayout.JAVA_FLOAT.withByteAlignment(1); + static final int LANE_TYPE_ORDINAL = LT_FLOAT; + + static final int LANEBITS_TYPE_ORDINAL = LT_INT; + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -562,7 +566,7 @@ public abstract class FloatVector extends AbstractVector { @ForceInline public static FloatVector zero(VectorSpecies species) { FloatSpecies vsp = (FloatSpecies) species; - return VectorSupport.fromBitsCoerced(vsp.vectorType(), float.class, species.length(), + return VectorSupport.fromBitsCoerced(vsp.vectorType(), LANE_TYPE_ORDINAL, species.length(), toBits(0.0f), MODE_BROADCAST, vsp, ((bits_, s_) -> s_.rvOp(i -> bits_))); } @@ -684,7 +688,7 @@ public abstract class FloatVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), null, float.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, UN_IMPL.find(op, opc, FloatVector::unaryOperations)); } @@ -712,7 +716,7 @@ public abstract class FloatVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), maskClass, float.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, UN_IMPL.find(op, opc, FloatVector::unaryOperations)); } @@ -801,7 +805,7 @@ public abstract class FloatVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), null, float.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, null, BIN_IMPL.find(op, opc, FloatVector::binaryOperations)); } @@ -839,7 +843,7 @@ public abstract class FloatVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), maskClass, float.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, m, BIN_IMPL.find(op, opc, FloatVector::binaryOperations)); } @@ -1021,7 +1025,7 @@ public abstract class FloatVector extends AbstractVector { tother.check(this); int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), null, float.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, tother, null, TERN_IMPL.find(op, opc, FloatVector::ternaryOperations)); } @@ -1056,7 +1060,7 @@ public abstract class FloatVector extends AbstractVector { int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), maskClass, float.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, tother, m, TERN_IMPL.find(op, opc, FloatVector::ternaryOperations)); } @@ -1940,7 +1944,7 @@ public abstract class FloatVector extends AbstractVector { that.check(this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, float.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, null, (cond, v0, v1, m1) -> { AbstractMask m @@ -1962,7 +1966,7 @@ public abstract class FloatVector extends AbstractVector { m.check(maskType, this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, float.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, m, (cond, v0, v1, m1) -> { AbstractMask cmpM @@ -2089,7 +2093,7 @@ public abstract class FloatVector extends AbstractVector { blendTemplate(Class maskType, FloatVector v, M m) { v.check(this); return VectorSupport.blend( - getClass(), maskType, float.class, length(), + getClass(), maskType, laneTypeOrdinal(), length(), this, v, m, (v0, v1, m_) -> v0.bOp(v1, m_, (i, a, b) -> b)); } @@ -2106,7 +2110,7 @@ public abstract class FloatVector extends AbstractVector { // make sure VLENGTH*scale doesn't overflow: vsp.checkScale(scale); return VectorSupport.indexVector( - getClass(), float.class, length(), + getClass(), laneTypeOrdinal(), length(), this, scale, vsp, (v, scale_, s) -> { @@ -2298,7 +2302,7 @@ public abstract class FloatVector extends AbstractVector { FloatVector rearrangeTemplate(Class shuffletype, S shuffle) { Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( - getClass(), shuffletype, null, float.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2325,7 +2329,7 @@ public abstract class FloatVector extends AbstractVector { Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( - getClass(), shuffletype, masktype, float.class, length(), + getClass(), shuffletype, masktype, laneTypeOrdinal(), length(), this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2351,7 +2355,7 @@ public abstract class FloatVector extends AbstractVector { VectorMask valid = shuffle.laneIsValid(); FloatVector r0 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, float.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); @@ -2359,7 +2363,7 @@ public abstract class FloatVector extends AbstractVector { })); FloatVector r1 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, float.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2403,7 +2407,7 @@ public abstract class FloatVector extends AbstractVector { FloatVector compressTemplate(Class masktype, M m) { m.check(masktype, this); return (FloatVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, - float.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> compressHelper(v1, m1)); } @@ -2422,7 +2426,7 @@ public abstract class FloatVector extends AbstractVector { FloatVector expandTemplate(Class masktype, M m) { m.check(masktype, this); return (FloatVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, - float.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> expandHelper(v1, m1)); } @@ -2437,7 +2441,7 @@ public abstract class FloatVector extends AbstractVector { /*package-private*/ @ForceInline final FloatVector selectFromTemplate(FloatVector v) { - return (FloatVector)VectorSupport.selectFromOp(getClass(), null, float.class, + return (FloatVector)VectorSupport.selectFromOp(getClass(), null, laneTypeOrdinal(), length(), this, v, null, (v1, v2, _m) -> v2.rearrange(v1.toShuffle())); @@ -2457,7 +2461,7 @@ public abstract class FloatVector extends AbstractVector { FloatVector selectFromTemplate(FloatVector v, Class masktype, M m) { m.check(masktype, this); - return (FloatVector)VectorSupport.selectFromOp(getClass(), masktype, float.class, + return (FloatVector)VectorSupport.selectFromOp(getClass(), masktype, laneTypeOrdinal(), length(), this, v, m, (v1, v2, _m) -> v2.rearrange(v1.toShuffle(), _m)); @@ -2475,7 +2479,7 @@ public abstract class FloatVector extends AbstractVector { /*package-private*/ @ForceInline final FloatVector selectFromTemplate(FloatVector v1, FloatVector v2) { - return VectorSupport.selectFromTwoVectorOp(getClass(), float.class, length(), this, v1, v2, + return VectorSupport.selectFromTwoVectorOp(getClass(), laneTypeOrdinal(), length(), this, v1, v2, (vec1, vec2, vec3) -> selectFromTwoVectorHelper(vec1, vec2, vec3)); } @@ -2681,7 +2685,7 @@ public abstract class FloatVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), maskClass, float.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, REDUCE_IMPL.find(op, opc, FloatVector::reductionOperations))); } @@ -2699,7 +2703,7 @@ public abstract class FloatVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), null, float.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, REDUCE_IMPL.find(op, opc, FloatVector::reductionOperations))); } @@ -2942,7 +2946,7 @@ public abstract class FloatVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, null, float.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, null, a, offset, indexMap, mapOffset, vsp, @@ -3125,7 +3129,7 @@ public abstract class FloatVector extends AbstractVector { offset = checkFromIndexSize(offset, length(), a.length); FloatSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, @@ -3214,7 +3218,7 @@ public abstract class FloatVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), null, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, null, @@ -3341,7 +3345,7 @@ public abstract class FloatVector extends AbstractVector { FloatVector fromArray0Template(float[] a, int offset) { FloatSpecies vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -3358,7 +3362,7 @@ public abstract class FloatVector extends AbstractVector { m.check(species()); FloatSpecies vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -3391,7 +3395,7 @@ public abstract class FloatVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, maskClass, float.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, m, a, offset, indexMap, mapOffset, vsp, @@ -3408,7 +3412,7 @@ public abstract class FloatVector extends AbstractVector { FloatVector fromMemorySegment0Template(MemorySegment ms, long offset) { FloatSpecies vsp = vspecies(); return ScopedMemoryAccess.loadFromMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, vsp, (msp, off, s) -> { return s.ldLongOp((MemorySegment) msp, off, FloatVector::memorySegmentGet); @@ -3424,7 +3428,7 @@ public abstract class FloatVector extends AbstractVector { FloatSpecies vsp = vspecies(); m.check(vsp); return ScopedMemoryAccess.loadFromMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, m, vsp, offsetInRange, (msp, off, s, vm) -> { return s.ldLongOp((MemorySegment) msp, off, vm, FloatVector::memorySegmentGet); @@ -3442,7 +3446,7 @@ public abstract class FloatVector extends AbstractVector { void intoArray0Template(float[] a, int offset) { FloatSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, (arr, off, v) @@ -3459,7 +3463,7 @@ public abstract class FloatVector extends AbstractVector { m.check(species()); FloatSpecies vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -3488,7 +3492,7 @@ public abstract class FloatVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, m, @@ -3507,7 +3511,7 @@ public abstract class FloatVector extends AbstractVector { void intoMemorySegment0(MemorySegment ms, long offset) { FloatSpecies vsp = vspecies(); ScopedMemoryAccess.storeIntoMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), this, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v) -> { @@ -3524,7 +3528,7 @@ public abstract class FloatVector extends AbstractVector { FloatSpecies vsp = vspecies(); m.check(vsp); ScopedMemoryAccess.storeIntoMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), this, m, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v, vm) -> { @@ -3562,6 +3566,18 @@ public abstract class FloatVector extends AbstractVector { return this; } + @Override + @ForceInline + final + FloatVector swapIfNeeded(AbstractSpecies srcSpecies) { + int subLanesPerSrc = subLanesToSwap(srcSpecies); + if (subLanesPerSrc < 0) { + return this; + } + VectorShuffle shuffle = normalizeSubLanesForSpecies(this.vspecies(), subLanesPerSrc); + return (FloatVector) this.rearrange(shuffle); + } + static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_FLOAT_INDEX_SCALE); static final long ARRAY_BASE = @@ -3728,7 +3744,7 @@ public abstract class FloatVector extends AbstractVector { final FloatVector broadcastBits(long bits) { return (FloatVector) VectorSupport.fromBitsCoerced( - vectorType, float.class, laneCount, + vectorType, laneTypeOrdinal(), laneCount, bits, MODE_BROADCAST, this, (bits_, s_) -> s_.rvOp(i -> bits_)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java index edf45b8772a..17e93dbd06a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int128Vector.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 @@ -119,6 +119,13 @@ final class Int128Vector extends IntVector { return (int[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -529,7 +536,7 @@ final class Int128Vector extends IntVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { int[] vecarr = vec.vec(); @@ -552,7 +559,7 @@ final class Int128Vector extends IntVector { @ForceInline public Int128Vector withLaneHelper(int i, int e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { int[] res = v.vec().clone(); @@ -656,8 +663,8 @@ final class Int128Vector extends IntVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -667,7 +674,7 @@ final class Int128Vector extends IntVector { /*package-private*/ Int128Mask indexPartiallyInUpperRange(long offset, long limit) { return (Int128Mask) VectorSupport.indexPartiallyInUpperRange( - Int128Mask.class, int.class, VLENGTH, offset, limit, + Int128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Int128Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -683,7 +690,7 @@ final class Int128Vector extends IntVector { @ForceInline public Int128Mask compress() { return (Int128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Int128Vector.class, Int128Mask.class, ETYPE, VLENGTH, null, this, + Int128Vector.class, Int128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -695,7 +702,7 @@ final class Int128Vector extends IntVector { public Int128Mask and(VectorMask mask) { Objects.requireNonNull(mask); Int128Mask m = (Int128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Int128Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Int128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -705,7 +712,7 @@ final class Int128Vector extends IntVector { public Int128Mask or(VectorMask mask) { Objects.requireNonNull(mask); Int128Mask m = (Int128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Int128Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Int128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -715,7 +722,7 @@ final class Int128Vector extends IntVector { public Int128Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Int128Mask m = (Int128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Int128Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Int128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -725,21 +732,21 @@ final class Int128Vector extends IntVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int128Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int128Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int128Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -749,7 +756,7 @@ final class Int128Vector extends IntVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Int128Mask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Int128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -759,7 +766,7 @@ final class Int128Vector extends IntVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Int128Mask.class, int.class, VLENGTH, + return VectorSupport.extract(Int128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -768,7 +775,7 @@ final class Int128Vector extends IntVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Int128Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, Int128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Int128Mask)m).getBits())); } @@ -776,7 +783,7 @@ final class Int128Vector extends IntVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Int128Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, Int128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Int128Mask)m).getBits())); } @@ -784,7 +791,7 @@ final class Int128Vector extends IntVector { @ForceInline /*package-private*/ static Int128Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Int128Mask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Int128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java index bb86ede05e1..f9700fbfd71 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int256Vector.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 @@ -119,6 +119,13 @@ final class Int256Vector extends IntVector { return (int[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -533,7 +540,7 @@ final class Int256Vector extends IntVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { int[] vecarr = vec.vec(); @@ -560,7 +567,7 @@ final class Int256Vector extends IntVector { @ForceInline public Int256Vector withLaneHelper(int i, int e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { int[] res = v.vec().clone(); @@ -664,8 +671,8 @@ final class Int256Vector extends IntVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -675,7 +682,7 @@ final class Int256Vector extends IntVector { /*package-private*/ Int256Mask indexPartiallyInUpperRange(long offset, long limit) { return (Int256Mask) VectorSupport.indexPartiallyInUpperRange( - Int256Mask.class, int.class, VLENGTH, offset, limit, + Int256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Int256Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -691,7 +698,7 @@ final class Int256Vector extends IntVector { @ForceInline public Int256Mask compress() { return (Int256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Int256Vector.class, Int256Mask.class, ETYPE, VLENGTH, null, this, + Int256Vector.class, Int256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -703,7 +710,7 @@ final class Int256Vector extends IntVector { public Int256Mask and(VectorMask mask) { Objects.requireNonNull(mask); Int256Mask m = (Int256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Int256Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Int256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -713,7 +720,7 @@ final class Int256Vector extends IntVector { public Int256Mask or(VectorMask mask) { Objects.requireNonNull(mask); Int256Mask m = (Int256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Int256Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Int256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -723,7 +730,7 @@ final class Int256Vector extends IntVector { public Int256Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Int256Mask m = (Int256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Int256Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Int256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -733,21 +740,21 @@ final class Int256Vector extends IntVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int256Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int256Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int256Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -757,7 +764,7 @@ final class Int256Vector extends IntVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Int256Mask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Int256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -767,7 +774,7 @@ final class Int256Vector extends IntVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Int256Mask.class, int.class, VLENGTH, + return VectorSupport.extract(Int256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -776,7 +783,7 @@ final class Int256Vector extends IntVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Int256Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, Int256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Int256Mask)m).getBits())); } @@ -784,7 +791,7 @@ final class Int256Vector extends IntVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Int256Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, Int256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Int256Mask)m).getBits())); } @@ -792,7 +799,7 @@ final class Int256Vector extends IntVector { @ForceInline /*package-private*/ static Int256Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Int256Mask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Int256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java index 16d3b673da0..2e2ee7eac05 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int512Vector.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 @@ -119,6 +119,13 @@ final class Int512Vector extends IntVector { return (int[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -541,7 +548,7 @@ final class Int512Vector extends IntVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { int[] vecarr = vec.vec(); @@ -576,7 +583,7 @@ final class Int512Vector extends IntVector { @ForceInline public Int512Vector withLaneHelper(int i, int e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { int[] res = v.vec().clone(); @@ -680,8 +687,8 @@ final class Int512Vector extends IntVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -691,7 +698,7 @@ final class Int512Vector extends IntVector { /*package-private*/ Int512Mask indexPartiallyInUpperRange(long offset, long limit) { return (Int512Mask) VectorSupport.indexPartiallyInUpperRange( - Int512Mask.class, int.class, VLENGTH, offset, limit, + Int512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Int512Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -707,7 +714,7 @@ final class Int512Vector extends IntVector { @ForceInline public Int512Mask compress() { return (Int512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Int512Vector.class, Int512Mask.class, ETYPE, VLENGTH, null, this, + Int512Vector.class, Int512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -719,7 +726,7 @@ final class Int512Vector extends IntVector { public Int512Mask and(VectorMask mask) { Objects.requireNonNull(mask); Int512Mask m = (Int512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Int512Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Int512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -729,7 +736,7 @@ final class Int512Vector extends IntVector { public Int512Mask or(VectorMask mask) { Objects.requireNonNull(mask); Int512Mask m = (Int512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Int512Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Int512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -739,7 +746,7 @@ final class Int512Vector extends IntVector { public Int512Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Int512Mask m = (Int512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Int512Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Int512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -749,21 +756,21 @@ final class Int512Vector extends IntVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int512Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int512Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int512Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -773,7 +780,7 @@ final class Int512Vector extends IntVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Int512Mask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Int512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -783,7 +790,7 @@ final class Int512Vector extends IntVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Int512Mask.class, int.class, VLENGTH, + return VectorSupport.extract(Int512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -792,7 +799,7 @@ final class Int512Vector extends IntVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Int512Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, Int512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Int512Mask)m).getBits())); } @@ -800,7 +807,7 @@ final class Int512Vector extends IntVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Int512Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, Int512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Int512Mask)m).getBits())); } @@ -808,7 +815,7 @@ final class Int512Vector extends IntVector { @ForceInline /*package-private*/ static Int512Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Int512Mask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Int512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java index d55364a8d67..8338799c61a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Int64Vector.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 @@ -119,6 +119,13 @@ final class Int64Vector extends IntVector { return (int[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -527,7 +534,7 @@ final class Int64Vector extends IntVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { int[] vecarr = vec.vec(); @@ -548,7 +555,7 @@ final class Int64Vector extends IntVector { @ForceInline public Int64Vector withLaneHelper(int i, int e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { int[] res = v.vec().clone(); @@ -652,8 +659,8 @@ final class Int64Vector extends IntVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -663,7 +670,7 @@ final class Int64Vector extends IntVector { /*package-private*/ Int64Mask indexPartiallyInUpperRange(long offset, long limit) { return (Int64Mask) VectorSupport.indexPartiallyInUpperRange( - Int64Mask.class, int.class, VLENGTH, offset, limit, + Int64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Int64Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -679,7 +686,7 @@ final class Int64Vector extends IntVector { @ForceInline public Int64Mask compress() { return (Int64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Int64Vector.class, Int64Mask.class, ETYPE, VLENGTH, null, this, + Int64Vector.class, Int64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -691,7 +698,7 @@ final class Int64Vector extends IntVector { public Int64Mask and(VectorMask mask) { Objects.requireNonNull(mask); Int64Mask m = (Int64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Int64Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Int64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -701,7 +708,7 @@ final class Int64Vector extends IntVector { public Int64Mask or(VectorMask mask) { Objects.requireNonNull(mask); Int64Mask m = (Int64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Int64Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Int64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -711,7 +718,7 @@ final class Int64Vector extends IntVector { public Int64Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Int64Mask m = (Int64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Int64Mask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Int64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -721,21 +728,21 @@ final class Int64Vector extends IntVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int64Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Int64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int64Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Int64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int64Mask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Int64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -745,7 +752,7 @@ final class Int64Vector extends IntVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Int64Mask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Int64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -755,7 +762,7 @@ final class Int64Vector extends IntVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Int64Mask.class, int.class, VLENGTH, + return VectorSupport.extract(Int64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -764,7 +771,7 @@ final class Int64Vector extends IntVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Int64Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, Int64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Int64Mask)m).getBits())); } @@ -772,7 +779,7 @@ final class Int64Vector extends IntVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Int64Mask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, Int64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Int64Mask)m).getBits())); } @@ -780,7 +787,7 @@ final class Int64Vector extends IntVector { @ForceInline /*package-private*/ static Int64Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Int64Mask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Int64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java index 0a1cd45eb93..177890e765c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntMaxVector.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 @@ -119,6 +119,13 @@ final class IntMaxVector extends IntVector { return (int[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -526,7 +533,7 @@ final class IntMaxVector extends IntVector { @ForceInline public int laneHelper(int i) { return (int) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { int[] vecarr = vec.vec(); @@ -546,7 +553,7 @@ final class IntMaxVector extends IntVector { @ForceInline public IntMaxVector withLaneHelper(int i, int e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { int[] res = v.vec().clone(); @@ -650,8 +657,8 @@ final class IntMaxVector extends IntVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -661,7 +668,7 @@ final class IntMaxVector extends IntVector { /*package-private*/ IntMaxMask indexPartiallyInUpperRange(long offset, long limit) { return (IntMaxMask) VectorSupport.indexPartiallyInUpperRange( - IntMaxMask.class, int.class, VLENGTH, offset, limit, + IntMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (IntMaxMask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -677,7 +684,7 @@ final class IntMaxVector extends IntVector { @ForceInline public IntMaxMask compress() { return (IntMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - IntMaxVector.class, IntMaxMask.class, ETYPE, VLENGTH, null, this, + IntMaxVector.class, IntMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -689,7 +696,7 @@ final class IntMaxVector extends IntVector { public IntMaxMask and(VectorMask mask) { Objects.requireNonNull(mask); IntMaxMask m = (IntMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, IntMaxMask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, IntMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -699,7 +706,7 @@ final class IntMaxVector extends IntVector { public IntMaxMask or(VectorMask mask) { Objects.requireNonNull(mask); IntMaxMask m = (IntMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, IntMaxMask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, IntMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -709,7 +716,7 @@ final class IntMaxVector extends IntVector { public IntMaxMask xor(VectorMask mask) { Objects.requireNonNull(mask); IntMaxMask m = (IntMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, IntMaxMask.class, null, int.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, IntMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -719,21 +726,21 @@ final class IntMaxVector extends IntVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, IntMaxMask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, IntMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, IntMaxMask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, IntMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, IntMaxMask.class, int.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, IntMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -743,7 +750,7 @@ final class IntMaxVector extends IntVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, IntMaxMask.class, int.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, IntMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -753,7 +760,7 @@ final class IntMaxVector extends IntVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(IntMaxMask.class, int.class, VLENGTH, + return VectorSupport.extract(IntMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -762,7 +769,7 @@ final class IntMaxVector extends IntVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, IntMaxMask.class, int.class, VLENGTH, + return VectorSupport.test(BT_ne, IntMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((IntMaxMask)m).getBits())); } @@ -770,7 +777,7 @@ final class IntMaxVector extends IntVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, IntMaxMask.class, int.class, VLENGTH, + return VectorSupport.test(BT_overflow, IntMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((IntMaxMask)m).getBits())); } @@ -778,7 +785,7 @@ final class IntMaxVector extends IntVector { @ForceInline /*package-private*/ static IntMaxMask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(IntMaxMask.class, int.class, VLENGTH, + return VectorSupport.fromBitsCoerced(IntMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java index 43356b9ea6c..412ac8e59b2 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.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 @@ -59,6 +59,10 @@ public abstract class IntVector extends AbstractVector { static final ValueLayout.OfInt ELEMENT_LAYOUT = ValueLayout.JAVA_INT.withByteAlignment(1); + static final int LANE_TYPE_ORDINAL = LT_INT; + + static final int LANEBITS_TYPE_ORDINAL = LT_INT; + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -573,7 +577,7 @@ public abstract class IntVector extends AbstractVector { @ForceInline public static IntVector zero(VectorSpecies species) { IntSpecies vsp = (IntSpecies) species; - return VectorSupport.fromBitsCoerced(vsp.vectorType(), int.class, species.length(), + return VectorSupport.fromBitsCoerced(vsp.vectorType(), LANE_TYPE_ORDINAL, species.length(), 0, MODE_BROADCAST, vsp, ((bits_, s_) -> s_.rvOp(i -> bits_))); } @@ -695,7 +699,7 @@ public abstract class IntVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), null, int.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, UN_IMPL.find(op, opc, IntVector::unaryOperations)); } @@ -723,7 +727,7 @@ public abstract class IntVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), maskClass, int.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, UN_IMPL.find(op, opc, IntVector::unaryOperations)); } @@ -796,7 +800,7 @@ public abstract class IntVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), null, int.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, null, BIN_IMPL.find(op, opc, IntVector::binaryOperations)); } @@ -847,7 +851,7 @@ public abstract class IntVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), maskClass, int.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, m, BIN_IMPL.find(op, opc, IntVector::binaryOperations)); } @@ -1038,7 +1042,7 @@ public abstract class IntVector extends AbstractVector { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), null, int.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, e, null, BIN_INT_IMPL.find(op, opc, IntVector::broadcastIntOperations)); } @@ -1059,7 +1063,7 @@ public abstract class IntVector extends AbstractVector { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), maskClass, int.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, e, m, BIN_INT_IMPL.find(op, opc, IntVector::broadcastIntOperations)); } @@ -1135,7 +1139,7 @@ public abstract class IntVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), null, int.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, tother, null, TERN_IMPL.find(op, opc, IntVector::ternaryOperations)); } @@ -1175,7 +1179,7 @@ public abstract class IntVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), maskClass, int.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, tother, m, TERN_IMPL.find(op, opc, IntVector::ternaryOperations)); } @@ -2055,7 +2059,7 @@ public abstract class IntVector extends AbstractVector { that.check(this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, int.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, null, (cond, v0, v1, m1) -> { AbstractMask m @@ -2077,7 +2081,7 @@ public abstract class IntVector extends AbstractVector { m.check(maskType, this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, int.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, m, (cond, v0, v1, m1) -> { AbstractMask cmpM @@ -2208,7 +2212,7 @@ public abstract class IntVector extends AbstractVector { blendTemplate(Class maskType, IntVector v, M m) { v.check(this); return VectorSupport.blend( - getClass(), maskType, int.class, length(), + getClass(), maskType, laneTypeOrdinal(), length(), this, v, m, (v0, v1, m_) -> v0.bOp(v1, m_, (i, a, b) -> b)); } @@ -2225,7 +2229,7 @@ public abstract class IntVector extends AbstractVector { // make sure VLENGTH*scale doesn't overflow: vsp.checkScale(scale); return VectorSupport.indexVector( - getClass(), int.class, length(), + getClass(), laneTypeOrdinal(), length(), this, scale, vsp, (v, scale_, s) -> { @@ -2417,7 +2421,7 @@ public abstract class IntVector extends AbstractVector { IntVector rearrangeTemplate(Class shuffletype, S shuffle) { Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( - getClass(), shuffletype, null, int.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2444,7 +2448,7 @@ public abstract class IntVector extends AbstractVector { Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( - getClass(), shuffletype, masktype, int.class, length(), + getClass(), shuffletype, masktype, laneTypeOrdinal(), length(), this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2470,7 +2474,7 @@ public abstract class IntVector extends AbstractVector { VectorMask valid = shuffle.laneIsValid(); IntVector r0 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, int.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); @@ -2478,7 +2482,7 @@ public abstract class IntVector extends AbstractVector { })); IntVector r1 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, int.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2528,7 +2532,7 @@ public abstract class IntVector extends AbstractVector { IntVector compressTemplate(Class masktype, M m) { m.check(masktype, this); return (IntVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, - int.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> compressHelper(v1, m1)); } @@ -2547,7 +2551,7 @@ public abstract class IntVector extends AbstractVector { IntVector expandTemplate(Class masktype, M m) { m.check(masktype, this); return (IntVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, - int.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> expandHelper(v1, m1)); } @@ -2562,7 +2566,7 @@ public abstract class IntVector extends AbstractVector { /*package-private*/ @ForceInline final IntVector selectFromTemplate(IntVector v) { - return (IntVector)VectorSupport.selectFromOp(getClass(), null, int.class, + return (IntVector)VectorSupport.selectFromOp(getClass(), null, laneTypeOrdinal(), length(), this, v, null, (v1, v2, _m) -> v2.rearrange(v1.toShuffle())); @@ -2582,7 +2586,7 @@ public abstract class IntVector extends AbstractVector { IntVector selectFromTemplate(IntVector v, Class masktype, M m) { m.check(masktype, this); - return (IntVector)VectorSupport.selectFromOp(getClass(), masktype, int.class, + return (IntVector)VectorSupport.selectFromOp(getClass(), masktype, laneTypeOrdinal(), length(), this, v, m, (v1, v2, _m) -> v2.rearrange(v1.toShuffle(), _m)); @@ -2600,7 +2604,7 @@ public abstract class IntVector extends AbstractVector { /*package-private*/ @ForceInline final IntVector selectFromTemplate(IntVector v1, IntVector v2) { - return VectorSupport.selectFromTwoVectorOp(getClass(), int.class, length(), this, v1, v2, + return VectorSupport.selectFromTwoVectorOp(getClass(), laneTypeOrdinal(), length(), this, v1, v2, (vec1, vec2, vec3) -> selectFromTwoVectorHelper(vec1, vec2, vec3)); } @@ -2820,7 +2824,7 @@ public abstract class IntVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), maskClass, int.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, REDUCE_IMPL.find(op, opc, IntVector::reductionOperations))); } @@ -2838,7 +2842,7 @@ public abstract class IntVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), null, int.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, REDUCE_IMPL.find(op, opc, IntVector::reductionOperations))); } @@ -2858,9 +2862,9 @@ public abstract class IntVector extends AbstractVector { case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (int) Math.max(a, b))); case VECTOR_OP_UMIN: return (v, m) -> - toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (int) VectorMath.minUnsigned(a, b))); + toBits(v.rOp(UMAX_VALUE, m, (i, a, b) -> (int) VectorMath.minUnsigned(a, b))); case VECTOR_OP_UMAX: return (v, m) -> - toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (int) VectorMath.maxUnsigned(a, b))); + toBits(v.rOp(UMIN_VALUE, m, (i, a, b) -> (int) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_SUADD: return (v, m) -> toBits(v.rOp((int)0, m, (i, a, b) -> (int) VectorMath.addSaturatingUnsigned(a, b))); case VECTOR_OP_AND: return (v, m) -> @@ -2875,6 +2879,8 @@ public abstract class IntVector extends AbstractVector { private static final int MIN_OR_INF = Integer.MIN_VALUE; private static final int MAX_OR_INF = Integer.MAX_VALUE; + private static final int UMIN_VALUE = (int)0; // Minimum unsigned value + private static final int UMAX_VALUE = (int)-1; // Maximum unsigned value public @Override abstract long reduceLanesToLong(VectorOperators.Associative op); public @Override abstract long reduceLanesToLong(VectorOperators.Associative op, @@ -3098,7 +3104,7 @@ public abstract class IntVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, null, int.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, null, a, offset, indexMap, mapOffset, vsp, @@ -3281,7 +3287,7 @@ public abstract class IntVector extends AbstractVector { offset = checkFromIndexSize(offset, length(), a.length); IntSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, @@ -3370,7 +3376,7 @@ public abstract class IntVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), null, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, null, @@ -3497,7 +3503,7 @@ public abstract class IntVector extends AbstractVector { IntVector fromArray0Template(int[] a, int offset) { IntSpecies vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -3514,7 +3520,7 @@ public abstract class IntVector extends AbstractVector { m.check(species()); IntSpecies vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -3547,7 +3553,7 @@ public abstract class IntVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, maskClass, int.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, m, a, offset, indexMap, mapOffset, vsp, @@ -3564,7 +3570,7 @@ public abstract class IntVector extends AbstractVector { IntVector fromMemorySegment0Template(MemorySegment ms, long offset) { IntSpecies vsp = vspecies(); return ScopedMemoryAccess.loadFromMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, vsp, (msp, off, s) -> { return s.ldLongOp((MemorySegment) msp, off, IntVector::memorySegmentGet); @@ -3580,7 +3586,7 @@ public abstract class IntVector extends AbstractVector { IntSpecies vsp = vspecies(); m.check(vsp); return ScopedMemoryAccess.loadFromMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, m, vsp, offsetInRange, (msp, off, s, vm) -> { return s.ldLongOp((MemorySegment) msp, off, vm, IntVector::memorySegmentGet); @@ -3598,7 +3604,7 @@ public abstract class IntVector extends AbstractVector { void intoArray0Template(int[] a, int offset) { IntSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, (arr, off, v) @@ -3615,7 +3621,7 @@ public abstract class IntVector extends AbstractVector { m.check(species()); IntSpecies vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -3644,7 +3650,7 @@ public abstract class IntVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, m, @@ -3663,7 +3669,7 @@ public abstract class IntVector extends AbstractVector { void intoMemorySegment0(MemorySegment ms, long offset) { IntSpecies vsp = vspecies(); ScopedMemoryAccess.storeIntoMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), this, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v) -> { @@ -3680,7 +3686,7 @@ public abstract class IntVector extends AbstractVector { IntSpecies vsp = vspecies(); m.check(vsp); ScopedMemoryAccess.storeIntoMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), this, m, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v, vm) -> { @@ -3718,6 +3724,18 @@ public abstract class IntVector extends AbstractVector { return this; } + @Override + @ForceInline + final + IntVector swapIfNeeded(AbstractSpecies srcSpecies) { + int subLanesPerSrc = subLanesToSwap(srcSpecies); + if (subLanesPerSrc < 0) { + return this; + } + VectorShuffle shuffle = normalizeSubLanesForSpecies(this.vspecies(), subLanesPerSrc); + return (IntVector) this.rearrange(shuffle); + } + static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_INT_INDEX_SCALE); static final long ARRAY_BASE = @@ -3884,7 +3902,7 @@ public abstract class IntVector extends AbstractVector { final IntVector broadcastBits(long bits) { return (IntVector) VectorSupport.fromBitsCoerced( - vectorType, int.class, laneCount, + vectorType, laneTypeOrdinal(), laneCount, bits, MODE_BROADCAST, this, (bits_, s_) -> s_.rvOp(i -> bits_)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LaneType.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LaneType.java index 53fa773555f..59844eabb57 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LaneType.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LaneType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, 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 @@ -35,20 +35,19 @@ import static jdk.incubator.vector.VectorIntrinsics.*; * It caches all sorts of goodies that we can't put on java.lang.Class. */ enum LaneType { - FLOAT(float.class, Float.class, float[].class, 'F', 24, Float.SIZE, T_FLOAT), - DOUBLE(double.class, Double.class, double[].class, 'F', 53, Double.SIZE, T_DOUBLE), - BYTE(byte.class, Byte.class, byte[].class, 'I', -1, Byte.SIZE, T_BYTE), - SHORT(short.class, Short.class, short[].class, 'I', -1, Short.SIZE, T_SHORT), - INT(int.class, Integer.class, int[].class, 'I', -1, Integer.SIZE, T_INT), - LONG(long.class, Long.class, long[].class, 'I', -1, Long.SIZE, T_LONG); + FLOAT(float.class, Float.class, float[].class, 'F', 24, Float.SIZE), + DOUBLE(double.class, Double.class, double[].class, 'F', 53, Double.SIZE), + BYTE(byte.class, Byte.class, byte[].class, 'I', -1, Byte.SIZE), + SHORT(short.class, Short.class, short[].class, 'I', -1, Short.SIZE), + INT(int.class, Integer.class, int[].class, 'I', -1, Integer.SIZE), + LONG(long.class, Long.class, long[].class, 'I', -1, Long.SIZE); LaneType(Class elementType, Class genericElementType, Class arrayType, char elementKind, int elementPrecision, - int elementSize, - int basicType) { + int elementSize) { if (elementPrecision <= 0) elementPrecision += elementSize; this.elementType = elementType; @@ -67,12 +66,6 @@ enum LaneType { // report that condition also. this.typeChar = genericElementType.getSimpleName().charAt(0); assert("FDBSIL".indexOf(typeChar) == ordinal()) : this; - // Same as in JVMS, org.objectweb.asm.Opcodes, etc.: - this.basicType = basicType; - assert(basicType == - ( (elementSizeLog2 - /*lg(Byte.SIZE)*/ 3) - | (elementKind == 'F' ? 4 : 8))) : this; - assert("....zcFDBSILoav..".charAt(basicType) == typeChar); } final Class elementType; @@ -85,7 +78,6 @@ enum LaneType { final int switchKey; // 1+ordinal(), which is non-zero final String printName; final char typeChar; // one of "BSILFD" - final int basicType; // lg(size/8) | (kind=='F'?4:kind=='I'?8) private @Stable LaneType asIntegral; private @Stable LaneType asFloating; @@ -194,8 +186,8 @@ enum LaneType { /*package-private*/ @ForceInline - static LaneType ofBasicType(int bt) { - return ENUM_FROM_BT[bt].check(); + static LaneType ofLaneTypeOrdinal(int lo) { + return ENUM_VALUES[lo].check(); } /*package-private*/ @@ -207,13 +199,11 @@ enum LaneType { @Stable private static final LaneType[] ENUM_VALUES; @Stable private static final LaneType[] ENUM_FROM_SK; @Stable private static final LaneType[] ENUM_FROM_C0; - @Stable private static final LaneType[] ENUM_FROM_BT; - private static final int C0_MASK = 0x0F, BT_MASK = 0x0F; + private static final int C0_MASK = 0x0F; static { LaneType[] values = values().clone(); LaneType[] valuesByKey = new LaneType[1+values.length]; LaneType[] valuesByC0 = new LaneType[C0_MASK+1]; - LaneType[] valuesByBT = new LaneType[BT_MASK+1]; for (int ord = 0; ord < values.length; ord++) { int key = 1+ord; LaneType value = values[ord]; @@ -229,8 +219,6 @@ enum LaneType { c0 &= C0_MASK; assert(valuesByC0[c0] == null); valuesByC0[c0] = value; - assert(valuesByBT[value.basicType] == null); - valuesByBT[value.basicType] = value; // set up asIntegral if (value.elementKind == 'I') { value.asIntegral = value; @@ -276,15 +264,14 @@ enum LaneType { ENUM_VALUES = values; ENUM_FROM_SK = valuesByKey; ENUM_FROM_C0 = valuesByC0; - ENUM_FROM_BT = valuesByBT; } static { - assert(ofBasicType(T_FLOAT) == FLOAT); - assert(ofBasicType(T_DOUBLE) == DOUBLE); - assert(ofBasicType(T_BYTE) == BYTE); - assert(ofBasicType(T_SHORT) == SHORT); - assert(ofBasicType(T_INT) == INT); - assert(ofBasicType(T_LONG) == LONG); + assert(ofLaneTypeOrdinal(LT_FLOAT) == FLOAT); + assert(ofLaneTypeOrdinal(LT_DOUBLE) == DOUBLE); + assert(ofLaneTypeOrdinal(LT_BYTE) == BYTE); + assert(ofLaneTypeOrdinal(LT_SHORT) == SHORT); + assert(ofLaneTypeOrdinal(LT_INT) == INT); + assert(ofLaneTypeOrdinal(LT_LONG) == LONG); } } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java index 5a47153837a..01d721f64fc 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long128Vector.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 @@ -119,6 +119,13 @@ final class Long128Vector extends LongVector { return (long[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -517,7 +524,7 @@ final class Long128Vector extends LongVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { long[] vecarr = vec.vec(); @@ -538,7 +545,7 @@ final class Long128Vector extends LongVector { @ForceInline public Long128Vector withLaneHelper(int i, long e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { long[] res = v.vec().clone(); @@ -642,8 +649,8 @@ final class Long128Vector extends LongVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -653,7 +660,7 @@ final class Long128Vector extends LongVector { /*package-private*/ Long128Mask indexPartiallyInUpperRange(long offset, long limit) { return (Long128Mask) VectorSupport.indexPartiallyInUpperRange( - Long128Mask.class, long.class, VLENGTH, offset, limit, + Long128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Long128Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -669,7 +676,7 @@ final class Long128Vector extends LongVector { @ForceInline public Long128Mask compress() { return (Long128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Long128Vector.class, Long128Mask.class, ETYPE, VLENGTH, null, this, + Long128Vector.class, Long128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -681,7 +688,7 @@ final class Long128Vector extends LongVector { public Long128Mask and(VectorMask mask) { Objects.requireNonNull(mask); Long128Mask m = (Long128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Long128Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Long128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -691,7 +698,7 @@ final class Long128Vector extends LongVector { public Long128Mask or(VectorMask mask) { Objects.requireNonNull(mask); Long128Mask m = (Long128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Long128Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Long128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -701,7 +708,7 @@ final class Long128Vector extends LongVector { public Long128Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Long128Mask m = (Long128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Long128Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Long128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -711,21 +718,21 @@ final class Long128Vector extends LongVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long128Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long128Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long128Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -735,7 +742,7 @@ final class Long128Vector extends LongVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long128Mask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -745,7 +752,7 @@ final class Long128Vector extends LongVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Long128Mask.class, long.class, VLENGTH, + return VectorSupport.extract(Long128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -754,7 +761,7 @@ final class Long128Vector extends LongVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Long128Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, Long128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Long128Mask)m).getBits())); } @@ -762,7 +769,7 @@ final class Long128Vector extends LongVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Long128Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, Long128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Long128Mask)m).getBits())); } @@ -770,7 +777,7 @@ final class Long128Vector extends LongVector { @ForceInline /*package-private*/ static Long128Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Long128Mask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Long128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java index 9c3ff7627cc..b3e7022771c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long256Vector.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 @@ -119,6 +119,13 @@ final class Long256Vector extends LongVector { return (long[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -519,7 +526,7 @@ final class Long256Vector extends LongVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { long[] vecarr = vec.vec(); @@ -542,7 +549,7 @@ final class Long256Vector extends LongVector { @ForceInline public Long256Vector withLaneHelper(int i, long e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { long[] res = v.vec().clone(); @@ -646,8 +653,8 @@ final class Long256Vector extends LongVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -657,7 +664,7 @@ final class Long256Vector extends LongVector { /*package-private*/ Long256Mask indexPartiallyInUpperRange(long offset, long limit) { return (Long256Mask) VectorSupport.indexPartiallyInUpperRange( - Long256Mask.class, long.class, VLENGTH, offset, limit, + Long256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Long256Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -673,7 +680,7 @@ final class Long256Vector extends LongVector { @ForceInline public Long256Mask compress() { return (Long256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Long256Vector.class, Long256Mask.class, ETYPE, VLENGTH, null, this, + Long256Vector.class, Long256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -685,7 +692,7 @@ final class Long256Vector extends LongVector { public Long256Mask and(VectorMask mask) { Objects.requireNonNull(mask); Long256Mask m = (Long256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Long256Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Long256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -695,7 +702,7 @@ final class Long256Vector extends LongVector { public Long256Mask or(VectorMask mask) { Objects.requireNonNull(mask); Long256Mask m = (Long256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Long256Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Long256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -705,7 +712,7 @@ final class Long256Vector extends LongVector { public Long256Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Long256Mask m = (Long256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Long256Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Long256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -715,21 +722,21 @@ final class Long256Vector extends LongVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long256Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long256Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long256Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -739,7 +746,7 @@ final class Long256Vector extends LongVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long256Mask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -749,7 +756,7 @@ final class Long256Vector extends LongVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Long256Mask.class, long.class, VLENGTH, + return VectorSupport.extract(Long256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -758,7 +765,7 @@ final class Long256Vector extends LongVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Long256Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, Long256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Long256Mask)m).getBits())); } @@ -766,7 +773,7 @@ final class Long256Vector extends LongVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Long256Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, Long256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Long256Mask)m).getBits())); } @@ -774,7 +781,7 @@ final class Long256Vector extends LongVector { @ForceInline /*package-private*/ static Long256Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Long256Mask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Long256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java index 30d29c3cd03..169664bc242 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long512Vector.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 @@ -119,6 +119,13 @@ final class Long512Vector extends LongVector { return (long[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -523,7 +530,7 @@ final class Long512Vector extends LongVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { long[] vecarr = vec.vec(); @@ -550,7 +557,7 @@ final class Long512Vector extends LongVector { @ForceInline public Long512Vector withLaneHelper(int i, long e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { long[] res = v.vec().clone(); @@ -654,8 +661,8 @@ final class Long512Vector extends LongVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -665,7 +672,7 @@ final class Long512Vector extends LongVector { /*package-private*/ Long512Mask indexPartiallyInUpperRange(long offset, long limit) { return (Long512Mask) VectorSupport.indexPartiallyInUpperRange( - Long512Mask.class, long.class, VLENGTH, offset, limit, + Long512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Long512Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -681,7 +688,7 @@ final class Long512Vector extends LongVector { @ForceInline public Long512Mask compress() { return (Long512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Long512Vector.class, Long512Mask.class, ETYPE, VLENGTH, null, this, + Long512Vector.class, Long512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -693,7 +700,7 @@ final class Long512Vector extends LongVector { public Long512Mask and(VectorMask mask) { Objects.requireNonNull(mask); Long512Mask m = (Long512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Long512Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Long512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -703,7 +710,7 @@ final class Long512Vector extends LongVector { public Long512Mask or(VectorMask mask) { Objects.requireNonNull(mask); Long512Mask m = (Long512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Long512Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Long512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -713,7 +720,7 @@ final class Long512Vector extends LongVector { public Long512Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Long512Mask m = (Long512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Long512Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Long512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -723,21 +730,21 @@ final class Long512Vector extends LongVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long512Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long512Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long512Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -747,7 +754,7 @@ final class Long512Vector extends LongVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long512Mask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -757,7 +764,7 @@ final class Long512Vector extends LongVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Long512Mask.class, long.class, VLENGTH, + return VectorSupport.extract(Long512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -766,7 +773,7 @@ final class Long512Vector extends LongVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Long512Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, Long512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Long512Mask)m).getBits())); } @@ -774,7 +781,7 @@ final class Long512Vector extends LongVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Long512Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, Long512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Long512Mask)m).getBits())); } @@ -782,7 +789,7 @@ final class Long512Vector extends LongVector { @ForceInline /*package-private*/ static Long512Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Long512Mask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Long512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java index 518baa168ec..66c84fde56f 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Long64Vector.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 @@ -119,6 +119,13 @@ final class Long64Vector extends LongVector { return (long[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -516,7 +523,7 @@ final class Long64Vector extends LongVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { long[] vecarr = vec.vec(); @@ -536,7 +543,7 @@ final class Long64Vector extends LongVector { @ForceInline public Long64Vector withLaneHelper(int i, long e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { long[] res = v.vec().clone(); @@ -640,8 +647,8 @@ final class Long64Vector extends LongVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -651,7 +658,7 @@ final class Long64Vector extends LongVector { /*package-private*/ Long64Mask indexPartiallyInUpperRange(long offset, long limit) { return (Long64Mask) VectorSupport.indexPartiallyInUpperRange( - Long64Mask.class, long.class, VLENGTH, offset, limit, + Long64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Long64Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -667,7 +674,7 @@ final class Long64Vector extends LongVector { @ForceInline public Long64Mask compress() { return (Long64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Long64Vector.class, Long64Mask.class, ETYPE, VLENGTH, null, this, + Long64Vector.class, Long64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -679,7 +686,7 @@ final class Long64Vector extends LongVector { public Long64Mask and(VectorMask mask) { Objects.requireNonNull(mask); Long64Mask m = (Long64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Long64Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Long64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -689,7 +696,7 @@ final class Long64Vector extends LongVector { public Long64Mask or(VectorMask mask) { Objects.requireNonNull(mask); Long64Mask m = (Long64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Long64Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Long64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -699,7 +706,7 @@ final class Long64Vector extends LongVector { public Long64Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Long64Mask m = (Long64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Long64Mask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Long64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -709,21 +716,21 @@ final class Long64Vector extends LongVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long64Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Long64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long64Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Long64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long64Mask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Long64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -733,7 +740,7 @@ final class Long64Vector extends LongVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long64Mask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Long64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -743,7 +750,7 @@ final class Long64Vector extends LongVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Long64Mask.class, long.class, VLENGTH, + return VectorSupport.extract(Long64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -752,7 +759,7 @@ final class Long64Vector extends LongVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Long64Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, Long64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Long64Mask)m).getBits())); } @@ -760,7 +767,7 @@ final class Long64Vector extends LongVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Long64Mask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, Long64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Long64Mask)m).getBits())); } @@ -768,7 +775,7 @@ final class Long64Vector extends LongVector { @ForceInline /*package-private*/ static Long64Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Long64Mask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Long64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java index 3d981c37ae2..c95db0c4482 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongMaxVector.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 @@ -119,6 +119,13 @@ final class LongMaxVector extends LongVector { return (long[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -516,7 +523,7 @@ final class LongMaxVector extends LongVector { @ForceInline public long laneHelper(int i) { return (long) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { long[] vecarr = vec.vec(); @@ -536,7 +543,7 @@ final class LongMaxVector extends LongVector { @ForceInline public LongMaxVector withLaneHelper(int i, long e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { long[] res = v.vec().clone(); @@ -640,8 +647,8 @@ final class LongMaxVector extends LongVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -651,7 +658,7 @@ final class LongMaxVector extends LongVector { /*package-private*/ LongMaxMask indexPartiallyInUpperRange(long offset, long limit) { return (LongMaxMask) VectorSupport.indexPartiallyInUpperRange( - LongMaxMask.class, long.class, VLENGTH, offset, limit, + LongMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (LongMaxMask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -667,7 +674,7 @@ final class LongMaxVector extends LongVector { @ForceInline public LongMaxMask compress() { return (LongMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - LongMaxVector.class, LongMaxMask.class, ETYPE, VLENGTH, null, this, + LongMaxVector.class, LongMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -679,7 +686,7 @@ final class LongMaxVector extends LongVector { public LongMaxMask and(VectorMask mask) { Objects.requireNonNull(mask); LongMaxMask m = (LongMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, LongMaxMask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, LongMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -689,7 +696,7 @@ final class LongMaxVector extends LongVector { public LongMaxMask or(VectorMask mask) { Objects.requireNonNull(mask); LongMaxMask m = (LongMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, LongMaxMask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, LongMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -699,7 +706,7 @@ final class LongMaxVector extends LongVector { public LongMaxMask xor(VectorMask mask) { Objects.requireNonNull(mask); LongMaxMask m = (LongMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, LongMaxMask.class, null, long.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, LongMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -709,21 +716,21 @@ final class LongMaxVector extends LongVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, LongMaxMask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, LongMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, LongMaxMask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, LongMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, LongMaxMask.class, long.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, LongMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -733,7 +740,7 @@ final class LongMaxVector extends LongVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, LongMaxMask.class, long.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, LongMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -743,7 +750,7 @@ final class LongMaxVector extends LongVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(LongMaxMask.class, long.class, VLENGTH, + return VectorSupport.extract(LongMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -752,7 +759,7 @@ final class LongMaxVector extends LongVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, LongMaxMask.class, long.class, VLENGTH, + return VectorSupport.test(BT_ne, LongMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((LongMaxMask)m).getBits())); } @@ -760,7 +767,7 @@ final class LongMaxVector extends LongVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, LongMaxMask.class, long.class, VLENGTH, + return VectorSupport.test(BT_overflow, LongMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((LongMaxMask)m).getBits())); } @@ -768,7 +775,7 @@ final class LongMaxVector extends LongVector { @ForceInline /*package-private*/ static LongMaxMask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(LongMaxMask.class, long.class, VLENGTH, + return VectorSupport.fromBitsCoerced(LongMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java index 8947343ff30..5657bbec0a6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.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 @@ -59,6 +59,10 @@ public abstract class LongVector extends AbstractVector { static final ValueLayout.OfLong ELEMENT_LAYOUT = ValueLayout.JAVA_LONG.withByteAlignment(1); + static final int LANE_TYPE_ORDINAL = LT_LONG; + + static final int LANEBITS_TYPE_ORDINAL = LT_LONG; + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -573,7 +577,7 @@ public abstract class LongVector extends AbstractVector { @ForceInline public static LongVector zero(VectorSpecies species) { LongSpecies vsp = (LongSpecies) species; - return VectorSupport.fromBitsCoerced(vsp.vectorType(), long.class, species.length(), + return VectorSupport.fromBitsCoerced(vsp.vectorType(), LANE_TYPE_ORDINAL, species.length(), 0, MODE_BROADCAST, vsp, ((bits_, s_) -> s_.rvOp(i -> bits_))); } @@ -653,7 +657,7 @@ public abstract class LongVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), null, long.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, UN_IMPL.find(op, opc, LongVector::unaryOperations)); } @@ -681,7 +685,7 @@ public abstract class LongVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), maskClass, long.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, UN_IMPL.find(op, opc, LongVector::unaryOperations)); } @@ -754,7 +758,7 @@ public abstract class LongVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), null, long.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, null, BIN_IMPL.find(op, opc, LongVector::binaryOperations)); } @@ -805,7 +809,7 @@ public abstract class LongVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), maskClass, long.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, m, BIN_IMPL.find(op, opc, LongVector::binaryOperations)); } @@ -951,7 +955,7 @@ public abstract class LongVector extends AbstractVector { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), null, long.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, e, null, BIN_INT_IMPL.find(op, opc, LongVector::broadcastIntOperations)); } @@ -972,7 +976,7 @@ public abstract class LongVector extends AbstractVector { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), maskClass, long.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, e, m, BIN_INT_IMPL.find(op, opc, LongVector::broadcastIntOperations)); } @@ -1048,7 +1052,7 @@ public abstract class LongVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), null, long.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, tother, null, TERN_IMPL.find(op, opc, LongVector::ternaryOperations)); } @@ -1088,7 +1092,7 @@ public abstract class LongVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), maskClass, long.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, tother, m, TERN_IMPL.find(op, opc, LongVector::ternaryOperations)); } @@ -1968,7 +1972,7 @@ public abstract class LongVector extends AbstractVector { that.check(this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, long.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, null, (cond, v0, v1, m1) -> { AbstractMask m @@ -1990,7 +1994,7 @@ public abstract class LongVector extends AbstractVector { m.check(maskType, this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, long.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, m, (cond, v0, v1, m1) -> { AbstractMask cmpM @@ -2095,7 +2099,7 @@ public abstract class LongVector extends AbstractVector { blendTemplate(Class maskType, LongVector v, M m) { v.check(this); return VectorSupport.blend( - getClass(), maskType, long.class, length(), + getClass(), maskType, laneTypeOrdinal(), length(), this, v, m, (v0, v1, m_) -> v0.bOp(v1, m_, (i, a, b) -> b)); } @@ -2112,7 +2116,7 @@ public abstract class LongVector extends AbstractVector { // make sure VLENGTH*scale doesn't overflow: vsp.checkScale(scale); return VectorSupport.indexVector( - getClass(), long.class, length(), + getClass(), laneTypeOrdinal(), length(), this, scale, vsp, (v, scale_, s) -> { @@ -2283,7 +2287,7 @@ public abstract class LongVector extends AbstractVector { LongVector rearrangeTemplate(Class shuffletype, S shuffle) { Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( - getClass(), shuffletype, null, long.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2310,7 +2314,7 @@ public abstract class LongVector extends AbstractVector { Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( - getClass(), shuffletype, masktype, long.class, length(), + getClass(), shuffletype, masktype, laneTypeOrdinal(), length(), this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2336,7 +2340,7 @@ public abstract class LongVector extends AbstractVector { VectorMask valid = shuffle.laneIsValid(); LongVector r0 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, long.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); @@ -2344,7 +2348,7 @@ public abstract class LongVector extends AbstractVector { })); LongVector r1 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, long.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2394,7 +2398,7 @@ public abstract class LongVector extends AbstractVector { LongVector compressTemplate(Class masktype, M m) { m.check(masktype, this); return (LongVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, - long.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> compressHelper(v1, m1)); } @@ -2413,7 +2417,7 @@ public abstract class LongVector extends AbstractVector { LongVector expandTemplate(Class masktype, M m) { m.check(masktype, this); return (LongVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, - long.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> expandHelper(v1, m1)); } @@ -2428,7 +2432,7 @@ public abstract class LongVector extends AbstractVector { /*package-private*/ @ForceInline final LongVector selectFromTemplate(LongVector v) { - return (LongVector)VectorSupport.selectFromOp(getClass(), null, long.class, + return (LongVector)VectorSupport.selectFromOp(getClass(), null, laneTypeOrdinal(), length(), this, v, null, (v1, v2, _m) -> v2.rearrange(v1.toShuffle())); @@ -2448,7 +2452,7 @@ public abstract class LongVector extends AbstractVector { LongVector selectFromTemplate(LongVector v, Class masktype, M m) { m.check(masktype, this); - return (LongVector)VectorSupport.selectFromOp(getClass(), masktype, long.class, + return (LongVector)VectorSupport.selectFromOp(getClass(), masktype, laneTypeOrdinal(), length(), this, v, m, (v1, v2, _m) -> v2.rearrange(v1.toShuffle(), _m)); @@ -2466,7 +2470,7 @@ public abstract class LongVector extends AbstractVector { /*package-private*/ @ForceInline final LongVector selectFromTemplate(LongVector v1, LongVector v2) { - return VectorSupport.selectFromTwoVectorOp(getClass(), long.class, length(), this, v1, v2, + return VectorSupport.selectFromTwoVectorOp(getClass(), laneTypeOrdinal(), length(), this, v1, v2, (vec1, vec2, vec3) -> selectFromTwoVectorHelper(vec1, vec2, vec3)); } @@ -2686,7 +2690,7 @@ public abstract class LongVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), maskClass, long.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, REDUCE_IMPL.find(op, opc, LongVector::reductionOperations))); } @@ -2704,7 +2708,7 @@ public abstract class LongVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), null, long.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, REDUCE_IMPL.find(op, opc, LongVector::reductionOperations))); } @@ -2724,9 +2728,9 @@ public abstract class LongVector extends AbstractVector { case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (long) Math.max(a, b))); case VECTOR_OP_UMIN: return (v, m) -> - toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (long) VectorMath.minUnsigned(a, b))); + toBits(v.rOp(UMAX_VALUE, m, (i, a, b) -> (long) VectorMath.minUnsigned(a, b))); case VECTOR_OP_UMAX: return (v, m) -> - toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (long) VectorMath.maxUnsigned(a, b))); + toBits(v.rOp(UMIN_VALUE, m, (i, a, b) -> (long) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_SUADD: return (v, m) -> toBits(v.rOp((long)0, m, (i, a, b) -> (long) VectorMath.addSaturatingUnsigned(a, b))); case VECTOR_OP_AND: return (v, m) -> @@ -2741,6 +2745,8 @@ public abstract class LongVector extends AbstractVector { private static final long MIN_OR_INF = Long.MIN_VALUE; private static final long MAX_OR_INF = Long.MAX_VALUE; + private static final long UMIN_VALUE = (long)0; // Minimum unsigned value + private static final long UMAX_VALUE = (long)-1; // Maximum unsigned value public @Override abstract long reduceLanesToLong(VectorOperators.Associative op); public @Override abstract long reduceLanesToLong(VectorOperators.Associative op, @@ -2977,7 +2983,7 @@ public abstract class LongVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, null, long.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, null, a, offset, indexMap, mapOffset, vsp, @@ -3160,7 +3166,7 @@ public abstract class LongVector extends AbstractVector { offset = checkFromIndexSize(offset, length(), a.length); LongSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, @@ -3268,7 +3274,7 @@ public abstract class LongVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), null, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, null, @@ -3395,7 +3401,7 @@ public abstract class LongVector extends AbstractVector { LongVector fromArray0Template(long[] a, int offset) { LongSpecies vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -3412,7 +3418,7 @@ public abstract class LongVector extends AbstractVector { m.check(species()); LongSpecies vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -3463,7 +3469,7 @@ public abstract class LongVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, maskClass, long.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, m, a, offset, indexMap, mapOffset, vsp, @@ -3480,7 +3486,7 @@ public abstract class LongVector extends AbstractVector { LongVector fromMemorySegment0Template(MemorySegment ms, long offset) { LongSpecies vsp = vspecies(); return ScopedMemoryAccess.loadFromMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, vsp, (msp, off, s) -> { return s.ldLongOp((MemorySegment) msp, off, LongVector::memorySegmentGet); @@ -3496,7 +3502,7 @@ public abstract class LongVector extends AbstractVector { LongSpecies vsp = vspecies(); m.check(vsp); return ScopedMemoryAccess.loadFromMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, m, vsp, offsetInRange, (msp, off, s, vm) -> { return s.ldLongOp((MemorySegment) msp, off, vm, LongVector::memorySegmentGet); @@ -3514,7 +3520,7 @@ public abstract class LongVector extends AbstractVector { void intoArray0Template(long[] a, int offset) { LongSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, (arr, off, v) @@ -3531,7 +3537,7 @@ public abstract class LongVector extends AbstractVector { m.check(species()); LongSpecies vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -3579,7 +3585,7 @@ public abstract class LongVector extends AbstractVector { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, m, @@ -3598,7 +3604,7 @@ public abstract class LongVector extends AbstractVector { void intoMemorySegment0(MemorySegment ms, long offset) { LongSpecies vsp = vspecies(); ScopedMemoryAccess.storeIntoMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), this, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v) -> { @@ -3615,7 +3621,7 @@ public abstract class LongVector extends AbstractVector { LongSpecies vsp = vspecies(); m.check(vsp); ScopedMemoryAccess.storeIntoMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), this, m, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v, vm) -> { @@ -3653,6 +3659,18 @@ public abstract class LongVector extends AbstractVector { return this; } + @Override + @ForceInline + final + LongVector swapIfNeeded(AbstractSpecies srcSpecies) { + int subLanesPerSrc = subLanesToSwap(srcSpecies); + if (subLanesPerSrc < 0) { + return this; + } + VectorShuffle shuffle = normalizeSubLanesForSpecies(this.vspecies(), subLanesPerSrc); + return (LongVector) this.rearrange(shuffle); + } + static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_LONG_INDEX_SCALE); static final long ARRAY_BASE = @@ -3819,7 +3837,7 @@ public abstract class LongVector extends AbstractVector { final LongVector broadcastBits(long bits) { return (LongVector) VectorSupport.fromBitsCoerced( - vectorType, long.class, laneCount, + vectorType, laneTypeOrdinal(), laneCount, bits, MODE_BROADCAST, this, (bits_, s_) -> s_.rvOp(i -> bits_)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java index 60f22eb5fb9..cc35a1ea069 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short128Vector.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 @@ -119,6 +119,13 @@ final class Short128Vector extends ShortVector { return (short[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -533,7 +540,7 @@ final class Short128Vector extends ShortVector { @ForceInline public short laneHelper(int i) { return (short) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { short[] vecarr = vec.vec(); @@ -560,7 +567,7 @@ final class Short128Vector extends ShortVector { @ForceInline public Short128Vector withLaneHelper(int i, short e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { short[] res = v.vec().clone(); @@ -664,8 +671,8 @@ final class Short128Vector extends ShortVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -675,7 +682,7 @@ final class Short128Vector extends ShortVector { /*package-private*/ Short128Mask indexPartiallyInUpperRange(long offset, long limit) { return (Short128Mask) VectorSupport.indexPartiallyInUpperRange( - Short128Mask.class, short.class, VLENGTH, offset, limit, + Short128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Short128Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -691,7 +698,7 @@ final class Short128Vector extends ShortVector { @ForceInline public Short128Mask compress() { return (Short128Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Short128Vector.class, Short128Mask.class, ETYPE, VLENGTH, null, this, + Short128Vector.class, Short128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -703,7 +710,7 @@ final class Short128Vector extends ShortVector { public Short128Mask and(VectorMask mask) { Objects.requireNonNull(mask); Short128Mask m = (Short128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Short128Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Short128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -713,7 +720,7 @@ final class Short128Vector extends ShortVector { public Short128Mask or(VectorMask mask) { Objects.requireNonNull(mask); Short128Mask m = (Short128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Short128Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Short128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -723,7 +730,7 @@ final class Short128Vector extends ShortVector { public Short128Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Short128Mask m = (Short128Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Short128Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Short128Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -733,21 +740,21 @@ final class Short128Vector extends ShortVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short128Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short128Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short128Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -757,7 +764,7 @@ final class Short128Vector extends ShortVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Short128Mask.class, short.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Short128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -767,7 +774,7 @@ final class Short128Vector extends ShortVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Short128Mask.class, short.class, VLENGTH, + return VectorSupport.extract(Short128Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -776,7 +783,7 @@ final class Short128Vector extends ShortVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Short128Mask.class, short.class, VLENGTH, + return VectorSupport.test(BT_ne, Short128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Short128Mask)m).getBits())); } @@ -784,7 +791,7 @@ final class Short128Vector extends ShortVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Short128Mask.class, short.class, VLENGTH, + return VectorSupport.test(BT_overflow, Short128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Short128Mask)m).getBits())); } @@ -792,7 +799,7 @@ final class Short128Vector extends ShortVector { @ForceInline /*package-private*/ static Short128Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Short128Mask.class, short.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Short128Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java index 14c415afac2..a3841eb63dc 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short256Vector.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 @@ -119,6 +119,13 @@ final class Short256Vector extends ShortVector { return (short[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -541,7 +548,7 @@ final class Short256Vector extends ShortVector { @ForceInline public short laneHelper(int i) { return (short) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { short[] vecarr = vec.vec(); @@ -576,7 +583,7 @@ final class Short256Vector extends ShortVector { @ForceInline public Short256Vector withLaneHelper(int i, short e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { short[] res = v.vec().clone(); @@ -680,8 +687,8 @@ final class Short256Vector extends ShortVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -691,7 +698,7 @@ final class Short256Vector extends ShortVector { /*package-private*/ Short256Mask indexPartiallyInUpperRange(long offset, long limit) { return (Short256Mask) VectorSupport.indexPartiallyInUpperRange( - Short256Mask.class, short.class, VLENGTH, offset, limit, + Short256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Short256Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -707,7 +714,7 @@ final class Short256Vector extends ShortVector { @ForceInline public Short256Mask compress() { return (Short256Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Short256Vector.class, Short256Mask.class, ETYPE, VLENGTH, null, this, + Short256Vector.class, Short256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -719,7 +726,7 @@ final class Short256Vector extends ShortVector { public Short256Mask and(VectorMask mask) { Objects.requireNonNull(mask); Short256Mask m = (Short256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Short256Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Short256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -729,7 +736,7 @@ final class Short256Vector extends ShortVector { public Short256Mask or(VectorMask mask) { Objects.requireNonNull(mask); Short256Mask m = (Short256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Short256Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Short256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -739,7 +746,7 @@ final class Short256Vector extends ShortVector { public Short256Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Short256Mask m = (Short256Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Short256Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Short256Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -749,21 +756,21 @@ final class Short256Vector extends ShortVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short256Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short256Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short256Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -773,7 +780,7 @@ final class Short256Vector extends ShortVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Short256Mask.class, short.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Short256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -783,7 +790,7 @@ final class Short256Vector extends ShortVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Short256Mask.class, short.class, VLENGTH, + return VectorSupport.extract(Short256Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -792,7 +799,7 @@ final class Short256Vector extends ShortVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Short256Mask.class, short.class, VLENGTH, + return VectorSupport.test(BT_ne, Short256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Short256Mask)m).getBits())); } @@ -800,7 +807,7 @@ final class Short256Vector extends ShortVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Short256Mask.class, short.class, VLENGTH, + return VectorSupport.test(BT_overflow, Short256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Short256Mask)m).getBits())); } @@ -808,7 +815,7 @@ final class Short256Vector extends ShortVector { @ForceInline /*package-private*/ static Short256Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Short256Mask.class, short.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Short256Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java index c92979302a6..3da20257a8d 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short512Vector.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 @@ -119,6 +119,13 @@ final class Short512Vector extends ShortVector { return (short[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -557,7 +564,7 @@ final class Short512Vector extends ShortVector { @ForceInline public short laneHelper(int i) { return (short) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { short[] vecarr = vec.vec(); @@ -608,7 +615,7 @@ final class Short512Vector extends ShortVector { @ForceInline public Short512Vector withLaneHelper(int i, short e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { short[] res = v.vec().clone(); @@ -712,8 +719,8 @@ final class Short512Vector extends ShortVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -723,7 +730,7 @@ final class Short512Vector extends ShortVector { /*package-private*/ Short512Mask indexPartiallyInUpperRange(long offset, long limit) { return (Short512Mask) VectorSupport.indexPartiallyInUpperRange( - Short512Mask.class, short.class, VLENGTH, offset, limit, + Short512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Short512Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -739,7 +746,7 @@ final class Short512Vector extends ShortVector { @ForceInline public Short512Mask compress() { return (Short512Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Short512Vector.class, Short512Mask.class, ETYPE, VLENGTH, null, this, + Short512Vector.class, Short512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -751,7 +758,7 @@ final class Short512Vector extends ShortVector { public Short512Mask and(VectorMask mask) { Objects.requireNonNull(mask); Short512Mask m = (Short512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Short512Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Short512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -761,7 +768,7 @@ final class Short512Vector extends ShortVector { public Short512Mask or(VectorMask mask) { Objects.requireNonNull(mask); Short512Mask m = (Short512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Short512Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Short512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -771,7 +778,7 @@ final class Short512Vector extends ShortVector { public Short512Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Short512Mask m = (Short512Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Short512Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Short512Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -781,21 +788,21 @@ final class Short512Vector extends ShortVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short512Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short512Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short512Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -805,7 +812,7 @@ final class Short512Vector extends ShortVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Short512Mask.class, short.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Short512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -815,7 +822,7 @@ final class Short512Vector extends ShortVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Short512Mask.class, short.class, VLENGTH, + return VectorSupport.extract(Short512Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -824,7 +831,7 @@ final class Short512Vector extends ShortVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Short512Mask.class, short.class, VLENGTH, + return VectorSupport.test(BT_ne, Short512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Short512Mask)m).getBits())); } @@ -832,7 +839,7 @@ final class Short512Vector extends ShortVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Short512Mask.class, short.class, VLENGTH, + return VectorSupport.test(BT_overflow, Short512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Short512Mask)m).getBits())); } @@ -840,7 +847,7 @@ final class Short512Vector extends ShortVector { @ForceInline /*package-private*/ static Short512Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Short512Mask.class, short.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Short512Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java index b454989b45f..8b3246996f3 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Short64Vector.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 @@ -119,6 +119,13 @@ final class Short64Vector extends ShortVector { return (short[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -529,7 +536,7 @@ final class Short64Vector extends ShortVector { @ForceInline public short laneHelper(int i) { return (short) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { short[] vecarr = vec.vec(); @@ -552,7 +559,7 @@ final class Short64Vector extends ShortVector { @ForceInline public Short64Vector withLaneHelper(int i, short e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { short[] res = v.vec().clone(); @@ -656,8 +663,8 @@ final class Short64Vector extends ShortVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -667,7 +674,7 @@ final class Short64Vector extends ShortVector { /*package-private*/ Short64Mask indexPartiallyInUpperRange(long offset, long limit) { return (Short64Mask) VectorSupport.indexPartiallyInUpperRange( - Short64Mask.class, short.class, VLENGTH, offset, limit, + Short64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (Short64Mask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -683,7 +690,7 @@ final class Short64Vector extends ShortVector { @ForceInline public Short64Mask compress() { return (Short64Mask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - Short64Vector.class, Short64Mask.class, ETYPE, VLENGTH, null, this, + Short64Vector.class, Short64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -695,7 +702,7 @@ final class Short64Vector extends ShortVector { public Short64Mask and(VectorMask mask) { Objects.requireNonNull(mask); Short64Mask m = (Short64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, Short64Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, Short64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -705,7 +712,7 @@ final class Short64Vector extends ShortVector { public Short64Mask or(VectorMask mask) { Objects.requireNonNull(mask); Short64Mask m = (Short64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, Short64Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, Short64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -715,7 +722,7 @@ final class Short64Vector extends ShortVector { public Short64Mask xor(VectorMask mask) { Objects.requireNonNull(mask); Short64Mask m = (Short64Mask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, Short64Mask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, Short64Mask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -725,21 +732,21 @@ final class Short64Vector extends ShortVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short64Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, Short64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short64Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, Short64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short64Mask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, Short64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -749,7 +756,7 @@ final class Short64Vector extends ShortVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Short64Mask.class, short.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, Short64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -759,7 +766,7 @@ final class Short64Vector extends ShortVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(Short64Mask.class, short.class, VLENGTH, + return VectorSupport.extract(Short64Mask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -768,7 +775,7 @@ final class Short64Vector extends ShortVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, Short64Mask.class, short.class, VLENGTH, + return VectorSupport.test(BT_ne, Short64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((Short64Mask)m).getBits())); } @@ -776,7 +783,7 @@ final class Short64Vector extends ShortVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, Short64Mask.class, short.class, VLENGTH, + return VectorSupport.test(BT_overflow, Short64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((Short64Mask)m).getBits())); } @@ -784,7 +791,7 @@ final class Short64Vector extends ShortVector { @ForceInline /*package-private*/ static Short64Mask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(Short64Mask.class, short.class, VLENGTH, + return VectorSupport.fromBitsCoerced(Short64Mask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java index bea14b7d5fd..bf9b13c6606 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortMaxVector.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 @@ -119,6 +119,13 @@ final class ShortMaxVector extends ShortVector { return (short[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -526,7 +533,7 @@ final class ShortMaxVector extends ShortVector { @ForceInline public short laneHelper(int i) { return (short) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { short[] vecarr = vec.vec(); @@ -546,7 +553,7 @@ final class ShortMaxVector extends ShortVector { @ForceInline public ShortMaxVector withLaneHelper(int i, short e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { short[] res = v.vec().clone(); @@ -650,8 +657,8 @@ final class ShortMaxVector extends ShortVector { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -661,7 +668,7 @@ final class ShortMaxVector extends ShortVector { /*package-private*/ ShortMaxMask indexPartiallyInUpperRange(long offset, long limit) { return (ShortMaxMask) VectorSupport.indexPartiallyInUpperRange( - ShortMaxMask.class, short.class, VLENGTH, offset, limit, + ShortMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> (ShortMaxMask) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -677,7 +684,7 @@ final class ShortMaxVector extends ShortVector { @ForceInline public ShortMaxMask compress() { return (ShortMaxMask)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - ShortMaxVector.class, ShortMaxMask.class, ETYPE, VLENGTH, null, this, + ShortMaxVector.class, ShortMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -689,7 +696,7 @@ final class ShortMaxVector extends ShortVector { public ShortMaxMask and(VectorMask mask) { Objects.requireNonNull(mask); ShortMaxMask m = (ShortMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, ShortMaxMask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, ShortMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -699,7 +706,7 @@ final class ShortMaxVector extends ShortVector { public ShortMaxMask or(VectorMask mask) { Objects.requireNonNull(mask); ShortMaxMask m = (ShortMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, ShortMaxMask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, ShortMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -709,7 +716,7 @@ final class ShortMaxVector extends ShortVector { public ShortMaxMask xor(VectorMask mask) { Objects.requireNonNull(mask); ShortMaxMask m = (ShortMaxMask)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, ShortMaxMask.class, null, short.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, ShortMaxMask.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -719,21 +726,21 @@ final class ShortMaxVector extends ShortVector { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, ShortMaxMask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, ShortMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, ShortMaxMask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, ShortMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, ShortMaxMask.class, short.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, ShortMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -743,7 +750,7 @@ final class ShortMaxVector extends ShortVector { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, ShortMaxMask.class, short.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, ShortMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -753,7 +760,7 @@ final class ShortMaxVector extends ShortVector { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract(ShortMaxMask.class, short.class, VLENGTH, + return VectorSupport.extract(ShortMaxMask.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -762,7 +769,7 @@ final class ShortMaxVector extends ShortVector { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, ShortMaxMask.class, short.class, VLENGTH, + return VectorSupport.test(BT_ne, ShortMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper(((ShortMaxMask)m).getBits())); } @@ -770,7 +777,7 @@ final class ShortMaxVector extends ShortVector { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, ShortMaxMask.class, short.class, VLENGTH, + return VectorSupport.test(BT_overflow, ShortMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper(((ShortMaxMask)m).getBits())); } @@ -778,7 +785,7 @@ final class ShortMaxVector extends ShortVector { @ForceInline /*package-private*/ static ShortMaxMask maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced(ShortMaxMask.class, short.class, VLENGTH, + return VectorSupport.fromBitsCoerced(ShortMaxMask.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java index e222c6d25f3..03b7bb030b9 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.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 @@ -59,6 +59,10 @@ public abstract class ShortVector extends AbstractVector { static final ValueLayout.OfShort ELEMENT_LAYOUT = ValueLayout.JAVA_SHORT.withByteAlignment(1); + static final int LANE_TYPE_ORDINAL = LT_SHORT; + + static final int LANEBITS_TYPE_ORDINAL = LT_SHORT; + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -573,7 +577,7 @@ public abstract class ShortVector extends AbstractVector { @ForceInline public static ShortVector zero(VectorSpecies species) { ShortSpecies vsp = (ShortSpecies) species; - return VectorSupport.fromBitsCoerced(vsp.vectorType(), short.class, species.length(), + return VectorSupport.fromBitsCoerced(vsp.vectorType(), LANE_TYPE_ORDINAL, species.length(), 0, MODE_BROADCAST, vsp, ((bits_, s_) -> s_.rvOp(i -> bits_))); } @@ -695,7 +699,7 @@ public abstract class ShortVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), null, short.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, UN_IMPL.find(op, opc, ShortVector::unaryOperations)); } @@ -723,7 +727,7 @@ public abstract class ShortVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), maskClass, short.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, UN_IMPL.find(op, opc, ShortVector::unaryOperations)); } @@ -796,7 +800,7 @@ public abstract class ShortVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), null, short.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, null, BIN_IMPL.find(op, opc, ShortVector::binaryOperations)); } @@ -847,7 +851,7 @@ public abstract class ShortVector extends AbstractVector { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), maskClass, short.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, m, BIN_IMPL.find(op, opc, ShortVector::binaryOperations)); } @@ -1034,7 +1038,7 @@ public abstract class ShortVector extends AbstractVector { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), null, short.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, e, null, BIN_INT_IMPL.find(op, opc, ShortVector::broadcastIntOperations)); } @@ -1055,7 +1059,7 @@ public abstract class ShortVector extends AbstractVector { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), maskClass, short.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, e, m, BIN_INT_IMPL.find(op, opc, ShortVector::broadcastIntOperations)); } @@ -1132,7 +1136,7 @@ public abstract class ShortVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), null, short.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, tother, null, TERN_IMPL.find(op, opc, ShortVector::ternaryOperations)); } @@ -1172,7 +1176,7 @@ public abstract class ShortVector extends AbstractVector { } int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), maskClass, short.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, tother, m, TERN_IMPL.find(op, opc, ShortVector::ternaryOperations)); } @@ -2071,7 +2075,7 @@ public abstract class ShortVector extends AbstractVector { that.check(this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, short.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, null, (cond, v0, v1, m1) -> { AbstractMask m @@ -2093,7 +2097,7 @@ public abstract class ShortVector extends AbstractVector { m.check(maskType, this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, short.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, m, (cond, v0, v1, m1) -> { AbstractMask cmpM @@ -2224,7 +2228,7 @@ public abstract class ShortVector extends AbstractVector { blendTemplate(Class maskType, ShortVector v, M m) { v.check(this); return VectorSupport.blend( - getClass(), maskType, short.class, length(), + getClass(), maskType, laneTypeOrdinal(), length(), this, v, m, (v0, v1, m_) -> v0.bOp(v1, m_, (i, a, b) -> b)); } @@ -2241,7 +2245,7 @@ public abstract class ShortVector extends AbstractVector { // make sure VLENGTH*scale doesn't overflow: vsp.checkScale(scale); return VectorSupport.indexVector( - getClass(), short.class, length(), + getClass(), laneTypeOrdinal(), length(), this, scale, vsp, (v, scale_, s) -> { @@ -2433,7 +2437,7 @@ public abstract class ShortVector extends AbstractVector { ShortVector rearrangeTemplate(Class shuffletype, S shuffle) { Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( - getClass(), shuffletype, null, short.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2460,7 +2464,7 @@ public abstract class ShortVector extends AbstractVector { Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( - getClass(), shuffletype, masktype, short.class, length(), + getClass(), shuffletype, masktype, laneTypeOrdinal(), length(), this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2486,7 +2490,7 @@ public abstract class ShortVector extends AbstractVector { VectorMask valid = shuffle.laneIsValid(); ShortVector r0 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, short.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); @@ -2494,7 +2498,7 @@ public abstract class ShortVector extends AbstractVector { })); ShortVector r1 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, short.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2544,7 +2548,7 @@ public abstract class ShortVector extends AbstractVector { ShortVector compressTemplate(Class masktype, M m) { m.check(masktype, this); return (ShortVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, - short.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> compressHelper(v1, m1)); } @@ -2563,7 +2567,7 @@ public abstract class ShortVector extends AbstractVector { ShortVector expandTemplate(Class masktype, M m) { m.check(masktype, this); return (ShortVector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, - short.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> expandHelper(v1, m1)); } @@ -2578,7 +2582,7 @@ public abstract class ShortVector extends AbstractVector { /*package-private*/ @ForceInline final ShortVector selectFromTemplate(ShortVector v) { - return (ShortVector)VectorSupport.selectFromOp(getClass(), null, short.class, + return (ShortVector)VectorSupport.selectFromOp(getClass(), null, laneTypeOrdinal(), length(), this, v, null, (v1, v2, _m) -> v2.rearrange(v1.toShuffle())); @@ -2598,7 +2602,7 @@ public abstract class ShortVector extends AbstractVector { ShortVector selectFromTemplate(ShortVector v, Class masktype, M m) { m.check(masktype, this); - return (ShortVector)VectorSupport.selectFromOp(getClass(), masktype, short.class, + return (ShortVector)VectorSupport.selectFromOp(getClass(), masktype, laneTypeOrdinal(), length(), this, v, m, (v1, v2, _m) -> v2.rearrange(v1.toShuffle(), _m)); @@ -2616,7 +2620,7 @@ public abstract class ShortVector extends AbstractVector { /*package-private*/ @ForceInline final ShortVector selectFromTemplate(ShortVector v1, ShortVector v2) { - return VectorSupport.selectFromTwoVectorOp(getClass(), short.class, length(), this, v1, v2, + return VectorSupport.selectFromTwoVectorOp(getClass(), laneTypeOrdinal(), length(), this, v1, v2, (vec1, vec2, vec3) -> selectFromTwoVectorHelper(vec1, vec2, vec3)); } @@ -2836,7 +2840,7 @@ public abstract class ShortVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), maskClass, short.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, REDUCE_IMPL.find(op, opc, ShortVector::reductionOperations))); } @@ -2854,7 +2858,7 @@ public abstract class ShortVector extends AbstractVector { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), null, short.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, REDUCE_IMPL.find(op, opc, ShortVector::reductionOperations))); } @@ -2874,9 +2878,9 @@ public abstract class ShortVector extends AbstractVector { case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (short) Math.max(a, b))); case VECTOR_OP_UMIN: return (v, m) -> - toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (short) VectorMath.minUnsigned(a, b))); + toBits(v.rOp(UMAX_VALUE, m, (i, a, b) -> (short) VectorMath.minUnsigned(a, b))); case VECTOR_OP_UMAX: return (v, m) -> - toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (short) VectorMath.maxUnsigned(a, b))); + toBits(v.rOp(UMIN_VALUE, m, (i, a, b) -> (short) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_SUADD: return (v, m) -> toBits(v.rOp((short)0, m, (i, a, b) -> (short) VectorMath.addSaturatingUnsigned(a, b))); case VECTOR_OP_AND: return (v, m) -> @@ -2891,6 +2895,8 @@ public abstract class ShortVector extends AbstractVector { private static final short MIN_OR_INF = Short.MIN_VALUE; private static final short MAX_OR_INF = Short.MAX_VALUE; + private static final short UMIN_VALUE = (short)0; // Minimum unsigned value + private static final short UMAX_VALUE = (short)-1; // Maximum unsigned value public @Override abstract long reduceLanesToLong(VectorOperators.Associative op); public @Override abstract long reduceLanesToLong(VectorOperators.Associative op, @@ -3135,7 +3141,7 @@ public abstract class ShortVector extends AbstractVector { } return VectorSupport.loadWithMap( - vectorType, null, short.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), lsp.vectorType(), lsp.length(), a, ARRAY_BASE, vix0, vix1, null, null, null, a, offset, indexMap, mapOffset, vsp, @@ -3468,7 +3474,7 @@ public abstract class ShortVector extends AbstractVector { offset = checkFromIndexSize(offset, length(), a.length); ShortSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, @@ -3617,7 +3623,7 @@ public abstract class ShortVector extends AbstractVector { offset = checkFromIndexSize(offset, length(), a.length); ShortSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, charArrayAddress(a, offset), false, this, a, offset, @@ -3822,7 +3828,7 @@ public abstract class ShortVector extends AbstractVector { ShortVector fromArray0Template(short[] a, int offset) { ShortSpecies vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -3839,7 +3845,7 @@ public abstract class ShortVector extends AbstractVector { m.check(species()); ShortSpecies vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -3886,7 +3892,7 @@ public abstract class ShortVector extends AbstractVector { } return VectorSupport.loadWithMap( - vectorType, maskClass, short.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), lsp.vectorType(), lsp.length(), a, ARRAY_BASE, vix0, vix1, null, null, m, a, offset, indexMap, mapOffset, vsp, @@ -3902,7 +3908,7 @@ public abstract class ShortVector extends AbstractVector { ShortVector fromCharArray0Template(char[] a, int offset) { ShortSpecies vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, charArrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -3919,7 +3925,7 @@ public abstract class ShortVector extends AbstractVector { m.check(species()); ShortSpecies vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, charArrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -3934,7 +3940,7 @@ public abstract class ShortVector extends AbstractVector { ShortVector fromMemorySegment0Template(MemorySegment ms, long offset) { ShortSpecies vsp = vspecies(); return ScopedMemoryAccess.loadFromMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, vsp, (msp, off, s) -> { return s.ldLongOp((MemorySegment) msp, off, ShortVector::memorySegmentGet); @@ -3950,7 +3956,7 @@ public abstract class ShortVector extends AbstractVector { ShortSpecies vsp = vspecies(); m.check(vsp); return ScopedMemoryAccess.loadFromMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, m, vsp, offsetInRange, (msp, off, s, vm) -> { return s.ldLongOp((MemorySegment) msp, off, vm, ShortVector::memorySegmentGet); @@ -3968,7 +3974,7 @@ public abstract class ShortVector extends AbstractVector { void intoArray0Template(short[] a, int offset) { ShortSpecies vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, (arr, off, v) @@ -3985,7 +3991,7 @@ public abstract class ShortVector extends AbstractVector { m.check(species()); ShortSpecies vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -4000,7 +4006,7 @@ public abstract class ShortVector extends AbstractVector { void intoMemorySegment0(MemorySegment ms, long offset) { ShortSpecies vsp = vspecies(); ScopedMemoryAccess.storeIntoMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), this, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v) -> { @@ -4017,7 +4023,7 @@ public abstract class ShortVector extends AbstractVector { ShortSpecies vsp = vspecies(); m.check(vsp); ScopedMemoryAccess.storeIntoMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), this, m, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v, vm) -> { @@ -4035,7 +4041,7 @@ public abstract class ShortVector extends AbstractVector { m.check(species()); ShortSpecies vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, charArrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -4072,6 +4078,18 @@ public abstract class ShortVector extends AbstractVector { return this; } + @Override + @ForceInline + final + ShortVector swapIfNeeded(AbstractSpecies srcSpecies) { + int subLanesPerSrc = subLanesToSwap(srcSpecies); + if (subLanesPerSrc < 0) { + return this; + } + VectorShuffle shuffle = normalizeSubLanesForSpecies(this.vspecies(), subLanesPerSrc); + return (ShortVector) this.rearrange(shuffle); + } + static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_SHORT_INDEX_SCALE); static final long ARRAY_BASE = @@ -4255,7 +4273,7 @@ public abstract class ShortVector extends AbstractVector { final ShortVector broadcastBits(long bits) { return (ShortVector) VectorSupport.fromBitsCoerced( - vectorType, short.class, laneCount, + vectorType, laneTypeOrdinal(), laneCount, bits, MODE_BROADCAST, this, (bits_, s_) -> s_.rvOp(i -> bits_)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java index 0e4516efa86..68b4a35067c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.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 diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java index 5695dff62fb..13ee9e27e0d 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, 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 @@ -207,7 +207,7 @@ public abstract class VectorMask extends jdk.internal.vm.vector.VectorSupport int laneCount = vsp.laneCount(); offset = VectorIntrinsics.checkFromIndexSize(offset, laneCount, bits.length); return VectorSupport.load( - vsp.maskType(), vsp.elementType(), laneCount, + vsp.maskType(), vsp.laneTypeOrdinal(), laneCount, bits, (long) offset + Unsafe.ARRAY_BOOLEAN_BASE_OFFSET, false, bits, offset, vsp, (c, idx, s) @@ -240,7 +240,7 @@ public abstract class VectorMask extends jdk.internal.vm.vector.VectorSupport public static VectorMask fromLong(VectorSpecies species, long bits) { AbstractSpecies vsp = (AbstractSpecies) species; bits = bits & (0xFFFFFFFFFFFFFFFFL >>> (64 - vsp.laneCount())); - return VectorSupport.fromBitsCoerced(vsp.maskType(), vsp.elementType(), vsp.laneCount(), bits, + return VectorSupport.fromBitsCoerced(vsp.maskType(), vsp.laneTypeOrdinal(), vsp.laneCount(), bits, VectorSupport.MODE_BITS_COERCED_LONG_TO_MASK, vsp, (m, s) -> { if (m == (m >> 1)) { diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMath.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMath.java index 67c9387dfd6..814ca2e2043 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMath.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMath.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 diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java index f4da4f42934..84009c55ac9 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorOperators.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, 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 @@ -817,8 +817,8 @@ public abstract class VectorOperators { private static ConversionImpl convert(String name, char kind, Class dom, Class ran, int opCode, int flags) { - int domran = ((LaneType.of(dom).basicType << VO_DOM_SHIFT) + - (LaneType.of(ran).basicType << VO_RAN_SHIFT)); + int domran = ((LaneType.of(dom).ordinal() << VO_DOM_SHIFT) + + (LaneType.of(ran).ordinal() << VO_RAN_SHIFT)); if (opCode >= 0) { if ((opCode & VO_DOM_RAN_MASK) == 0) { opCode += domran; @@ -945,10 +945,10 @@ public abstract class VectorOperators { @ForceInline /*package-private*/ - boolean compatibleWith(LaneType laneType) { - if (laneType.elementKind == 'F') { + boolean compatibleWith(LaneType type) { + if (type.elementKind == 'F') { return !opKind(VO_NOFP); - } else if (laneType.elementKind == 'I') { + } else if (type.elementKind == 'I') { return !opKind(VO_ONLYFP); } else { throw new AssertionError(); @@ -1077,8 +1077,8 @@ public abstract class VectorOperators { String name; Class domType = dom.elementType; Class ranType = ran.elementType; - int domCode = (dom.basicType << VO_DOM_SHIFT); - int ranCode = (ran.basicType << VO_RAN_SHIFT); + int domCode = (dom.ordinal() << VO_DOM_SHIFT); + int ranCode = (ran.ordinal() << VO_RAN_SHIFT); int opCode = domCode + ranCode; switch (kind) { case 'I': @@ -1156,16 +1156,16 @@ public abstract class VectorOperators { switch (conv.kind) { case 'W': int domCode = (opc >> VO_DOM_SHIFT) & 0xF; - dom = LaneType.ofBasicType(domCode); + dom = LaneType.ofLaneTypeOrdinal(domCode); break; case 'N': int ranCode = (opc >> VO_RAN_SHIFT) & 0xF; - ran = LaneType.ofBasicType(ranCode); + ran = LaneType.ofLaneTypeOrdinal(ranCode); break; } assert((opc & VO_DOM_RAN_MASK) == - ((dom.basicType << VO_DOM_SHIFT) + - (ran.basicType << VO_RAN_SHIFT))); + ((dom.ordinal() << VO_DOM_SHIFT) + + (ran.ordinal() << VO_RAN_SHIFT))); ConversionImpl[] cache = cacheOf(conv.kind, dom); int ranKey = ran.switchKey; if (cache[ranKey] != conv) { @@ -1233,12 +1233,12 @@ public abstract class VectorOperators { break; case 'W': doc = "In-place widen {@code _domVal} inside _ran to {@code (_ran)_domVal}"; - LaneType logdom = LaneType.ofBasicType(domran >> VO_DOM_SHIFT & 0xF); + LaneType logdom = LaneType.ofLaneTypeOrdinal(domran >> VO_DOM_SHIFT & 0xF); doc = doc.replace("_dom", logdom.elementType.getSimpleName()); break; case 'N': doc = "In-place narrow {@code _domVal} to {@code (_ran)_domVal} inside _dom"; - LaneType logran = LaneType.ofBasicType(domran >> VO_RAN_SHIFT & 0xF); + LaneType logran = LaneType.ofLaneTypeOrdinal(domran >> VO_RAN_SHIFT & 0xF); doc = doc.replace("_ran", logran.elementType.getSimpleName()); break; default: diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java index e14cdecbc4a..e80bbf231ea 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorSpecies.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 diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template index f7d987fd280..03883cf3e8a 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template @@ -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 @@ -63,6 +63,10 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { static final ValueLayout.Of$Type$ ELEMENT_LAYOUT = ValueLayout.JAVA_$TYPE$.withByteAlignment(1); + static final int LANE_TYPE_ORDINAL = $laneType$; + + static final int LANEBITS_TYPE_ORDINAL = $lanebitsType$; + @ForceInline static int opCode(Operator op) { return VectorOperators.opCode(op, VO_OPCODE_VALID, FORBID_OPCODE_KIND); @@ -588,11 +592,11 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { public static $abstractvectortype$ zero(VectorSpecies<$Boxtype$> species) { $Type$Species vsp = ($Type$Species) species; #if[FP] - return VectorSupport.fromBitsCoerced(vsp.vectorType(), $type$.class, species.length(), + return VectorSupport.fromBitsCoerced(vsp.vectorType(), LANE_TYPE_ORDINAL, species.length(), toBits(0.0f), MODE_BROADCAST, vsp, ((bits_, s_) -> s_.rvOp(i -> bits_))); #else[FP] - return VectorSupport.fromBitsCoerced(vsp.vectorType(), $type$.class, species.length(), + return VectorSupport.fromBitsCoerced(vsp.vectorType(), LANE_TYPE_ORDINAL, species.length(), 0, MODE_BROADCAST, vsp, ((bits_, s_) -> s_.rvOp(i -> bits_))); #end[FP] @@ -724,7 +728,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), null, $type$.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, UN_IMPL.find(op, opc, $abstractvectortype$::unaryOperations)); } @@ -759,7 +763,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { } int opc = opCode(op); return VectorSupport.unaryOp( - opc, getClass(), maskClass, $type$.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, UN_IMPL.find(op, opc, $abstractvectortype$::unaryOperations)); } @@ -903,7 +907,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), null, $type$.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, null, BIN_IMPL.find(op, opc, $abstractvectortype$::binaryOperations)); } @@ -970,7 +974,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { int opc = opCode(op); return VectorSupport.binaryOp( - opc, getClass(), maskClass, $type$.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, m, BIN_IMPL.find(op, opc, $abstractvectortype$::binaryOperations)); } @@ -1198,7 +1202,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), null, $type$.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, e, null, BIN_INT_IMPL.find(op, opc, $abstractvectortype$::broadcastIntOperations)); } @@ -1219,7 +1223,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { e &= SHIFT_MASK; int opc = opCode(op); return VectorSupport.broadcastInt( - opc, getClass(), maskClass, $type$.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, e, m, BIN_INT_IMPL.find(op, opc, $abstractvectortype$::broadcastIntOperations)); } @@ -1303,7 +1307,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { #end[BITWISE] int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), null, $type$.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, that, tother, null, TERN_IMPL.find(op, opc, $abstractvectortype$::ternaryOperations)); } @@ -1345,7 +1349,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { #end[BITWISE] int opc = opCode(op); return VectorSupport.ternaryOp( - opc, getClass(), maskClass, $type$.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, that, tother, m, TERN_IMPL.find(op, opc, $abstractvectortype$::ternaryOperations)); } @@ -2477,7 +2481,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { that.check(this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, $type$.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, null, (cond, v0, v1, m1) -> { AbstractMask<$Boxtype$> m @@ -2499,7 +2503,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { m.check(maskType, this); int opc = opCode(op); return VectorSupport.compare( - opc, getClass(), maskType, $type$.class, length(), + opc, getClass(), maskType, laneTypeOrdinal(), length(), this, that, m, (cond, v0, v1, m1) -> { AbstractMask<$Boxtype$> cmpM @@ -2634,7 +2638,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { blendTemplate(Class maskType, $abstractvectortype$ v, M m) { v.check(this); return VectorSupport.blend( - getClass(), maskType, $type$.class, length(), + getClass(), maskType, laneTypeOrdinal(), length(), this, v, m, (v0, v1, m_) -> v0.bOp(v1, m_, (i, a, b) -> b)); } @@ -2651,7 +2655,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { // make sure VLENGTH*scale doesn't overflow: vsp.checkScale(scale); return VectorSupport.indexVector( - getClass(), $type$.class, length(), + getClass(), laneTypeOrdinal(), length(), this, scale, vsp, (v, scale_, s) -> { @@ -2865,7 +2869,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ rearrangeTemplate(Class shuffletype, S shuffle) { Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( - getClass(), shuffletype, null, $type$.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2892,7 +2896,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( - getClass(), shuffletype, masktype, $type$.class, length(), + getClass(), shuffletype, masktype, laneTypeOrdinal(), length(), this, shuffle, m, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2918,7 +2922,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { VectorMask<$Boxtype$> valid = shuffle.laneIsValid(); $abstractvectortype$ r0 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, $type$.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), this, shuffle, null, (v0, s_, m_) -> v0.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v0.length()); @@ -2926,7 +2930,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { })); $abstractvectortype$ r1 = VectorSupport.rearrangeOp( - getClass(), shuffletype, null, $type$.class, length(), + getClass(), shuffletype, null, laneTypeOrdinal(), length(), v, shuffle, null, (v1, s_, m_) -> v1.uOp((i, a) -> { int ei = Integer.remainderUnsigned(s_.laneSource(i), v1.length()); @@ -2988,7 +2992,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $Type$Vector compressTemplate(Class masktype, M m) { m.check(masktype, this); return ($Type$Vector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_COMPRESS, getClass(), masktype, - $type$.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> compressHelper(v1, m1)); } @@ -3007,7 +3011,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $Type$Vector expandTemplate(Class masktype, M m) { m.check(masktype, this); return ($Type$Vector) VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_EXPAND, getClass(), masktype, - $type$.class, length(), this, m, + laneTypeOrdinal(), length(), this, m, (v1, m1) -> expandHelper(v1, m1)); } @@ -3022,7 +3026,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { /*package-private*/ @ForceInline final $abstractvectortype$ selectFromTemplate($abstractvectortype$ v) { - return ($Type$Vector)VectorSupport.selectFromOp(getClass(), null, $type$.class, + return ($Type$Vector)VectorSupport.selectFromOp(getClass(), null, laneTypeOrdinal(), length(), this, v, null, (v1, v2, _m) -> v2.rearrange(v1.toShuffle())); @@ -3042,7 +3046,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ selectFromTemplate($abstractvectortype$ v, Class masktype, M m) { m.check(masktype, this); - return ($Type$Vector)VectorSupport.selectFromOp(getClass(), masktype, $type$.class, + return ($Type$Vector)VectorSupport.selectFromOp(getClass(), masktype, laneTypeOrdinal(), length(), this, v, m, (v1, v2, _m) -> v2.rearrange(v1.toShuffle(), _m)); @@ -3060,7 +3064,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { /*package-private*/ @ForceInline final $abstractvectortype$ selectFromTemplate($abstractvectortype$ v1, $abstractvectortype$ v2) { - return VectorSupport.selectFromTwoVectorOp(getClass(), $type$.class, length(), this, v1, v2, + return VectorSupport.selectFromTwoVectorOp(getClass(), laneTypeOrdinal(), length(), this, v1, v2, (vec1, vec2, vec3) -> selectFromTwoVectorHelper(vec1, vec2, vec3)); } @@ -3409,7 +3413,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), maskClass, $type$.class, length(), + opc, getClass(), maskClass, laneTypeOrdinal(), length(), this, m, REDUCE_IMPL.find(op, opc, $abstractvectortype$::reductionOperations))); } @@ -3427,7 +3431,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { } int opc = opCode(op); return fromBits(VectorSupport.reductionCoerced( - opc, getClass(), null, $type$.class, length(), + opc, getClass(), null, laneTypeOrdinal(), length(), this, null, REDUCE_IMPL.find(op, opc, $abstractvectortype$::reductionOperations))); } @@ -3448,9 +3452,9 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> ($type$) Math.max(a, b))); #if[!FP] case VECTOR_OP_UMIN: return (v, m) -> - toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> ($type$) VectorMath.minUnsigned(a, b))); + toBits(v.rOp(UMAX_VALUE, m, (i, a, b) -> ($type$) VectorMath.minUnsigned(a, b))); case VECTOR_OP_UMAX: return (v, m) -> - toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> ($type$) VectorMath.maxUnsigned(a, b))); + toBits(v.rOp(UMIN_VALUE, m, (i, a, b) -> ($type$) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_SUADD: return (v, m) -> toBits(v.rOp(($type$)0, m, (i, a, b) -> ($type$) VectorMath.addSaturatingUnsigned(a, b))); #end[!FP] @@ -3472,6 +3476,8 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { #else[FP] private static final $type$ MIN_OR_INF = $Boxtype$.MIN_VALUE; private static final $type$ MAX_OR_INF = $Boxtype$.MAX_VALUE; + private static final $type$ UMIN_VALUE = ($type$)0; // Minimum unsigned value + private static final $type$ UMAX_VALUE = ($type$)-1; // Maximum unsigned value #end[FP] public @Override abstract long reduceLanesToLong(VectorOperators.Associative op); @@ -3787,7 +3793,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { } return VectorSupport.loadWithMap( - vectorType, null, $type$.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), lsp.vectorType(), lsp.length(), a, ARRAY_BASE, vix0, vix1, vix2, vix3, null, a, offset, indexMap, mapOffset, vsp, @@ -3795,7 +3801,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { s.vOp(n -> c[idx + iMap[idy+n]])); #else[byte] return VectorSupport.loadWithMap( - vectorType, null, $type$.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), lsp.vectorType(), lsp.length(), a, ARRAY_BASE, vix0, vix1, null, null, null, a, offset, indexMap, mapOffset, vsp, @@ -3848,7 +3854,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, null, $type$.class, vsp.laneCount(), + vectorType, null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, null, a, offset, indexMap, mapOffset, vsp, @@ -4347,7 +4353,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { offset = checkFromIndexSize(offset, length(), a.length); $Type$Species vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, @@ -4474,7 +4480,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), null, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), null, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, null, @@ -4567,7 +4573,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { offset = checkFromIndexSize(offset, length(), a.length); $Type$Species vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, charArrayAddress(a, offset), false, this, a, offset, @@ -4729,7 +4735,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $Type$Species vsp = vspecies(); ByteVector normalized = this.and((byte) 1); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, booleanArrayAddress(a, offset), false, normalized, a, offset, @@ -4943,7 +4949,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ fromArray0Template($type$[] a, int offset) { $Type$Species vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -4960,7 +4966,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { m.check(species()); $Type$Species vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -5018,7 +5024,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { } return VectorSupport.loadWithMap( - vectorType, maskClass, $type$.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), lsp.vectorType(), lsp.length(), a, ARRAY_BASE, vix0, vix1, vix2, vix3, m, a, offset, indexMap, mapOffset, vsp, @@ -5026,7 +5032,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { s.vOp(vm, n -> c[idx + iMap[idy+n]])); #else[byte] return VectorSupport.loadWithMap( - vectorType, maskClass, $type$.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), lsp.vectorType(), lsp.length(), a, ARRAY_BASE, vix0, vix1, null, null, m, a, offset, indexMap, mapOffset, vsp, @@ -5081,7 +5087,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorSupport.loadWithMap( - vectorType, maskClass, $type$.class, vsp.laneCount(), + vectorType, maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, ARRAY_BASE, vix, null, null, null, m, a, offset, indexMap, mapOffset, vsp, @@ -5099,7 +5105,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ fromCharArray0Template(char[] a, int offset) { $Type$Species vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, charArrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -5116,7 +5122,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { m.check(species()); $Type$Species vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, charArrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -5133,7 +5139,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ fromBooleanArray0Template(boolean[] a, int offset) { $Type$Species vsp = vspecies(); return VectorSupport.load( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, booleanArrayAddress(a, offset), false, a, offset, vsp, (arr, off, s) -> s.ldOp(arr, (int) off, @@ -5150,7 +5156,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { m.check(species()); $Type$Species vsp = vspecies(); return VectorSupport.loadMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, booleanArrayAddress(a, offset), false, m, offsetInRange, a, offset, vsp, (arr, off, s, vm) -> s.ldOp(arr, (int) off, vm, @@ -5165,7 +5171,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $abstractvectortype$ fromMemorySegment0Template(MemorySegment ms, long offset) { $Type$Species vsp = vspecies(); return ScopedMemoryAccess.loadFromMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, vsp, (msp, off, s) -> { return s.ldLongOp((MemorySegment) msp, off, $abstractvectortype$::memorySegmentGet); @@ -5181,7 +5187,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $Type$Species vsp = vspecies(); m.check(vsp); return ScopedMemoryAccess.loadFromMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), (AbstractMemorySegmentImpl) ms, offset, m, vsp, offsetInRange, (msp, off, s, vm) -> { return s.ldLongOp((MemorySegment) msp, off, vm, $abstractvectortype$::memorySegmentGet); @@ -5199,7 +5205,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { void intoArray0Template($type$[] a, int offset) { $Type$Species vsp = vspecies(); VectorSupport.store( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, a, offset, (arr, off, v) @@ -5216,7 +5222,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { m.check(species()); $Type$Species vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, arrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -5272,7 +5278,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { vix = VectorIntrinsics.checkIndex(vix, a.length); VectorSupport.storeWithMap( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), isp.vectorType(), isp.length(), a, arrayAddress(a, 0), vix, this, m, @@ -5297,7 +5303,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $Type$Species vsp = vspecies(); ByteVector normalized = this.and((byte) 1); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, booleanArrayAddress(a, offset), false, normalized, m, a, offset, (arr, off, v, vm) @@ -5311,7 +5317,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { void intoMemorySegment0(MemorySegment ms, long offset) { $Type$Species vsp = vspecies(); ScopedMemoryAccess.storeIntoMemorySegment( - vsp.vectorType(), vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), LANE_TYPE_ORDINAL, vsp.laneCount(), this, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v) -> { @@ -5328,7 +5334,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { $Type$Species vsp = vspecies(); m.check(vsp); ScopedMemoryAccess.storeIntoMemorySegmentMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), this, m, (AbstractMemorySegmentImpl) ms, offset, (msp, off, v, vm) -> { @@ -5347,7 +5353,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { m.check(species()); $Type$Species vsp = vspecies(); VectorSupport.storeMasked( - vsp.vectorType(), maskClass, vsp.elementType(), vsp.laneCount(), + vsp.vectorType(), maskClass, LANE_TYPE_ORDINAL, vsp.laneCount(), a, charArrayAddress(a, offset), false, this, m, a, offset, (arr, off, v, vm) @@ -5602,7 +5608,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { final $abstractvectortype$ broadcastBits(long bits) { return ($abstractvectortype$) VectorSupport.fromBitsCoerced( - vectorType, $type$.class, laneCount, + vectorType, laneTypeOrdinal(), laneCount, bits, MODE_BROADCAST, this, (bits_, s_) -> s_.rvOp(i -> bits_)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template index fa502e3f29a..61ac02d84f6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-VectorBits.java.template @@ -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 @@ -119,6 +119,13 @@ final class $vectortype$ extends $abstractvectortype$ { return ($type$[])getPayload(); } + /*package-private*/ + @ForceInline + final @Override + int laneTypeOrdinal() { + return LANE_TYPE_ORDINAL; + } + // Virtualized constructors @Override @@ -577,7 +584,7 @@ final class $vectortype$ extends $abstractvectortype$ { @ForceInline public $bitstype$ laneHelper(int i) { return ($bitstype$) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { $type$[] vecarr = vec.vec(); @@ -627,7 +634,7 @@ final class $vectortype$ extends $abstractvectortype$ { @ForceInline public $vectortype$ withLaneHelper(int i, $type$ e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)$Type$.$type$ToRaw$Bitstype$Bits(e), (v, ix, bits) -> { $type$[] res = v.vec().clone(); @@ -730,7 +737,7 @@ final class $vectortype$ extends $abstractvectortype$ { @ForceInline public $type$ laneHelper(int i) { return ($type$) VectorSupport.extract( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (vec, ix) -> { $type$[] vecarr = vec.vec(); @@ -832,7 +839,7 @@ final class $vectortype$ extends $abstractvectortype$ { @ForceInline public $vectortype$ withLaneHelper(int i, $type$ e) { return VectorSupport.insert( - VCLASS, ETYPE, VLENGTH, + VCLASS, LANE_TYPE_ORDINAL, VLENGTH, this, i, (long)e, (v, ix, bits) -> { $type$[] res = v.vec().clone(); @@ -937,8 +944,8 @@ final class $vectortype$ extends $abstractvectortype$ { throw new IllegalArgumentException("VectorMask length and species length differ"); return VectorSupport.convert(VectorSupport.VECTOR_OP_CAST, - this.getClass(), ETYPE, VLENGTH, - species.maskType(), species.elementType(), VLENGTH, + this.getClass(), LANE_TYPE_ORDINAL, VLENGTH, + species.maskType(), species.laneTypeOrdinal(), VLENGTH, this, species, (m, s) -> s.maskFactory(m.toArray()).check(s)); } @@ -948,7 +955,7 @@ final class $vectortype$ extends $abstractvectortype$ { /*package-private*/ $masktype$ indexPartiallyInUpperRange(long offset, long limit) { return ($masktype$) VectorSupport.indexPartiallyInUpperRange( - $masktype$.class, $type$.class, VLENGTH, offset, limit, + $masktype$.class, LANE_TYPE_ORDINAL, VLENGTH, offset, limit, (o, l) -> ($masktype$) TRUE_MASK.indexPartiallyInRange(o, l)); } @@ -964,7 +971,7 @@ final class $vectortype$ extends $abstractvectortype$ { @ForceInline public $masktype$ compress() { return ($masktype$)VectorSupport.compressExpandOp(VectorSupport.VECTOR_OP_MASK_COMPRESS, - $vectortype$.class, $masktype$.class, ETYPE, VLENGTH, null, this, + $vectortype$.class, $masktype$.class, LANE_TYPE_ORDINAL, VLENGTH, null, this, (v1, m1) -> VSPECIES.iota().compare(VectorOperators.LT, m1.trueCount())); } @@ -976,7 +983,7 @@ final class $vectortype$ extends $abstractvectortype$ { public $masktype$ and(VectorMask<$Boxtype$> mask) { Objects.requireNonNull(mask); $masktype$ m = ($masktype$)mask; - return VectorSupport.binaryOp(VECTOR_OP_AND, $masktype$.class, null, $bitstype$.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_AND, $masktype$.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a & b)); } @@ -986,7 +993,7 @@ final class $vectortype$ extends $abstractvectortype$ { public $masktype$ or(VectorMask<$Boxtype$> mask) { Objects.requireNonNull(mask); $masktype$ m = ($masktype$)mask; - return VectorSupport.binaryOp(VECTOR_OP_OR, $masktype$.class, null, $bitstype$.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_OR, $masktype$.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a | b)); } @@ -996,7 +1003,7 @@ final class $vectortype$ extends $abstractvectortype$ { public $masktype$ xor(VectorMask<$Boxtype$> mask) { Objects.requireNonNull(mask); $masktype$ m = ($masktype$)mask; - return VectorSupport.binaryOp(VECTOR_OP_XOR, $masktype$.class, null, $bitstype$.class, VLENGTH, + return VectorSupport.binaryOp(VECTOR_OP_XOR, $masktype$.class, null, LANEBITS_TYPE_ORDINAL, VLENGTH, this, m, null, (m1, m2, vm) -> m1.bOp(m2, (i, a, b) -> a ^ b)); } @@ -1006,21 +1013,21 @@ final class $vectortype$ extends $abstractvectortype$ { @Override @ForceInline public int trueCount() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, $masktype$.class, $bitstype$.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TRUECOUNT, $masktype$.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> trueCountHelper(m.getBits())); } @Override @ForceInline public int firstTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, $masktype$.class, $bitstype$.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_FIRSTTRUE, $masktype$.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> firstTrueHelper(m.getBits())); } @Override @ForceInline public int lastTrue() { - return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, $masktype$.class, $bitstype$.class, VLENGTH, this, + return (int) VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_LASTTRUE, $masktype$.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> lastTrueHelper(m.getBits())); } @@ -1030,7 +1037,7 @@ final class $vectortype$ extends $abstractvectortype$ { if (length() > Long.SIZE) { throw new UnsupportedOperationException("too many lanes for one long"); } - return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, $masktype$.class, $bitstype$.class, VLENGTH, this, + return VectorSupport.maskReductionCoerced(VECTOR_OP_MASK_TOLONG, $masktype$.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, (m) -> toLongHelper(m.getBits())); } @@ -1040,7 +1047,7 @@ final class $vectortype$ extends $abstractvectortype$ { @ForceInline public boolean laneIsSet(int i) { Objects.checkIndex(i, length()); - return VectorSupport.extract($masktype$.class, $type$.class, VLENGTH, + return VectorSupport.extract($masktype$.class, LANE_TYPE_ORDINAL, VLENGTH, this, i, (m, idx) -> (m.getBits()[idx] ? 1L : 0L)) == 1L; } @@ -1049,7 +1056,7 @@ final class $vectortype$ extends $abstractvectortype$ { @Override @ForceInline public boolean anyTrue() { - return VectorSupport.test(BT_ne, $masktype$.class, $bitstype$.class, VLENGTH, + return VectorSupport.test(BT_ne, $masktype$.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> anyTrueHelper((($masktype$)m).getBits())); } @@ -1057,7 +1064,7 @@ final class $vectortype$ extends $abstractvectortype$ { @Override @ForceInline public boolean allTrue() { - return VectorSupport.test(BT_overflow, $masktype$.class, $bitstype$.class, VLENGTH, + return VectorSupport.test(BT_overflow, $masktype$.class, LANEBITS_TYPE_ORDINAL, VLENGTH, this, vspecies().maskAll(true), (m, __) -> allTrueHelper((($masktype$)m).getBits())); } @@ -1065,7 +1072,7 @@ final class $vectortype$ extends $abstractvectortype$ { @ForceInline /*package-private*/ static $masktype$ maskAll(boolean bit) { - return VectorSupport.fromBitsCoerced($masktype$.class, $bitstype$.class, VLENGTH, + return VectorSupport.fromBitsCoerced($masktype$.class, LANEBITS_TYPE_ORDINAL, VLENGTH, (bit ? -1 : 0), MODE_BROADCAST, null, (v, __) -> (v != 0 ? TRUE_MASK : FALSE_MASK)); } diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/gen-src.sh b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/gen-src.sh index 6841a47c757..a9f1648eaa7 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/gen-src.sh +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/gen-src.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# 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 @@ -77,11 +77,15 @@ do byte) Wideboxtype=Integer sizeInBytes=1 + laneType=LT_BYTE + lanebitsType=LT_BYTE args="$args -KbyteOrShort" ;; short) Wideboxtype=Integer sizeInBytes=2 + laneType=LT_SHORT + lanebitsType=LT_SHORT args="$args -KbyteOrShort" ;; int) @@ -92,6 +96,8 @@ do Fptype=Float Boxfptype=Float sizeInBytes=4 + laneType=LT_INT + lanebitsType=LT_INT args="$args -KintOrLong -KintOrFP -KintOrFloat" ;; long) @@ -99,6 +105,8 @@ do Fptype=Double Boxfptype=Double sizeInBytes=8 + laneType=LT_LONG + lanebitsType=LT_LONG args="$args -KintOrLong -KlongOrDouble" ;; float) @@ -107,6 +115,8 @@ do Bitstype=Int Boxbitstype=Integer sizeInBytes=4 + laneType=LT_FLOAT + lanebitsType=LT_INT args="$args -KintOrFP -KintOrFloat" ;; double) @@ -115,11 +125,13 @@ do Bitstype=Long Boxbitstype=Long sizeInBytes=8 + laneType=LT_DOUBLE + lanebitsType=LT_LONG args="$args -KintOrFP -KlongOrDouble" ;; esac - args="$args -K$kind -DBoxtype=$Boxtype -DWideboxtype=$Wideboxtype" + args="$args -K$kind -DlaneType=$laneType -DlanebitsType=$lanebitsType -DBoxtype=$Boxtype -DWideboxtype=$Wideboxtype" args="$args -Dbitstype=$bitstype -DBitstype=$Bitstype -DBoxbitstype=$Boxbitstype" args="$args -Dfptype=$fptype -DFptype=$Fptype -DBoxfptype=$Boxfptype" args="$args -DsizeInBytes=$sizeInBytes" diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/package-info.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/package-info.java index 859c66c5f63..f257c222eca 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/package-info.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/package-info.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 diff --git a/src/jdk.internal.jvmstat/macosx/classes/sun/jvmstat/PlatformSupportImpl.java b/src/jdk.internal.jvmstat/macosx/classes/sun/jvmstat/PlatformSupportImpl.java new file mode 100644 index 00000000000..f858fde4dce --- /dev/null +++ b/src/jdk.internal.jvmstat/macosx/classes/sun/jvmstat/PlatformSupportImpl.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, BELLSOFT. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.jvmstat; + +import java.io.IOException; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +/* + * macOS specific implementation of the PlatformSupport routines + * providing temporary directory support. + */ +public class PlatformSupportImpl extends PlatformSupport { + + private static final String VAR_FOLDERS_PATH = "/var/folders"; + private static final String USER_NAME_SYSTEM_PROPERTY = "user.name"; + private static final String USER_NAME_ROOT = "root"; + private static final String DIRHELPER_TEMP_STR = "T"; + + private static final boolean isCurrentUserRoot = + System.getProperty(USER_NAME_SYSTEM_PROPERTY).equals(USER_NAME_ROOT); + + public PlatformSupportImpl() { + super(); + } + + /* + * Return a list of the temporary directories that the VM uses + * for the attach and perf data files. + * + * This function returns the traditional temp directory. Additionally, + * when called by root, it returns other temporary directories of non-root + * users. + * + * macOS per-user temp directories are located under /var/folders + * and have the form /var/folders///T + */ + @Override + public List getTemporaryDirectories(int pid) { + if (!isCurrentUserRoot) { + // early exit for non-root + return List.of(PlatformSupport.getTemporaryDirectory()); + } + List result = new ArrayList<>(); + try (DirectoryStream bs = Files.newDirectoryStream(Path.of(VAR_FOLDERS_PATH))) { + for (Path bucket : bs) { + try (DirectoryStream encUuids = Files.newDirectoryStream(bucket)) { + for (Path encUuid : encUuids) { + try { + Path tempDir = encUuid.resolve(DIRHELPER_TEMP_STR); + if (Files.isDirectory(tempDir) && Files.isReadable(tempDir)) { + result.add(tempDir.toString()); + } + } catch (Exception ignore) { // ignored unreadable bucket/encUuid, continue + } + } + } catch (IOException ignore) { // IOException ignored, continue to the next bucket + } + } + } catch (Exception ignore) { // var/folders directory is inaccessible / other errors + } + return result.isEmpty() ? List.of(PlatformSupport.getTemporaryDirectory()) : result; + } +} diff --git a/src/jdk.internal.jvmstat/share/classes/module-info.java b/src/jdk.internal.jvmstat/share/classes/module-info.java index 9e12c98b016..d9e1bc68008 100644 --- a/src/jdk.internal.jvmstat/share/classes/module-info.java +++ b/src/jdk.internal.jvmstat/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, 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 @@ -40,6 +40,8 @@ module jdk.internal.jvmstat { jdk.jstatd; exports sun.jvmstat.perfdata.monitor to jdk.jstatd; + exports sun.jvmstat to + jdk.attach; uses sun.jvmstat.monitor.MonitoredHostService; diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java index ba02e792f3e..9a0e31e4c10 100644 --- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java +++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, 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 diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap index 7d9ba8d2251..f8cc98268a0 100644 --- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap +++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap @@ -1,6 +1,6 @@ /* * -* 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 diff --git a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/InetAddressConverter.java b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/InetAddressConverter.java index 46c4b8e3168..ba891b184e8 100644 --- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/InetAddressConverter.java +++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/InetAddressConverter.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/BytecodeFrame.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/BytecodeFrame.java index 8c698b4ee3d..7b0d3d75387 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/BytecodeFrame.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/BytecodeFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2023, 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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/VirtualObject.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/VirtualObject.java index 1033fa559f8..6f91bfb6c1f 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/VirtualObject.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/VirtualObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019, 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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/site/Site.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/site/Site.java index 7d1239fea0e..d12a78e5106 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/site/Site.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/site/Site.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java index b25f7a09256..ee578cfd5f1 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCode.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCode.java index 6d1f16d5bd2..dffd54e3117 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCode.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, 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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java index 2cd5e839ee8..565b38de96e 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledCodeStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java index e0e93b0f8bc..f532617a09e 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJavaType.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJavaType.java index 792c7bc00a2..d8fcb61079c 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJavaType.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJavaType.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstant.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstant.java index bed38f91988..ca54e8325f3 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstant.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstant.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java index 1dcc969b3e6..9a067375245 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java index b75edb9df08..ba29cad7849 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, 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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java index 224e8b1a070..3c3aaf830fa 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaType.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaType.java index ab634568a84..e8c7107cd89 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaType.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, 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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java index 1fc5f1bfd6a..5cad3d05bf5 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, 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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java index 46e53411dee..6074b2b32dc 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.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 @@ -165,8 +165,12 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem } public int getAccessFlags() { - HotSpotVMConfig config = config(); - return UNSAFE.getInt(getKlassPointer() + config.klassAccessFlagsOffset); + if (isArray()) { + return 0; // Array Metadata doesn't set access_flags + } else { + HotSpotVMConfig config = config(); + return UNSAFE.getInt(getKlassPointer() + config.instanceKlassAccessFlagsOffset); + } } public int getMiscFlags() { diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java index 4849750337c..bf9b1875663 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfig.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfig.java index e4e23c6d8b8..c058f785715 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfig.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfig.java @@ -84,7 +84,6 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess { */ final int javaMirrorOffset = getFieldOffset("Klass::_java_mirror", Integer.class, "OopHandle"); - final int klassAccessFlagsOffset = getFieldOffset("Klass::_access_flags", Integer.class, "AccessFlags"); final int klassLayoutHelperOffset = getFieldOffset("Klass::_layout_helper", Integer.class, "jint"); final int klassLayoutHelperNeutralValue = getConstant("Klass::_lh_neutral_value", Integer.class); @@ -93,6 +92,7 @@ class HotSpotVMConfig extends HotSpotVMConfigAccess { final int vtableEntrySize = getFieldValue("CompilerToVM::Data::sizeof_vtableEntry", Integer.class, "int"); final int vtableEntryMethodOffset = getFieldOffset("vtableEntry::_method", Integer.class, "Method*"); + final int instanceKlassAccessFlagsOffset = getFieldOffset("InstanceKlass::_access_flags", Integer.class, "AccessFlags"); final int instanceKlassInitStateOffset = getFieldOffset("InstanceKlass::_init_state", Integer.class, "InstanceKlass::ClassState"); final int instanceKlassConstantsOffset = getFieldOffset("InstanceKlass::_constants", Integer.class, "ConstantPool*"); final int instanceKlassFieldInfoStreamOffset = getFieldOffset("InstanceKlass::_fieldinfo_stream", Integer.class, "Array*"); diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java index 15bd58a5a5d..5f921c767dd 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/VMField.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/VMField.java index 21755445ca0..da9db1ddc32 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/VMField.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/VMField.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java index 0b7fd70762d..ebd0df403a3 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2023, 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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/EncodedSpeculationReason.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/EncodedSpeculationReason.java index 2e72896b31d..02f91082fd5 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/EncodedSpeculationReason.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/EncodedSpeculationReason.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaMethod.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaMethod.java index f401bc30f83..dcd80170ba9 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaMethod.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaType.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaType.java index cdb24c5f1ad..4e11cce4f68 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaType.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/JVMCIServiceLocator.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/JVMCIServiceLocator.java index d5ff0bba9b3..98856337cec 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/JVMCIServiceLocator.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/JVMCIServiceLocator.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 diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/Services.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/Services.java index 22f8eec7d12..c2bccb1bac1 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/Services.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/services/Services.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties index c5d9f41ee85..2b76f1408fa 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties @@ -220,3 +220,4 @@ entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=Eintrag %s ist jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=Diese JAR-Datei enthält interne Inkonsistenzen, die zu anderem Inhalt beim Lesen über JarFile als beim Lesen über JarInputStream führen können: signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=Signaturverifizierung war für Eintrag %s beim Lesen über JarInputStream nicht erfolgreich signature.verification.failed.on.entry.1.when.reading.via.jarfile=Signaturverifizierung war für Eintrag %s beim Lesen über JarFile nicht erfolgreich +jks.storetype.warning=%1$s verwendet veraltete kryptografische Algorithmen und wird in einer zukünftigen Version entfernt. Migrieren Sie zu PKCS12 mit:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties index 97ab6a918cb..f2a5ce39be3 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties @@ -220,3 +220,4 @@ entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=エントリ%s jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=このJARファイルには内部的な不整合があるため、JarFileとJarInputStreamから読み取る場合にコンテンツが異なる可能性があります: signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=JarInputStreamを介して読み取るときに署名検証がエントリ%sで失敗しました signature.verification.failed.on.entry.1.when.reading.via.jarfile=JarFileを介して読み取るときに署名検証がエントリ%sで失敗しました +jks.storetype.warning=%1$sは古い暗号化アルゴリズムを使用しているため、将来のリリースで削除されます。次を使用してPKCS12に移行します:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties index 378cc3ba9fc..f780bd1f1c3 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties @@ -220,3 +220,4 @@ entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=条目 %s 已 jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=此 JAR 文件包含内部不一致,通过 JarFile 和 JarInputStream 读取时可能会导致内容不同: signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=通过 JarInputStream 读取时,条目 %s 的签名验证失败 signature.verification.failed.on.entry.1.when.reading.via.jarfile=通过 JarFile 读取时,条目 %s 的签名验证失败 +jks.storetype.warning=%1$s 使用的加密算法已过时,将在未来发行版中删除。请使用以下命令迁移到 PKCS12:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java b/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java index be694eeb1bc..c6f6f012543 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java +++ b/src/jdk.jartool/share/classes/sun/tools/jar/Validator.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 @@ -47,6 +47,8 @@ import java.util.function.Function; import java.util.function.IntSupplier; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.jar.Attributes; +import java.util.jar.Manifest; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; @@ -100,6 +102,7 @@ final class Validator { this.zf = zf; this.zis = zis; checkModuleDescriptor(MODULE_INFO); + checkAutomaticModuleName(); } static boolean validate(Main main, File zipFile) throws IOException { @@ -453,6 +456,36 @@ final class Validator { }); } + /** + * Checks whether an Automatic-Module-Name entry is valid + * and also verifies it to the name given by a compiled + * module descriptor. + */ + private void checkAutomaticModuleName() { + var entry = zf.getEntry("META-INF/MANIFEST.MF"); + if (entry == null) { + return; + } + try (InputStream jis = zf.getInputStream(entry)) { + Attributes attributes = new Manifest(jis).getMainAttributes(); + String automaticModuleName = attributes.getValue("Automatic-Module-Name"); + if (automaticModuleName == null) { + return; + } + try { + ModuleDescriptor.newAutomaticModule(automaticModuleName); + } catch (IllegalArgumentException e) { + errorAndInvalid(formatMsg("error.validator.manifest.invalid.automatic.module.name", automaticModuleName)); + } + if (md == null || automaticModuleName.equals(md.name())) { + return; + } + errorAndInvalid(formatMsg("error.validator.manifest.inconsistent.automatic.module.name", automaticModuleName, md.name())); + } catch (IOException e) { + errorAndInvalid(e.getMessage()); + } + } + /* * Checks whether or not the given versioned module descriptor's attributes * are valid when compared against the root/base module descriptor. diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties index c80377e20c1..95c5f80197d 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties @@ -138,6 +138,10 @@ error.validator.metainf.wrong.position=\ expected entry META-INF/ to be at position 0, but found: {0} error.validator.manifest.wrong.position=\ expected entry META-INF/MANIFEST.MF to be at position 0 or 1, but found it at position: {0} +error.validator.manifest.invalid.automatic.module.name=\ + invalid module name of Automatic-Module-Name entry in manifest: {0} +error.validator.manifest.inconsistent.automatic.module.name=\ + expected Automatic-Module-Name entry in manifest: {0} to match name of compiled module: {1} warn.validator.identical.entry=\ Warning: entry {0} contains a class that\n\ is identical to an entry already in the jar diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties index 2a5786e10b4..292ec9c963d 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties @@ -80,6 +80,8 @@ error.validator.info.opens.notequal=module-info.class in einem versionierten Ver error.validator.info.provides.notequal=module-info.class in einem versionierten Verzeichnis enthält unterschiedliche "provides" error.validator.info.version.notequal={0}: module-info.class in einem versionierten Verzeichnis enthält unterschiedlichen "version"-Wert error.validator.info.manclass.notequal={0}: module-info.class in einem versionierten Verzeichnis enthält unterschiedlichen "main-class"-Wert +error.validator.metainf.wrong.position=Eintrag META-INF/ an Position 0 erwartet, aber an Position {0} gefunden +error.validator.manifest.wrong.position=Eintrag META-INF/MANIFEST.MF an Position 0 oder 1 erwartet, aber an Position {0} gefunden warn.validator.identical.entry=Warnung: Eintrag {0} enthält eine Klasse, die mit\neinem bereits in der JAR-Datei enthaltenen Eintrag identisch ist warn.validator.resources.with.same.name=Warnung: Eintrag {0}, mehrere Ressourcen mit demselben Namen warn.validator.concealed.public.class=Warnung: Eintrag {0} ist eine öffentliche Klasse\nin einem verdeckten Package. Wenn Sie diese JAR-Datei in den Classpath einfügen, kommt es\nzu nicht kompatiblen öffentlichen Schnittstellen diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties index c7d7c14613a..0d0f91ad791 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties @@ -80,6 +80,8 @@ error.validator.info.opens.notequal=バージョニング・ディレクトリ error.validator.info.provides.notequal=バージョニングされたディレクトリのmodule-info.classに異なる"provides"が含まれています error.validator.info.version.notequal={0}: バージョニングされたディレクトリのmodule-info.classに異なる"version"が含まれています error.validator.info.manclass.notequal={0}: バージョニングされたディレクトリのmodule-info.classに異なる"main-class"が含まれています +error.validator.metainf.wrong.position=エントリMETA-INF/は0の位置にある必要がありますが、見つかりました: {0} +error.validator.manifest.wrong.position=エントリMETA-INF/MANIFEST.MFは0または1の位置にある必要がありますが、位置: {0}で見つかりました warn.validator.identical.entry=警告 : エントリ{0}には、jarにすでに存在する\nエントリと同じクラスが含まれます warn.validator.resources.with.same.name=警告 : エントリ{0}、同じ名前を持つ複数のリソース warn.validator.concealed.public.class=警告 : エントリ{0}は、隠しパッケージ内のpublicクラスです。\nクラスパスにこのjarを配置すると、互換性のない\npublicインタフェースが生成されます diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties index 1979f3e2386..41833d28bfc 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties @@ -80,6 +80,8 @@ error.validator.info.opens.notequal=版本化目录中的 module-info.class 包 error.validator.info.provides.notequal=版本化目录中的 module-info.class 包含不同的 "provides" error.validator.info.version.notequal={0}: 版本化目录中的 module-info.class 包含不同的 "version" error.validator.info.manclass.notequal={0}: 版本化目录中的 module-info.class 包含不同的 "main-class" +error.validator.metainf.wrong.position=条目 META-INF/ 应位于位置 0 处,但发现:{0} +error.validator.manifest.wrong.position=条目 META-INF/MANIFEST.MF 应位于位置 0 或 1 处,但发现该条目位于位置 {0} 处 warn.validator.identical.entry=警告: 条目 {0} 包含与 jar 中的\n现有条目相同的类 warn.validator.resources.with.same.name=警告: 条目 {0}, 多个资源具有相同名称 warn.validator.concealed.public.class=警告: 条目 {0} 是已隐藏程序包中的\n公共类, 将此 jar 放置在类路径中\n将导致公共接口不兼容 diff --git a/src/jdk.jartool/share/man/jarsigner.md b/src/jdk.jartool/share/man/jarsigner.md index 0ecc159a037..d128b9c11ff 100644 --- a/src/jdk.jartool/share/man/jarsigner.md +++ b/src/jdk.jartool/share/man/jarsigner.md @@ -483,7 +483,7 @@ the following standards: `-keystore` option is relevant for signing and verifying a JAR file. In addition, aliases are specified when signing and verifying a JAR file. -`-keystore` *url* +[`-keystore`]{#option-keystore} *url* : Specifies the URL that tells the keystore location. This defaults to the file `.keystore` in the user's home directory, as determined by the `user.home` system property. @@ -517,7 +517,7 @@ the following standards: > `keytool -keystore NONE -storetype PKCS11 -list` -`-storepass` \[`:env` \| `:file`\] *argument* +[`-storepass`]{#option-storepass} \[`:env` \| `:file`\] *argument* : Specifies the password that is required to access the keystore. This is only needed when signing (not verifying) a JAR file. In that case, if a `-storepass` option isn't provided at the command line, then the user is @@ -536,7 +536,7 @@ the following standards: The password shouldn't be specified on the command line or in a script unless it is for testing purposes, or you are on a secure system. -`-storetype` *storetype* +[`-storetype`]{#option-storetype} *storetype* : Specifies the type of keystore to be instantiated. The default keystore type is the one that is specified as the value of the `keystore.type` property in the security properties file, which is returned by the static @@ -548,7 +548,7 @@ the following standards: (such as a dedicated PIN-pad or a biometric reader), then the `-protected` option must be specified and no password options can be specified. -`-keypass` \[`:env` \| `:file`\] *argument* `-certchain` *file* +[`-keypass`]{#option-keypass} \[`:env` \| `:file`\] *argument* `-certchain` *file* : Specifies the password used to protect the private key of the keystore entry addressed by the alias specified on the command line. The password is required when using `jarsigner` to sign a JAR file. If no password is @@ -568,7 +568,7 @@ the following standards: The password shouldn't be specified on the command line or in a script unless it is for testing purposes, or you are on a secure system. -`-certchain` *file* +[`-certchain`]{#option-certchain} *file* : Specifies the certificate chain to be used when the certificate chain associated with the private key of the keystore entry that is addressed by the alias specified on the command line isn't complete. This can happen @@ -579,7 +579,7 @@ the following standards: (also known as Base64 encoding) as defined by [Internet RFC 1421 Certificate Encoding Standard](http://tools.ietf.org/html/rfc1421). -`-sigfile` *file* +[`-sigfile`]{#option-sigfile} *file* : Specifies the base file name to be used for the generated `.SF` and signature block files. For example, if file is `DUKESIGN`, then the generated `.SF` and signature block files are named `DUKESIGN.SF` and `DUKESIGN.RSA`, and placed in the @@ -598,10 +598,10 @@ the following standards: file name, then each such character is converted to an underscore (\_) character to form the file name. -`-signedjar` *file* +[`-signedjar`]{#option-signedjar} *file* : Specifies the name of signed JAR file. -`-digestalg` *algorithm* +[`-digestalg`]{#option-digestalg} *algorithm* : Specifies the name of the message digest algorithm to use when digesting the entries of a JAR file. @@ -613,7 +613,7 @@ the following standards: specified algorithm or the user must specify one with the `-addprovider` or `-providerClass` options; otherwise, the command will not succeed. -`-sigalg` *algorithm* +[`-sigalg`]{#option-sigalg} *algorithm* : Specifies the name of the signature algorithm to use to sign the JAR file. This algorithm must be compatible with the private key used to sign the @@ -627,10 +627,10 @@ the following standards: For a list of standard signature algorithm names, see the Java Security Standard Algorithm Names Specification. -`-verify` +[`-verify`]{#option-verify} : Verifies a signed JAR file. -`-verbose`\[`:`*suboptions*\] +[`-verbose`]{#option-verbose}\[`:`*suboptions*\] : When the `-verbose` option appears on the command line, it indicates that the `jarsigner` use the verbose mode when signing or verifying with the suboptions determining how much information is shown. This causes the , @@ -654,7 +654,7 @@ the following standards: more)*. See [Example of Verifying a Signed JAR File] and [Example of Verification with Certificate Information]. -`-certs` +[`-certs`]{#option-certs} : If the `-certs` option appears on the command line with the `-verify` and `-verbose` options, then the output includes certificate information for each signer of the JAR file. This information includes the name of the type @@ -669,14 +669,14 @@ the following standards: the alias name for the keystore entry for that signer is displayed in parentheses. -`-revCheck` +[`-revCheck`]{#option-revCheck} : This option enables revocation checking of certificates when signing or verifying a JAR file. The `jarsigner` command attempts to make network connections to fetch OCSP responses and CRLs if the `-revCheck` option is specified on the command line. Note that revocation checks are not enabled unless this option is specified. -`-tsa` *url* +[`-tsa`]{#option-tsa} *url* : If `-tsa http://example.tsa.url` appears on the command line when signing a JAR file then a time stamp is generated for the signature. The URL, `http://example.tsa.url`, identifies the location of the Time Stamping @@ -689,7 +689,7 @@ the following standards: stamp token returned by the TSA is stored with the signature in the signature block file. -`-tsacert` *alias* +[`-tsacert`]{#option-tsacert} *alias* : When `-tsacert` *alias* appears on the command line when signing a JAR file, a time stamp is generated for the signature. The alias identifies the TSA public key certificate in the keystore that is in effect. The entry's @@ -699,7 +699,7 @@ the following standards: The TSA public key certificate must be present in the keystore when using the `-tsacert` option. -`-tsapolicyid` *policyid* +[`-tsapolicyid`]{#option-tsapolicyid} *policyid* : Specifies the object identifier (OID) that identifies the policy ID to be sent to the TSA server. If this option isn't specified, no policy ID is sent and the TSA server will choose a default policy ID. @@ -708,7 +708,7 @@ the following standards: Standardization Sector (ITU-T) standard. These identifiers are typically period-separated sets of non-negative digits like `1.2.3.4`, for example. -`-tsadigestalg` *algorithm* +[`-tsadigestalg`]{#option-tsadigestalg} *algorithm* : Specifies the message digest algorithm that is used to generate the message imprint to be sent to the TSA server. If this option isn't specified, SHA-384 will be used. @@ -718,7 +718,7 @@ the following standards: For a list of standard message digest algorithm names, see the Java Security Standard Algorithm Names Specification. -`-internalsf` +[`-internalsf`]{#option-internalsf} : In the past, the signature block file generated when a JAR file was signed included a complete encoded copy of the `.SF` file (signature file) also generated. This behavior has been changed. To reduce the overall @@ -728,7 +728,7 @@ the following standards: In practice, don't use the `-internalsf` option because it incurs higher overhead. -`-sectionsonly` +[`-sectionsonly`]{#option-sectionsonly} : If the `-sectionsonly` option appears on the command line, then the `.SF` file (signature file) generated when a JAR file is signed doesn't include a header that contains a hash of the whole manifest file. It contains only @@ -747,12 +747,12 @@ the following standards: The `-sectionsonly` option is primarily used for testing. It shouldn't be used other than for testing because using it incurs higher overhead. -`-protected` +[`-protected`]{#option-protected} : Values can be either `true` or `false`. Specify `true` when a password must be specified through a protected authentication path such as a dedicated PIN reader. -`-providerName` *providerName* +[`-providerName`]{#option-providerName} *providerName* : If more than one provider was configured in the `java.security` security properties file, then you can use the `-providerName` option to target a specific provider instance. The argument to this option is the name of the @@ -768,7 +768,7 @@ the following standards: > `jarsigner -keystore NONE -storetype PKCS11 -providerName SunPKCS11-SmartCard -list` -`-addprovider` *name* \[`-providerArg` *arg*\] +[`-addprovider`]{#option-addprovider} *name* \[`-providerArg` *arg*\] : Adds a security provider by name (such as SunPKCS11) and an optional configure argument. The value of the security provider is the name of a security provider that is defined in a module. @@ -782,7 +782,7 @@ the following standards: > `jarsigner -keystore NONE -storetype PKCS11 -addprovider SunPKCS11 -providerArg /mydir1/mydir2/token.config` -`-providerClass` *provider-class-name* \[`-providerArg` *arg*\] +[`-providerClass`]{#option-providerClass} *provider-class-name* \[`-providerArg` *arg*\] : Used to specify the name of cryptographic service provider's master class file when the service provider isn't listed in the `java.security` security properties file. Adds a security provider by fully-qualified class name and @@ -792,7 +792,7 @@ the following standards: The preferred way to load PKCS11 is by using modules. See `-addprovider`. -`-providerPath` *classpath* +[`-providerPath`]{#option-providerPath} *classpath* : Used to specify the classpath for providers specified by the `-providerClass` option. Multiple paths should be separated by the system-dependent path-separator character. @@ -804,13 +804,13 @@ the following standards: execution environment or memory usage. For a list of possible interpreter options, type `java -h` or `java -X` at the command line. -`-strict` +[`-strict`]{#option-strict} : During the signing or verifying process, the command may issue warning messages. If you specify this option, the exit code of the tool reflects the severe warning messages that this command found. See [Errors and Warnings]. -`-conf` *url* +[`-conf`]{#option-conf} *url* : Specifies a pre-configured options file. Read the [keytool documentation](keytool.html#pre-configured-options-file) for details. The property keys supported are "jarsigner.all" for all actions, @@ -818,7 +818,7 @@ the following standards: `jarsigner` arguments including the JAR file name and alias name(s) cannot be set in this file. -`-version` +[`-version`]{#option-version} : Prints the program version. ## Errors and Warnings diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java index 6ad1d2107c6..edc2b4f1f3f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.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 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java index 60c99dfa76a..c91ee348c11 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index 1f2c4d97dd3..86ac3a892fd 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -243,8 +243,12 @@ public abstract class HtmlDocletWriter { if (generating) { writeGenerating(); } + CURRENT_PATH.set(path.getPath()); } + /** Temporary workaround to share current path with taglets, see 8373909 */ + public static final ThreadLocal CURRENT_PATH = new ThreadLocal<>(); + /** * The top-level method to generate and write the page represented by this writer. * diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.java index cb8b3dbfd40..21b3a07b70b 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.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 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriter.java index 1847ddf979f..b8acc4d40fe 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriter.java index dbc0c7ceaf3..e81ad2f39af 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriter.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 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java index 37edd800328..383bde4a63d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.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 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyles.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyles.java index 7f33ebedfa4..9b59cb0cb47 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyles.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties index 4cbb4b97774..a380b29d553 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties @@ -190,6 +190,10 @@ doclet.Window_Help_title=API-Hilfe doclet.references={0} Referenzen doclet.Window_Search_title=Suchen doclet.search.main_heading=Suchen +doclet.theme.select_theme=Theme auswählen +doclet.theme.light=Hell +doclet.theme.dark=Dunkel +doclet.theme.system=Systemeinstellung # label for link/button element to show the information below doclet.search.show_more=Zusätzliche Ressourcen @@ -539,3 +543,5 @@ doclet.NoFrames_specified=Die Option --no-frames wird nicht mehr benötigt und w # L10N: do not localize the option name -footer doclet.footer_specified=Die Option -footer wird nicht mehr unterstützt und wird ignoriert.\nSie wird möglicherweise in einem zukünftigen Release entfernt. + +doclet.selectModule=Wählen Sie das Modul aus, in dem gesucht werden soll. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_en.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_en.properties new file mode 100644 index 00000000000..e1312e77aa4 --- /dev/null +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_en.properties @@ -0,0 +1,28 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Empty resource bundle to be used with English default bundle as parent. +# This is necessary to make English resources available on systems using +# one of the supported non-English locales as default locale. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties index 2151b3f4a2e..69cdc862b4c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties @@ -190,6 +190,10 @@ doclet.Window_Help_title=APIヘルプ doclet.references={0}の参照 doclet.Window_Search_title=検索 doclet.search.main_heading=検索 +doclet.theme.select_theme=テーマを選択 +doclet.theme.light=明るい +doclet.theme.dark=暗い +doclet.theme.system=システム設定 # label for link/button element to show the information below doclet.search.show_more=その他のリソース @@ -539,3 +543,5 @@ doclet.NoFrames_specified=--no-framesオプションは必須ではなくなり # L10N: do not localize the option name -footer doclet.footer_specified=-footerオプションはサポートされなくなったため、無視されます。\n将来のリリースで削除される可能性があります。 + +doclet.selectModule=検索するモジュールを選択します。 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties index 66620d158bb..b3a0a3a1197 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties @@ -190,6 +190,10 @@ doclet.Window_Help_title=API 帮助 doclet.references={0} 个引用 doclet.Window_Search_title=搜索 doclet.search.main_heading=搜索 +doclet.theme.select_theme=选择主题 +doclet.theme.light=浅色 +doclet.theme.dark=深色 +doclet.theme.system=系统设置 # label for link/button element to show the information below doclet.search.show_more=其他资源 @@ -539,3 +543,5 @@ doclet.NoFrames_specified=--no-frames 选项不再是必需的,可能\n会在 # L10N: do not localize the option name -footer doclet.footer_specified=-footer 选项不再受支持并将被忽略。\n可能会在未来发行版中删除此选项。 + +doclet.selectModule=选择要在其中搜索的模块。 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/stylesheet.css b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/stylesheet.css index 53b9d8ca6b2..6198df5c2f3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/stylesheet.css +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/stylesheet.css @@ -163,6 +163,13 @@ \ '); --current-theme-svg: url("moon.svg"); + div.block a[href], div.horizontal-scroll a[href], div.inherited-list h3 a[href], header > div a[href], + .hierarchy a[href], .index a[href], div.caption a[href], .sub-title a[href], .deprecation-comment a[href], + .serialized-class-details a[href] { + text-decoration: underline; + text-decoration-thickness: 0.02em; + text-underline-offset: 0.12em; + } } /* * Styles for individual HTML elements. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java index 62b003afd96..e239feed0e7 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.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 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java index f415a673345..cda8c2fa740 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java index b1266516586..c26e507279e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/WorkArounds.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties index 0ee34071c93..a6dbf050bf3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties @@ -65,6 +65,7 @@ doclet.JavaScript_in_comment=JavaScript in Dokumentationskommentar gefunden.\nVe doclet.JavaScript_in_option=Option {0} enthält JavaScript.\nVerwenden Sie --allow-script-in-comments, um die Verwendung von JavaScript zuzulassen. doclet.Link_icon=Linksymbol doclet.Link_to_section=Link zu diesem Abschnitt +doclet.Toggle_member_listing=Zwischen kurzer und detaillierter Listenansicht umschalten doclet.Packages=Packages doclet.All_Packages=Alle Packages doclet.Modules=Module @@ -114,7 +115,7 @@ doclet.inheritDocWithinInappropriateTag=@inheritDoc kann in diesem Tag nicht ver doclet.inheritDocNoDoc=überschriebene Methoden dokumentieren Ausnahmetyp {0} nicht doclet.throwsInheritDocUnsupported=@inheritDoc wird für Parameter vom Typ Ausnahme, die nicht von einer Methode deklariert werden, nicht unterstützt. Dokumentieren Sie solche Ausnahmetypen direkt. doclet.noInheritedDoc=@inheritDoc wurde verwendet, aber mit {0} wird keine Methode außer Kraft gesetzt oder implementiert. -doclet.tag_misuse=Tag {0} kann nicht in {1}-Dokumentation verwendet werden. Es kann nur in folgenden Dokumentationstypen verwendet werden: {2}. +doclet.tag_misuse=Tag {0} kann nicht in Dokumentation {1} verwendet werden. Es kann nur in folgenden Dokumentationstypen verwendet werden: {2}. doclet.Package_Summary=Packageübersicht doclet.Requires_Summary=Erfordernisse doclet.Indirect_Requires_Summary=Indirekte Erfordernisse @@ -226,7 +227,7 @@ doclet.search=Suchen doclet.search_placeholder=In Dokumentation suchen ("/" eingeben) doclet.search_in_documentation=In Dokumentation suchen doclet.search_reset=Zurücksetzen -doclet.Member=Mitglied +doclet.Member=Member doclet.Field=Feld doclet.Property=Eigenschaft doclet.Constructor=Konstruktor @@ -240,11 +241,14 @@ doclet.Description=Beschreibung doclet.ConstantField=Konstantenfeld doclet.Value=Wert doclet.table_of_contents=Inhaltsverzeichnis +doclet.Sort_lexicographically=Member-Details lexikographisch sortieren +doclet.Sort_by_source_order=Member-Details nach Quellreihenfolge sortieren doclet.hide_sidebar=Randleiste ausblenden doclet.show_sidebar=Randleiste einblenden doclet.filter_label=Inhalt filtern ("." eingeben) doclet.filter_table_of_contents=Inhaltsverzeichnis filtern doclet.filter_reset=Zurücksetzen +doclet.sort_table_of_contents=Member-Details in lexikographischer Reihenfolge sortieren doclet.linkMismatch_PackagedLinkedtoModule=Der Code, der dokumentiert wird, verwendet Packages im unbenannten Modul, aber die in {0} definierten Packages befinden sich in benannten Modulen. doclet.linkMismatch_ModuleLinkedtoPackage=Der Code, der dokumentiert wird, verwendet Module, aber die in {0} definierten Packages befinden sich im unbenannten Modul. doclet.urlRedirected=URL {0} wurde umgeleitet an {1} - Aktualisieren Sie die Befehlszeilenoptionen, um diese Warnung zu unterdrücken. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_en.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_en.properties new file mode 100644 index 00000000000..e1312e77aa4 --- /dev/null +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_en.properties @@ -0,0 +1,28 @@ +# +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Empty resource bundle to be used with English default bundle as parent. +# This is necessary to make English resources available on systems using +# one of the supported non-English locales as default locale. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties index 2b10f4e6e9a..1970203da38 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties @@ -65,6 +65,7 @@ doclet.JavaScript_in_comment=ドキュメント・コメントにJavaScriptが doclet.JavaScript_in_option=オプション{0}にJavaScriptが含まれています。\n--allow-script-in-commentsを使用して、JavaScriptの使用を許可してください。 doclet.Link_icon=リンク・アイコン doclet.Link_to_section=このセクションにリンク +doclet.Toggle_member_listing=短いリスト・ビューと詳細リスト・ビューの切替え doclet.Packages=パッケージ doclet.All_Packages=すべてのパッケージ doclet.Modules=モジュール @@ -240,11 +241,14 @@ doclet.Description=説明 doclet.ConstantField=定数フィールド doclet.Value=値 doclet.table_of_contents=目次 +doclet.Sort_lexicographically=メンバー詳細を辞書順にソート +doclet.Sort_by_source_order=メンバー詳細をソース順序にソート doclet.hide_sidebar=サイドバーの非表示 doclet.show_sidebar=サイドバーの表示 doclet.filter_label=コンテンツのフィルタ(.と入力) doclet.filter_table_of_contents=目次のフィルタ doclet.filter_reset=リセット +doclet.sort_table_of_contents=メンバー詳細を辞書順にソート doclet.linkMismatch_PackagedLinkedtoModule=ドキュメント化しようとしているコードでは名前のないモジュールのパッケージが使用されていますが、{0}で定義されているパッケージは名前のあるモジュールのものです。 doclet.linkMismatch_ModuleLinkedtoPackage=ドキュメント化しようとしているコードではモジュールが使用されていますが、{0}で定義されているパッケージは名前のないモジュールのものです。 doclet.urlRedirected=URL {0}は{1}にリダイレクトされました -- コマンドライン・オプションを更新してこの警告を表示しないようにしてください。 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties index f2c8762b283..62e51c2c1c4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties @@ -65,6 +65,7 @@ doclet.JavaScript_in_comment=文档注释中发现 JavaScript。\n使用 --allow doclet.JavaScript_in_option=选项 {0} 包含 JavaScript。\n使用 --allow-script-in-comments 可允许使用 JavaScript。 doclet.Link_icon=链接图标 doclet.Link_to_section=链接到此节 +doclet.Toggle_member_listing=在简短列表视图和详细列表视图之间切换 doclet.Packages=程序包 doclet.All_Packages=所有程序包 doclet.Modules=模块 @@ -240,11 +241,14 @@ doclet.Description=说明 doclet.ConstantField=常量字段 doclet.Value=值 doclet.table_of_contents=目录 +doclet.Sort_lexicographically=按字典顺序对成员详细信息进行排序 +doclet.Sort_by_source_order=按源顺序对成员详细信息进行排序 doclet.hide_sidebar=隐藏子工具栏 doclet.show_sidebar=显示子工具栏 doclet.filter_label=筛选内容(键入 .) doclet.filter_table_of_contents=筛选目录 doclet.filter_reset=重置 +doclet.sort_table_of_contents=按字典顺序对成员详细信息进行排序 doclet.linkMismatch_PackagedLinkedtoModule=进行文档化的代码使用了未命名模块中的程序包,但在 {0} 中定义的程序包在命名模块中。 doclet.linkMismatch_ModuleLinkedtoPackage=进行文档化的代码使用了模块,但在 {0} 中定义的程序包在未命名模块中。 doclet.urlRedirected=URL {0} 已重定向到 {1} — 更新命令行选项以隐藏此警告。 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java index 26e9635b9db..a25879f4052 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java index 43405c3ebb0..b5399d0fef9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclint/Checker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Content.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Content.java index f582dbdc76a..9a6cae7e141 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Content.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Content.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/ContentBuilder.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/ContentBuilder.java index abcd8e199bb..5aab7cb56c9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/ContentBuilder.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/ContentBuilder.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 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Entity.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Entity.java index 5d080c19c67..a37a4d95565 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Entity.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Entity.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 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/RawHtml.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/RawHtml.java index 38be7799c4e..bcd71006cbd 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/RawHtml.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/RawHtml.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocLog.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocLog.java index 84c32a4c732..b3bf1c14cb1 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocLog.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocLog.java @@ -55,7 +55,6 @@ import com.sun.source.doctree.TextTree; import com.sun.tools.javac.tree.DCTree.DCDocComment; import com.sun.tools.javac.tree.DCTree; -import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.util.Context.Factory; import com.sun.tools.javac.util.DiagnosticSource; import com.sun.source.tree.CompilationUnitTree; @@ -616,7 +615,7 @@ public class JavadocLog extends Log implements Reporter { } @Override - public int getEndPosition(EndPosTable endPosTable) { + public int getEndPosition() { return end; } }; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties index 7829d2d7e27..57137ffe75d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties @@ -52,7 +52,7 @@ main.opt.package.desc=Zeigt Package-/geschützte/öffentliche Typen und Mitglied main.opt.private.desc=Zeigt alle Typen und Mitglieder. Zeigt bei benannten Modulen\nalle Packages und alle Moduldetails. main.opt.show.members.arg= -main.opt.show.members.desc=Gibt an, welche Member (Felder, Methoden oder Konstruktoren) dokumentiert\nwerden, wobei der Wert "public", "protected",\n"package" oder "private" lauten kann. Der Standardwert ist "protected"\nund zeigt öffentliche und geschützte Member an. "public" zeigt nur\nöffentliche Member, "package" zeigt öffentliche, geschützte und\nPackage-Member, und "private" zeigt alle Member an. +main.opt.show.members.desc=Gibt an, welche Members (Felder, Methoden oder Konstruktoren) dokumentiert\nwerden, wobei der Wert "public", "protected",\n"package" oder "private" lauten kann. Der Standardwert ist "protected"\nund zeigt öffentliche und geschützte Members an. "public" zeigt nur\nöffentliche Members, "package" zeigt öffentliche, geschützte und\nPackage-Members, und "private" zeigt alle Members an. main.opt.show.types.arg= main.opt.show.types.desc=Gibt an, welche Typen (Klassen, Schnittstellen usw.) dokumentiert\nwerden, wobei der Wert "public", "protected",\n"package" oder "private" lauten kann. Der Standardwert ist "protected"\nund zeigt öffentliche und geschützte Typen, "public" zeigt nur\nöffentliche Typen, "package" zeigt öffentliche, geschützte und\nPackagetypen, und "private" zeigt alle Typen. diff --git a/src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionExecuter.java b/src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionExecuter.java index 860fd832197..649e878d340 100644 --- a/src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionExecuter.java +++ b/src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionExecuter.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 diff --git a/src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionResolver.java b/src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionResolver.java index f0e1bc371e3..9e43b079793 100644 --- a/src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionResolver.java +++ b/src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionResolver.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 diff --git a/src/jdk.jcmd/share/classes/sun/tools/jstat/Parser.java b/src/jdk.jcmd/share/classes/sun/tools/jstat/Parser.java index cf1790d65e6..06de56533a6 100644 --- a/src/jdk.jcmd/share/classes/sun/tools/jstat/Parser.java +++ b/src/jdk.jcmd/share/classes/sun/tools/jstat/Parser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, 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 diff --git a/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options b/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options index 6bf67b9bdc4..1589526db0e 100644 --- a/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options +++ b/src/jdk.jcmd/share/classes/sun/tools/jstat/resources/jstat_options @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, 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 diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/jnativescan/Main.java b/src/jdk.jdeps/share/classes/com/sun/tools/jnativescan/Main.java index 9aa77a947a9..7d645025630 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/jnativescan/Main.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/jnativescan/Main.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 diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java b/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java index 3bd363af56e..de13561a4fc 100644 --- a/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java +++ b/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.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 @@ -251,13 +251,13 @@ public interface EventRequestManager extends Mirror { * after the first step is detected. Thus a next line method * would do the following: *
    {@code
    -     *     EventRequestManager mgr = myVM.{@link VirtualMachine#eventRequestManager eventRequestManager}();
    +     *     EventRequestManager mgr = myVM.eventRequestManager();
          *     StepRequest request = mgr.createStepRequest(myThread,
    -     *                                                 StepRequest.{@link StepRequest#STEP_LINE STEP_LINE},
    -     *                                                 StepRequest.{@link StepRequest#STEP_OVER STEP_OVER});
    -     *     request.{@link EventRequest#addCountFilter addCountFilter}(1);  // next step only
    +     *                                                 StepRequest.STEP_LINE,
    +     *                                                 StepRequest.STEP_OVER);
    +     *     request.addCountFilter(1);  // next step only
          *     request.enable();
    -     *     myVM.{@link VirtualMachine#resume resume}();
    +     *     myVM.resume();
          * }
    * * @param thread the thread in which to step @@ -382,7 +382,7 @@ public interface EventRequestManager extends Mirror { * Iterator iter = requestManager.stepRequests().iterator(); * while (iter.hasNext()) { * requestManager.deleteEventRequest(iter.next()); - * } + * } *
    * may cause a {@link java.util.ConcurrentModificationException}. * Instead use diff --git a/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java b/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java index 19e8b45c491..9a13eb3dca5 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, 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 @@ -37,6 +37,7 @@ import com.sun.jdi.InternalException; import com.sun.jdi.Locatable; import com.sun.jdi.Location; import com.sun.jdi.Method; +import com.sun.jdi.ObjectCollectedException; import com.sun.jdi.ObjectReference; import com.sun.jdi.ReferenceType; import com.sun.jdi.ThreadReference; @@ -206,6 +207,19 @@ public class EventSetImpl extends ArrayList implements EventSet { } + /* Safely fetch the thread name in case there is an ObjectCollectedException. + * This can happen when dealing with SUSPEND_NONE events. + */ + private static String getThreadName(ThreadReference thread) { + String name; + try { + name = thread.name(); + } catch (ObjectCollectedException oce) { + name = ""; + } + return name; + } + abstract class ThreadedEventImpl extends EventImpl { private ThreadReference thread; @@ -220,7 +234,7 @@ public class EventSetImpl extends ArrayList implements EventSet { } public String toString() { - return eventName() + " in thread " + thread.name(); + return eventName() + " in thread " + getThreadName(thread); } } @@ -249,7 +263,7 @@ public class EventSetImpl extends ArrayList implements EventSet { public String toString() { return eventName() + "@" + ((location() == null) ? " null" : location().toString()) + - " in thread " + thread().name(); + " in thread " + getThreadName(thread()); } } diff --git a/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java b/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java index e5dce0718f4..766c65ea195 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/ThreadReferenceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jdi/windows/native/libdt_shmem/shmem_md.c b/src/jdk.jdi/windows/native/libdt_shmem/shmem_md.c index df07b753f0e..3badeb74207 100644 --- a/src/jdk.jdi/windows/native/libdt_shmem/shmem_md.c +++ b/src/jdk.jdi/windows/native/libdt_shmem/shmem_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, 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 diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c b/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c index 3eddb01eaa5..2bc6fa5259e 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/EventRequestImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,12 +84,10 @@ readAndSetFilters(JNIEnv *env, PacketInputStream *in, HandlerNode *node, } case JDWP_REQUEST_MODIFIER(LocationOnly): { - jbyte tag; jclass clazz; jmethodID method; jlocation location; - tag = inStream_readByte(in); /* not currently used */ - tag = tag; /* To shut up lint */ + (void)inStream_readByte(in); /* not currently used */ if ( (serror = inStream_error(in)) != JDWP_ERROR(NONE) ) break; clazz = inStream_readClassRef(env, in); diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/SDE.c b/src/jdk.jdwp.agent/share/native/libjdwp/SDE.c index b1f18dd10be..4334b4cbc63 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/SDE.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/SDE.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, 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 @@ -718,19 +718,6 @@ private jboolean isValid(void); lineTable[lti].jplsLineInc)); } - private int fileTableIndex(int sti, int fileId) { - int i; - int fileIndexStart = stratumTable[sti].fileIndex; - /* one past end */ - int fileIndexEnd = stratumTable[sti+1].fileIndex; - for (i = fileIndexStart; i < fileIndexEnd; ++i) { - if (fileTable[i].fileId == fileId) { - return i; - } - } - return -1; - } - private jboolean isValid(void) { return sourceMapIsValid; } diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c b/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c index 2bed6b6bb28..1911ff1bed4 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c @@ -181,11 +181,11 @@ DEF_Agent_OnLoad(JavaVM *vm, char *options, void *reserved) vmInitialized = JNI_FALSE; gdata->vmDead = JNI_FALSE; - jvmtiCompileTimeMajorVersion = ( JVMTI_VERSION & JVMTI_VERSION_MASK_MAJOR ) + jvmtiCompileTimeMajorVersion = ((unsigned)JVMTI_VERSION & JVMTI_VERSION_MASK_MAJOR) >> JVMTI_VERSION_SHIFT_MAJOR; - jvmtiCompileTimeMinorVersion = ( JVMTI_VERSION & JVMTI_VERSION_MASK_MINOR ) + jvmtiCompileTimeMinorVersion = ((unsigned)JVMTI_VERSION & JVMTI_VERSION_MASK_MINOR) >> JVMTI_VERSION_SHIFT_MINOR; - jvmtiCompileTimeMicroVersion = ( JVMTI_VERSION & JVMTI_VERSION_MASK_MICRO ) + jvmtiCompileTimeMicroVersion = ((unsigned)JVMTI_VERSION & JVMTI_VERSION_MASK_MICRO) >> JVMTI_VERSION_SHIFT_MICRO; /* Get the JVMTI Env, IMPORTANT: Do this first! For jvmtiAllocate(). */ diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/error_messages.c b/src/jdk.jdwp.agent/share/native/libjdwp/error_messages.c index a37b88e70df..6ddc6fe739a 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/error_messages.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/error_messages.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, 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 @@ -61,6 +61,8 @@ * NOTE: This function is at the lowest level of the call tree. * Do not use the ERROR* macros here. */ + +ATTRIBUTE_PRINTF(4, 0) static void vprint_message(FILE *fp, const char *prefix, const char *suffix, const char *format, va_list ap) @@ -84,6 +86,7 @@ vprint_message(FILE *fp, const char *prefix, const char *suffix, * NOTE: This function is at the lowest level of the call tree. * Do not use the ERROR* macros here. */ +ATTRIBUTE_PRINTF(4, 5) void print_message(FILE *fp, const char *prefix, const char *suffix, const char *format, ...) @@ -96,6 +99,7 @@ print_message(FILE *fp, const char *prefix, const char *suffix, } /* Generate error message */ +ATTRIBUTE_PRINTF(1, 2) void error_message(const char *format, ...) { @@ -110,6 +114,7 @@ error_message(const char *format, ...) } /* Print plain message to stdout. */ +ATTRIBUTE_PRINTF(1, 2) void tty_message(const char *format, ...) { diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c b/src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c index 3ba875e88cd..6fe01044a2c 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/eventFilter.c @@ -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 @@ -976,7 +976,6 @@ eventFilter_setSourceNameMatchFilter(HandlerNode *node, jvmtiError eventFilter_setPlatformThreadsOnlyFilter(HandlerNode *node, jint index) { - PlatformThreadsFilter *filter = &FILTER(node, index).u.PlatformThreadsOnly; if (index >= FILTER_COUNT(node)) { return AGENT_ERROR_ILLEGAL_ARGUMENT; } diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/inStream.c b/src/jdk.jdwp.agent/share/native/libjdwp/inStream.c index 232da2cb348..de424853175 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/inStream.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/inStream.c @@ -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 @@ -470,6 +470,7 @@ inStream_readValue(PacketInputStream *stream) break; default: stream->error = JDWP_ERROR(INVALID_TAG); + value.j = 0L; // to make compiler happy break; } } diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c b/src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c index ebc39febff9..e24fcd57156 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, 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 @@ -155,6 +155,7 @@ standard_logging_format(FILE *fp, } /* End a log entry */ +ATTRIBUTE_PRINTF(1, 2) void log_message_end(const char *format, ...) { diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c b/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c index 491182a583f..7b0adab8ca5 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c @@ -70,6 +70,7 @@ typedef struct ThreadNode { unsigned int popFrameEvent : 1; unsigned int popFrameProceed : 1; unsigned int popFrameThread : 1; + unsigned int frameGeneration_accessed:1; /* true if frameGeneration accessed to produce a FrameID */ EventIndex current_ei; /* Used to determine if we are currently handling an event on this thread. */ jobject pendingStop; /* Object we are throwing to stop the thread (ThreadReferenceImpl.stop). */ jint suspendCount; /* Number of outstanding suspends from the debugger. */ @@ -157,11 +158,24 @@ setThreadLocalStorage(jthread thread, ThreadNode *node) error = JVMTI_FUNC_PTR(gdata->jvmti,SetThreadLocalStorage) (gdata->jvmti, thread, (void*)node); - if ( error == JVMTI_ERROR_THREAD_NOT_ALIVE && node == NULL) { - /* Just return. This can happen when clearing the TLS. */ + if (error == JVMTI_ERROR_THREAD_NOT_ALIVE) { + if (node == NULL) { + // Just return. This can happen when clearing the TLS. + return; + } + if (isVThread(thread)) { + // Just return. This can happen with a vthread that is running and we + // had to create a ThreadNode for it. By the time we get here, it may + // have already terminated. + return; + } + } + if (error == JVMTI_ERROR_WRONG_PHASE && gdata->vmDead && isVThread(thread)) { + // Just return. This can happen with vthreads when the vm is exiting. return; - } else if ( error != JVMTI_ERROR_NONE ) { - /* The jthread object must be valid, so this must be a fatal error */ + } + if (error != JVMTI_ERROR_NONE) { + // The jthread object must be valid, so this must be a fatal error. EXIT_ERROR(error, "cannot set thread local storage"); } } @@ -251,9 +265,10 @@ findThread(ThreadList *list, jthread thread) * Otherwise the thread should not be on the runningThreads. */ if ( !gdata->jvmtiCallBacksCleared ) { - /* The thread better not be on either list if the TLS lookup failed. */ + // The thread better not be on the runningThreads list if the TLS lookup failed. + // It might be on the runningVThreads list because of how ThreadNodes for vthreads + // can be recreated just before terminating, so we don't check runningVThreads. JDI_ASSERT(!nonTlsSearch(getEnv(), &runningThreads, thread)); - JDI_ASSERT(!nonTlsSearch(getEnv(), &runningVThreads, thread)); } else { /* * Search the runningThreads and runningVThreads lists. The TLS lookup may have @@ -606,6 +621,7 @@ freeUnusedVThreadNode(JNIEnv *env, ThreadNode* node) !node->popFrameEvent && !node->popFrameProceed && !node->popFrameThread && + !node->frameGeneration_accessed && node->pendingStop == NULL) { removeNode(node); @@ -2651,12 +2667,16 @@ threadControl_setEventMode(jvmtiEventMode mode, EventIndex ei, jthread thread) /* * Returns the current thread. + * Returns NULL on error (JVMTI_ERROR_WRONG_PHASE, JVMTI_ERROR_UNATTACHED_THREAD). */ jthread threadControl_currentThread(void) { jthread thread = NULL; jvmtiError error = JVMTI_FUNC_PTR(gdata->jvmti,GetCurrentThread)(gdata->jvmti, &thread); + if (error != JVMTI_ERROR_NONE) { + return NULL; + } return thread; } @@ -2673,6 +2693,7 @@ threadControl_getFrameGeneration(jthread thread) if (node != NULL) { frameGeneration = node->frameGeneration; + node->frameGeneration_accessed = JNI_TRUE; } } debugMonitorExit(threadLock); @@ -2683,11 +2704,9 @@ threadControl_getFrameGeneration(jthread thread) jthread * threadControl_allVThreads(jint *numVThreads) { - JNIEnv *env; ThreadNode *node; jthread* vthreads; - env = getEnv(); debugMonitorEnter(threadLock); *numVThreads = numRunningVThreads; diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c b/src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c index f5573930d34..6bae02fce54 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/utf_util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -173,7 +173,7 @@ int JNICALL utf8mToUtf8sLength(jbyte *string, int length) { newLength = 0; for ( i = 0 ; i < length ; i++ ) { - unsigned byte1, byte2, byte3, byte4, byte5, byte6; + unsigned byte1, byte2, byte4, byte5, byte6; byte1 = (unsigned char)string[i]; if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */ @@ -196,7 +196,7 @@ int JNICALL utf8mToUtf8sLength(jbyte *string, int length) { break; /* Error condition */ } byte2 = (unsigned char)string[++i]; - byte3 = (unsigned char)string[++i]; + ++i; // byte3 is not used newLength += 3; /* Possible process a second 3byte encoding */ if ( (i+3) < length && byte1 == 0xED && (byte2 & 0xF0) == 0xA0 ) { diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/util.h b/src/jdk.jdwp.agent/share/native/libjdwp/util.h index a48c8ba2c09..0975ddeb4fd 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/util.h +++ b/src/jdk.jdwp.agent/share/native/libjdwp/util.h @@ -59,6 +59,14 @@ #include "error_messages.h" #include "debugInit.h" +/* To handle "format string is not a string literal" warning. */ +#if !defined(_MSC_VER) + #define ATTRIBUTE_PRINTF(fmt_pos_num, vargs_pos_num) \ + __attribute__((format(printf, fmt_pos_num, vargs_pos_num))) +#else + #define ATTRIBUTE_PRINTF(fmt_pos_num, vargs_pos_num) +#endif + /* Definition of a CommonRef tracked by the backend for the frontend */ typedef struct RefNode { jlong seqNum; /* ID of reference, also key for hash table */ diff --git a/src/jdk.jdwp.agent/windows/native/libjdwp/proc_md.h b/src/jdk.jdwp.agent/windows/native/libjdwp/proc_md.h index 6c86473625f..e8877f862f8 100644 --- a/src/jdk.jdwp.agent/windows/native/libjdwp/proc_md.h +++ b/src/jdk.jdwp.agent/windows/native/libjdwp/proc_md.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, 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 diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java index 841221c57d9..24c92e81a4c 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java @@ -71,7 +71,7 @@ public final class JVM { /** * Begin recording events * - * Requires that JFR has been started with {@link #createNativeJFR()} + * Requires that JFR has been started with {@link JVMSupport#createJFR()} */ public static native void beginRecording(); @@ -83,7 +83,7 @@ public final class JVM { /** * End recording events, which includes flushing data in thread buffers * - * Requires that JFR has been started with {@link #createNativeJFR()} + * Requires that JFR has been started with {@link JVMSupport#createJFR()} * */ public static native void endRecording(); @@ -144,7 +144,7 @@ public final class JVM { /** * Return unique identifier for stack trace. * - * Requires that JFR has been started with {@link #createNativeJFR()} + * Requires that JFR has been started with {@link JVMSupport#createJFR()} * * @param skipCount number of frames to skip, or 0 if no frames should be * skipped @@ -295,7 +295,7 @@ public final class JVM { /** * Sets the file where data should be written. * - * Requires that JFR has been started with {@link #createNativeJFR()} + * Requires that JFR has been started with {@link JVMSupport#createJFR()} * *
          * Recording  Previous  Current  Action
    @@ -380,7 +380,7 @@ public final class JVM {
          * chunk, data should be written after GMT offset and size of metadata event
          * should be adjusted
          *
    -     * Requires that JFR has been started with {@link #createNativeJFR()}
    +     * Requires that JFR has been started with {@link JVMSupport#createJFR()}
          *
          * @param bytes binary representation of metadata descriptor
          */
    @@ -409,7 +409,7 @@ public final class JVM {
         /**
          * Destroys native part of JFR. If already destroy, call is ignored.
          *
    -     * Requires that JFR has been started with {@link #createNativeJFR()}
    +     * Requires that JFR has been started with {@link JVMSupport#createJFR()}
          *
          * @return if an instance was actually destroyed.
          *
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java
    index eaba86e6327..1180ebd6ea2 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformEventType.java
    @@ -34,6 +34,7 @@ import jdk.jfr.internal.periodic.PeriodicEvents;
     import jdk.jfr.internal.util.ImplicitFields;
     import jdk.jfr.internal.util.TimespanRate;
     import jdk.jfr.internal.util.Utils;
    +import jdk.jfr.internal.settings.CPUThrottleSetting;
     import jdk.jfr.internal.settings.Throttler;
     import jdk.jfr.internal.tracing.Modification;
     
    @@ -60,7 +61,7 @@ public final class PlatformEventType extends Type {
         private boolean stackTraceEnabled = true;
         private long thresholdTicks = 0;
         private long period = 0;
    -    private TimespanRate cpuRate;
    +    private TimespanRate cpuRate = TimespanRate.of(CPUThrottleSetting.DEFAULT_VALUE);
         private boolean hasHook;
     
         private boolean beginChunk;
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java
    index b07a71dd4d5..64454fc3cb4 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java
    @@ -34,6 +34,7 @@ import static jdk.jfr.internal.LogTag.JFR;
     import java.io.IOException;
     import java.io.InputStream;
     import java.nio.channels.FileChannel;
    +import java.nio.channels.FileLock;
     import java.nio.file.NoSuchFileException;
     import java.nio.file.Path;
     import java.nio.file.StandardOpenOption;
    @@ -744,7 +745,14 @@ public final class PlatformRecording implements AutoCloseable {
         }
     
         private void transferChunks(WriteablePath path) throws IOException {
    -        try (ChunksChannel cc = new ChunksChannel(chunks); FileChannel fc = FileChannel.open(path.getReal(), StandardOpenOption.WRITE, StandardOpenOption.APPEND)) {
    +        // Before writing, wipe the file if it already exists.
    +        try (ChunksChannel cc = new ChunksChannel(chunks); FileChannel fc = FileChannel.open(path.getReal(), StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING,  StandardOpenOption.CREATE)) {
    +            // Mitigate races against other processes
    +            FileLock l = fc.tryLock();
    +            if (l == null) {
    +                Logger.log(LogTag.JFR, LogLevel.INFO, "Dump operation skipped for recording \"" + name + "\" (" + id + "). File " + path.getRealPathText() + " is locked by other dump operation or activity.");
    +                return;
    +            }
                 long bytes = cc.transferTo(fc);
                 Logger.log(LogTag.JFR, LogLevel.INFO, "Transferred " + bytes + " bytes from the disk repository");
                 // No need to force if no data was transferred, which avoids IOException when device is /dev/null
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java
    index 3b6859304b8..b6f1273eb9e 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ConstantMap.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/Dispatcher.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/Dispatcher.java
    index 61072e03e79..266756d49e9 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/Dispatcher.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/Dispatcher.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/FieldBuilder.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/FieldBuilder.java
    index df6fb9f2a9a..64791b1976a 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/FieldBuilder.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/FieldBuilder.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
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/QueryResolver.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/QueryResolver.java
    index 1b68a038a17..1bc21131cc1 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/QueryResolver.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/QueryResolver.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
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/view.ini b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/view.ini
    index 91decb1aa20..5d72a9f85dc 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/query/view.ini
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/query/view.ini
    @@ -110,6 +110,15 @@ table = "COLUMN 'Time', 'Requested By', 'Operation', 'Classes'
              GROUP BY redefinitionId
              ORDER BY duration DESC"
     
    +[jvm.classes-by-source]
    + label = "Classes by Source"
    + table = "COLUMN 'Source', 'Count'
    +          FORMAT truncate-beginning, none
    +          SELECT source, COUNT(*) AS C
    +          FROM jdk.ClassDefine
    +          GROUP BY source
    +          ORDER BY C DESC"
    +
     [jvm.compiler-configuration]
     label = "Compiler Configuration"
     form = "SELECT LAST(threadCount), LAST(dynamicCompilerThreadCount), LAST(tieredCompilation)
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/CPUThrottleSetting.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/CPUThrottleSetting.java
    index 944827f6d6f..7ea0ace21bb 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/CPUThrottleSetting.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/settings/CPUThrottleSetting.java
    @@ -65,7 +65,7 @@ public final class CPUThrottleSetting extends SettingControl {
                     }
                 }
             }
    -        return Objects.requireNonNullElse(highestRate.toString(), DEFAULT_VALUE);
    +        return highestRate == null ? DEFAULT_VALUE : highestRate.toString();
         }
     
         @Override
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Query.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Query.java
    index ec0407a6f04..280bef55af4 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Query.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Query.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
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Instrumentation.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Instrumentation.java
    index dbafca4ed3c..e06d361b203 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Instrumentation.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Instrumentation.java
    @@ -58,7 +58,13 @@ final class Instrumentation {
         }
     
         public void addMethod(long methodId, String name, String signature, int modification) {
    -        modificationMap.put(name + signature, new Method(methodId, Modification.valueOf(modification), className + "::" + name));
    +        Method method = new Method(
    +            methodId,
    +            Modification.valueOf(modification),
    +            name.equals(""),
    +            className + "::" + name
    +        );
    +        modificationMap.put(name + signature, method);
         }
     
         public List getMethods() {
    @@ -71,7 +77,7 @@ final class Instrumentation {
             ClassModel classModel = classFile.parse(bytecode);
             byte[] generated = classFile.build(classModel.thisClass().asSymbol(), classBuilder -> {
                 for (var ce : classModel) {
    -                if (modifyClassElement(classBuilder, ce)) {
    +                if (modifyClassElement(classModel, classBuilder, ce)) {
                         modified[0] = true;
                     } else {
                         classBuilder.with(ce);
    @@ -93,7 +99,7 @@ final class Instrumentation {
             }
         }
     
    -    private boolean modifyClassElement(ClassBuilder classBuilder, ClassElement ce) {
    +    private boolean modifyClassElement(ClassModel classModel, ClassBuilder classBuilder, ClassElement ce) {
             if (ce instanceof MethodModel mm) {
                 String method = mm.methodName().stringValue();
                 String signature = mm.methodType().stringValue();
    @@ -102,15 +108,15 @@ final class Instrumentation {
                 if (tm != null) {
                     Modification m = tm.modification();
                     if (m.tracing() || m.timing()) {
    -                    return modifyMethod(classBuilder, mm, tm);
    +                    return modifyMethod(classModel, classBuilder, mm, tm);
                     }
                 }
             }
             return false;
         }
     
    -    private boolean modifyMethod(ClassBuilder classBuilder, MethodModel m, Method method) {
    -        var code = m.code();
    +    private boolean modifyMethod(ClassModel classModel, ClassBuilder classBuilder, MethodModel methodModel, Method method) {
    +        var code = methodModel.code();
             if (code.isPresent()) {
                 if (classLoader == null && ExcludeList.containsMethod(method.name())) {
                     String msg = "Risk of recursion, skipping bytecode generation of " + method.name();
    @@ -118,9 +124,9 @@ final class Instrumentation {
                     return false;
                 }
                 MethodTransform s = MethodTransform.ofStateful(
    -                () -> MethodTransform.transformingCode(new Transform(method))
    +                () -> MethodTransform.transformingCode(new Transform(classModel, code.get(), method))
                 );
    -            classBuilder.transformMethod(m, s);
    +            classBuilder.transformMethod(methodModel, s);
                 return true;
             }
             return false;
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Method.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Method.java
    index d685083153d..d85e458e9d5 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Method.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Method.java
    @@ -31,7 +31,7 @@ import jdk.jfr.internal.Logger;
     /**
      * Class that holds information about an instrumented method.
      */
    -record Method(long methodId, Modification modification, String name) {
    +record Method(long methodId, Modification modification, boolean constructor, String name) {
         @Override
         public String toString() {
             return name + (modification.timing() ? " +timing" : " -timing") + (modification.tracing() ? " +tracing" : " -tracing") + " (Method ID: " + String.format("0x%08X)", methodId);
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Transform.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Transform.java
    index cd65a119cee..377eede7925 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Transform.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tracing/Transform.java
    @@ -24,13 +24,19 @@
      */
     package jdk.jfr.internal.tracing;
     
    +import java.lang.classfile.ClassModel;
     import java.lang.classfile.CodeBuilder;
     import java.lang.classfile.CodeElement;
    +import java.lang.classfile.CodeModel;
     import java.lang.classfile.CodeTransform;
    +import java.lang.classfile.Label;
     import java.lang.classfile.TypeKind;
    +import java.lang.classfile.instruction.InvokeInstruction;
     import java.lang.classfile.instruction.ReturnInstruction;
     import java.lang.classfile.instruction.ThrowInstruction;
     import java.lang.constant.ClassDesc;
    +import java.util.ArrayList;
    +import java.util.List;
     
     import jdk.jfr.internal.util.Bytecode;
     import jdk.jfr.internal.util.Bytecode.MethodDesc;
    @@ -43,59 +49,208 @@ import jdk.jfr.tracing.MethodTracer;
      * The method ID is determined by native code.
      */
     final class Transform implements CodeTransform {
    +    private static class TryBlock {
    +        Label start;
    +        Label end;
    +    }
         private static final ClassDesc METHOD_TRACER_CLASS = ClassDesc.of(MethodTracer.class.getName());
         private static final MethodDesc TRACE_METHOD = MethodDesc.of("trace", "(JJ)V");
         private static final MethodDesc TIMING_METHOD = MethodDesc.of("timing", "(JJ)V");
         private static final MethodDesc TRACE_TIMING_METHOD = MethodDesc.of("traceTiming", "(JJ)V");
         private static final MethodDesc TIMESTAMP_METHOD = MethodDesc.of("timestamp", "()J");
     
    +    private final List tryBlocks = new ArrayList<>();
    +    private final boolean simplifiedInstrumentation;
    +    private final ClassModel classModel;
         private final Method method;
         private int timestampSlot = -1;
     
    -    Transform(Method method) {
    +    Transform(ClassModel classModel, CodeModel model, Method method) {
             this.method = method;
    +        this.classModel = classModel;
    +        // The JVMS (not the JLS) allows multiple mutually exclusive super/this.
    +        // invocations in a constructor body as long as only one lies on any given
    +        // execution path. For example, this is valid bytecode:
    +        //
    +        // Foo(boolean value) {
    +        //   if (value) {
    +        //     staticMethodThatMayThrow();
    +        //     super();
    +        //   } else {
    +        //     try {
    +        //       if (value == 0) {
    +        //         throw new Exception("");
    +        //       }
    +        //     } catch (Throwable t) {
    +        //       throw t;
    +        //     }
    +        //     super();
    +        //   }
    +        // }
    +        //
    +        // If such a method is found, instrumentation falls back to instrumenting only
    +        // RET and ATHROW. This can cause exceptions to be missed or counted twice.
    +        //
    +        // An effect of this heuristic is that constructors like the one below
    +        // will also trigger simplified instrumentation.
    +        //
    +        // class Bar {
    +        // }
    +        //
    +        // class Foo extends Bar {
    +        //   Foo() {
    +        //     new Bar();
    +        //   }
    +        // }
    +        //
    +        // java.lang.Object:: with zero constructor invocations should use simplified instrumentation
    +        this.simplifiedInstrumentation = method.constructor() && constructorInvocations(model.elementList()) != 1;
    +    }
    +
    +    private int constructorInvocations(List elementList) {
    +        int count = 0;
    +        for (CodeElement e : elementList) {
    +            if (isConstructorInvocation(e)) {
    +                count++;
    +            }
    +        }
    +        return count;
    +    }
    +
    +    private boolean isConstructorInvocation(CodeElement element) {
    +        if (element instanceof InvokeInstruction inv && inv.name().equalsString("")) {
    +            if (classModel.thisClass().equals(inv.owner())) {
    +                return true;
    +            }
    +            if (classModel.superclass().isPresent()) {
    +                return classModel.superclass().get().equals(inv.owner());
    +            }
    +        }
    +        return false;
         }
     
         @Override
    -    public final void accept(CodeBuilder builder, CodeElement element) {
    +    public void accept(CodeBuilder builder, CodeElement element) {
    +        if (simplifiedInstrumentation) {
    +            acceptSimplifiedInstrumentation(builder, element);
    +            return;
    +        }
    +        if (method.constructor()) {
    +            acceptConstructor(builder, element, isConstructorInvocation(element));
    +        } else {
    +            acceptMethod(builder, element);
    +        }
    +    }
    +
    +    @Override
    +    public void atEnd(CodeBuilder builder) {
    +        endTryBlock(builder);
    +        for (TryBlock block : tryBlocks) {
    +            addCatchHandler(block, builder);
    +        }
    +    }
    +
    +    private void acceptConstructor(CodeBuilder builder, CodeElement element, boolean isConstructorInvocation) {
    +        if (timestampSlot == -1) {
    +            timestampSlot = invokeTimestamp(builder);
    +            builder.lstore(timestampSlot);
    +            if (!isConstructorInvocation) {
    +                beginTryBlock(builder);
    +            }
    +        }
    +        if (isConstructorInvocation) {
    +            endTryBlock(builder);
    +            builder.with(element);
    +            beginTryBlock(builder);
    +            return;
    +        }
    +        if (element instanceof ReturnInstruction) {
    +            addTracing(builder);
    +        }
    +        builder.with(element);
    +    }
    +
    +    private void endTryBlock(CodeBuilder builder) {
    +        if (tryBlocks.isEmpty()) {
    +            return;
    +        }
    +        TryBlock last = tryBlocks.getLast();
    +        if (last.end == null) {
    +            last.end = builder.newBoundLabel();
    +        }
    +    }
    +
    +    private void beginTryBlock(CodeBuilder builder) {
    +        TryBlock block = new TryBlock();
    +        block.start = builder.newBoundLabel();
    +        tryBlocks.add(block);
    +    }
    +
    +    private void acceptSimplifiedInstrumentation(CodeBuilder builder, CodeElement element) {
             if (timestampSlot == -1) {
                 timestampSlot = invokeTimestamp(builder);
                 builder.lstore(timestampSlot);
             }
             if (element instanceof ReturnInstruction || element instanceof ThrowInstruction) {
    -            builder.lload(timestampSlot);
    -            builder.ldc(method.methodId());
    -            Modification modification = method.modification();
    -            boolean objectInit = method.name().equals("java.lang.Object::");
    -            String suffix = objectInit ? "ObjectInit" : "";
    -            if (modification.timing()) {
    -                if (modification.tracing()) {
    -                    invokeTraceTiming(builder, suffix);
    -                } else {
    -                    invokeTiming(builder, suffix);
    -                }
    -            } else {
    -                if (modification.tracing()) {
    -                    invokeTrace(builder, suffix);
    -                }
    -            }
    +            addTracing(builder);
             }
             builder.with(element);
         }
     
    -    public static void invokeTiming(CodeBuilder builder, String suffix) {
    +    private void acceptMethod(CodeBuilder builder, CodeElement element) {
    +        if (timestampSlot == -1) {
    +            timestampSlot = invokeTimestamp(builder);
    +            builder.lstore(timestampSlot);
    +            beginTryBlock(builder);
    +        }
    +        if (element instanceof ReturnInstruction) {
    +            addTracing(builder);
    +        }
    +        builder.with(element);
    +    }
    +
    +    private void addCatchHandler(TryBlock block, CodeBuilder builder) {
    +        Label catchHandler = builder.newBoundLabel();
    +        int exceptionSlot = builder.allocateLocal(TypeKind.REFERENCE);
    +        builder.astore(exceptionSlot);
    +        addTracing(builder);
    +        builder.aload(exceptionSlot);
    +        builder.athrow();
    +        builder.exceptionCatchAll(block.start, block.end, catchHandler);
    +    }
    +
    +    private void addTracing(CodeBuilder builder) {
    +        builder.lload(timestampSlot);
    +        builder.ldc(method.methodId());
    +        Modification modification = method.modification();
    +        boolean objectInit = method.name().equals("java.lang.Object::");
    +        String suffix = objectInit ? "ObjectInit" : "";
    +        if (modification.timing()) {
    +            if (modification.tracing()) {
    +                invokeTraceTiming(builder, suffix);
    +            } else {
    +                invokeTiming(builder, suffix);
    +            }
    +        } else {
    +            if (modification.tracing()) {
    +                invokeTrace(builder, suffix);
    +            }
    +        }
    +    }
    +
    +    private static void invokeTiming(CodeBuilder builder, String suffix) {
             builder.invokestatic(METHOD_TRACER_CLASS, TIMING_METHOD.name() + suffix, TIMING_METHOD.descriptor());
         }
     
    -    public static void invokeTrace(CodeBuilder builder, String suffix) {
    +    private static void invokeTrace(CodeBuilder builder, String suffix) {
             builder.invokestatic(METHOD_TRACER_CLASS, TRACE_METHOD.name() + suffix, TRACE_METHOD.descriptor());
         }
     
    -    public static void invokeTraceTiming(CodeBuilder builder, String suffix) {
    +    private static void invokeTraceTiming(CodeBuilder builder, String suffix) {
             builder.invokestatic(METHOD_TRACER_CLASS, TRACE_TIMING_METHOD.name() + suffix, TRACE_TIMING_METHOD.descriptor());
         }
     
    -    public static int invokeTimestamp(CodeBuilder builder) {
    +    private static int invokeTimestamp(CodeBuilder builder) {
             Bytecode.invokestatic(builder, METHOD_TRACER_CLASS, TIMESTAMP_METHOD);
             return builder.allocateLocal(TypeKind.LONG);
         }
    diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/util/Rate.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/util/Rate.java
    index 2632cd63848..0a7b14965cb 100644
    --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/util/Rate.java
    +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/util/Rate.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
    @@ -34,7 +34,7 @@ public record Rate(long amount, TimespanUnit unit) {
             String value = splitted[0].strip();
             String unit = splitted[1].strip();
             TimespanUnit tu = TimespanUnit.fromText(unit);
    -        if (unit == null) {
    +        if (tu == null) {
                 return null;
             }
             try {
    diff --git a/src/jdk.jfr/share/man/jfr.md b/src/jdk.jfr/share/man/jfr.md
    index f7ff1b62775..b3b7ab1c0b4 100644
    --- a/src/jdk.jfr/share/man/jfr.md
    +++ b/src/jdk.jfr/share/man/jfr.md
    @@ -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
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties
    index 3042823130c..ac13505a0d9 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage.properties
    @@ -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
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_de.properties
    index fd30f5385e8..62bfd36181f 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_de.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_de.properties
    @@ -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
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_ja.properties
    index 66471e23b38..7ab6d7f655f 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_ja.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_ja.properties
    @@ -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
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_zh_CN.properties
    index 8355ed5595e..37954b9b743 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_zh_CN.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jimage/resources/jimage_zh_CN.properties
    @@ -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
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
    index 928b9a47934..3baae08eed6 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2015, 2024, 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
    @@ -27,9 +27,11 @@ package jdk.tools.jlink.internal;
     import static jdk.tools.jlink.internal.TaskHelper.JLINK_BUNDLE;
     
     import java.io.BufferedInputStream;
    +import java.io.BufferedReader;
     import java.io.File;
     import java.io.IOException;
     import java.io.InputStream;
    +import java.io.InputStreamReader;
     import java.io.PrintWriter;
     import java.io.UncheckedIOException;
     import java.lang.module.Configuration;
    @@ -56,6 +58,7 @@ import java.util.HashSet;
     import java.util.List;
     import java.util.Locale;
     import java.util.Map;
    +import java.util.NoSuchElementException;
     import java.util.Objects;
     import java.util.Optional;
     import java.util.Set;
    @@ -238,6 +241,27 @@ public class JlinkTask {
         }
     
         public static final String OPTIONS_RESOURCE = "jdk/tools/jlink/internal/options";
    +    // Release information stored in the java.base module
    +    private static final String JDK_RELEASE_RESOURCE = "jdk/internal/misc/resources/release.txt";
    +
    +    /**
    +     * Read the release.txt from the module.
    +     */
    +    private static Optional getReleaseInfo(ModuleReference mref) {
    +        try (var moduleReader = mref.open()) {
    +            Optional release = moduleReader.open(JDK_RELEASE_RESOURCE);
    +
    +            if (release.isEmpty()) {
    +                return Optional.empty();
    +            }
    +
    +            try (var r = new BufferedReader(new InputStreamReader(release.get()))) {
    +                return Optional.of(r.readLine());
    +            }
    +        } catch (IOException ioe) {
    +            throw new UncheckedIOException(ioe);
    +        }
    +    }
     
         int run(String[] args) {
             if (log == null) {
    @@ -410,7 +434,8 @@ public class JlinkTask {
     
             // Sanity check version if we use JMODs
             if (!isLinkFromRuntime) {
    -            checkJavaBaseVersion(finder);
    +            assert(finder.find("java.base").isPresent());
    +            checkJavaBaseVersion(finder.find("java.base").get());
             }
     
             // Determine the roots set
    @@ -561,32 +586,34 @@ public class JlinkTask {
             return finder;
         }
     
    +    private static String getCurrentRuntimeVersion() {
    +        ModuleReference current = ModuleLayer.boot()
    +                .configuration()
    +                .findModule("java.base")
    +                .get()
    +                .reference();
    +        // This jlink runtime should always have the release.txt
    +        return getReleaseInfo(current).get();
    +    }
    +
         /*
    -     * Checks the version of the module descriptor of java.base for compatibility
    -     * with the current runtime version.
    +     * Checks the release information of the java.base used for target image
    +     * for compatibility with the java.base used by jlink.
          *
    -     * @throws IllegalArgumentException the descriptor of java.base has no
    -     * version or the java.base version is not the same as the current runtime's
    -     * version.
    +     * @throws IllegalArgumentException  If  the `java.base` module reference `target`
    +     * is not compatible with this jlink.
          */
    -    private static void checkJavaBaseVersion(ModuleFinder finder) {
    -        assert finder.find("java.base").isPresent();
    +    private static void checkJavaBaseVersion(ModuleReference target) {
    +        String currentRelease = getCurrentRuntimeVersion();
     
    -        // use the version of java.base module, if present, as
    -        // the release version for multi-release JAR files
    -        ModuleDescriptor.Version v = finder.find("java.base").get()
    -                .descriptor().version().orElseThrow(() ->
    -                new IllegalArgumentException("No version in java.base descriptor")
    -                        );
    +        String targetRelease = getReleaseInfo(target).orElseThrow(() -> new IllegalArgumentException(
    +                taskHelper.getMessage("err.jlink.version.missing", currentRelease)));
     
    -        Runtime.Version version = Runtime.Version.parse(v.toString());
    -        if (Runtime.version().feature() != version.feature() ||
    -                Runtime.version().interim() != version.interim()) {
    -            // jlink version and java.base version do not match.
    -            // We do not (yet) support this mode.
    +        if (!currentRelease.equals(targetRelease)) {
    +            // Current runtime image and the target runtime image are not compatible build
                 throw new IllegalArgumentException(taskHelper.getMessage("err.jlink.version.mismatch",
    -                    Runtime.version().feature(), Runtime.version().interim(),
    -                    version.feature(), version.interim()));
    +                    currentRelease,
    +                    targetRelease));
             }
         }
     
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Snippets.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Snippets.java
    index d662e297f9a..c5bfeb08d33 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Snippets.java
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Snippets.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
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
    index d53589dc388..dca4d57f764 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
    @@ -362,10 +362,13 @@ public final class TaskHelper {
     
                     if (plugin instanceof DefaultCompressPlugin) {
                         plugOption
    -                        = new PluginOption(false,
    +                        = new PluginOption(true,
                                 (task, opt, arg) -> {
                                     Map m = addArgumentMap(plugin);
    -                                m.put(plugin.getName(), DefaultCompressPlugin.LEVEL_2);
    +                                String level = (arg != null && !arg.isEmpty())
    +                                        ? arg
    +                                        :"zip-6";
    +                                m.put(plugin.getName(), level);
                                 }, false, "--compress", "-c");
                         mainOptions.add(plugOption);
                     } else if (plugin instanceof DefaultStripDebugPlugin) {
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ModuleDescriptorBuilder.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ModuleDescriptorBuilder.java
    index 87f4ddcdbc6..2fdb37410ae 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ModuleDescriptorBuilder.java
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ModuleDescriptorBuilder.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java
    index 4a6b54a3b6c..72b20cd2d43 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java
    index 1c126d7321c..533c216c735 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties
    index 080d51506a6..374ed78f608 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties
    @@ -130,7 +130,9 @@ err.runtime.link.patched.module=jlink does not support linking from the run-time
     err.no.module.path=--module-path option must be specified with --add-modules ALL-MODULE-PATH
     err.empty.module.path=No module found in module path ''{0}'' with --add-modules ALL-MODULE-PATH
     err.limit.modules=--limit-modules not allowed with --add-modules ALL-MODULE-PATH
    -err.jlink.version.mismatch=jlink version {0}.{1} does not match target java.base version {2}.{3}
    +err.jlink.version.mismatch=jlink build ''{0}'' does not match target java.base build ''{1}''
    +err.jlink.version.missing=jlink build ''{0}'' cannot find the build signature\
    +\ in the java.base specified on module path, likely from an earlier build.
     err.automatic.module:automatic module cannot be used with jlink: {0} from {1}
     err.unknown.byte.order:unknown byte order {0}
     err.launcher.main.class.empty:launcher main class name cannot be empty: {0}
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties
    index 9b776745c66..40022a5532b 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties
    @@ -78,7 +78,8 @@ err.runtime.link.patched.module=jlink unterstützt keine Verknüpfung vom Laufze
     err.no.module.path=Option --module-path muss mit --add-modules ALL-MODULE-PATH angegeben werden
     err.empty.module.path=Kein Modul im Modulpfad "{0}" mit --add-modules ALL-MODULE-PATH gefunden
     err.limit.modules=--limit-modules nicht mit --add-modules ALL-MODULE-PATH zulässig
    -err.jlink.version.mismatch=jlink-Version {0}.{1} stimmt nicht mit Ziel-java.base-Version {2}.{3} überein
    +err.jlink.version.mismatch=jlink-Build "{0}" stimmt nicht mit dem java.base-Ziel-Build "{1}" überein
    +err.jlink.version.missing=jlink-Build "{0}" kann die Build-Signatur nicht im Modul java.base finden, das im Modulpfad angegebenen wird. Wahrscheinlich stammt es aus einem früheren Build.
     err.automatic.module:automatisches Modul kann nicht mit jlink verwendet werden: {0} aus {1}
     err.unknown.byte.order:unbekannte Bytereihenfolge {0}
     err.launcher.main.class.empty:Launcher-Hauptklassenname darf nicht leer sein: {0}
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties
    index c925f250c41..9519a24c96e 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties
    @@ -78,7 +78,8 @@ err.runtime.link.patched.module=--patch-moduleを使用してパッチ済ラン
     err.no.module.path=--module-pathオプションは--add-modules ALL-MODULE-PATHで指定する必要があります
     err.empty.module.path=モジュール・パス''{0}''に--add-modules ALL-MODULE-PATHを使用したモジュールが見つかりません
     err.limit.modules=--limit-modulesは--add-modules ALL-MODULE-PATHとともに指定できません
    -err.jlink.version.mismatch=jlinkバージョン{0}.{1}がターゲットのjava.baseバージョン{2}.{3}と一致しません
    +err.jlink.version.mismatch=jlinkビルド''{0}''がターゲットのjava.baseビルド''{1}''と一致しません
    +err.jlink.version.missing=jlinkビルド''{0}''では、モジュール・パスで指定されたjava.baseにビルド署名が見つかりません(おそらく以前のビルドから)。
     err.automatic.module:jlinkでは自動モジュールは使用できません: {1}からの{0}
     err.unknown.byte.order:不明なバイト順{0}
     err.launcher.main.class.empty:起動ツールのメイン・クラス名は空にできません: {0}
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties
    index b7526c9f57a..81af170ae7f 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties
    @@ -78,7 +78,8 @@ err.runtime.link.patched.module=当使用 --patch-module 在打补丁的运行
     err.no.module.path=--module-path 选项必须与 --add-modules ALL-MODULE-PATH 一起指定
     err.empty.module.path=在随 --add-modules ALL-MODULE-PATH 提供的模块路径 ''{0}'' 中找不到模块
     err.limit.modules=不允许将 --limit-modules 与 --add-modules ALL-MODULE-PATH 一起使用
    -err.jlink.version.mismatch=jlink 版本 {0}.{1} 与目标 java.base 版本 {2}.{3} 不匹配
    +err.jlink.version.mismatch=jlink 工作版本 ''{0}'' 与目标 java.base 工作版本 ''{1}'' 不匹配
    +err.jlink.version.missing=jlink 工作版本 ''{0}'' 在模块路径中指定的 java.base 中找不到工作版本签名,可能来自早期工作版本。
     err.automatic.module:自动模块不能用于来自 {1} 的 jlink: {0}
     err.unknown.byte.order:未知的字节顺序 {0}
     err.launcher.main.class.empty:启动程序主类名不能为空: {0}
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties
    index e9be0b4e587..7e3c26fa7b8 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties
    @@ -61,14 +61,14 @@ Class optimization: convert Class.forName calls to constant loads.
     class-for-name.usage=\
     \  --class-for-name          Class optimization: convert Class.forName calls to constant loads.
     
    -compress.argument=[:filter=]
    +compress.argument=[:filter=]
     
     compress.description= Compression to use in compressing resources.
     
     compress.usage=\
     \  --compress      Compression to use in compressing resources:\n\
     \                            Accepted values are:\n\
    -\                            zip-[0-9], where zip-0 provides no compression,\n\
    +\                            zip-'{0-9}', where zip-0 provides no compression,\n\
     \                            and zip-9 provides the best compression.\n\
     \                            Default is zip-6.
     
    @@ -307,15 +307,15 @@ plugin.opt.disable-plugin=\
     \      --disable-plugin      Disable the plugin mentioned
     
     plugin.opt.compress=\
    -\      --compress              Compression to use in compressing resources:\n\
    +\      --compress              Compress all resources in the output image:\n\
     \                                        Accepted values are:\n\
    -\                                        zip-[0-9], where zip-0 provides no compression,\n\
    +\                                        zip-'{0-9}', where zip-0 provides no compression,\n\
     \                                        and zip-9 provides the best compression.\n\
     \                                        Default is zip-6.\n\
     \                                        Deprecated values to be removed in a future release:\n\
    -\                                        0:  No compression. Equivalent to zip-0.\n\
    +\                                        0:  No compression. Use zip-0 instead.\n\
     \                                        1:  Constant String Sharing\n\
    -\                                        2:  Equivalent to zip-6.
    +\                                        2:  ZIP. Use zip-6 instead.
     
     plugin.opt.strip-debug=\
     \  -G, --strip-debug                     Strip debug information
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties
    index 4713eabed85..c313d6a348d 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties
    @@ -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
    @@ -31,9 +31,9 @@ add-options.usage=\  --add-options    Stellt die angegebene 
     
     release-info.argument=|add:=:=:...|del:
     
    -release-info.description=-Option lädt Releaseeigenschaften aus der angegebenen Datei.\nadd: fügt der Datei "release" Eigenschaften hinzu.\nEine beliebige Anzahl von =-Paaren kann übergeben werden.\ndel: löscht die Liste der Schlüssel in der Releasedatei.
    +release-info.description=Option  lädt Releaseeigenschaften aus der angegebenen Datei.\n       Die angegebene Datei soll erwartungsgemäß in UTF-8 codiert sein.\nadd: fügt der Datei "release" Eigenschaften hinzu.\nEine beliebige Anzahl von =-Paaren kann übergeben werden.\ndel: löscht die Liste der Schlüssel in der Releasedatei.
     
    -release-info.usage=\  --release-info |add:=:=:...|del:\n                            Option  löscht Releaseeigenschaften aus\n                            der angegebenen Datei.\n                            add: fügt Eigenschaften der Datei "release" hinzu.\n                            Eine beliebige Anzahl =-Paare kann übergeben werden.\n                            del: löscht die Liste der Schlüssel in der Releasedatei.
    +release-info.usage=\  --release-info |add:=:=:...|del:\n                            Option  lädt Releaseeigenschaften aus\n                            der angegebenen Datei. Die angegebene Datei soll erwartungsgemäß\n                            in UTF-8 codiert sein.\n                            add: fügt der Datei "release" Eigenschaften hinzu.\n                            Eine beliebige Anzahl =-Paare kann übergeben werden.\n                            del: löscht die Liste der Schlüssel in der Releasedatei.
     
     class-for-name.argument=
     
    @@ -41,11 +41,11 @@ class-for-name.description=Klassenoptimierung: Konvertiert Class.forName-Aufrufe
     
     class-for-name.usage=\  --class-for-name          Klassenoptimierung: Konvertiert Class.forName-Aufrufe in Konstantenladevorgänge.
     
    -compress.argument=[:filter=]
    +compress.argument=[:filter=]
     
     compress.description= Zu verwendende Komprimierung für Ressourcen.
     
    -compress.usage=\  --compress      Zu verwendende Komprimierung für Ressourcen:\n                            Zulässige Werte:\n                            zip-[0-9], wobei "zip-0" für keine Komprimierung\n                            und "zip-9" für die beste Komprimierung steht.\n                            Standardwert ist "zip-6".
    +compress.usage=\  --compress      Zu verwendende Komprimierung für Ressourcen:\n                            Zulässige Werte:\n                            zip-'{0-9}', wobei "zip-0" für keine Komprimierung\n                            und "zip-9" für die beste Komprimierung steht.\n                            Standardwert ist "zip-6".
     
     compress.warn.argumentdeprecated=Warnung: Das Argument {0} für --compress ist veraltet und wird möglicherweise in einem zukünftigen Release entfernt
     
    @@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\      --resources-last-sorter     Das le
     
     plugin.opt.disable-plugin=\      --disable-plugin      Deaktiviert das angegebene Plug-in
     
    -plugin.opt.compress=\      --compress              Zu verwendende Komprimierung für Ressourcen:\n                                        Zulässige Werte:\n                                        zip-[0-9], wobei "zip-0" für keine Komprimierung\n                                        und "zip-9" für die beste Komprimierung steht.\n                                        Standardwert ist "zip-6".\n                                        Veraltete Werte, die in einem zukünftigen Release entfernt werden:\n                                        0: Keine Komprimierung. Entspricht "zip-0".\n                                        1: Gemeinsame Verwendung konstanter Zeichenfolgen\n                                        2: Entspricht "zip-6".
    +plugin.opt.compress=\      --compress              Komprimiert alle Ressourcen im Ausgabeimage:\n                                        Zulässige Werte:\n                                        zip-'{0-9}', wobei "zip-0" für keine Komprimierung\n                                        und "zip-9" für die beste Komprimierung steht.\n                                        Standardwert ist "zip-6".\n                                        Veraltete Werte, die in einem zukünftigen Release entfernt werden:\n                                        0:  Keine Komprimierung. Verwenden Sie stattdessen "zip-0".\n                                        1:  Gemeinsame Verwendung konstanter Zeichenfolgen\n                                        2:  ZIP. Verwenden Sie stattdessen "zip-6".
     
     plugin.opt.strip-debug=\  -G, --strip-debug                     Entfernt Debuginformationen
     
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties
    index 1cf3ba5b0c0..a5dc70061f6 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties
    @@ -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
    @@ -31,9 +31,9 @@ add-options.usage=\  --add-options    指定した文字列を
     
     release-info.argument=|add:=:=:...|del:
     
    -release-info.description=オプションは指定されたファイルからリリース・プロパティをロードします。\nadd:はリリース・ファイルにプロパティを追加します。\n任意の数の=のペアを渡すことができます。\ndel:はリリース・ファイルのキーのリストを削除します。
    +release-info.description=オプションは指定されたファイルからリリース・プロパティをロードします。\n       指定されたファイルはUTF-8でエンコードされる必要があります。\nadd:はリリース・ファイルにプロパティを追加します。\n任意の数の=のペアを渡すことができます。\ndel:はリリース・ファイルのキーのリストを削除します。
     
    -release-info.usage=\  --release-info |add:=:=:...|del:\n                            オプションは指定されたファイルからリリース・プロパティを\n                            ロードします。\n                            add:はリリース・ファイルにプロパティを追加します。\n                            任意の数の=ペアを渡すことができます。\n                            del:はリリース・ファイルのキーのリストを削除します。
    +release-info.usage=\  --release-info |add:=:=:...|del:\n                            オプションは指定されたファイルからリリース・プロパティを\n                            ロードします。指定されたファイルはUTF-8で\n                            エンコードされる必要があります。\n                            add:はリリース・ファイルにプロパティを追加します。\n                            任意の数の=ペアを渡すことができます。\n                            del:はリリース・ファイルのキーのリストを削除します。
     
     class-for-name.argument=
     
    @@ -41,11 +41,11 @@ class-for-name.description=クラスの最適化: Class.forName呼出しを定
     
     class-for-name.usage=\  --class-for-name          クラスの最適化: Class.forName呼出しを定数のロードに変換します。
     
    -compress.argument=[:filter=]
    +compress.argument=[:filter=]
     
     compress.description= リソースの圧縮に使用する圧縮。
     
    -compress.usage=\  --compress      リソースの圧縮に使用する圧縮:\n                            使用可能な値は\n                            zip-[0-9]です。zip-0では圧縮は行われず、\n                            zip-9では最適な圧縮が行われます。\n                            デフォルトはzip-6です。
    +compress.usage=\  --compress      リソースの圧縮に使用する圧縮:\n                            使用可能な値は\n                            zip-'{0-9}'です。zip-0では圧縮は行われず、\n                            zip-9では最適な圧縮が行われます。\n                            デフォルトはzip-6です。
     
     compress.warn.argumentdeprecated=警告:  --compressの{0}引数は非推奨であり、今後のリリースで削除される可能性があります
     
    @@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\      --resources-last-sorter     最後
     
     plugin.opt.disable-plugin=\      --disable-plugin      指定したプラグインを無効にします
     
    -plugin.opt.compress=\      --compress              リソースの圧縮に使用する圧縮:\n                                        使用可能な値は\n                                        zip-[0-9]です。zip-0では圧縮は行われず、\n                                        zip-9では最適な圧縮が行われます。\n                                        デフォルトはzip-6です。\n                                        今後のリリースで削除される非推奨の値:\n                                        0:  圧縮なし。zip-0と同等。\n                                        1:  定数文字列の共有\n                                        2:  zip-6と同等。
    +plugin.opt.compress=\      --compress <圧縮>             出力イメージ内のすべてのリソースを圧縮します:\n                                        使用可能な値は\n                                        zip-'{0-9}'です。zip-0では圧縮は行われず、\n                                        zip-9では最適な圧縮が行われます。\n                                        デフォルトはzip-6です。\n                                        今後のリリースで削除される非推奨の値:\n                                        0:  圧縮なし。かわりにzip-0を使用。\n                                        1:  定数文字列の共有\n                                        2:  ZIP。かわりにzip-6を使用。
     
     plugin.opt.strip-debug=\  -G, --strip-debug                     デバッグ情報を削除します
     
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties
    index 819238e7d04..1de1ef372b6 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties
    @@ -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
    @@ -31,9 +31,9 @@ add-options.usage=\  --add-options    在生成的映像中调用虚拟
     
     release-info.argument=|add:=:=:...|del:
     
    -release-info.description= 选项:从提供的文件加载 release 属性。\nadd:向 'release' 文件中添加属性。\n可以传递任意数量的 = 对。\ndel:删除 release 文件中的关键字列表。
    +release-info.description= 选项:从提供的文件加载 release 属性。\n       指定的文件应采用 UTF-8 编码。\nadd:向 'release' 文件中添加属性。\n可以传递任意数量的 = 对。\ndel:删除 release 文件中的关键字列表。
     
    -release-info.usage=\  --release-info |add:=:=:...|del:\n                             选项:从提供的文件\n                            加载 release 属性。\n                            add:向 'release' 文件中添加属性。\n                            可以传递任意数量的 = 对。\n                            del:删除 release 文件中的关键字列表。
    +release-info.usage=\  --release-info |add:=:=:...|del:\n                             选项:从提供的文件\n                            加载 release 属性。指定的文件\n                            应采用 UTF-8 编码。\n                            add:向 'release' 文件中添加属性。\n                            可以传递任意数量的 = 对。\n                            del:删除 release 文件中的关键字列表。
     
     class-for-name.argument=
     
    @@ -41,11 +41,11 @@ class-for-name.description=类优化:将 Class.forName 调用转换为常量
     
     class-for-name.usage=\  --class-for-name          类优化:将 Class.forName 调用转换为常量负载。
     
    -compress.argument=[:filter=]
    +compress.argument=[:filter=]
     
     compress.description= 要在压缩资源时使用的压缩。
     
    -compress.usage=\  --compress      要在压缩资源时使用的压缩:\n                            接受的值为:\n                            zip-[0-9],其中 zip-0 表示无压缩,\n                            zip-9 表示最佳压缩。\n                            默认值为 zip-6。
    +compress.usage=\  --compress      要在压缩资源时使用的压缩:\n                            接受的值为:\n                            zip-'{0-9}',其中 zip-0 表示无压缩,\n                            zip-9 表示最佳压缩。\n                            默认值为 zip-6。
     
     compress.warn.argumentdeprecated=警告:--compress 的 {0} 参数已过时,可能会在未来发行版中删除
     
    @@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\      --resources-last-sorter     允许
     
     plugin.opt.disable-plugin=\      --disable-plugin      禁用所提及的插件
     
    -plugin.opt.compress=\      --compress              要在压缩资源时使用的压缩:\n                                        接受的值为:\n                                        zip-[0-9],其中 zip-0 表示无压缩,\n                                        zip-9 表示最佳压缩。\n                                        默认值为 zip-6。\n                                        要在未来发行版中删除的已过时值:\n                                        0:无压缩。等同于 zip-0。\n                                        1:常量字符串共享\n                                        2:等同于 zip-6。
    +plugin.opt.compress=\      --compress <压缩>             在输出映像中压缩所有资源:\n                                        接受的值包括:\n                                        zip-'{0-9}',其中 zip-0 表示无压缩,\n                                        zip-9 表示最佳压缩。\n                                        默认值为 zip-6。\n                                        要在未来发行版中删除的已过时值:\n                                        0:无压缩。改为使用 zip-0。\n                                        1:常量字符串共享\n                                        2:ZIP。改为使用 zip-6。
     
     plugin.opt.strip-debug=\  -G, --strip-debug                     去除调试信息
     
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java
    index 5345ee4253c..d4d7171d799 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.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
    diff --git a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties
    index 126e04d0b58..386fd199d86 100644
    --- a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties
    +++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_de.properties
    @@ -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
    diff --git a/src/jdk.jlink/share/man/jlink.md b/src/jdk.jlink/share/man/jlink.md
    index dc256af43b5..5c77202434c 100644
    --- a/src/jdk.jlink/share/man/jlink.md
    +++ b/src/jdk.jlink/share/man/jlink.md
    @@ -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
    @@ -64,12 +64,16 @@ Developers are responsible for updating their custom runtime images.
     `--bind-services`
     :   Link service provider modules and their dependencies.
     
    -`-c ={0|1|2}` or `--compress={0|1|2}`
    -:   Enable compression of resources:
    +`-c zip-{0-9}` or `--compress=zip-{0-9}`
    +:   Enable compression of resources. The accepted values are:
    +    zip-{0-9}, where zip-0 provides no compression,
    +    and zip-9 provides the best compression. Default is zip-6.
     
    -    -   `0`: No compression
    +:   Deprecated values to be removed in a future release:
    +
    +    -   `0`: No compression. Use zip-0 instead.
         -   `1`: Constant string sharing
    -    -   `2`: ZIP
    +    -   `2`: ZIP. Use zip-6 instead.
     
     `--disable-plugin` *pluginname*
     :   Disables the specified plug-in. See [jlink Plug-ins] for the list of
    @@ -170,14 +174,19 @@ For a complete list of all available plug-ins, run the command
     ### Plugin `compress`
     
     Options
    -:   `--compress=`{`0`\|`1`\|`2`}\[`:filter=`*pattern-list*\]
    +:   `--compress=zip-`{`0`-`9`}\[`:filter=`*pattern-list*\]
     
     Description
     :   Compresses all resources in the output image.
    +    Accepted values are:
    +    zip-{0-9}, where zip-0 provides no compression,
    +    and zip-9 provides the best compression. Default is zip-6.
     
    -    -   Level 0: No compression
    +:   Deprecated values to be removed in a future release:
    +
    +    -   Level 0: No compression. Use zip-0 instead.
         -   Level 1: Constant string sharing
    -    -   Level 2: ZIP
    +    -   Level 2: ZIP. Use zip-6 instead.
     
         An optional *pattern-list* filter can be specified to list the pattern of
         files to include.
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/DesktopIntegration.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/DesktopIntegration.java
    index dbaa5e3eec6..523b6c4821c 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/DesktopIntegration.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/DesktopIntegration.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2019, 2025, 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
    @@ -50,6 +50,7 @@ import jdk.jpackage.internal.model.LinuxLauncher;
     import jdk.jpackage.internal.model.LinuxPackage;
     import jdk.jpackage.internal.model.Package;
     import jdk.jpackage.internal.util.CompositeProxy;
    +import jdk.jpackage.internal.util.Enquoter;
     import jdk.jpackage.internal.util.PathUtils;
     import jdk.jpackage.internal.util.XmlUtils;
     
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LibProvidersLookup.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LibProvidersLookup.java
    index 55200b908cd..6faacbca528 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LibProvidersLookup.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LibProvidersLookup.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2019, 2021, 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,13 +27,12 @@ package jdk.jpackage.internal;
     import java.io.IOException;
     import java.nio.file.Files;
     import java.nio.file.Path;
    -import java.util.List;
     import java.util.Collection;
    -import java.util.Objects;
     import java.util.Collections;
    -import java.util.Set;
    -import java.util.ArrayList;
     import java.util.Iterator;
    +import java.util.List;
    +import java.util.Objects;
    +import java.util.Set;
     import java.util.function.Predicate;
     import java.util.regex.Matcher;
     import java.util.regex.Pattern;
    @@ -48,9 +47,6 @@ public final class LibProvidersLookup {
             return (new ToolValidator(TOOL_LDD).validate() == null);
         }
     
    -    public LibProvidersLookup() {
    -    }
    -
         LibProvidersLookup setPackageLookup(PackageLookup v) {
             packageLookup = v;
             return this;
    @@ -87,23 +83,20 @@ public final class LibProvidersLookup {
         }
     
         private static List getNeededLibsForFile(Path path) throws IOException {
    -        List result = new ArrayList<>();
    -        int ret = Executor.of(TOOL_LDD, path.toString()).setOutputConsumer(lines -> {
    -            lines.map(line -> {
    -                Matcher matcher = LIB_IN_LDD_OUTPUT_REGEX.matcher(line);
    -                if (matcher.find()) {
    -                    return matcher.group(1);
    -                }
    -                return null;
    -            }).filter(Objects::nonNull).map(Path::of).forEach(result::add);
    -        }).execute();
    +        final var result = Executor.of(TOOL_LDD, path.toString()).saveOutput().execute();
     
    -        if (ret != 0) {
    +        if (result.getExitCode() != 0) {
                 // objdump failed. This is OK if the tool was applied to not a binary file
                 return Collections.emptyList();
             }
     
    -        return result;
    +        return result.stdout().stream().map(line -> {
    +            Matcher matcher = LIB_IN_LDD_OUTPUT_REGEX.matcher(line);
    +            if (matcher.find()) {
    +                return matcher.group(1);
    +            }
    +            return null;
    +        }).filter(Objects::nonNull).map(Path::of).toList();
         }
     
         private static Collection getNeededLibsForFiles(List paths) {
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxBundlingEnvironment.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxBundlingEnvironment.java
    index cfd8ab391bb..d2169ede461 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxBundlingEnvironment.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxBundlingEnvironment.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
    @@ -33,6 +33,7 @@ import static jdk.jpackage.internal.cli.StandardBundlingOperation.CREATE_LINUX_R
     
     import java.util.Map;
     import java.util.Optional;
    +import java.util.function.Supplier;
     import java.util.stream.Stream;
     import jdk.jpackage.internal.cli.Options;
     import jdk.jpackage.internal.cli.StandardBundlingOperation;
    @@ -44,19 +45,34 @@ import jdk.jpackage.internal.util.Result;
     public class LinuxBundlingEnvironment extends DefaultBundlingEnvironment {
     
         public LinuxBundlingEnvironment() {
    -        super(build()
    -                .defaultOperation(() -> {
    -                    return LazyLoad.SYS_ENV.value().map(LinuxSystemEnvironment::nativePackageType).map(DESCRIPTORS::get);
    -                })
    -                .bundler(CREATE_LINUX_APP_IMAGE, LinuxBundlingEnvironment::createAppImage)
    -                .bundler(CREATE_LINUX_DEB, LazyLoad::debSysEnv, LinuxBundlingEnvironment::createDebPackage)
    -                .bundler(CREATE_LINUX_RPM, LazyLoad::rpmSysEnv, LinuxBundlingEnvironment::createRpmPackage));
    +        super(build().mutate(builder -> {
    +
    +            // Wrap the generic Linux system environment supplier in the run-once wrapper
    +            // as this supplier is called from both RPM and DEB Linux system environment suppliers.
    +            var sysEnv = runOnce(() -> {
    +                return LinuxSystemEnvironment.create();
    +            });
    +
    +            Supplier> debSysEnv = () -> {
    +                return LinuxDebSystemEnvironment.create(sysEnv.get());
    +            };
    +
    +            Supplier> rpmSysEnv = () -> {
    +                return LinuxRpmSystemEnvironment.create(sysEnv.get());
    +            };
    +
    +            builder.defaultOperation(() -> {
    +                return sysEnv.get().value().map(LinuxSystemEnvironment::nativePackageType).map(DESCRIPTORS::get);
    +            })
    +            .bundler(CREATE_LINUX_DEB, debSysEnv, LinuxBundlingEnvironment::createDebPackage)
    +            .bundler(CREATE_LINUX_RPM, rpmSysEnv, LinuxBundlingEnvironment::createRpmPackage);
    +        }).bundler(CREATE_LINUX_APP_IMAGE, LinuxBundlingEnvironment::createAppImage));
         }
     
         private static void createDebPackage(Options options, LinuxDebSystemEnvironment sysEnv) {
     
             createNativePackage(options,
    -                LinuxFromOptions::createLinuxDebPackage,
    +                LinuxFromOptions.createLinuxDebPackage(options, sysEnv),
                     buildEnv()::create,
                     LinuxBundlingEnvironment::buildPipeline,
                     (env, pkg, outputDir) -> {
    @@ -67,7 +83,7 @@ public class LinuxBundlingEnvironment extends DefaultBundlingEnvironment {
         private static void createRpmPackage(Options options, LinuxRpmSystemEnvironment sysEnv) {
     
             createNativePackage(options,
    -                LinuxFromOptions::createLinuxRpmPackage,
    +                LinuxFromOptions.createLinuxRpmPackage(options, sysEnv),
                     buildEnv()::create,
                     LinuxBundlingEnvironment::buildPipeline,
                     (env, pkg, outputDir) -> {
    @@ -90,23 +106,6 @@ public class LinuxBundlingEnvironment extends DefaultBundlingEnvironment {
             return new BuildEnvFromOptions().predefinedAppImageLayout(APPLICATION_LAYOUT);
         }
     
    -    private static final class LazyLoad {
    -
    -        static Result debSysEnv() {
    -            return DEB_SYS_ENV;
    -        }
    -
    -        static Result rpmSysEnv() {
    -            return RPM_SYS_ENV;
    -        }
    -
    -        private static final Result SYS_ENV = LinuxSystemEnvironment.create();
    -
    -        private static final Result DEB_SYS_ENV = LinuxDebSystemEnvironment.create(SYS_ENV);
    -
    -        private static final Result RPM_SYS_ENV = LinuxRpmSystemEnvironment.create(SYS_ENV);
    -    }
    -
         private static final Map DESCRIPTORS = Stream.of(
                 CREATE_LINUX_DEB,
                 CREATE_LINUX_RPM
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebPackager.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebPackager.java
    index 64a0368e9a0..7c1f06f54a3 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebPackager.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebPackager.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2012, 2025, 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
    @@ -25,7 +25,6 @@
     
     package jdk.jpackage.internal;
     
    -import static jdk.jpackage.internal.model.StandardPackageType.LINUX_DEB;
     import static jdk.jpackage.internal.util.function.ThrowingFunction.toFunction;
     
     import java.io.IOException;
    @@ -76,11 +75,11 @@ final class LinuxDebPackager extends LinuxPackager {
     
                 try {
                     // Try the real path first as it works better on newer Ubuntu versions
    -                return findProvidingPackages(realPath, sysEnv.dpkg());
    +                return findProvidingPackages(realPath, sysEnv);
                 } catch (IOException ex) {
                     // Try the default path if differ
                     if (!realPath.equals(file)) {
    -                    return findProvidingPackages(file, sysEnv.dpkg());
    +                    return findProvidingPackages(file, sysEnv);
                     } else {
                         throw ex;
                     }
    @@ -107,7 +106,7 @@ final class LinuxDebPackager extends LinuxPackager {
     
             properties.forEach(property -> cmdline.add(property.name));
     
    -        Map actualValues = Executor.of(cmdline.toArray(String[]::new))
    +        Map actualValues = Executor.of(cmdline)
                     .saveOutput(true)
                     .executeExpectSuccess()
                     .getOutput().stream()
    @@ -148,8 +147,6 @@ final class LinuxDebPackager extends LinuxPackager {
     
             Path debFile = outputPackageFile();
     
    -        Log.verbose(I18N.format("message.outputting-to-location", debFile.toAbsolutePath()));
    -
             List cmdline = new ArrayList<>();
             Stream.of(sysEnv.fakeroot(), sysEnv.dpkgdeb()).map(Path::toString).forEach(cmdline::add);
             if (Log.isVerbose()) {
    @@ -158,11 +155,8 @@ final class LinuxDebPackager extends LinuxPackager {
             cmdline.addAll(List.of("-b", env.appImageDir().toString(), debFile.toAbsolutePath().toString()));
     
             // run dpkg
    -        RetryExecutor.retryOnKnownErrorMessage(
    -                "semop(1): encountered an error: Invalid argument").execute(
    -                        cmdline.toArray(String[]::new));
    -
    -        Log.verbose(I18N.format("message.output-to-location", debFile.toAbsolutePath()));
    +        Executor.of(cmdline).retryOnKnownErrorMessage(
    +                "semop(1): encountered an error: Invalid argument").execute();
         }
     
         @Override
    @@ -233,7 +227,7 @@ final class LinuxDebPackager extends LinuxPackager {
             }
         }
     
    -    private static Stream findProvidingPackages(Path file, Path dpkg) throws IOException {
    +    private static Stream findProvidingPackages(Path file, LinuxDebSystemEnvironment sysEnv) throws IOException {
             //
             // `dpkg -S` command does glob pattern lookup. If not the absolute path
             // to the file is specified it might return mltiple package names.
    @@ -279,9 +273,9 @@ final class LinuxDebPackager extends LinuxPackager {
             Set archPackages = new HashSet<>();
             Set otherPackages = new HashSet<>();
     
    -        var debArch = LinuxPackageArch.getValue(LINUX_DEB);
    +        var debArch = sysEnv.packageArch().value();
     
    -        Executor.of(dpkg.toString(), "-S", file.toString())
    +        Executor.of(sysEnv.dpkg().toString(), "-S", file.toString())
                     .saveOutput(true).executeExpectSuccess()
                     .getOutput().forEach(line -> {
                         Matcher matcher = PACKAGE_NAME_REGEX.matcher(line);
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebSystemEnvironment.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebSystemEnvironment.java
    index 5b5decb7a67..d5480361452 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebSystemEnvironment.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebSystemEnvironment.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
    @@ -28,7 +28,7 @@ import static jdk.jpackage.internal.LinuxSystemEnvironment.mixin;
     
     import jdk.jpackage.internal.util.Result;
     
    -public interface LinuxDebSystemEnvironment extends LinuxSystemEnvironment, LinuxDebSystemEnvironmentMixin {
    +interface LinuxDebSystemEnvironment extends LinuxSystemEnvironment, LinuxDebSystemEnvironmentMixin {
     
         static Result create(Result base) {
             return mixin(LinuxDebSystemEnvironment.class, base, LinuxDebSystemEnvironmentMixin::create);
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebSystemEnvironmentMixin.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebSystemEnvironmentMixin.java
    index 8688327b353..2cf3e9e36e8 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebSystemEnvironmentMixin.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxDebSystemEnvironmentMixin.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
    @@ -29,7 +29,7 @@ import java.util.Objects;
     import java.util.stream.Stream;
     import jdk.jpackage.internal.util.Result;
     
    -public interface LinuxDebSystemEnvironmentMixin {
    +interface LinuxDebSystemEnvironmentMixin {
         Path dpkg();
         Path dpkgdeb();
         Path fakeroot();
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxFromOptions.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxFromOptions.java
    index 799c92ce2e1..0791c79c662 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxFromOptions.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxFromOptions.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
    @@ -70,9 +70,9 @@ final class LinuxFromOptions {
             return LinuxApplication.create(appBuilder.create());
         }
     
    -    static LinuxRpmPackage createLinuxRpmPackage(Options options) {
    +    static LinuxRpmPackage createLinuxRpmPackage(Options options, LinuxRpmSystemEnvironment sysEnv) {
     
    -        final var superPkgBuilder = createLinuxPackageBuilder(options, LINUX_RPM);
    +        final var superPkgBuilder = createLinuxPackageBuilder(options, sysEnv, LINUX_RPM);
     
             final var pkgBuilder = new LinuxRpmPackageBuilder(superPkgBuilder);
     
    @@ -81,9 +81,9 @@ final class LinuxFromOptions {
             return pkgBuilder.create();
         }
     
    -    static LinuxDebPackage createLinuxDebPackage(Options options) {
    +    static LinuxDebPackage createLinuxDebPackage(Options options, LinuxDebSystemEnvironment sysEnv) {
     
    -        final var superPkgBuilder = createLinuxPackageBuilder(options, LINUX_DEB);
    +        final var superPkgBuilder = createLinuxPackageBuilder(options, sysEnv, LINUX_DEB);
     
             final var pkgBuilder = new LinuxDebPackageBuilder(superPkgBuilder);
     
    @@ -99,7 +99,7 @@ final class LinuxFromOptions {
             return pkg;
         }
     
    -    private static LinuxPackageBuilder createLinuxPackageBuilder(Options options, StandardPackageType type) {
    +    private static LinuxPackageBuilder createLinuxPackageBuilder(Options options, LinuxSystemEnvironment sysEnv, StandardPackageType type) {
     
             final var app = createLinuxApplication(options);
     
    @@ -107,6 +107,8 @@ final class LinuxFromOptions {
     
             final var pkgBuilder = new LinuxPackageBuilder(superPkgBuilder);
     
    +        pkgBuilder.arch(sysEnv.packageArch());
    +
             LINUX_PACKAGE_DEPENDENCIES.ifPresentIn(options, pkgBuilder::additionalDependencies);
             LINUX_APP_CATEGORY.ifPresentIn(options, pkgBuilder::category);
             LINUX_MENU_GROUP.ifPresentIn(options, pkgBuilder::menuGroupName);
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxLaunchersAsServices.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxLaunchersAsServices.java
    index b14404d67b1..40ff26bcfac 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxLaunchersAsServices.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxLaunchersAsServices.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2022, 2025, 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
    @@ -32,6 +32,7 @@ import java.util.List;
     import java.util.Map;
     import jdk.jpackage.internal.model.Launcher;
     import jdk.jpackage.internal.model.Package;
    +import jdk.jpackage.internal.util.Enquoter;
     
     /**
      * Helper to install launchers as services using "systemd".
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageArch.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageArch.java
    index 836d1fb2c37..b1df92ae312 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageArch.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageArch.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
    @@ -25,18 +25,20 @@
     package jdk.jpackage.internal;
     
     import java.io.IOException;
    -import static jdk.jpackage.internal.util.function.ThrowingSupplier.toSupplier;
    +import java.util.ArrayList;
     import jdk.jpackage.internal.model.StandardPackageType;
    +import jdk.jpackage.internal.util.CommandOutputControl;
    +import jdk.jpackage.internal.util.Result;
     
    -final class LinuxPackageArch {
    +record LinuxPackageArch(String value) {
     
    -    static String getValue(StandardPackageType pkgType) {
    +    static Result create(StandardPackageType pkgType) {
             switch (pkgType) {
                 case LINUX_RPM -> {
    -                return RpmPackageArch.VALUE;
    +                return rpm().map(LinuxPackageArch::new);
                 }
                 case LINUX_DEB -> {
    -                return DebPackageArch.VALUE;
    +                return deb().map(LinuxPackageArch::new);
                 }
                 default -> {
                     throw new IllegalArgumentException();
    @@ -44,62 +46,51 @@ final class LinuxPackageArch {
             }
         }
     
    -    private static class DebPackageArch {
    -
    -        static final String VALUE = toSupplier(DebPackageArch::getValue).get();
    -
    -        private static String getValue() throws IOException {
    -            return Executor.of("dpkg", "--print-architecture").saveOutput(true)
    -                    .executeExpectSuccess().getOutput().get(0);
    -        }
    +    private static Result deb() {
    +        var exec = Executor.of("dpkg", "--print-architecture").saveOutput(true);
    +        return Result.of(exec::executeExpectSuccess, IOException.class)
    +                .flatMap(LinuxPackageArch::getStdoutFirstLine);
         }
     
    -    private static class RpmPackageArch {
    -
    -        /*
    -         * Various ways to get rpm arch. Needed to address JDK-8233143. rpmbuild is mandatory for
    -         * rpm packaging, try it first. rpm is optional and may not be available, use as the last
    -         * resort.
    -         */
    -        private static enum RpmArchReader {
    -            Rpmbuild("rpmbuild", "--eval=%{_target_cpu}"),
    -            Rpm("rpm", "--eval=%{_target_cpu}");
    -
    -            RpmArchReader(String... cmdline) {
    -                this.cmdline = cmdline;
    +    private static Result rpm() {
    +        var errors = new ArrayList();
    +        for (var tool : RpmArchReader.values()) {
    +            var result = tool.getRpmArch();
    +            if (result.hasValue()) {
    +                return result;
    +            } else {
    +                errors.addAll(result.errors());
                 }
    -
    -            String getRpmArch() throws IOException {
    -                Executor exec = Executor.of(cmdline).saveOutput(true);
    -                switch (this) {
    -                    case Rpm -> {
    -                        exec.executeExpectSuccess();
    -                    }
    -                    case Rpmbuild -> {
    -                        if (exec.execute() != 0) {
    -                            return null;
    -                        }
    -                    }
    -                    default -> {
    -                        throw new UnsupportedOperationException();
    -                    }
    -                }
    -                return exec.getOutput().get(0);
    -            }
    -
    -            private final String[] cmdline;
             }
     
    -        static final String VALUE = toSupplier(RpmPackageArch::getValue).get();
    +        return Result.ofErrors(errors);
    +    }
     
    -        private static String getValue() throws IOException {
    -            for (var rpmArchReader : RpmArchReader.values()) {
    -                var rpmArchStr = rpmArchReader.getRpmArch();
    -                if (rpmArchStr != null) {
    -                    return rpmArchStr;
    -                }
    -            }
    -            throw new RuntimeException("error.rpm-arch-not-detected");
    +    /*
    +     * Various ways to get rpm arch. Needed to address JDK-8233143. rpmbuild is mandatory for
    +     * rpm packaging, try it first. rpm is optional and may not be available, use as the last
    +     * resort.
    +     */
    +    private enum RpmArchReader {
    +        RPMBUILD("rpmbuild", "--eval=%{_target_cpu}"),
    +        RPM("rpm", "--eval=%{_target_cpu}");
    +
    +        RpmArchReader(String... cmdline) {
    +            this.cmdline = cmdline;
             }
    +
    +        Result getRpmArch() {
    +            var exec = Executor.of(cmdline).saveOutput(true);
    +            return Result.of(exec::executeExpectSuccess, IOException.class)
    +                    .flatMap(LinuxPackageArch::getStdoutFirstLine);
    +        }
    +
    +        private final String[] cmdline;
    +    }
    +
    +    private static Result getStdoutFirstLine(CommandOutputControl.Result result) {
    +        return Result.of(() -> {
    +            return result.stdout().stream().findFirst().orElseThrow(result::unexpected);
    +        }, IOException.class);
         }
     }
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBuilder.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBuilder.java
    index bc7c301ace2..cd4d674432e 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBuilder.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackageBuilder.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
    @@ -83,7 +83,7 @@ final class LinuxPackageBuilder {
                     category(),
                     Optional.ofNullable(additionalDependencies),
                     release(),
    -                pkg.asStandardPackageType().map(LinuxPackageArch::getValue).orElseThrow()));
    +                arch.value()));
         }
     
         LinuxPackageBuilder literalName(String v) {
    @@ -119,6 +119,11 @@ final class LinuxPackageBuilder {
             return Optional.ofNullable(release);
         }
     
    +    LinuxPackageBuilder arch(LinuxPackageArch v) {
    +        arch = v;
    +        return this;
    +    }
    +
         private static LinuxApplicationLayout usrTreePackageLayout(Path prefix, String packageName) {
             final var lib = prefix.resolve(Path.of("lib", packageName));
             return LinuxApplicationLayout.create(
    @@ -184,6 +189,7 @@ final class LinuxPackageBuilder {
         private String category;
         private String additionalDependencies;
         private String release;
    +    private LinuxPackageArch arch;
     
         private final PackageBuilder pkgBuilder;
     
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackager.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackager.java
    index af7f5288cc5..551e1ab1af6 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackager.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackager.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
    @@ -61,7 +61,7 @@ abstract class LinuxPackager implements Consumer {
     
             Path rpmFile = outputPackageFile();
     
    -        Log.verbose(I18N.format("message.outputting-bundle-location", rpmFile.getParent()));
    -
             //run rpmbuild
             Executor.of(sysEnv.rpmbuild().toString(),
                     "-bb", specFile().toAbsolutePath().toString(),
    @@ -147,8 +145,6 @@ final class LinuxRpmPackager extends LinuxPackager {
                             env.buildRoot().toAbsolutePath()),
                     "--define", String.format("%%_rpmfilename %s", rpmFile.getFileName())
             ).executeExpectSuccess();
    -
    -        Log.verbose(I18N.format("message.output-bundle-location", rpmFile.getParent()));
         }
     
         private Path installPrefix() {
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmSystemEnvironment.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmSystemEnvironment.java
    index 58c10668227..e56551be325 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmSystemEnvironment.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmSystemEnvironment.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
    @@ -28,7 +28,7 @@ import static jdk.jpackage.internal.LinuxSystemEnvironment.mixin;
     
     import jdk.jpackage.internal.util.Result;
     
    -public interface LinuxRpmSystemEnvironment extends LinuxSystemEnvironment, LinuxRpmSystemEnvironmentMixin {
    +interface LinuxRpmSystemEnvironment extends LinuxSystemEnvironment, LinuxRpmSystemEnvironmentMixin {
     
         static Result create(Result base) {
             return mixin(LinuxRpmSystemEnvironment.class, base, LinuxRpmSystemEnvironmentMixin::create);
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmSystemEnvironmentMixin.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmSystemEnvironmentMixin.java
    index b741495f5ed..4cbd3ce4a9c 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmSystemEnvironmentMixin.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxRpmSystemEnvironmentMixin.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
    @@ -32,7 +32,7 @@ import java.util.stream.Stream;
     import jdk.jpackage.internal.model.DottedVersion;
     import jdk.jpackage.internal.util.Result;
     
    -public interface LinuxRpmSystemEnvironmentMixin {
    +interface LinuxRpmSystemEnvironmentMixin {
         Path rpm();
         Path rpmbuild();
     
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxSystemEnvironment.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxSystemEnvironment.java
    index 1a70cc938b8..e347c58ae21 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxSystemEnvironment.java
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxSystemEnvironment.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
    @@ -27,7 +27,6 @@ package jdk.jpackage.internal;
     import java.io.IOException;
     import java.util.ArrayList;
     import java.util.List;
    -import java.util.Objects;
     import java.util.Optional;
     import java.util.function.Supplier;
     import jdk.jpackage.internal.model.PackageType;
    @@ -35,9 +34,10 @@ import jdk.jpackage.internal.model.StandardPackageType;
     import jdk.jpackage.internal.util.CompositeProxy;
     import jdk.jpackage.internal.util.Result;
     
    -public interface LinuxSystemEnvironment extends SystemEnvironment {
    +interface LinuxSystemEnvironment extends SystemEnvironment {
         boolean soLookupAvailable();
         PackageType nativePackageType();
    +    LinuxPackageArch packageArch();
     
         static Result create() {
             return detectNativePackageType().map(LinuxSystemEnvironment::create).orElseGet(() -> {
    @@ -45,7 +45,7 @@ public interface LinuxSystemEnvironment extends SystemEnvironment {
             });
         }
     
    -    static Optional detectNativePackageType() {
    +    static Optional detectNativePackageType() {
             if (Internal.isDebian()) {
                 return Optional.of(StandardPackageType.LINUX_DEB);
             } else if (Internal.isRpm()) {
    @@ -55,13 +55,14 @@ public interface LinuxSystemEnvironment extends SystemEnvironment {
             }
         }
     
    -    static Result create(PackageType nativePackageType) {
    -        return Result.ofValue(new Stub(LibProvidersLookup.supported(),
    -                Objects.requireNonNull(nativePackageType)));
    +    static Result create(StandardPackageType nativePackageType) {
    +        return LinuxPackageArch.create(nativePackageType).map(arch -> {
    +            return new Stub(LibProvidersLookup.supported(), nativePackageType, arch);
    +        });
         }
     
         static  U createWithMixin(Class type, LinuxSystemEnvironment base, T mixin) {
    -        return CompositeProxy.create(type, base, mixin);
    +        return CompositeProxy.build().invokeTunnel(CompositeProxyTunnel.INSTANCE).create(type, base, mixin);
         }
     
         static  Result mixin(Class type,
    @@ -79,7 +80,7 @@ public interface LinuxSystemEnvironment extends SystemEnvironment {
             }
         }
     
    -    record Stub(boolean soLookupAvailable, PackageType nativePackageType) implements LinuxSystemEnvironment {
    +    record Stub(boolean soLookupAvailable, PackageType nativePackageType, LinuxPackageArch packageArch) implements LinuxSystemEnvironment {
         }
     
         static final class Internal {
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties
    index 3aabe1f4ba5..3aa0e0e92a0 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources.properties
    @@ -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
    @@ -49,11 +49,7 @@ error.rpm-arch-not-detected="Failed to detect RPM arch"
     
     message.icon-not-png=The specified icon "{0}" is not a PNG file and will not be used. The default icon will be used in it's place.
     message.test-for-tool=Test for [{0}]. Result: {1}
    -message.outputting-to-location=Generating DEB for installer to: {0}.
    -message.output-to-location=Package (.deb) saved to: {0}.
     message.debs-like-licenses=Debian packages should specify a license. The absence of a license will cause some linux distributions to complain about the quality of the application.
    -message.outputting-bundle-location=Generating RPM for installer to: {0}.
    -message.output-bundle-location=Package (.rpm) saved to: {0}.
     
     message.ldd-not-available=ldd command not found. Package dependencies will not be generated.
     message.deb-ldd-not-available.advice=Install "libc-bin" DEB package to get ldd.
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties
    index 2f8fcddff73..345ed36b7be 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties
    @@ -23,12 +23,7 @@
     # questions.
     #
     #
    -app.bundler.name=Linux-Anwendungsimage
    -deb.bundler.name=DEB-Bundle
    -rpm.bundler.name=RPM-Bundle
    -
     param.license-type.default=Unbekannt
    -param.menu-group.default=Unbekannt
     
     resource.deb-control-file=DEB-Kontrolldatei
     resource.deb-preinstall-script=DEB-Preinstall-Skript
    @@ -59,7 +54,6 @@ message.output-to-location=Package (.deb) gespeichert in: {0}.
     message.debs-like-licenses=Debian-Packages müssen eine Lizenz angeben. Bei fehlender Lizenz geben einige Linux-Distributionen eine Meldung über eine Beeinträchtigung der Anwendungsqualität aus.
     message.outputting-bundle-location=RPM für Installationsprogramm wird generiert in: {0}.
     message.output-bundle-location=Package (.rpm) gespeichert in: {0}.
    -message.creating-association-with-null-extension=Verknüpfung mit Nullerweiterung wird erstellt.
     
     message.ldd-not-available=ldd-Befehl nicht gefunden. Packageabhängigkeiten werden nicht generiert.
     message.deb-ldd-not-available.advice=Installieren Sie das DEB-Package "libc-bin", um ldd abzurufen.
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties
    index be2cd00b42c..d0bc4f73407 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties
    @@ -23,12 +23,7 @@
     # questions.
     #
     #
    -app.bundler.name=Linuxアプリケーション・イメージ
    -deb.bundler.name=DEBバンドル
    -rpm.bundler.name=RPMバンドル
    -
     param.license-type.default=不明
    -param.menu-group.default=不明
     
     resource.deb-control-file=DEB制御ファイル
     resource.deb-preinstall-script=DEBインストール前スクリプト
    @@ -59,7 +54,6 @@ message.output-to-location=パッケージ(.deb)は次に保存されました:
     message.debs-like-licenses=Debianパッケージではライセンスを指定する必要があります。ライセンスがない場合、一部のLinuxディストリビューションでアプリケーションの品質に問題が発生する場合があります。
     message.outputting-bundle-location=インストーラのRPMを次に生成しています: {0}
     message.output-bundle-location=パッケージ(.rpm)は次に保存されました: {0}
    -message.creating-association-with-null-extension=null拡張子との関連付けを作成しています。
     
     message.ldd-not-available=lddコマンドが見つかりませんでした。パッケージ依存性は生成されません。
     message.deb-ldd-not-available.advice="libc-bin" DEBパッケージをインストールしてlddを取得します。
    diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties
    index 5b583062ab6..f3d62675c4d 100644
    --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties
    +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties
    @@ -23,12 +23,7 @@
     # questions.
     #
     #
    -app.bundler.name=Linux 应用程序映像
    -deb.bundler.name=DEB 包
    -rpm.bundler.name=RPM 包
    -
     param.license-type.default=未知
    -param.menu-group.default=未知
     
     resource.deb-control-file=DEB 控制文件
     resource.deb-preinstall-script=DEB 安装前脚本
    @@ -59,7 +54,6 @@ message.output-to-location=程序包 (.deb) 已保存到: {0}。
     message.debs-like-licenses=Debian 程序包应指定许可证。缺少许可证将导致某些 Linux 分发投诉应用程序质量。
     message.outputting-bundle-location=正在为安装程序生成 RPM, 位置: {0}。
     message.output-bundle-location=程序包 (.rpm) 已保存到: {0}。
    -message.creating-association-with-null-extension=正在使用空扩展名创建关联。
     
     message.ldd-not-available=未找到 ldd 命令。将不生成程序包被依赖对象。
     message.deb-ldd-not-available.advice=安装 "libc-bin" DEB 程序包以获取 ldd。
    diff --git a/src/jdk.jpackage/linux/native/libapplauncher/LinuxLauncherLib.cpp b/src/jdk.jpackage/linux/native/libapplauncher/LinuxLauncherLib.cpp
    index 7d7c8b7213d..561e2a942bb 100644
    --- a/src/jdk.jpackage/linux/native/libapplauncher/LinuxLauncherLib.cpp
    +++ b/src/jdk.jpackage/linux/native/libapplauncher/LinuxLauncherLib.cpp
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
      * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      *
      * This code is free software; you can redistribute it and/or modify it
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageInfoPListFile.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageInfoPListFile.java
    index 4787d1297bb..602e147a970 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageInfoPListFile.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageInfoPListFile.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
    @@ -24,8 +24,6 @@
      */
     package jdk.jpackage.internal;
     
    -import static jdk.jpackage.internal.util.XmlUtils.initDocumentBuilder;
    -
     import java.io.IOException;
     import java.nio.file.Files;
     import java.nio.file.Path;
    @@ -50,7 +48,7 @@ record AppImageInfoPListFile(String bundleIdentifier, String bundleName, String
         static AppImageInfoPListFile loadFromInfoPList(Path infoPListFile)
                 throws IOException, InvalidPlistFileException, SAXException {
     
    -        final var plistReader = new PListReader(initDocumentBuilder().parse(Files.newInputStream(infoPListFile)));
    +        final var plistReader = new PListReader(Files.readAllBytes(infoPListFile));
     
             try {
                 return new AppImageInfoPListFile(
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java
    index 71f87dd8705..c908ec7447c 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/AppImageSigner.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
    @@ -24,7 +24,6 @@
      */
     package jdk.jpackage.internal;
     
    -import static java.util.stream.Collectors.joining;
     import static jdk.jpackage.internal.MacPackagingPipeline.APPLICATION_LAYOUT;
     import static jdk.jpackage.internal.model.MacPackage.RUNTIME_BUNDLE_LAYOUT;
     import static jdk.jpackage.internal.util.function.ThrowingConsumer.toConsumer;
    @@ -40,14 +39,15 @@ import java.util.Optional;
     import java.util.Set;
     import java.util.function.Consumer;
     import java.util.function.Predicate;
    -import java.util.stream.Stream;
     import jdk.jpackage.internal.Codesign.CodesignException;
     import jdk.jpackage.internal.model.Application;
     import jdk.jpackage.internal.model.ApplicationLayout;
     import jdk.jpackage.internal.model.Launcher;
     import jdk.jpackage.internal.model.MacApplication;
     import jdk.jpackage.internal.model.RuntimeLayout;
    +import jdk.jpackage.internal.util.MacBundle;
     import jdk.jpackage.internal.util.PathUtils;
    +import jdk.jpackage.internal.util.Result;
     import jdk.jpackage.internal.util.function.ExceptionBox;
     
     
    @@ -61,9 +61,10 @@ final class AppImageSigner {
                     throw handleCodesignException(app, ex);
                 } catch (ExceptionBox ex) {
                     if (ex.getCause() instanceof CodesignException codesignEx) {
    -                    handleCodesignException(app, codesignEx);
    +                    throw handleCodesignException(app, codesignEx);
    +                } else {
    +                    throw ex;
                     }
    -                throw ex;
                 }
             });
         }
    @@ -163,13 +164,9 @@ final class AppImageSigner {
             }
         }
     
    -    private static CodesignException handleCodesignException(MacApplication app, CodesignException ex) {
    -        // Log output of "codesign" in case of error. It should help
    -        // user to diagnose issues when using --mac-app-image-sign-identity.
    -        // In addition add possible reason for failure. For example
    -        // "--app-content" can fail "codesign".
    -
    -        if (!app.contentDirs().isEmpty()) {
    +    private static IOException handleCodesignException(MacApplication app, CodesignException ex) {
    +        if (!app.contentDirSources().isEmpty()) {
    +            // Additional content may cause signing error.
                 Log.info(I18N.getString("message.codesign.failed.reason.app.content"));
             }
     
    @@ -180,19 +177,13 @@ final class AppImageSigner {
                 Log.info(I18N.getString("message.codesign.failed.reason.xcode.tools"));
             }
     
    -        // Log "codesign" output
    -        Log.info(I18N.format("error.tool.failed.with.output", "codesign"));
    -        Log.info(Stream.of(ex.getOutput()).collect(joining("\n")).strip());
    -
    -        return ex;
    +        return ex.getCause();
         }
     
         private static boolean isXcodeDevToolsInstalled() {
    -        try {
    -            return Executor.of("/usr/bin/xcrun", "--help").setQuiet(true).execute() == 0;
    -        } catch (IOException ex) {
    -            return false;
    -        }
    +        return Result.of(
    +                Executor.of("/usr/bin/xcrun", "--help").setQuiet(true)::executeExpectSuccess,
    +                IOException.class).hasValue();
         }
     
         private static void unsign(Path path) throws IOException {
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/Codesign.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/Codesign.java
    index 920b75df398..984202bbfaf 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/Codesign.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/Codesign.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
    @@ -34,23 +34,21 @@ import java.util.Objects;
     import java.util.Optional;
     import java.util.function.Consumer;
     import java.util.function.Supplier;
    -import java.util.stream.Stream;
    -
    +import jdk.jpackage.internal.util.CommandOutputControl.UnexpectedExitCodeException;
     
     public final class Codesign {
     
         public static final class CodesignException extends Exception {
     
    -        CodesignException(String[] output) {
    -            this.output = output;
    +        CodesignException(UnexpectedExitCodeException cause) {
    +            super(Objects.requireNonNull(cause));
             }
     
    -        String[] getOutput() {
    -            return output;
    +        @Override
    +        public UnexpectedExitCodeException getCause() {
    +            return (UnexpectedExitCodeException)super.getCause();
             }
     
    -        private final String[] output;
    -
             private static final long serialVersionUID = 1L;
         }
     
    @@ -94,14 +92,13 @@ public final class Codesign {
     
         public void applyTo(Path path) throws IOException, CodesignException {
     
    -        var exec = Executor.of(Stream.concat(
    -                cmdline.stream(),
    -                Stream.of(path.toString())).toArray(String[]::new)
    -        ).saveOutput(true);
    +        var exec = Executor.of(cmdline).args(path.toString()).saveOutput(true);
             configureExecutor.ifPresent(configure -> configure.accept(exec));
     
    -        if (exec.execute() != 0) {
    -            throw new CodesignException(exec.getOutput().toArray(String[]::new));
    +        try {
    +            exec.execute().expectExitCode(0);
    +        } catch (UnexpectedExitCodeException ex) {
    +            throw new CodesignException(ex);
             }
         }
     
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacApplicationBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacApplicationBuilder.java
    index 5f126305aed..2023b425da9 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacApplicationBuilder.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacApplicationBuilder.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
    @@ -31,6 +31,9 @@ import java.nio.file.Path;
     import java.util.Objects;
     import java.util.Optional;
     import java.util.Set;
    +import java.util.stream.Collectors;
    +import jdk.jpackage.internal.util.RootedPath;
    +import java.util.stream.Stream;
     import jdk.jpackage.internal.model.AppImageLayout;
     import jdk.jpackage.internal.model.AppImageSigningConfig;
     import jdk.jpackage.internal.model.Application;
    @@ -143,15 +146,17 @@ final class MacApplicationBuilder {
         }
     
         private static void validateAppContentDirs(Application app) {
    -        for (var contentDir : app.contentDirs()) {
    +        app.contentDirSources().stream().filter(rootedPath -> {
    +            return rootedPath.branch().getNameCount() == 1;
    +        }).map(RootedPath::fullPath).forEach(contentDir -> {
                 if (!Files.isDirectory(contentDir)) {
                     Log.info(I18N.format("warning.app.content.is.not.dir",
                             contentDir));
    -            } else if (!CONTENTS_SUB_DIRS.contains(contentDir.getFileName().toString())) {
    +            } else if (!CONTENTS_SUB_DIRS.contains(contentDir.getFileName())) {
                     Log.info(I18N.format("warning.non.standard.contents.sub.dir",
                             contentDir));
                 }
    -        }
    +        });
         }
     
         private MacApplicationBuilder createCopyForExternalInfoPlistFile() {
    @@ -258,6 +263,11 @@ final class MacApplicationBuilder {
         private static final int MAX_BUNDLE_NAME_LENGTH = 16;
     
         // List of standard subdirectories of the "Contents" directory
    -    private static final Set CONTENTS_SUB_DIRS = Set.of("MacOS",
    -            "Resources", "Frameworks", "PlugIns", "SharedSupport");
    +    private static final Set CONTENTS_SUB_DIRS = Stream.of(
    +            "MacOS",
    +            "Resources",
    +            "Frameworks",
    +            "PlugIns",
    +            "SharedSupport"
    +    ).map(Path::of).collect(Collectors.toUnmodifiableSet());
     }
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.java
    index 371a3c7307a..224ea20f249 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.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
    @@ -36,7 +36,6 @@ import java.util.Optional;
     import jdk.jpackage.internal.cli.Options;
     import jdk.jpackage.internal.model.MacPackage;
     import jdk.jpackage.internal.model.Package;
    -import jdk.jpackage.internal.util.Result;
     
     public class MacBundlingEnvironment extends DefaultBundlingEnvironment {
     
    @@ -45,30 +44,26 @@ public class MacBundlingEnvironment extends DefaultBundlingEnvironment {
                     .defaultOperation(CREATE_MAC_DMG)
                     .bundler(SIGN_MAC_APP_IMAGE, MacBundlingEnvironment::signAppImage)
                     .bundler(CREATE_MAC_APP_IMAGE, MacBundlingEnvironment::createAppImage)
    -                .bundler(CREATE_MAC_DMG, LazyLoad::dmgSysEnv, MacBundlingEnvironment::createDmdPackage)
    +                .bundler(CREATE_MAC_DMG, MacDmgSystemEnvironment::create, MacBundlingEnvironment::createDmdPackage)
                     .bundler(CREATE_MAC_PKG, MacBundlingEnvironment::createPkgPackage));
         }
     
         private static void createDmdPackage(Options options, MacDmgSystemEnvironment sysEnv) {
             createNativePackage(options,
    -                MacFromOptions::createMacDmgPackage,
    +                MacFromOptions.createMacDmgPackage(options),
                     buildEnv()::create,
                     MacBundlingEnvironment::buildPipeline,
                     (env, pkg, outputDir) -> {
    -                    Log.verbose(I18N.format("message.building-dmg", pkg.app().name()));
                         return new MacDmgPackager(env, pkg, outputDir, sysEnv);
                     });
         }
     
         private static void createPkgPackage(Options options) {
             createNativePackage(options,
    -                MacFromOptions::createMacPkgPackage,
    +                MacFromOptions.createMacPkgPackage(options),
                     buildEnv()::create,
                     MacBundlingEnvironment::buildPipeline,
    -                (env, pkg, outputDir) -> {
    -                    Log.verbose(I18N.format("message.building-pkg", pkg.app().name()));
    -                    return new MacPkgPackager(env, pkg, outputDir);
    -                });
    +                MacPkgPackager::new);
         }
     
         private static void signAppImage(Options options) {
    @@ -98,13 +93,4 @@ public class MacBundlingEnvironment extends DefaultBundlingEnvironment {
                     .predefinedAppImageLayout(APPLICATION_LAYOUT)
                     .predefinedRuntimeImageLayout(MacPackage::guessRuntimeLayout);
         }
    -
    -    private static final class LazyLoad {
    -
    -        static Result dmgSysEnv() {
    -            return DMG_SYS_ENV;
    -        }
    -
    -        private static final Result DMG_SYS_ENV = MacDmgSystemEnvironment.create();
    -    }
     }
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificateUtils.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificateUtils.java
    index fe593e347fc..24a236ae15d 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificateUtils.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacCertificateUtils.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
    @@ -53,7 +53,7 @@ public final class MacCertificateUtils {
             keychain.map(Keychain::asCliArg).ifPresent(args::add);
     
             return toSupplier(() -> {
    -            final var output = Executor.of(args.toArray(String[]::new))
    +            final var output = Executor.of(args)
                         .setQuiet(true).saveOutput(true).executeExpectSuccess()
                         .getOutput();
     
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgLicense.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgLicense.java
    new file mode 100644
    index 00000000000..eea09b80929
    --- /dev/null
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgLicense.java
    @@ -0,0 +1,103 @@
    +/*
    + * 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.  Oracle designates this
    + * particular file as subject to the "Classpath" exception as provided
    + * by Oracle in the LICENSE file that accompanied this code.
    + *
    + * This code is distributed in the hope that it will be useful, but WITHOUT
    + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    + * version 2 for more details (a copy is included in the LICENSE file that
    + * accompanied this code).
    + *
    + * You should have received a copy of the GNU General Public License version
    + * 2 along with this work; if not, write to the Free Software Foundation,
    + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    + *
    + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    + * or visit www.oracle.com if you need additional information or have any
    + * questions.
    + */
    +
    +package jdk.jpackage.internal;
    +
    +import java.io.ByteArrayOutputStream;
    +import java.io.IOException;
    +import java.nio.charset.Charset;
    +import java.nio.file.Files;
    +import java.nio.file.Path;
    +import java.util.Base64;
    +import java.util.HashMap;
    +import java.util.Locale;
    +import java.util.Map;
    +import java.util.ResourceBundle;
    +
    +import jdk.jpackage.internal.resources.ResourceLocator;
    +
    +final class MacDmgLicense {
    +
    +    public static void prepareLicensePListFile(Path licenseFile, Path licensePListFile)
    +            throws IOException {
    +        byte[] licenseContentOriginal =
    +                Files.readAllBytes(licenseFile);
    +        String licenseInBase64 =
    +                Base64.getEncoder().encodeToString(licenseContentOriginal);
    +
    +        Map data = new HashMap<>();
    +        data.put("APPLICATION_LICENSE_TEXT", licenseInBase64);
    +        data.put("STR_DATA_ENGLISH",
    +                getSTRData("English", Locale.ENGLISH, "MacRoman"));
    +        data.put("STR_DATA_GERMAN",
    +                getSTRData("German", Locale.GERMAN, "MacRoman"));
    +        data.put("STR_DATA_JAPANESE",
    +                getSTRData("Japanese", Locale.JAPANESE, "Shift_JIS"));
    +        data.put("STR_DATA_SIMPLIFIED_CHINESE",
    +                getSTRData("Simplified Chinese", Locale.SIMPLIFIED_CHINESE, "GB2312"));
    +
    +        new OverridableResource(DEFAULT_LICENSE_PLIST, ResourceLocator.class)
    +                .setCategory(I18N.getString("resource.license-setup"))
    +                .setSubstitutionData(data)
    +                .saveToFile(licensePListFile);
    +    }
    +
    +    private static void writeSTRDataString(ByteArrayOutputStream bos,
    +                String str, String charset) {
    +        byte [] bytes = str.getBytes(Charset.forName(charset));
    +        byte [] bytesLength = {(byte)bytes.length};
    +        bos.writeBytes(bytesLength);
    +        bos.writeBytes(bytes);
    +    }
    +
    +    // Returns base64 decoded STR section data.
    +    // Strings should be in following order:
    +    // Language, message.dmg.license.button.agree,
    +    // message.dmg.license.button.disagree, message.dmg.license.button.print
    +    // message.dmg.license.button.save, message.dmg.license.message
    +    // STR section data encoded:
    +    // Number of strings in the list (unsigned 16-bit integer, big endian): 6
    +    // A sequence of strings prefixed with string length (unsigned 8-bit integer)
    +    // Note: Language should not be translated.
    +    private static String getSTRData(String language, Locale locale, String charset) {
    +        ResourceBundle bundle = ResourceBundle.getBundle(
    +                "jdk.jpackage.internal.resources.MacResources", locale);
    +        ByteArrayOutputStream bos = new ByteArrayOutputStream();
    +
    +        byte [] numberOfStrings = {0x00, 0x06}; // Always 6
    +        bos.writeBytes(numberOfStrings);
    +
    +        writeSTRDataString(bos, language, charset);
    +        writeSTRDataString(bos, bundle.getString("message.dmg.license.button.agree"), charset);
    +        writeSTRDataString(bos, bundle.getString("message.dmg.license.button.disagree"), charset);
    +        writeSTRDataString(bos, bundle.getString("message.dmg.license.button.print"), charset);
    +        writeSTRDataString(bos, bundle.getString("message.dmg.license.button.save"), charset);
    +        writeSTRDataString(bos, bundle.getString("message.dmg.license.message"), charset);
    +
    +        return Base64.getEncoder().encodeToString(bos.toByteArray());
    +    }
    +
    +    private static final String DEFAULT_LICENSE_PLIST = "lic_template.plist";
    +}
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackageBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackageBuilder.java
    index 10754b1f1b6..b9e407b4a47 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackageBuilder.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackageBuilder.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
    @@ -25,11 +25,13 @@
     package jdk.jpackage.internal;
     
     import java.nio.file.Path;
    +import java.util.Collection;
     import java.util.List;
     import java.util.Objects;
     import java.util.Optional;
     import jdk.jpackage.internal.model.MacDmgPackage;
     import jdk.jpackage.internal.model.MacDmgPackageMixin;
    +import jdk.jpackage.internal.util.RootedPath;
     
     final class MacDmgPackageBuilder {
     
    @@ -37,8 +39,8 @@ final class MacDmgPackageBuilder {
             this.pkgBuilder = Objects.requireNonNull(pkgBuilder);
         }
     
    -    MacDmgPackageBuilder dmgContent(List v) {
    -        dmgContent = v;
    +    MacDmgPackageBuilder dmgRootDirSources(Collection v) {
    +        dmgRootDirSources = v;
             return this;
         }
     
    @@ -47,8 +49,8 @@ final class MacDmgPackageBuilder {
             return this;
         }
     
    -    List validatedDmgContent() {
    -        return Optional.ofNullable(dmgContent).orElseGet(List::of);
    +    private Collection validatedDmgRootDirSources() {
    +        return Optional.ofNullable(dmgRootDirSources).orElseGet(List::of);
         }
     
         MacDmgPackage create() {
    @@ -56,10 +58,10 @@ final class MacDmgPackageBuilder {
     
             return MacDmgPackage.create(pkg, new MacDmgPackageMixin.Stub(
                     Optional.ofNullable(icon).or((pkg.app())::icon),
    -                validatedDmgContent()));
    +                validatedDmgRootDirSources()));
         }
     
         private Path icon;
    -    private List dmgContent;
    +    private Collection dmgRootDirSources;
         private final MacPackageBuilder pkgBuilder;
     }
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackager.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackager.java
    index 4ccc459109f..24474c88162 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackager.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackager.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
    @@ -33,16 +33,20 @@ import java.nio.file.Files;
     import java.nio.file.LinkOption;
     import java.nio.file.Path;
     import java.text.MessageFormat;
    -import java.util.Base64;
    +import java.util.ArrayList;
     import java.util.HashMap;
    +import java.util.List;
     import java.util.Map;
     import java.util.Objects;
    +import java.util.concurrent.TimeUnit;
     import java.util.function.Consumer;
    +import java.util.function.Function;
     import jdk.jpackage.internal.PackagingPipeline.PackageTaskID;
     import jdk.jpackage.internal.PackagingPipeline.TaskID;
     import jdk.jpackage.internal.model.MacDmgPackage;
     import jdk.jpackage.internal.util.FileUtils;
     import jdk.jpackage.internal.util.PathGroup;
    +import jdk.jpackage.internal.util.RootedPath;
     
     record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
             MacDmgSystemEnvironment sysEnv) implements Consumer {
    @@ -57,7 +61,6 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
         @Override
         public void accept(PackagingPipeline.Builder pipelineBuilder) {
             pipelineBuilder
    -                .excludeDirFromCopying(outputDir)
                     .task(DmgPackageTaskID.COPY_DMG_CONTENT)
                             .action(this::copyDmgContent)
                             .addDependent(PackageTaskID.CREATE_PACKAGE_FILE)
    @@ -101,10 +104,14 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
             return env.configDir().resolve(pkg.app().name() + "-volume.icns");
         }
     
    -    Path licenseFile() {
    +    Path licensePListFile() {
             return env.configDir().resolve(pkg.app().name() + "-license.plist");
         }
     
    +    private Path finalDmg() {
    +        return outputDir.resolve(pkg.packageFileNameWithSuffix());
    +    }
    +
         Path protoDmg() {
             return dmgWorkdir().resolve("proto.dmg");
         }
    @@ -123,9 +130,11 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
     
         private void copyDmgContent() throws IOException {
             final var srcFolder = env.appImageDir();
    -        for (Path path : pkg.content()) {
    -            FileUtils.copyRecursive(path, srcFolder.resolve(path.getFileName()));
    -        }
    +        RootedPath.copy(pkg.dmgRootDirSources().stream(), srcFolder);
    +    }
    +
    +    private Executor hdiutil(String... args) {
    +        return Executor.of(sysEnv.hdiutil().toString()).args(args).storeOutputInFiles();
         }
     
         private void prepareDMGSetupScript() throws IOException {
    @@ -163,26 +172,6 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
                     .saveToFile(dmgSetup);
         }
     
    -    private void prepareLicense() throws IOException {
    -        final var licFile = pkg.licenseFile();
    -        if (licFile.isEmpty()) {
    -            return;
    -        }
    -
    -        byte[] licenseContentOriginal =
    -                Files.readAllBytes(licFile.orElseThrow());
    -        String licenseInBase64 =
    -                Base64.getEncoder().encodeToString(licenseContentOriginal);
    -
    -        Map data = new HashMap<>();
    -        data.put("APPLICATION_LICENSE_TEXT", licenseInBase64);
    -
    -        env.createResource(DEFAULT_LICENSE_PLIST)
    -                .setCategory(I18N.getString("resource.license-setup"))
    -                .setSubstitutionData(data)
    -                .saveToFile(licenseFile());
    -    }
    -
         private void prepareConfigFiles() throws IOException {
     
             env.createResource(DEFAULT_BACKGROUND_IMAGE)
    @@ -194,7 +183,9 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
                     .setExternal(pkg.icon().orElse(null))
                     .saveToFile(volumeIcon());
     
    -        prepareLicense();
    +        if (pkg.licenseFile().isPresent()) {
    +            MacDmgLicense.prepareLicensePListFile(pkg.licenseFile().get(), licensePListFile());
    +        }
     
             prepareDMGSetupScript();
         }
    @@ -211,43 +202,32 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
             }
         }
     
    +    private String hdiUtilVerbosityFlag() {
    +        return env.verbose() ? "-verbose" : "-quiet";
    +    }
    +
         private void buildDMG() throws IOException {
             boolean copyAppImage = false;
     
    -        Path protoDMG = protoDmg();
    -        Path finalDMG = outputDir.resolve(pkg.packageFileNameWithSuffix());
    +        final Path protoDMG = protoDmg();
    +        final Path finalDMG = finalDmg();
     
    -        Path srcFolder = env.appImageDir();
    -
    -        Log.verbose(MessageFormat.format(I18N.getString(
    -                "message.creating-dmg-file"), finalDMG.toAbsolutePath()));
    -
    -        try {
    -            Files.deleteIfExists(finalDMG);
    -        } catch (IOException ex) {
    -            throw new IOException(MessageFormat.format(I18N.getString(
    -                    "message.dmg-cannot-be-overwritten"),
    -                    finalDMG.toAbsolutePath()));
    -        }
    +        final Path srcFolder = env.appImageDir();
     
             Files.createDirectories(protoDMG.getParent());
             Files.createDirectories(finalDMG.getParent());
     
    -        String hdiUtilVerbosityFlag = env.verbose() ?
    -                "-verbose" : "-quiet";
    +        final String hdiUtilVerbosityFlag = hdiUtilVerbosityFlag();
     
             // create temp image
    -        ProcessBuilder pb = new ProcessBuilder(
    -                sysEnv.hdiutil().toString(),
    -                "create",
    -                hdiUtilVerbosityFlag,
    -                "-srcfolder", normalizedAbsolutePathString(srcFolder),
    -                "-volname", volumeName(),
    -                "-ov", normalizedAbsolutePathString(protoDMG),
    -                "-fs", "HFS+",
    -                "-format", "UDRW");
             try {
    -            IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
    +            hdiutil("create",
    +                    hdiUtilVerbosityFlag,
    +                    "-srcfolder", normalizedAbsolutePathString(srcFolder),
    +                    "-volname", volumeName(),
    +                    "-ov", normalizedAbsolutePathString(protoDMG),
    +                    "-fs", "HFS+",
    +                    "-format", "UDRW").executeExpectSuccess();
             } catch (IOException ex) {
                 Log.verbose(ex); // Log exception
     
    @@ -260,31 +240,26 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
                 // not be bigger, but it will able to hold additional 50 megabytes of data.
                 // We need extra room for icons and background image. When we providing
                 // actual files to hdiutil, it will create DMG with ~50 megabytes extra room.
    -            pb = new ProcessBuilder(
    -                sysEnv.hdiutil().toString(),
    -                "create",
    -                hdiUtilVerbosityFlag,
    -                "-size", String.valueOf(size),
    -                "-volname", volumeName(),
    -                "-ov", normalizedAbsolutePathString(protoDMG),
    -                "-fs", "HFS+");
    -            new RetryExecutor()
    -                .setMaxAttemptsCount(10)
    -                .setAttemptTimeoutMillis(3000)
    -                .setWriteOutputToFile(true)
    -                .execute(pb);
    +            hdiutil(
    +                    "create",
    +                    hdiUtilVerbosityFlag,
    +                    "-size", String.valueOf(size),
    +                    "-volname", volumeName(),
    +                    "-ov", normalizedAbsolutePathString(protoDMG),
    +                    "-fs", "HFS+"
    +            ).retry()
    +                    .setMaxAttemptsCount(10)
    +                    .setAttemptTimeout(3, TimeUnit.SECONDS)
    +                    .execute();
             }
     
    +        final Path mountedVolume = volumePath();
    +
             // mount temp image
    -        pb = new ProcessBuilder(
    -                sysEnv.hdiutil().toString(),
    -                "attach",
    +        hdiutil("attach",
                     normalizedAbsolutePathString(protoDMG),
                     hdiUtilVerbosityFlag,
    -                "-mountroot", protoDMG.getParent().toString());
    -        IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
    -
    -        final Path mountedVolume = volumePath();
    +                "-mountroot", mountedVolume.getParent().toString()).executeExpectSuccess();
     
             // Copy app image, since we did not create DMG with it, but instead we created
             // empty one.
    @@ -302,9 +277,13 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
                 // to install-dir in DMG as critical error, since it can fail in
                 // headless environment.
                 try {
    -                pb = new ProcessBuilder(sysEnv.osascript().toString(),
    -                        normalizedAbsolutePathString(volumeScript()));
    -                IOUtils.exec(pb, 180); // Wait 3 minutes. See JDK-8248248.
    +                Executor.of(
    +                        sysEnv.osascript().toString(),
    +                        normalizedAbsolutePathString(volumeScript())
    +                )
    +                // Wait 3 minutes. See JDK-8248248.
    +                .timeout(3, TimeUnit.MINUTES)
    +                .executeExpectSuccess();
                 } catch (IOException ex) {
                     Log.verbose(ex);
                 }
    @@ -325,18 +304,18 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
                         // but it seems Finder excepts these bytes to be
                         // "icnC" for the volume icon
                         // (might not work on Mac 10.13 with old XCode)
    -                    pb = new ProcessBuilder(
    +                    Executor.of(
                                 sysEnv.setFileUtility().orElseThrow().toString(),
                                 "-c", "icnC",
    -                            normalizedAbsolutePathString(volumeIconFile));
    -                    IOUtils.exec(pb);
    +                            normalizedAbsolutePathString(volumeIconFile)
    +                    ).executeExpectSuccess();
                         volumeIconFile.toFile().setReadOnly();
     
    -                    pb = new ProcessBuilder(
    +                    Executor.of(
                                 sysEnv.setFileUtility().orElseThrow().toString(),
                                 "-a", "C",
    -                            normalizedAbsolutePathString(mountedVolume));
    -                    IOUtils.exec(pb);
    +                            normalizedAbsolutePathString(mountedVolume)
    +                    ).executeExpectSuccess();
                     } catch (IOException ex) {
                         Log.error(ex.getMessage());
                         Log.verbose("Cannot enable custom icon using SetFile utility");
    @@ -347,85 +326,23 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
     
             } finally {
                 // Detach the temporary image
    -            pb = new ProcessBuilder(
    -                    sysEnv.hdiutil().toString(),
    -                    "detach",
    -                    hdiUtilVerbosityFlag,
    -                    normalizedAbsolutePathString(mountedVolume));
    -            // "hdiutil detach" might not work right away due to resource busy error, so
    -            // repeat detach several times.
    -            RetryExecutor retryExecutor = new RetryExecutor();
    -            // Image can get detach even if we got resource busy error, so stop
    -            // trying to detach it if it is no longer attached.
    -            retryExecutor.setExecutorInitializer(exec -> {
    -                if (!Files.exists(mountedVolume)) {
    -                    retryExecutor.abort();
    -                }
    -            });
    -            try {
    -                // 10 times with 6 second delays.
    -                retryExecutor.setMaxAttemptsCount(10).setAttemptTimeoutMillis(6000)
    -                        .execute(pb);
    -            } catch (IOException ex) {
    -                if (!retryExecutor.isAborted()) {
    -                    // Now force to detach if it still attached
    -                    if (Files.exists(mountedVolume)) {
    -                        pb = new ProcessBuilder(
    -                                sysEnv.hdiutil().toString(),
    -                                "detach",
    -                                "-force",
    -                                hdiUtilVerbosityFlag,
    -                                normalizedAbsolutePathString(mountedVolume));
    -                        IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
    -                    }
    -                }
    -            }
    +            detachVolume();
             }
     
             // Compress it to a new image
    -        pb = new ProcessBuilder(
    -                sysEnv.hdiutil().toString(),
    -                "convert",
    -                normalizedAbsolutePathString(protoDMG),
    -                hdiUtilVerbosityFlag,
    -                "-format", "UDZO",
    -                "-o", normalizedAbsolutePathString(finalDMG));
    -        try {
    -            new RetryExecutor()
    -                .setMaxAttemptsCount(10)
    -                .setAttemptTimeoutMillis(3000)
    -                .execute(pb);
    -        } catch (Exception ex) {
    -            // Convert might failed if something holds file. Try to convert copy.
    -            Path protoCopyDMG = protoCopyDmg();
    -            Files.copy(protoDMG, protoCopyDMG);
    -            try {
    -                pb = new ProcessBuilder(
    -                        sysEnv.hdiutil().toString(),
    -                        "convert",
    -                        normalizedAbsolutePathString(protoCopyDMG),
    -                        hdiUtilVerbosityFlag,
    -                        "-format", "UDZO",
    -                        "-o", normalizedAbsolutePathString(finalDMG));
    -                IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
    -            } finally {
    -                Files.deleteIfExists(protoCopyDMG);
    -            }
    -        }
    +        convertProtoDmg();
     
             //add license if needed
             if (pkg.licenseFile().isPresent()) {
    -            pb = new ProcessBuilder(
    -                    sysEnv.hdiutil().toString(),
    +            hdiutil(
                         "udifrez",
                         normalizedAbsolutePathString(finalDMG),
                         "-xml",
    -                    normalizedAbsolutePathString(licenseFile())
    -            );
    -            new RetryExecutor()
    -                .setMaxAttemptsCount(10)
    -                .setAttemptTimeoutMillis(3000)
    -                .execute(pb);
    +                    normalizedAbsolutePathString(licensePListFile())
    +            ).retry()
    +                    .setMaxAttemptsCount(10)
    +                    .setAttemptTimeout(3, TimeUnit.SECONDS)
    +                    .execute();
             }
     
             try {
    @@ -434,17 +351,73 @@ record MacDmgPackager(BuildEnv env, MacDmgPackage pkg, Path outputDir,
             } catch (IOException ex) {
                 // Don't care if fails
             }
    +    }
     
    -        Log.verbose(MessageFormat.format(I18N.getString(
    -                "message.output-to-location"),
    -                pkg.app().name(), normalizedAbsolutePathString(finalDMG)));
    +    private void detachVolume() throws IOException {
    +        var mountedVolume = volumePath();
     
    +        // "hdiutil detach" might not work right away due to resource busy error, so
    +        // repeat detach several times.
    +        Globals.instance().objectFactory().retryExecutor(IOException.class).setExecutable(context -> {
    +
    +            List cmdline = new ArrayList<>();
    +            cmdline.add("detach");
    +
    +            if (context.isLastAttempt()) {
    +                // The last attempt, force detach.
    +                cmdline.add("-force");
    +            }
    +
    +            cmdline.addAll(List.of(
    +                    hdiUtilVerbosityFlag(),
    +                    normalizedAbsolutePathString(mountedVolume)
    +            ));
    +
    +            // The image can get detached even if we get a resource busy error,
    +            // so execute the detach command without checking the exit code.
    +            var result = hdiutil(cmdline.toArray(String[]::new)).execute();
    +
    +            if (result.getExitCode() == 0 || !Files.exists(mountedVolume)) {
    +                // Detached successfully!
    +                return null;
    +            } else {
    +                throw result.unexpected();
    +            }
    +        }).setMaxAttemptsCount(10).setAttemptTimeout(6, TimeUnit.SECONDS).execute();
    +    }
    +
    +    private void convertProtoDmg() throws IOException {
    +
    +        Function convert = srcDmg -> {
    +            return hdiutil(
    +                    "convert",
    +                    normalizedAbsolutePathString(srcDmg),
    +                    hdiUtilVerbosityFlag(),
    +                    "-format", "UDZO",
    +                    "-o", normalizedAbsolutePathString(finalDmg()));
    +        };
    +
    +        // Convert it to a new image.
    +        try {
    +            convert.apply(protoDmg()).retry()
    +                .setMaxAttemptsCount(10)
    +                .setAttemptTimeout(3, TimeUnit.SECONDS)
    +                .execute();
    +        } catch (IOException ex) {
    +            Log.verbose(ex);
    +            // Something holds the file, try to convert a copy.
    +            Path copyDmg = protoCopyDmg();
    +            Files.copy(protoDmg(), copyDmg);
    +            try {
    +                convert.apply(copyDmg).executeExpectSuccess();
    +            } finally {
    +                Files.deleteIfExists(copyDmg);
    +            }
    +        }
         }
     
         // Background image name in resources
         private static final String DEFAULT_BACKGROUND_IMAGE = "background_dmg.tiff";
         private static final String DEFAULT_DMG_SETUP_SCRIPT = "DMGsetup.scpt";
         private static final String TEMPLATE_BUNDLE_ICON = "JavaApp.icns";
    -
    -    private static final String DEFAULT_LICENSE_PLIST="lic_template.plist";
     }
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgSystemEnvironment.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgSystemEnvironment.java
    index 54eb0c6f4fe..12d105b99b5 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgSystemEnvironment.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgSystemEnvironment.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
    @@ -25,10 +25,11 @@
     package jdk.jpackage.internal;
     
     import java.io.IOException;
    -import java.nio.file.Files;
     import java.nio.file.Path;
    +import java.util.List;
     import java.util.Objects;
     import java.util.Optional;
    +import java.util.stream.Collectors;
     import java.util.stream.Stream;
     import jdk.jpackage.internal.util.Result;
     
    @@ -54,41 +55,31 @@ record MacDmgSystemEnvironment(Path hdiutil, Path osascript, Optional setF
         // Location of SetFile utility may be different depending on MacOS version
         // We look for several known places and if none of them work will
         // try to find it
    -    private static Optional findSetFileUtility() {
    -        String typicalPaths[] = {"/Developer/Tools/SetFile",
    -                "/usr/bin/SetFile", "/Developer/usr/bin/SetFile"};
    +    static Optional findSetFileUtility() {
    +        return SETFILE_KNOWN_PATHS.stream().filter(setFilePath -> {
    +            // Validate SetFile, if Xcode is not installed it will run, but exit with error code
    +            return Result.of(
    +                    Executor.of(setFilePath.toString(), "-h").setQuiet(true)::executeExpectSuccess,
    +                    IOException.class).hasValue();
    +        }).findFirst().or(() -> {
    +            // generic find attempt
    +            final var executor = Executor.of("/usr/bin/xcrun", "-find", "SetFile").setQuiet(true).saveFirstLineOfOutput();
     
    -        final var setFilePath = Stream.of(typicalPaths).map(Path::of).filter(Files::isExecutable).findFirst();
    -        if (setFilePath.isPresent()) {
    -            // Validate SetFile, if Xcode is not installed it will run, but exit with error
    -            // code
    -            try {
    -                if (Executor.of(setFilePath.orElseThrow().toString(), "-h").setQuiet(true).execute() == 0) {
    -                    return setFilePath;
    -                }
    -            } catch (Exception ignored) {
    -                // No need for generic find attempt. We found it, but it does not work.
    -                // Probably due to missing xcode.
    -                return Optional.empty();
    -            }
    -        }
    -
    -        // generic find attempt
    -        try {
    -            final var executor = Executor.of("/usr/bin/xcrun", "-find", "SetFile");
    -            final var code = executor.setQuiet(true).saveOutput(true).execute();
    -            if (code == 0 && !executor.getOutput().isEmpty()) {
    -                final var firstLine = executor.getOutput().getFirst();
    -                Path f = Path.of(firstLine);
    -                if (new ToolValidator(f).checkExistsOnly().validate() == null) {
    -                    return Optional.of(f.toAbsolutePath());
    -                }
    -            }
    -        } catch (IOException ignored) {}
    -
    -        return Optional.empty();
    +            return Result.of(executor::executeExpectSuccess, IOException.class).flatMap(execResult -> {
    +                return Result.of(() -> {
    +                    return execResult.stdout().stream().findFirst().map(Path::of).orElseThrow(execResult::unexpected);
    +                }, Exception.class);
    +            }).value().filter(v -> {
    +                return new ToolValidator(v).checkExistsOnly().validate() == null;
    +            }).map(Path::toAbsolutePath);
    +        });
         }
     
    +    static final List SETFILE_KNOWN_PATHS = Stream.of(
    +            "/Developer/Tools/SetFile",
    +            "/usr/bin/SetFile",
    +            "/Developer/usr/bin/SetFile").map(Path::of).collect(Collectors.toUnmodifiableList());
    +
         private static final Path HDIUTIL = Path.of("/usr/bin/hdiutil");
         private static final Path OSASCRIPT = Path.of("/usr/bin/osascript");
     }
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java
    index 074014dede0..f3c1765210f 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.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,8 +30,8 @@ import static jdk.jpackage.internal.MacPackagingPipeline.APPLICATION_LAYOUT;
     import static jdk.jpackage.internal.MacRuntimeValidator.validateRuntimeHasJliLib;
     import static jdk.jpackage.internal.MacRuntimeValidator.validateRuntimeHasNoBinDir;
     import static jdk.jpackage.internal.cli.StandardBundlingOperation.SIGN_MAC_APP_IMAGE;
    -import static jdk.jpackage.internal.cli.StandardOption.ICON;
     import static jdk.jpackage.internal.cli.StandardOption.APPCLASS;
    +import static jdk.jpackage.internal.cli.StandardOption.ICON;
     import static jdk.jpackage.internal.cli.StandardOption.MAC_APP_CATEGORY;
     import static jdk.jpackage.internal.cli.StandardOption.MAC_APP_IMAGE_SIGN_IDENTITY;
     import static jdk.jpackage.internal.cli.StandardOption.MAC_APP_STORE;
    @@ -49,14 +49,17 @@ import static jdk.jpackage.internal.cli.StandardOption.PREDEFINED_RUNTIME_IMAGE;
     import static jdk.jpackage.internal.model.MacPackage.RUNTIME_BUNDLE_LAYOUT;
     import static jdk.jpackage.internal.model.StandardPackageType.MAC_DMG;
     import static jdk.jpackage.internal.model.StandardPackageType.MAC_PKG;
    -import static jdk.jpackage.internal.util.function.ExceptionBox.rethrowUnchecked;
    +import static jdk.jpackage.internal.util.function.ExceptionBox.toUnchecked;
     
     import java.nio.file.Path;
    +import java.util.Collection;
    +import java.util.List;
     import java.util.Objects;
     import java.util.Optional;
     import jdk.jpackage.internal.ApplicationBuilder.MainLauncherStartupInfo;
     import jdk.jpackage.internal.SigningIdentityBuilder.ExpiredCertificateException;
     import jdk.jpackage.internal.SigningIdentityBuilder.StandardCertificateSelector;
    +import jdk.jpackage.internal.cli.OptionValue;
     import jdk.jpackage.internal.cli.Options;
     import jdk.jpackage.internal.cli.StandardFaOption;
     import jdk.jpackage.internal.model.ApplicationLaunchers;
    @@ -71,7 +74,9 @@ import jdk.jpackage.internal.model.MacPackage;
     import jdk.jpackage.internal.model.MacPkgPackage;
     import jdk.jpackage.internal.model.PackageType;
     import jdk.jpackage.internal.model.RuntimeLayout;
    +import jdk.jpackage.internal.util.MacBundle;
     import jdk.jpackage.internal.util.Result;
    +import jdk.jpackage.internal.util.RootedPath;
     import jdk.jpackage.internal.util.function.ExceptionBox;
     
     
    @@ -89,7 +94,14 @@ final class MacFromOptions {
     
             final var pkgBuilder = new MacDmgPackageBuilder(superPkgBuilder);
     
    -        MAC_DMG_CONTENT.ifPresentIn(options, pkgBuilder::dmgContent);
    +        MAC_DMG_CONTENT.findIn(options).map((List> v) -> {
    +            // Reverse the order of content sources.
    +            // If there are multiple source files for the same
    +            // destination file, only the first will be used.
    +            // Reversing the order of content sources makes it use the last file
    +            // from the original list of source files for the given destination file.
    +            return v.reversed().stream().flatMap(Collection::stream).toList();
    +        }).ifPresent(pkgBuilder::dmgRootDirSources);
     
             return pkgBuilder.create();
         }
    @@ -106,7 +118,7 @@ final class MacFromOptions {
             final boolean sign = MAC_SIGN.findIn(options).orElse(false);
             final boolean appStore = MAC_APP_STORE.findIn(options).orElse(false);
     
    -        final var appResult = Result.create(() -> createMacApplicationInternal(options));
    +        final var appResult = Result.of(() -> createMacApplicationInternal(options));
     
             final Optional pkgBuilder;
             if (appResult.hasValue()) {
    @@ -146,18 +158,18 @@ final class MacFromOptions {
     
                     final var expiredAppCertException = appResult.firstError().orElseThrow();
     
    -                final var pkgSignConfigResult = Result.create(signingIdentityBuilder::create);
    +                final var pkgSignConfigResult = Result.of(signingIdentityBuilder::create);
                     try {
                         rethrowIfNotExpiredCertificateException(pkgSignConfigResult);
                         // The certificate for the package signing config is also expired!
                     } catch (RuntimeException ex) {
                         // Some error occurred trying to configure the signing config for the package.
                         // Ignore it, bail out with the first error.
    -                    rethrowUnchecked(expiredAppCertException);
    +                    throw toUnchecked(expiredAppCertException);
                     }
     
                     Log.error(pkgSignConfigResult.firstError().orElseThrow().getMessage());
    -                rethrowUnchecked(expiredAppCertException);
    +                throw toUnchecked(expiredAppCertException);
                 }
             }
     
    @@ -276,16 +288,12 @@ final class MacFromOptions {
     
             final var builder = new MacPackageBuilder(createPackageBuilder(options, app.app(), type));
     
    -        app.externalApp()
    -                .map(ExternalApplication::extra)
    -                .flatMap(MAC_SIGN::findIn)
    -                .ifPresent(builder::predefinedAppImageSigned);
    -
    -        PREDEFINED_RUNTIME_IMAGE.findIn(options)
    -                .map(MacBundle::new)
    -                .filter(MacBundle::isValid)
    -                .map(MacBundle::isSigned)
    -                .ifPresent(builder::predefinedAppImageSigned);
    +        for (OptionValue ov : List.of(PREDEFINED_APP_IMAGE, PREDEFINED_RUNTIME_IMAGE)) {
    +            ov.findIn(options)
    +                    .flatMap(MacBundle::fromPath)
    +                    .map(MacPackagingPipeline::isSigned)
    +                    .ifPresent(builder::predefinedAppImageSigned);
    +        }
     
             return builder;
         }
    @@ -303,7 +311,7 @@ final class MacFromOptions {
                 }
             }
     
    -        rethrowUnchecked(ex);
    +        throw toUnchecked(ex);
         }
     
         private static SigningIdentityBuilder createSigningIdentityBuilder(Options options) {
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPackagingPipeline.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPackagingPipeline.java
    index 53f297282ba..4e63f6db178 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPackagingPipeline.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPackagingPipeline.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
    @@ -76,6 +76,8 @@ import jdk.jpackage.internal.model.MacPackage;
     import jdk.jpackage.internal.model.Package;
     import jdk.jpackage.internal.model.PackageType;
     import jdk.jpackage.internal.util.FileUtils;
    +import jdk.jpackage.internal.util.MacBundle;
    +import jdk.jpackage.internal.util.PListReader;
     import jdk.jpackage.internal.util.PathUtils;
     import jdk.jpackage.internal.util.function.ThrowingConsumer;
     
    @@ -178,13 +180,10 @@ final class MacPackagingPipeline {
                     builder.task(MacCopyAppImageTaskID.COPY_RUNTIME_JLILIB)
                             .appImageAction(MacPackagingPipeline::copyJliLib).add();
     
    -                final var predefinedRuntimeBundle = Optional.of(
    -                        new MacBundle(p.predefinedAppImage().orElseThrow())).filter(MacBundle::isValid);
    -
                     // Don't create ".package" file.
                     disabledTasks.add(MacCopyAppImageTaskID.COPY_PACKAGE_FILE);
     
    -                if (predefinedRuntimeBundle.isPresent()) {
    +                if (MacBundle.fromPath(p.predefinedAppImage().orElseThrow()).isPresent()) {
                         // The input runtime image is a macOS bundle.
                         // Disable all alterations of the input bundle, but keep the signing enabled.
                         disabledTasks.addAll(List.of(MacCopyAppImageTaskID.values()));
    @@ -195,7 +194,7 @@ final class MacPackagingPipeline {
                                 .appImageAction(MacPackagingPipeline::writeRuntimeInfoPlist).add();
                     }
     
    -                if (predefinedRuntimeBundle.map(MacBundle::isSigned).orElse(false) && !((MacPackage)p).app().sign()) {
    +                if (((MacPackage)p).predefinedAppImageSigned().orElse(false) && !((MacPackage)p).app().sign()) {
                         // The input runtime is a signed bundle; explicit signing is not requested for the package.
                         // Disable the signing, i.e. don't re-sign the input bundle.
                         disabledTasks.add(MacCopyAppImageTaskID.COPY_SIGN);
    @@ -218,6 +217,11 @@ final class MacPackagingPipeline {
     
         enum SignAppImagePackageType implements PackageType {
             VALUE;
    +
    +        @Override
    +        public String label() {
    +            throw new UnsupportedOperationException();
    +        }
         }
     
         static Package createSignAppImagePackage(MacApplication app, BuildEnv env) {
    @@ -279,6 +283,30 @@ final class MacPackagingPipeline {
             }
         }
     
    +    static boolean isSigned(MacBundle bundle) {
    +
    +        var result = toSupplier(Executor.of(
    +                "/usr/sbin/spctl",
    +                "-vv",
    +                "--raw",
    +                "--assess",
    +                "--type", "exec",
    +                bundle.root().toString()).setQuiet(true).saveOutput(true).binaryOutput()::execute).get();
    +
    +        switch (result.getExitCode()) {
    +            case 0, 3 -> {
    +                // These exit codes are accompanied with valid plist xml.
    +                return toSupplier(() -> {
    +                    return new PListReader(result.byteStdout()).findValue("assessment:originator").isPresent();
    +                }).get();
    +            }
    +            default -> {
    +                // Likely to be an "a sealed resource is missing or invalid" error.
    +                return false;
    +            }
    +        }
    +    }
    +
         private static void copyAppImage(MacPackage pkg, AppImageLayout srcAppImage,
                 AppImageLayout dstAppImage) throws IOException {
     
    @@ -286,7 +314,7 @@ final class MacPackagingPipeline {
     
             final Optional srcMacBundle;
             if (pkg.isRuntimeInstaller()) {
    -            srcMacBundle = MacBundle.fromAppImageLayout(srcAppImage);
    +            srcMacBundle = macBundleFromAppImageLayout(srcAppImage);
             } else {
                 srcMacBundle = Optional.empty();
             }
    @@ -297,7 +325,7 @@ final class MacPackagingPipeline {
                 try {
                     FileUtils.copyRecursive(
                             inputBundle.root(),
    -                        MacBundle.fromAppImageLayout(dstAppImage).orElseThrow().root(),
    +                        macBundleFromAppImageLayout(dstAppImage).orElseThrow().root(),
                             LinkOption.NOFOLLOW_LINKS);
                 } catch (IOException ex) {
                     throw new UncheckedIOException(ex);
    @@ -415,7 +443,7 @@ final class MacPackagingPipeline {
     
             final var app = env.app();
     
    -        final var infoPlistFile = MacBundle.fromAppImageLayout(env.resolvedLayout()).orElseThrow().infoPlistFile();
    +        final var infoPlistFile = macBundleFromAppImageLayout(env.resolvedLayout()).orElseThrow().infoPlistFile();
     
             Log.verbose(I18N.format("message.preparing-info-plist", PathUtils.normalizedAbsolutePathString(infoPlistFile)));
     
    @@ -468,7 +496,7 @@ final class MacPackagingPipeline {
             }
     
             final Runnable signAction = () -> {
    -            AppImageSigner.createSigner(app, codesignConfigBuilder.create()).accept(MacBundle.fromAppImageLayout(env.resolvedLayout()).orElseThrow());
    +            AppImageSigner.createSigner(app, codesignConfigBuilder.create()).accept(macBundleFromAppImageLayout(env.resolvedLayout()).orElseThrow());
             };
     
             app.signingConfig().flatMap(AppImageSigningConfig::keychain).map(Keychain::new).ifPresentOrElse(keychain -> {
    @@ -550,7 +578,7 @@ final class MacPackagingPipeline {
     
         private static MacBundle runtimeBundle(AppImageBuildEnv env) {
             if (env.app().isRuntime()) {
    -            return MacBundle.fromAppImageLayout(env.resolvedLayout()).orElseThrow();
    +            return macBundleFromAppImageLayout(env.resolvedLayout()).orElseThrow();
             } else {
                 return new MacBundle(((MacApplicationLayout)env.resolvedLayout()).runtimeRootDirectory());
             }
    @@ -595,6 +623,22 @@ final class MacPackagingPipeline {
             };
         }
     
    +    private static Optional macBundleFromAppImageLayout(AppImageLayout layout) {
    +        final var root = layout.rootDirectory();
    +        final var bundleSubdir = root.relativize(layout.runtimeDirectory());
    +        final var contentsDirname = Path.of("Contents");
    +        var bundleRoot = root;
    +        for (int i = 0; i != bundleSubdir.getNameCount(); i++) {
    +            var nameComponent = bundleSubdir.getName(i);
    +            if (contentsDirname.equals(nameComponent)) {
    +                return Optional.of(new MacBundle(bundleRoot));
    +            } else {
    +                bundleRoot = bundleRoot.resolve(nameComponent);
    +            }
    +        }
    +        return Optional.empty();
    +    }
    +
     
         private record TaskContextProxy(TaskContext delegate, boolean forApp, boolean copyAppImage) implements TaskContext {
     
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgInstallerScripts.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgInstallerScripts.java
    index ecd3d19ac17..d0313af1efa 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgInstallerScripts.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgInstallerScripts.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
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackager.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackager.java
    index 127b3232661..fc5c85c699c 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackager.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackager.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
    @@ -32,7 +32,6 @@ import java.io.IOException;
     import java.io.UncheckedIOException;
     import java.net.URI;
     import java.net.URISyntaxException;
    -import java.nio.file.DirectoryStream;
     import java.nio.file.Files;
     import java.nio.file.Path;
     import java.text.MessageFormat;
    @@ -57,6 +56,7 @@ import jdk.jpackage.internal.PackagingPipeline.PackageTaskID;
     import jdk.jpackage.internal.PackagingPipeline.TaskID;
     import jdk.jpackage.internal.model.MacPkgPackage;
     import jdk.jpackage.internal.resources.ResourceLocator;
    +import jdk.jpackage.internal.util.Enquoter;
     import jdk.jpackage.internal.util.XmlUtils;
     import org.xml.sax.SAXException;
     
    @@ -108,7 +108,7 @@ record MacPkgPackager(BuildEnv env, MacPkgPackage pkg, Optional servic
                 cmdline.addAll(allPkgbuildArgs());
                 try {
                     Files.createDirectories(path.getParent());
    -                IOUtils.exec(new ProcessBuilder(cmdline), false, null, true, Executor.INFINITE_TIMEOUT);
    +                Executor.of(cmdline).executeExpectSuccess();
                 } catch (IOException ex) {
                     throw new UncheckedIOException(ex);
                 }
    @@ -215,7 +215,6 @@ record MacPkgPackager(BuildEnv env, MacPkgPackage pkg, Optional servic
         @Override
         public void accept(PackagingPipeline.Builder pipelineBuilder) {
             pipelineBuilder
    -                .excludeDirFromCopying(outputDir)
                     .task(PkgPackageTaskID.PREPARE_MAIN_SCRIPTS)
                             .action(this::prepareMainScripts)
                             .addDependent(PackageTaskID.RUN_POST_IMAGE_USER_SCRIPT)
    @@ -487,15 +486,13 @@ record MacPkgPackager(BuildEnv env, MacPkgPackage pkg, Optional servic
     
             Files.createDirectories(cpl.getParent());
     
    -        final var pb = new ProcessBuilder("/usr/bin/pkgbuild",
    +        Executor.of("/usr/bin/pkgbuild",
                     "--root",
                     normalizedAbsolutePathString(env.appImageDir()),
                     "--install-location",
                     normalizedAbsolutePathString(installLocation()),
                     "--analyze",
    -                normalizedAbsolutePathString(cpl));
    -
    -        IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
    +                normalizedAbsolutePathString(cpl)).executeExpectSuccess();
     
             patchCPLFile(cpl);
         }
    @@ -544,8 +541,7 @@ record MacPkgPackager(BuildEnv env, MacPkgPackage pkg, Optional servic
             }
             commandLine.add(normalizedAbsolutePathString(finalPkg));
     
    -        final var pb = new ProcessBuilder(commandLine);
    -        IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
    +        Executor.of(commandLine).executeExpectSuccess();
         }
     
         private static Optional createServices(BuildEnv env, MacPkgPackage pkg) {
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java
    index 9a57ce1e697..0f753c07569 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.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
    @@ -40,6 +40,7 @@ import javax.naming.ldap.Rdn;
     import javax.security.auth.x500.X500Principal;
     import jdk.jpackage.internal.MacCertificateUtils.CertificateHash;
     import jdk.jpackage.internal.model.ConfigException;
    +import jdk.jpackage.internal.model.JPackageException;
     import jdk.jpackage.internal.model.SigningIdentity;
     
     final class SigningIdentityBuilder {
    @@ -147,10 +148,9 @@ final class SigningIdentityBuilder {
             Objects.requireNonNull(keychain);
             switch (certs.size()) {
                 case 0 -> {
    -                Log.error(I18N.format("error.cert.not.found", certificateSelector.signingIdentities().getFirst(),
    +                throw new JPackageException(I18N.format("error.cert.not.found",
    +                        certificateSelector.signingIdentities().getFirst(),
                             keychain.map(Keychain::name).orElse("")));
    -                throw I18N.buildConfigException("error.explicit-sign-no-cert")
    -                        .advice("error.explicit-sign-no-cert.advice").create();
                 }
                 case 1 -> {
                     return certs.getFirst();
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/TempKeychain.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/TempKeychain.java
    index 97709678c67..2f616aafba1 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/TempKeychain.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/TempKeychain.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
    @@ -27,15 +27,17 @@ package jdk.jpackage.internal;
     
     import java.io.Closeable;
     import java.io.IOException;
    +import java.io.UncheckedIOException;
     import java.util.ArrayList;
     import java.util.List;
     import java.util.Objects;
    +import java.util.function.Consumer;
     import jdk.internal.util.OSVersion;
    -import jdk.jpackage.internal.util.function.ThrowingConsumer;
     
     final class TempKeychain implements Closeable {
     
    -    static void withKeychains(ThrowingConsumer> keychainConsumer, List keychains) throws Throwable {
    +    static void withKeychains(Consumer> keychainConsumer, List keychains) {
    +
             keychains.forEach(Objects::requireNonNull);
             if (keychains.isEmpty() || OSVersion.current().compareTo(new OSVersion(10, 12)) < 0) {
                 keychainConsumer.accept(keychains);
    @@ -43,11 +45,14 @@ final class TempKeychain implements Closeable {
                 // we need this for OS X 10.12+
                 try (var tempKeychain = new TempKeychain(keychains)) {
                     keychainConsumer.accept(tempKeychain.keychains);
    +            } catch (IOException ex) {
    +                throw new UncheckedIOException(ex);
                 }
             }
         }
     
    -    static void withKeychain(ThrowingConsumer keychainConsumer, Keychain keychain) throws Throwable {
    +    static void withKeychain(Consumer keychainConsumer, Keychain keychain) {
    +
             Objects.requireNonNull(keychainConsumer);
             withKeychains(keychains -> {
                 keychainConsumer.accept(keychains.getFirst());
    @@ -78,7 +83,7 @@ final class TempKeychain implements Closeable {
     
                 args.addAll(missingKeychains.stream().map(Keychain::asCliArg).toList());
     
    -            Executor.of(args.toArray(String[]::new)).executeExpectSuccess();
    +            Executor.of(args).executeExpectSuccess();
             }
         }
     
    @@ -89,7 +94,7 @@ final class TempKeychain implements Closeable {
         @Override
         public void close() throws IOException {
             if (!restoreKeychainsCmd.isEmpty()) {
    -            Executor.of(restoreKeychainsCmd.toArray(String[]::new)).executeExpectSuccess();
    +            Executor.of(restoreKeychainsCmd).executeExpectSuccess();
             }
         }
     
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/model/MacApplication.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/model/MacApplication.java
    index cfe10e8a012..e2b3d30b7ae 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/model/MacApplication.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/model/MacApplication.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
    @@ -28,7 +28,6 @@ import static java.util.stream.Collectors.joining;
     import static java.util.stream.Collectors.toUnmodifiableMap;
     import static jdk.jpackage.internal.cli.StandardAppImageFileOption.MAC_APP_STORE;
     import static jdk.jpackage.internal.cli.StandardAppImageFileOption.MAC_MAIN_CLASS;
    -import static jdk.jpackage.internal.cli.StandardAppImageFileOption.MAC_SIGNED;
     
     import java.nio.file.Path;
     import java.util.Map;
    @@ -96,9 +95,6 @@ public interface MacApplication extends Application, MacApplicationMixin {
         }
     
         public enum ExtraAppImageFileField {
    -        SIGNED(MAC_SIGNED, app -> {
    -            return Optional.of(Boolean.toString(app.sign()));
    -        }),
             APP_STORE(MAC_APP_STORE, app -> {
                 return Optional.of(Boolean.toString(app.appStore()));
             }),
    diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/model/MacDmgPackageMixin.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/model/MacDmgPackageMixin.java
    index 0b502e7ce7e..08797b11509 100644
    --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/model/MacDmgPackageMixin.java
    +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/model/MacDmgPackageMixin.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
    @@ -25,22 +25,23 @@
     package jdk.jpackage.internal.model;
     
     import java.nio.file.Path;
    -import java.util.List;
    +import java.util.Collection;
     import java.util.Optional;
    +import jdk.jpackage.internal.util.RootedPath;
     
     public interface MacDmgPackageMixin {
     
         Optional icon();
     
         /**
    -     * Returns additional top=level content for DMG package.
    +     * Returns the source paths that should be copied into the top-level directory of a DMG package.
          * 

    * Each item in the list can be a directory or a file. * - * @return the additional top=level content for DMG package + * @return the source paths of additional top-level content for DMG package */ - List content(); + Collection dmgRootDirSources(); - record Stub(Optional icon, List content) implements MacDmgPackageMixin { + record Stub(Optional icon, Collection dmgRootDirSources) implements MacDmgPackageMixin { } } diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties index d01297aa814..e1b154c5933 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties @@ -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 @@ -24,13 +24,10 @@ # # error.invalid-cfbundle-version.advice=Set a compatible 'app-version' value. Valid versions are one to three integers separated by dots. -error.explicit-sign-no-cert=Signature explicitly requested but no signing certificate found -error.explicit-sign-no-cert.advice=Specify a valid mac-signing-key-user-name and mac-signing-keychain error.certificate.expired=Certificate expired {0} error.cert.not.found=No certificate found matching [{0}] using keychain [{1}] error.multiple.certs.found=Multiple certificates matching name [{0}] found in keychain [{1}] error.app-image.mac-sign.required=--mac-sign option is required with predefined application image and with type [app-image] -error.tool.failed.with.output="{0}" failed with following output: error.invalid-runtime-image-missing-file=Runtime image "{0}" is missing "{1}" file error.invalid-runtime-image-bin-dir=Runtime image "{0}" should not contain "bin" folder error.invalid-runtime-image-bin-dir.advice=Use --strip-native-commands jlink option when generating runtime image used with {0} option @@ -59,18 +56,18 @@ message.version-string-first-number-not-zero=The first number in an app-version message.keychain.error=Unable to get keychain list. message.invalid-identifier=Invalid mac bundle identifier [{0}]. message.invalid-identifier.advice=specify identifier with "--mac-package-identifier". -message.building-dmg=Building DMG package for {0}. message.preparing-dmg-setup=Preparing dmg setup: {0}. -message.creating-dmg-file=Creating DMG file: {0}. -message.dmg-cannot-be-overwritten=Dmg file exists [{0}] and can not be removed. -message.output-to-location=Result DMG installer for {0}: {1}. -message.building-pkg=Building PKG package for {0}. message.preparing-scripts=Preparing package scripts. message.preparing-distribution-dist=Preparing distribution.dist: {0}. message.signing.pkg=Warning: For signing PKG, you might need to set "Always Trust" for your certificate using "Keychain Access" tool. message.setfile.dmg=Setting custom icon on DMG file skipped because 'SetFile' utility was not found. Installing Xcode with Command Line Tools should resolve this issue. message.codesign.failed.reason.app.content="codesign" failed and additional application content was supplied via the "--app-content" parameter. Probably the additional content broke the integrity of the application bundle and caused the failure. Ensure content supplied via the "--app-content" parameter does not break the integrity of the application bundle, or add it in the post-processing step. message.codesign.failed.reason.xcode.tools=Possible reason for "codesign" failure is missing Xcode with command line developer tools. Install Xcode with command line developer tools to see if it resolves the problem. +message.dmg.license.button.agree=Agree +message.dmg.license.button.disagree=Disagree +message.dmg.license.button.print=Print +message.dmg.license.button.save=Save... +message.dmg.license.message=If you agree with the terms of this license, press "Agree" to install the software. If you do not agree, press "Disagree". warning.unsigned.app.image=Warning: Using unsigned app-image to build signed {0}. warning.per.user.app.image.signed=Warning: Support for per-user configuration of the installed application will not be supported due to missing "{0}" in predefined signed application image. warning.non.standard.contents.sub.dir=Warning: The file name of the directory "{0}" specified for the --app-content option is not a standard subdirectory name in the "Contents" directory of the application bundle. The result application bundle may fail code signing and/or notarization. diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties index 7e36a260c3f..367f3216f85 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties @@ -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 @@ -23,24 +23,19 @@ # questions. # # - -app.bundler.name=Mac-Anwendungsimage -store.bundler.name=Mac App Store-fähiger Bundler -dmg.bundler.name=Mac-DMG-Package -pkg.bundler.name=Mac-PKG-Package - error.invalid-cfbundle-version.advice=Legen Sie einen kompatiblen Wert für "app-version" fest. Gültige Versionsnummern sind ein bis drei durch Punkte getrennte Ganzzahlen. error.explicit-sign-no-cert=Signatur wurde explizit angefordert, doch es wurde kein Signaturzertifikat gefunden error.explicit-sign-no-cert.advice=Geben Sie gültige Werte für mac-signing-key-user-name und mac-signing-keychain an -error.must-sign-app-store=Mac App Store-Apps müssen signiert werden. Die Signierung wurde von der Bundler-Konfiguration deaktiviert -error.must-sign-app-store.advice=Verwenden Sie die Option --mac-sign mit entsprechenden Werten für user-name und keychain -error.certificate.expired=Fehler: Zertifikat abgelaufen {0} +error.certificate.expired=Zertifikat abgelaufen {0} error.cert.not.found=Kein Zertifikat gefunden, das [{0}] mit Schlüsselbund [{1}] entspricht -error.multiple.certs.found=WARNUNG: Mehrere Zertifikate gefunden, die [{0}] mit Schlüsselbund [{1}] entsprechen. Es wird das erste Zertifikat verwendet -error.app-image.mac-sign.required=Fehler: Die Option "--mac-sign" ist mit einem vordefinierten Anwendungsimage und Typ [app-image] erforderlich -error.tool.failed.with.output=Fehler: "{0}" nicht erfolgreich mit folgender Ausgabe: -resource.bundle-config-file=Bundle-Konfigurationsdatei +error.multiple.certs.found=Mehrere Zertifikate mit Namen [{0}] in Schlüsselbund [{1}] gefunden +error.app-image.mac-sign.required=Die Option --mac-sign ist mit einem vordefinierten Anwendungsimage und Typ [app-image] erforderlich +error.tool.failed.with.output="{0}" war mit folgender Ausgabe nicht erfolgreich: +error.invalid-runtime-image-missing-file=Im Laufzeitimage "{0}" fehlt die Datei "{1}" +error.invalid-runtime-image-bin-dir=Laufzeitimage "{0}" darf keinen Ordner "bin" enthalten +error.invalid-runtime-image-bin-dir.advice=Verwenden Sie die jlink-Option --strip-native-commands, wenn das Laufzeitimage mit Option {0} generiert wird resource.app-info-plist=Info.plist der Anwendung +resource.app-runtime-info-plist=Eingebettete Info.plist von Java Runtime resource.runtime-info-plist=Info.plist von Java Runtime resource.entitlements=Mac-Berechtigungen resource.dmg-setup-script=DMG-Setupskript @@ -56,21 +51,15 @@ resource.pkg-background-image=PKG-Hintergrundbild resource.pkg-pdf=Projektdefinitionsdatei resource.launchd-plist-file=launchd-PLIST-Datei - message.bundle-name-too-long-warning={0} ist auf "{1}" gesetzt. Dies ist länger als 16 Zeichen. Kürzen Sie den Wert, um die Mac-Nutzungserfahrung zu verbessern. message.preparing-info-plist=Info.plist wird vorbereitet: {0}. message.icon-not-icns= Das angegebene Symbol "{0}" ist keine ICNS-Datei und wird nicht verwendet. Stattdessen wird das Standardsymbol verwendet. message.version-string-too-many-components="app-version" darf ein bis drei Zahlen aufweisen: 1, 1.2, 1.2.3. message.version-string-first-number-not-zero=Die erste Zahl in app-version darf nicht null oder negativ sein. -message.creating-association-with-null-extension=Verknüpfung mit Nullerweiterung wird erstellt. -message.ignoring.symlink=Warnung: codesign überspringt den Symlink {0}. -message.already.signed=Datei ist bereits signiert: {0}. -message.keychain.error=Fehler: Schlüsselbundliste kann nicht abgerufen werden. -message.building-bundle=Mac App Store-Package für {0} wird erstellt. +message.keychain.error=Schlüsselbundliste kann nicht abgerufen werden. message.invalid-identifier=Ungültige Mac-Bundle-ID [{0}]. message.invalid-identifier.advice=Geben Sie die ID mit "--mac-package-identifier" an. message.building-dmg=DMG-Package für {0} wird erstellt. -message.running-script=Shellskript wird auf Anwendungsimage [{0}] ausgeführt. message.preparing-dmg-setup=DMG-Setup wird vorbereitet: {0}. message.creating-dmg-file=DMG-Datei wird erstellt: {0}. message.dmg-cannot-be-overwritten=DMG-Datei [{0}] ist vorhanden und kann nicht entfernt werden. @@ -82,5 +71,12 @@ message.signing.pkg=Warnung: Zum Signieren von PKG müssen Sie möglicherweise m message.setfile.dmg=Das Festlegen des benutzerdefinierten Symbols für die DMG-Datei wurde übersprungen, weil das Utility "SetFile" nicht gefunden wurde. Durch Installieren von Xcode mit Befehlszeilentools sollte dieses Problem behoben werden. message.codesign.failed.reason.app.content="codesign" war nicht erfolgreich, und zusätzlicher Anwendungsinhalt wurde über den Parameter "--app-content" angegeben. Wahrscheinlich hat der zusätzliche Inhalt die Integrität des Anwendungs-Bundles beeinträchtigt und den Fehler verursacht. Stellen Sie sicher, das der über den Parameter "--app-content" angegebene Inhalt nicht die Integrität des Anwendungs-Bundles beeinträchtigt, oder fügen Sie ihn im Nachverarbeitungsschritt hinzu. message.codesign.failed.reason.xcode.tools=Möglicher Grund für "codesign"-Fehler ist fehlender Xcode mit Befehlszeilen-Entwicklertools. Installieren Sie Xcode mit Befehlszeilen-Entwicklertools, und prüfen Sie, ob das Problem dadurch beseitigt wird. +message.dmg.license.button.agree=Akzeptieren +message.dmg.license.button.disagree=Ablehnen +message.dmg.license.button.print=Drucken +message.dmg.license.button.save=Sichern... +message.dmg.license.message=Klicken Sie in “Akzeptieren”, wenn Sie mit den Bestimmungen des Software-Lizenzvertrags einverstanden sind. Falls nicht, bitte “Ablehnen” anklicken. Sie können die Software nur installieren, wenn Sie “Akzeptieren” angeklickt haben. warning.unsigned.app.image=Warnung: Nicht signiertes app-image wird zum Erstellen von signiertem {0} verwendet. warning.per.user.app.image.signed=Warnung: Konfiguration der installierten Anwendung pro Benutzer wird nicht unterstützt, da "{0}" im vordefinierten signierten Anwendungsimage fehlt. +warning.non.standard.contents.sub.dir=Warnung: Der Dateiname des Verzeichnisses "{0}", das für die Option --app-content angegeben wurde, ist kein Standardunterverzeichnisname im Verzeichnis "Contents" des Anwendungs-Bundles. Möglicherweise verläuft die Codesignierung und/oder Notarisierung im Ergebnisanwendungs-Bundle nicht erfolgreich. +warning.app.content.is.not.dir=Warnung: Der Wert "{0}" der Option --app-content ist kein Verzeichnis. Möglicherweise verläuft die Codesignierung und/oder Notarisierung im Ergebnisanwendungs-Bundle nicht erfolgreich. diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties index 4384d6507f9..ba2497d30dd 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties @@ -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 @@ -23,24 +23,19 @@ # questions. # # - -app.bundler.name=Macアプリケーション・イメージ -store.bundler.name=Mac App Storeの準備完了バンドラ -dmg.bundler.name=Mac DMGパッケージ -pkg.bundler.name=Mac PKGパッケージ - error.invalid-cfbundle-version.advice=互換性のある'app-version'値を設定します。有効なバージョンは、ドットで区切られた1から3つの整数です。 error.explicit-sign-no-cert=署名が明示的に要求されましたが、署名証明書が見つかりません error.explicit-sign-no-cert.advice=有効なmac-signing-key-user-nameおよびmac-signing-keychainを指定してください -error.must-sign-app-store=Mac App Storeアプリケーションは署名されている必要がありますが、署名はバンドラ構成によって無効化されています -error.must-sign-app-store.advice=--mac-signオプションを適切なuser-nameおよびkeychain付きで使用してください -error.certificate.expired=エラー: 証明書は{0}に期限が切れました +error.certificate.expired=証明書が期限切れです{0} error.cert.not.found=キーチェーン[{1}]を使用する[{0}]と一致する証明書が見つかりません -error.multiple.certs.found=警告: キーチェーン[{1}]を使用する[{0}]と一致する複数の証明書が見つかりました。最初のものを使用します -error.app-image.mac-sign.required=エラー: --mac-signオプションは、事前定義済アプリケーション・イメージおよびタイプ[app-image]で必要です -error.tool.failed.with.output=エラー: "{0}"は次の出力で失敗しました: -resource.bundle-config-file=バンドル構成ファイル +error.multiple.certs.found=名前[{0}]に一致する複数の証明書がキーチェーン[{1}]で見つかりました +error.app-image.mac-sign.required=--mac-signオプションは、事前定義済アプリケーション・イメージおよびタイプ[app-image]で必要です +error.tool.failed.with.output="{0}"は次の出力で失敗しました: +error.invalid-runtime-image-missing-file=ランタイム・イメージ"{0}"に"{1}"ファイルがありません +error.invalid-runtime-image-bin-dir=ランタイム・イメージ"{0}"に"bin"フォルダを含めることはできません +error.invalid-runtime-image-bin-dir.advice={0}オプションとともに使用されるランタイム・イメージを生成する場合は、--strip-native-commands jlinkオプションを使用します resource.app-info-plist=アプリケーションのInfo.plist +resource.app-runtime-info-plist=埋込みJavaランタイムのInfo.plist resource.runtime-info-plist=JavaランタイムのInfo.plist resource.entitlements=Mac権限 resource.dmg-setup-script=DMG設定スクリプト @@ -56,21 +51,15 @@ resource.pkg-background-image=pkg背景イメージ resource.pkg-pdf=プロジェクト定義ファイル resource.launchd-plist-file=launchd plistファイル - message.bundle-name-too-long-warning={0}が16文字を超える''{1}''に設定されています。Macでの操作性をより良くするために短くすることを検討してください。 message.preparing-info-plist=Info.plistを準備しています: {0}。 message.icon-not-icns= 指定したアイコン"{0}"はICNSファイルではなく、使用されません。デフォルト・アイコンがその位置に使用されます。 message.version-string-too-many-components='app-version'には、1、1.2、1.2.3など1から3の数字を使用できます。 message.version-string-first-number-not-zero=pp-versionの最初の数字は、ゼロまたは負の値にできません。 -message.creating-association-with-null-extension=null拡張子との関連付けを作成しています。 -message.ignoring.symlink=警告: codesignがsymlink {0}をスキップしています -message.already.signed=ファイルはすでに署名されています: {0}。 -message.keychain.error=エラー: キーチェーン・リストを取得できません。 -message.building-bundle={0}のMac App Storeパッケージを作成しています。 +message.keychain.error=キーチェーン・リストを取得できません。 message.invalid-identifier=macバンドル識別子[{0}]が無効です。 message.invalid-identifier.advice="--mac-package-identifier"で識別子を指定してください。 message.building-dmg={0}のDMGパッケージを作成しています -message.running-script=アプリケーション・イメージ[{0}]でシェル・スクリプトを実行しています。 message.preparing-dmg-setup=dmgの設定を準備しています: {0} message.creating-dmg-file=DMGファイルを作成しています: {0} message.dmg-cannot-be-overwritten=Dmgファイルは存在し[{0}]、削除できません。 @@ -82,5 +71,12 @@ message.signing.pkg=警告: PKGへの署名の場合、「キーチェーン・ message.setfile.dmg='SetFile'ユーティリティが見つからないため、DMGファイルでのカスタム・アイコンの設定がスキップされました。Xcodeとコマンド・ライン・ツールをインストールすると、この問題は解決されます。 message.codesign.failed.reason.app.content="codesign"が失敗したため、追加のアプリケーション・コンテンツが、"--app-content"パラメータを介して提供されました。追加のコンテンツにより、アプリケーション・バンドルの整合性が損われ、失敗の原因になった可能性があります。"--app-content"パラメータを介して提供されたコンテンツによって、アプリケーション・バンドルの整合性が損われていないことを確認するか、処理後のステップで追加してください。 message.codesign.failed.reason.xcode.tools="codesign"失敗の考えられる理由は、Xcodeとコマンドライン・デベロッパ・ツールの欠落です。Xcodeとコマンドライン・デベロッパ・ツールをインストールして、問題が解決されるかを確認してください。 +message.dmg.license.button.agree=同意します +message.dmg.license.button.disagree=同意しません +message.dmg.license.button.print=印刷する +message.dmg.license.button.save=保存... +message.dmg.license.message=本ソフトウエア使用許諾契約の条件に同意される場合には、ソフトウエアをインストールするために「同意します」を押してください。 同意されない場合には、「同意しません」を押してください。 warning.unsigned.app.image=警告: 署名されていないapp-imageを使用して署名された{0}を作成します。 warning.per.user.app.image.signed=警告: 事前定義済の署名付きアプリケーション・イメージに"{0}"がないため、インストール済アプリケーションのユーザーごとの構成はサポートされません。 +warning.non.standard.contents.sub.dir=警告: --app-contentオプションに指定されたディレクトリ"{0}"のファイル名が、アプリケーション・バンドルの"Contents"ディレクトリ内の標準サブディレクトリ名ではありません。結果アプリケーション・バンドルは、コード署名および/または公証に失敗することがあります。 +warning.app.content.is.not.dir=警告: --app-contentオプションの値"{0}"はディレクトリではありません。結果アプリケーション・バンドルは、コード署名または公証(あるいはその両方)に失敗することがあります。 diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties index 09c6d77694a..f855a31caae 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties @@ -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 @@ -23,24 +23,19 @@ # questions. # # - -app.bundler.name=Mac 应用程序映像 -store.bundler.name=支持 Mac App Store 的打包程序 -dmg.bundler.name=Mac DMG 程序包 -pkg.bundler.name=Mac PKG 程序包 - error.invalid-cfbundle-version.advice=设置兼容的 'app-version' 值。有效版本包含一到三个用点分隔的整数。 error.explicit-sign-no-cert=已明确请求签名,但找不到签名证书 error.explicit-sign-no-cert.advice=指定有效的 mac-signing-key-user-name 和 mac-signing-keychain -error.must-sign-app-store=Mac App Store 应用程序必须签名, 而打包程序配置已禁用签名 -error.must-sign-app-store.advice=将 --mac-sign 选项用于适当的用户名和密钥链 -error.certificate.expired=错误: 证书已失效 {0} +error.certificate.expired=证书已到期 {0} error.cert.not.found=使用密钥链 [{1}] 找不到与 [{0}] 匹配的证书 -error.multiple.certs.found=警告:使用密钥链 [{1}] 找到多个与 [{0}] 匹配的证书,将使用第一个证书 -error.app-image.mac-sign.required=错误:预定义的应用程序映像和类型 [app image] 需要 --mac-sign 选项 -error.tool.failed.with.output=错误:"{0}" 失败,显示以下输出: -resource.bundle-config-file=包配置文件 +error.multiple.certs.found=在密钥链 [{1}] 中找到多个与名称 [{0}] 匹配的证书 +error.app-image.mac-sign.required=预定义的应用程序映像和类型 [app-image] 需要 --mac-sign 选项 +error.tool.failed.with.output="{0}" 失败,显示以下输出: +error.invalid-runtime-image-missing-file=运行时映像 "{0}" 缺少 "{1}" 文件 +error.invalid-runtime-image-bin-dir=运行时映像 "{0}" 不应包含 "bin" 文件夹 +error.invalid-runtime-image-bin-dir.advice=生成与 {0} 选项一起使用的运行时映像时,使用 --strip-native-commands jlink 选项 resource.app-info-plist=应用程序 Info.plist +resource.app-runtime-info-plist=嵌入式 Java 运行时 Info.plist resource.runtime-info-plist=Java 运行时 Info.plist resource.entitlements=Mac 权利 resource.dmg-setup-script=DMG 设置脚本 @@ -56,21 +51,15 @@ resource.pkg-background-image=pkg 背景图像 resource.pkg-pdf=项目定义文件 resource.launchd-plist-file=launchd plist 文件 - message.bundle-name-too-long-warning={0}已设置为 ''{1}'', 其长度超过了 16 个字符。为了获得更好的 Mac 体验, 请考虑将其缩短。 message.preparing-info-plist=正在准备 Info.plist: {0}。 message.icon-not-icns= 指定的图标 "{0}" 不是 ICNS 文件, 不会使用。将使用默认图标代替。 message.version-string-too-many-components='app-version' 可以包含 1 到 3 个数字:1、1.2、1.2.3。 message.version-string-first-number-not-zero=app-version 中的第一个数字不能为零或负数。 -message.creating-association-with-null-extension=正在使用空扩展名创建关联。 -message.ignoring.symlink=警告: codesign 正在跳过符号链接 {0}。 -message.already.signed=文件已签名:{0}。 -message.keychain.error=错误:无法获取密钥链列表。 -message.building-bundle=正在为 {0} 构建 Mac App Store 程序包。 -message.invalid-identifier=无效的 Mac 包标识符 [{0}]。 +message.keychain.error=无法获取密钥链列表。 +message.invalid-identifier=mac 包标识符 [{0}] 无效。 message.invalid-identifier.advice=请使用 "--mac-package-identifier" 指定标识符。 message.building-dmg=正在为 {0} 构建 DMG 程序包。 -message.running-script=正在应用程序映像 [{0}] 上运行 shell 脚本。 message.preparing-dmg-setup=正在准备 dmg 设置: {0}。 message.creating-dmg-file=正在创建 DMG 文件: {0}。 message.dmg-cannot-be-overwritten=Dmg 文件已存在 [{0}] 且无法删除。 @@ -82,5 +71,12 @@ message.signing.pkg=警告:要对 PKG 进行签名,可能需要使用“密 message.setfile.dmg=由于未找到 'SetFile' 实用程序,跳过了针对 DMG 文件设置定制图标的操作。安装带命令行工具的 Xcode 应能解决此问题。 message.codesign.failed.reason.app.content="codesign" 失败,并通过 "--app-content" 参数提供了附加应用程序内容。可能是附加内容破坏了应用程序包的完整性,导致了故障。请确保通过 "--app-content" 参数提供的内容不会破坏应用程序包的完整性,或者在后处理步骤中添加该内容。 message.codesign.failed.reason.xcode.tools="codesign" 失败可能是因为缺少带命令行开发人员工具的 Xcode。请安装带命令行开发人员工具的 Xcode,看看是否可以解决问题。 +message.dmg.license.button.agree=同意 +message.dmg.license.button.disagree=不同意 +message.dmg.license.button.print=打印 +message.dmg.license.button.save=存储... +message.dmg.license.message=如果您同意本许可协议的条款,请按“同意”来安装此软件。如果您不同意,请按“不同意”。 warning.unsigned.app.image=警告:使用未签名的 app-image 生成已签名的 {0}。 warning.per.user.app.image.signed=警告:由于预定义的已签名应用程序映像中缺少 "{0}",不支持对已安装应用程序的每用户配置提供支持。 +warning.non.standard.contents.sub.dir=警告:为 --app-content 选项指定的目录 "{0}" 的文件名不是应用程序包的 "Contents" 目录中的标准子目录名称。结果应用程序包可能会使代码签名和/或公证失败。 +warning.app.content.is.not.dir=警告:--app-content 选项的值 "{0}" 不是目录。结果应用程序包可能会使代码签名和/或公证失败。 diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/lic_template.plist b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/lic_template.plist index 072e7168fb7..ac1b32325e8 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/lic_template.plist +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/lic_template.plist @@ -8,7 +8,9 @@ Attributes 0x0000 Data - AAAAAgAAAAAAAAAAAAQAAA== + + AAAABAAAAAAAAAADAAEAAAAOAAIAAQA0AAMAAQ== + ID 5000 Name @@ -21,17 +23,22 @@ Attributes 0x0000 Data - AAYPRW5nbGlzaCBkZWZhdWx0BUFncmVlCERpc2FncmVlBVByaW50B1NhdmUuLi56SWYgeW91IGFncmVlIHdpdGggdGhlIHRlcm1zIG9mIHRoaXMgbGljZW5zZSwgY2xpY2sgIkFncmVlIiB0byBhY2Nlc3MgdGhlIHNvZnR3YXJlLiAgSWYgeW91IGRvIG5vdCBhZ3JlZSwgcHJlc3MgIkRpc2FncmVlLiI= + + STR_DATA_ENGLISH + ID 5000 + Name - English buttons + English (United States) Attributes 0x0000 Data - AAYHRGV1dHNjaAtBa3plcHRpZXJlbghBYmxlaG5lbgdEcnVja2VuClNpY2hlcm4uLi7nS2xpY2tlbiBTaWUgaW4g0kFremVwdGllcmVu0ywgd2VubiBTaWUgbWl0IGRlbiBCZXN0aW1tdW5nZW4gZGVzIFNvZnR3YXJlLUxpemVuenZlcnRyYWdzIGVpbnZlcnN0YW5kZW4gc2luZC4gRmFsbHMgbmljaHQsIGJpdHRlINJBYmxlaG5lbtMgYW5rbGlja2VuLiBTaWUga5pubmVuIGRpZSBTb2Z0d2FyZSBudXIgaW5zdGFsbGllcmVuLCB3ZW5uIFNpZSDSQWt6ZXB0aWVyZW7TIGFuZ2VrbGlja3QgaGFiZW4u + + STR_DATA_GERMAN + ID 5001 Name @@ -41,151 +48,25 @@ Attributes 0x0000 Data - AAYHRW5nbGlzaAVBZ3JlZQhEaXNhZ3JlZQVQcmludAdTYXZlLi4ue0lmIHlvdSBhZ3JlZSB3aXRoIHRoZSB0ZXJtcyBvZiB0aGlzIGxpY2Vuc2UsIHByZXNzICJBZ3JlZSIgdG8gaW5zdGFsbCB0aGUgc29mdHdhcmUuICBJZiB5b3UgZG8gbm90IGFncmVlLCBwcmVzcyAiRGlzYWdyZWUiLg== + + STR_DATA_JAPANESE + ID 5002 Name - English - - - Attributes - 0x0000 - Data - AAYHRXNwYZZvbAdBY2VwdGFyCk5vIGFjZXB0YXIISW1wcmltaXIKR3VhcmRhci4uLsBTaSBlc3SHIGRlIGFjdWVyZG8gY29uIGxvcyB0jnJtaW5vcyBkZSBlc3RhIGxpY2VuY2lhLCBwdWxzZSAiQWNlcHRhciIgcGFyYSBpbnN0YWxhciBlbCBzb2Z0d2FyZS4gRW4gZWwgc3VwdWVzdG8gZGUgcXVlIG5vIGVzdI4gZGUgYWN1ZXJkbyBjb24gbG9zIHSOcm1pbm9zIGRlIGVzdGEgbGljZW5jaWEsIHB1bHNlICJObyBhY2VwdGFyLiI= - ID - 5003 - Name - Spanish - - - Attributes - 0x0000 - Data - AAYIRnJhbo1haXMIQWNjZXB0ZXIHUmVmdXNlcghJbXByaW1lcg5FbnJlZ2lzdHJlci4uLrpTaSB2b3VzIGFjY2VwdGV6IGxlcyB0ZXJtZXMgZGUgbGEgcHKOc2VudGUgbGljZW5jZSwgY2xpcXVleiBzdXIgIkFjY2VwdGVyIiBhZmluIGQnaW5zdGFsbGVyIGxlIGxvZ2ljaWVsLiBTaSB2b3VzIG4nkHRlcyBwYXMgZCdhY2NvcmQgYXZlYyBsZXMgdGVybWVzIGRlIGxhIGxpY2VuY2UsIGNsaXF1ZXogc3VyICJSZWZ1c2VyIi4= - ID - 5004 - Name - French - - - Attributes - 0x0000 - Data - AAYISXRhbGlhbm8HQWNjZXR0bwdSaWZpdXRvBlN0YW1wYQtSZWdpc3RyYS4uLn9TZSBhY2NldHRpIGxlIGNvbmRpemlvbmkgZGkgcXVlc3RhIGxpY2VuemEsIGZhaSBjbGljIHN1ICJBY2NldHRvIiBwZXIgaW5zdGFsbGFyZSBpbCBzb2Z0d2FyZS4gQWx0cmltZW50aSBmYWkgY2xpYyBzdSAiUmlmaXV0byIu - ID - 5005 - Name - Italian - - - Attributes - 0x0000 - Data - AAYISmFwYW5lc2UKk6+I04K1gtyCtwyTr4jTgrWC3IK5gvEIiPON/IK3gukHlduRti4uLrSWe4Ncg3SDZ4NFg0eDQY5nl3CLlpH4jF+W8YLMj/CMj4LJk6+I04KzguqC6Y/qjYeCyYLNgUGDXIN0g2eDRYNHg0GC8INDg5ODWINngVuDi4K3gumCvYLfgsmBdZOviNOCtYLcgreBdoLwiZ+CtYLEgq2CvoKzgqKBQoFAk6+I04KzguqCyIKij+qNh4LJgs2BQYF1k6+I04K1gtyCuYLxgXaC8ImfgrWCxIKtgr6Cs4KigUI= - ID - 5006 - Name Japanese Attributes 0x0000 Data - AAYKTmVkZXJsYW5kcwJKYQNOZWUFUHJpbnQJQmV3YWFyLi4upEluZGllbiB1IGFra29vcmQgZ2FhdCBtZXQgZGUgdm9vcndhYXJkZW4gdmFuIGRlemUgbGljZW50aWUsIGt1bnQgdSBvcCAnSmEnIGtsaWtrZW4gb20gZGUgcHJvZ3JhbW1hdHV1ciB0ZSBpbnN0YWxsZXJlbi4gSW5kaWVuIHUgbmlldCBha2tvb3JkIGdhYXQsIGtsaWt0IHUgb3AgJ05lZScu + + STR_DATA_SIMPLIFIED_CHINESE + ID - 5007 + 5003 Name - Dutch - - - Attributes - 0x0000 - Data - AAYGU3ZlbnNrCEdvZGuKbm5zBkF2YppqcwhTa3JpdiB1dAhTcGFyYS4uLpNPbSBEdSBnb2Rrim5uZXIgbGljZW5zdmlsbGtvcmVuIGtsaWNrYSBwjCAiR29ka4pubnMiIGaaciBhdHQgaW5zdGFsbGVyYSBwcm9ncmFtcHJvZHVrdGVuLiBPbSBEdSBpbnRlIGdvZGuKbm5lciBsaWNlbnN2aWxsa29yZW4sIGtsaWNrYSBwjCAiQXZimmpzIi4= - ID - 5008 - Name - Swedish - - - Attributes - 0x0000 - Data - AAYRUG9ydHVndZBzLCBCcmFzaWwJQ29uY29yZGFyCURpc2NvcmRhcghJbXByaW1pcglTYWx2YXIuLi6MU2UgZXN0hyBkZSBhY29yZG8gY29tIG9zIHRlcm1vcyBkZXN0YSBsaWNlbo1hLCBwcmVzc2lvbmUgIkNvbmNvcmRhciIgcGFyYSBpbnN0YWxhciBvIHNvZnR3YXJlLiBTZSBui28gZXN0hyBkZSBhY29yZG8sIHByZXNzaW9uZSAiRGlzY29yZGFyIi4= - ID - 5009 - Name - Brazilian Portuguese - - - Attributes - 0x0000 - Data - AAYSU2ltcGxpZmllZCBDaGluZXNlBM2s0uIGsrvNrNLiBLTy06EGtOa0oqGtVMjnufvE+s2s0uKxvtDtv8nQrdLptcTM9b/uo6zH67C0obDNrNLiobHAtLCy17C0y8jtvP6ho8jnufvE+rK7zazS4qOsx+uwtKGwsrvNrNLiobGhow== - ID - 5010 - Name - Simplified Chinese - - - Attributes - 0x0000 - Data - AAYTVHJhZGl0aW9uYWwgQ2hpbmVzZQSmULdOBqSjplC3TgSmQ6ZMBsB4pnOhS1CmcKpHsXqmULdOpbuzXKVpw9K4zKq6sfi02qFBvdCr9qGnplC3TqGopUimd7jLs27F6aFDpnCqR6SjplC3TqFBvdCr9qGnpKOmULdOoaihQw== - ID - 5011 - Name - Traditional Chinese - - - Attributes - 0x0000 - Data - AAYFRGFuc2sERW5pZwVVZW5pZwdVZHNrcml2CkFya2l2ZXIuLi6YSHZpcyBkdSBhY2NlcHRlcmVyIGJldGluZ2Vsc2VybmUgaSBsaWNlbnNhZnRhbGVuLCBza2FsIGR1IGtsaWtrZSBwjCDSRW5pZ9MgZm9yIGF0IGluc3RhbGxlcmUgc29mdHdhcmVuLiBLbGlrIHCMINJVZW5pZ9MgZm9yIGF0IGFubnVsbGVyZSBpbnN0YWxsZXJpbmdlbi4= - ID - 5012 - Name - Danish - - - Attributes - 0x0000 - Data - AAYFU3VvbWkISHl2imtzeW4KRW4gaHl2imtzeQdUdWxvc3RhCVRhbGxlbm5hyW9IeXaKa3N5IGxpc2Vuc3Npc29waW11a3NlbiBlaGRvdCBvc29pdHRhbWFsbGEg1Uh5doprc3nVLiBKb3MgZXQgaHl2imtzeSBzb3BpbXVrc2VuIGVodG9qYSwgb3NvaXRhINVFbiBoeXaKa3N51S4= - ID - 5013 - Name - Finnish - - - Attributes - 0x0000 - Data - AAYRRnJhbo1haXMgY2FuYWRpZW4IQWNjZXB0ZXIHUmVmdXNlcghJbXByaW1lcg5FbnJlZ2lzdHJlci4uLrpTaSB2b3VzIGFjY2VwdGV6IGxlcyB0ZXJtZXMgZGUgbGEgcHKOc2VudGUgbGljZW5jZSwgY2xpcXVleiBzdXIgIkFjY2VwdGVyIiBhZmluIGQnaW5zdGFsbGVyIGxlIGxvZ2ljaWVsLiBTaSB2b3VzIG4nkHRlcyBwYXMgZCdhY2NvcmQgYXZlYyBsZXMgdGVybWVzIGRlIGxhIGxpY2VuY2UsIGNsaXF1ZXogc3VyICJSZWZ1c2VyIi4= - ID - 5014 - Name - French Canadian - - - Attributes - 0x0000 - Data - AAYGS29yZWFuBLW/wMcJtb/AxyC+yMfUBsfBuLDGrgfA+sDlLi4ufrvnv+sgsOi+4LytwMcgs7u/67+hILW/wMfHz7jpLCAitb/AxyIgtNzD37imILStt68gvNLHwcauv/6+7rimILyzxKHHz73KvcO/wC4gtb/Ax8fPwfYgvsq0wrTZuOksICK1v8DHIL7Ix9QiILTcw9+4piC0qbijvcq9w7/ALg== - ID - 5015 - Name - Korean - - - Attributes - 0x0000 - Data - AAYFTm9yc2sERW5pZwlJa2tlIGVuaWcIU2tyaXYgdXQKQXJraXZlci4uLqNIdmlzIERlIGVyIGVuaWcgaSBiZXN0ZW1tZWxzZW5lIGkgZGVubmUgbGlzZW5zYXZ0YWxlbiwga2xpa2tlciBEZSBwjCAiRW5pZyIta25hcHBlbiBmb3IgjCBpbnN0YWxsZXJlIHByb2dyYW12YXJlbi4gSHZpcyBEZSBpa2tlIGVyIGVuaWcsIGtsaWtrZXIgRGUgcIwgIklra2UgZW5pZyIu - ID - 5016 - Name - Norwegian + Chinese (Simplified) TEXT @@ -194,50 +75,49 @@ Attributes 0x0000 Data - APPLICATION_LICENSE_TEXT + + APPLICATION_LICENSE_TEXT + ID 5000 Name - English SLA + English (United States) SLA + + + Attributes + 0x0000 + Data + + APPLICATION_LICENSE_TEXT + + ID + 5001 + Name + German SLA - - TMPL - Attributes 0x0000 Data - E0RlZmF1bHQgTGFuZ3VhZ2UgSUREV1JEBUNvdW50T0NOVAQqKioqTFNUQwtzeXMgbGFuZyBJRERXUkQebG9jYWwgcmVzIElEIChvZmZzZXQgZnJvbSA1MDAwRFdSRBAyLWJ5dGUgbGFuZ3VhZ2U/RFdSRAQqKioqTFNURQ== + + APPLICATION_LICENSE_TEXT + ID - 128 + 5002 Name - LPic + Japanese SLA - - plst - - - Attributes - 0x0050 - Data - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - ID - 0 - Name - - - - styl - Attributes 0x0000 Data - AAMAAAAAAAwACQAUAAAAAAAAAAAAAAAAACcADAAJABQBAAAAAAAAAAAAAAAAKgAMAAkAFAAAAAAAAAAAAAA= + + APPLICATION_LICENSE_TEXT + ID - 5000 + 5003 Name - English SLA + Chinese (Simplified) SLA diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java index b6b4322302e..75ead9d08ad 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, 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 @@ -28,11 +28,12 @@ import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toUnmodifiableMap; import static java.util.stream.Collectors.toUnmodifiableSet; import static jdk.jpackage.internal.cli.StandardAppImageFileOption.APP_VERSION; -import static jdk.jpackage.internal.cli.StandardAppImageFileOption.LAUNCHER_AS_SERVICE; import static jdk.jpackage.internal.cli.StandardAppImageFileOption.DESCRIPTION; +import static jdk.jpackage.internal.cli.StandardAppImageFileOption.LAUNCHER_AS_SERVICE; import static jdk.jpackage.internal.cli.StandardAppImageFileOption.LAUNCHER_NAME; import static jdk.jpackage.internal.util.function.ThrowingFunction.toFunction; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.file.Files; import java.nio.file.NoSuchFileException; @@ -162,7 +163,23 @@ final class AppImageFile { final var relativeAppImageFilePath = appImageDir.relativize(appImageFilePath); try { - final Document doc = XmlUtils.initDocumentBuilder().parse(Files.newInputStream(appImageFilePath)); + // + // Use javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream). + // Don't use javax.xml.parsers.DocumentBuilder#parse(java.io.File) as this will introduce + // dependency on how the XML parser reports filesystem I/O errors. + // E.g.: the default JDK XML parser throws java.io.FileNotFoundException if the supplied + // directory is not found and throws org.xml.sax.SAXParseException if the supplied file is a directory. + // Another DOM XML parser (a different version of Xerces?) may behave differently. + // + // The use of javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) eliminates + // differences in how XML parsers handle file system I/O errors. + // Filesystem I/O is delegated to java.nio.file.Files#readAllBytes(java.nio.file.Path), + // XML parser deals with the byte stream in memory and the error handling code + // doesn't depend on how XML parser reports filesystem I/O errors because + // it reads data from memory, not from the filesystem. + // + final Document doc = XmlUtils.initDocumentBuilder().parse( + new ByteArrayInputStream(Files.readAllBytes(appImageFilePath))); final XPath xPath = XPathFactory.newInstance().newXPath(); @@ -198,7 +215,7 @@ final class AppImageFile { } catch (XPathExpressionException ex) { // This should never happen as XPath expressions should be correct - throw ExceptionBox.rethrowUnchecked(ex); + throw ExceptionBox.toUnchecked(ex); } catch (SAXException ex) { // Malformed input XML throw new JPackageException(I18N.format("error.malformed-app-image-file", relativeAppImageFilePath, appImageDir), ex); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationBuilder.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationBuilder.java index 6896668ffdc..9d5407524a8 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationBuilder.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationBuilder.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 @@ -27,6 +27,7 @@ package jdk.jpackage.internal; import static jdk.jpackage.internal.I18N.buildConfigException; import java.nio.file.Path; +import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Map; @@ -44,6 +45,7 @@ import jdk.jpackage.internal.model.LauncherIcon; import jdk.jpackage.internal.model.LauncherStartupInfo; import jdk.jpackage.internal.model.ResourceDirLauncherIcon; import jdk.jpackage.internal.model.RuntimeBuilder; +import jdk.jpackage.internal.util.RootedPath; final class ApplicationBuilder { @@ -65,8 +67,8 @@ final class ApplicationBuilder { Optional.ofNullable(version).orElseGet(DEFAULTS::version), Optional.ofNullable(vendor).orElseGet(DEFAULTS::vendor), Optional.ofNullable(copyright).orElseGet(DEFAULTS::copyright), - Optional.ofNullable(srcDir), - Optional.ofNullable(contentDirs).orElseGet(List::of), + Optional.ofNullable(appDirSources).orElseGet(List::of), + Optional.ofNullable(contentDirSources).orElseGet(List::of), appImageLayout, Optional.ofNullable(runtimeBuilder), launchersAsList, @@ -126,13 +128,13 @@ final class ApplicationBuilder { return this; } - ApplicationBuilder srcDir(Path v) { - srcDir = v; + ApplicationBuilder appDirSources(Collection v) { + appDirSources = v; return this; } - ApplicationBuilder contentDirs(List v) { - contentDirs = v; + ApplicationBuilder contentDirSources(Collection v) { + contentDirSources = v; return this; } @@ -246,8 +248,8 @@ final class ApplicationBuilder { app.version(), app.vendor(), app.copyright(), - app.srcDir(), - app.contentDirs(), + app.appDirSources(), + app.contentDirSources(), Objects.requireNonNull(appImageLayout), app.runtimeBuilder(), app.launchers(), @@ -294,9 +296,9 @@ final class ApplicationBuilder { private String version; private String vendor; private String copyright; - private Path srcDir; + private Collection appDirSources; private ExternalApplication externalApp; - private List contentDirs; + private Collection contentDirSources; private AppImageLayout appImageLayout; private RuntimeBuilder runtimeBuilder; private ApplicationLaunchers launchers; diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationImageUtils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationImageUtils.java index 3d2ffbfdc7c..5edc4d69c81 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationImageUtils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationImageUtils.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 @@ -25,19 +25,14 @@ package jdk.jpackage.internal; -import static jdk.jpackage.internal.util.function.ThrowingConsumer.toConsumer; - -import java.io.IOException; import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; import java.nio.file.StandardCopyOption; -import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Stream; import jdk.jpackage.internal.PackagingPipeline.ApplicationImageTaskAction; import jdk.jpackage.internal.model.Application; import jdk.jpackage.internal.model.ApplicationLayout; @@ -45,7 +40,7 @@ import jdk.jpackage.internal.model.CustomLauncherIcon; import jdk.jpackage.internal.model.DefaultLauncherIcon; import jdk.jpackage.internal.model.Launcher; import jdk.jpackage.internal.model.ResourceDirLauncherIcon; -import jdk.jpackage.internal.util.FileUtils; +import jdk.jpackage.internal.util.RootedPath; final class ApplicationImageUtils { @@ -86,21 +81,14 @@ final class ApplicationImageUtils { }; } - static ApplicationImageTaskAction createCopyContentAction(Supplier> excludeCopyDirs) { + static ApplicationImageTaskAction createCopyContentAction() { return env -> { - var excludeCandidates = Stream.concat( - excludeCopyDirs.get().stream(), - Stream.of(env.env().buildRoot(), env.env().appImageDir()) - ).map(Path::toAbsolutePath).toList(); - - env.app().srcDir().ifPresent(toConsumer(srcDir -> { - copyRecursive(srcDir, env.resolvedLayout().appDirectory(), excludeCandidates); - })); - - for (var srcDir : env.app().contentDirs()) { - copyRecursive(srcDir, - env.resolvedLayout().contentDirectory().resolve(srcDir.getFileName()), - excludeCandidates); + for (var e : List.of( + Map.entry(env.app().appDirSources(), env.resolvedLayout().appDirectory()), + Map.entry(env.app().contentDirSources(), env.resolvedLayout().contentDirectory()) + )) { + RootedPath.copy(e.getKey().stream(), e.getValue(), + StandardCopyOption.REPLACE_EXISTING, LinkOption.NOFOLLOW_LINKS); } }; } @@ -126,21 +114,4 @@ final class ApplicationImageUtils { } }; } - - private static void copyRecursive(Path srcDir, Path dstDir, List excludeDirs) throws IOException { - srcDir = srcDir.toAbsolutePath(); - - List excludes = new ArrayList<>(); - - for (var path : excludeDirs) { - if (Files.isDirectory(path)) { - if (path.startsWith(srcDir) && !Files.isSameFile(path, srcDir)) { - excludes.add(path); - } - } - } - - FileUtils.copyRecursive(srcDir, dstDir.toAbsolutePath(), excludes, - LinkOption.NOFOLLOW_LINKS, StandardCopyOption.REPLACE_EXISTING); - } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java index 9cb9fb5cba0..7958dcdef2d 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/CfgFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2025, 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 @@ -124,21 +124,19 @@ final class CfgFile { Files.write(cfgFile, (Iterable) lines::iterator); } - private record Referencies(Path appModsDirectory) { + private record Referencies(Path appModsDirectory, Path appDirectory) { Referencies { - if (!appModsDirectory.startsWith(appDirectory())) { + if (!appModsDirectory.startsWith(appDirectory)) { throw new IllegalArgumentException(); } } Referencies(ApplicationLayout appLayout) { - this(Path.of("$APPDIR").resolve(appLayout.appModsDirectory().getFileName())); + this(BASEDIR.resolve(appLayout.appModsDirectory().getFileName()), BASEDIR); } - Path appDirectory() { - return Path.of("$APPDIR"); - } + private static final Path BASEDIR = Path.of("$APPDIR"); } private final LauncherStartupInfo startupInfo; diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DefaultBundlingEnvironment.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DefaultBundlingEnvironment.java index 0bf7d6f41b2..331bde29d27 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DefaultBundlingEnvironment.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DefaultBundlingEnvironment.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 @@ -42,17 +42,15 @@ import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import jdk.internal.util.OperatingSystem; +import jdk.jpackage.internal.PackagingPipeline.PackageTaskID; import jdk.jpackage.internal.cli.CliBundlingEnvironment; import jdk.jpackage.internal.cli.Options; import jdk.jpackage.internal.cli.StandardBundlingOperation; -import jdk.jpackage.internal.model.AppImagePackageType; import jdk.jpackage.internal.model.Application; import jdk.jpackage.internal.model.BundlingOperationDescriptor; import jdk.jpackage.internal.model.JPackageException; import jdk.jpackage.internal.model.Package; -import jdk.jpackage.internal.model.PackageType; -import jdk.jpackage.internal.model.StandardPackageType; +import jdk.jpackage.internal.util.PathUtils; import jdk.jpackage.internal.util.Result; class DefaultBundlingEnvironment implements CliBundlingEnvironment { @@ -65,10 +63,10 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { Map>>> bundlers) { this.bundlers = bundlers.entrySet().stream().collect(toMap(Map.Entry::getKey, e -> { - return new CachingSupplier<>(e.getValue()); + return runOnce(e.getValue()); })); - this.defaultOperationSupplier = Objects.requireNonNull(defaultOperationSupplier).map(CachingSupplier::new); + this.defaultOperationSupplier = Objects.requireNonNull(defaultOperationSupplier).map(DefaultBundlingEnvironment::runOnce); } @@ -98,6 +96,11 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { return bundler(op, () -> Result.ofValue(bundler)); } + Builder mutate(Consumer mutator) { + mutator.accept(this); + return this; + } + private Supplier> defaultOperationSupplier; private final Map>>> bundlers = new HashMap<>(); } @@ -107,6 +110,10 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { return new Builder(); } + static Supplier runOnce(Supplier supplier) { + return new CachingSupplier<>(supplier); + } + static Supplier>> createBundlerSupplier( Supplier> sysEnvResultSupplier, BiConsumer bundler) { Objects.requireNonNull(sysEnvResultSupplier); @@ -125,7 +132,9 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { Objects.requireNonNull(app); Objects.requireNonNull(pipelineBuilder); - final var outputDir = OptionUtils.outputDir(options).resolve(app.appImageDirName()); + final var outputDir = PathUtils.normalizedAbsolutePath(OptionUtils.outputDir(options).resolve(app.appImageDirName())); + + Log.verbose(I18N.getString("message.create-app-image")); IOUtils.writableOutputDir(outputDir.getParent()); @@ -133,45 +142,51 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { .predefinedAppImageLayout(app.asApplicationLayout().orElseThrow()) .create(options, app); - Log.verbose(I18N.format("message.creating-app-bundle", outputDir.getFileName(), outputDir.toAbsolutePath().getParent())); - if (Files.exists(outputDir)) { - throw new JPackageException(I18N.format("error.root-exists", outputDir.toAbsolutePath())); + throw new JPackageException(I18N.format("error.root-exists", outputDir)); } - pipelineBuilder.excludeDirFromCopying(outputDir.getParent()) - .create().execute(BuildEnv.withAppImageDir(env, outputDir), app); + pipelineBuilder.create().execute(BuildEnv.withAppImageDir(env, outputDir), app); + + Log.verbose(I18N.getString("message.app-image-created")); } static void createNativePackage(Options options, - Function createPackage, + T pkg, BiFunction createBuildEnv, PackagingPipeline.Builder pipelineBuilder, Packager.PipelineBuilderMutatorFactory pipelineBuilderMutatorFactory) { Objects.requireNonNull(pipelineBuilder); - createNativePackage(options, createPackage, createBuildEnv, _ -> pipelineBuilder, pipelineBuilderMutatorFactory); + createNativePackage(options, pkg, createBuildEnv, _ -> pipelineBuilder, pipelineBuilderMutatorFactory); } static void createNativePackage(Options options, - Function createPackage, + T pkg, BiFunction createBuildEnv, Function createPipelineBuilder, Packager.PipelineBuilderMutatorFactory pipelineBuilderMutatorFactory) { Objects.requireNonNull(options); - Objects.requireNonNull(createPackage); + Objects.requireNonNull(pkg); Objects.requireNonNull(createBuildEnv); Objects.requireNonNull(createPipelineBuilder); Objects.requireNonNull(pipelineBuilderMutatorFactory); - var pkg = Objects.requireNonNull(createPackage.apply(options)); + var pipelineBuilder = Objects.requireNonNull(createPipelineBuilder.apply(pkg)); + + // Delete an old output package file (if any) before creating a new one. + pipelineBuilder.task(PackageTaskID.DELETE_OLD_PACKAGE_FILE) + .addDependencies(pipelineBuilder.taskGraphSnapshot().getTailsOf(PackageTaskID.CREATE_PACKAGE_FILE)) + .addDependent(PackageTaskID.CREATE_PACKAGE_FILE) + .packageAction(PackagingPipeline::deleteOutputBundle) + .add(); Packager.build().pkg(pkg) - .outputDir(OptionUtils.outputDir(options)) - .env(Objects.requireNonNull(createBuildEnv.apply(options, pkg))) - .pipelineBuilderMutatorFactory(pipelineBuilderMutatorFactory) - .execute(Objects.requireNonNull(createPipelineBuilder.apply(pkg))); + .outputDir(OptionUtils.outputDir(options)) + .env(Objects.requireNonNull(createBuildEnv.apply(options, pkg))) + .pipelineBuilderMutatorFactory(pipelineBuilderMutatorFactory) + .execute(pipelineBuilder); } @Override @@ -188,10 +203,6 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { permanentWorkDirectory = Optional.of(tempDir.path()); } bundler.accept(tempDir.options()); - - var packageType = OptionUtils.bundlingOperation(cmdline).packageType(); - - Log.verbose(I18N.format("message.bundle-created", I18N.getString(bundleTypeDescription(packageType, op.os())))); } catch (IOException ex) { throw new UncheckedIOException(ex); } finally { @@ -207,56 +218,9 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { } private Supplier>> getBundlerSupplier(BundlingOperationDescriptor op) { - return Optional.ofNullable(bundlers.get(op)).orElseThrow(NoSuchElementException::new); - } - - private String bundleTypeDescription(PackageType type, OperatingSystem os) { - switch (type) { - case StandardPackageType stdType -> { - switch (stdType) { - case WIN_MSI -> { - return "bundle-type.win-msi"; - } - case WIN_EXE -> { - return "bundle-type.win-exe"; - } - case LINUX_DEB -> { - return "bundle-type.linux-deb"; - } - case LINUX_RPM -> { - return "bundle-type.linux-rpm"; - } - case MAC_DMG -> { - return "bundle-type.mac-dmg"; - } - case MAC_PKG -> { - return "bundle-type.mac-pkg"; - } - default -> { - throw new AssertionError(); - } - } - } - case AppImagePackageType appImageType -> { - switch (os) { - case WINDOWS -> { - return "bundle-type.win-app"; - } - case LINUX -> { - return "bundle-type.linux-app"; - } - case MACOS -> { - return "bundle-type.mac-app"; - } - default -> { - throw new AssertionError(); - } - } - } - default -> { - throw new AssertionError(); - } - } + return Optional.ofNullable(bundlers.get(op)).orElseThrow(() -> { + throw new NoSuchElementException(String.format("Unsupported bundling operation: %s", op)); + }); } @@ -279,5 +243,5 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { private final Map>>> bundlers; - private final Optional>> defaultOperationSupplier; + private final Optional>> defaultOperationSupplier; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java index dd1cc4a24b4..53c587ab37c 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Executor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2024, 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,53 +25,154 @@ package jdk.jpackage.internal; import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.file.Files; -import java.nio.file.Path; +import java.io.PrintStream; +import java.io.StringReader; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import java.util.Objects; +import java.util.Optional; import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.function.Supplier; +import java.util.function.UnaryOperator; +import java.util.spi.ToolProvider; import java.util.stream.Stream; +import jdk.jpackage.internal.model.ExecutableAttributesWithCapturedOutput; +import jdk.jpackage.internal.util.CommandLineFormat; +import jdk.jpackage.internal.util.CommandOutputControl; +import jdk.jpackage.internal.util.CommandOutputControl.ProcessAttributes; +import jdk.jpackage.internal.util.CommandOutputControl.Result; +import jdk.jpackage.internal.util.RetryExecutor; +import jdk.jpackage.internal.util.function.ExceptionBox; -public final class Executor { +final class Executor { - Executor() { + static Executor of(String... cmdline) { + return of(List.of(cmdline)); } - Executor setOutputConsumer(Consumer> v) { - outputConsumer = v; - return this; + static Executor of(List cmdline) { + return of(new ProcessBuilder(cmdline)); + } + + static Executor of(ProcessBuilder pb) { + return Globals.instance().objectFactory().executor().processBuilder(pb); + } + + public Executor() { + commandOutputControl = new CommandOutputControl(); + args = new ArrayList<>(); + } + + private Executor(Executor other) { + commandOutputControl = other.commandOutputControl.copy(); + quietCommand = other.quietCommand; + args = new ArrayList<>(other.args); + processBuilder = other.processBuilder; + toolProvider = other.toolProvider; + timeout = other.timeout; + mapper = other.mapper; } Executor saveOutput(boolean v) { - saveOutput = v; + commandOutputControl.saveOutput(v); return this; } - Executor setWriteOutputToFile(boolean v) { - writeOutputToFile = v; + Executor saveOutput() { + return saveOutput(true); + } + + Executor saveFirstLineOfOutput() { + commandOutputControl.saveFirstLineOfOutput(); return this; } - Executor setTimeout(long v) { + Executor charset(Charset v) { + commandOutputControl.charset(v); + return this; + } + + Executor storeOutputInFiles(boolean v) { + commandOutputControl.storeOutputInFiles(v); + return this; + } + + Executor storeOutputInFiles() { + return storeOutputInFiles(true); + } + + Executor binaryOutput(boolean v) { + commandOutputControl.binaryOutput(v); + return this; + } + + Executor binaryOutput() { + return binaryOutput(true); + } + + Executor discardStdout(boolean v) { + commandOutputControl.discardStdout(v); + return this; + } + + Executor discardStdout() { + return discardStdout(true); + } + + Executor discardStderr(boolean v) { + commandOutputControl.discardStderr(v); + return this; + } + + Executor discardStderr() { + return discardStderr(true); + } + + Executor timeout(long v, TimeUnit unit) { + return timeout(Duration.of(v, unit.toChronoUnit())); + } + + Executor timeout(Duration v) { timeout = v; - if (timeout != INFINITE_TIMEOUT) { - // Redirect output to file if timeout is requested, otherwise we will - // reading until process ends and timeout will never be reached. - setWriteOutputToFile(true); - } return this; } - Executor setProcessBuilder(ProcessBuilder v) { - pb = v; + Executor toolProvider(ToolProvider v) { + toolProvider = Objects.requireNonNull(v); + processBuilder = null; return this; } - Executor setCommandLine(String... cmdline) { - return setProcessBuilder(new ProcessBuilder(cmdline)); + Optional toolProvider() { + return Optional.ofNullable(toolProvider); + } + + Executor processBuilder(ProcessBuilder v) { + processBuilder = Objects.requireNonNull(v); + toolProvider = null; + return this; + } + + Optional processBuilder() { + return Optional.ofNullable(processBuilder); + } + + Executor args(List v) { + args.addAll(v); + return this; + } + + Executor args(String... args) { + return args(List.of(args)); + } + + List args() { + return args; } Executor setQuiet(boolean v) { @@ -79,159 +180,202 @@ public final class Executor { return this; } - List getOutput() { - return output; - } - - Executor executeExpectSuccess() throws IOException { - int ret = execute(); - if (0 != ret) { - throw new IOException( - String.format("Command %s exited with %d code", - createLogMessage(pb, false), ret)); - } + Executor mapper(UnaryOperator v) { + mapper = v; return this; } - int execute() throws IOException { - output = null; + Optional> mapper() { + return Optional.ofNullable(mapper); + } - boolean needProcessOutput = outputConsumer != null || Log.isVerbose() || saveOutput; - Path outputFile = null; - if (needProcessOutput) { - pb.redirectErrorStream(true); - if (writeOutputToFile) { - outputFile = Files.createTempFile("jpackageOutputTempFile", ".tmp"); - pb.redirectOutput(outputFile.toFile()); + Executor copy() { + return new Executor(this); + } + + Result execute() throws IOException { + if (mapper != null) { + var mappedExecutor = Objects.requireNonNull(mapper.apply(this)); + if (mappedExecutor != this) { + return mappedExecutor.execute(); } + } + + var coc = commandOutputControl.copy(); + + final CommandOutputControl.Executable exec; + if (processBuilder != null) { + exec = coc.createExecutable(copyProcessBuilder()); + } else if (toolProvider != null) { + exec = coc.createExecutable(toolProvider, args.toArray(String[]::new)); } else { - // We are not going to read process output, so need to notify - // ProcessBuilder about this. Otherwise some processes might just - // hang up (`ldconfig -p`). - pb.redirectError(ProcessBuilder.Redirect.DISCARD); - pb.redirectOutput(ProcessBuilder.Redirect.DISCARD); + throw new IllegalStateException("No target to execute"); } - if (!quietCommand) { - Log.verbose(String.format("Running %s", createLogMessage(pb, true))); - } - - Process p = pb.start(); - - int code = 0; - if (writeOutputToFile) { - try { - code = waitForProcess(p); - } catch (InterruptedException ex) { - Log.verbose(ex); - throw new RuntimeException(ex); - } - } - - if (needProcessOutput) { - final List savedOutput; - Supplier> outputStream; - - if (writeOutputToFile) { - output = savedOutput = Files.readAllLines(outputFile); - Files.delete(outputFile); - outputStream = () -> { - if (savedOutput != null) { - return savedOutput.stream(); - } - return null; - }; - if (outputConsumer != null) { - outputConsumer.accept(outputStream.get()); - } - } else { - try (var br = new BufferedReader(new InputStreamReader( - p.getInputStream()))) { - - if ((outputConsumer != null || Log.isVerbose()) - || saveOutput) { - savedOutput = br.lines().toList(); - } else { - savedOutput = null; - } - output = savedOutput; - - outputStream = () -> { - if (savedOutput != null) { - return savedOutput.stream(); - } - return br.lines(); - }; - if (outputConsumer != null) { - outputConsumer.accept(outputStream.get()); - } - - if (savedOutput == null) { - // For some processes on Linux if the output stream - // of the process is opened but not consumed, the process - // would exit with code 141. - // It turned out that reading just a single line of process - // output fixes the problem, but let's process - // all of the output, just in case. - br.lines().forEach(x -> {}); - } - } - } + if (dumpOutput()) { + Log.verbose(String.format("Running %s", CommandLineFormat.DEFAULT.apply(List.of(commandLine().getFirst())))); } + var printableOutputBuilder = new PrintableOutputBuilder(coc); + Result result; try { - if (!writeOutputToFile) { - code = p.waitFor(); - } - if (!quietCommand) { - Log.verbose(pb.command(), getOutput(), code, IOUtils.getPID(p)); - } - return code; - } catch (InterruptedException ex) { - Log.verbose(ex); - throw new RuntimeException(ex); - } - } - - private int waitForProcess(Process p) throws InterruptedException { - if (timeout == INFINITE_TIMEOUT) { - return p.waitFor(); - } else { - if (p.waitFor(timeout, TimeUnit.SECONDS)) { - return p.exitValue(); + if (timeout == null) { + result = exec.execute(); } else { - Log.verbose(String.format("Command %s timeout after %d seconds", - createLogMessage(pb, false), timeout)); - p.destroy(); - return -1; + result = exec.execute(timeout.toMillis(), TimeUnit.MILLISECONDS); + } + } catch (InterruptedException ex) { + throw ExceptionBox.toUnchecked(ex); + } + + var printableOutput = printableOutputBuilder.create(); + if (dumpOutput()) { + log(result, printableOutput); + } + + return ExecutableAttributesWithCapturedOutput.augmentResultWithOutput(result, printableOutput); + } + + Result executeExpectSuccess() throws IOException { + return execute().expectExitCode(0); + } + + Result executeExpect(int mainExitCode, int... otherExitCodes) throws IOException { + return execute().expectExitCode(mainExitCode, otherExitCodes); + } + + RetryExecutor retry() { + return Globals.instance().objectFactory().retryExecutor(IOException.class) + .setExecutable(this::executeExpectSuccess); + } + + RetryExecutor retryOnKnownErrorMessage(String msg) { + Objects.requireNonNull(msg); + return saveOutput().retry().setExecutable(() -> { + // Execute it without exit code check. + var result = execute(); + if (result.stderr().stream().anyMatch(msg::equals)) { + throw result.unexpected(); + } + return result; + }); + } + + List commandLine() { + if (processBuilder != null) { + return Stream.of(processBuilder.command(), args).flatMap(Collection::stream).toList(); + } else if (toolProvider != null) { + return Stream.concat(Stream.of(toolProvider.name()), args.stream()).toList(); + } else { + throw new IllegalStateException("No target to execute"); + } + } + + private ProcessBuilder copyProcessBuilder() { + if (processBuilder == null) { + throw new IllegalStateException(); + } + + var copy = new ProcessBuilder(commandLine()); + copy.directory(processBuilder.directory()); + var env = copy.environment(); + env.clear(); + env.putAll(processBuilder.environment()); + + return copy; + } + + private boolean dumpOutput() { + return Log.isVerbose() && !quietCommand; + } + + private static void log(Result result, String printableOutput) throws IOException { + Objects.requireNonNull(result); + Objects.requireNonNull(printableOutput); + + Optional pid; + if (result.execAttrs() instanceof ProcessAttributes attrs) { + pid = attrs.pid(); + } else { + pid = Optional.empty(); + } + + var sb = new StringBuilder(); + sb.append("Command"); + pid.ifPresent(p -> { + sb.append(" [PID: ").append(p).append("]"); + }); + sb.append(":\n ").append(result.execAttrs().printableCommandLine()); + Log.verbose(sb.toString()); + + if (!printableOutput.isEmpty()) { + sb.delete(0, sb.length()); + sb.append("Output:"); + try (var lines = new BufferedReader(new StringReader(printableOutput)).lines()) { + lines.forEach(line -> { + sb.append("\n ").append(line); + }); + } + Log.verbose(sb.toString()); + } + + result.exitCode().ifPresentOrElse(exitCode -> { + Log.verbose("Returned: " + exitCode + "\n"); + }, () -> { + Log.verbose("Aborted: timed-out" + "\n"); + }); + } + + private static final class PrintableOutputBuilder { + + PrintableOutputBuilder(CommandOutputControl coc) { + coc.dumpOutput(true); + charset = coc.charset(); + if (coc.isBinaryOutput()) { + // Assume binary output goes into stdout and text error messages go into stderr, so keep them separated. + sinks = new ByteArrayOutputStream[2]; + sinks[0] = new ByteArrayOutputStream(); + sinks[1] = new ByteArrayOutputStream(); + coc.dumpStdout(new PrintStream(sinks[0], false, charset)) + .dumpStderr(new PrintStream(sinks[1], false, charset)); + } else { + sinks = new ByteArrayOutputStream[1]; + sinks[0] = new ByteArrayOutputStream(); + var ps = new PrintStream(sinks[0], false, charset); + // Redirect stderr in stdout. + coc.dumpStdout(ps).dumpStderr(ps); } } - } - static Executor of(String... cmdline) { - return new Executor().setCommandLine(cmdline); - } - - static Executor of(ProcessBuilder pb) { - return new Executor().setProcessBuilder(pb); - } - - private static String createLogMessage(ProcessBuilder pb, boolean quiet) { - StringBuilder sb = new StringBuilder(); - sb.append((quiet) ? pb.command().get(0) : pb.command()); - if (pb.directory() != null) { - sb.append(String.format(" in %s", pb.directory().getAbsolutePath())); + String create() { + if (isBinaryOutput()) { + // In case of binary output: + // - Convert binary stdout to text using ISO-8859-1 encoding and + // replace non-printable characters with the question mark symbol (?). + // - Convert binary stderr to text using designated encoding (assume stderr is always a character stream). + // - Merge text stdout and stderr into a single string; + // stderr first, stdout follows, with the aim to present user error messages first. + var sb = new StringBuilder(); + var stdout = sinks[0].toString(StandardCharsets.ISO_8859_1).replaceAll("[^\\p{Print}\\p{Space}]", "?"); + return sb.append(sinks[1].toString(charset)).append(stdout).toString(); + } else { + return sinks[0].toString(charset); + } } - return sb.toString(); + + private boolean isBinaryOutput() { + return sinks.length == 2; + } + + private final ByteArrayOutputStream sinks[]; + private final Charset charset; } - public static final int INFINITE_TIMEOUT = -1; - - private ProcessBuilder pb; - private boolean saveOutput; - private boolean writeOutputToFile; + private final CommandOutputControl commandOutputControl; private boolean quietCommand; - private long timeout = INFINITE_TIMEOUT; - private List output; - private Consumer> outputConsumer; + private final List args; + private ProcessBuilder processBuilder; + private ToolProvider toolProvider; + private Duration timeout; + private UnaryOperator mapper; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ExecutorFactory.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ExecutorFactory.java new file mode 100644 index 00000000000..ce703358b82 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ExecutorFactory.java @@ -0,0 +1,33 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal; + +@FunctionalInterface +interface ExecutorFactory { + + Executor executor(); + + static final ExecutorFactory DEFAULT = Executor::new; +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/FromOptions.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/FromOptions.java index 6b74cab4e65..cccd05792d6 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/FromOptions.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/FromOptions.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 @@ -46,6 +46,7 @@ import static jdk.jpackage.internal.cli.StandardOption.RESOURCE_DIR; import static jdk.jpackage.internal.cli.StandardOption.VENDOR; import java.nio.file.Path; +import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Optional; @@ -60,6 +61,7 @@ import jdk.jpackage.internal.model.Launcher; import jdk.jpackage.internal.model.LauncherModularStartupInfo; import jdk.jpackage.internal.model.PackageType; import jdk.jpackage.internal.model.RuntimeLayout; +import jdk.jpackage.internal.util.RootedPath; final class FromOptions { @@ -168,8 +170,15 @@ final class FromOptions { APP_VERSION.ifPresentIn(options, appBuilder::version); VENDOR.ifPresentIn(options, appBuilder::vendor); COPYRIGHT.ifPresentIn(options, appBuilder::copyright); - INPUT.ifPresentIn(options, appBuilder::srcDir); - APP_CONTENT.ifPresentIn(options, appBuilder::contentDirs); + INPUT.ifPresentIn(options, appBuilder::appDirSources); + APP_CONTENT.findIn(options).map((List> v) -> { + // Reverse the order of content sources. + // If there are multiple source files for the same + // destination file, only the first will be used. + // Reversing the order of content sources makes it use the last file + // from the original list of source files for the given destination file. + return v.reversed().stream().flatMap(Collection::stream).toList(); + }).ifPresent(appBuilder::contentDirSources); if (isRuntimeInstaller) { appBuilder.appImageLayout(runtimeLayout); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Globals.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Globals.java new file mode 100644 index 00000000000..91ae37870a5 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Globals.java @@ -0,0 +1,85 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal; + +import java.io.PrintWriter; +import java.util.Optional; +import java.util.function.Supplier; + +public final class Globals { + + private Globals() { + } + + Globals objectFactory(ObjectFactory v) { + checkMutable(); + objectFactory = Optional.ofNullable(v).orElse(ObjectFactory.DEFAULT); + return this; + } + + ObjectFactory objectFactory() { + return objectFactory; + } + + Globals executorFactory(ExecutorFactory v) { + return objectFactory(ObjectFactory.build(objectFactory).executorFactory(v).create()); + } + + Log.Logger logger() { + return logger; + } + + public void loggerOutputStreams(PrintWriter out, PrintWriter err) { + logger.setPrintWriter(out, err); + } + + public void loggerVerbose() { + logger.setVerbose(); + } + + public static int main(Supplier mainBody) { + if (INSTANCE.isBound()) { + return mainBody.get(); + } else { + return ScopedValue.where(INSTANCE, new Globals()).call(mainBody::get); + } + } + + public static Globals instance() { + return INSTANCE.orElse(DEFAULT); + } + + private void checkMutable() { + if (this == DEFAULT) { + throw new UnsupportedOperationException("Can't modify immutable instance"); + } + } + + private ObjectFactory objectFactory = ObjectFactory.DEFAULT; + private final Log.Logger logger = new Log.Logger(); + + private static final ScopedValue INSTANCE = ScopedValue.newInstance(); + private static final Globals DEFAULT = new Globals(); +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java index aac113d7777..08cf0c10982 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2025, 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 @@ -26,12 +26,9 @@ package jdk.jpackage.internal; import java.io.IOException; -import java.io.PrintStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; -import java.util.ArrayList; -import java.util.List; import jdk.jpackage.internal.model.JPackageException; /** @@ -50,46 +47,6 @@ final class IOUtils { StandardCopyOption.COPY_ATTRIBUTES); } - public static void exec(ProcessBuilder pb) - throws IOException { - exec(pb, false, null, false, Executor.INFINITE_TIMEOUT); - } - - // timeout in seconds. -1 will be return if process timeouts. - public static void exec(ProcessBuilder pb, long timeout) - throws IOException { - exec(pb, false, null, false, timeout); - } - - static void exec(ProcessBuilder pb, boolean testForPresenceOnly, - PrintStream consumer, boolean writeOutputToFile, long timeout) - throws IOException { - exec(pb, testForPresenceOnly, consumer, writeOutputToFile, - timeout, false); - } - - static void exec(ProcessBuilder pb, boolean testForPresenceOnly, - PrintStream consumer, boolean writeOutputToFile, - long timeout, boolean quiet) throws IOException { - List output = new ArrayList<>(); - Executor exec = Executor.of(pb) - .setWriteOutputToFile(writeOutputToFile) - .setTimeout(timeout) - .setQuiet(quiet) - .setOutputConsumer(lines -> { - lines.forEach(output::add); - if (consumer != null) { - output.forEach(consumer::println); - } - }); - - if (testForPresenceOnly) { - exec.execute(); - } else { - exec.executeExpectSuccess(); - } - } - static void writableOutputDir(Path outdir) { if (!Files.isDirectory(outdir)) { try { @@ -103,15 +60,4 @@ final class IOUtils { throw new JPackageException(I18N.format("error.cannot-write-to-output-dir", outdir.toAbsolutePath())); } } - - public static long getPID(Process p) { - try { - return p.pid(); - } catch (UnsupportedOperationException ex) { - Log.verbose(ex); // Just log exception and ignore it. This method - // is used for verbose output, so not a problem - // if unsupported. - return -1; - } - } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkRuntimeBuilder.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkRuntimeBuilder.java index 37f166a4e7c..f960f8dc2bf 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkRuntimeBuilder.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkRuntimeBuilder.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 @@ -22,13 +22,14 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package jdk.jpackage.internal; + import static jdk.jpackage.internal.model.RuntimeBuilder.getDefaultModulePath; +import static jdk.jpackage.internal.util.function.ThrowingRunnable.toRunnable; import java.io.File; import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; @@ -50,7 +51,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.internal.module.ModulePath; import jdk.jpackage.internal.model.AppImageLayout; -import jdk.jpackage.internal.model.JPackageException; import jdk.jpackage.internal.model.LauncherModularStartupInfo; import jdk.jpackage.internal.model.LauncherStartupInfo; import jdk.jpackage.internal.model.RuntimeBuilder; @@ -58,27 +58,15 @@ import jdk.jpackage.internal.model.RuntimeBuilder; final class JLinkRuntimeBuilder implements RuntimeBuilder { private JLinkRuntimeBuilder(List jlinkCmdLine) { - this.jlinkCmdLine = jlinkCmdLine; + this.jlinkCmdLine = Objects.requireNonNull(jlinkCmdLine); } @Override public void create(AppImageLayout appImageLayout) { - var args = new ArrayList(); - args.add("--output"); - args.add(appImageLayout.runtimeDirectory().toString()); - args.addAll(jlinkCmdLine); - - StringWriter writer = new StringWriter(); - PrintWriter pw = new PrintWriter(writer); - - int retVal = LazyLoad.JLINK_TOOL.run(pw, pw, args.toArray(String[]::new)); - String jlinkOut = writer.toString(); - - args.add(0, "jlink"); - Log.verbose(args, List.of(jlinkOut), retVal, -1); - if (retVal != 0) { - throw new JPackageException(I18N.format("error.jlink.failed", jlinkOut)); - } + toRunnable(Executor.of() + .toolProvider(LazyLoad.JLINK_TOOL) + .args("--output", appImageLayout.runtimeDirectory().toString()) + .args(jlinkCmdLine)::executeExpectSuccess).run(); } @Override diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherBuilder.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherBuilder.java index e3720e0a776..5658760b4d6 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherBuilder.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherBuilder.java @@ -50,13 +50,16 @@ final class LauncherBuilder { final var fa = createFileAssociations(faSources, Optional.ofNullable(faTraits).orElse(DEFAULT_FA_TRAITS)); - Objects.requireNonNull(defaultIconResourceName); - final var nonNullName = deriveNonNullName(); - return new Stub(nonNullName, Optional.ofNullable(startupInfo), fa, - isService, Optional.ofNullable(description).orElse(nonNullName), - Optional.ofNullable(icon), defaultIconResourceName, + return new Stub( + nonNullName, + Optional.ofNullable(startupInfo), + fa, + isService, + Optional.ofNullable(description).orElse(nonNullName), + Optional.ofNullable(icon), + Optional.ofNullable(defaultIconResourceName).orElseGet(LauncherBuilder::defaultIconResourceName), Optional.ofNullable(extraAppImageFileData).orElseGet(Map::of)); } @@ -170,6 +173,23 @@ final class LauncherBuilder { return FileAssociationGroup.flatMap(groups.stream()).toList(); } + private static String defaultIconResourceName() { + switch (OperatingSystem.current()) { + case WINDOWS -> { + return "JavaApp.ico"; + } + case LINUX -> { + return "JavaApp.png"; + } + case MACOS -> { + return "JavaApp.icns"; + } + default -> { + throw new UnsupportedOperationException(); + } + } + } + private String name; private LauncherStartupInfo startupInfo; private List faSources = List.of(); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherFromOptions.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherFromOptions.java index 0749cc48b9b..1ba384dba2d 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherFromOptions.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherFromOptions.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 @@ -45,17 +45,18 @@ import java.util.Optional; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.stream.IntStream; -import jdk.internal.util.OperatingSystem; import jdk.jpackage.internal.FileAssociationGroup.FileAssociationException; import jdk.jpackage.internal.FileAssociationGroup.FileAssociationNoExtensionsException; import jdk.jpackage.internal.FileAssociationGroup.FileAssociationNoMimesException; import jdk.jpackage.internal.cli.Options; import jdk.jpackage.internal.cli.StandardFaOption; import jdk.jpackage.internal.model.CustomLauncherIcon; +import jdk.jpackage.internal.model.JPackageException; import jdk.jpackage.internal.model.DefaultLauncherIcon; import jdk.jpackage.internal.model.FileAssociation; import jdk.jpackage.internal.model.Launcher; import jdk.jpackage.internal.model.LauncherIcon; +import jdk.jpackage.internal.util.RootedPath; final class LauncherFromOptions { @@ -82,7 +83,7 @@ final class LauncherFromOptions { } Launcher create(Options options) { - final var builder = new LauncherBuilder().defaultIconResourceName(defaultIconResourceName()); + final var builder = new LauncherBuilder(); DESCRIPTION.ifPresentIn(options, builder::description); builder.icon(toLauncherIcon(ICON.findIn(options).orElse(null))); @@ -92,7 +93,9 @@ final class LauncherFromOptions { if (PREDEFINED_APP_IMAGE.findIn(options).isEmpty()) { final var startupInfoBuilder = new LauncherStartupInfoBuilder(); - INPUT.ifPresentIn(options, startupInfoBuilder::inputDir); + INPUT.findIn(options).flatMap(v -> { + return v.stream().findAny().map(RootedPath::root); + }).ifPresent(startupInfoBuilder::inputDir); ARGUMENTS.ifPresentIn(options, startupInfoBuilder::defaultParameters); JAVA_OPTIONS.ifPresentIn(options, startupInfoBuilder::javaOptions); MAIN_JAR.ifPresentIn(options, startupInfoBuilder::mainJar); @@ -131,8 +134,7 @@ final class LauncherFromOptions { .advice("error.no-content-types-for-file-association.advice", faID) .create(); } catch (FileAssociationNoExtensionsException ex) { - // TODO: Must do something about this condition! - throw new AssertionError(); + throw new JPackageException(I18N.format("error.no-extensions-for-file-association", faID)); } catch (FileAssociationException ex) { // Should never happen throw new UnsupportedOperationException(ex); @@ -167,23 +169,6 @@ final class LauncherFromOptions { } } - private static String defaultIconResourceName() { - switch (OperatingSystem.current()) { - case WINDOWS -> { - return "JavaApp.ico"; - } - case LINUX -> { - return "JavaApp.png"; - } - case MACOS -> { - return "JavaApp.icns"; - } - default -> { - throw new UnsupportedOperationException(); - } - } - } - private BiConsumer faGroupBuilderMutator; private BiFunction faMapper; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java index b14b4ab22ca..5c27ef67500 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Log.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2021, 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,6 @@ package jdk.jpackage.internal; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.List; /** * Log @@ -62,16 +61,6 @@ public class Log { this.err = err; } - public void flush() { - if (out != null) { - out.flush(); - } - - if (err != null) { - err.flush(); - } - } - public void info(String msg) { if (out != null) { out.println(msg); @@ -105,29 +94,6 @@ public class Log { } } - public void verbose(List strings, - List output, int returnCode, long pid) { - if (verbose) { - StringBuilder sb = new StringBuilder(); - sb.append("Command [PID: "); - sb.append(pid); - sb.append("]:\n "); - - for (String s : strings) { - sb.append(" " + s); - } - verbose(sb.toString()); - if (output != null && !output.isEmpty()) { - sb = new StringBuilder("Output:"); - for (String s : output) { - sb.append("\n " + s); - } - verbose(sb.toString()); - } - verbose("Returned: " + returnCode + "\n"); - } - } - private String addTimestamp(String msg) { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS"); Date time = new Date(System.currentTimeMillis()); @@ -135,51 +101,27 @@ public class Log { } } - private static final InheritableThreadLocal instance = - new InheritableThreadLocal() { - @Override protected Logger initialValue() { - return new Logger(); - } - }; - - public static void setPrintWriter (PrintWriter out, PrintWriter err) { - instance.get().setPrintWriter(out, err); - } - - public static void flush() { - instance.get().flush(); - } - public static void info(String msg) { - instance.get().info(msg); + Globals.instance().logger().info(msg); } public static void fatalError(String msg) { - instance.get().fatalError(msg); + Globals.instance().logger().fatalError(msg); } public static void error(String msg) { - instance.get().error(msg); - } - - public static void setVerbose() { - instance.get().setVerbose(); + Globals.instance().logger().error(msg); } public static boolean isVerbose() { - return instance.get().isVerbose(); + return Globals.instance().logger().isVerbose(); } public static void verbose(String msg) { - instance.get().verbose(msg); + Globals.instance().logger().verbose(msg); } public static void verbose(Throwable t) { - instance.get().verbose(t); - } - - public static void verbose(List strings, List out, - int ret, long pid) { - instance.get().verbose(strings, out, ret, pid); + Globals.instance().logger().verbose(t); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ObjectFactory.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ObjectFactory.java new file mode 100644 index 00000000000..f1a83eb9eab --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ObjectFactory.java @@ -0,0 +1,72 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal; + +import java.util.Objects; +import java.util.Optional; +import jdk.jpackage.internal.util.CompositeProxy; + +interface ObjectFactory extends ExecutorFactory, RetryExecutorFactory { + + static ObjectFactory.Builder build() { + return new Builder(); + } + + static ObjectFactory.Builder build(ObjectFactory from) { + return build().initFrom(from); + } + + static final class Builder { + private Builder() { + } + + ObjectFactory create() { + return CompositeProxy.build().invokeTunnel(CompositeProxyTunnel.INSTANCE).create( + ObjectFactory.class, + Optional.ofNullable(executorFactory).orElse(ExecutorFactory.DEFAULT), + Optional.ofNullable(retryExecutorFactory).orElse(RetryExecutorFactory.DEFAULT)); + } + + Builder initFrom(ObjectFactory of) { + Objects.requireNonNull(of); + return executorFactory(of).retryExecutorFactory(of); + } + + Builder executorFactory(ExecutorFactory v) { + executorFactory = v; + return this; + } + + Builder retryExecutorFactory(RetryExecutorFactory v) { + retryExecutorFactory = v; + return this; + } + + private ExecutorFactory executorFactory; + private RetryExecutorFactory retryExecutorFactory; + } + + static final ObjectFactory DEFAULT = build().create(); +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackagingPipeline.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackagingPipeline.java index a2750fee260..315e3bce0f1 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackagingPipeline.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackagingPipeline.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 @@ -29,9 +29,9 @@ import static java.util.stream.Collectors.toMap; import static jdk.jpackage.internal.model.AppImageLayout.toPathGroup; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.LinkOption; import java.nio.file.Path; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -39,12 +39,16 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.concurrent.Callable; +import java.util.function.BiConsumer; +import java.util.function.Function; import java.util.function.Predicate; +import java.util.function.Supplier; import java.util.function.UnaryOperator; import java.util.stream.Stream; import jdk.jpackage.internal.model.AppImageLayout; import jdk.jpackage.internal.model.Application; import jdk.jpackage.internal.model.ApplicationLayout; +import jdk.jpackage.internal.model.JPackageException; import jdk.jpackage.internal.model.Package; import jdk.jpackage.internal.pipeline.DirectedEdge; import jdk.jpackage.internal.pipeline.FixedDAG; @@ -97,7 +101,7 @@ final class PackagingPipeline { /** * The way to access packaging build environment before building a package in a pipeline. */ - interface StartupParameters { + sealed interface StartupParameters { BuildEnv packagingEnv(); } @@ -127,6 +131,7 @@ final class PackagingPipeline { enum PackageTaskID implements TaskID { RUN_POST_IMAGE_USER_SCRIPT, CREATE_CONFIG_FILES, + DELETE_OLD_PACKAGE_FILE, CREATE_PACKAGE_FILE } @@ -183,9 +188,11 @@ final class PackagingPipeline { void execute() throws IOException; } - record TaskConfig(Optional action) { + record TaskConfig(Optional action, Optional beforeAction, Optional afterAction) { TaskConfig { Objects.requireNonNull(action); + Objects.requireNonNull(beforeAction); + Objects.requireNonNull(afterAction); } } @@ -196,47 +203,64 @@ final class PackagingPipeline { final class TaskBuilder extends TaskSpecBuilder { - private TaskBuilder(TaskID id) { - super(id); - } - - private TaskBuilder(TaskID id, TaskConfig config) { - this(id); - config.action().ifPresent(this::setAction); - } - - private TaskBuilder setAction(TaskAction v) { - action = v; - return this; - } - TaskBuilder noaction() { - action = null; - return this; + return setAction(ActionRole.WORKLOAD, null); } TaskBuilder applicationAction(ApplicationImageTaskAction action) { - return setAction(action); + return applicationAction(ActionRole.WORKLOAD, action); } TaskBuilder appImageAction(AppImageTaskAction action) { - return setAction(action); + return appImageAction(ActionRole.WORKLOAD, action); } TaskBuilder copyAction(CopyAppImageTaskAction action) { - return setAction(action); + return copyAction(ActionRole.WORKLOAD, action); } TaskBuilder packageAction(PackageTaskAction action) { - return setAction(action); + return packageAction(ActionRole.WORKLOAD, action); } TaskBuilder action(NoArgTaskAction action) { - return setAction(action); + return action(ActionRole.WORKLOAD, action); + } + + TaskBuilder logAppImageActionBegin(String keyId, Function, Object[]> formatArgsSupplier) { + return logAppImageAction(ActionRole.BEFORE, keyId, formatArgsSupplier); + } + + TaskBuilder logAppImageActionEnd(String keyId, Function, Object[]> formatArgsSupplier) { + return logAppImageAction(ActionRole.AFTER, keyId, formatArgsSupplier); + } + + TaskBuilder logPackageActionBegin(String keyId, Function, Object[]> argsSupplier) { + return logPackageAction(ActionRole.BEFORE, keyId, argsSupplier); + } + + TaskBuilder logPackageActionEnd(String keyId, Function, Object[]> argsSupplier) { + return logPackageAction(ActionRole.AFTER, keyId, argsSupplier); + } + + TaskBuilder logActionBegin(String keyId, Supplier formatArgsSupplier) { + return logAction(ActionRole.BEFORE, keyId, formatArgsSupplier); + } + + TaskBuilder logActionBegin(String keyId, Object... formatArgsSupplier) { + return logAction(ActionRole.BEFORE, keyId, () -> formatArgsSupplier); + } + + TaskBuilder logActionEnd(String keyId, Supplier formatArgsSupplier) { + return logAction(ActionRole.AFTER, keyId, formatArgsSupplier); + } + + TaskBuilder logActionEnd(String keyId, Object... formatArgsSupplier) { + return logAction(ActionRole.AFTER, keyId, () -> formatArgsSupplier); } boolean hasAction() { - return action != null; + return workloadAction != null; } @Override @@ -272,13 +296,109 @@ final class PackagingPipeline { } Builder add() { - final var config = new TaskConfig(Optional.ofNullable(action)); + final var config = new TaskConfig( + Optional.ofNullable(workloadAction), + Optional.ofNullable(beforeAction), + Optional.ofNullable(afterAction)); taskConfig.put(task(), config); createLinks().forEach(Builder.this::linkTasks); return Builder.this; } - private TaskAction action; + + private enum ActionRole { + WORKLOAD(TaskBuilder::setWorkloadAction), + BEFORE(TaskBuilder::setBeforeAction), + AFTER(TaskBuilder::setAfterAction), + ; + + ActionRole(BiConsumer actionSetter) { + this.actionSetter = Objects.requireNonNull(actionSetter); + } + + TaskBuilder setAction(TaskBuilder taskBuilder, TaskAction action) { + actionSetter.accept(taskBuilder, action); + return taskBuilder; + } + + private final BiConsumer actionSetter; + } + + + private TaskBuilder(TaskID id) { + super(id); + } + + private TaskBuilder(TaskID id, TaskConfig config) { + this(id); + config.action().ifPresent(this::setWorkloadAction); + config.beforeAction().ifPresent(this::setBeforeAction); + config.afterAction().ifPresent(this::setAfterAction); + } + + private TaskBuilder setAction(ActionRole role, TaskAction v) { + return role.setAction(this, v); + } + + private TaskBuilder setWorkloadAction(TaskAction v) { + workloadAction = v; + return this; + } + + private TaskBuilder setBeforeAction(TaskAction v) { + beforeAction = v; + return this; + } + + private TaskBuilder setAfterAction(TaskAction v) { + afterAction = v; + return this; + } + + private TaskBuilder applicationAction(ActionRole role, ApplicationImageTaskAction action) { + return setAction(role, action); + } + + private TaskBuilder appImageAction(ActionRole role, AppImageTaskAction action) { + return setAction(role, action); + } + + private TaskBuilder copyAction(ActionRole role, CopyAppImageTaskAction action) { + return setAction(role, action); + } + + private TaskBuilder packageAction(ActionRole role, PackageTaskAction action) { + return setAction(role, action); + } + + private TaskBuilder action(ActionRole role, NoArgTaskAction action) { + return setAction(role, action); + } + + private TaskBuilder logAppImageAction(ActionRole role, String keyId, Function, Object[]> formatArgsSupplier) { + Objects.requireNonNull(keyId); + return appImageAction(role, (AppImageBuildEnv env) -> { + Log.verbose(I18N.format(keyId, formatArgsSupplier.apply(env))); + }); + } + + private TaskBuilder logPackageAction(ActionRole role, String keyId, Function, Object[]> formatArgsSupplier) { + Objects.requireNonNull(keyId); + return packageAction(role, (PackageBuildEnv env) -> { + Log.verbose(I18N.format(keyId, formatArgsSupplier.apply(env))); + }); + } + + private TaskBuilder logAction(ActionRole role, String keyId, Supplier formatArgsSupplier) { + Objects.requireNonNull(keyId); + return action(role, () -> { + Log.verbose(I18N.format(keyId, formatArgsSupplier.get())); + }); + } + + private TaskAction workloadAction; + private TaskAction beforeAction; + private TaskAction afterAction; } Builder linkTasks(DirectedEdge edge) { @@ -294,7 +414,11 @@ final class PackagingPipeline { } TaskBuilder task(TaskID id) { - return new TaskBuilder(id); + return Optional.ofNullable(taskConfig.get(id)).map(taskConfig -> { + return new TaskBuilder(id, taskConfig); + }).orElseGet(() -> { + return new TaskBuilder(id); + }); } Stream configuredTasks() { @@ -303,12 +427,6 @@ final class PackagingPipeline { }); } - Builder excludeDirFromCopying(Path path) { - Objects.requireNonNull(path); - excludeCopyDirs.add(path); - return this; - } - Builder contextMapper(UnaryOperator v) { contextMapper = v; return this; @@ -331,7 +449,6 @@ final class PackagingPipeline { } private final FixedDAG.Builder taskGraphBuilder = FixedDAG.build(); - private final List excludeCopyDirs = new ArrayList<>(); private final Map taskConfig = new HashMap<>(); private UnaryOperator contextMapper; private FixedDAG taskGraphSnapshot; @@ -365,7 +482,7 @@ final class PackagingPipeline { builder.task(BuildApplicationTaskID.CONTENT) .addDependent(BuildApplicationTaskID.APP_IMAGE_FILE) - .applicationAction(ApplicationImageUtils.createCopyContentAction(() -> builder.excludeCopyDirs)).add(); + .applicationAction(ApplicationImageUtils.createCopyContentAction()).add(); return builder; } @@ -392,6 +509,8 @@ final class PackagingPipeline { builder.task(PackageTaskID.CREATE_PACKAGE_FILE) .addDependent(PrimaryTaskID.PACKAGE) + .logActionBegin("message.create-package") + .logActionEnd("message.package-created") .add(); builder.task(PrimaryTaskID.PACKAGE).add(); @@ -425,6 +544,17 @@ final class PackagingPipeline { .run(env.env(), env.pkg().app().name()); } + static void deleteOutputBundle(PackageBuildEnv env) throws IOException { + + var outputBundle = env.outputDir().resolve(env.pkg().packageFileNameWithSuffix()); + + try { + Files.deleteIfExists(outputBundle); + } catch (IOException ex) { + throw new JPackageException(I18N.format("error.output-bundle-cannot-be-overwritten", outputBundle.toAbsolutePath()), ex); + } + } + private PackagingPipeline(FixedDAG taskGraph, Map taskConfig, UnaryOperator contextMapper) { this.taskGraph = Objects.requireNonNull(taskGraph); @@ -508,7 +638,7 @@ final class PackagingPipeline { try { builder.create().call(); } catch (Exception ex) { - throw ExceptionBox.rethrowUnchecked(ex); + throw ExceptionBox.toUnchecked(ex); } } @@ -632,7 +762,7 @@ final class PackagingPipeline { final var accepted = withAction && context.test(id); if (TRACE_TASK_ACTION) { - var sb = new StringBuffer(); + var sb = new StringBuilder(); sb.append("Execute task=[").append(id).append("]: "); if (!withAction) { sb.append("no action"); @@ -645,7 +775,13 @@ final class PackagingPipeline { } if (accepted) { + if (config.beforeAction.isPresent()) { + context.execute(config.beforeAction.orElseThrow()); + } context.execute(config.action.orElseThrow()); + if (config.afterAction.isPresent()) { + context.execute(config.afterAction.orElseThrow()); + } } return null; diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RetryExecutor.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RetryExecutor.java deleted file mode 100644 index f806217e8f9..00000000000 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RetryExecutor.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2020, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.jpackage.internal; - -import java.io.IOException; -import java.util.List; -import java.util.function.Consumer; -import java.util.function.Supplier; - -public final class RetryExecutor { - public RetryExecutor() { - setMaxAttemptsCount(5); - setAttemptTimeoutMillis(2 * 1000); - setWriteOutputToFile(false); - } - - public RetryExecutor setMaxAttemptsCount(int v) { - attempts = v; - return this; - } - - public RetryExecutor setAttemptTimeoutMillis(int v) { - timeoutMillis = v; - return this; - } - - public RetryExecutor saveOutput(boolean v) { - saveOutput = v; - return this; - } - - public List getOutput() { - return output; - } - - public RetryExecutor setWriteOutputToFile(boolean v) { - writeOutputToFile = v; - return this; - } - - public RetryExecutor setExecutorInitializer(Consumer v) { - executorInitializer = v; - return this; - } - - public void abort() { - aborted = true; - } - - public boolean isAborted() { - return aborted; - } - - static RetryExecutor retryOnKnownErrorMessage(String v) { - RetryExecutor result = new RetryExecutor(); - return result.setExecutorInitializer(exec -> { - exec.setOutputConsumer(output -> { - if (!output.anyMatch(v::equals)) { - result.abort(); - } - }); - }); - } - - public void execute(String cmdline[]) throws IOException { - executeLoop(() -> - Executor.of(cmdline).setWriteOutputToFile(writeOutputToFile)); - } - - public void execute(ProcessBuilder pb) throws IOException { - executeLoop(() -> - Executor.of(pb).setWriteOutputToFile(writeOutputToFile)); - } - - private void executeLoop(Supplier execSupplier) throws IOException { - aborted = false; - for (;;) { - if (aborted) { - break; - } - - try { - Executor exec = execSupplier.get().saveOutput(saveOutput); - if (executorInitializer != null) { - executorInitializer.accept(exec); - } - exec.executeExpectSuccess(); - if (saveOutput) { - output = exec.getOutput(); - } - break; - } catch (IOException ex) { - if (aborted || (--attempts) <= 0) { - throw ex; - } - } - - try { - Thread.sleep(timeoutMillis); - } catch (InterruptedException ex) { - Log.verbose(ex); - throw new RuntimeException(ex); - } - } - } - - private Consumer executorInitializer; - private boolean aborted; - private int attempts; - private int timeoutMillis; - private boolean saveOutput; - private List output; - private boolean writeOutputToFile; -} diff --git a/src/java.desktop/share/native/libjsound/Platform.c b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RetryExecutorFactory.java similarity index 69% rename from src/java.desktop/share/native/libjsound/Platform.c rename to src/jdk.jpackage/share/classes/jdk/jpackage/internal/RetryExecutorFactory.java index ecb389c89b7..3efb522abd4 100644 --- a/src/java.desktop/share/native/libjsound/Platform.c +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/RetryExecutorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -22,22 +22,14 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +package jdk.jpackage.internal; +import jdk.jpackage.internal.util.RetryExecutor; -#include "Utilities.h" -// Platform.java includes -#include "com_sun_media_sound_Platform.h" +@FunctionalInterface +interface RetryExecutorFactory { -/* - * Declare library specific JNI_Onload entry if static build - */ -DEF_STATIC_JNI_OnLoad + RetryExecutor retryExecutor(Class exceptionType); -/* - * Class: com_sun_media_sound_Platform - * Method: nIsBigEndian - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_com_sun_media_sound_Platform_nIsBigEndian(JNIEnv *env, jclass clss) { - return UTIL_IsBigEndianPlatform(); + static final RetryExecutorFactory DEFAULT = RetryExecutor::new; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/SystemEnvironment.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/SystemEnvironment.java index de98e97c922..5d9a1d6d147 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/SystemEnvironment.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/SystemEnvironment.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 @@ -24,5 +24,5 @@ */ package jdk.jpackage.internal; -public interface SystemEnvironment { +interface SystemEnvironment { } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ToolValidator.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ToolValidator.java index 13e87d5cfa6..9440aff3a53 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ToolValidator.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ToolValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, 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 @@ -121,32 +121,32 @@ final class ToolValidator { cmdline.addAll(args); } - boolean canUseTool[] = new boolean[1]; + boolean canUseTool = false; if (minimalVersion == null) { // No version check. - canUseTool[0] = true; + canUseTool = true; } - String[] version = new String[1]; + String version = null; try { - Executor.of(cmdline.toArray(String[]::new)).setQuiet(true).setOutputConsumer(lines -> { - if (versionParser != null && minimalVersion != null) { - version[0] = versionParser.apply(lines); - if (version[0] != null && minimalVersion.compareTo(version[0]) <= 0) { - canUseTool[0] = true; - } + var result = Executor.of(cmdline).setQuiet(true).saveOutput().execute(); + var lines = result.content(); + if (versionParser != null && minimalVersion != null) { + version = versionParser.apply(lines.stream()); + if (version != null && minimalVersion.compareTo(version) <= 0) { + canUseTool = true; } - }).execute(); + } } catch (IOException e) { return new ConfigException(I18N.format("error.tool-error", toolPath, e.getMessage()), null, e); } - if (canUseTool[0]) { + if (canUseTool) { // All good. Tool can be used. return null; } else if (toolOldVersionErrorHandler != null) { - return toolOldVersionErrorHandler.apply(toolPath, version[0]); + return toolOldVersionErrorHandler.apply(toolPath, version); } else { return new ConfigException( I18N.format("error.tool-old-version", toolPath, minimalVersion), diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/JOptSimpleOptionsBuilder.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/JOptSimpleOptionsBuilder.java index 57b92471e4a..bff35874645 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/JOptSimpleOptionsBuilder.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/JOptSimpleOptionsBuilder.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 @@ -27,6 +27,7 @@ package jdk.jpackage.internal.cli; import static java.util.stream.Collectors.toUnmodifiableMap; import static java.util.stream.Collectors.toUnmodifiableSet; +import static jdk.jpackage.internal.cli.OptionValueConverter.convertString; import java.lang.reflect.Array; import java.util.ArrayList; @@ -565,7 +566,7 @@ final class JOptSimpleOptionsBuilder { final var converter = optionSpec.converter().orElseThrow(); final Result conversionResult = optionValue.map(v -> { - return converter.convert(optionName(), StringToken.of(v)); + return convertString(converter, optionName(), StringToken.of(v)); }).orElseGet(() -> { return Result.ofValue(optionSpec.defaultOptionalValue().orElseThrow()); }); @@ -579,7 +580,7 @@ final class JOptSimpleOptionsBuilder { final String str = getOptionValue(List.of(tokens), optionSpec.mergePolicy()).getFirst(); final String[] token = arrConverter.tokenize(str); if (token.length == 1 && str.equals(token[0])) { - final var singleTokenConversionResult = converter.convert(optionName(), StringToken.of(str)); + final var singleTokenConversionResult = convertString(converter, optionName(), StringToken.of(str)); if (singleTokenConversionResult.hasValue()) { return singleTokenConversionResult; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java index f377b22374d..73b4850344b 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.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 @@ -29,9 +29,12 @@ import static jdk.jpackage.internal.cli.StandardOption.HELP; import static jdk.jpackage.internal.cli.StandardOption.VERBOSE; import static jdk.jpackage.internal.cli.StandardOption.VERSION; +import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.PrintStream; import java.io.PrintWriter; +import java.io.StringReader; import java.io.UncheckedIOException; import java.nio.file.NoSuchFileException; import java.util.Collection; @@ -44,9 +47,15 @@ import java.util.function.Supplier; import java.util.spi.ToolProvider; import jdk.internal.opt.CommandLine; import jdk.internal.util.OperatingSystem; +import jdk.jpackage.internal.Globals; import jdk.jpackage.internal.Log; import jdk.jpackage.internal.model.ConfigException; +import jdk.jpackage.internal.model.ExecutableAttributesWithCapturedOutput; import jdk.jpackage.internal.model.JPackageException; +import jdk.jpackage.internal.model.SelfContainedException; +import jdk.jpackage.internal.util.CommandOutputControl.UnexpectedExitCodeException; +import jdk.jpackage.internal.util.CommandOutputControl.UnexpectedResultException; +import jdk.jpackage.internal.util.Slot; import jdk.jpackage.internal.util.function.ExceptionBox; /** @@ -54,7 +63,15 @@ import jdk.jpackage.internal.util.function.ExceptionBox; */ public final class Main { - public static final class Provider implements ToolProvider { + public record Provider(Supplier bundlingEnvSupplier) implements ToolProvider { + + public Provider { + Objects.requireNonNull(bundlingEnvSupplier); + } + + public Provider() { + this(DefaultBundlingEnvironmentLoader.INSTANCE); + } @Override public String name() { @@ -63,7 +80,22 @@ public final class Main { @Override public int run(PrintWriter out, PrintWriter err, String... args) { - return Main.run(out, err, args); + return Main.run(bundlingEnvSupplier, out, err, args); + } + + @Override + public int run(PrintStream out, PrintStream err, String... args) { + PrintWriter outWriter = toPrintWriter(out); + PrintWriter errWriter = toPrintWriter(err); + try { + try { + return run(outWriter, errWriter, args); + } finally { + outWriter.flush(); + } + } finally { + errWriter.flush(); + } } } @@ -72,33 +104,66 @@ public final class Main { } public static void main(String... args) { - var out = new PrintWriter(System.out, true); - var err = new PrintWriter(System.err, true); + var out = toPrintWriter(System.out); + var err = toPrintWriter(System.err); System.exit(run(out, err, args)); } - public static int run(PrintWriter out, PrintWriter err, String... args) { + static int run(PrintWriter out, PrintWriter err, String... args) { + return run(DefaultBundlingEnvironmentLoader.INSTANCE, out, err, args); + } + + static int run(Supplier bundlingEnvSupplier, PrintWriter out, PrintWriter err, String... args) { + return Globals.main(() -> { + return runWithGlobals(bundlingEnvSupplier, out, err, args); + }); + } + + private static int runWithGlobals( + Supplier bundlingEnvSupplier, + PrintWriter out, + PrintWriter err, + String... args) { + + Objects.requireNonNull(bundlingEnvSupplier); + Objects.requireNonNull(args); + for (String arg : args) { + Objects.requireNonNull(arg); + } Objects.requireNonNull(out); Objects.requireNonNull(err); - Log.setPrintWriter(out, err); + Globals.instance().loggerOutputStreams(out, err); + + final var runner = new Runner(t -> { + new ErrorReporter(_ -> { + t.printStackTrace(err); + }, Log::fatalError, Log.isVerbose()).reportError(t); + }); try { - try { - args = CommandLine.parse(args); - } catch (FileNotFoundException|NoSuchFileException ex) { - Log.fatalError(I18N.format("ERR_CannotParseOptions", ex.getMessage())); - return 1; - } catch (IOException ex) { - throw ExceptionBox.rethrowUnchecked(ex); + var mappedArgs = Slot.createEmpty(); + + int preprocessStatus = runner.run(() -> { + try { + mappedArgs.set(CommandLine.parse(args)); + return List.of(); + } catch (FileNotFoundException | NoSuchFileException ex) { + return List.of(new JPackageException(I18N.format("ERR_CannotParseOptions", ex.getMessage()), ex)); + } catch (IOException ex) { + return List.of(ex); + } + }); + + if (preprocessStatus != 0) { + return preprocessStatus; } - final var bundlingEnv = ServiceLoader.load(CliBundlingEnvironment.class, - CliBundlingEnvironment.class.getClassLoader()).findFirst().orElseThrow(); + final var bundlingEnv = bundlingEnvSupplier.get(); - final var parseResult = Utils.buildParser(OperatingSystem.current(), bundlingEnv).create().apply(args); + final var parseResult = Utils.buildParser(OperatingSystem.current(), bundlingEnv).create().apply(mappedArgs.get()); - return new Runner().run(() -> { + return runner.run(() -> { final var parsedOptionsBuilder = parseResult.orElseThrow(); final var options = parsedOptionsBuilder.create(); @@ -120,7 +185,7 @@ public final class Main { } if (VERBOSE.containsIn(options)) { - Log.setVerbose(); + Globals.instance().loggerVerbose(); } final var optionsProcessor = new OptionsProcessor(parsedOptionsBuilder, bundlingEnv); @@ -144,13 +209,35 @@ public final class Main { } } + /* + * Exception (error) reporting: + * + * There are two types of exceptions to handle: + * + * 1. Exceptions explicitly thrown by jpackage code with localized, + * jpackage-specific error messages. These are usually instances of + * JPackageException. + * + * 2. Exceptions thrown by JDK code (for example, an NPE from Optional.of(...)). + * These should normally not occur or should be handled at the point + * where they arise. If they reach this level of exception handling, + * it indicates a flaw in jpackage’s internal logic. + * + * Always print stack traces for exceptions of type #2. + * Print stack traces for exceptions of type #1 only in verbose mode. + * Always print the messages for exceptions of any type. + */ - record ErrorReporter(Consumer stackTracePrinter, Consumer messagePrinter) { + record ErrorReporter(Consumer stackTracePrinter, Consumer messagePrinter, boolean verbose) { ErrorReporter { Objects.requireNonNull(stackTracePrinter); Objects.requireNonNull(messagePrinter); } + ErrorReporter(Consumer stackTracePrinter, Consumer messagePrinter) { + this(stackTracePrinter, messagePrinter, true); + } + void reportError(Throwable t) { if (t instanceof ConfigException cfgEx) { printError(cfgEx, Optional.ofNullable(cfgEx.getAdvice())); @@ -158,53 +245,74 @@ public final class Main { reportError(ex.getCause()); } else if (t instanceof UncheckedIOException ex) { reportError(ex.getCause()); + } else if (t instanceof UnexpectedResultException ex) { + printExternalCommandError(ex); } else { printError(t, Optional.empty()); } } - private void printError(Throwable t, Optional advice) { - stackTracePrinter.accept(t); + private void printExternalCommandError(UnexpectedResultException ex) { + var result = ex.getResult(); + var commandOutput = ((ExecutableAttributesWithCapturedOutput)result.execAttrs()).printableOutput(); + var printableCommandLine = result.execAttrs().printableCommandLine(); + + if (verbose) { + stackTracePrinter.accept(ex); + } String msg; - if (isAlienExceptionType(t)) { - msg = t.toString(); + if (ex instanceof UnexpectedExitCodeException) { + msg = I18N.format("error.command-failed-unexpected-exit-code", result.getExitCode(), printableCommandLine); + } else if (result.exitCode().isPresent()) { + msg = I18N.format("error.command-failed-unexpected-output", printableCommandLine); } else { + msg = I18N.format("error.command-failed-timed-out", printableCommandLine); + } + + messagePrinter.accept(I18N.format("message.error-header", msg)); + messagePrinter.accept(I18N.format("message.failed-command-output-header")); + try (var lines = new BufferedReader(new StringReader(commandOutput)).lines()) { + lines.forEach(messagePrinter); + } + } + + private void printError(Throwable t, Optional advice) { + var isSelfContained = isSelfContained(t); + + if (!isSelfContained || verbose) { + stackTracePrinter.accept(t); + } + + String msg; + if (isSelfContained) { msg = t.getMessage(); + } else { + msg = t.toString(); } messagePrinter.accept(I18N.format("message.error-header", msg)); advice.ifPresent(v -> messagePrinter.accept(I18N.format("message.advice-header", v))); } - private static boolean isAlienExceptionType(Throwable t) { - switch (t) { - case JPackageException _ -> { - return false; - } - case Utils.ParseException _ -> { - return false; - } - case StandardOption.AddLauncherIllegalArgumentException _ -> { - return false; - } - default -> { - return true; - } - } + private static boolean isSelfContained(Throwable t) { + return t.getClass().getAnnotation(SelfContainedException.class) != null; } } - static final class Runner { + record Runner(Consumer errorReporter) { + + Runner { + Objects.requireNonNull(errorReporter); + } int run(Supplier> r) { final var exceptions = runIt(r); if (exceptions.isEmpty()) { return 0; } else { - var errorReporter = new ErrorReporter(Log::verbose, Log::fatalError); - exceptions.forEach(errorReporter::reportError); + exceptions.forEach(errorReporter); return 1; } } @@ -221,4 +329,19 @@ public final class Main { private static String getVersion() { return System.getProperty("java.version"); } + + private static PrintWriter toPrintWriter(PrintStream ps) { + return new PrintWriter(ps, true, ps.charset()); + } + + private enum DefaultBundlingEnvironmentLoader implements Supplier { + INSTANCE; + + @Override + public CliBundlingEnvironment get() { + return ServiceLoader.load( + CliBundlingEnvironment.class, + CliBundlingEnvironment.class.getClassLoader()).findFirst().orElseThrow(); + } + } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionArrayValueConverter.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionArrayValueConverter.java index 401d5e15d28..9b757c29d36 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionArrayValueConverter.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionArrayValueConverter.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 @@ -29,7 +29,7 @@ package jdk.jpackage.internal.cli; * * @param option value element type */ -interface OptionArrayValueConverter extends OptionValueConverter { +interface OptionArrayValueConverter extends OptionValueConverter { /** * Splits the given string into tokens and returns the result. diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpec.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpec.java index c6aa46a6940..60674e6bdfe 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpec.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpec.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,6 +30,7 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.stream.Stream; +import jdk.jpackage.internal.util.Result; /** @@ -56,7 +57,7 @@ import java.util.stream.Stream; */ record OptionSpec( List names, - Optional> converter, + Optional> converter, Set scope, MergePolicy mergePolicy, Optional defaultOptionalValue, @@ -134,7 +135,7 @@ record OptionSpec( }); } - OptionSpec copyWithConverter(OptionValueConverter converter) { + OptionSpec copyWithConverter(OptionValueConverter converter) { if (!defaultOptionalValue.isEmpty()) { throw new UnsupportedOperationException("Can not convert an option spec with optional value"); } @@ -169,12 +170,16 @@ record OptionSpec( return valueType(converter).orElseThrow(); } + Result convert(OptionName optionName, StringToken optionValue) { + return OptionValueConverter.convertString(converter().orElseThrow(), optionName, optionValue); + } + @SuppressWarnings("unchecked") Optional> arrayValueConverter() { return converter.filter(OptionArrayValueConverter.class::isInstance).map(v -> (OptionArrayValueConverter)v); } - private static Optional> valueType(Optional> valueConverter) { + private static Optional> valueType(Optional> valueConverter) { return valueConverter.map(OptionValueConverter::valueType); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecBuilder.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecBuilder.java index e27d6472369..5eecbc9b464 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecBuilder.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecBuilder.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 @@ -24,6 +24,8 @@ */ package jdk.jpackage.internal.cli; +import static jdk.jpackage.internal.util.function.ThrowingFunction.toFunction; + import java.io.File; import java.lang.reflect.Array; import java.util.Arrays; @@ -61,22 +63,49 @@ final class OptionSpecBuilder { this.valueType = Objects.requireNonNull(valueType); } - OptionSpecBuilder(OptionSpecBuilder other) { + private OptionSpecBuilder(OptionSpecBuilder other) { valueType = other.valueType; + initFrom(other); + defaultValue = other.defaultValue; + defaultOptionalValue = other.defaultOptionalValue; + converterBuilder = other.converterBuilder.copy(); + validatorBuilder = other.validatorBuilder.copy(); + validator = other.validator; + + if (other.arrayDefaultValue != null) { + arrayDefaultValue = Arrays.copyOf(other.arrayDefaultValue, other.arrayDefaultValue.length); + } else { + arrayDefaultValue = null; + } + } + + private OptionSpecBuilder(OptionSpecBuilder other, ValueConverter converter) { + Function converterFunction = toFunction(converter::convert); + + this.valueType = converter.valueType(); + initFrom(other); + converter(other, converter); + + other.defaultValue().map(converterFunction).ifPresent(this::defaultValue); + other.defaultOptionalValue().map(converterFunction).ifPresent(this::defaultOptionalValue); + + if (other.arrayDefaultValue != null) { + arrayDefaultValue = Stream.of(other.arrayDefaultValue).map(converterFunction).toArray(length -> { + @SuppressWarnings("unchecked") + var arr = (T[])Array.newInstance(valueType, length); + return arr; + }); + } + } + + private void initFrom(OptionSpecBuilder other) { name = other.name; + nameAliases.clear(); nameAliases.addAll(other.nameAliases); description = other.description; mergePolicy = other.mergePolicy; scope = Set.copyOf(other.scope); - defaultValue = other.defaultValue; - defaultOptionalValue = other.defaultOptionalValue; valuePattern = other.valuePattern; - converterBuilder = other.converterBuilder.copy(); - validatorBuilder = other.validatorBuilder.copy(); - - if (other.arrayDefaultValue != null) { - arrayDefaultValue = Arrays.copyOf(other.arrayDefaultValue, other.arrayDefaultValue.length); - } arrayValuePatternSeparator = other.arrayValuePatternSeparator; arrayTokenizer = other.arrayTokenizer; } @@ -85,6 +114,14 @@ final class OptionSpecBuilder { return new OptionSpecBuilder<>(this); } + OptionSpecBuilder map(ValueConverter converter) { + return new OptionSpecBuilder<>(this, converter); + } + + OptionSpecBuilder map(Function, OptionSpecBuilder> mapper) { + return mapper.apply(this); + } + Class valueType() { return valueType; } @@ -135,10 +172,20 @@ final class OptionSpecBuilder { scope, OptionSpecBuilder.this.mergePolicy().orElse(MergePolicy.CONCATENATE), defaultArrayOptionalValue(), - Optional.of(arryValuePattern()), + Optional.of(arrayValuePattern()), OptionSpecBuilder.this.description().orElse("")); } + Optional> createValidator() { + return Optional.ofNullable(validator).or(() -> { + if (validatorBuilder.hasValidatingMethod()) { + return Optional.of(validatorBuilder.create()); + } else { + return Optional.empty(); + } + }); + } + OptionSpecBuilder tokenizer(String splitRegexp) { Objects.requireNonNull(splitRegexp); return tokenizer(str -> { @@ -162,11 +209,13 @@ final class OptionSpecBuilder { OptionSpecBuilder validatorExceptionFormatString(String v) { validatorBuilder.formatString(v); + validator = null; return this; } - OptionSpecBuilder validatorExceptionFormatString(UnaryOperator mutator) { - validatorBuilder.formatString(mutator.apply(validatorBuilder.formatString().orElse(null))); + OptionSpecBuilder validatorExceptionFormatString(UnaryOperator mapper) { + validatorBuilder.formatString(mapper.apply(validatorBuilder.formatString().orElse(null))); + validator = null; return this; } @@ -175,18 +224,19 @@ final class OptionSpecBuilder { return this; } - OptionSpecBuilder converterExceptionFormatString(UnaryOperator mutator) { - converterBuilder.formatString(mutator.apply(converterBuilder.formatString().orElse(null))); + OptionSpecBuilder converterExceptionFormatString(UnaryOperator mapper) { + converterBuilder.formatString(mapper.apply(converterBuilder.formatString().orElse(null))); return this; } OptionSpecBuilder validatorExceptionFactory(OptionValueExceptionFactory v) { validatorBuilder.exceptionFactory(v); + validator = null; return this; } - OptionSpecBuilder validatorExceptionFactory(UnaryOperator> mutator) { - return validatorExceptionFactory(mutator.apply(validatorBuilder.exceptionFactory().orElse(null))); + OptionSpecBuilder validatorExceptionFactory(UnaryOperator> mapper) { + return validatorExceptionFactory(mapper.apply(validatorBuilder.exceptionFactory().orElse(null))); } OptionSpecBuilder converterExceptionFactory(OptionValueExceptionFactory v) { @@ -194,49 +244,68 @@ final class OptionSpecBuilder { return this; } - OptionSpecBuilder converterExceptionFactory(UnaryOperator> mutator) { - return converterExceptionFactory(mutator.apply(converterBuilder.exceptionFactory().orElse(null))); + OptionSpecBuilder converterExceptionFactory(UnaryOperator> mapper) { + return converterExceptionFactory(mapper.apply(converterBuilder.exceptionFactory().orElse(null))); } OptionSpecBuilder exceptionFormatString(String v) { return validatorExceptionFormatString(v).converterExceptionFormatString(v); } - OptionSpecBuilder exceptionFormatString(UnaryOperator mutator) { - return validatorExceptionFormatString(mutator).converterExceptionFormatString(mutator); + OptionSpecBuilder exceptionFormatString(UnaryOperator mapper) { + return validatorExceptionFormatString(mapper).converterExceptionFormatString(mapper); } OptionSpecBuilder exceptionFactory(OptionValueExceptionFactory v) { return validatorExceptionFactory(v).converterExceptionFactory(v); } - OptionSpecBuilder exceptionFactory(UnaryOperator> mutator) { - return validatorExceptionFactory(mutator).converterExceptionFactory(mutator); + OptionSpecBuilder exceptionFactory(UnaryOperator> mapper) { + return validatorExceptionFactory(mapper).converterExceptionFactory(mapper); } - OptionSpecBuilder converter(ValueConverter v) { + OptionSpecBuilder converter(ValueConverter v) { converterBuilder.converter(v); return this; } - OptionSpecBuilder converter(Function v) { + OptionSpecBuilder converter(OptionSpecBuilder other, ValueConverter v) { + converterBuilder = other.finalizeConverterBuilder().map(v); + return this; + } + + OptionSpecBuilder interimConverter(OptionSpecBuilder other) { + converterBuilder = converterBuilder.map(other.finalizeConverterBuilder()); + return this; + } + + OptionSpecBuilder converter(ValueConverterFunction v) { return converter(ValueConverter.create(v, valueType)); } OptionSpecBuilder validator(Predicate v) { validatorBuilder.predicate(v::test); + validator = null; return this; } @SuppressWarnings("overloads") OptionSpecBuilder validator(Consumer v) { validatorBuilder.consumer(v::accept); + validator = null; return this; } @SuppressWarnings("overloads") - OptionSpecBuilder validator(UnaryOperator> mutator) { - validatorBuilder = mutator.apply(validatorBuilder); + OptionSpecBuilder validator(UnaryOperator> mapper) { + validatorBuilder = mapper.apply(validatorBuilder); + validator = null; + return this; + } + + OptionSpecBuilder validator(Validator v) { + validatorBuilder.predicate(null).consumer(null); + validator = Objects.requireNonNull(v); return this; } @@ -247,6 +316,7 @@ final class OptionSpecBuilder { OptionSpecBuilder withoutValidator() { validatorBuilder.predicate(null).consumer(null); + validator = null; return this; } @@ -279,8 +349,8 @@ final class OptionSpecBuilder { return this; } - OptionSpecBuilder scope(UnaryOperator> mutator) { - return scope(mutator.apply(scope().orElseGet(Set::of))); + OptionSpecBuilder scope(UnaryOperator> mapper) { + return scope(mapper.apply(scope().orElseGet(Set::of))); } OptionSpecBuilder inScope(OptionScope... v) { @@ -400,10 +470,12 @@ final class OptionSpecBuilder { } private Optional defaultValuePattern() { - return converterBuilder.converter().map(_ -> { + if (converterBuilder.hasConverter()) { final var tokens = name.split("-"); - return tokens[tokens.length - 1]; - }); + return Optional.of(tokens[tokens.length - 1]); + } else { + return Optional.empty(); + } } private List names() { @@ -413,25 +485,21 @@ final class OptionSpecBuilder { ).flatMap(Collection::stream).map(OptionName::new).distinct().toList(); } - private Optional> createConverter() { - if (converterBuilder.converter().isPresent()) { - final var newBuilder = converterBuilder.copy(); - createValidator().ifPresent(newBuilder::validator); - return Optional.of(newBuilder.create()); + private Optional> createConverter() { + if (converterBuilder.hasConverter()) { + return Optional.of(finalizeConverterBuilder().create()); } else { return Optional.empty(); } } - private Optional> createValidator() { - if (validatorBuilder.hasValidatingMethod()) { - return Optional.of(validatorBuilder.create()); - } else { - return Optional.empty(); - } + private OptionValueConverter.Builder finalizeConverterBuilder() { + final var newBuilder = converterBuilder.copy(); + createValidator().ifPresent(newBuilder::validator); + return newBuilder; } - private OptionValueConverter createArrayConverter() { + private OptionValueConverter createArrayConverter() { final var newBuilder = converterBuilder.copy(); newBuilder.tokenizer(Optional.ofNullable(arrayTokenizer).orElse(str -> { return new String[] { str }; @@ -440,7 +508,7 @@ final class OptionSpecBuilder { return newBuilder.createArray(); } - private String arryValuePattern() { + private String arrayValuePattern() { final var elementValuePattern = OptionSpecBuilder.this.valuePattern().orElseThrow(); if (arrayValuePatternSeparator == null) { return elementValuePattern; @@ -468,6 +536,7 @@ final class OptionSpecBuilder { private String valuePattern; private OptionValueConverter.Builder converterBuilder = OptionValueConverter.build(); private Validator.Builder validatorBuilder = Validator.build(); + private Validator validator; private T[] arrayDefaultValue; private String arrayValuePatternSeparator; diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecMapperOptionScope.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecMapperOptionScope.java index ec781e107ea..42ed704ec6e 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecMapperOptionScope.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecMapperOptionScope.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 @@ -25,11 +25,17 @@ package jdk.jpackage.internal.cli; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Objects; +import java.util.Optional; +import java.util.SequencedMap; import java.util.Set; import java.util.function.BiConsumer; import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.stream.Stream; +import jdk.jpackage.internal.util.IdentityWrapper; import jdk.jpackage.internal.util.SetBuilder; /** @@ -42,9 +48,9 @@ import jdk.jpackage.internal.util.SetBuilder; * varies depending on the current OS. * * @param the type of option value - * @param the type of context + * @param the type of context */ -interface OptionSpecMapperOptionScope extends OptionScope { +sealed interface OptionSpecMapperOptionScope extends OptionScope { OptionSpec createOptionSpec(U context, boolean createArray); @@ -52,7 +58,7 @@ interface OptionSpecMapperOptionScope extends OptionScope { @SuppressWarnings("unchecked") static OptionSpec mapOptionSpec(OptionSpec optionSpec, U context) { - return optionSpec.scope().stream() + var mappedOptionSpec = optionSpec.scope().stream() .filter(OptionSpecMapperOptionScope.class::isInstance) .map(OptionSpecMapperOptionScope.class::cast) .filter(scope -> { @@ -62,6 +68,25 @@ interface OptionSpecMapperOptionScope extends OptionScope { return ((OptionSpecMapperOptionScope)scope).createOptionSpec( context, optionSpec.arrayValueConverter().isPresent()); }).orElse(optionSpec); + + Optional valueType = optionSpec.converter().map(OptionValueConverter::valueType); + Optional mappedValueType = mappedOptionSpec.converter().map(OptionValueConverter::valueType); + + while (!mappedValueType.equals(valueType)) { + // Source and mapped option specs have different option value types. + if (Stream.of(valueType, mappedValueType).anyMatch(Optional::isEmpty) && + Stream.of(valueType, mappedValueType) + .filter(Optional::isPresent).map(Optional::get) + .anyMatch(Predicate.isEqual(Boolean.class))) { + // One option spec doesn't have a converter and another has a converter of type `Boolean`. + // They are compatible, let it pass. + break; + } + + throw new IllegalStateException(String.format("Bad option spec mapping from %s to %s", valueType, mappedValueType)); + } + + return mappedOptionSpec; } static Consumer> createOptionSpecBuilderMutator( @@ -94,24 +119,24 @@ interface OptionSpecMapperOptionScope extends OptionScope { var contextOptionScope = scope.stream() .filter(AccumulatingContextOptionScope.class::isInstance) - .map(AccumulatingContextOptionScope.class::cast) + .map(v -> { + @SuppressWarnings("unchecked") + var tv = (AccumulatingContextOptionScope)v; + return tv; + }) .filter(s -> { return s.contextType().equals(contextType); }) .findFirst(); + contextOptionScope.ifPresent(v -> { - @SuppressWarnings("unchecked") - var mutators = (AccumulatingContextOptionScope)v; - mutators.addMutator(optionSpecBuilderMutator); - if (optionSpecBuilder != mutators.optionSpecBuilder) { - throw new IllegalArgumentException(); - } + v.addMutator(optionSpecBuilder, optionSpecBuilderMutator); }); if (contextOptionScope.isEmpty()) { - var mutators = new AccumulatingContextOptionScope(optionSpecBuilder, contextType); - mutators.addMutator(optionSpecBuilderMutator); - scope = SetBuilder.build(OptionScope.class).add(scope).add(mutators).create(); + var mutators = new AccumulatingContextOptionScope(contextType); + mutators.addMutator(optionSpecBuilder, optionSpecBuilderMutator); + scope = SetBuilder.build().add(scope).add(mutators).create(); } return scope; @@ -119,23 +144,24 @@ interface OptionSpecMapperOptionScope extends OptionScope { private static final class AccumulatingContextOptionScope implements OptionSpecMapperOptionScope { - AccumulatingContextOptionScope(OptionSpecBuilder optionSpecBuilder, Class contextType) { - this.optionSpecBuilder = Objects.requireNonNull(optionSpecBuilder); + AccumulatingContextOptionScope(Class contextType) { this.contextType = Objects.requireNonNull(contextType); } @SuppressWarnings("unchecked") @Override public OptionSpec createOptionSpec(U context, boolean createArray) { - var copy = optionSpecBuilder.copy(); - for (var mutator : optionSpecBuilderMutators) { - mutator.accept(copy, context); + var it = builders.values().iterator(); + + var builder = it.next().initBuilder(context, Optional.empty()); + while (it.hasNext()) { + builder = it.next().initBuilder(context, Optional.of(builder)); } if (createArray) { - return (OptionSpec)copy.createArrayOptionSpec(); + return (OptionSpec)builder.createArrayOptionSpec(); } else { - return copy.createOptionSpec(); + return (OptionSpec)builder.createOptionSpec(); } } @@ -144,14 +170,43 @@ interface OptionSpecMapperOptionScope extends OptionScope { return contextType; } - void addMutator(BiConsumer, U> mutator) { - optionSpecBuilderMutators.add(mutator); + void addMutator(OptionSpecBuilder builder, BiConsumer, U> mutator) { + @SuppressWarnings("unchecked") + var builderWithMutators = ((OptionSpecBuilderWithMutators)builders.computeIfAbsent(new IdentityWrapper<>(builder), _ -> { + return new OptionSpecBuilderWithMutators(builder); + })); + + builderWithMutators.addMutator(mutator); } - private final OptionSpecBuilder optionSpecBuilder; private final Class contextType; - private final List, U>> optionSpecBuilderMutators = new ArrayList<>(); + private final SequencedMap>, OptionSpecBuilderWithMutators> builders = new LinkedHashMap<>(); } + private static final class OptionSpecBuilderWithMutators { + + OptionSpecBuilderWithMutators(OptionSpecBuilder builder) { + this.builder = Objects.requireNonNull(builder); + } + + OptionSpecBuilder initBuilder(U context, Optional> other) { + Objects.requireNonNull(context); + Objects.requireNonNull(other); + + var copy = builder.copy(); + other.ifPresent(copy::interimConverter); + for (var mutator : mutators) { + mutator.accept(copy, context); + } + return copy; + } + + void addMutator(BiConsumer, U> mutator) { + mutators.add(Objects.requireNonNull(mutator)); + } + + private final OptionSpecBuilder builder; + private final List, U>> mutators = new ArrayList<>(); + } } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionValueConverter.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionValueConverter.java index 8544853d584..7e249ca1508 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionValueConverter.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionValueConverter.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 @@ -35,28 +35,35 @@ import jdk.jpackage.internal.cli.Validator.ParsedValue; import jdk.jpackage.internal.util.Result; /** - * Defines creating an option value of type {@link T} from a string. + * Defines creating an option value of type {@link U} from value of type {@link T}. * - * @param option value type + * @param input option value type + * @param output option value type */ -interface OptionValueConverter { +interface OptionValueConverter { /** - * Converts the given string value corresponding to the given option name into a - * Java type. + * Converts the given value of type {@link T} corresponding to the given option name + * and option string value to an object of type {@link U}. * * @param optionName the option name - * @param optionValue the string value of the option to convert + * @param optionValue the string value of the option + * @param value the value of the option to convert * @return the conversion result + * @throws ConverterException if internal converter error occurs */ - Result convert(OptionName optionName, StringToken optionValue); + Result convert(OptionName optionName, StringToken optionValue, T value) throws ConverterException; /** * Gives the class of the type of values this converter converts to. * * @return the target class for conversion */ - Class valueType(); + Class valueType(); + + static Result convertString(OptionValueConverter converter, OptionName optionName, StringToken optionValue) { + return converter.convert(optionName, optionValue, optionValue.value()); + } /** * Thrown to indicate an error in the normal execution of the converter. @@ -74,54 +81,78 @@ interface OptionValueConverter { return new Builder<>(); } + static final class Builder { private Builder() { + this(new OneStepBackend<>(new StepBuilder<>(true))); + } + + private Builder(Backend backend) { + this.backend = Objects.requireNonNull(backend); } private Builder(Builder other) { - converter = other.converter; - validator = other.validator; + backend = other.backend.copy(); tokenizer = other.tokenizer; - formatString = other.formatString; - exceptionFactory = other.exceptionFactory; } Builder copy() { return new Builder<>(this); } - OptionValueConverter create() { - return new DefaultOptionValueConverter<>( - converter, - formatString().orElseGet(() -> { - if (exceptionFactory == null) { - return ""; - } else { - return null; - } - }), - exceptionFactory().orElseGet(() -> { - if (formatString == null) { - return OptionValueExceptionFactory.unreachable(); - } else { - return null; - } - }), - validator()); + Builder map(ValueConverter converter) { + Objects.requireNonNull(converter); + return new Builder<>(new TwoStepBackend<>( + backend, + new StepBuilder(false).converter(converter))).tokenizer(tokenizer); + } + + Builder map(Builder other) { + Objects.requireNonNull(other); + switch (backend) { + case OneStepBackend _ -> { + throw new UnsupportedOperationException(); + } + case TwoStepBackend b -> { + var fromInterimValueType = other.backend.valueType().orElseThrow(); + var toInterimValueType = b.interimValueType(); + if (fromInterimValueType.equals(toInterimValueType)) { + @SuppressWarnings("unchecked") + var twoStepBackend = (TwoStepBackend)b; + return new Builder<>(new TwoStepBackend<>( + other.backend, + twoStepBackend.otherConvBuilder())).tokenizer(tokenizer); + } else { + throw new IllegalArgumentException(String.format( + "Expected (%s); actual (%s)", toInterimValueType, fromInterimValueType)); + } + } + } + } + + OptionValueConverter create() { + return backend.create(); } OptionArrayValueConverter createArray() { return new DefaultOptionArrayValueConverter<>(create(), tokenizer); } - Builder converter(ValueConverter v) { - converter = v; + Builder converter(ValueConverter v) { + switch (backend) { + case OneStepBackend b -> { + b.stringConvBuilder().converter(v); + } + case TwoStepBackend _ -> { + throw new UnsupportedOperationException(); + } + } return this; } Builder validator(Validator v) { - validator = v; + backend.validator(v); return this; } @@ -131,12 +162,12 @@ interface OptionValueConverter { } Builder formatString(String v) { - formatString = v; + backend.formatString(v); return this; } Builder exceptionFactory(OptionValueExceptionFactory v) { - exceptionFactory = v; + backend.exceptionFactory(v); return this; } @@ -145,12 +176,30 @@ interface OptionValueConverter { return this; } - Optional> converter() { - return Optional.ofNullable(converter); + boolean hasConverter() { + switch (backend) { + case OneStepBackend b -> { + return b.stringConvBuilder().converter().isPresent(); + } + case TwoStepBackend _ -> { + return true; + } + } } Optional> validator() { - return Optional.ofNullable(validator); + return backend.validator(); + } + + Optional> converter() { + switch (backend) { + case OneStepBackend b -> { + return b.stringConvBuilder().converter(); + } + case TwoStepBackend _ -> { + throw new UnsupportedOperationException(); + } + } } Optional> tokenizer() { @@ -158,68 +207,15 @@ interface OptionValueConverter { } Optional formatString() { - return Optional.ofNullable(formatString); + return backend.formatString(); } Optional> exceptionFactory() { - return Optional.ofNullable(exceptionFactory); + return backend.exceptionFactory(); } - private record DefaultOptionValueConverter(ValueConverter converter, String formatString, - OptionValueExceptionFactory exceptionFactory, - Optional> validator) implements OptionValueConverter { - - DefaultOptionValueConverter { - Objects.requireNonNull(converter); - Objects.requireNonNull(formatString); - Objects.requireNonNull(exceptionFactory); - Objects.requireNonNull(validator); - } - - @Override - public Result convert(OptionName optionName, StringToken optionValue) { - Objects.requireNonNull(optionName); - - final T convertedValue; - try { - convertedValue = converter.convert(optionValue.value()); - } catch (Exception ex) { - return handleException(optionName, optionValue, ex); - } - - final List validationExceptions = validator.map(val -> { - try { - return val.validate(optionName, ParsedValue.create(convertedValue, optionValue)); - } catch (Validator.ValidatorException ex) { - // All unexpected exceptions that the converter yields should be tunneled via ConverterException. - throw new ConverterException(ex.getCause()); - } - }).orElseGet(List::of); - - if (validationExceptions.isEmpty()) { - return Result.ofValue(convertedValue); - } else { - return Result.ofErrors(validationExceptions); - } - } - - @Override - public Class valueType() { - return converter.valueType(); - } - - private Result handleException(OptionName optionName, StringToken optionValue, Exception ex) { - if (ex instanceof IllegalArgumentException) { - return Result.ofError(exceptionFactory.create(optionName, optionValue, formatString, Optional.of(ex))); - } else { - throw new ConverterException(ex); - } - } - } - - - private record DefaultOptionArrayValueConverter(OptionValueConverter elementConverter, + private record DefaultOptionArrayValueConverter(OptionValueConverter elementConverter, Function tokenizer) implements OptionArrayValueConverter { DefaultOptionArrayValueConverter { @@ -229,14 +225,18 @@ interface OptionValueConverter { @SuppressWarnings("unchecked") @Override - public Result convert(OptionName optionName, StringToken optionValue) { + public Result convert(OptionName optionName, StringToken optionValue, String value) { + + if (!value.equals(optionValue.value())) { + throw new IllegalArgumentException(); + } final List exceptions = new ArrayList<>(); final List convertedValues = new ArrayList<>(); final var tokens = tokenize(optionValue.value()); for (var token : tokens) { - final var result = elementConverter.convert(optionName, StringToken.of(optionValue.value(), token)); + final var result = elementConverter.convert(optionName, StringToken.of(optionValue.value(), token), token); exceptions.addAll(result.errors()); if (exceptions.isEmpty()) { result.value().ifPresent(convertedValues::add); @@ -264,10 +264,311 @@ interface OptionValueConverter { } } - private ValueConverter converter; - private Validator validator; + + private record TwoStepOptionValueConverter(OptionValueConverter stringConverter, + OptionValueConverter converter) implements OptionValueConverter { + + TwoStepOptionValueConverter { + Objects.requireNonNull(stringConverter); + Objects.requireNonNull(converter); + } + + @Override + public Result convert(OptionName optionName, StringToken optionValue, String value) { + final var interimResult = stringConverter.convert(optionName, optionValue, value); + return interimResult.flatMap(interimValue -> { + return converter.convert(optionName, optionValue, interimValue); + }); + } + + @Override + public Class valueType() { + return converter.valueType(); + } + } + + + private sealed interface Backend { + + OptionValueConverter create(); + + Backend copy(); + + void validator(Validator v); + + void formatString(String v); + + void exceptionFactory(OptionValueExceptionFactory v); + + Optional> valueType(); + + Optional> validator(); + + Optional formatString(); + + Optional> exceptionFactory(); + } + + + private record OneStepBackend(StepBuilder stringConvBuilder) implements Backend { + + OneStepBackend { + Objects.requireNonNull(stringConvBuilder); + } + + @Override + public Backend copy() { + return new OneStepBackend<>(stringConvBuilder.copy()); + } + + @Override + public OptionValueConverter create() { + return stringConvBuilder.create(); + } + + @Override + public void validator(Validator v) { + stringConvBuilder.validator(v); + } + + @Override + public void formatString(String v) { + stringConvBuilder.formatString(v); + } + + @Override + public void exceptionFactory(OptionValueExceptionFactory v) { + stringConvBuilder.exceptionFactory(v); + } + + @Override + public Optional> valueType() { + return stringConvBuilder.converter().map(ValueConverter::valueType); + } + + @Override + public Optional> validator() { + return stringConvBuilder.validator(); + } + + @Override + public Optional formatString() { + return stringConvBuilder.formatString(); + } + + @Override + public Optional> exceptionFactory() { + return stringConvBuilder.exceptionFactory(); + } + } + + + private record TwoStepBackend(Backend stringConvBuilder, StepBuilder otherConvBuilder) implements Backend { + + TwoStepBackend { + Objects.requireNonNull(stringConvBuilder); + Objects.requireNonNull(otherConvBuilder); + } + + Class interimValueType() { + return stringConvBuilder.valueType().orElseThrow(); + } + + @Override + public Backend copy() { + return new TwoStepBackend<>(stringConvBuilder.copy(), otherConvBuilder.copy()); + } + + @Override + public OptionValueConverter create() { + return new TwoStepOptionValueConverter<>(stringConvBuilder.create(), otherConvBuilder.create()); + } + + @Override + public void validator(Validator v) { + otherConvBuilder.validator(v); + } + + @Override + public void formatString(String v) { + otherConvBuilder.formatString(v); + } + + @Override + public void exceptionFactory(OptionValueExceptionFactory v) { + otherConvBuilder.exceptionFactory(v); + } + + @Override + public Optional> valueType() { + return otherConvBuilder.converter().map(ValueConverter::valueType); + } + + @Override + public Optional> validator() { + return otherConvBuilder.validator(); + } + + @Override + public Optional formatString() { + return otherConvBuilder.formatString(); + } + + @Override + public Optional> exceptionFactory() { + return otherConvBuilder.exceptionFactory(); + } + } + + + private static final class StepBuilder { + + private StepBuilder(boolean starter) { + this.starter = starter; + } + + private StepBuilder(StepBuilder other) { + starter = other.starter; + converter = other.converter; + validator = other.validator; + formatString = other.formatString; + exceptionFactory = other.exceptionFactory; + } + + StepBuilder copy() { + return new StepBuilder<>(this); + } + + OptionValueConverter create() { + return new DefaultOptionValueConverter<>( + converter, + formatString().orElseGet(() -> { + if (exceptionFactory == null) { + return ""; + } else { + return null; + } + }), + exceptionFactory().orElseGet(() -> { + if (formatString == null) { + return OptionValueExceptionFactory.unreachable(); + } else { + return null; + } + }), + validator(), + starter); + } + + StepBuilder converter(ValueConverter v) { + converter = v; + return this; + } + + StepBuilder validator(Validator v) { + validator = v; + return this; + } + + StepBuilder formatString(String v) { + formatString = v; + return this; + } + + StepBuilder exceptionFactory(OptionValueExceptionFactory v) { + exceptionFactory = v; + return this; + } + + Optional> converter() { + return Optional.ofNullable(converter); + } + + Optional> validator() { + return Optional.ofNullable(validator); + } + + Optional formatString() { + return Optional.ofNullable(formatString); + } + + Optional> exceptionFactory() { + return Optional.ofNullable(exceptionFactory); + } + + + private record DefaultOptionValueConverter( + ValueConverter converter, + String formatString, + OptionValueExceptionFactory exceptionFactory, + Optional> validator, + boolean starter) implements OptionValueConverter { + + DefaultOptionValueConverter { + Objects.requireNonNull(converter); + Objects.requireNonNull(formatString); + Objects.requireNonNull(exceptionFactory); + Objects.requireNonNull(validator); + } + + @Override + public Result convert(OptionName optionName, StringToken optionValue, T value) { + Objects.requireNonNull(optionName); + Objects.requireNonNull(optionValue); + Objects.requireNonNull(value); + + if (starter && !value.equals(optionValue.value())) { + throw new IllegalArgumentException(); + } + + final U convertedValue; + try { + convertedValue = converter.convert(value); + } catch (Exception ex) { + return handleException(optionName, optionValue, ex); + } + + final List validationExceptions = validator.map(val -> { + try { + return val.validate(optionName, ParsedValue.create(convertedValue, optionValue)); + } catch (Validator.ValidatorException ex) { + // All unexpected exceptions that the converter yields should be tunneled via ConverterException. + throw new ConverterException(ex.getCause()); + } + }).orElseGet(List::of); + + if (validationExceptions.isEmpty()) { + return Result.ofValue(convertedValue); + } else { + return Result.ofErrors(validationExceptions); + } + } + + @Override + public Class valueType() { + return converter.valueType(); + } + + private Result handleException(OptionName optionName, StringToken optionValue, Exception ex) { + if (ex instanceof IllegalArgumentException) { + return Result.ofError(exceptionFactory.create(optionName, optionValue, formatString, Optional.of(ex))); + } else { + throw new ConverterException(ex); + } + } + } + + + private final boolean starter; + private ValueConverter converter; + private Validator validator; + private String formatString; + private OptionValueExceptionFactory exceptionFactory; + } + + + private final Backend backend; private Function tokenizer; - private String formatString; - private OptionValueExceptionFactory exceptionFactory; } } + diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsAnalyzer.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsAnalyzer.java index 67e87d55d8b..6c32a3d1569 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsAnalyzer.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsAnalyzer.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 @@ -56,7 +56,7 @@ import jdk.jpackage.internal.model.BundlingEnvironment; import jdk.jpackage.internal.model.BundlingOperationDescriptor; import jdk.jpackage.internal.model.ConfigException; import jdk.jpackage.internal.model.JPackageException; -import jdk.jpackage.internal.model.PackageType; +import jdk.jpackage.internal.model.BundleType; /** * Analyzes jpackage command line structure. @@ -250,7 +250,7 @@ final class OptionsAnalyzer { return error("ERR_NoInstallerEntryPoint", mapFormatArguments(optionSpec)); } else { return error("ERR_InvalidTypeOption", mapFormatArguments( - optionSpec, bundlingOperation.packageTypeValue())); + optionSpec, bundlingOperation.bundleTypeValue())); } } @@ -267,30 +267,30 @@ final class OptionsAnalyzer { final var typeOption = TYPE.getOption(); return cmdline.find(typeOption).map(obj -> { - if (obj instanceof PackageType packageType) { - return packageType; + if (obj instanceof BundleType bundleType) { + return bundleType; } else { - return typeOption.spec() - .converter().orElseThrow() - .convert(typeOption.spec().name(), StringToken.of(((String[])obj)[0])) + var spec = new StandardOptionContext(os).mapOptionSpec(typeOption.spec()); + return spec + .convert(spec.name(), StringToken.of(((String[])obj)[0])) .orElseThrow(); } - }).map(packageType -> { - // Find standard bundling operations producing the given package type. + }).map(bundleType -> { + // Find standard bundling operations producing the given bundle type. var bundlingOperations = Stream.of(StandardBundlingOperation.values()).filter(op -> { - return op.packageType().equals(packageType); + return op.bundleType().equals(bundleType); }).toList(); if (bundlingOperations.isEmpty()) { // jpackage internal error: none of the standard bundling operations produce - // bundles of the `packageType`. + // bundles of the `bundleType`. throw new AssertionError(String.format( "None of the standard bundling operations produce bundles of type [%s]", - packageType)); + bundleType)); } else if (bundlingOperations.size() == 1) { return bundlingOperations.getFirst(); } else { - // Multiple standard bundling operations produce the `packageType` package type. + // Multiple standard bundling operations produce the `bundleType` bundle type. // Filter those that belong to the current OS bundlingOperations = bundlingOperations.stream().filter(op -> { return op.os().equals(OperatingSystem.current()); @@ -298,10 +298,10 @@ final class OptionsAnalyzer { if (bundlingOperations.isEmpty()) { // jpackage internal error: none of the standard bundling operations produce - // bundles of the `packageType` on the current OS. + // bundles of the `bundleType` on the current OS. throw new AssertionError(String.format( "None of the standard bundling operations produce bundles of type [%s] on %s", - packageType, OperatingSystem.current())); + bundleType, OperatingSystem.current())); } else if (bundlingOperations.size() == 1) { return bundlingOperations.getFirst(); } else if (StandardBundlingOperation.MACOS_APP_IMAGE.containsAll(bundlingOperations)) { @@ -316,7 +316,7 @@ final class OptionsAnalyzer { } } }).orElseGet(() -> { - // No package type specified, use the default bundling operation in the given environment. + // No bundle type specified, use the default bundling operation in the given environment. return env.defaultOperation().map(descriptor -> { return Stream.of(StandardBundlingOperation.values()).filter(op -> { return descriptor.equals(op.descriptor()); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsProcessor.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsProcessor.java index 1bc5c36989f..3c0eab77f8a 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsProcessor.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsProcessor.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 @@ -29,6 +29,7 @@ import static java.util.stream.Collectors.counting; import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.toMap; import static jdk.jpackage.internal.cli.Option.fromOptionSpecPredicate; +import static jdk.jpackage.internal.cli.OptionValueConverter.convertString; import static jdk.jpackage.internal.cli.StandardOption.ADDITIONAL_LAUNCHERS; import static jdk.jpackage.internal.cli.StandardOption.platformOption; @@ -87,7 +88,7 @@ final class OptionsProcessor { final var untypedOptions = optionsBuilder.create(); // Create command line structure analyzer. - final var analyzerResult = Result.create(() -> new OptionsAnalyzer(untypedOptions, bundlingEnv)); + final var analyzerResult = Result.of(() -> new OptionsAnalyzer(untypedOptions, bundlingEnv)); if (analyzerResult.hasErrors()) { // Failed to derive the bundling operation from the command line. allErrors.addAll(analyzerResult.mapErrors().errors()); @@ -380,8 +381,8 @@ final class OptionsProcessor { } @Override - public Result convert(OptionName optionName, StringToken optionValue) { - return converter.convert(optionName, optionValue).flatMap(arr -> { + public Result convert(OptionName optionName, StringToken optionValue, String value) { + return convertString(converter, optionName, optionValue).flatMap(arr -> { return Stream.of(arr).map(mapper).reduce(Result.>ofValue(new ArrayList<>()), (result, o) -> { if (Result.allHaveValues(result, o)) { return result.map(v -> { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardAppImageFileOption.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardAppImageFileOption.java index 330a650e513..2538bbf4fb4 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardAppImageFileOption.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardAppImageFileOption.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 @@ -169,15 +169,6 @@ public final class StandardAppImageFileOption { .mutate(setPlatformScope(OperatingSystem.MACOS)) .toOptionValueBuilder().id(StandardOption.MAC_APP_STORE.id()).create(); - /** - * Is an application image is signed. macOS-only. - */ - public static final OptionValue MAC_SIGNED = booleanOption("signed") - .inScope(AppImageFileOptionScope.APP) - .mutate(setPlatformScope(OperatingSystem.MACOS)) - .toOptionValueBuilder().id(StandardOption.MAC_SIGN.id()).create(); - - public static final class InvalidOptionValueException extends RuntimeException { InvalidOptionValueException(String str, Throwable t) { @@ -239,7 +230,7 @@ public final class StandardAppImageFileOption { } return strValue.map(v -> { - return spec.converter().orElseThrow().convert(spec.name(), StringToken.of(v)).orElseThrow(); + return spec.convert(spec.name(), StringToken.of(v)).orElseThrow(); }).map(v -> { return Map.entry(option, v); }); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardBundlingOperation.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardBundlingOperation.java index 988589884cc..f6fcd68a6d8 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardBundlingOperation.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardBundlingOperation.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 @@ -24,8 +24,6 @@ */ package jdk.jpackage.internal.cli; -import static jdk.jpackage.internal.model.AppImagePackageType.APP_IMAGE; - import java.util.Objects; import java.util.Optional; import java.util.Set; @@ -34,6 +32,8 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.internal.util.OperatingSystem; +import jdk.jpackage.internal.model.AppImageBundleType; +import jdk.jpackage.internal.model.BundleType; import jdk.jpackage.internal.model.BundlingOperationDescriptor; import jdk.jpackage.internal.model.PackageType; import jdk.jpackage.internal.model.StandardPackageType; @@ -44,54 +44,89 @@ import jdk.jpackage.internal.util.SetBuilder; * Standard jpackage operations. */ public enum StandardBundlingOperation implements BundlingOperationOptionScope { - CREATE_WIN_APP_IMAGE(APP_IMAGE, "^(?!(linux-|mac-|win-exe-|win-msi-))", OperatingSystem.WINDOWS), - CREATE_LINUX_APP_IMAGE(APP_IMAGE, "^(?!(win-|mac-|linux-rpm-|linux-deb-))", OperatingSystem.LINUX), - CREATE_MAC_APP_IMAGE(APP_IMAGE, "^(?!(linux-|win-|mac-dmg-|mac-pkg-))", OperatingSystem.MACOS), + CREATE_WIN_APP_IMAGE(AppImageBundleType.WIN_APP_IMAGE, "^(?!(linux-|mac-|win-exe-|win-msi-))", OperatingSystem.WINDOWS), + CREATE_LINUX_APP_IMAGE(AppImageBundleType.LINUX_APP_IMAGE, "^(?!(win-|mac-|linux-rpm-|linux-deb-))", OperatingSystem.LINUX), + CREATE_MAC_APP_IMAGE(AppImageBundleType.MAC_APP_IMAGE, "^(?!(linux-|win-|mac-dmg-|mac-pkg-))", OperatingSystem.MACOS), CREATE_WIN_EXE(StandardPackageType.WIN_EXE, "^(?!(linux-|mac-|win-msi-))", OperatingSystem.WINDOWS), CREATE_WIN_MSI(StandardPackageType.WIN_MSI, "^(?!(linux-|mac-|win-exe-))", OperatingSystem.WINDOWS), CREATE_LINUX_RPM(StandardPackageType.LINUX_RPM, "^(?!(win-|mac-|linux-deb-))", OperatingSystem.LINUX), CREATE_LINUX_DEB(StandardPackageType.LINUX_DEB, "^(?!(win-|mac-|linux-rpm-))", OperatingSystem.LINUX), CREATE_MAC_PKG(StandardPackageType.MAC_PKG, "^(?!(linux-|win-|mac-dmg-))", OperatingSystem.MACOS), CREATE_MAC_DMG(StandardPackageType.MAC_DMG, "^(?!(linux-|win-|mac-pkg-))", OperatingSystem.MACOS), - SIGN_MAC_APP_IMAGE(APP_IMAGE, OperatingSystem.MACOS, "sign"); + SIGN_MAC_APP_IMAGE(AppImageBundleType.MAC_APP_IMAGE, OperatingSystem.MACOS, Verb.SIGN); - StandardBundlingOperation(PackageType packageType, String optionNameRegexp, OperatingSystem os, String descriptorVerb) { - this.packageType = Objects.requireNonNull(packageType); + /** + * Supported values of the {@link BundlingOperationDescriptor#verb()} property. + */ + private enum Verb { + CREATE(BundlingOperationDescriptor.VERB_CREATE_BUNDLE), + SIGN("sign"), + ; + + Verb(String value) { + this.value = Objects.requireNonNull(value); + } + + String value() { + return value; + } + + boolean createBundle() { + return this == CREATE; + } + + private final String value; + } + + StandardBundlingOperation(BundleType bundleType, String optionNameRegexp, OperatingSystem os, Verb descriptorVerb) { + this.bundleType = Objects.requireNonNull(bundleType); optionNamePredicate = Pattern.compile(optionNameRegexp).asPredicate(); this.os = Objects.requireNonNull(os); this.descriptorVerb = Objects.requireNonNull(descriptorVerb); } - StandardBundlingOperation(PackageType packageType, String optionNameRegexp, OperatingSystem os) { - this(packageType, optionNameRegexp, os, "create"); + StandardBundlingOperation(BundleType bundleType, String optionNameRegexp, OperatingSystem os) { + this(bundleType, optionNameRegexp, os, Verb.CREATE); } - StandardBundlingOperation(PackageType packageType, OperatingSystem os, String descriptorVerb) { - this.packageType = Objects.requireNonNull(packageType); + StandardBundlingOperation(BundleType bundleType, OperatingSystem os, Verb descriptorVerb) { + this.bundleType = Objects.requireNonNull(bundleType); optionNamePredicate = v -> false; this.os = Objects.requireNonNull(os); this.descriptorVerb = Objects.requireNonNull(descriptorVerb); } - OperatingSystem os() { + public OperatingSystem os() { return os; } - public String packageTypeValue() { - if (packageType.equals(APP_IMAGE)) { + public String bundleTypeValue() { + if (bundleType instanceof AppImageBundleType) { return "app-image"; } else { - return ((StandardPackageType)packageType).suffix().substring(1); + return ((StandardPackageType)bundleType).suffix().substring(1); } } + public BundleType bundleType() { + return bundleType; + } + public PackageType packageType() { - return packageType; + return (PackageType)bundleType(); + } + + /** + * Returns {@code true} if this bundling operation will create a new bundle and + * {@code false} otherwise. + */ + public boolean isCreateBundle() { + return descriptorVerb.createBundle(); } @Override public BundlingOperationDescriptor descriptor() { - return new BundlingOperationDescriptor(os(), packageTypeValue(), descriptorVerb); + return new BundlingOperationDescriptor(os(), bundleTypeValue(), descriptorVerb.value()); } public static Optional valueOf(BundlingOperationDescriptor descriptor) { @@ -101,10 +136,17 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { }).findFirst(); } - static Stream ofPlatform(OperatingSystem os) { + public static Stream ofPlatform(OperatingSystem os) { return Stream.of(values()).filter(platform(os)); } + public static Predicate platform(OperatingSystem os) { + Objects.requireNonNull(os); + return op -> { + return op.os() == os; + }; + } + static Set fromOptionName(String optionName) { Objects.requireNonNull(optionName); return Stream.of(StandardBundlingOperation.values()).filter(v -> { @@ -112,13 +154,6 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { }).collect(Collectors.toUnmodifiableSet()); } - static Predicate platform(OperatingSystem os) { - Objects.requireNonNull(os); - return op -> { - return op.os() == os; - }; - } - static Stream narrow(Stream scope) { return scope.filter(StandardBundlingOperation.class::isInstance).map(StandardBundlingOperation.class::cast); } @@ -145,8 +180,8 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { static final Set LINUX = LINUX_CREATE_BUNDLE; - static final Set MACOS = SetBuilder.build( - BundlingOperationOptionScope.class).add(MACOS_CREATE_BUNDLE).add(SIGN_MAC_APP_IMAGE).create(); + static final Set MACOS = SetBuilder.build( + ).add(MACOS_CREATE_BUNDLE).add(SIGN_MAC_APP_IMAGE).create(); static final Set MACOS_APP_IMAGE = Set.of( SIGN_MAC_APP_IMAGE, CREATE_MAC_APP_IMAGE); @@ -168,6 +203,6 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { private final Predicate optionNamePredicate; private final OperatingSystem os; - private final PackageType packageType; - private final String descriptorVerb; + private final BundleType bundleType; + private final Verb descriptorVerb; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java index 6de3b7e5c5c..fedb55116a3 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.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 @@ -37,6 +37,7 @@ import static jdk.jpackage.internal.cli.StandardOptionValueExceptionFactory.ERRO import static jdk.jpackage.internal.cli.StandardOptionValueExceptionFactory.forMessageWithOptionValueAndName; import static jdk.jpackage.internal.cli.StandardValueConverter.addLauncherShortcutConv; import static jdk.jpackage.internal.cli.StandardValueConverter.booleanConv; +import static jdk.jpackage.internal.cli.StandardValueConverter.explodedPathConverter; import static jdk.jpackage.internal.cli.StandardValueConverter.identityConv; import static jdk.jpackage.internal.cli.StandardValueConverter.mainLauncherShortcutConv; import static jdk.jpackage.internal.cli.StandardValueConverter.pathConv; @@ -44,22 +45,27 @@ import static jdk.jpackage.internal.cli.StandardValueConverter.uuidConv; import java.nio.file.Path; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.function.Consumer; +import java.util.function.Function; import java.util.function.Predicate; import java.util.function.UnaryOperator; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; import jdk.internal.util.OperatingSystem; +import jdk.jpackage.internal.model.AppImageBundleType; +import jdk.jpackage.internal.model.BundleType; import jdk.jpackage.internal.model.BundlingOperationDescriptor; import jdk.jpackage.internal.model.JPackageException; import jdk.jpackage.internal.model.LauncherShortcut; import jdk.jpackage.internal.model.LauncherShortcutStartupDirectory; -import jdk.jpackage.internal.model.PackageType; +import jdk.jpackage.internal.util.RootedPath; +import jdk.jpackage.internal.model.SelfContainedException; import jdk.jpackage.internal.util.SetBuilder; /** @@ -103,23 +109,26 @@ public final class StandardOption { public static final OptionValue VERBOSE = auxilaryOption("verbose").create(); - public static final OptionValue TYPE = option("type", PackageType.class).addAliases("t") + public static final OptionValue TYPE = option("type", BundleType.class).addAliases("t") .scope(StandardBundlingOperation.values()).inScope(NOT_BUILDING_APP_IMAGE) .converterExceptionFactory(ERROR_WITH_VALUE).converterExceptionFormatString("ERR_InvalidInstallerType") .converter(str -> { - Objects.requireNonNull(str); - return Stream.of(StandardBundlingOperation.values()).filter(bundlingOperation -> { - return bundlingOperation.packageTypeValue().equals(str); - }).map(StandardBundlingOperation::packageType).findFirst().orElseThrow(IllegalArgumentException::new); + return parseBundleType(str, OperatingSystem.current()); }) .description("help.option.type" + resourceKeySuffix(OperatingSystem.current())) .mutate(createOptionSpecBuilderMutator((b, context) -> { b.description("help.option.type" + resourceKeySuffix(context.os())); + b.converter(str -> { + return parseBundleType(str, context.os()); + }); })).create(); - public static final OptionValue INPUT = directoryOption("input").addAliases("i") + public static final OptionValue> INPUT = directoryOption("input").addAliases("i") .outOfScope(NOT_BUILDING_APP_IMAGE) - .create(); + .map(explodedPathOptionMapper(explodedPathConverter().create())) + .create(optionValueBuilder -> { + return optionValueBuilder.to(List::of).create(); + }); public static final OptionValue DEST = directoryOption("dest").addAliases("d") .valuePattern("destination path") @@ -190,16 +199,17 @@ public final class StandardOption { .inScope(LauncherProperty.VALUE) .createArray(toList()); - public static final OptionValue> APP_CONTENT = pathOption("app-content") + public static final OptionValue>> APP_CONTENT = existingPathOption("app-content") .tokenizer(",") .valuePattern("additional content") .outOfScope(NOT_BUILDING_APP_IMAGE) + .map(explodedPathOptionMapper(explodedPathConverter().withPathFileName().create())) .mutate(createOptionSpecBuilderMutator((b, context) -> { if (context.os() == OperatingSystem.MACOS) { b.description("help.option.app-content" + resourceKeySuffix(context.os())); } })) - .createArray(toList()); + .createArray(toExplodedPathList()); static final OptionValue FILE_ASSOCIATIONS_INTERNAL = fileOption("file-associations") .tokenizer(pathSeparator()) @@ -233,6 +243,12 @@ public final class StandardOption { .mutate(createOptionSpecBuilderMutator((b, context) -> { if (context.os() == OperatingSystem.MACOS) { b.description("help.option.app-image" + resourceKeySuffix(context.os())); + var directoryValidator = b.createValidator().orElseThrow(); + var macBundleValidator = b + .validatorExceptionFormatString("error.parameter-not-mac-bundle") + .validator(StandardValidator.IS_VALID_MAC_BUNDLE) + .createValidator().orElseThrow(); + b.validator(Validator.and(directoryValidator, macBundleValidator)); } })) .create(); @@ -315,10 +331,11 @@ public final class StandardOption { // MacOS-specific // - public static final OptionValue> MAC_DMG_CONTENT = pathOption("mac-dmg-content") + public static final OptionValue>> MAC_DMG_CONTENT = existingPathOption("mac-dmg-content") .valuePattern("additional content path") .tokenizer(",") - .createArray(toList()); + .map(explodedPathOptionMapper(explodedPathConverter().withPathFileName().create())) + .createArray(toExplodedPathList()); public static final OptionValue MAC_SIGN = booleanOption("mac-sign").scope(MAC_SIGNING).addAliases("s").create(); @@ -504,12 +521,57 @@ public final class StandardOption { static Consumer> directoryOptionMutator() { return builder -> { builder.mutate(pathOptionMutator()) + .mutate(createOptionSpecBuilderMutator((b, context) -> { + context.asFileSource().ifPresent(propertyFile -> { + b.validatorExceptionFactory(forMessageWithOptionValueAndName(propertyFile)); + b.validatorExceptionFormatString("error.properties-parameter-not-directory"); + }); + })) .validator(StandardValidator.IS_DIRECTORY) .validatorExceptionFactory(ERROR_WITH_VALUE_AND_OPTION_NAME) .validatorExceptionFormatString("error.parameter-not-directory"); }; } + static Consumer> existingPathOptionMutator() { + + return builder -> { + builder.mutate(pathOptionMutator()) + .validator(createExistingPathValidator(Validator.build().exceptionFactory(ERROR_WITH_VALUE_AND_OPTION_NAME), true)) + .mutate(createOptionSpecBuilderMutator((b, context) -> { + context.asFileSource().ifPresent(propertyFile -> { + var validatorBuilder = Validator.build(); + validatorBuilder.exceptionFactory(forMessageWithOptionValueAndName(propertyFile)); + b.validator(createExistingPathValidator(validatorBuilder, false)); + }); + })); + }; + } + + private static Validator createExistingPathValidator(Validator.Builder builder, boolean cmdline) { + + if (cmdline) { + builder.formatString("error.parameter-not-directory"); + } else { + builder.formatString("error.properties-parameter-not-directory"); + } + + var isDirectoryValidator = builder.predicate(StandardValidator.IS_DIRECTORY).create(); + + if (cmdline) { + builder.formatString("error.parameter-not-file"); + } else { + builder.formatString("error.properties-parameter-not-file"); + } + + var isFileValidator = builder.predicate(StandardValidator.IS_FILE_OR_SYMLINK).create(); + + @SuppressWarnings("unchecked") + var validator = (Validator)isDirectoryValidator.or(isFileValidator); + + return validator; + } + static Consumer> booleanOptionMutator() { return builder -> { builder.mutate(createOptionSpecBuilderMutator((b, context) -> { @@ -537,13 +599,37 @@ public final class StandardOption { }; } + static Function, OptionSpecBuilder> explodedPathOptionMapper(ValueConverter conv) { + Objects.requireNonNull(conv); + return builder -> { + return builder.map(conv) + .converterExceptionFactory(ERROR_WITH_VALUE_AND_OPTION_NAME) + .converterExceptionFormatString("error.path-parameter-ioexception") + // Add empty mutator to OptionSpecMapperOptionScope to make + // mapped option spec have `RootedPath[]` type. + // Otherwise, it will have `Path` type. + .mutate(createOptionSpecBuilderMutator((b, context) -> { + })); + }; + } + + private static Function, OptionValue>>> toExplodedPathList() { + return builder -> { + return builder.to((RootedPath[][] v) -> { + return Stream.of(v).map(arr -> { + return (Collection)List.of(arr); + }).toList(); + }).create(); + }; + } + private static OptionSpecBuilder option(String name, Class valueType) { return OptionSpecBuilder.create(valueType) .name(Objects.requireNonNull(name)) .description("help.option." + name) .scope(fromOptionName(name)) .scope(scope -> { - return SetBuilder.build(OptionScope.class) + return SetBuilder.build() .add(scope) .add(BundlingOperationModifier.values()) .create(); @@ -565,6 +651,10 @@ public final class StandardOption { return option(name, Path.class).mutate(pathOptionMutator()); } + private static OptionSpecBuilder existingPathOption(String name) { + return option(name, Path.class).mutate(existingPathOptionMutator()); + } + private static OptionSpecBuilder fileOption(String name) { return option(name, Path.class) .valuePattern("file path") @@ -615,8 +705,7 @@ public final class StandardOption { } private static OptionValue createAddLauncherOption(String name) { - OptionValueConverter propertyFileConverter = fileOption(name) - .create().getSpec().converter().orElseThrow(); + var propertyFileSpec = fileOption(name).create().getSpec(); return option(name, AdditionalLauncher.class) .valuePattern("=") @@ -648,7 +737,7 @@ public final class StandardOption { final Path propertyFile; try { - propertyFile = propertyFileConverter.convert(OptionName.of(name), + propertyFile = propertyFileSpec.convert(OptionName.of(name), StringToken.of(value, components[1])).orElseThrow(); } catch (JPackageException ex) { throw new AddLauncherInvalidPropertyFileException(I18N.format( @@ -659,6 +748,23 @@ public final class StandardOption { }).defaultArrayValue(new AdditionalLauncher[0]).createArray(); } + private static BundleType parseBundleType(String str, OperatingSystem appImageOS) { + Objects.requireNonNull(str); + Objects.requireNonNull(appImageOS); + + return Stream.of(StandardBundlingOperation.values()).filter(bundlingOperation -> { + return bundlingOperation.bundleTypeValue().equals(str); + }) + .filter(bundlingOperation -> { + // Skip app image bundle type if it is from another platform. + return !(bundlingOperation.bundleType() instanceof AppImageBundleType) + || (bundlingOperation.os() == appImageOS); + }) + .map(StandardBundlingOperation::bundleType) + .findFirst() + .orElseThrow(IllegalArgumentException::new); + } + private static String resourceKeySuffix(OperatingSystem os) { switch (os) { case LINUX -> { @@ -677,6 +783,7 @@ public final class StandardOption { } + @SelfContainedException static class AddLauncherIllegalArgumentException extends IllegalArgumentException { AddLauncherIllegalArgumentException(String message) { @@ -727,8 +834,15 @@ public final class StandardOption { // // regexp for parsing args (for example, for additional launchers) - private static Pattern pattern = Pattern.compile( - "(?:(?:([\"'])(?:\\\\\\1|.)*?(?:\\1|$))|(?:\\\\[\"'\\s]|[^\\s]))++"); + private static Pattern PATTERN = Pattern.compile(String.format( + "(?:(?:%s|%s)|(?:\\\\[\"'\\s]|\\S))++", + createPatternComponent('\''), + createPatternComponent('\"'))); + + private static String createPatternComponent(char quoteChar) { + var str = Character.toString(quoteChar); + return String.format("(?:%s(?:\\\\%s|[^%s])*+(?:%s|$))", str, str, str, str); + } static List getArgumentList(String inputString) { Objects.requireNonNull(inputString); @@ -741,7 +855,7 @@ public final class StandardOption { // The "pattern" regexp attempts to abide to the rule that // strings are delimited by whitespace unless surrounded by // quotes, then it is anything (including spaces) in the quotes. - Matcher m = pattern.matcher(inputString); + Matcher m = PATTERN.matcher(inputString); while (m.find()) { String s = inputString.substring(m.start(), m.end()).trim(); // Ensure we do not have an empty string. trim() will take care of diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValidator.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValidator.java index 0038740f9df..cfa97439592 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValidator.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValidator.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 @@ -38,6 +38,7 @@ import java.util.function.Consumer; import java.util.function.Predicate; import jdk.jpackage.internal.cli.Validator.ValidatingConsumerException; import jdk.jpackage.internal.util.FileUtils; +import jdk.jpackage.internal.util.MacBundle; final public class StandardValidator { @@ -138,6 +139,10 @@ final public class StandardValidator { return true; }; + public static Predicate IS_VALID_MAC_BUNDLE = path -> { + return MacBundle.fromPath(path).isPresent(); + }; + public static final class DirectoryListingIOException extends RuntimeException { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValueConverter.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValueConverter.java index 3a310166fa8..b1e1189654d 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValueConverter.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValueConverter.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 @@ -25,11 +25,15 @@ package jdk.jpackage.internal.cli; +import java.io.IOException; +import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.util.UUID; +import java.util.function.Function; import jdk.jpackage.internal.model.LauncherShortcut; import jdk.jpackage.internal.model.ParseUtils; +import jdk.jpackage.internal.util.RootedPath; final class StandardValueConverter { @@ -37,33 +41,59 @@ final class StandardValueConverter { private StandardValueConverter() { } - static ValueConverter identityConv() { + static ValueConverter identityConv() { return IDENTITY_CONV; } - static ValueConverter pathConv() { + static ValueConverter pathConv() { return PATH_CONV; } - static ValueConverter uuidConv() { + static ValueConverter uuidConv() { return UUID_CONV; } - static ValueConverter booleanConv() { + static ValueConverter booleanConv() { return BOOLEAN_CONV; } - static ValueConverter mainLauncherShortcutConv() { + static ValueConverter mainLauncherShortcutConv() { return MAIN_LAUNCHER_SHORTCUT_CONV; } - static ValueConverter addLauncherShortcutConv() { + static ValueConverter addLauncherShortcutConv() { return ADD_LAUNCHER_SHORTCUT_CONV; } - private static final ValueConverter IDENTITY_CONV = ValueConverter.create(x -> x, String.class); + static ExplodedPathConverterBuilder explodedPathConverter() { + return new ExplodedPathConverterBuilder(); + } - private static final ValueConverter PATH_CONV = ValueConverter.create(str -> { + static final class ExplodedPathConverterBuilder { + private ExplodedPathConverterBuilder() { + } + + ValueConverter create() { + return ValueConverter.create(path -> { + return explodePath(path, withPathFileName); + }, RootedPath[].class); + } + + ExplodedPathConverterBuilder withPathFileName(boolean v) { + withPathFileName = v; + return this; + } + + ExplodedPathConverterBuilder withPathFileName() { + return withPathFileName(true); + } + + private boolean withPathFileName; + } + + private static final ValueConverter IDENTITY_CONV = ValueConverter.create(x -> x, String.class); + + private static final ValueConverter PATH_CONV = ValueConverter.create(str -> { try { return Path.of(str); } catch (InvalidPathException ex) { @@ -71,13 +101,33 @@ final class StandardValueConverter { } }, Path.class); - private static final ValueConverter UUID_CONV = ValueConverter.create(UUID::fromString, UUID.class); + private static final ValueConverter UUID_CONV = ValueConverter.create(UUID::fromString, UUID.class); - private static final ValueConverter BOOLEAN_CONV = ValueConverter.create(Boolean::valueOf, Boolean.class); + private static final ValueConverter BOOLEAN_CONV = ValueConverter.create(Boolean::valueOf, Boolean.class); - private static final ValueConverter MAIN_LAUNCHER_SHORTCUT_CONV = ValueConverter.create( + private static final ValueConverter MAIN_LAUNCHER_SHORTCUT_CONV = ValueConverter.create( ParseUtils::parseLauncherShortcutForMainLauncher, LauncherShortcut.class); - private static final ValueConverter ADD_LAUNCHER_SHORTCUT_CONV = ValueConverter.create( + private static final ValueConverter ADD_LAUNCHER_SHORTCUT_CONV = ValueConverter.create( ParseUtils::parseLauncherShortcutForAddLauncher, LauncherShortcut.class); + + private static RootedPath[] explodePath(Path path, boolean withPathFileName) throws Exception { + + Function mapper; + if (withPathFileName) { + mapper = RootedPath.toRootedPath(path.getParent()); + } else { + mapper = RootedPath.toRootedPath(path); + } + + RootedPath[] items; + try (var walk = Files.walk(path)) { + items = walk.map(mapper).toArray(RootedPath[]::new); + } catch (IOException ex) { + // IOException is not a converter error, it is a converting error, so map it into IAE. + throw new IllegalArgumentException(ex); + } + + return items; + } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Utils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Utils.java index 0565a8f1235..a94de355284 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Utils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Utils.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 @@ -32,6 +32,7 @@ import java.util.function.IntPredicate; import java.util.stream.Stream; import jdk.internal.util.OperatingSystem; import jdk.jpackage.internal.model.BundlingEnvironment; +import jdk.jpackage.internal.model.SelfContainedException; final class Utils { @@ -98,6 +99,7 @@ final class Utils { }); } + @SelfContainedException static final class ParseException extends RuntimeException { ParseException(String msg) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Validator.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Validator.java index 0ddf0e1984f..0701071b00f 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Validator.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Validator.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 @@ -24,20 +24,63 @@ */ package jdk.jpackage.internal.cli; -import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Predicate; +import java.util.stream.Stream; @FunctionalInterface interface Validator { - List validate(OptionName optionName, ParsedValue optionValue); + /** + * Validates the given option value. + * + * @param optionName the name of an option to validate + * @param optionValue the value of an option to validate + * @return the list of validation errors + * @throws ValidatorException if internal validator error occurs + */ + List validate(OptionName optionName, ParsedValue optionValue) throws ValidatorException; - default Validator andThen(Validator after) { - return reduce(this, after); + default Validator and(Validator after) { + Objects.requireNonNull(after); + var before = this; + return (optionName, optionValue) -> { + return Stream.concat( + before.validate(optionName, optionValue).stream(), + after.validate(optionName, optionValue).stream() + ).toList(); + }; + } + + default Validator or(Validator after) { + Objects.requireNonNull(after); + var before = this; + return (optionName, optionValue) -> { + var bErrors = before.validate(optionName, optionValue); + if (bErrors.isEmpty()) { + return List.of(); + } + + var aErrors = after.validate(optionName, optionValue); + if (aErrors.isEmpty()) { + return List.of(); + } + + return Stream.concat(bErrors.stream(), aErrors.stream()).toList(); + }; + } + + @SuppressWarnings("unchecked") + static Validator and(Validator first, Validator second) { + return (Validator)first.and(second); + } + + @SuppressWarnings("unchecked") + static Validator or(Validator first, Validator second) { + return (Validator)first.or(second); } /** @@ -251,15 +294,4 @@ interface Validator { } } } - - @SafeVarargs - private static Validator reduce(Validator... validators) { - @SuppressWarnings("varargs") - var theValidators = List.of(validators); - return (optionName, optionValue) -> { - return theValidators.stream().map(validator -> { - return validator.validate(optionName, optionValue); - }).flatMap(Collection::stream).map(Exception.class::cast).toList(); - }; - } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/ValueConverter.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/ValueConverter.java index ba52ca35f50..122b212d295 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/ValueConverter.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/ValueConverter.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 @@ -25,41 +25,30 @@ package jdk.jpackage.internal.cli; import java.util.Objects; -import java.util.function.Function; -interface ValueConverter { - - /** - * Converts the given string value into a Java type. - * - * @param value the string to convert - * @return the converted value - * @throws IllegalArgumentException if the given string value can not be - * converted to an object of type {@link T} - */ - T convert(String value) throws IllegalArgumentException; +interface ValueConverter extends ValueConverterFunction { /** * Gives the class of the type of values this converter converts to. * * @return the target class for conversion */ - Class valueType(); + Class valueType(); - static ValueConverter create(Function mapper, Class type) { - Objects.requireNonNull(mapper); + static ValueConverter create(ValueConverterFunction conv, Class type) { + Objects.requireNonNull(conv); Objects.requireNonNull(type); return new ValueConverter<>() { @Override - public T convert(String value) { + public U convert(T value) throws Exception { Objects.requireNonNull(value); - return Objects.requireNonNull(mapper.apply(value)); + return Objects.requireNonNull(conv.convert(value)); } @Override - public Class valueType() { + public Class valueType() { return type; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/ValueConverterFunction.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/ValueConverterFunction.java new file mode 100644 index 00000000000..28702afff75 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/ValueConverterFunction.java @@ -0,0 +1,40 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal.cli; + +@FunctionalInterface +interface ValueConverterFunction { + + /** + * Converts value of one type into another. + * + * @param value the value to convert + * @return the converted value + * @throws IllegalArgumentException if the given value can not be converted to + * an object of type {@link U} + * @throws Exception if internal converter error occurs + */ + U convert(T value) throws Exception, IllegalArgumentException; +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/AppImageBundleType.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/AppImageBundleType.java new file mode 100644 index 00000000000..c5d2f0d1569 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/AppImageBundleType.java @@ -0,0 +1,51 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal.model; + +import java.util.Objects; + +/** + * App image bundle type. + * + * @see StandardPackageType + */ +public enum AppImageBundleType implements BundleType { + + WIN_APP_IMAGE("bundle-type.win-app"), + LINUX_APP_IMAGE("bundle-type.linux-app"), + MAC_APP_IMAGE("bundle-type.mac-app"), + ; + + private AppImageBundleType(String key) { + this.key = Objects.requireNonNull(key); + } + + @Override + public String label() { + return I18N.getString(key); + } + + private final String key; +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Application.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Application.java index 943a42712c8..7860a04faac 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Application.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Application.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 @@ -25,11 +25,13 @@ package jdk.jpackage.internal.model; import java.nio.file.Path; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Stream; +import jdk.jpackage.internal.util.RootedPath; /** * A generic application for packaging. @@ -40,7 +42,7 @@ import java.util.stream.Stream; * * @see Package */ -public interface Application extends BundleSpec { +public non-sealed interface Application extends BundleSpec { /** * Gets the name of this application. @@ -78,27 +80,25 @@ public interface Application extends BundleSpec { String copyright(); /** - * Gets the source directory of this application if available or an empty - * {@link Optional} instance. + * Gets the source paths that should be copied into + * {@link ApplicationLayout#appDirectory()} directory of the image of this + * application. *

    - * Source directory is a directory with the applications's classes and other + * Source paths are supposed to contain the applications's classes and other * resources. * - * @return the source directory of this application + * @return the source paths */ - Optional srcDir(); + Collection appDirSources(); /** - * Gets the input content directories of this application. - *

    - * Contents of the content directories will be copied as-is into the dedicated - * location of the application image. + * Gets the source paths that should be copied into + * {@link ApplicationLayout#contentDirectory()} directory of the image of this + * application. * - * @see ApplicationLayout#contentDirectory - * - * @return the input content directories of this application + * @return the source paths */ - List contentDirs(); + Collection contentDirSources(); /** * Gets the unresolved app image layout of this application. @@ -244,8 +244,17 @@ public interface Application extends BundleSpec { /** * Default implementation of {@link Application} interface. */ - record Stub(String name, String description, String version, String vendor, String copyright, Optional srcDir, - List contentDirs, AppImageLayout imageLayout, Optional runtimeBuilder, - List launchers, Map extraAppImageFileData) implements Application { + record Stub( + String name, + String description, + String version, + String vendor, + String copyright, + Collection appDirSources, + Collection contentDirSources, + AppImageLayout imageLayout, + Optional runtimeBuilder, + List launchers, + Map extraAppImageFileData) implements Application { } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleSpec.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleSpec.java index d91662075e3..e6426a9c1b5 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleSpec.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleSpec.java @@ -27,5 +27,5 @@ package jdk.jpackage.internal.model; /** * A generic bundle specification. */ -public interface BundleSpec { +public sealed interface BundleSpec permits Application, Package { } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/AppImagePackageType.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleType.java similarity index 77% rename from src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/AppImagePackageType.java rename to src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleType.java index 4e28bb05aef..009725f3e92 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/AppImagePackageType.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -22,20 +22,18 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package jdk.jpackage.internal.model; -/** - * App image packaging type. - * - * @see StandardPackageType - */ -public final class AppImagePackageType implements PackageType { - private AppImagePackageType() { - } +/** + * Generic bundle type. E.g.: application image, rpm, msi are all bundle types. + */ +public sealed interface BundleType permits PackageType, AppImageBundleType { /** - * Singleton + * Returns a user-facing label of this bundle type. + * @return a user-facing label of this bundle type. */ - public static final AppImagePackageType APP_IMAGE = new AppImagePackageType(); + String label(); } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundlingOperationDescriptor.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundlingOperationDescriptor.java index 70e51c849eb..7a736d95514 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundlingOperationDescriptor.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundlingOperationDescriptor.java @@ -41,6 +41,10 @@ public record BundlingOperationDescriptor(OperatingSystem os, String bundleType, Objects.requireNonNull(verb); } + public BundlingOperationDescriptor(OperatingSystem os, String bundleType) { + this(os, bundleType, VERB_CREATE_BUNDLE); + } + @Override public String toString() { return os.name() + ":" + verb + ":" + bundleType; @@ -50,4 +54,6 @@ public record BundlingOperationDescriptor(OperatingSystem os, String bundleType, final var components = str.split(":"); return new BundlingOperationDescriptor(OperatingSystem.valueOf(components[0]), components[1], components[2]); } + + public static final String VERB_CREATE_BUNDLE = "create"; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/ExecutableAttributesWithCapturedOutput.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/ExecutableAttributesWithCapturedOutput.java new file mode 100644 index 00000000000..faed9d24d01 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/ExecutableAttributesWithCapturedOutput.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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.jpackage.internal.model; + +import java.util.List; +import java.util.Objects; +import jdk.jpackage.internal.util.CommandOutputControl.ExecutableAttributes; +import jdk.jpackage.internal.util.CommandOutputControl.Result; + +/** + * {@link ExecutableAttributes} augmented with printable command output. + */ +public record ExecutableAttributesWithCapturedOutput(ExecutableAttributes execAttrs, String printableOutput) + implements ExecutableAttributes { + + public ExecutableAttributesWithCapturedOutput { + Objects.requireNonNull(execAttrs); + Objects.requireNonNull(printableOutput); + } + + @Override + public List commandLine() { + return execAttrs.commandLine(); + } + + public static Result augmentResultWithOutput(Result result, String output) { + var execAttrs = new ExecutableAttributesWithCapturedOutput(result.execAttrs(), output); + return result.copyWithExecutableAttributes(execAttrs); + } +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/JPackageException.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/JPackageException.java index 9727f21d2d7..3d24d293f18 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/JPackageException.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/JPackageException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2025, 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 @@ -30,6 +30,7 @@ import java.util.Objects; /** * Generic jpackage exception with non-null message. */ +@SelfContainedException public class JPackageException extends RuntimeException { public JPackageException(String msg) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Package.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Package.java index 33c707b776f..ec5d6341d4d 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Package.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Package.java @@ -66,7 +66,7 @@ import java.util.Optional; * * */ -public interface Package extends BundleSpec { +public non-sealed interface Package extends BundleSpec { /** * Gets the application of this package. diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/PackageType.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/PackageType.java index d0a4fd010e6..e7273d27ba5 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/PackageType.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/PackageType.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 @@ -27,8 +27,8 @@ package jdk.jpackage.internal.model; /** - * Generic package type. E.g.: application image, rpm, msi are all package types. + * Native package type. E.g.: dmg, rpm, msi are all package types. * * @see jdk.jpackage.internal.model.Package */ -public interface PackageType {} +public non-sealed interface PackageType extends BundleType {} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/SelfContainedException.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/SelfContainedException.java new file mode 100644 index 00000000000..c7d1b3016ac --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/SelfContainedException.java @@ -0,0 +1,42 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.jpackage.internal.model; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation for exceptions with self-contained error messages that don't + * require an additional context, like exception class name or a stack trace. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Inherited +public @interface SelfContainedException { +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/StandardPackageType.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/StandardPackageType.java index ccdeceb4a04..6fadc748ecc 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/StandardPackageType.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/StandardPackageType.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 @@ -24,19 +24,22 @@ */ package jdk.jpackage.internal.model; +import java.util.Objects; + /** * Standard native package types. */ public enum StandardPackageType implements PackageType { - WIN_MSI(".msi"), - WIN_EXE(".exe"), - LINUX_DEB(".deb"), - LINUX_RPM(".rpm"), - MAC_PKG(".pkg"), - MAC_DMG(".dmg"); + WIN_MSI("bundle-type.win-msi", ".msi"), + WIN_EXE("bundle-type.win-exe", ".exe"), + LINUX_DEB("bundle-type.linux-deb", ".deb"), + LINUX_RPM("bundle-type.linux-rpm", ".rpm"), + MAC_PKG("bundle-type.mac-pkg", ".pkg"), + MAC_DMG("bundle-type.mac-dmg", ".dmg"); - StandardPackageType(String suffix) { - this.suffix = suffix; + StandardPackageType(String key, String suffix) { + this.key = Objects.requireNonNull(key); + this.suffix = Objects.requireNonNull(suffix); } /** @@ -48,5 +51,11 @@ public enum StandardPackageType implements PackageType { return suffix; } + @Override + public String label() { + return I18N.getString(key); + } + + private final String key; private final String suffix; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties index c1cb5bf4283..5b9a5728912 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties @@ -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 @@ -24,19 +24,163 @@ # # -MSG_Help=Verwendung: jpackage \n\nBeispielverwendungen:\n--------------\n Generiert ein für das Hostsystem geeignetes Anwendungspackage:\n Für eine modulare Anwendung:\n jpackage -n name -p modulePath -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Aus einem vorab erstellten Anwendungsimage:\n jpackage -n name --app-image appImageDir\n Generiert ein Anwendungsimage:\n Für eine modulare Anwendung:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Um eigene Optionen für jlink anzugeben, führen Sie jlink separat aus:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage\n Generiert ein Java Runtime-Package:\n jpackage -n name --runtime-image \n{6}\nAllgemeine Optionen:\n @ \n Liest Optionen und/oder Modus aus einer Datei \n Diese Option kann mehrmals verwendet werden.\n --type -t \n Der zu erstellende Packagetyp\n Gültige Werte: {1} \n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt.\n --app-version \n Version der Anwendung und/oder des Packages\n --copyright \n Copyright für die Anwendung\n --description \n Beschreibung der Anwendung\n --help -h \n Gibt den Verwendungstext mit einer Liste und Beschreibung jeder gültigen\n Option für die aktuelle Plattform an den Ausgabestream aus und beendet den Vorgang\n --icon \n Pfad des Symbols für das Anwendungspackage\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --name -n \n Name der Anwendung und/oder des Packages\n --dest -d \n Pfad, in den die generierte Ausgabedatei abgelegt wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Standardmäßig wird das aktuelle Arbeitsverzeichnis verwendet.\n --temp \n Pfad eines neuen oder leeren Verzeichnisses zum Erstellen temporärer Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Falls angegeben, wird das temporäre Verzeichnis beim Abschließen der Aufgabe\n nicht entfernt und muss manuell entfernt werden.\n Bei fehlender Angabe wird ein temporäres Verzeichnis erstellt und\n beim Abschließen der Aufgabe entfernt.\n --vendor \n Anbieter der Anwendung\n --verbose\n Aktiviert Ausgabe im Verbose-Modus\n --version\n Gibt die Produktversion an den Outputstream aus und beendet den Vorgang.\n\nOptionen für das Erstellen des Laufzeitimages:\n --add-modules [,...]\n Eine per Komma (",") getrennte Liste hinzuzufügender Module\n Diese Modulliste wird zusammen mit dem Hauptmodul (sofern angegeben)\n als Argument --add-module an jlink übergeben.\n Bei fehlender Angabe wird entweder nur das Hauptmodul (sofern --module\n angegeben ist) oder das Standardset an Modulen (sofern --main-jar \n angegeben ist) verwendet.\n Diese Option kann mehrmals verwendet werden.\n --module-path -p ...\n \ -Eine per {0} getrennte Pfadliste\n Jeder Pfad ist entweder ein Verzeichnis mit Modulen oder der Pfad zu einer\n JAR-Datei eines Moduls.\n (Jeder Pfad ist absolut oder relativ zum aktuellen Verzeichnis.)\n Diese Option kann mehrmals verwendet werden.\n --jlink-options \n Eine per Leerzeichen getrennte Liste mit an jlink zu übergebenden Optionen \n Bei fehlender Angabe wird standardmäßig "--strip-native-commands \n --strip-debug --no-man-pages --no-header-files" verwendet. \n Diese Option kann mehrmals verwendet werden.\n --runtime-image \n Pfad des vordefinierten Laufzeitimages, das in\n das Anwendungsimage kopiert wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Wenn --runtime-image nicht angegeben wird, führt jpackage jlink aus, um\n das Laufzeitimage mit folgenden Optionen zu erstellen:\n --strip-debug, --no-header-files, --no-man-pages und\n --strip-native-commands.\n\nOptionen für das Erstellen des Anwendungsimages:\n --input -i \n Pfad des Eingabeverzeichnisses mit den zu verpackenden Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Alle Dateien im Eingabeverzeichnis werden verpackt für das\n Anwendungsimage integriert.\n --app-content [,...]\n Eine per Komma getrennte Liste mit Pfaden zu Dateien und/oder Verzeichnissen,\n die zur Anwendungs-Payload hinzugefügt werden sollen.\n Diese Option kann mehrmals verwendet werden.\n\nOptionen für das Erstellen des Anwendungs-Launchers:\n --add-launcher =\n Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "module", "main-jar", "main-class", "description",\n "arguments", "java-options", "app-version", "icon",\n "launcher-as-service",\n "win-console", "win-shortcut", "win-menu",\n "linux-app-category" und "linux-shortcut" können verwendet werden.\n Diese Optionen werden den ursprünglichen Befehlszeilenoptionen hinzugefügt\n (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen.\n Der Hauptanwendungs-Launcher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. \n --arguments \n Befehlszeilenargumente, die an die Hauptklasse übergeben werden, falls\n keine Befehlszeilenargumente an den Launcher übergeben werden\n Diese Option kann mehrmals verwendet werden.\n --java-options \n Optionen, die an Java Runtime übergeben werden\n Diese Option kann mehrmals verwendet werden.\n --main-class \n Qualifizierter Name der auszuführenden Anwendungshauptklasse\n Diese Option kann nur bei Angabe von --main-jar verwendet werden.\n --main-jar \n Die Haupt-JAR-Datei der Anwendung, die die Hauptklasse enthält\n (angegeben als Pfad relativ zum Eingabepfad)\n Es kann entweder die Option --module oder die Option --main-jar angegeben werden, nicht jedoch\n beides.\n --module -m [/]\n Das Hauptmodul (und optional die Hauptklasse) der Anwendung\n Dieses Modul muss unter dem Modulpfad gespeichert sein.\n Bei Angabe dieser Option wird das Hauptmodul\n \ -im Java Runtime-Image verknüpft. Es kann entweder die Option --module oder die Option --main-jar\n angegeben werden, nicht jedoch beides.\n{2}\nOptionen für das Erstellen des Anwendungspackages:\n --about-url \n URL der Homepage der Anwendung\n --app-image \n {5} (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --file-associations \n Pfad zu einer Eigenschaftendatei mit einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Mit den Schlüsseln "extension", "mime-type", "icon" und "description"\n kann die Verknüpfung beschrieben werden.\n Diese Option kann mehrmals verwendet werden.\n --install-dir \n {4} --license-file \n Pfad zur Lizenzdatei\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --resource-dir \n Pfad zum Überschreiben von jpackage-Ressourcen\n Symbole, Vorlagendateien und weitere Ressourcen von jpackage können\n durch Hinzufügen von Ersetzungsressourcen zu diesem Verzeichnis überschrieben werden.\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --runtime-image \n Pfad des zu installierenden vordefinierten Laufzeitimages\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Option muss beim Erstellen eines Laufzeitpackages angegeben werden.\n --launcher-as-service\n Anforderung zum Erstellen eines Installationsprogramms, das den\n Hauptanwendungs-Launcher als Hintergrundserviceanwendung registriert.\n\nPlattformabhängige Optionen für das Erstellen des Anwendungspackages:\n{3} +help.header=Verwendung: jpackage + +help.short=Verwenden Sie jpackage --help (oder -h), um eine Liste möglicher Optionen aufzurufen + +help.option-group.sample.create-native-package=\ Generieren Sie ein Anwendungspackage, das für das Hostsystem geeignet ist:\n Für eine modulare Anwendung:\n jpackage -n name -p modulePath -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Aus einem vordefinierten Anwendungsimage:\n jpackage -n name --app-image appImageDir + +help.option-group.sample.create-app-image=\ Generieren Sie ein Anwendungspackage:\n Für eine modulare Anwendung:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Um eigene Optionen für jlink anzugeben, führen Sie jlink separat aus:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage + +help.option-group.sample.create-runtime-installer=\ Generieren Sie ein Java-Laufzeitpackage:\n jpackage -n name --runtime-image + +help.option-group.sample.sign-app-image=\ Vordefiniertes Anwendungsimage signieren:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n Hinweis: In diesem Modus sind nur die folgenden zusätzlichen Optionen zulässig:\n Das Set der zusätzlichen Mac-Signaturoptionen und --verbose + +help.option-group.sample=Beispielverwendungen +help.option-group.generic=Allgemeine Optionen +help.option-group.runtime-image=Optionen für das Erstellen des Laufzeitimages +help.option-group.app-image=Optionen für das Erstellen des Anwendungsimages +help.option-group.launcher=Optionen für das Erstellen der Anwendungslauncher: +help.option-group.launcher-platform=Plattformabhängige Option für das Erstellen des Anwendungslaunchers +help.option-group.package=Optionen für das Erstellen des Anwendungspackages +help.option-group.package-platform=Plattformabhängige Optionen für das Erstellen des Anwendungspackages + +help.option.argument-file=\ Leseoptionen und/oder -modus aus einer Datei\n Diese Option kann mehrmals verwendet werden. + +help.option.about-url=\ URL der Homepage der Anwendung + +help.option.add-launcher.win=\ Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "arguments", "description", "icon", "java-options",\n "launcher-as-service", "main-class", "main-jar", "module",\n "win-console", "win-menu" und "win-shortcut" können verwendet werden. \n Diese Optionen werden den ursprünglichen\n Befehlszeilenoptionen hinzugefügt (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen.\n Der Hauptanwendungslauncher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. + +help.option.add-launcher.linux=\ Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "arguments", "description", "icon", "java-options",\n "launcher-as-service", "linux-shortcut", "main-class", "main-jar"\n und "module" können verwendet werden. \n Diese Optionen werden den ursprünglichen Befehlszeilenoptionen hinzugefügt\n (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen. \n Der Hauptanwendungslauncher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. + +help.option.add-launcher.mac=\ Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "arguments", "description", "icon", "java-options",\n "launcher-as-service", "main-class", "main-jar"\n und "module" können verwendet werden. \n Diese Optionen werden den ursprünglichen Befehlszeilenoptionen hinzugefügt\n (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen. \n Der Hauptanwendungslauncher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. + +help.option.add-modules=\ Eine per Komma (",") getrennte Liste hinzuzufügender Module\n Diese Modulliste wird zusammen mit dem Hauptmodul (sofern angegeben)\n als Argument --add-module an jlink übergeben. \n Bei fehlender Angabe wird entweder nur das Hauptmodul (sofern --module\n angegeben ist) oder das Standardset an Modulen (sofern --main-jar\n angegeben ist) verwendet. \n Diese Option kann mehrmals verwendet werden. + +help.option.app-content=\ Eine per Komma getrennte Liste mit Pfaden zu Dateien und/oder Verzeichnissen,\n die zur Anwendungs-Payload hinzugefügt werden sollen.\n Diese Option kann mehrmals verwendet werden. + +help.option.app-content.mac=\ Eine per Komma getrennte Liste mit Pfaden zu Dateien und/oder Verzeichnissen,\n die zur Anwendungs-Payload hinzugefügt werden sollen. \n Diese Option kann mehrmals verwendet werden. \n Hinweis: Der Wert muss ein Verzeichnis mit dem Unterverzeichnis "Resources" sein\n Unterverzeichnis (oder ein anderes Verzeichnis, das im Verzeichnis "Contents"\n des Anwendungs-Bundles gültig ist). Andernfalls produziert jpackage möglicherweise ein\n ungültiges Anwendungs-Bundle, bei dem die Codesignatur und/oder Notarisierung nicht erfolgreich\n verläuft. + +help.option.app-image=\ Speicherort des vordefinierten Anwendungsimages, mit dem\n ein installierbares Package erstellt wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis) + +help.option.app-image.mac=\ Speicherort des vordefinierten Anwendungsimages, mit dem\n ein installierbares Package erstellt oder das vordefinierte\n Anwendungsimage signiert wird\n (absoluter Pfad bzw. relativ zum aktuellen Verzeichnis) + +help.option.app-version=\ Version der Anwendung und/oder des Packages + +help.option.arguments=\ Befehlszeilenargumente, die an die Hauptklasse übergeben werden, falls\n keine Befehlszeilenargumente an den Launcher übergeben werden\n Diese Option kann mehrmals verwendet werden. + +help.option.copyright=\ Copyright für die Anwendung + +help.option.description=\ Beschreibung der Anwendung + +help.option.dest=\ Pfad, in dem die generierte Ausgabedatei abgelegt wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Standardmäßig wird das aktuelle Arbeitsverzeichnis verwendet. + +help.option.file-associations=\ Pfad zu einer Eigenschaftendatei mit einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Mit den Schlüsseln "extension", "mime-type", "icon" und "description"\n kann die Verknüpfung beschrieben werden.\n Diese Option kann mehrmals verwendet werden. + +help.option.help=\ Gibt den Verwendungstext mit einer Liste und Beschreibung jeder gültigen\n Option für die aktuelle Plattform an den Outputstream aus und beendet den Vorgang + +help.option.icon=\ Pfad des Symbols für das Anwendungspackage\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis) + +help.option.input=\ Pfad des Eingabeverzeichnisses mit den zu verpackenden Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Alle Dateien im Eingabeverzeichnis werden als Package in das\n Anwendungsimage integriert. + +help.option.install-dir=\ Absoluter Pfad des Installationsverzeichnisses der Anwendung + +help.option.install-dir.win=\ Relativer Unterpfad des Installationsverzeichnisses der\n Anwendung, wie "Programme" oder "AppData". + +help.option.installer-runtime-image=\ Pfad des zu installierenden vordefinierten Laufzeitimages\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Option muss beim Erstellen eines Laufzeitpackages angegeben werden. + +help.option.java-options=\ Optionen, die an Java Runtime übergeben werden\n Diese Option kann mehrmals verwendet werden. + +help.option.jlink-options=\ Eine per Leerzeichen getrennte Liste mit an jlink zu übergebenden Optionen\n Bei fehlender Angabe wird standardmäßig "--strip-native-commands\n --strip-debug --no-man-pages --no-header-files" verwendet. \n Diese Option kann mehrmals verwendet werden. + +help.option.launcher-as-service=\ Anforderung zum Erstellen eines Installationsprogramms, das den\n Hauptanwendungslauncher als Hintergrundserviceanwendung registriert. + +help.option.license-file=\ Pfad zur Lizenzdatei\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis) + +help.option.linux-app-category=\ Gruppenwert der RPM-Datei .spec oder\n Abschnittswert der DEB-Kontrolldatei + +help.option.linux-app-release=\ Releasewert der RPM-Datei .spec oder\n Debian-Revisionswert der DEB-Kontrolldatei + +help.option.linux-deb-maintainer=\ Maintainer für DEB-Package + +help.option.linux-menu-group=\ Menügruppe, in der diese Anwendung abgelegt wird + +help.option.linux-package-deps=\ Erforderliche Packages oder Funktionen für die Anwendung + +help.option.linux-package-name=\ Name für das Linux-Package, Standardwert: Anwendungsname + +help.option.linux-rpm-license-type=\ Lizenztyp ("Lizenz: " der RPM-SPEC-Datei) + +help.option.linux-shortcut=\ Erstellt eine Verknüpfung für die Anwendung. + +help.option.mac-app-category=\ Zeichenfolge für das Erstellen von LSApplicationCategoryType in\n Anwendungs-plist. Standardwert: "utilities". + +help.option.mac-app-image-sign-identity=\ Zum Signieren des Anwendungsimages verwendete Identität. Dieser Wert wird direkt\n an die Option --sign des Tools "codesign" übergeben. Diese Option kann nicht\n mit --mac-signing-key-user-name kombiniert werden. + +help.option.mac-app-store=\ Gibt an, dass die jpackage-Ausgabe für den\n Mac App Store vorgesehen ist. + +help.option.mac-dmg-content=\ Nimmt den gesamten referenzierten Inhalt in die DMG-Datei auf.\n Diese Option kann mehrmals verwendet werden. + +help.option.mac-entitlements=\ Pfad zu einer Datei mit Berechtigungen, die beim Signieren von ausführbaren\n Dateien und Librarys im Bundle verwendet werden sollen. + +help.option.mac-installer-sign-identity=\ Zum Signieren des Installationsprogramms "pkg" verwendete Identität. Dieser Wert wird direkt\n an die Option --sign des Tools "productbuild"-übergeben. Diese Option\n kann nicht mit --mac-signing-key-user-name kombiniert werden. + +help.option.mac-package-identifier=\ Eine ID, die die Anwendung für macOS eindeutig identifiziert\n Standardwert ist der Hauptklassenname. \n Es dürfen nur alphanumerische Zeichen (A-Z, a-z, 0-9), Bindestriche (-)\n und Punkte (.) verwendet werden. + +help.option.mac-package-name=\ Name der Anwendung, wie in der Menüleiste angezeigt\n Dieser kann vom Anwendungsnamen abweichen.\n Er darf maximal 15 Zeichen enthalten und muss für die Anzeige\n in der Menüleiste und im Infofenster der Anwendung geeignet sein.\n Standardwert: Anwendungsname. + +help.option.mac-package-signing-prefix=\ Beim Signieren des Anwendungspackages wird dieser Wert\n allen zu signierenden Komponenten ohne vorhandene\n Package-ID als Präfix vorangestellt. + +help.option.mac-sign=\ Anforderung zum Signieren des Packages oder des vordefinierten\n Anwendungsimages. + +help.option.mac-signing-keychain=\ Name des Schlüsselbundes für die Suche nach der Signaturidentität\n Bei fehlender Angabe werden die Standardschlüsselbunde verwendet. + +help.option.mac-signing-key-user-name=\ Team- oder Benutzernamensteil der Apple-Signaturidentitäten. Um direkt zu steuern,\n welche Signaturidentität zum Signieren eines Anwendungsimages oder\n Installationsprogramms verwendet wird, verwenden Sie --mac-app-image-sign-identity und/oder\n --mac-installer-sign-identity. Diese Option kann nicht mit\n --mac-app-image-sign-identity oder --mac-installer-sign-identity kombiniert werden. + +help.option.main-class=\ Qualifizierter Name der auszuführenden Anwendungshauptklasse\n Diese Option kann nur bei Angabe von --main-jar verwendet werden. + +help.option.main-jar=\ Die Haupt-JAR-Datei der Anwendung, die die Hauptklasse enthält\n (angegeben als Pfad relativ zum Eingabepfad)\n Es kann entweder die Option --module oder die Option --main-jar angegeben werden, nicht jedoch\n beides. + +help.option.module=\ Das Hauptmodul (und optional die Hauptklasse) der Anwendung\n Dieses Modul muss unter dem Modulpfad gespeichert sein. \n Bei Angabe dieser Option wird das Hauptmodul\n im Java Runtime-Image verknüpft. Es kann entweder die Option --module oder die Option --main-jar\n angegeben werden, nicht jedoch beides. + +help.option.module-path=\ Eine per Doppelpunkt (:) getrennte Pfadliste\n Jeder Pfad ist entweder ein Verzeichnis mit Modulen oder der Pfad zu einer\n modularen JAR-Datei.\n (Jeder Pfad ist absolut oder relativ zum aktuellen Verzeichnis.)\n Diese Option kann mehrmals verwendet werden. +help.option.module-path.win=\ Eine per Semikolon (;) getrennte Pfadliste\n Jeder Pfad ist entweder ein Verzeichnis mit Modulen oder der Pfad zu einer\n modularen JAR-Datei.\n (Jeder Pfad ist absolut oder relativ zum aktuellen Verzeichnis.)\n Diese Option kann mehrmals verwendet werden. + +help.option.name=\ Name der Anwendung und/oder des Packages + +help.option.resource-dir=\ Pfad zum Überschreiben von jpackage-Ressourcen\n Symbole, Vorlagendateien und weitere Ressourcen von jpackage können\n durch Hinzufügen von Ersetzungsressourcen zu diesem Verzeichnis überschrieben werden.\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis) + +help.option.runtime-image=\ Pfad des vordefinierten Laufzeitimages, das in\n das Anwendungsimage kopiert wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Wenn --runtime-image nicht angegeben wird, führt jpackage jlink aus, um\n das Laufzeitimage mit folgenden Optionen zu erstellen:\n --strip-debug, --no-header-files, --no-man-pages und\n --strip-native-commands. + +help.option.temp=\ Pfad eines neuen oder leeren Verzeichnisses zum Erstellen temporärer Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Falls angegeben, wird das temporäre Verzeichnis beim Abschließen der Aufgabe\n nicht entfernt und muss manuell entfernt werden. \n Bei fehlender Angabe wird ein temporäres Verzeichnis erstellt und\n beim Abschließen der Aufgabe entfernt. + +help.option.type.win=\ Der zu erstellende Packagetyp\n Gültige Werte sind: {"app-image", "exe", "msi"}\n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt. +help.option.type.linux=\ Der zu erstellende Packagetyp\n Gültige Werte sind: {"app-image", "deb", "rpm"}\n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt. +help.option.type.mac=\ Der zu erstellende Packagetyp\n Gültige Werte sind: {"app-image", "dmg", "pkg"}\n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt. + +help.option.vendor=\ Anbieter der Anwendung + +help.option.verbose=\ Aktiviert Ausgabe im Verbose-Modus + +help.option.version=\ Gibt die Produktversion an den Outputstream aus und beendet den Vorgang. + +help.option.win-console=\ Erstellt einen Konsolenlauncher für die Anwendung. Sollte für\n Anwendungen angegeben werden, die Konsoleninteraktionen erfordern + +help.option.win-dir-chooser=\ Fügt ein Dialogfeld hinzu, in dem der Benutzer das Verzeichnis auswählen kann, in dem\n das Produkt installiert wird. + +help.option.win-help-url=\ URL, unter der der Benutzer weitere Informationen oder technische Unterstützung erhält + +help.option.win-menu=\ Anforderung zum Hinzufügen einer Startmenüverknüpfung für diese Anwendung + +help.option.win-menu-group=\ Startmenügruppe, in der diese Anwendung abgelegt wird + +help.option.win-per-user-install=\ Anforderung zum Ausführen einer Installation pro Benutzer + +help.option.win-shortcut=\ Anforderung zum Hinzufügen einer Desktopverknüpfung für diese Anwendung + +help.option.win-shortcut-prompt=\ Fügt ein Dialogfeld hinzu, in dem der Benutzer auswählen kann, ob Verknüpfungen\n vom Installationsprogramm erstellt werden. + +help.option.win-update-url=\ URL der verfügbaren Anwendungsaktualisierungsinformationen + +help.option.win-upgrade-uuid=\ UUID für Upgrades für dieses Package -MSG_Help_win_launcher=\nPlattformabhängige Option für das Erstellen des Anwendungs-Launchers:\n --win-console\n Erstellt einen Konsolen-Launcher für die Anwendung. Sollte für\n Anwendungen angegeben werden, die Konsoleninteraktionen erfordern\n -MSG_Help_win_install=\ --win-dir-chooser\n Fügt ein Dialogfeld hinzu, in dem der Benutzer das Verzeichnis auswählen kann, in dem\n das Produkt installiert wird.\n --win-help-url \n URL, unter der der Benutzer weitere Informationen oder technische Unterstützung erhält\n --win-menu\n Anforderung zum Hinzufügen einer Startmenüverknüpfung für diese Anwendung\n --win-menu-group \n Startmenügruppe, in der diese Anwendung abgelegt wird\n --win-per-user-install\n Anforderung zum Ausführen einer Installation pro Benutzer\n --win-shortcut\n Anforderung zum Hinzufügen einer Desktopverknüpfung für diese Anwendung\n --win-shortcut-prompt\n Fügt ein Dialogfeld hinzu, in dem der Benutzer auswählen kann, ob Verknüpfungen\n vom Installationsprogramm erstellt werden sollen.\n --win-update-url \n URL verfügbarer Anwendungsupdateinformationen\n --win-upgrade-uuid \n UUID, die mit Upgrades für dieses Package verknüpft ist\n -MSG_Help_win_install_dir=Relativer Unterpfad unter dem Standardinstallationsverzeichnis\n -MSG_Help_mac_install=\ --mac-dmg-content [,...]\n Nimmt den gesamten referenzierten Inhalt in die DMG-Datei auf.\n Diese Option kann mehrmals verwendet werden. \n -MSG_Help_mac_launcher=\ --mac-package-identifier \n Eine ID, die die Anwendung für macOS eindeutig identifiziert\n Standardwert ist der Hauptklassenname.\n Es dürfen nur alphanumerische Zeichen (A-Z, a-z, 0-9), Bindestriche (-)\n und Punkte (.) verwendet werden.\n --mac-package-name \n Name der Anwendung, wie in der Menüleiste angezeigt\n Dieser kann vom Anwendungsnamen abweichen.\n Er darf maximal 15 Zeichen enthalten und muss für die Anzeige\n in der Menüleiste und im Infofenster der Anwendung geeignet sein.\n Standardwert: Anwendungsname.\n --mac-package-signing-prefix \n Beim Signieren des Anwendungspackages wird dieser Wert\n allen zu signierenden Komponenten ohne vorhandene\n Package-ID als Präfix vorangestellt.\n --mac-sign\n Anforderung zum Signieren des Packages oder des vordefinierten\nAnwendungsimages\n --mac-signing-keychain \n Name des Schlüsselbundes für die Suche nach der Signaturidentität\n Bei fehlender Angabe werden die Standardschlüsselbunde verwendet.\n --mac-signing-key-user-name \n Team- oder Benutzernamensteil der Apple-Signaturidentitäten. Um direkt zu steuern,\n welche Signaturidentität zum Signieren eines Anwendungsimages oder\n Installationsprogramms verwendet wird, verwenden Sie --mac-app-image-sign-identity und/oder\n --mac-installer-sign-identity. Diese Option kann nicht mit\n --mac-app-image-sign-identity oder --mac-installer-sign-identity kombiniert werden.\n --mac-app-image-sign-identity \n Zum Signieren des Anwendungsimages verwendete Identität. Dieser Wert wird\n direkt an die Option --sign des Tools "codesign" übergeben. Diese Option kann nicht\n mit --mac-signing-key-user-name kombiniert werden.\n --mac-installer-sign-identity \n Zum Signieren des Installationsprogramms "pkg" verwendete Identität. Dieser Wert wird\n direkt an die Option --sign des Tools "productbuild" übergeben. Diese Option\n kann nicht mit --mac-signing-key-user-name kombiniert werden.\n --mac-app-store\n Gibt an, dass die jpackage-Ausgabe für den\n Mac App Store bestimmt ist.\n --mac-entitlements \n Pfad zu einer Datei mit Berechtigungen, die beim Signieren\n von ausführbaren Dateien und Librarys im Bundle verwendet werden sollen.\n --mac-app-category \n Zeichenfolge für das Erstellen von LSApplicationCategoryType in\n Anwendungs-plist. Standardwert: "utilities".\n -MSG_Help_linux_install=\ --linux-package-name \n Name für das Linux-Package, Standardwert: Anwendungsname\n --linux-deb-maintainer \n Maintainer für .deb-Package\n --linux-menu-group \n Menügruppe, in der diese Anwendung abgelegt wird\n --linux-package-deps \n Erforderliche Packages oder Funktionen für die Anwendung\n --linux-rpm-license-type \n Typ der Lizenz ("License: " der RPM-SPEC-Datei)\n --linux-app-release \n Releasewert der RPM-Datei .spec oder \n Debian-Revisionswert der DEB-Kontrolldatei\n --linux-app-category \n Gruppenwert der RPM-Datei .spec oder \n Abschnittswert der DEB-Kontrolldatei\n --linux-shortcut\n Erstellt einen Shortcut für die Anwendung.\n -MSG_Help_mac_linux_install_dir=Absoluter Pfad des Installationsverzeichnisses der Anwendung\n -MSG_Help_default_install_dir=Absoluter Pfad des Installationsverzeichnisses der Anwendung auf OS X\n oder Linux. Relativer Unterpfad des Installationsverzeichnisses der\n Anwendung wie "Programme" oder "AppData" unter Windows.\n -MSG_Help_no_args=Verwendung: jpackage \nVerwenden Sie jpackage --help (oder -h), um eine Liste möglicher Optionen aufzurufen -MSG_Help_default_app_image=Speicherort des vordefinierten Anwendungsimages, mit dem\n ein installierbares Package erstellt wird\n -MSG_Help_mac_app_image=Speicherort des vordefinierten Anwendungsimages, mit dem\n ein installierbares Package erstellt oder das vordefinierte\n Anwendungsimage signiert wird\n -MSG_Help_mac_sign_sample_usage=\ Vordefiniertes Anwendungsimage signieren:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n Hinweis: In diesem Modus sind nur die folgenden zusätzlichen Optionen zulässig:\n Das Set der zusätzlichen Mac-Signaturoptionen und --verbose\n diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties index cae6ae216d3..ca606dda9f8 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties @@ -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 @@ -24,22 +24,163 @@ # # -MSG_Help=使用方法: jpackage \n\n使用例:\n--------------\n ホスト・システムに適したアプリケーション・パッケージを生成します。\n モジュラ・アプリケーションの場合:\n jpackage -n name -p modulePath -m moduleName/className\n 非モジュラ・アプリケーションの場合:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 事前作成されたアプリケーション・イメージから:\n jpackage -n name --app-image appImageDir\n アプリケーション・イメージの生成:\n モジュラ・アプリケーションの場合:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n 非モジュラ・アプリケーションの場合:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n jlinkに独自のオプションを指定するには、jlinkを別個に実行します。\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage\n Javaランタイム・パッケージを生成します。\n jpackage -n name --runtime-image \n{6}\n一般的なオプション:\n @ \n ファイルからの読取りオプションおよびモード \n このオプションは複数回使用できます。\n --type -t \n 作成するパッケージのタイプ\n 有効な値: {1} \n このオプションが指定されていない場合、プラットフォーム依存の\n デフォルト・タイプが作成されます\n --app-version \n アプリケーションおよびパッケージのバージョン\n --copyright \n アプリケーションのコピーライト\n --description \n アプリケーションの説明\n --help -h \n 使用方法テキストと現在のプラットフォームの有効なオプションのリストと説明を\n 出力ストリームに出力して、終了します\n --icon \n アプリケーション・パッケージのアイコンのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n \ ---name -n \n アプリケーションおよびパッケージの名前\n --dest -d \n 生成された出力ファイルが配置されるパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n デフォルトは現在の作業ディレクトリです。\n --temp \n 一時ファイルの作成に使用される新規または空のディレクトリのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 指定した場合、タスク完了時に一時ディレクトリは削除されないため\n 手動で削除する必要があります\n 指定しなかった場合、一時ディレクトリが作成され\n タスク完了時に削除されます。\n --vendor \n アプリケーションのベンダー\n --verbose\n 詳細な出力を有効にします\n --version\n 製品バージョンを出力ストリームに出力して終了します\n\nランタイム・イメージを作成するためのオプション:\n --add-modules [,...]\n 追加するモジュールのカンマ(",")区切りリスト\n このモジュール・リストとメイン・モジュール(指定した場合)\n が--add-module引数としてjlinkに渡されます。\n 指定しなかった場合、メイン・モジュールのみ(--moduleが\n 指定された場合)、またはデフォルトのモジュール・セット(--main-jarが \n 指定された場合)が使用されます。\n このオプションは複数回使用できます。\n --module-path -p ...\n パスの{0}区切りリスト\n 各パスは、モジュールのディレクトリまたは\n モジュラjarへのパスです。\n (各パスは、絶対パスまたは現在のディレクトリからの相対パスです。)\n このオプションは複数回使用できます。\n --jlink-options \n jlinkに渡すオプションのスペース区切りのリスト \n 指定しない場合、"--strip-native-commands \n --strip-debug \ ---no-man-pages --no-header-files"。 \n このオプションは複数回使用できます。\n --runtime-image \n アプリケーション・イメージにコピーされる、事前定義済みのランタイム・イメージ\n のパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n --runtime-imageが指定されていない場合、jpackageはjlinkを実行し、\n 次のオプションを使用してランタイム・イメージを作成します:\n --strip-debug、--no-header-files、--no-man-pagesおよび\n --strip-native-commands。\n\nアプリケーション・イメージを作成するためのオプション:\n --input -i \n パッケージ化するファイルを含む入力ディレクトリへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 入力ディレクトリのすべてのファイルは、アプリケーション・イメージに\n パッケージ化されます。\n --app-content [,...]\n ファイルまたはディレクトリ(あるいは両方)のパスのカンマ区切りのリスト\n アプリケーション・ペイロードに追加します。\n このオプションは複数回使用できます。\n\nアプリケーション・ランチャを作成するためのオプション:\n --add-launcher =\n ランチャの名前、およびキー、値のペアのリスト\n を含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"module"、"main-jar"、"main-class"、"description"、\n "arguments"、"java-options"、"app-version"、"icon"、\n "launcher-as-service"、\n "win-console"、"win-shortcut"、"win-menu"、\n "linux-app-category"および"linux-shortcut"を使用できます。\n これらのオプションを元のコマンドライン・オプションに追加するか、これらのオプションを\n 使用して元のコマンドライン・オプションを上書きして、追加の代替ランチャを作成します。\n \ -メイン・アプリケーション・ランチャはコマンドライン・オプションから作成されます。\n このオプションを使用して追加の代替ランチャを作成でき、\n このオプションを複数回使用して\n 複数の追加のランチャを作成できます。 \n --arguments

    \n ランチャにコマンド・ライン引数が指定されていない場合にメイン・クラスに渡す\n コマンド・ライン引数\n このオプションは複数回使用できます。\n --java-options \n Javaランタイムに渡すオプション\n このオプションは複数回使用できます。\n --main-class \n 実行するアプリケーション・メイン・クラスの修飾名\n このオプションを使用できるのは、--main-jarが指定されている場合だけです。\n --main-jar
    \n メイン・クラスを含む、アプリケーションのメインJAR\n (入力パスからの相対パスとして指定)\n --moduleまたは--main-jarオプションを指定できますが、両方は\n 指定できません。\n --module -m [/
    ]\n アプリケーションのメイン・モジュール(およびオプションでメイン・クラス)\n このモジュールは、モジュール・パスに置かれている必要があります。\n このオプションが指定されている場合、メイン・モジュールは\n Javaランタイム・イメージ内でリンクされます。--moduleまたは--main-jar\n オプションを指定できますが、両方は指定できません。\n{2}\nアプリケーション・パッケージを作成するためのオプション:\n --about-url \n アプリケーションのホームページのURL\n --app-image \n {5} (絶対パスまたは現在のディレクトリからの相対パス)\n --file-associations \n キー、値のペアのリストを含むプロパティ・ファイルへのパス\n \ -(絶対パスまたは現在のディレクトリからの相対パス)\n キー"extension"、"mime-type"、"icon"、"description"\n を使用して関連付けを記述できます。\n このオプションは複数回使用できます。\n --install-dir \n {4} --license-file \n ライセンス・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n --resource-dir \n オーバーライドjpackageリソースへのパス\n アイコン、テンプレート・ファイルおよびjpackageのその他のリソースは、\n このディレクトリに置換リソースを追加することでオーバーライドできます。\n (絶対パスまたは現在のディレクトリからの相対パス)\n --runtime-image \n インストールする事前定義済みのランタイム・イメージのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n ランタイム・パッケージの作成時には、オプションが必要です。\n --launcher-as-service\n 次として登録するインストーラの作成をリクエストします: \n バックグラウンド・サービス・タイプ・アプリケーションとしてのメイン・アプリケーション・ランチャ。\n\nアプリケーション・パッケージを作成するためのプラットフォーム依存オプション:\n{3} +help.header=使用方法: jpackage + +help.short=利用可能なオプションのリストについては、jpackage --help (or -h)を使用します + +help.option-group.sample.create-native-package=\ ホスト・システムに適したアプリケーション・パッケージを生成します:\n モジュラ・アプリケーションの場合:\n jpackage -n name -p modulePath -m moduleName/className\n 非モジュラ・アプリケーションの場合:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 事前作成されたアプリケーション・イメージから:\n jpackage -n name --app-image appImageDir + +help.option-group.sample.create-app-image=\ アプリケーション・イメージの生成:\n モジュラ・アプリケーションの場合:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n 非モジュラ・アプリケーションの場合:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n jlinkに独自のオプションを指定するには、jlinkを別個に実行します:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage + +help.option-group.sample.create-runtime-installer=\ Javaランタイム・パッケージを生成します:\n jpackage -n name --runtime-image + +help.option-group.sample.sign-app-image=\ 事前定義済みアプリケーション・イメージへの署名:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n ノート: このモードで許可される唯一の追加オプション:\n 追加のmac署名オプションのセットおよび--verbose + +help.option-group.sample=使用例 +help.option-group.generic=一般的なオプション +help.option-group.runtime-image=ランタイム・イメージを作成するためのオプション +help.option-group.app-image=アプリケーション・イメージを作成するためのオプション +help.option-group.launcher=アプリケーション・ランチャを作成するためのオプション +help.option-group.launcher-platform=アプリケーション・ランチャを作成するためのプラットフォーム依存オプション +help.option-group.package=アプリケーション・パッケージを作成するためのオプション +help.option-group.package-platform=アプリケーション・パッケージを作成するためのプラットフォーム依存オプション + +help.option.argument-file=\ ファイルからの読取りオプションまたはモード(あるいはその両方)\n このオプションは複数回使用できます。 + +help.option.about-url=\ アプリケーションのホームページのURL + +help.option.add-launcher.win=\ ランチャの名前、およびキー、値のペアのリスト\n を含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"main-class"、"main-jar"、"module"、\n "win-console"、"win-menu"、"win-shortcut"が使用できます。\n これらのオプションを元のコマンドライン・オプションに追加するか、これらのオプションを\n 使用して元のコマンドライン・オプションを上書きして、追加の代替ランチャを作成します。\n メイン・アプリケーション・ランチャはコマンドライン・オプションから作成されます。\n このオプションを使用して追加の代替ランチャを作成でき、\n このオプションを複数回使用して\n 複数の追加のランチャを作成できます。 + +help.option.add-launcher.linux=\ ランチャの名前、およびキー、値のペアのリスト\n を含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"linux-shortcut"、"main-class"、"main-jar"、\n "module"が使用できます。\n これらのオプションを元のコマンドライン・オプションに追加するか、これらのオプションを\n 使用して元のコマンドライン・オプションを上書きして、追加の代替ランチャを作成します。\n メイン・アプリケーション・ランチャはコマンドライン・オプションから作成されます。\n このオプションを使用して追加の代替ランチャを作成でき、\n このオプションを複数回使用して\n 複数の追加のランチャを作成できます。 + +help.option.add-launcher.mac=\ ランチャの名前、およびキー、値のペアのリスト\n を含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"main-class"、"main-jar"、"module"\n が使用できます。\n これらのオプションを元のコマンドライン・オプションに追加するか、これらのオプションを\n 使用して元のコマンドライン・オプションを上書きして、追加の代替ランチャを作成します。\n メイン・アプリケーション・ランチャはコマンドライン・オプションから作成されます。\n このオプションを使用して追加の代替ランチャを作成でき、\n このオプションを複数回使用して\n 複数の追加のランチャを作成できます。 + +help.option.add-modules=\ 追加するモジュールのカンマ(",")区切りリスト\n このモジュール・リストとメイン・モジュール(指定した場合)\n が--add-module引数としてjlinkに渡されます。\n 指定しなかった場合、メイン・モジュールのみ(--moduleが\n 指定された場合)、またはデフォルトのモジュール・セット(--main-jarが\n 指定された場合)が使用されます。\n このオプションは複数回使用できます。 + +help.option.app-content=\ アプリケーション・ペイロードに追加するファイルまたはディレクトリ(あるいはその両方)\n のパスのカンマ区切りのリスト。\n このオプションは複数回使用できます。 + +help.option.app-content.mac=\ アプリケーション・ペイロードに追加するファイルまたはディレクトリ(あるいはその両方)\n のパスのカンマ区切りのリスト。\n このオプションは複数回使用できます。\n ノート: 値は"Resources"サブディレクトリ\n (またはアプリケーション・バンドルの"Contents"ディレクトリで有効なその他のディレクトリ)\n を含むディレクトリである必要があります。それ以外の場合は、jpackageによって無効なアプリケーション・バンドルが生成される場合があり、\n コード署名または公証(あるいはその両方)に失敗する\n 場合があります。 + +help.option.app-image=\ インストール可能なパッケージの作成に使用する、事前定義済\n アプリケーション・イメージの場所\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.app-image.mac=\ インストール可能なパッケージの作成または事前定義済\n アプリケーション・イメージの署名に使用する、事前定義済\n アプリケーション・イメージの場所\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.app-version=\ アプリケーションおよびパッケージのバージョン + +help.option.arguments=\ コマンドライン引数がランチャに指定されていない場合に、\n メイン・クラスに渡されるコマンドライン引数\n このオプションは複数回使用できます。 + +help.option.copyright=\ アプリケーションのコピーライト + +help.option.description=\ アプリケーションの説明 + +help.option.dest=\ 生成された出力ファイルが配置されるパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 現在の作業ディレクトリにデフォルト設定されています。 + +help.option.file-associations=\ キー、値のペアのリストを含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"extension"、"mime-type"、"icon"、"description"\n を使用して関連付けを記述できます。\n このオプションは複数回使用できます。 + +help.option.help=\ 使用方法テキストと現在のプラットフォームの有効なオプションのリストと説明を\n 出力ストリームに出力して、終了します + +help.option.icon=\ アプリケーション・パッケージのアイコンのパス\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.input=\ パッケージ化するファイルを含む入力ディレクトリのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 入力ディレクトリのすべてのファイルは、アプリケーション・イメージに\n パッケージ化されます。 + +help.option.install-dir=\ アプリケーションのインストール・ディレクトリの絶対パス + +help.option.install-dir.win=\ "プログラム・ファイル"または"AppData"など、\n アプリケーションのインストール場所の相対サブパス。 + +help.option.installer-runtime-image=\ インストールする事前定義済のランタイム・イメージのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n ランタイム・パッケージの作成時には、オプションが必要です。 + +help.option.java-options=\ Javaランタイムに渡すオプション\n このオプションは複数回使用できます。 + +help.option.jlink-options=\ jlinkに渡すオプションのスペース区切りのリスト\n 指定しない場合、"--strip-native-commands\n --strip-debug --no-man-pages --no-header-files"にデフォルト設定されます。\n このオプションは複数回使用できます。 + +help.option.launcher-as-service=\ バックグラウンド・サービス・タイプ・アプリケーションとしてメイン・\n アプリケーション・ランチャを登録するインストーラの作成をリクエストします。 + +help.option.license-file=\ ライセンス・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.linux-app-category=\ RPM .specファイルのグループ値または\n DEB制御ファイルのセクション値 + +help.option.linux-app-release=\ RPM .specファイルのリリース値または\n DEB制御ファイルのDebianリビジョン値 + +help.option.linux-deb-maintainer=\ .debパッケージのメンテナ + +help.option.linux-menu-group=\ このアプリケーションを配置するメニュー・グループ + +help.option.linux-package-deps=\ アプリケーションに必要なパッケージまたは機能 + +help.option.linux-package-name=\ Linuxパッケージの名前。アプリケーション名にデフォルト設定されています + +help.option.linux-rpm-license-type=\ ライセンスのタイプ(RPM .specの"License: ") + +help.option.linux-shortcut=\ アプリケーションのショートカットを作成します。 + +help.option.mac-app-category=\ アプリケーションplistのLSApplicationCategoryTypeの構築に\n 使用する文字列。デフォルト値は"utilities"です。 + +help.option.mac-app-image-sign-identity=\ アプリケーション・イメージの署名に使用するアイデンティティ。この値は直接\n "codesign"ツールの--signオプションに渡されます。このオプションは\n --mac-signing-key-user-nameと組み合せることはできません。 + +help.option.mac-app-store=\ jpackage出力がMac App Store用であること\n を示します。 + +help.option.mac-dmg-content=\ dmgに参照されたコンテンツをすべて含めます。\n このオプションは複数回使用できます。 + +help.option.mac-entitlements=\ バンドルの実行可能ファイルおよびライブラリの署名時に\n 使用する権限を含むファイルのパス。 + +help.option.mac-installer-sign-identity=\ "pkg"インストーラの署名に使用するアイデンティティ。この値は直接\n "productbuild"ツールの--signオプションに渡されます。このオプションは\n --mac-signing-key-user-nameと組み合せることはできません。 + +help.option.mac-package-identifier=\ MacOSのアプリケーションを一意に識別する識別子。\n メイン・クラス名にデフォルト設定されています。\n 英数字(A-Z、a-z、0-9)、ハイフン(-)、\n およびピリオド(.)のみを使用できます。 + +help.option.mac-package-name=\ メニュー・バーに表示されるアプリケーションの名前\n アプリケーション名とは異なります。\n この名前は16文字未満にする必要があり、メニュー・バー\n およびアプリケーション情報ウィンドウに表示するのに適している必要があります。\n アプリケーション名にデフォルト設定されています。 + +help.option.mac-package-signing-prefix=\ アプリケーション・パッケージに署名する際、既存のパッケージIDのない\n 署名が必要なすべてのコンポーネントに、\n この値が接頭辞として付けられます。 + +help.option.mac-sign=\ パッケージまたは事前定義済アプリケーション・イメージに署名するよう\n リクエストします。 + +help.option.mac-signing-keychain=\ 署名アイデンティティを検索するキーチェーンの名前\n 指定しなかった場合、標準のキーチェーンが使用されます。 + +help.option.mac-signing-key-user-name=\ Apple署名アイデンティティのチームまたはユーザー名部分。\n アプリケーション・イメージまたはインストーラの署名に使用する署名アイデンティティの\n 直接制御には、--mac-app-image-sign-identityまたは\n --mac-installer-sign-identity(あるいはその両方)を使用します。このオプションは\n --mac-app-image-sign-identityまたは--mac-installer-sign-identityと組み合せることはできません。 + +help.option.main-class=\ 実行するアプリケーション・メイン・クラスの修飾名\n このオプションを使用できるのは、--main-jarが指定されている場合だけです。 + +help.option.main-jar=\ メイン・クラスを含む、アプリケーションのメインJAR\n (入力パスからの相対パスとして指定)\n --moduleまたは--main-jarオプションを指定できますが、両方は\n 指定できません。 + +help.option.module=\ アプリケーションのメイン・モジュール(およびオプションでメイン・クラス)\n このモジュールは、モジュール・パスに置かれている必要があります。\n このオプションが指定されている場合、メイン・モジュールは\n Javaランタイム・イメージ内でリンクされます。--moduleまたは--main-jar\n オプションを指定できますが、両方は指定できません。 + +help.option.module-path=\ :で区切られたパスのリスト\n 各パスは、モジュールのディレクトリまたは\n モジュラjarへのパスです。\n (各パスは、絶対パスまたは現在のディレクトリからの相対パスです。)\n このオプションは複数回使用できます。 +help.option.module-path.win=\ ;で区切られたパスのリスト\n 各パスは、モジュールのディレクトリまたは\n モジュラjarへのパスです。\n (各パスは、絶対パスまたは現在のディレクトリからの相対パスです。)\n このオプションは複数回使用できます。 + +help.option.name=\ アプリケーションおよびパッケージの名前 + +help.option.resource-dir=\ オーバーライドjpackageリソースへのパス\n アイコン、テンプレート・ファイルおよびjpackageのその他のリソースは、\n このディレクトリに置換リソースを追加することでオーバーライドできます。\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.runtime-image=\ アプリケーション・イメージにコピーされる、事前定義済のランタイム・イメージ\n のパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n --runtime-imageが指定されていない場合、jpackageはjlinkを実行し、\n 次のオプションを使用してランタイム・イメージを作成します:\n --strip-debug、--no-header-files、--no-man-pagesおよび\n --strip-native-commands。 + +help.option.temp=\ 一時ファイルの作成に使用される新規または空のディレクトリのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 指定した場合、タスク完了時に一時ディレクトリは削除されないため\n 手動で削除する必要があります。\n 指定しなかった場合、一時ディレクトリが作成され\n タスク完了時に削除されます。 + +help.option.type.win=\ 作成するパッケージのタイプ\n 有効な値: {"app-image", "exe", "msi"}\n このオプションを指定しない場合、プラットフォーム依存の\n デフォルト・タイプが作成されます。 +help.option.type.linux=\ 作成するパッケージのタイプ\n 有効な値: {"app-image", "deb", "rpm"}\n このオプションを指定しない場合、プラットフォーム依存の\n デフォルト・タイプが作成されます。 +help.option.type.mac=\ 作成するパッケージのタイプ\n 有効な値: {"app-image", "dmg", "pkg"}\n このオプションを指定しない場合、プラットフォーム依存の\n デフォルト・タイプが作成されます。 + +help.option.vendor=\ アプリケーションのベンダー + +help.option.verbose=\ 詳細な出力を有効にします + +help.option.version=\ 製品バージョンを出力ストリームに出力して終了します + +help.option.win-console=\ アプリケーションのコンソール・ランチャを作成します。コンソール・\n インタラクションが必要なアプリケーションに指定する必要があります + +help.option.win-dir-chooser=\ 製品をインストールするディレクトリをユーザーが\n 選択できるダイアログを追加します。 + +help.option.win-help-url=\ ユーザーが詳細情報または技術サポートを取得できるURL + +help.option.win-menu=\ このアプリケーションのスタート・メニューのショートカットを追加するリクエスト + +help.option.win-menu-group=\ このアプリケーションを配置するスタート・メニュー・グループ + +help.option.win-per-user-install=\ ユーザーごとにインストールを実行するリクエスト + +help.option.win-shortcut=\ このアプリケーションのデスクトップのショートカットを追加するリクエスト + +help.option.win-shortcut-prompt=\ ショートカットをインストーラで作成するかどうかをユーザーが\n 選択できるダイアログを追加します。 + +help.option.win-update-url=\ 使用可能なアプリケーション更新情報のURL + +help.option.win-upgrade-uuid=\ このパッケージのアップグレードに関連付けられているUUID -MSG_Help_win_launcher=\nアプリケーション・ランチャを作成するためのプラットフォーム依存オプション:\n --win-console\n アプリケーションのコンソール・ランチャを作成します。コンソール・\n インタラクションが必要なアプリケーションに指定する必要があります\n -MSG_Help_win_install=\ --win-dir-chooser\n ユーザーが製品をインストールするディレクトリを選択するための\n ダイアログを追加します。\n --win-help-url \n ユーザーが詳細情報または技術的なサポートを取得できるURL\n --win-menu\n このアプリケーションのスタート・メニュー・ショートカットを追加するようにリクエストします\n --win-menu-group \n このアプリケーションを配置するスタート・メニュー・グループ\n --win-per-user-install\n ユーザーごとにインストールを実行するようにリクエストします\n --win-shortcut\n このアプリケーションのデスクトップ・ショートカットを追加するようにリクエストします\n --win-shortcut-prompt\n ショートカットをインストーラで作成するかどうかをユーザーが選択できるようにする\n ダイアログを追加します。\n --win-update-url \n 使用可能なアプリケーションの更新情報のURL\n --win-upgrade-uuid \n このパッケージのアップグレードに関連付けられたUUID\n -MSG_Help_win_install_dir=デフォルトのインストール場所の下の相対サブパス\n -MSG_Help_mac_install=\ --mac-dmg-content [,...]\n dmgに参照されたコンテンツをすべて含めます。\n このオプションは複数回使用できます。 \n -MSG_Help_mac_launcher=\ --mac-package-identifier \n macOSのアプリケーションを一意に識別するID\n メイン・クラス名にデフォルト設定されています。\n 英数字(A-Z、a-z、0-9)、ハイフン(-)およびピリオド(.)文字のみ\n 使用できます。\n --mac-package-name \n メニュー・バーに表示されるアプリケーションの名前\n アプリケーション名とは異なります。\n この名前は16文字未満にする必要があり、メニュー・バーおよびアプリケーション情報ウィンドウに\n 表示するのに適している必要があります。\n アプリケーション名にデフォルト設定されています。\n --mac-package-signing-prefix \n アプリケーション・パッケージに署名する際、\n 既存のパッケージIDのない署名が必要なすべてのコンポーネントに、\n この値が接頭辞として付けられます。\n --mac-sign\n パッケージまたは事前定義済アプリケーション・イメージに署名するよう\n リクエストします。\n --mac-signing-keychain \n 署名アイデンティティを検索するキーチェーンの名前\n 指定しなかった場合、標準のキーチェーンが使用されます。\n --mac-signing-key-user-name \n Apple署名アイデンティティのチームまたはユーザー名部分。\n アプリケーション・イメージまたはインストーラの署名に使用する署名アイデンティティの\n 直接制御には、--mac-app-image-sign-identityまたは\n --mac-installer-sign-identity(あるいは両方)を使用します。このオプションは\n --mac-app-image-sign-identityまたは--mac-installer-sign-identityと組み合せることはできません。\n --mac-app-image-sign-identity \n アプリケーション・イメージの署名に使用するアイデンティティ。この値は直接\n "codesign"ツールの--signオプションに渡されます。このオプションは\n \ ---mac-signing-key-user-nameと組み合せることはできません。\n --mac-installer-sign-identity \n "pkg"インストーラの署名に使用するアイデンティティ。この値は直接\n "productbuild"ツールの--signオプションに渡されます。このオプションは\n --mac-signing-key-user-nameと組み合せることはできません。\n --mac-app-store\n jpackage出力がMac App Store用であること\n を示します。\n --mac-entitlements \n バンドルの実行可能ファイルおよびライブラリの署名時に\n 使用する権限を含むファイルのパス。\n --mac-app-category \n アプリケーションのplistのLSApplicationCategoryTypeを生成する際に使用する文字列。\n デフォルト値は"utilities"です。\n -MSG_Help_linux_install=\ --linux-package-name \n Linuxパッケージの名前。アプリケーション名にデフォルト設定されています\n --linux-deb-maintainer \n .debパッケージのMaintainer\n --linux-menu-group \n このアプリケーションが配置されているメニュー・グループ\n --linux-package-deps \n アプリケーションに必要なパッケージまたは機能\n --linux-rpm-license-type \n ライセンスのタイプ(RPM .specの"License: ")\n --linux-app-release \n RPM .specファイルのリリース値または\n DEBコントロール・ファイルのDebianリビジョン値。\n --linux-app-category \n RPM .specファイルのグループ値または \n DEBコントロール・ファイルのセクション値\n --linux-shortcut\n アプリケーションのショートカットを作成します。\n -MSG_Help_mac_linux_install_dir=アプリケーションのインストール・ディレクトリの絶対パス\n -MSG_Help_default_install_dir=OS XまたはLinux上のアプリケーションのインストール・ディレクトリの絶対パス。\n "プログラム・ファイル"や"AppData"など、Windows上のアプリケーションの\n インストール場所の相対サブパス。\n -MSG_Help_no_args=使用方法: jpackage \n利用可能なオプションのリストについては、jpackage --help (or -h)を使用します -MSG_Help_default_app_image=インストール可能なパッケージの作成に使用する、事前定義済み\n アプリケーション・イメージの場所\n -MSG_Help_mac_app_image=インストール可能なパッケージの作成または事前定義済みアプリケーション・\n イメージへの署名に使用する、事前定義済みアプリケーション・\n イメージの場所\n -MSG_Help_mac_sign_sample_usage=\ 事前定義済みアプリケーション・イメージへの署名:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n ノート: このモードで許可される唯一の追加オプション:\n 追加のmac署名オプションのセットおよび--verbose\n diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties index 6adf62ef1f8..ac72c67ee2f 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties @@ -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 @@ -24,20 +24,163 @@ # # -MSG_Help=用法:jpackage \n\n示例用法:\n--------------\n 生成适合主机系统的应用程序包:\n 对于模块化应用程序:\n jpackage -n name -p modulePath -m moduleName/className\n 对于非模块化应用程序:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 从预构建的应用程序映像:\n jpackage -n name --app-image appImageDir\n 生成应用程序映像:\n 对于模块化应用程序:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n 对于非模块化应用程序:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 要为 jlink 提供您自己的选项,请单独运行 jlink:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage\n 生成 Java 运行时程序包:\n jpackage -n name --runtime-image \n{6}\n一般选项:\n @ \n 从文件读取选项和/或模式 \n 可以多次使用此选项。\n --type -t \n 要创建的程序包的类型\n 有效值为:{1} \n 如果未指定此选项,则将创建与平台相关的\n 默认类型。\n --app-version \n 应用程序和/或程序包的版本\n --copyright \n 应用程序的版权\n --description \n 应用程序的说明\n --help -h \n 将用法文本输出到输出流并退出,用法文本中包含\n 适用于当前平台的每个有效选项的列表和说明\n --icon \n 应用程序包图标的路径\n (绝对路径或相对于当前目录的路径)\n --name -n \n 应用程序和/或程序包的名称\n --dest -d \n 用来放置所生成的输出文件的路径\n (绝对路径或相对于当前目录的路径)\n 默认为当前的工作目录。\n --temp \n 用来创建临时文件的新目录或空白目录的路径\n (绝对路径或相对于当前目录的路径)\n 如果指定,则在任务完成时将不删除临时目录,\n 必须手动删除临时目录。\n 如果未指定,则将创建一个临时目录,\n \ -并在任务完成时删除该临时目录。\n --vendor \n 应用程序的供应商\n --verbose\n 启用详细的输出\n --version\n 将产品版本输出到输出流并退出。\n\n用来创建运行时映像的选项:\n --add-modules <模块名称>[,<模块名称>...]\n 要添加的模块的逗号 (",") 分隔列表\n 此模块列表连同主模块(如果指定)\n 将作为 --add-module 参数传递到 jlink。\n 如果未指定,则仅使用主模块(如果指定了 --module),\n 或者使用默认的模块集(如果指定了 \n --main-jar)。\n 可以多次使用此选项。\n --module-path -p ...\n 路径的 {0} 分隔列表\n 每个路径要么是模块的目录,要么是\n 模块化 jar 的路径。\n (每个路径可以是绝对路径,也可以是相对于当前目录的路径。)\n 可以多次使用此选项。\n --jlink-options \n 要传递给 jlink 的选项列表(用空格分隔) \n 如果未指定,则默认为 "--strip-native-commands \n --strip-debug --no-man-pages --no-header-files"。 \n 可以多次使用此选项。\n --runtime-image \n 将复制到应用程序映像的预定义\n 运行时映像的路径\n (绝对路径或相对于当前目录的路径)\n 如果未指定 --runtime-image,jpackage 将运行 jlink 以\n 使用如下选项创建运行时映像:\n --strip-debug、--no-header-files、--no-man-pages 和 \n --strip-native-commands。\n\n用来创建应用程序映像的选项:\n --input -i \n 包含要打包的文件的输入目录的路径\n (绝对路径或相对于当前目录的路径)\n 输入目录中的所有文件将打包到\n 应用程序映像中。\n --app-content [,...]\n 要添加到应用程序有效负载中的文件和/或\n 目录的逗号分隔路径列表。\n 此选项可以多次使用。\n\n用来创建应用程序启动程序的选项:\n --add-launcher =\n 启动程序的名称和包含关键字-值对列表的\n 属性文件的路径\n (绝对路径或相对于当前目录的路径)\n \ -可以使用关键字 "module"、"main-jar"、"main-class"、"description"、\n "arguments"、"java-options"、"app-version"、"icon"、\n "launcher-as-service"、\n "win-console"、"win-shortcut"、"win-menu"、\n "linux-app-category" 和 "linux-shortcut"。\n 这些选项将添加到原始命令行选项中或者用来覆盖\n 原始命令行选项,以构建额外的替代启动程序。\n 将从命令行选项构建主应用程序启动程序。\n 可以使用此选项构建额外的替代启动程序,\n 可以多次使用此选项来构建\n 多个额外的启动程序。 \n --arguments
    \n 在没有为启动程序提供命令行参数时,\n 要传递到主类的命令行参数\n 可以多次使用此选项。\n --java-options \n 要传递到 Java 运行时的选项\n 可以多次使用此选项。\n --main-class \n 要执行的应用程序主类的限定名称\n 只有在指定了 --main-jar 时才能使用此选项。\n --main-jar
    \n 应用程序的主 JAR;包含主类\n (指定为相对于输入路径的路径)\n 可以指定 --module 或 --main-jar 选项,但是不能同时指定\n 两者。\n --module -m [/
    ]\n 应用程序的主模块(以及可选的主类)\n 此模块必须位于模块路径中。\n 如果指定了此选项,则将在 Java 运行时映像中\n 链接主模块。可以指定 --module 或 --main-jar 选项,\n 但是不能同时指定这两个选项。\n{2}\n用来创建应用程序包的选项:\n --about-url \n 应用程序主页的 URL\n --app-image \n {5} (绝对路径或相对于当前目录的路径)\n --file-associations \n 包含关键字-值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 可以使用关键字 "extension"、"mime-type"、"icon" 和 "description" \n 来描述此关联。\n 可以多次使用此选项。\n --install-dir \n {4} --license-file \n 许可证文件的路径\n (绝对路径或相对于当前目录的路径)\n --resource-dir \n 覆盖 jpackage 资源的路径\n \ -可以通过向该目录中添加替代资源来覆盖 jpackage 的\n 图标、模板文件和其他资源。\n (绝对路径或相对于当前目录的路径)\n --runtime-image \n 要安装的预定义运行时映像的路径\n (绝对路径或相对于当前目录的路径)\n 在创建运行时程序包时需要使用选项。\n --launcher-as-service\n 请求创建安装程序,以将主\n 应用程序启动程序注册为后台服务类型应用程序。\n\n用来创建应用程序包的与平台相关的选项:\n{3} +help.header=用法:jpackage + +help.short=使用 jpackage --help(或 -h)可获取可能选项的列表 + +help.option-group.sample.create-native-package=\ 生成适用于主机系统的应用程序包:\n 对于模块化应用程序:\n jpackage -n name -p modulePath -m moduleName/className\n 对于非模块化应用程序:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 从预构建的应用程序映像:\n jpackage -n name --app-image appImageDir + +help.option-group.sample.create-app-image=\ 生成应用程序映像:\n 对于模块化应用程序:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n 对于非模块化应用程序:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 要向 jlink 提供您自己的选项,请分别运行 jlink:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage + +help.option-group.sample.create-runtime-installer=\ 生成 Java 运行时程序包:\n jpackage -n name --runtime-image + +help.option-group.sample.sign-app-image=\ 对预定义应用程序映像进行签名:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n 注:此模式下允许的其他选项只有:\n 一组其他 mac 签名选项和 --verbose + +help.option-group.sample=示例用法 +help.option-group.generic=一般选项 +help.option-group.runtime-image=用来创建运行时映像的选项 +help.option-group.app-image=用来创建应用程序映像的选项 +help.option-group.launcher=用来创建应用程序启动程序的选项 +help.option-group.launcher-platform=用来创建应用程序启动程序的平台相关选项 +help.option-group.package=用来创建应用程序包的选项 +help.option-group.package-platform=用来创建应用程序包的与平台相关的选项 + +help.option.argument-file=\ 从文件读取选项和/或模式\n 可以多次使用此选项。 + +help.option.about-url=\ 应用程序主页的 URL + +help.option.add-launcher.win=\ 启动程序的名称,以及包含\n 键值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 可以使用键 "arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"main-class"、"main-jar"、"module"、\n "win-console"、"win-menu" 和 "win-shortcut"。\n 这些选项添加到或用于覆盖原始\n 命令行选项以构建其他替代启动程序。\n 将从命令行选项构建主应用程序启动程序。\n 可以使用此选项构建其他替代启动程序,\n 并且可以多次使用此选项\n 构建多个其他启动程序。 + +help.option.add-launcher.linux=\ 启动程序的名称,以及包含\n 键值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 可以使用键 "arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"linux-shortcut"、"main-class"、"main-jar" \n 和 "module"。\n 这些选项添加到或用于覆盖原始\n 命令行选项以构建其他替代启动程序。\n 将从命令行选项构建主应用程序启动程序。\n 可以使用此选项构建其他替代启动程序,\n 并且可以多次使用此选项\n 构建多个其他启动程序。 + +help.option.add-launcher.mac=\ 启动程序的名称,以及包含\n 键值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 可以使用键 "arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"main-class"、"main-jar" 和\n "module"。\n 这些选项添加到或用于覆盖原始\n 命令行选项以构建其他替代启动程序。\n 将从命令行选项构建主应用程序启动程序。\n 可以使用此选项构建其他替代启动程序,\n 并且可以多次使用此选项\n 构建多个其他启动程序。 + +help.option.add-modules=\ 要添加的模块列表(以逗号 (",") 分隔)\n 此模块列表以及主模块(如果指定)\n 将作为 --add-module 参数传递到 jlink。\n 如果未指定,则仅使用主模块\n (如果指定 --module)或默认模块集\n (如果指定 --main-jar)。\n 可以多次使用此选项。 + +help.option.app-content=\ 要添加到应用程序有效负载中的文件\n 和/或目录路径的逗号分隔列表。\n 可以多次使用此选项。 + +help.option.app-content.mac=\ 要添加到应用程序有效负载中的文件\n 和/或目录路径的逗号分隔列表。\n 可以多次使用此选项。\n 注:该值应为具有 "Resources" 子目录的\n 目录(或应用程序包的 "Contents" 目录中\n 有效的任何其他目录)。否则,jpackage \n 可能会生成无效的应用程序包,此应用程序包\n 可能会使代码签名和/或公证失败。 + +help.option.app-image=\ 用来构建可安装程序包的\n 预定义应用程序映像的位置\n (绝对路径或相对于当前目录的路径) + +help.option.app-image.mac=\ 用来构建可安装程序包或对预定义应用程序\n 映像进行签名的预定义应用程序\n 映像的位置\n (绝对路径或相对于当前目录的路径) + +help.option.app-version=\ 应用程序和/或程序包的版本 + +help.option.arguments=\ 在没有为启动程序提供命令行参数时,\n 要传递到主类的命令行参数\n 可以多次使用此选项。 + +help.option.copyright=\ 应用程序的版权 + +help.option.description=\ 应用程序的说明 + +help.option.dest=\ 放置生成的输出文件的路径\n (绝对路径或相对于当前目录的路径)\n 默认为当前工作目录。 + +help.option.file-associations=\ 包含键值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 键 "extension"、"mime-type"、"icon" 和 "description"\n 可用于描述关联。\n 可以多次使用此选项。 + +help.option.help=\ 将用法文本输出到输出流并退出,用法文本中包含\n 适用于当前平台的每个有效选项的列表和说明 + +help.option.icon=\ 应用程序包图标的路径\n (绝对路径或相对于当前目录的路径) + +help.option.input=\ 包含要打包的文件的输入目录的路径\n (绝对路径或相对于当前目录的路径)\n 输入目录中的所有文件将打包到\n 应用程序映像中。 + +help.option.install-dir=\ 应用程序安装目录的绝对路径 + +help.option.install-dir.win=\ 应用程序安装位置的相对子路径\n 例如 "Program Files" 或 "AppData"。 + +help.option.installer-runtime-image=\ 要安装的预定义运行时映像的路径\n (绝对路径或相对于当前目录的路径)\n 创建运行时程序包时需要提供选项。 + +help.option.java-options=\ 传递到 Java 运行时的选项\n 可以多次使用此选项。 + +help.option.jlink-options=\ 要传递到 jlink 的选项列表(以空格分隔)\n 如果未指定,则默认为 "--strip-native-commands\n --strip-debug --no-man-pages --no-header-files"。\n 可以多次使用此选项。 + +help.option.launcher-as-service=\ 请求创建安装程序,以将主应用程序\n 启动程序注册为后台服务类型应用程序。 + +help.option.license-file=\ 许可证文件的路径\n (绝对路径或相对于当前目录的路径) + +help.option.linux-app-category=\ RPM .spec 文件的组值或\n DEB 控制文件的节值 + +help.option.linux-app-release=\ RPM .spec 文件的发行版值或\n DEB 控制文件的 Debian 修订版值 + +help.option.linux-deb-maintainer=\ .deb 程序包的维护程序 + +help.option.linux-menu-group=\ 此应用程序所在的菜单组 + +help.option.linux-package-deps=\ 应用程序所需的程序包或功能 + +help.option.linux-package-name=\ Linux 程序包的名称,默认为应用程序名称 + +help.option.linux-rpm-license-type=\ 许可证类型(RPM .spec 的 "License: ") + +help.option.linux-shortcut=\ 为应用程序创建快捷方式。 + +help.option.mac-app-category=\ 用于构造应用程序 plist 中的 LSApplicationCategoryType 的\n 字符串。默认值为 "utilities"。 + +help.option.mac-app-image-sign-identity=\ 用于对应用程序映像进行签名的身份。此值将\n 直接传递到 "codesign" 工具的 --sign 选项。此选项\n 不能与 --mac-signing-key-user-name 结合使用。 + +help.option.mac-app-store=\ 指示 jpackage 输出面向\n Mac App Store。 + +help.option.mac-dmg-content=\ 包括 dmg 中引用的所有内容。\n 可以多次使用此选项。 + +help.option.mac-entitlements=\ 包含对包中的可执行文件和库进行签名时\n 要使用的权利的文件路径。 + +help.option.mac-installer-sign-identity=\ 用于对 "pkg" 安装程序进行签名的身份。此值将\n 直接传递到 "productbuild" 工具的 --sign 选项。此选项\n 不能与 --mac-signing-key-user-name 结合使用。 + +help.option.mac-package-identifier=\ 唯一标识 macOS 应用程序的标识符\n 默认为主类名称。\n 只能使用字母数字 (A-Z,a-z,0-9)、连字符 (-)\n 和句点 (.) 字符。 + +help.option.mac-package-name=\ 应用程序在菜单栏中显示的名称\n 此名称可以与应用程序名称不同。\n 此名称的长度必须少于 16 个字符,并且\n 适合显示在菜单栏和应用程序“信息”窗口中。\n 默认为应用程序名称。 + +help.option.mac-package-signing-prefix=\ 对应用程序包进行签名时,此值将作为\n 前缀添加到需要签名但当前没有程序包\n 标识符的所有组件。 + +help.option.mac-sign=\ 请求对程序包或预定义的应用程序映像\n 进行签名。 + +help.option.mac-signing-keychain=\ 要用来搜索签名身份的密钥链的名称\n 如果未指定,则使用标准密钥链。 + +help.option.mac-signing-key-user-name=\ Apple 签名身份的团队或用户名称部分。为了直接\n 控制用于对应用程序映像或安装程序进行签名的\n 签名身份,请使用 --mac-app-image-sign-identity 和/或\n --mac-installer-sign-identity。此选项不能与\n --mac-app-image-sign-identity 或 --mac-installer-sign-identity 结合使用。 + +help.option.main-class=\ 要执行的应用程序主类的限定名称\n 只有在指定了 --main-jar 时才能使用此选项。 + +help.option.main-jar=\ 应用程序的主 JAR;包含主类\n (指定为相对于输入路径的路径)\n 可以指定 --module 或 --main-jar 选项,\n 但不能同时指定这两个选项。 + +help.option.module=\ 应用程序的主模块(以及可选的主类)\n 此模块必须位于模块路径中。\n 指定了此选项时,将在 Java 运行时映像中\n 链接主模块。可以指定 --module 或 --main-jar \n 选项,但不能同时指定这两个选项。 + +help.option.module-path=\ 以 : 分隔的路径列表\n 每个路径是模块的目录或\n 模块化 jar 的路径。\n (每个路径可以是绝对路径,也可以是相对于当前目录的路径。)\n 可以多次使用此选项。 +help.option.module-path.win=\ 以 ; 分隔的路径列表\n 每个路径是模块的目录或\n 模块化 jar 的路径。\n (每个路径可以是绝对路径,也可以是相对于当前目录的路径。)\n 可以多次使用此选项。 + +help.option.name=\ 应用程序和/或程序包的名称 + +help.option.resource-dir=\ 覆盖 jpackage 资源的路径\n 可以通过向此目录中添加替换资源来覆盖 jpackage 的\n 图标、模板文件和其他资源。\n (绝对路径或相对于当前目录的路径) + +help.option.runtime-image=\ 将复制到应用程序映像中的预定义\n 运行时映像的路径\n (绝对路径或相对于当前目录的路径)\n 如果未指定 --runtime-image,jpackage 将运行 jlink 以\n 使用以下选项创建运行时映像:\n --strip-debug、--no-header-files、--no-man-pages 和\n --strip-native-commands。 + +help.option.temp=\ 用于创建临时文件的新目录或空目录的路径\n (绝对路径或相对于当前目录的路径)\n 如果指定,则在任务完成时将不删除\n 临时目录,必须手动删除临时目录。\n 如果未指定,将创建临时目录并\n 并在任务完成时删除该临时目录。 + +help.option.type.win=\ 要创建的程序包的类型\n 有效值为:{"app-image", "exe", "msi"}\n 如果未指定此选项,则将创建与平台相关的\n 默认类型。 +help.option.type.linux=\ 要创建的程序包的类型\n 有效值为:{"app-image", "deb", "rpm"}\n 如果未指定此选项,则将创建与平台相关的\n 默认类型。 +help.option.type.mac=\ 要创建的程序包的类型\n 有效值为:{"app-image", "dmg", "pkg"}\n 如果未指定此选项,则将创建与平台相关的\n 默认类型。 + +help.option.vendor=\ 应用程序的供应商 + +help.option.verbose=\ 启用详细的输出 + +help.option.version=\ 将产品版本输出到输出流并退出。 + +help.option.win-console=\ 为应用程序创建控制台启动程序,应当为\n 需要控制台交互的应用程序指定 + +help.option.win-dir-chooser=\ 添加一个对话框以允许用户选择\n 产品的安装目录。 + +help.option.win-help-url=\ 用户可以从中获取更多信息或技术支持的 URL + +help.option.win-menu=\ 请求为此应用程序添加“开始”菜单快捷方式 + +help.option.win-menu-group=\ 此应用程序所在的“开始”菜单组 + +help.option.win-per-user-install=\ 请求基于每个用户执行安装 + +help.option.win-shortcut=\ 请求为此应用程序添加桌面快捷方式 + +help.option.win-shortcut-prompt=\ 添加一个对话框以允许用户选择是否将由安装程序\n 创建快捷方式。 + +help.option.win-update-url=\ 可用应用程序更新信息的 URL + +help.option.win-upgrade-uuid=\ 与此程序包的升级关联的 UUID -MSG_Help_win_launcher=\n用来创建应用程序启动程序的与平台相关的选项:\n --win-console\n 为应用程序创建控制台启动程序,应当为\n 需要控制台交互的应用程序指定\n -MSG_Help_win_install=\ --win-dir-chooser\n 添加一个对话框以允许用户选择\n 产品的安装目录。\n --win-help-url \n 用户可以从中获取更多信息或技术支持的 URL\n --win-menu\n 请求为此应用程序添加开始菜单快捷方式\n --win-menu-group \n 此应用程序所在的开始菜单组\n --win-per-user-install\n 请求基于每个用户执行安装\n --win-shortcut\n 请求为此应用程序添加桌面快捷方式\n --win-shortcut-prompt\n 添加一个对话框以允许用户选择是否将由安装程序\n 创建快捷方式。\n --win-update-url \n 可用应用程序更新信息的 URL\n --win-upgrade-uuid \n 与此程序包的升级相关联的 UUID\n -MSG_Help_win_install_dir=默认安装位置下面的相对子路径\n -MSG_Help_mac_install=\ --mac-dmg-content [,...]\n 包括 DMG 中引用的所有内容。\n 此选项可以使用多次。\n -MSG_Help_mac_launcher=\ --mac-package-identifier \n 用来唯一地标识 macOS 应用程序的标识符\n 默认为主类名称。\n 只能使用字母数字 (A-Z,a-z,0-9)、连字符 (-) 和\n 句点 (.) 字符。\n --mac-package-name \n 出现在菜单栏中的应用程序名称\n 这可以与应用程序名称不同。\n 此名称的长度必须小于 16 个字符,适合\n 显示在菜单栏中和应用程序“信息”窗口中。\n 默认为应用程序名称。\n --mac-package-signing-prefix \n 在对应用程序包签名时,会在所有需要签名\n 但当前没有程序包标识符的组件的\n 前面加上此值。\n --mac-sign\n 请求对程序包或预定义的应用程序映像\n 进行签名。\n --mac-signing-keychain \n 要用来搜索签名身份的密钥链的名称\n 如果未指定,则使用标准的密钥链。\n --mac-signing-key-user-name \n Apple 签名身份的团队或用户名称部分。为了直接\n 控制用于对应用程序映像或安装程序进行签名的\n 签名身份,请使用 --mac-app-image-sign-identity 和/或\n --mac-installer-sign-identity。此选项不能与\n --mac-app-image-sign-identity 或 --mac-installer-sign-identity 结合使用。\n --mac-app-image-sign-identity \n 用于对应用程序映像进行签名的身份。此值将直接\n 传递至 "codesign" 工具的 --sign 选项。此选项不能\n 与 --mac-signing-key-user-name 结合使用。\n --mac-installer-sign-identity \n 用于对 "pkg" 安装程序进行签名的身份。此值将直接\n 传递至 "productbuild" 工具的 --sign 选项。此选项不能\n 与 --mac-signing-key-user-name 结合使用。\n --mac-app-store\n 指示 jpackage 输出面向\n Mac App Store。\n --mac-entitlements \n 包含一些权利的文件的路径,在对捆绑包中的可执行文件\n 和库进行签名时会使用这些权利。\n --mac-app-category \n 用于构造应用程序 plist 中 LSApplicationCategoryType 的\n 字符串。默认值为 "utilities"。\n -MSG_Help_linux_install=\ --linux-package-name \n Linux 程序包的名称,默认为应用程序名称\n --linux-deb-maintainer \n .deb 程序包的维护程序\n --linux-menu-group \n 此应用程序所在的菜单组\n --linux-package-deps \n 应用程序所需的程序包或功能\n --linux-rpm-license-type \n 许可证的类型(RPM .spec 的 "License: ")\n --linux-app-release \n RPM .spec 文件的发行版值或 \n DEB 控制文件的 Debian 修订版值\n --linux-app-category \n RPM .spec 文件的组值或 \n DEB 控制文件的节值\n --linux-shortcut\n 为应用程序创建快捷方式。\n -MSG_Help_mac_linux_install_dir=应用程序安装目录的绝对路径\n -MSG_Help_default_install_dir=OS X 或 Linux 上应用程序安装目录的绝对路径。\n Windows 上应用程序安装位置的相对子路径\n (如 "Program Files" 或 "AppData")。\n -MSG_Help_no_args=用法:jpackage \n使用 jpackage --help(或 -h)可获取可能选项的列表 -MSG_Help_default_app_image=用来构建可安装程序包的\n 预定义应用程序映像的位置\n -MSG_Help_mac_app_image=用来构建可安装程序包的\n 或对预定义应用程序映像进行签名的\n 预定义应用程序映像的位置\n -MSG_Help_mac_sign_sample_usage=\ 对预定义应用程序映像进行签名:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n 注:此模式下允许的其他选项只有:\n 一组其他 mac 签名选项和 --verbose\n diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties index c61e60fe4ec..6e5de3d9729 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties @@ -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,14 +28,14 @@ param.copyright.default=Copyright (C) {0,date,YYYY} param.vendor.default=Unknown bundle-type.win-app=Windows Application Image -bundle-type.win-exe=EXE Installer Package -bundle-type.win-msi=MSI Installer Package +bundle-type.win-exe=Windows EXE Installer +bundle-type.win-msi=Windows MSI Installer bundle-type.mac-app=Mac Application Image bundle-type.mac-dmg=Mac DMG Package bundle-type.mac-pkg=Mac PKG Package bundle-type.linux-app=Linux Application Image -bundle-type.linux-deb=DEB Bundle -bundle-type.linux-rpm=RPM Bundle +bundle-type.linux-deb=Linux DEB Package +bundle-type.linux-rpm=Linux RPM Package resource.post-app-image-script=script to run after application image is populated @@ -43,13 +43,23 @@ message.using-default-resource=Using default package resource {0} {1} (add {2} t message.no-default-resource=No default package resource {0} (add {1} to the resource-dir to customize). message.using-custom-resource-from-file=Using custom package resource {0} (loaded from file {1}). message.using-custom-resource=Using custom package resource {0} (loaded from {1}). -message.creating-app-bundle=Creating app package: {0} in {1} + +message.create-package=Building output package file... +message.create-app-image=Building output application image directory... +message.package-created=Succeeded in building output package file +message.app-image-created=Succeeded in building output application image directory + message.debug-working-directory=Kept working directory for debug: {0} -message.bundle-created=Succeeded in building {0} package + message.module-version=Using version "{0}" from module "{1}" as application version -message.error-header={0} +message.error-header=Error: {0} message.advice-header=Advice to fix: {0} +message.failed-command-output-header=Command output: + +error.command-failed-unexpected-output=Unexpected output from executing the command {0} +error.command-failed-unexpected-exit-code=Unexpected exit code {0} from executing the command {1} +error.command-failed-timed-out=Timed-out command {0} error.version-string-empty=Version may not be empty string error.version-string-zero-length-component=Version [{0}] contains a zero length component @@ -75,13 +85,16 @@ error.parameter-not-directory=The value "{0}" provided for parameter {1} is not error.parameter-not-empty-directory=The value "{0}" provided for parameter {1} is not an empty directory or non existent path error.parameter-not-url=The value "{0}" provided for parameter {1} is not a valid URL error.parameter-not-launcher-shortcut-dir=The value "{0}" provided for parameter {1} is not a valid shortcut startup directory +error.parameter-not-mac-bundle=The value "{0}" provided for parameter {1} is not a valid macOS bundle error.path-parameter-ioexception=I/O error accessing path value "{0}" of parameter {1} error.parameter-add-launcher-malformed=The value "{0}" provided for parameter {1} does not match the pattern = error.parameter-add-launcher-not-file=The value of path to a property file "{0}" provided for additional launcher "{1}" is not a valid file path error.properties-parameter-not-path=The value "{0}" provided for property "{1}" in "{2}" file is not a valid path error.properties-parameter-not-file=The value "{0}" provided for property "{1}" in "{2}" file is not a file +error.properties-parameter-not-directory=The value "{0}" provided for property "{1}" in "{2}" file is not a directory error.properties-parameter-not-launcher-shortcut-dir=The value "{0}" provided for property "{1}" in "{2}" file is not a valid shortcut startup directory +error.no-extensions-for-file-association=No extensions were specified for File Association number {0} error.no-content-types-for-file-association=No MIME types were specified for File Association number {0} error.no-content-types-for-file-association.advice=Specify MIME type for File Association number {0} error.too-many-content-types-for-file-association=More than one MIME types was specified for File Association number {0} @@ -96,7 +109,8 @@ error.tool-not-found.advice=Please install "{0}" error.tool-old-version=Can not find "{0}" {1} or newer error.tool-old-version.advice=Please install "{0}" {1} or newer -error.jlink.failed=jlink failed with: {0} +error.output-bundle-cannot-be-overwritten=Output package file "{0}" exists and can not be removed. + error.blocked.option=jlink option [{0}] is not permitted in --jlink-options error.no.name=Name not specified with --name and cannot infer one from app-image error.no.name.advice=Specify name with --name diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties index 2426b97c7e2..7816f8ee71a 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties @@ -24,25 +24,32 @@ # # -jpackage.description=Eigenständige Java-Anwendung verpacken - param.copyright.default=Copyright (C) {0,date,YYYY} -param.description.default=Kein Wert param.vendor.default=Unbekannt +bundle-type.win-app=Windows-Anwendungsimage +bundle-type.win-exe=EXE-Installationsprogrammpackage +bundle-type.win-msi=MSI-Installationsprogrammpackage +bundle-type.mac-app=Mac-Anwendungsimage +bundle-type.mac-dmg=Mac-DMG-Package +bundle-type.mac-pkg=Mac-PKG-Package +bundle-type.linux-app=Linux-Anwendungsimage +bundle-type.linux-deb=DEB-Bundle +bundle-type.linux-rpm=RPM-Bundle + resource.post-app-image-script=Auszuführendes Skript nach dem Auffüllen des Anwendungsimages message.using-default-resource=Standardpackageressource {0} {1} wird verwendet (durch Hinzufügen von {2} zu resource-dir ist eine Anpassung möglich). -message.no-default-resource=Keine Standardpackageressource {0} {1} (durch Hinzufügen von {2} zu resource-dir ist eine Anpassung möglich). +message.no-default-resource=Keine Standardpackageressource {0} (durch Hinzufügen von {1} zu resource-dir ist eine Anpassung möglich). message.using-custom-resource-from-file=Benutzerdefinierte Packageressource {0} wird verwendet (aus Datei {1} geladen). message.using-custom-resource=Benutzerdefinierte Packageressource {0} wird verwendet (aus {1} geladen). message.creating-app-bundle=Anwendungspackage {0} wird in {1} erstellt -message.runtime-image-dir-does-not-exist=Angegebenes Laufzeitimageverzeichnis {0}: {1} ist nicht vorhanden -message.resource-dir-does-not-exist=Angegebenes Ressourcenverzeichnis {0}: {1} ist nicht vorhanden message.debug-working-directory=Arbeitsverzeichnis für Debug beibehalten: {0} message.bundle-created={0}-Package wurde erfolgreich erstellt message.module-version=Version "{0}" aus Modul "{1}" wird als Anwendungsversion verwendet -message.module-class=Klasse "{0}" aus Modul "{1}" wird als Anwendungshauptklasse verwendet + +message.error-header={0} +message.advice-header=Empfehlung zur Behebung: {0} error.version-string-empty=Version darf keine leere Zeichenfolge sein error.version-string-zero-length-component=Version [{0}] enthält eine Komponente mit Nulllänge @@ -50,64 +57,69 @@ error.version-string-invalid-component=Version [{0}] enthält ungültige Kompone error.cannot-create-output-dir=Zielverzeichnis {0} kann nicht erstellt werden error.cannot-write-to-output-dir=Zielverzeichnis {0} ist schreibgeschützt -error.root-exists=Fehler: Anwendungszielverzeichnis {0} ist bereits vorhanden +error.root-exists=Anwendungszielverzeichnis {0} ist bereits vorhanden error.no-main-class-with-main-jar=Es wurde keine Hauptklasse angegeben oder in der JAR-Datei {0} gefunden error.no-main-class-with-main-jar.advice=Geben Sie eine Hauptklasse an, oder stellen Sie sicher, dass die JAR-Datei {0} eine Hauptklasse im Manifest angibt -error.no-main-class=Es wurde keine Hauptklasse angegeben oder in den angegebenen Anwendungsressourcen gefunden -error.no-main-class.advice=Geben Sie eine Anwendungsklasse an, oder stellen Sie sicher, dass die appResources eine JAR-Datei mit einer Anwendungsklasse im Manifest enthalten error.main-jar-does-not-exist=Die konfigurierte Haupt-JAR-Datei ist im Eingabeverzeichnis nicht vorhanden {0} error.main-jar-does-not-exist.advice=Die Haupt-JAR-Datei muss relativ zum Eingabeverzeichnis (nicht als absoluter Pfad) angegeben werden und muss in diesem Verzeichnis vorhanden sein error.no-module-in-path="{0}-Modul im Modulpfad nicht gefunden" -error.not-path-parameter="Ungültiger Wert für Parameter {0}: {1}" error.no-input-parameter="--input-Parameter für nicht modulare Anwendung fehlt" +error.non-option-arguments={0} Argumente, die keine Option sind, in der Befehlszeile gefunden. Argumente, die keine Option sind, sind nicht zulässig +error.undefined-default-bundling-operation=Standard-Bundling-Vorgang ist nicht definiert +error.undefined-default-bundling-operation.advice=Parameter {0} zur Befehlszeile hinzufügen +error.parameter-not-uuid=Der für Parameter {1} angegebene Wert "{0}" ist keine gültige UUID +error.parameter-not-path=Der für Parameter {1} angegebene Wert "{0}" ist kein gültiger Pfad +error.parameter-not-file=Der für Parameter {1} angegebene Wert "{0}" ist keine Datei +error.parameter-not-directory=Der für Parameter {1} angegebene Wert "{0}" ist kein Verzeichnis +error.parameter-not-empty-directory=Der für Parameter {1} angegebene Wert "{0}" ist kein leeres Verzeichnis oder kein vorhandener Pfad +error.parameter-not-url=Der für Parameter {1} angegebene Wert "{0}" ist keine gültige URL +error.parameter-not-launcher-shortcut-dir=Der für Parameter {1} angegebene Wert "{0}" ist kein gültiges Verknüpfungsstartverzeichnis +error.path-parameter-ioexception=I/O-Fehler beim Zugriff auf Pfadwert "{0}" von Parameter {1} +error.parameter-add-launcher-malformed=Der für Parameter {1} angegebene Wert "{0}" stimmt nicht mit dem Muster = überein +error.parameter-add-launcher-not-file=Der Wert des Pfades zu einer Eigenschaftendatei "{0}", der für den zusätzlichen Launcher "{1}" bereitgestellt wird, ist kein gültiger Dateipfad +error.properties-parameter-not-path=Der für Eigenschaft "{1}" in Datei "{2}" angegebene Wert "{0}" ist kein gültiger Pfad +error.properties-parameter-not-file=Der für Eigenschaft "{1}" in Datei "{2}" angegebene Wert "{0}" ist keine Datei +error.properties-parameter-not-launcher-shortcut-dir=Der für Eigenschaft "{1}" in Datei "{2}" angegebene Wert "{0}" ist kein gültiges Verknüpfungsstartverzeichnis + error.no-content-types-for-file-association=Für Dateiverknüpfungsnummer {0} wurden keine MIME-Typen angegeben error.no-content-types-for-file-association.advice=Geben Sie einen MIME-Typ für Dateiverknüpfungsnummer {0} an error.too-many-content-types-for-file-association=Für Dateiverknüpfungsnummer {0} wurde mehr als ein MIME-Typ angegeben error.too-many-content-types-for-file-association.advice=Geben Sie nur einen MIME-Typ für Dateiverknüpfungsnummer {0} an -error.tool-not-found={0} kann nicht gefunden werden. Grund: {1} -error.tool-not-found.advice=Installieren Sie {0} -error.tool-old-version={0} {1} oder eine neuere Version kann nicht gefunden werden -error.tool-old-version.advice=Installieren Sie {0} {1} oder eine neuere Version +error.launcher-duplicate-name=Mehrere Launcher haben denselben Namen "{0}". Launcher müssen eindeutige Namen haben + +error.tool-error=Validieren von "{0}" nicht möglich. Grund: {1} +error.tool-not-executable="{0}" ist nicht ausführbar +error.tool-not-found="{0}" kann nicht gefunden werden +error.tool-not-found.advice=Installieren Sie "{0}" +error.tool-old-version="{0}" {1} oder eine neuere Version kann nicht gefunden werden +error.tool-old-version.advice=Installieren Sie "{0}" {1} oder eine neuere Version + error.jlink.failed=jlink nicht erfolgreich mit: {0} error.blocked.option=jlink-Option [{0}] ist in --jlink-options nicht zulässig error.no.name=Name nicht mit --name angegeben. Es kann auch kein Name aus app-image abgeleitet werden error.no.name.advice=Geben Sie den Namen mit --name an -warning.no.jdk.modules.found=Warnung: Keine JDK-Module gefunden - -error.foreign-app-image=Fehler : Fehlende .jpackage.xml-Datei in app-image-Verzeichnis "{0}" -error.invalid-app-image=Fehler: app-image-Verzeichnis "{0}" wurde von einer anderen jpackage-Version generiert, oder Datei "{1}" ist nicht wohlgeformt +error.missing-app-image-file=Datei "{0}" fehlt im vordefinierten Anwendungsimage "{1}" +error.invalid-app-image-file=Datei "{0}" im vordefinierten Anwendungsimage "{1}" ist beschädigt oder wurde von einer anderen Version von jpackage erstellt +error.malformed-app-image-file=Datei "{0}" im vordefinierten Anwendungsimage "{1}" enthält nicht wohlgeformte XML-Daten +error.reading-app-image-file=Datei "{0}" konnte im vordefinierten Anwendungsimage "{1}" nicht gelesen werden error.invalid-install-dir=Ungültiges Installationsverzeichnis "{0}" -MSG_BundlerFailed=Fehler: Bundler "{1}" ({0}) konnte kein Package generieren -MSG_BundlerConfigException=Bundler {0} aufgrund eines Konfigurationsproblems übersprungen: {1} \nEmpfehlung zur Behebung: {2} -MSG_BundlerConfigExceptionNoAdvice=Bundler {0} aufgrund eines Konfigurationsproblems übersprungen: {1} -MSG_BundlerRuntimeException=Bundler {0} nicht erfolgreich. Grund: {1} +ERR_NoMainClass=Hauptanwendungsklasse fehlt +ERR_UnsupportedOption=Option [{0}] ist auf dieser Plattform ungültig +ERR_InvalidTypeOption=Option [{0}] ist nicht gültig mit Typ [{1}] +ERR_NoInstallerEntryPoint=Option [{0}] ist nicht gültig ohne Einstiegspunktoption --module oder --main-jar +ERR_MutuallyExclusiveOptions=Sich gegenseitig ausschließende Optionen: [{0}] und [{1}] +ERR_InvalidOptionWithAppImageSigning=Option [{0}] ist nicht gültig beim Signieren eines Anwendungsimages -ERR_NoMainClass=Fehler: Hauptanwendungsklasse fehlt -ERR_UnsupportedOption=Fehler: Option [{0}] ist auf dieser Plattform ungültig -ERR_InvalidTypeOption=Fehler: Option [{0}] ist nicht gültig mit Typ [{1}] -ERR_NoInstallerEntryPoint=Fehler: Option [{0}] ist nicht gültig ohne Einstiegspunktoption --module oder --main-jar -ERR_MutuallyExclusiveOptions=Fehler: Optionen [{0}] und [{1}] schließen sich gegenseitig aus -ERR_InvalidOptionWithAppImageSigning=Fehler: Option [{0}] ist nicht gültig beim Signieren eines Anwendungsimages - -ERR_MissingArgument=Fehler: Fehlendes Argument: {0} -ERR_MissingRequiredArgument=Fehler: Für das Argument {0} ist mindestens eines der folgenden Argumente erforderlich: [{1}] -ERR_AppImageNotExist=Fehler: Anwendungsimageverzeichnis "{0}" ist nicht vorhanden -ERR_NoAddLauncherName=Fehler: Für Option --add-launcher müssen ein Name und ein Dateipfad angegeben werden (--add-launcher =) -ERR_NoUniqueName=Fehler: Für --add-launcher = ist ein eindeutiger Name erforderlich -ERR_InvalidAppName=Fehler: Ungültiger Anwendungsname: {0} -ERR_InvalidSLName=Fehler: Ungültiger Name für hinzuzufügenden Launcher: {0} -ERR_IconFileNotExit=Fehler: Die angegebene Symboldatei [{0}] ist nicht vorhanden -ERR_LicenseFileNotExit=Fehler: Die angegebene Lizenzdatei ist nicht vorhanden -ERR_BuildRootInvalid=Fehler: Das temporäre Verzeichnis ({0}) darf nicht vorhanden sein oder muss leer sein -ERR_InvalidOption=Fehler: Ungültige Option: [{0}] -ERR_InvalidInstallerType=Fehler: Ungültiger oder nicht unterstützter Typ: [{0}] -ERR_BothMainJarAndModule=Fehler: Die Optionen --main-jar und --module dürfen nicht beide vorhanden sein -ERR_NoEntryPoint=Fehler: Für das Erstellen des Anwendungsimages muss entweder die Option --main-jar oder die Option --module angegeben werden -ERR_CannotParseOptions=Fehler: Option @filename wird verarbeitet: {0} -ERR_MissingJLinkOptMacAppStore=Fehler: Argument "--mac-app-store" erfordert eine {0}-Option für Argument "--jlink-options" -ERR_MacAppStoreRuntimeBinExists=Fehler: Laufzeitimage "{0}" darf nicht den Ordner "bin" enthalten. Verwenden Sie die jlink-Option "--strip-native-commands" beim Generieren des Laufzeitimages mit dem Argument "--mac-app-store". +ERR_MissingArgument2=Fehlendes Argument: {0} oder {1} +ERR_InvalidAppName=Ungültiger Anwendungsname: {0} +ERR_InvalidSLName=Ungültiger Name für hinzuzufügenden Launcher: {0} +ERR_InvalidOption=Ungültige Option: [{0}] +ERR_InvalidInstallerType=Ungültiger oder nicht unterstützter Typ: [{0}] +ERR_NoEntryPoint=Für das Erstellen des Anwendungsimages muss entweder die Option --main-jar oder die Option --module angegeben werden +ERR_CannotParseOptions=Option @filename wird verarbeitet: {0} +ERR_MissingJLinkOptMacAppStore=Argument "--mac-app-store" erfordert eine {0}-Option für Argument "--jlink-options" diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties index e0faf346973..5db5ead7577 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties @@ -24,25 +24,32 @@ # # -jpackage.description=自己完結型Javaアプリケーションをパッケージ化します - param.copyright.default=Copyright (C) {0,date,YYYY} -param.description.default=なし param.vendor.default=不明 +bundle-type.win-app=Windowsアプリケーション・イメージ +bundle-type.win-exe=EXEインストーラ・パッケージ +bundle-type.win-msi=MSIインストーラ・パッケージ +bundle-type.mac-app=Macアプリケーション・イメージ +bundle-type.mac-dmg=Mac DMGパッケージ +bundle-type.mac-pkg=Mac PKGパッケージ +bundle-type.linux-app=Linuxアプリケーション・イメージ +bundle-type.linux-deb=DEBバンドル +bundle-type.linux-rpm=RPMバンドル + resource.post-app-image-script=アプリケーション・イメージを移入した後に実行するスクリプト message.using-default-resource=デフォルトのパッケージ・リソース{0} {1}の使用({2}をresource-dirに追加してカスタマイズ)。 -message.no-default-resource=デフォルトのパッケージ・リソース{0} {1}なし({2}をresource-dirに追加してカスタマイズ)。 +message.no-default-resource=デフォルトのパッケージ・リソース{0}なし({1}をresource-dirに追加してカスタマイズ)。 message.using-custom-resource-from-file=カスタム・パッケージ・リソース{0}の使用(ファイル{1}からロード済) message.using-custom-resource=カスタム・パッケージ・リソース{0}の使用({1}からロード済) message.creating-app-bundle=アプリケーション・パッケージを作成しています: {1}内の{0} -message.runtime-image-dir-does-not-exist=指定されたランタイム・イメージ・ディレクトリ{0}: {1}は存在しません -message.resource-dir-does-not-exist=指定されたリソース・ディレクトリ{0}: {1}は存在しません message.debug-working-directory=デバッグの作業ディレクトリが保持されました: {0} message.bundle-created={0}パッケージの作成に成功しました message.module-version=モジュール"{1}"のバージョン"{0}"をアプリケーション・バージョンとして使用 -message.module-class=モジュール"{1}"のクラス"{0}"をアプリケーション・メイン・クラスとして使用 + +message.error-header={0} +message.advice-header=修正のアドバイス: {0} error.version-string-empty=バージョンを空の文字列にすることはできません error.version-string-zero-length-component=バージョン[{0}]に長さゼロのコンポーネントが含まれます @@ -50,64 +57,69 @@ error.version-string-invalid-component=バージョン[{0}]に無効なコンポ error.cannot-create-output-dir=宛先ディレクトリ{0}を作成できません。 error.cannot-write-to-output-dir=宛先ディレクトリ{0}は書込み不可です -error.root-exists=エラー: アプリケーションの宛先ディレクトリ{0}はすでに存在します +error.root-exists=アプリケーションの宛先ディレクトリ{0}はすでに存在します error.no-main-class-with-main-jar=メイン・クラスが指定されていなかったか、jar {0}に見つかりませんでした error.no-main-class-with-main-jar.advice=メイン・クラスを指定するか、jar {0}がマニフェストで指定していることを確認してください -error.no-main-class=メイン・クラスが指定されていなかったか、指定されたアプリケーション・リソースに見つかりませんでした -error.no-main-class.advice=アプリケーション・クラスを指定するか、マニフェストでappResourcesにアプリケーション・クラスを含むjarがあることを確認してください error.main-jar-does-not-exist=入力ディレクトリで、構成されたメインjarが{0}に存在しません error.main-jar-does-not-exist.advice=入力ディレクトリに対して相対的に(絶対パスではない)メインjarを指定する必要があり、そのディレクトリ内に存在する必要があります error.no-module-in-path="モジュール・パスに{0}モジュールが見つかりませんでした" -error.not-path-parameter="{0}パラメータの無効な値: {1}" error.no-input-parameter="非モジュラ・アプリケーションに--inputパラメータがありません" +error.non-option-arguments=コマンドラインで{0}個の非オプション引数が見つかりました。非オプション引数は使用できません +error.undefined-default-bundling-operation=デフォルトのバンドル操作は未定義です +error.undefined-default-bundling-operation.advice=コマンドラインに{0}パラメータを追加します +error.parameter-not-uuid=パラメータ{1}に指定された値"{0}"は有効なUUIDではありません +error.parameter-not-path=パラメータ{1}に指定された値"{0}"は有効なパスではありません +error.parameter-not-file=パラメータ{1}に指定された値"{0}"はファイルではありません +error.parameter-not-directory=パラメータ{1}に指定された値"{0}"はディレクトリではありません +error.parameter-not-empty-directory=パラメータ{1}に指定された値"{0}"が空のディレクトリでないか、存在しないパスです +error.parameter-not-url=パラメータ{1}に指定された値"{0}"は有効なURLではありません +error.parameter-not-launcher-shortcut-dir=パラメータ{1}に指定された値"{0}"は、有効なショートカット起動ディレクトリではありません +error.path-parameter-ioexception=パラメータ{1}のパス値"{0}"へのアクセス中にI/Oエラーが発生しました +error.parameter-add-launcher-malformed=パラメータ{1}に指定された値"{0}"がパターン=と一致しません +error.parameter-add-launcher-not-file=追加のランチャ"{1}"に指定されたプロパティ・ファイル"{0}"へのパスの値は有効なファイル・パスではありません +error.properties-parameter-not-path="{2}"ファイルのプロパティ"{1}"に指定された値"{0}"は有効なパスではありません +error.properties-parameter-not-file="{2}"ファイルのプロパティ"{1}"に指定された値"{0}"はファイルではありません +error.properties-parameter-not-launcher-shortcut-dir="{2}"ファイルのプロパティ"{1}"に指定された値"{0}"は、有効なショートカット起動ディレクトリではありません + error.no-content-types-for-file-association=ファイル・アソシエーション番号{0}にMIMEタイプが指定されませんでした error.no-content-types-for-file-association.advice=ファイル・アソシエーション番号{0}にMIMEタイプを指定してください error.too-many-content-types-for-file-association=ファイル・アソシエーション番号{0}に複数のMIMEタイプが指定されました error.too-many-content-types-for-file-association.advice=ファイル・アソシエーション番号{0}にMIMEタイプを1つのみ指定してください -error.tool-not-found={0}が見つかりません。理由: {1} -error.tool-not-found.advice={0}をインストールしてください -error.tool-old-version={0} {1}以降が見つかりません -error.tool-old-version.advice={0} {1}以降をインストールしてください +error.launcher-duplicate-name=複数のランチャに同じ名前"{0}"が付いています。ランチャには一意の名前が必要です + +error.tool-error="{0}"を検証できません。理由: {1} +error.tool-not-executable="{0}"は実行可能ではありません +error.tool-not-found="{0}"が見つかりません +error.tool-not-found.advice="{0}"をインストールしてください +error.tool-old-version="{0}" {1}以降が見つかりません +error.tool-old-version.advice="{0}" {1}以降をインストールしてください + error.jlink.failed=jlinkが次で失敗しました: {0} error.blocked.option=jlinkオプション[{0}]は--jlink-optionsでは許可されません error.no.name=名前が--nameで指定されておらず、app-imageから推論できません error.no.name.advice=--nameで名前を指定します -warning.no.jdk.modules.found=警告: JDKモジュールが見つかりません - -error.foreign-app-image=エラー: app-imageディレクトリ"{0}"に.jpackage.xmlファイルがありません -error.invalid-app-image=エラー: app-imageディレクトリ"{0}"は、別のjpackageバージョンまたは不正な"{1}"ファイルで生成されました +error.missing-app-image-file=事前定義済アプリケーション・イメージ"{1}"に"{0}"ファイルがありません +error.invalid-app-image-file=事前定義済アプリケーション・イメージ"{1}"の"{0}"ファイルが破損しているか、別のバージョンのjpackageによって作成されました +error.malformed-app-image-file=事前定義済アプリケーション・イメージ"{1}"の"{0}"ファイルに不正なXMLデータが含まれています +error.reading-app-image-file=事前定義済アプリケーション・イメージ"{1}"の"{0}"ファイルの読取りに失敗しました error.invalid-install-dir=無効なインストール・ディレクトリ"{0}" -MSG_BundlerFailed=エラー: バンドラ"{1}" ({0})がパッケージの生成に失敗しました -MSG_BundlerConfigException=構成の問題のため、バンドラ{0}がスキップされました: {1} \n次の修正を行ってください: {2} -MSG_BundlerConfigExceptionNoAdvice=構成の問題のため、バンドラ{0}がスキップされました: {1} -MSG_BundlerRuntimeException={1}のため、バンドラ{0}が失敗しました +ERR_NoMainClass=メイン・アプリケーション・クラスがありません +ERR_UnsupportedOption=オプション[{0}]は、このプラットフォームでは無効です +ERR_InvalidTypeOption=オプション[{0}]は、タイプ[{1}]では無効です +ERR_NoInstallerEntryPoint=オプション[{0}]は、--moduleまたは--main-jarエントリ・ポイント・オプションなしでは無効です +ERR_MutuallyExclusiveOptions=相互排他的なオプション[{0}]と[{1}] +ERR_InvalidOptionWithAppImageSigning=アプリケーション・イメージへの署名時にオプション[{0}]が有効ではありません -ERR_NoMainClass=エラー: メイン・アプリケーション・クラスがありません -ERR_UnsupportedOption=エラー: オプション[{0}]は、このプラットフォームでは無効です -ERR_InvalidTypeOption=エラー: オプション[{0}]は、タイプ[{1}]では無効です -ERR_NoInstallerEntryPoint=エラー: オプション[{0}]は、--moduleまたは--main-jarエントリ・ポイント・オプションなしでは無効です -ERR_MutuallyExclusiveOptions=エラー: 相互排他的なオプション[{0}]と[{1}] -ERR_InvalidOptionWithAppImageSigning=エラー: アプリケーション・イメージへの署名時にオプション[{0}]が有効ではありません - -ERR_MissingArgument=エラー: 引数がありません: {0} -ERR_MissingRequiredArgument=エラー: {0}引数には少なくとも1つの[{1}]引数が必要です -ERR_AppImageNotExist=エラー: アプリケーション・イメージ・ディレクトリ"{0}"は存在しません -ERR_NoAddLauncherName=エラー: --add-launcherオプションには名前およびファイル・パスが必要です(--add-launcher =) -ERR_NoUniqueName=エラー: --add-launcher =には一意の名前が必要です -ERR_InvalidAppName=エラー: 無効なアプリケーション名: {0} -ERR_InvalidSLName=エラー: 無効な追加ランチャ名: {0} -ERR_IconFileNotExit=エラー: 指定されたアイコン・ファイル[{0}]は存在しません -ERR_LicenseFileNotExit=エラー: 指定されたライセンス・ファイルは存在しません -ERR_BuildRootInvalid=エラー: 一時({0})は存在しないか、空のディレクトリである必要があります -ERR_InvalidOption=エラー: 無効なオプション: [{0}] -ERR_InvalidInstallerType=エラー: 無効またはサポートされていないタイプ: [{0}] -ERR_BothMainJarAndModule=エラー: --main-jarオプションと--moduleオプションの両方を指定することはできません -ERR_NoEntryPoint=エラー: アプリケーション・イメージの作成には--main-jarまたは--moduleオプションが必要です -ERR_CannotParseOptions=エラー: @filenameオプションの処理: {0} -ERR_MissingJLinkOptMacAppStore=エラー: --mac-app-store引数では、--jlink-options引数に{0}オプションが必要です -ERR_MacAppStoreRuntimeBinExists=エラー: ランタイム・イメージ"{0}"に"bin"フォルダを含めることはできません。--mac-app-store引数で使用されるランタイム・イメージを生成する際に、--strip-native-commands jlinkオプションを使用します。 +ERR_MissingArgument2=引数がありません: {0}または{1} +ERR_InvalidAppName=無効なアプリケーション名: {0} +ERR_InvalidSLName=無効な追加ランチャ名: {0} +ERR_InvalidOption=無効なオプション: [{0}] +ERR_InvalidInstallerType=無効またはサポートされていないタイプ: [{0}] +ERR_NoEntryPoint=アプリケーション・イメージの作成には--main-jarまたは--moduleオプションが必要です +ERR_CannotParseOptions=@filenameオプションの処理: {0} +ERR_MissingJLinkOptMacAppStore=--mac-app-store引数では、--jlink-options引数に{0}オプションが必要です diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties index 0236ef34077..23540af7db2 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties @@ -24,25 +24,32 @@ # # -jpackage.description=打包自包含 Java 应用程序 - param.copyright.default=版权所有 (C) {0,date,YYYY} -param.description.default=无 param.vendor.default=未知 +bundle-type.win-app=Windows 应用程序映像 +bundle-type.win-exe=EXE 安装程序包 +bundle-type.win-msi=MSI 安装程序包 +bundle-type.mac-app=Mac 应用程序映像 +bundle-type.mac-dmg=Mac DMG 程序包 +bundle-type.mac-pkg=Mac PKG 程序包 +bundle-type.linux-app=Linux 应用程序映像 +bundle-type.linux-deb=DEB 包 +bundle-type.linux-rpm=RPM 包 + resource.post-app-image-script=要在填充应用程序映像之后运行的脚本 message.using-default-resource=使用默认程序包资源 {0} {1}(将 {2} 添加到 resource-dir 中以进行定制)。 -message.no-default-resource=无默认程序包资源 {0} {1}(将 {2} 添加到 resource-dir 中以进行定制)。 +message.no-default-resource=无默认程序包资源 {0}(将 {1} 添加到 resource-dir 中以进行定制)。 message.using-custom-resource-from-file=使用定制程序包资源 {0} (从文件 {1} 加载)。 message.using-custom-resource=使用定制程序包资源 {0} (从 {1} 加载)。 message.creating-app-bundle=正在 {1} 中创建应用程序包 {0} -message.runtime-image-dir-does-not-exist=指定的运行时映像目录 {0}:{1} 不存在 -message.resource-dir-does-not-exist=指定的资源目录 {0}:{1} 不存在 message.debug-working-directory=用于调试的已保留工作目录: {0} message.bundle-created=已成功地构建 {0} 程序包 message.module-version=正在将模块 "{1}" 中的版本 "{0}" 用作应用程序版本 -message.module-class=正在将模块 "{1}" 中的类 "{0}" 用作应用程序主类 + +message.error-header={0} +message.advice-header=修复建议:{0} error.version-string-empty=版本不能为空字符串 error.version-string-zero-length-component=版本 [{0}] 包含长度为零的组件 @@ -50,64 +57,69 @@ error.version-string-invalid-component=版本 [{0}] 包含无效组件 [{1}] error.cannot-create-output-dir=无法创建目标目录 {0} error.cannot-write-to-output-dir=目标目录 {0} 不可写 -error.root-exists=错误:应用程序目标目录 {0} 已存在 +error.root-exists=应用程序目标目录 {0} 已存在 error.no-main-class-with-main-jar=未指定主类,在 jar {0} 中也未找到主类 error.no-main-class-with-main-jar.advice=请指定主类或确保 jar {0} 在清单中指定一个主类。 -error.no-main-class=未指定主类,在提供的应用程序资源中也未找到主类 -error.no-main-class.advice=请指定应用程序类,或者确保 appResources 中有一个 jar 在清单中包含应用程序类。 error.main-jar-does-not-exist=配置的主 jar 在输入目录中不存在 {0} error.main-jar-does-not-exist.advice=必须使用相对于输入目录的路径(不使用绝对路径)指定主 jar ,并且该目录中存在主 jar error.no-module-in-path="无法在模块路径中找到 {0} 模块" -error.not-path-parameter="{0} 参数的值无效:{1}" error.no-input-parameter="非模块化应用程序缺少 --input 参数" +error.non-option-arguments=在命令行上发现 {0} 个非选项参数。不允许使用非选项参数 +error.undefined-default-bundling-operation=未定义默认绑定操作 +error.undefined-default-bundling-operation.advice=将 {0} 参数添加到命令行 +error.parameter-not-uuid=为参数 {1} 提供的值 "{0}" 不是有效的 UUID +error.parameter-not-path=为参数 {1} 提供的值 "{0}" 不是有效路径 +error.parameter-not-file=为参数 {1} 提供的值 "{0}" 不是文件 +error.parameter-not-directory=为参数 {1} 提供的值 "{0}" 不是目录 +error.parameter-not-empty-directory=为参数 {1} 提供的值 "{0}" 不是空目录或是不存在的路径 +error.parameter-not-url=为参数 {1} 提供的值 "{0}" 不是有效的 URL +error.parameter-not-launcher-shortcut-dir=为参数 {1} 提供的值 "{0}" 不是有效的快捷方式启动目录 +error.path-parameter-ioexception=访问参数 {1} 的路径值 "{0}" 时出现 I/O 错误 +error.parameter-add-launcher-malformed=为参数 {1} 提供的值 "{0}" 与模式 = 不匹配 +error.parameter-add-launcher-not-file=为其他启动程序 "{1}" 提供的属性文件 "{0}" 的路径值不是有效的文件路径 +error.properties-parameter-not-path=为 "{2}" 文件中的属性 "{1}" 提供的值 "{0}" 不是有效路径 +error.properties-parameter-not-file=为 "{2}" 文件中的属性 "{1}" 提供的值 "{0}" 不是文件 +error.properties-parameter-not-launcher-shortcut-dir=为 "{2}" 文件中的属性 "{1}" 提供的值 "{0}" 不是有效的快捷方式启动目录 + error.no-content-types-for-file-association=没有为文件关联号{0}指定 MIME 类型 error.no-content-types-for-file-association.advice=为文件关联号 {0} 指定 MIME 类型 error.too-many-content-types-for-file-association=为文件关联号{0}指定了多个 MIME 类型 error.too-many-content-types-for-file-association.advice=仅为文件关联号 {0} 指定一个 MIME 类型 -error.tool-not-found=找不到 {0}。原因:{1} -error.tool-not-found.advice=请安装 {0} -error.tool-old-version=找不到 {0} {1}或更新版本 -error.tool-old-version.advice=请安装 {0} {1}或更新版本 +error.launcher-duplicate-name=多个启动程序具有相同的名称 "{0}"。启动程序应具有唯一名称 + +error.tool-error=无法验证 "{0}"。原因:{1} +error.tool-not-executable="{0}" 不可执行 +error.tool-not-found=找不到 "{0}" +error.tool-not-found.advice=请安装 "{0}" +error.tool-old-version=找不到 "{0}" {1} 或更新版本 +error.tool-old-version.advice=请安装 "{0}" {1} 或更新版本 + error.jlink.failed=jlink 失败,出现 {0} error.blocked.option=不允许在 --jlink-options 中使用 jlink 选项 [{0}] error.no.name=未使用 --name 指定名称,无法从 app-image 推断名称 error.no.name.advice=使用 --name 指定名称 -warning.no.jdk.modules.found=警告: 未找到 JDK 模块 - -error.foreign-app-image=错误:app-image 目录 "{0}" 中缺少 .jpackage.xml 文件 -error.invalid-app-image=错误:另一个 jpackage 版本或格式错误的 "{1}" 文件生成了 app-image 目录 "{0}" +error.missing-app-image-file=预定义的应用程序映像 "{1}" 中缺少 "{0}" 文件 +error.invalid-app-image-file=预定义的应用程序映像 "{1}" 中的 "{0}" 文件已损坏或由其他版本的 jpackage 创建 +error.malformed-app-image-file=预定义的应用程序映像 "{1}" 中的 "{0}" 文件包含格式错误的 XML 数据 +error.reading-app-image-file=无法在预定义的应用程序映像 "{1}" 中读取 "{0}" 文件 error.invalid-install-dir=安装目录 "{0}" 无效 -MSG_BundlerFailed=错误:打包程序 "{1}" ({0}) 无法生成程序包 -MSG_BundlerConfigException=由于配置问题, 跳过了打包程序{0}: {1} \n修复建议: {2} -MSG_BundlerConfigExceptionNoAdvice=由于配置问题, 跳过了打包程序{0}: {1} -MSG_BundlerRuntimeException=由于{1}, 打包程序{0}失败 +ERR_NoMainClass=缺少主应用程序类 +ERR_UnsupportedOption=选项 [{0}] 在此平台上无效 +ERR_InvalidTypeOption=选项 [{0}] 对于类型 [{1}] 无效 +ERR_NoInstallerEntryPoint=在没有 --module 或 --main-jar 入口点选项时,选项 [{0}] 无效 +ERR_MutuallyExclusiveOptions=选项 [{0}] 和 [{1}] 相互排斥 +ERR_InvalidOptionWithAppImageSigning=对应用程序映像进行签名时,选项 [{0}] 无效 -ERR_NoMainClass=错误:缺少主应用程序类 -ERR_UnsupportedOption=错误:选项 [{0}] 在此平台上无效 -ERR_InvalidTypeOption=错误:选项 [{0}] 对于类型 [{1}] 无效 -ERR_NoInstallerEntryPoint=错误:在没有 --module 或 --main-jar 入口点选项时,选项 [{0}] 无效 -ERR_MutuallyExclusiveOptions=错误:选项 [{0}] 和 [{1}] 相互排斥 -ERR_InvalidOptionWithAppImageSigning=错误:对应用程序映像签名时,选项 [{0}] 无效 - -ERR_MissingArgument=错误: 缺少参数: {0} -ERR_MissingRequiredArgument=错误:{0} 参数至少需要 [{1}] 参数之一 -ERR_AppImageNotExist=错误:应用程序映像目录 "{0}" 不存在 -ERR_NoAddLauncherName=错误:--add-launcher 选项需要一个名称和一个文件路径 (--add-launcher =) -ERR_NoUniqueName=错误:--add-launcher = 需要一个唯一的名称 -ERR_InvalidAppName=错误:应用程序名称 {0} 无效 -ERR_InvalidSLName=错误:添加启动程序名称 {0} 无效 -ERR_IconFileNotExit=错误:指定的图标文件 [{0}] 不存在 -ERR_LicenseFileNotExit=错误:指定的许可证文件不存在 -ERR_BuildRootInvalid=错误:临时目录 ({0}) 必须是不存在的目录或空白目录 -ERR_InvalidOption=错误:选项 [{0}] 无效 -ERR_InvalidInstallerType=错误:类型 [{0}] 无效或不受支持 -ERR_BothMainJarAndModule=错误:不能同时包含 --main-jar 和 --module 选项 -ERR_NoEntryPoint=错误:创建应用程序映像需要 --main-jar 或 --module 选项 -ERR_CannotParseOptions=错误:正在处理 @filename 选项:{0} -ERR_MissingJLinkOptMacAppStore=错误:对于 --jlink-options 参数,--mac-app-store 参数需要 {0} 选项 -ERR_MacAppStoreRuntimeBinExists=错误:运行时映像 "{0}" 不应包含 "bin" 文件夹。生成与 --mac-app-store 参数一起使用的运行时映像时,使用 --strip-native-commands jlink 选项。 +ERR_MissingArgument2=缺少参数:{0} 或 {1} +ERR_InvalidAppName=应用程序名称 {0} 无效 +ERR_InvalidSLName=添加启动程序名称 {0} 无效 +ERR_InvalidOption=选项 [{0}] 无效 +ERR_InvalidInstallerType=类型 [{0}] 无效或不受支持 +ERR_NoEntryPoint=创建应用程序映像需要 --main-jar 或 --module 选项 +ERR_CannotParseOptions=正在处理 @filename 选项:{0} +ERR_MissingJLinkOptMacAppStore=对于 --jlink-options 参数,--mac-app-store 参数需要 {0} 选项 diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/ResourceLocator.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/ResourceLocator.java index 93d317b0128..cb03a1fee8a 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/ResourceLocator.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/ResourceLocator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, 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 diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/CommandLineFormat.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/CommandLineFormat.java new file mode 100644 index 00000000000..4d64030876f --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/CommandLineFormat.java @@ -0,0 +1,52 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal.util; + +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * Formats command line arguments. + */ +public final class CommandLineFormat { + + public String format(List cmdline) { + return cmdline.stream().map(enquoter::applyTo).collect(Collectors.joining(" ")); + } + + public static CommandLineFormat platform() { + var format = new CommandLineFormat(); + format.enquoter = Enquoter.identity().setEnquotePredicate(Enquoter.QUOTE_IF_WHITESPACES).setQuoteChar('\''); + return format; + } + + private CommandLineFormat() { + } + + private Enquoter enquoter; + + public static final Function, String> DEFAULT = platform()::format; +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/CommandOutputControl.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/CommandOutputControl.java new file mode 100644 index 00000000000..00fbdd71919 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/CommandOutputControl.java @@ -0,0 +1,1949 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal.util; + +import static java.util.stream.Collectors.joining; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintStream; +import java.io.StringReader; +import java.io.UncheckedIOException; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.IntPredicate; +import java.util.function.Predicate; +import java.util.spi.ToolProvider; +import java.util.stream.IntStream; +import java.util.stream.Stream; +import jdk.jpackage.internal.util.function.ExceptionBox; +import jdk.jpackage.internal.util.function.ThrowingConsumer; +import jdk.jpackage.internal.util.function.ThrowingRunnable; + +/** + * Runs commands and processes their stdout and stderr streams. + *

    + * A command is either a subprocess represented by {@link ProcessBuilder} or a + * tool provided by {@link ToolProvider}. + *

    + * A command is executed synchronously, and the result of its execution is + * stored in a {@link Result} instance which captures the exit code and any + * saved output streams. + *

    + * Depending on the configuration, it can save the entire output stream, only + * the first line, or not save the output at all. Stdout and stderr streams can + * be configured independently. + *

    + * Output streams can be treated as either byte streams or character streams. + * + *

    + * The table below shows how different parameter combinations affect the content + * written to streams returned by {@link #dumpStdout()} and + * {@link #dumpStderr()} for subsequently executed tools, regardless of whether + * their output streams are saved, or for subprocesses when the output streams + * are saved: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    discardStdout(false) and discardStderr(false)discardStdout(false) and discardStderr(true)discardStdout(true) and discardStderr(false)
    redirectStderr(true) and dumpOutput(true) + *

    + * dumpStdout(): STDOUT and STDERR interleaved + *

    + * dumpStderr(): unchanged

    + *

    + * dumpStdout(): STDOUT + *

    + * dumpStderr(): unchanged

    + *

    + * dumpStdout(): STDERR; + *

    + * dumpStderr(): unchanged

    redirectStderr(false) and dumpOutput(true) + *

    + * dumpStdout(): STDOUT + *

    + * dumpStderr(): STDERR

    + *

    + * dumpStdout(): STDOUT + *

    + * dumpStderr(): unchanged

    + *

    + * dumpStdout(): unchanged + *

    + * dumpStderr(): STDERR

    + * + *

    + * The table below shows how different parameter combinations affect the content + * written to the native file descriptors associated with {@link System#out} and + * {@link System#err} for subsequently executed subprocesses when the output + * streams are not saved: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    discardStdout(false) and discardStderr(false)discardStdout(false) and discardStderr(true)discardStdout(true) and discardStderr(false)
    redirectStderr(true) and dumpOutput(true) + *

    + * System.out: STDOUT and STDERR interleaved + *

    + * System.err: unchanged

    + *

    + * System.out: STDOUT + *

    + * System.err: unchanged

    + *

    + * System.out: STDERR; + *

    + * The command's STDERR will be written to the stream referenced by + * {@link #dumpStdout()} rather than to the underlying file descriptor + * associated with the Java process's STDOUT + *

    + * System.err: unchanged

    redirectStderr(false) and dumpOutput(true) + *

    + * System.out: STDOUT + *

    + * System.err: STDERR

    + *

    + * System.out: STDOUT + *

    + * System.err: unchanged

    + *

    + * System.out: unchanged + *

    + * System.err: STDERR

    + * + *

    + * The table below shows how different parameter combinations affect the + * properties of {@link Result} objects returned by + * {@link #execute(ProcessBuilder, long)} or + * {@link #execute(ToolProvider, long, String...)} when processing character + * streams: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    saveOutput(true)saveFirstLineOfOutput()
    redirectStderr(true) and discardStdout(false) and + * discardStderr(false) + *

    + * content(): STDOUT and STDERR interleaved + *

    + * findStdout(): {@code Optional.empty()} + *

    + * findStderr(): {@code Optional.empty()}

    + *

    + * content(): a single-item list containing the first line of interleaved STDOUT + * and STDERR if the command produced any output; otherwise, an empty list + *

    + * findStdout(): {@code Optional.empty()} + *

    + * findStderr(): {@code Optional.empty()}

    redirectStderr(false) and discardStdout(false) and + * discardStderr(false) + *

    + * content(): STDOUT followed by STDERR + *

    + * stdout(): STDOUT + *

    + * stderr(): STDERR

    + *

    + * content(): a list containing at most two items: the first line of STDOUT (if + * the command produced any), followed by the first line of STDERR (if the + * command produced any) + *

    + * stdout(): The first line of STDOUT (if the command produced any); otherwise + * an empty list + *

    + * findStderr(): The first line of STDERR (if the command produced any); + * otherwise an empty list + *

    redirectStderr(true) and discardStdout(false) and + * discardStderr(true) + *

    + * content(): STDOUT + *

    + * stdout(): The same as content() + *

    + * findStderr(): {@code Optional.empty()}

    + *

    + * content(): The first line of STDOUT (if the command produced any); otherwise + * an empty list + *

    + * stdout(): The same as content() + *

    + * findStderr(): {@code Optional.empty()}

    redirectStderr(false) and discardStdout(false) and + * discardStderr(true) + *

    + * content(): STDOUT + *

    + * stdout(): The same as content() + *

    + * stderr(): an empty list

    + *

    + * content(): The first line of STDOUT (if the command produced any); otherwise + * an empty list + *

    + * stdout(): The same as content() + *

    + * stderr(): an empty list

    redirectStderr(true) and discardStdout(true) and + * discardStderr(false) + *

    + * content(): STDERR + *

    + * stdout(): The same as content() + *

    + * findStderr(): {@code Optional.empty()}

    + *

    + * content(): The first line of STDERR (if the command produced any); otherwise + * an empty list + *

    + * stdout(): The same as content() + *

    + * findStderr(): {@code Optional.empty()}

    redirectStderr(false) and discardStdout(true) and + * discardStderr(false) + *

    + * content(): STDERR + *

    + * findStdout(): an empty list + *

    + * stderr(): The same as content()

    + *

    + * content(): The first line of STDERR (if the command produced any); otherwise + * an empty list + *

    + * findStdout(): an empty list + *

    + * stderr(): The same as content()

    + *

    + * The table below shows how different parameter combinations affect the + * properties of {@link Result} objects returned by + * {@link #execute(ProcessBuilder, long)} or + * {@link #execute(ToolProvider, long, String...)} when processing byte streams: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    saveOutput(true) or saveFirstLineOfOutput()
    redirectStderr(true) and discardStdout(false) and + * discardStderr(false) + *

    + * byteContent(): STDOUT and STDERR interleaved + *

    + * findByteStdout(): {@code Optional.empty()} + *

    + * findByteStderr(): {@code Optional.empty()}

    redirectStderr(false) and discardStdout(false) and + * discardStderr(false) + *

    + * byteContent(): STDOUT followed by STDERR + *

    + * byteStdout(): STDOUT + *

    + * byteStderr(): STDERR

    redirectStderr(true) and discardStdout(false) and + * discardStderr(true) + *

    + * byteContent(): STDOUT + *

    + * byteStdout(): The same as byteContent() + *

    + * findByteStderr(): {@code Optional.empty()}

    redirectStderr(false) and discardStdout(false) and + * discardStderr(true) + *

    + * byteContent(): STDOUT + *

    + * byteStdout(): The same as byteContent() + *

    + * byteStderr(): an empty array

    redirectStderr(true) and discardStdout(true) and + * discardStderr(false) + *

    + * byteContent(): STDERR + *

    + * byteStdout(): The same as byteContent() + *

    + * findByteStderr(): {@code Optional.empty()}

    redirectStderr(false) and discardStdout(true) and + * discardStderr(false) + *

    + * byteContent(): STDERR + *

    + * findByteStdout(): an empty array + *

    + * byteStderr(): The same as byteContent()

    + */ +public final class CommandOutputControl { + + public CommandOutputControl() { + outputStreamsControl = new OutputStreamsControl(); + } + + private CommandOutputControl(CommandOutputControl other) { + flags = other.flags; + outputStreamsControl = other.outputStreamsControl.copy(); + dumpStdout = other.dumpStdout; + dumpStderr = other.dumpStderr; + charset = other.charset; + processListener = other.processListener; + } + + /** + * Specifies whether the full output produced by commands subsequently executed + * by this object will be saved. + *

    + * If {@code v} is {@code true}, both stdout and stderr streams will be saved; + * otherwise, they will not be saved. + *

    + * This setting is mutually exclusive with {@link #saveFirstLineOfOutput()}. + * + * @param v {@code true} to save the full stdout and stderr streams; + * {@code false} otherwise + * @return this + */ + public CommandOutputControl saveOutput(boolean v) { + return setOutputControl(v, OutputControlOption.SAVE_ALL); + } + + /** + * Returns whether this object will save the complete output of commands + * subsequently executed. + * + * @return {@code true} if this object will save the full output of commands it + * executes subsequently; {@code false} otherwise + */ + public boolean isSaveOutput() { + return outputStreamsControl.stdout().saveAll(); + } + + /** + * Specifies whether the first line of the output, combined from the stdout and + * stderr streams of commands subsequently executed by this object, will be + * saved. + *

    + * This setting is mutually exclusive with {@link #saveOutput(boolean)}. + * + * @return this + */ + public CommandOutputControl saveFirstLineOfOutput() { + return setOutputControl(true, OutputControlOption.SAVE_FIRST_LINE); + } + + /** + * Returns whether this object will save the first line of the output of + * commands subsequently executed. + * + * @return {@code true} if this object will save the first line of the output of + * commands it executes subsequently; {@code false} otherwise + */ + public boolean isSaveFirstLineOfOutput() { + return outputStreamsControl.stdout().saveFirstLine(); + } + + /** + * Specifies whether this object will dump the output streams from + * subsequently executed commands into the streams returned by + * {@link #dumpStdout()} and {@link #dumpStdout()} methods respectively. + *

    + * If this object is configured to redirect stderr of subsequently executed + * commands into their stdout ({@code redirectStderr(true)}), their output + * streams will be dumped into the stream returned by {@code dumpStdout()} + * method. Otherwise, their stdout and stderr streams will be dumped into the + * stream returned by {@code dumpStdout()} and {@code dumpStderr()} methods + * respectively. + * + * @param v if output streams from subsequently executed commands will be + * dumped into streams returned by {@code dumpStdout()} and + * {@code dumpStderr()} methods respectively + * + * @return this + * + * @see #redirectStderr(boolean) + * @see #dumpStdout() + * @see #dumpStderr() + */ + public CommandOutputControl dumpOutput(boolean v) { + setFlag(Flag.DUMP, v); + return setOutputControl(v, OutputControlOption.DUMP); + } + + /** + * Returns the value passed in the last call of {@link #dumpOutput(boolean)} + * method on this object, or {@code false} if the method has not been called. + * + * @return the value passed in the last call of {@link #dumpOutput(boolean)} + */ + public boolean isDumpOutput() { + return Flag.DUMP.isSet(flags); + } + + /** + * Specifies whether this object will treat output streams of subsequently + * executed commands as byte streams rather than character streams. + * + * @param v {@code true} if this object will treat the output streams of + * subsequently executed commands as byte streams, and {@code false} + * otherwise + * + * @return this + */ + public CommandOutputControl binaryOutput(boolean v) { + return setFlag(Flag.BINARY_OUTPUT, v); + } + + /** + * Returns the value passed in the last call of {@link #binaryOutput(boolean)} + * method on this object, or {@code false} if the method has not been called. + * + * @return the value passed in the last call of {@link #binaryOutput(boolean)} + */ + public boolean isBinaryOutput() { + return Flag.BINARY_OUTPUT.isSet(flags); + } + + /** + * Sets character encoding that will be applied to the stdout and the stderr + * streams of commands (subprocesses and {@code ToolProvider}-s) subsequently + * executed by this object. The default encoding is {@code UTF-8}. + *

    + * The value will be ignored if this object is configured for byte output + * streams. + * + * @param v character encoding for output streams of subsequently executed + * commands + * + * @see #binaryOutput(boolean) + * + * @return this + */ + public CommandOutputControl charset(Charset v) { + charset = v; + return this; + } + + /** + * Returns the value passed in the last call of + * {@link #charset(Charset)} method on this object, or + * {@link StandardCharsets#UTF_8} if the method has not been called. + * + * @return the character encoding that will be applied to the stdout and stderr + * streams of commands subsequently executed by this object + */ + public Charset charset() { + return Optional.ofNullable(charset).orElse(StandardCharsets.UTF_8); + } + + /** + * Specifies whether the stderr stream will be redirected into the stdout stream + * for commands subsequently executed by this object. + * + * @see ProcessBuilder#redirectErrorStream(boolean) + * + * @param v {@code true} if the stderr stream of commands subsequently executed + * by this object will be redirected into the stdout stream; + * {@code false} otherwise + * + * @return this + */ + public CommandOutputControl redirectStderr(boolean v) { + return setFlag(Flag.REDIRECT_STDERR, v); + } + + /** + * Returns the value passed in the last call of {@link #redirectStderr(boolean)} + * method on this object, or {@code false} if the method has not been called. + * + * @return the value passed in the last call of {@link #redirectStderr(boolean)} + */ + public boolean isRedirectStderr() { + return Flag.REDIRECT_STDERR.isSet(flags); + } + + /** + * Specifies whether stderr and stdout streams for subprocesses subsequently + * executed by this object will be stored in files. + *

    + * By default, if an output stream of a subprocess is configured for saving, + * this object will retrieve the content using {@link Process#getInputStream()} + * function for stdout and {@link Process#getErrorStream()} function for stderr. + * However, these functions don't always work correctly due to a + * JDK-8236825 bug + * still reproducible on macOS JDK26. The alternative way to get the content of + * output streams of a subprocess is to redirect them into files and read these + * files when the subprocess terminates. + *

    + * It will use {@code Files.createTempFile("jpackageOutputTempFile", ".tmp")} to + * create a file for each subprocess's output stream configured for saving. All + * created files will be automatically deleted at the exit of + * {@link #execute(ProcessBuilder, long)} method. + *

    + * Doesn't apply to executing {@code ToolProvider}-s. + *

    + * Storing output streams in files takes longer than managing them in memory and + * should be avoided if possible. + * + * @param v {@code true} if this object will use files to store saved output + * streams of subsequently executed subprocesses; {@code false} + * otherwise + * @return this + */ + public CommandOutputControl storeOutputInFiles(boolean v) { + return setFlag(Flag.STORE_OUTPUT_IN_FILES, v); + } + + /** + * Returns the value passed in the last call of {@link #storeOutputInFiles(boolean)} + * method on this object, or {@code false} if the method has not been called. + * + * @return the value passed in the last call of {@link #storeOutputInFiles(boolean)} + */ + public boolean isStoreOutputInFiles() { + return Flag.STORE_OUTPUT_IN_FILES.isSet(flags); + } + + /** + * Specifies whether stdout streams from commands subsequently executed by this + * object will be discarded. + * + * @param v {@code true} if this object will discard stdout streams from + * commands subsequently executed by this object; {@code false} + * otherwise + * @return this + */ + public CommandOutputControl discardStdout(boolean v) { + setFlag(Flag.DISCARD_STDOUT, v); + outputStreamsControl.stdout().discard(v); + return this; + } + + /** + * Returns the value passed in the last call of {@link #discardStdout(boolean)} + * method on this object, or {@code false} if the method has not been called. + * + * @return the value passed in the last call of {@link #discardStdout(boolean)} + */ + public boolean isDiscardStdout() { + return Flag.DISCARD_STDOUT.isSet(flags); + } + + /** + * Specifies whether stderr streams from commands subsequently executed by this + * object will be discarded. + * + * @param v {@code true} if this object will discard stderr streams from + * commands subsequently executed by this object; {@code false} + * otherwise + * @return this + */ + public CommandOutputControl discardStderr(boolean v) { + setFlag(Flag.DISCARD_STDERR, v); + outputStreamsControl.stderr().discard(v); + return this; + } + + /** + * Returns the value passed in the last call of {@link #discardStderr(boolean)} + * method on this object, or {@code false} if the method has not been called. + * + * @return the value passed in the last call of {@link #discardStderr(boolean)} + */ + public boolean isDiscardStderr() { + return Flag.DISCARD_STDERR.isSet(flags); + } + + /** + * Specifies the stream where stdout streams from commands subsequently executed + * by this object will be dumped. + *

    + * If the {@code null} is specified and this object configuration is equivalent + * to {@code dumpOutput(true).saveOutput(false).discardStdout(false)} the stdout + * streams from commands subsequently executed by this object will be written + * into the file descriptor associated with the {@code Systsem.out} stream. If + * you want them to be written into the {@code Systsem.out} object, pass the + * {@code Systsem.out} reference into this function. + * + * @param v the stream where stdout streams from commands subsequently executed + * by this object will be dumped; {@code null} permitted + * @return this + */ + public CommandOutputControl dumpStdout(PrintStream v) { + dumpStdout = v; + return this; + } + + /** + * Returns the value passed in the last call of {@link #dumpStdout(PrintStream)} + * method on this object, or {@link System#out} if the method has not been + * called. + * + * @return the stream where stdout streams from commands subsequently executed + * by this object will be dumped + */ + public PrintStream dumpStdout() { + return Optional.ofNullable(dumpStdout).orElse(System.out); + } + + /** + * Specifies the stream where stderr streams from commands subsequently executed + * by this object will be dumped. + *

    + * If the {@code null} is specified and this object configuration is equivalent + * to + * {@code dumpOutput(true).saveOutput(false).redirectStderr(false).discardStderr(false)} + * the stderr streams from commands subsequently executed by this object will be + * written into the file descriptor associated with the {@code Systsem.err} + * stream. If you want them to be written into the {@code Systsem.err} object, + * pass the {@code Systsem.err} reference into this function. + * + * @param v the stream where stderr streams from commands subsequently executed + * by this object will be dumped; {@code null} permitted + * @return this + */ + public CommandOutputControl dumpStderr(PrintStream v) { + dumpStderr = v; + return this; + } + + /** + * Returns the value passed in the last call of {@link #dumpStderr(PrintStream)} + * method on this object, or {@link System#err} if the method has not been + * called. + * + * @return the stream where stderr streams from commands subsequently executed + * by this object will be dumped + */ + public PrintStream dumpStderr() { + return Optional.ofNullable(dumpStderr).orElse(System.err); + } + + /** + * Sets the callback to be invoked when this object starts a subprocess from + * subsequent {@link #execute(ProcessBuilder, long)} calls. + * + *

    + * This object maintains a single callback. Calling this method replaces any + * previously set callback. + * + *

    + * The callback is invoked on the thread that calls + * {@link #execute(ProcessBuilder, long)} after the subprocess's output streams + * begin being pumped. + * + * @param v the callback for notifying a subprocess being started or + * {@code null} + * @return this + */ + public CommandOutputControl processListener(Consumer v) { + processListener = v; + return this; + } + + /** + * Returns an {@code Optional} wrapping the value passed in the last call of + * {@link #processListener(Consumer)} method on this object, or an empty + * {@code Optional} if the method has not been called or {@code null} was passed in the last call. + * + * @return an {@code Optional} wrapping the value passed in the last call of + * {@link #processListener(Consumer)} + */ + public Optional> processListener() { + return Optional.ofNullable(processListener); + } + + /** + * Returns a deep copy of this object. Changes to the copy will not affect the + * original. + * + * @return a deep copy of this object + */ + public CommandOutputControl copy() { + return new CommandOutputControl(this); + } + + public interface ExecutableAttributes { + List commandLine(); + + default String printableCommandLine() { + return CommandLineFormat.DEFAULT.apply(commandLine()); + } + } + + public sealed interface Executable { + + ExecutableAttributes attributes(); + + Result execute() throws IOException, InterruptedException; + + Result execute(long timeout, TimeUnit unit) throws IOException, InterruptedException; + } + + public record ProcessAttributes(Optional pid, List commandLine) implements ExecutableAttributes { + public ProcessAttributes { + Objects.requireNonNull(pid); + commandLine.forEach(Objects::requireNonNull); + } + } + + public record ToolProviderAttributes(String name, List args) implements ExecutableAttributes { + public ToolProviderAttributes { + Objects.requireNonNull(name); + args.forEach(Objects::requireNonNull); + } + + @Override + public List commandLine() { + return Stream.concat(Stream.of(name), args.stream()).toList(); + } + } + + public static ExecutableAttributes EMPTY_EXECUTABLE_ATTRIBUTES = new ExecutableAttributes() { + @Override + public List commandLine() { + return List.of(""); + } + }; + + public Executable createExecutable(ToolProvider tp, String... args) { + return new ToolProviderExecutable(tp, List.of(args), this); + } + + public Executable createExecutable(ProcessBuilder pb) { + return new ProcessExecutable(pb, this); + } + + public record Result( + Optional exitCode, + Optional>> output, + Optional> byteOutput, + ExecutableAttributes execAttrs) { + + public Result { + Objects.requireNonNull(exitCode); + Objects.requireNonNull(output); + Objects.requireNonNull(byteOutput); + Objects.requireNonNull(execAttrs); + } + + public static Builder build() { + return new Builder(); + } + + public static final class Builder { + + public Result create() { + return new Result( + exitCode, + Optional.ofNullable(content).map(List::copyOf).map(StringListContent::new).map(c -> { + return new CommandOutput>(Optional.of(c), c.size(), true); + }), + Optional.empty(), + Optional.ofNullable(execAttrs).orElse(EMPTY_EXECUTABLE_ATTRIBUTES)); + } + + public Builder exitCode(int v) { + exitCode = Optional.of(v); + return this; + } + + public Builder noExitCode() { + exitCode = Optional.empty(); + return this; + } + + public Builder execAttrs(ExecutableAttributes v) { + execAttrs = v; + return this; + } + + public Builder content(List v) { + content = v; + return this; + } + + public Builder content(String... v) { + return content(List.of(v)); + } + + private ExecutableAttributes execAttrs; + private List content; + private Optional exitCode = Optional.empty(); + } + + public Result(int exitCode) { + this(Optional.of(exitCode), Optional.empty(), Optional.empty(), EMPTY_EXECUTABLE_ATTRIBUTES); + } + + public int getExitCode() { + return exitCode.orElseThrow(() -> { + return new IllegalStateException("Exit code is unavailable for timed-out command"); + }); + } + + public Result expectExitCode(int main, int... other) throws UnexpectedExitCodeException { + return expectExitCode(v -> { + return IntStream.concat(IntStream.of(main), IntStream.of(other)).boxed().anyMatch(Predicate.isEqual(v)); + }); + } + + public Result expectExitCode(Collection expected) throws UnexpectedExitCodeException { + return expectExitCode(expected::contains); + } + + public Result expectExitCode(IntPredicate expected) throws UnexpectedExitCodeException { + if (!expected.test(getExitCode())) { + throw new UnexpectedExitCodeException(this); + } + return this; + } + + public UnexpectedResultException unexpected() { + return new UnexpectedResultException(this); + } + + public UnexpectedResultException unexpected(String message) { + return new UnexpectedResultException(this, message); + } + + public Optional> findContent() { + return output.flatMap(CommandOutput::combined); + } + + public Optional> findStdout() { + return output.flatMap(CommandOutput::stdout); + } + + public Optional> findStderr() { + return output.flatMap(CommandOutput::stderr); + } + + // For backward compatibility + public List getOutput() { + return content(); + } + + public List content() { + return findContent().orElseThrow(); + } + + public List stdout() { + return findStdout().orElseThrow(); + } + + public List stderr() { + return findStderr().orElseThrow(); + } + + public Optional findByteContent() { + return byteOutput.flatMap(CommandOutput::combined); + } + + public Optional findByteStdout() { + return byteOutput.flatMap(CommandOutput::stdout); + } + + public Optional findByteStderr() { + return byteOutput.flatMap(CommandOutput::stderr); + } + + public byte[] byteContent() { + return findByteContent().orElseThrow(); + } + + public byte[] byteStdout() { + return findByteStdout().orElseThrow(); + } + + public byte[] byteStderr() { + return findByteStderr().orElseThrow(); + } + + public Result toCharacterResult(Charset charset, boolean keepByteContent) throws IOException { + Objects.requireNonNull(charset); + + if (byteOutput.isEmpty()) { + return this; + } + + var theByteOutput = byteOutput.get(); + + try { + Optional>> out; + if (theByteOutput.content().isEmpty()) { + // The content is unavailable. + out = Optional.empty(); + } else if (theByteOutput.stdoutContentSize() == 0) { + // The content is available, but empty. + out = Optional.of(new StringListContent(List.of())); + } else if (theByteOutput.interleaved()) { + // STDOUT and STDERR streams are interleaved. + out = theByteOutput.combined().map(data -> { + return toStringList(data, charset); + }); + } else { + // Non-empty STDOUT not interleaved with STDERR. + out = findByteStdout().map(data -> { + return toStringList(data, charset); + }); + } + + var err = findByteStderr().map(data -> { + return toStringList(data, charset); + }); + + var newOutput = combine(out, err, theByteOutput.interleaved); + + return new Result(exitCode, Optional.of(newOutput), byteOutput.filter(_ -> keepByteContent), execAttrs); + } catch (UncheckedIOException ex) { + throw ex.getCause(); + } + } + + public Result copyWithExecutableAttributes(ExecutableAttributes execAttrs) { + return new Result(exitCode, output, byteOutput, Objects.requireNonNull(execAttrs)); + } + + private static StringListContent toStringList(byte[] data, Charset charset) { + try (var bufReader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data), charset))) { + return new StringListContent(bufReader.lines().toList()); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + } + } + + public static sealed class UnexpectedResultException extends IOException { + + private UnexpectedResultException(Result value, String message) { + super(Objects.requireNonNull(message)); + this.value = Objects.requireNonNull(value); + } + + private UnexpectedResultException(Result value) { + this(value, String.format("Unexpected result from executing the command %s", + value.execAttrs().printableCommandLine())); + } + + public Result getResult() { + return value; + } + + private final transient Result value; + + private static final long serialVersionUID = 1L; + } + + public static final class UnexpectedExitCodeException extends UnexpectedResultException { + + public UnexpectedExitCodeException(Result value, String message) { + super(requireExitCode(value), message); + } + + public UnexpectedExitCodeException(Result value) { + this(value, String.format("Unexpected exit code %d from executing the command %s", + requireExitCode(value).getExitCode(), value.execAttrs().printableCommandLine())); + } + + private static Result requireExitCode(Result v) { + Objects.requireNonNull(v); + if (v.exitCode().isPresent()) { + return v; + } else { + throw new IllegalArgumentException(); + } + } + + private static final long serialVersionUID = 1L; + } + + public String description() { + var tokens = outputStreamsControl.descriptionTokens(); + if (isBinaryOutput()) { + tokens.add("byte"); + } + if (redirectRetainedStderr()) { + tokens.add("interleave"); + } + return String.join("; ", tokens); + } + + private Result execute(ProcessBuilder pb, long timeoutMillis) + throws IOException, InterruptedException { + + Objects.requireNonNull(pb); + + var theCharset = charset(); + + configureProcessBuilder(pb); + + var csc = new CachingStreamsConfig(); + + var process = pb.start(); + + BiConsumer gobbler = (in, ps) -> { + try { + if (isBinaryOutput()) { + try (in) { + in.transferTo(ps); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + } else { + try (var bufReader = new BufferedReader(new InputStreamReader(in, theCharset))) { + bufReader.lines().forEach(ps::println); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + } + } finally { + suppressIOException(ps::flush); + } + }; + + // Start fetching process output streams. + // Do it before waiting for the process termination to avoid deadlocks. + + final Optional> stdoutGobbler; + if (mustReadOutputStream(pb.redirectOutput())) { + stdoutGobbler = Optional.of(CompletableFuture.runAsync(() -> { + gobbler.accept(process.getInputStream(), csc.out()); + }, gobblerExecutor)); + } else { + stdoutGobbler = Optional.empty(); + } + + final Optional> stderrGobbler; + if (!pb.redirectErrorStream() && mustReadOutputStream(pb.redirectError())) { + stderrGobbler = Optional.of(CompletableFuture.runAsync(() -> { + gobbler.accept(process.getErrorStream(), csc.err()); + }, gobblerExecutor)); + } else { + stderrGobbler = Optional.empty(); + } + + processListener().ifPresent(c -> { + c.accept(process); + }); + + final Optional exitCode; + if (timeoutMillis < 0) { + exitCode = Optional.of(process.waitFor()); + } else if (!process.waitFor(timeoutMillis, TimeUnit.MILLISECONDS)) { + // Destroy the process and cancel the process output stream gobblers. + process.destroy(); + for (var g : List.of(stdoutGobbler, stderrGobbler)) { + g.ifPresent(future -> { + future.cancel(true); + }); + } + exitCode = Optional.empty(); + } else { + exitCode = Optional.of(process.exitValue()); + } + + try { + if (isStoreOutputInFiles()) { + var stdoutStorage = streamFileSink(pb.redirectOutput()); + var stderrStorage = streamFileSink(pb.redirectError()); + + Function toInputStream = path -> { + try { + return Files.newInputStream(path); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + }; + + try { + stdoutStorage.map(toInputStream).ifPresent(in -> { + gobbler.accept(in, csc.out()); + }); + + stderrStorage.map(toInputStream).ifPresent(in -> { + gobbler.accept(in, csc.err()); + }); + } finally { + Consumer silentDeleter = path -> { + suppressIOException(Files::delete, path); + }; + + stdoutStorage.ifPresent(silentDeleter); + stderrStorage.ifPresent(silentDeleter); + } + } else { + stdoutGobbler.ifPresent(CommandOutputControl::join); + stderrGobbler.ifPresent(CommandOutputControl::join); + } + } catch (UncheckedIOException ex) { + throw ex.getCause(); + } + + return csc.createResult(exitCode, new ProcessAttributes(getPID(process), pb.command())); + } + + private Result execute(ToolProvider tp, long timeoutMillis, String... args) + throws IOException, InterruptedException { + + var csc = new CachingStreamsConfig(); + + Optional exitCode; + var out = csc.out(); + var err = csc.err(); + try { + if (timeoutMillis < 0) { + exitCode = Optional.of(tp.run(out, err, args)); + } else { + var future = new CompletableFuture>(); + + var workerThread = Thread.ofVirtual().start(() -> { + Optional result = Optional.empty(); + try { + result = Optional.of(tp.run(out, err, args)); + } catch (Exception ex) { + future.completeExceptionally(ex); + return; + } + future.complete(result); + }); + + try { + exitCode = future.get(timeoutMillis, TimeUnit.MILLISECONDS); + } catch (ExecutionException ex) { + // Rethrow the cause (ex.getCause()) as a RuntimeException. + // If `ex.getCause()` returns an Error, ExceptionBox.unbox() will throw it. + throw ExceptionBox.toUnchecked(ExceptionBox.unbox(ex.getCause())); + } catch (TimeoutException ex) { + workerThread.interrupt(); + exitCode = Optional.empty(); + } + } + } finally { + suppressIOException(out::flush); + suppressIOException(err::flush); + } + + return csc.createResult(exitCode, new ToolProviderAttributes(tp.name(), List.of(args))); + } + + private CommandOutputControl setOutputControl(boolean set, OutputControlOption v) { + outputStreamsControl.stdout().set(set, v); + outputStreamsControl.stderr().set(set, v); + return this; + } + + private CommandOutputControl setFlag(Flag flag, boolean v) { + flags = flag.set(flags, v); + return this; + } + + private Optional streamFileSink(ProcessBuilder.Redirect redirect) { + return Optional.of(redirect) + .filter(Predicate.isEqual(ProcessBuilder.Redirect.DISCARD).negate()) + .map(ProcessBuilder.Redirect::file) + .map(File::toPath); + } + + private void configureProcessBuilder(ProcessBuilder pb) throws IOException { + + var stdoutRedirect = outputStreamsControl.stdout().asProcessBuilderRedirect(); + var stderrRedirect = outputStreamsControl.stderr().asProcessBuilderRedirect(); + + if (!stdoutRedirect.equals(stderrRedirect) && Stream.of( + stdoutRedirect, + stderrRedirect + ).noneMatch(Predicate.isEqual(ProcessBuilder.Redirect.DISCARD)) && redirectRetainedStderr()) { + throw new IllegalStateException(String.format( + "Can't redirect stderr into stdout because they have different redirects: stdout=%s; stderr=%s", + stdoutRedirect, stderrRedirect)); + } + + pb.redirectErrorStream(redirectRetainedStderr()); + if (replaceStdoutWithStderr()) { + if (stderrRedirect.equals(ProcessBuilder.Redirect.INHERIT)) { + stderrRedirect = ProcessBuilder.Redirect.PIPE; + } + pb.redirectErrorStream(false); + } + + stdoutRedirect = mapRedirect(stdoutRedirect); + stderrRedirect = mapRedirect(stderrRedirect); + + if (dumpStdout != null && stdoutRedirect.equals(ProcessBuilder.Redirect.INHERIT)) { + stdoutRedirect = ProcessBuilder.Redirect.PIPE; + } + + if (dumpStderr != null && stderrRedirect.equals(ProcessBuilder.Redirect.INHERIT)) { + stderrRedirect = ProcessBuilder.Redirect.PIPE; + } + + pb.redirectOutput(stdoutRedirect); + pb.redirectError(stderrRedirect); + } + + private ProcessBuilder.Redirect mapRedirect(ProcessBuilder.Redirect redirect) throws IOException { + if (isStoreOutputInFiles() && redirect.equals(ProcessBuilder.Redirect.PIPE)) { + var sink = Files.createTempFile("jpackageOutputTempFile", ".tmp"); + return ProcessBuilder.Redirect.to(sink.toFile()); + } else { + return redirect; + } + } + + /** + * Returns {@code true} if STDERR is not discarded and will be redirected to STDOUT, and {@code false} otherwise. + */ + private boolean redirectRetainedStderr() { + return isRedirectStderr() && !outputStreamsControl.stderr().discard(); + } + + /** + * Returns {@code true} if STDERR will replace STDOUT, and {@code false} otherwise. + *

    + * STDERR will replace STDOUT if it is redirected and not discarded, and if STDOUT is discarded. + */ + private boolean replaceStdoutWithStderr() { + return redirectRetainedStderr() && outputStreamsControl.stdout().discard(); + } + + private static T join(CompletableFuture future, T cancelledValue) { + Objects.requireNonNull(future); + try { + return future.join(); + } catch (CancellationException ex) { + return cancelledValue; + } catch (CompletionException ex) { + switch (ExceptionBox.unbox(ex.getCause())) { + case IOException cause -> { + throw new UncheckedIOException(cause); + } + case UncheckedIOException cause -> { + throw cause; + } + case Exception cause -> { + throw ExceptionBox.toUnchecked(cause); + } + } + } + } + + private static void join(CompletableFuture future) { + join(future, null); + } + + private static boolean mustReadOutputStream(ProcessBuilder.Redirect redirect) { + return redirect.equals(ProcessBuilder.Redirect.PIPE); + } + + private static Optional> read(OutputControl outputControl, CachingPrintStream cps) throws IOException { + final var bufferAsString = cps.bufferContents(); + try (final var bufReader = new BufferedReader(new StringReader(bufferAsString.orElse("")))) { + if (outputControl.saveFirstLine()) { + return Optional.of(bufReader.lines().findFirst().map(List::of).orElseGet(List::of)); + } else if (outputControl.saveAll()) { + return Optional.of(bufReader.lines().toList()); + } else { + return Optional.empty(); + } + } catch (UncheckedIOException ex) { + throw ex.getCause(); + } + } + + private static Optional readBinary(OutputControl outputControl, CachingPrintStream cps) { + if (outputControl.save()) { + return cps.buf().map(ByteArrayOutputStream::toByteArray).or(() -> { + return Optional.of(new byte[0]); + }); + } else { + return Optional.empty(); + } + } + + private static CommandOutput combine( + Optional> out, + Optional> err, + boolean interleaved) { + + if (out.isEmpty() && err.isEmpty()) { + return CommandOutput.empty(); + } else if (out.isEmpty()) { + // This branch is unreachable because it is impossible to make it save stderr without saving stdout. + // If streams are configured for saving and stdout is discarded, + // its saved contents will be an Optional instance wrapping an empty content, not an empty Optional. + throw ExceptionBox.reachedUnreachable(); + } else if (err.isEmpty()) { + return new CommandOutput<>(out, Integer.MAX_VALUE, interleaved); + } else { + final var combined = out.get().append(err.get()); + return new CommandOutput<>(Optional.of(combined), out.orElseThrow().size(), interleaved); + } + } + + private static PrintStream nullPrintStream() { + return new PrintStream(OutputStream.nullOutputStream()); + } + + private sealed interface Content { + T data(); + int size(); + Content slice(int from, int to); + Content append(Content other); + } + + private record StringListContent(List data) implements Content> { + StringListContent { + Objects.requireNonNull(data); + } + + @Override + public int size() { + return data.size(); + } + + @Override + public StringListContent slice(int from, int to) { + return new StringListContent(data.subList(from, to)); + } + + @Override + public StringListContent append(Content> other) { + return new StringListContent(Stream.of(data, other.data()).flatMap(List::stream).toList()); + } + } + + private record ByteContent(byte[] data) implements Content { + ByteContent { + Objects.requireNonNull(data); + } + + @Override + public int size() { + return data.length; + } + + @Override + public ByteContent slice(int from, int to) { + return new ByteContent(Arrays.copyOfRange(data, from, to)); + } + + @Override + public ByteContent append(Content other) { + byte[] combined = new byte[size() + other.size()]; + System.arraycopy(data, 0, combined, 0, data.length); + System.arraycopy(other.data(), 0, combined, data.length, other.size()); + return new ByteContent(combined); + } + } + + private record OutputStreamsControl(OutputControl stdout, OutputControl stderr) { + OutputStreamsControl { + Objects.requireNonNull(stdout); + Objects.requireNonNull(stderr); + } + + OutputStreamsControl() { + this(new OutputControl(), new OutputControl()); + } + + OutputStreamsControl copy() { + return new OutputStreamsControl(stdout.copy(), stderr.copy()); + } + + List descriptionTokens() { + final List tokens = new ArrayList<>(); + if (stdout.save()) { // Save flags are the same for stdout and stderr, checking stdout is sufficient. + streamsLabel("save ", true).ifPresent(tokens::add); + } + if (stdout.dump() || stderr.dump()) { + streamsLabel("echo ", true).ifPresent(tokens::add); + } + streamsLabel("discard ", false).ifPresent(tokens::add); + if (tokens.isEmpty()) { + // Unreachable because there is always at least one token in the description. + throw ExceptionBox.reachedUnreachable(); + } else { + return tokens; + } + } + + private Optional streamsLabel(String prefix, boolean negate) { + Objects.requireNonNull(prefix); + final var str = Stream.of(stdoutLabel(negate), stderrLabel(negate)) + .filter(Optional::isPresent) + .map(Optional::orElseThrow) + .collect(joining("+")); + if (str.isEmpty()) { + return Optional.empty(); + } else { + return Optional.of(prefix + str); + } + } + + private Optional stdoutLabel(boolean negate) { + if ((stdout.discard() && !negate) || (!stdout.discard() && negate)) { + return Optional.of("out"); + } else { + return Optional.empty(); + } + } + + private Optional stderrLabel(boolean negate) { + if ((stderr.discard() && !negate) || (!stderr.discard() && negate)) { + return Optional.of("err"); + } else { + return Optional.empty(); + } + } + } + + private record CachingPrintStream(PrintStream ps, Optional buf) { + CachingPrintStream { + Objects.requireNonNull(ps); + Objects.requireNonNull(buf); + } + + Optional bufferContents() { + return buf.map(ByteArrayOutputStream::toString); + } + + static Builder build(Charset charset) { + return new Builder(charset); + } + + static final class Builder { + + private Builder(Charset charset) { + this.charset = Objects.requireNonNull(charset); + } + + Builder save(boolean v) { + save = v; + return this; + } + + Builder discard(boolean v) { + discard = v; + return this; + } + + Builder dumpStream(PrintStream v) { + dumpStream = v; + return this; + } + + Builder buffer(ByteArrayOutputStream v) { + externalBuffer = v; + return this; + } + + CachingPrintStream create() { + final Optional buf; + if (save && !discard) { + buf = Optional.ofNullable(externalBuffer).or(() -> { + return Optional.of(new ByteArrayOutputStream()); + }); + } else { + buf = Optional.empty(); + } + + final PrintStream ps; + if (buf.isPresent() && dumpStream != null) { + ps = new PrintStream(new TeeOutputStream(List.of(buf.get(), dumpStream)), true, dumpStream.charset()); + } else if (!discard) { + ps = buf.map(in -> { + return new PrintStream(in, false, charset); + }).or(() -> { + return Optional.ofNullable(dumpStream); + }).orElseGet(CommandOutputControl::nullPrintStream); + } else { + ps = nullPrintStream(); + } + + return new CachingPrintStream(ps, buf); + } + + private boolean save; + private boolean discard; + private PrintStream dumpStream; + private ByteArrayOutputStream externalBuffer; + private final Charset charset; + } + } + + private final class CachingStreamsConfig { + + CachingStreamsConfig() { + out = outputStreamsControl.stdout().buildCachingPrintStream(dumpStdout(), charset()).create(); + if (isRedirectStderr()) { + var builder = outputStreamsControl.stderr().buildCachingPrintStream(dumpStdout(), charset()); + out.buf().ifPresent(builder::buffer); + err = builder.create(); + } else { + err = outputStreamsControl.stderr().buildCachingPrintStream(dumpStderr(), charset()).create(); + } + } + + Result createResult(Optional exitCode, ExecutableAttributes execAttrs) throws IOException { + + CommandOutput> output; + CommandOutput byteOutput; + + CachingPrintStream effectiveOut; + if (out.buf().isEmpty() && isRedirectStderr()) { + effectiveOut = new CachingPrintStream(nullPrintStream(), err.buf()); + } else { + effectiveOut = out; + } + + if (isBinaryOutput()) { + Optional outContent, errContent; + if (isRedirectStderr()) { + outContent = readBinary(outputStreamsControl.stdout(), effectiveOut).map(ByteContent::new); + errContent = Optional.empty(); + } else { + outContent = readBinary(outputStreamsControl.stdout(), out).map(ByteContent::new); + errContent = readBinary(outputStreamsControl.stderr(), err).map(ByteContent::new); + } + + byteOutput = combine(outContent, errContent, redirectRetainedStderr()); + output = null; + } else { + Optional outContent, errContent; + if (isRedirectStderr()) { + outContent = read(outputStreamsControl.stdout(), effectiveOut).map(StringListContent::new); + errContent = Optional.empty(); + } else { + outContent = read(outputStreamsControl.stdout(), out).map(StringListContent::new); + errContent = read(outputStreamsControl.stderr(), err).map(StringListContent::new); + } + + output = combine(outContent, errContent, redirectRetainedStderr()); + byteOutput = null; + } + + return new Result(exitCode, Optional.ofNullable(output), Optional.ofNullable(byteOutput), execAttrs); + } + + PrintStream out() { + return out.ps(); + } + + PrintStream err() { + return err.ps(); + } + + private final CachingPrintStream out; + private final CachingPrintStream err; + } + + private static final class OutputControl { + + OutputControl() { + } + + private OutputControl(OutputControl other) { + dump = other.dump; + discard = other.discard; + save = other.save; + } + + boolean save() { + return save.isPresent(); + } + + boolean saveAll() { + return save.orElse(null) == OutputControlOption.SAVE_ALL; + } + + boolean saveFirstLine() { + return save.orElse(null) == OutputControlOption.SAVE_FIRST_LINE; + } + + boolean discard() { + return discard || (!dump && save.isEmpty()); + } + + boolean dump() { + return !discard && dump; + } + + OutputControl dump(boolean v) { + this.dump = v; + return this; + } + + OutputControl discard(boolean v) { + this.discard = v; + return this; + } + + OutputControl saveAll(boolean v) { + if (v) { + save = Optional.of(OutputControlOption.SAVE_ALL); + } else { + save = Optional.empty(); + } + return this; + } + + OutputControl saveFirstLine(boolean v) { + if (v) { + save = Optional.of(OutputControlOption.SAVE_FIRST_LINE); + } else { + save = Optional.empty(); + } + return this; + } + + OutputControl set(boolean set, OutputControlOption v) { + switch (v) { + case DUMP -> dump(set); + case SAVE_ALL -> saveAll(set); + case SAVE_FIRST_LINE -> saveFirstLine(set); + } + return this; + } + + OutputControl copy() { + return new OutputControl(this); + } + + ProcessBuilder.Redirect asProcessBuilderRedirect() { + if (discard()) { + return ProcessBuilder.Redirect.DISCARD; + } else if (dump && !save()) { + return ProcessBuilder.Redirect.INHERIT; + } else { + return ProcessBuilder.Redirect.PIPE; + } + } + + CachingPrintStream.Builder buildCachingPrintStream(PrintStream dumpStream, Charset charset) { + Objects.requireNonNull(dumpStream); + final var builder = CachingPrintStream.build(charset).save(save()).discard(discard()); + if (dump()) { + builder.dumpStream(dumpStream); + } + return builder; + } + + private boolean dump; + private boolean discard; + private Optional save = Optional.empty(); + } + + private record CommandOutput(Optional> content, int stdoutContentSize, boolean interleaved) { + + CommandOutput { + Objects.requireNonNull(content); + if (interleaved) { + stdoutContentSize = content.map(Content::size).orElse(-1); + } + } + + CommandOutput() { + this(Optional.empty(), 0, false); + } + + Optional combined() { + return content.map(Content::data); + } + + /** + * Returns non-empty {@code Optional} if stdout is available and stdout and stderr are not interleaved. + * @return stdout if it can be extracted from the combined output + */ + Optional stdout() { + if (withoutExtractableStdout()) { + return Optional.empty(); + } + + final var theContent = content.orElseThrow(); + if (stdoutContentSize == theContent.size()) { + return combined(); + } else { + return Optional.of(theContent.slice(0, Integer.min(stdoutContentSize, theContent.size())).data()); + } + } + + /** + * Returns non-empty {@code Optional} if stderr is available and stdout and stderr are not interleaved. + * @return stderr if it can be extracted from the combined output + */ + Optional stderr() { + if (withoutExtractableStderr()) { + return Optional.empty(); + } else if (stdoutContentSize <= 0) { + return combined(); + } else { + final var theContent = content.orElseThrow(); + return Optional.of(theContent.slice(stdoutContentSize, theContent.size()).data()); + } + } + + @SuppressWarnings("unchecked") + static CommandOutput empty() { + return (CommandOutput)EMPTY; + } + + private boolean withoutExtractableStdout() { + return interleaved || content.isEmpty() || stdoutContentSize < 0; + } + + private boolean withoutExtractableStderr() { + return interleaved || content.isEmpty() || stdoutContentSize > content.get().size(); + } + + private static final CommandOutput EMPTY = new CommandOutput<>(); + } + + private record ToolProviderExecutable(ToolProvider tp, List args, CommandOutputControl coc) implements Executable { + + ToolProviderExecutable { + Objects.requireNonNull(tp); + Objects.requireNonNull(args); + Objects.requireNonNull(coc); + } + + @Override + public Result execute() throws IOException, InterruptedException { + return coc.execute(tp, -1, args.toArray(String[]::new)); + } + + @Override + public Result execute(long timeout, TimeUnit unit) throws IOException, InterruptedException { + return coc.execute(tp, unit.toMillis(timeout), args.toArray(String[]::new)); + } + + @Override + public ExecutableAttributes attributes() { + return new ToolProviderAttributes(tp.name(), args); + } + } + + private record ProcessExecutable(ProcessBuilder pb, CommandOutputControl coc) implements Executable { + + ProcessExecutable { + Objects.requireNonNull(pb); + Objects.requireNonNull(coc); + } + + @Override + public Result execute() throws IOException, InterruptedException { + return coc.execute(pb, -1L); + } + + @Override + public Result execute(long timeout, TimeUnit unit) throws IOException, InterruptedException { + return coc.execute(pb, unit.toMillis(timeout)); + } + + @Override + public ExecutableAttributes attributes() { + return new ProcessAttributes(Optional.empty(), pb.command()); + } + } + + private static Optional getPID(Process p) { + try { + return Optional.of(p.pid()); + } catch (UnsupportedOperationException ex) { + return Optional.empty(); + } + } + + private static void suppressIOException(ThrowingRunnable r) { + try { + r.run(); + } catch (IOException ex) {} + } + + private static void suppressIOException(ThrowingConsumer c, T value) { + suppressIOException(() -> { + c.accept(value); + }); + } + + private int flags; + private final OutputStreamsControl outputStreamsControl; + private PrintStream dumpStdout; + private PrintStream dumpStderr; + private Charset charset; + private Consumer processListener; + + // Executor to run subprocess output stream gobblers. + // Output stream gobblers should start fetching output streams ASAP after the process starts. + // No pooling, no waiting. + // CompletableFuture#runAsync() method starts an output stream gobbler. + // If used with the default executor, it is known to make WiX3 light.exe create + // a locked msi file when multiple jpackage tool providers are executed asynchronously. + // The AsyncTest fails with cryptic java.nio.file.FileSystemException error: + // jtreg_open_test_jdk_tools_jpackage_share_AsyncTest_java\\tmp\\jdk.jpackage8108811639097525318\\msi\\Foo-1.0.msi: The process cannot access the file because it is being used by another process. + // The remedy for the problem is to use non-pooling executor to run subprocess output stream gobblers. + private final java.util.concurrent.Executor gobblerExecutor = Executors.newVirtualThreadPerTaskExecutor(); + + private enum OutputControlOption { + SAVE_ALL, SAVE_FIRST_LINE, DUMP + } + + private enum Flag { + DUMP (0x01), + REDIRECT_STDERR (0x02), + BINARY_OUTPUT (0x04), + STORE_OUTPUT_IN_FILES (0x08), + DISCARD_STDOUT (0x10), + DISCARD_STDERR (0x20), + ; + + Flag(int value) { + this.value = value; + } + + int set(int flags, boolean set) { + if (set) { + return flags | value; + } else { + return flags & ~value; + } + } + + boolean isSet(int flags) { + return (flags & value) != 0; + } + + private final int value; + } +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Enquoter.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Enquoter.java similarity index 77% rename from src/jdk.jpackage/share/classes/jdk/jpackage/internal/Enquoter.java rename to src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Enquoter.java index 51f97ad2cd6..d9ededcbadb 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/Enquoter.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Enquoter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, 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 @@ -22,7 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.jpackage.internal; +package jdk.jpackage.internal.util; import java.util.Optional; import java.util.function.BiConsumer; @@ -32,39 +32,43 @@ import java.util.regex.Pattern; /** * Add quotes to the given string in a configurable way. */ -final class Enquoter { +public final class Enquoter { private Enquoter() { setQuoteChar('"'); } - static Enquoter forPropertyValues() { + public static Enquoter identity() { + return new Enquoter(); + } + + public static Enquoter forPropertyValues() { return new Enquoter() .setEnquotePredicate(QUOTE_IF_WHITESPACES) .setEscaper(PREPEND_BACKSLASH); } - static Enquoter forShellLiterals() { + public static Enquoter forShellLiterals() { return forShellLiterals('\''); } - static Enquoter forShellLiterals(char quoteChar) { + public static Enquoter forShellLiterals(char quoteChar) { return new Enquoter() .setQuoteChar(quoteChar) .setEnquotePredicate(x -> true) .setEscaper(PREPEND_BACKSLASH); } - String applyTo(String v) { + public String applyTo(String v) { if (!needQuotes.test(v)) { return v; } else { var buf = new StringBuilder(); buf.appendCodePoint(beginQuoteChr); - Optional.of(escaper).ifPresentOrElse(op -> { + Optional.ofNullable(escaper).ifPresentOrElse(op -> { v.codePoints().forEachOrdered(chr -> { if (chr == beginQuoteChr || chr == endQuoteChr) { - escaper.accept(chr, buf); + op.accept(chr, buf); } else { buf.appendCodePoint(chr); } @@ -77,28 +81,23 @@ final class Enquoter { } } - Enquoter setQuoteChar(char chr) { + public Enquoter setQuoteChar(char chr) { beginQuoteChr = chr; endQuoteChr = chr; return this; } - Enquoter setEscaper(BiConsumer v) { + public Enquoter setEscaper(BiConsumer v) { escaper = v; return this; } - Enquoter setEnquotePredicate(Predicate v) { + public Enquoter setEnquotePredicate(Predicate v) { needQuotes = v; return this; } - private int beginQuoteChr; - private int endQuoteChr; - private BiConsumer escaper; - private Predicate needQuotes = str -> false; - - private static final Predicate QUOTE_IF_WHITESPACES = new Predicate() { + public static final Predicate QUOTE_IF_WHITESPACES = new Predicate() { @Override public boolean test(String t) { return pattern.matcher(t).find(); @@ -106,8 +105,13 @@ final class Enquoter { private final Pattern pattern = Pattern.compile("\\s"); }; - private static final BiConsumer PREPEND_BACKSLASH = (chr, buf) -> { + public static final BiConsumer PREPEND_BACKSLASH = (chr, buf) -> { buf.append('\\'); buf.appendCodePoint(chr); }; + + private int beginQuoteChr; + private int endQuoteChr; + private BiConsumer escaper; + private Predicate needQuotes = str -> false; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/FileUtils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/FileUtils.java index 49c395642f4..b143a54cb5c 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/FileUtils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/FileUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 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 @@ -37,7 +37,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import jdk.internal.util.OperatingSystem; -import jdk.jpackage.internal.util.function.ExceptionBox; import jdk.jpackage.internal.util.function.ThrowingConsumer; public final class FileUtils { @@ -58,12 +57,6 @@ public final class FileUtils { public static void copyRecursive(Path src, Path dest, CopyOption... options) throws IOException { - copyRecursive(src, dest, List.of(), options); - } - - public static void copyRecursive(Path src, Path dest, - final List excludes, CopyOption... options) - throws IOException { List copyActions = new ArrayList<>(); @@ -72,24 +65,18 @@ public final class FileUtils { @Override public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) { - if (isPathMatch(dir, excludes)) { - return FileVisitResult.SKIP_SUBTREE; - } else { - copyActions.add(new CopyAction(null, dest.resolve(src.relativize(dir)))); - return FileVisitResult.CONTINUE; - } + copyActions.add(new CopyAction(null, dest.resolve(src.relativize(dir)))); + return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) { - if (!isPathMatch(file, excludes)) { - copyActions.add(new CopyAction(file, dest.resolve(src.relativize(file)))); - } + copyActions.add(new CopyAction(file, dest.resolve(src.relativize(file)))); return FileVisitResult.CONTINUE; } }); - } else if (!isPathMatch(src, excludes)) { + } else { Optional.ofNullable(dest.getParent()).ifPresent(dstDir -> { copyActions.add(new CopyAction(null, dstDir)); }); @@ -114,10 +101,6 @@ public final class FileUtils { } } - private static boolean isPathMatch(Path what, List paths) { - return paths.stream().anyMatch(what::endsWith); - } - private static record CopyAction(Path src, Path dest) { void apply(CopyOption... options) throws IOException { @@ -170,15 +153,13 @@ public final class FileUtils { } } - private void runActionOnPath(ThrowingConsumer action, Path path) { + private void runActionOnPath(ThrowingConsumer action, Path path) { try { action.accept(path); } catch (IOException ex) { if (this.ex == null) { this.ex = ex; } - } catch (Throwable t) { - throw ExceptionBox.rethrowUnchecked(t); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/IdentityWrapper.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/IdentityWrapper.java index 0a7a8cc8d4b..7b4c75630ac 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/IdentityWrapper.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/IdentityWrapper.java @@ -69,5 +69,9 @@ public final class IdentityWrapper { return String.format("Identity[%s]", value); } + public static IdentityWrapper wrapIdentity(T v) { + return new IdentityWrapper<>(v); + } + private final T value; } diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundle.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/MacBundle.java similarity index 63% rename from src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundle.java rename to src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/MacBundle.java index 723614f9bd6..95629e7d4b5 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundle.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/MacBundle.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 @@ -23,54 +23,49 @@ * questions. */ -package jdk.jpackage.internal; +package jdk.jpackage.internal.util; import java.nio.file.Files; import java.nio.file.Path; import java.util.Objects; import java.util.Optional; -import jdk.jpackage.internal.model.AppImageLayout; /** * An abstraction of macOS Application bundle. * * @see https://en.wikipedia.org/wiki/Bundle_(macOS)#Application_bundles */ -record MacBundle(Path root) { +public record MacBundle(Path root) { - MacBundle { + public MacBundle { Objects.requireNonNull(root); } - boolean isValid() { + public boolean isValid() { return Files.isDirectory(contentsDir()) && Files.isDirectory(macOsDir()) && Files.isRegularFile(infoPlistFile()); } - boolean isSigned() { - return Files.isDirectory(contentsDir().resolve("_CodeSignature")); - } - - Path contentsDir() { + public Path contentsDir() { return root.resolve("Contents"); } - Path homeDir() { + public Path homeDir() { return contentsDir().resolve("Home"); } - Path macOsDir() { + public Path macOsDir() { return contentsDir().resolve("MacOS"); } - Path resourcesDir() { + public Path resourcesDir() { return contentsDir().resolve("Resources"); } - Path infoPlistFile() { + public Path infoPlistFile() { return contentsDir().resolve("Info.plist"); } - static Optional fromPath(Path path) { + public static Optional fromPath(Path path) { var bundle = new MacBundle(path); if (bundle.isValid()) { return Optional.of(bundle); @@ -78,20 +73,4 @@ record MacBundle(Path root) { return Optional.empty(); } } - - static Optional fromAppImageLayout(AppImageLayout layout) { - final var root = layout.rootDirectory(); - final var bundleSubdir = root.relativize(layout.runtimeDirectory()); - final var contentsDirname = Path.of("Contents"); - var bundleRoot = root; - for (int i = 0; i != bundleSubdir.getNameCount(); i++) { - var nameComponent = bundleSubdir.getName(i); - if (contentsDirname.equals(nameComponent)) { - return Optional.of(new MacBundle(bundleRoot)); - } else { - bundleRoot = bundleRoot.resolve(nameComponent); - } - } - return Optional.empty(); - } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PListReader.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PListReader.java index 2c693939dab..4c85358d424 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PListReader.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PListReader.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 @@ -35,7 +35,6 @@ import java.util.NoSuchElementException; import java.util.Objects; import java.util.Optional; import java.util.stream.Stream; -import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.dom.DOMSource; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; @@ -311,7 +310,7 @@ public final class PListReader { } } - public PListReader(byte[] xmlData) throws ParserConfigurationException, SAXException, IOException { + public PListReader(byte[] xmlData) throws SAXException, IOException { this(XmlUtils.initDocumentBuilder().parse(new ByteArrayInputStream(xmlData))); } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Result.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Result.java index 8a61acafe77..46e99f134df 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Result.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Result.java @@ -24,33 +24,28 @@ */ package jdk.jpackage.internal.util; -import static jdk.jpackage.internal.util.function.ExceptionBox.rethrowUnchecked; - import java.util.Collection; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import java.util.function.UnaryOperator; import java.util.stream.StreamSupport; +import jdk.jpackage.internal.util.function.ExceptionBox; +import jdk.jpackage.internal.util.function.ThrowingSupplier; public record Result(Optional value, Collection errors) { public Result { if (value.isEmpty() == errors.isEmpty()) { - throw new IllegalArgumentException(); + throw new IllegalArgumentException("'value' and 'errors' cannot both be non-empty or both be empty"); } - - if (value.isEmpty() && errors.isEmpty()) { - throw new IllegalArgumentException("Error collection must be non-empty"); - } - } public T orElseThrow() { firstError().ifPresent(ex -> { - rethrowUnchecked(ex); + throw ExceptionBox.toUnchecked(ex); }); return value.orElseThrow(); } @@ -64,7 +59,16 @@ public record Result(Optional value, Collection error } public Result map(Function conv) { - return new Result<>(value.map(conv), errors); + if (hasValue()) { + var mapped = value.map(conv); + if (mapped.isEmpty()) { + throw new NullPointerException(); + } else { + return new Result<>(mapped, errors); + } + } else { + return mapErrors(); + } } public Result flatMap(Function> conv) { @@ -73,12 +77,12 @@ public record Result(Optional value, Collection error }); } - public Result mapErrors(UnaryOperator> errorsMapper) { - return new Result<>(value, errorsMapper.apply(errors)); - } - + @SuppressWarnings("unchecked") public Result mapErrors() { - return new Result<>(Optional.empty(), errors); + if (hasValue()) { + throw new IllegalStateException("Can not map errors from a result without errors"); + } + return (Result)this; } public Result peekErrors(Consumer> consumer) { @@ -97,12 +101,31 @@ public record Result(Optional value, Collection error return errors.stream().findFirst(); } - public static Result create(Supplier supplier) { + public static Result of(Supplier supplier) { + return of(supplier::get, RuntimeException.class); + } + + public static Result of( + ThrowingSupplier supplier, Class supplierExceptionType) { + + Objects.requireNonNull(supplier); + Objects.requireNonNull(supplierExceptionType); + + T value; try { - return ofValue(supplier.get()); + value = supplier.get(); } catch (Exception ex) { - return ofError(ex); + if (supplierExceptionType.isInstance(ex)) { + return ofError(ex); + } else if (ex instanceof RuntimeException rex) { + throw rex; + } else { + // Unreachable because the `supplier` can throw exceptions of type or supertype `E` or runtime exceptions. + throw ExceptionBox.reachedUnreachable(); + } } + + return ofValue(value); } public static Result ofValue(T value) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/RetryExecutor.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/RetryExecutor.java new file mode 100644 index 00000000000..c67373e8233 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/RetryExecutor.java @@ -0,0 +1,194 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal.util; + +import static jdk.jpackage.internal.util.function.ThrowingConsumer.toConsumer; + +import java.time.Duration; +import java.util.Iterator; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; +import java.util.function.Function; +import jdk.jpackage.internal.util.function.ExceptionBox; +import jdk.jpackage.internal.util.function.ThrowingFunction; +import jdk.jpackage.internal.util.function.ThrowingSupplier; + +public class RetryExecutor { + + public RetryExecutor(Class exceptionType) { + this.exceptionType = Objects.requireNonNull(exceptionType); + setMaxAttemptsCount(5); + setAttemptTimeout(2, TimeUnit.SECONDS); + } + + final public Class exceptionType() { + return exceptionType; + } + + public RetryExecutor setExecutable(ThrowingFunction>, T, E> v) { + executable = v; + return this; + } + + final public RetryExecutor setExecutable(ThrowingSupplier v) { + if (v != null) { + setExecutable(_ -> { + return v.get(); + }); + } else { + executable = null; + } + return this; + } + + public RetryExecutor setMaxAttemptsCount(int v) { + attempts = v; + return this; + } + + final public RetryExecutor setAttemptTimeout(long v, TimeUnit unit) { + return setAttemptTimeout(Duration.of(v, unit.toChronoUnit())); + } + + public RetryExecutor setAttemptTimeout(Duration v) { + timeout = v; + return this; + } + + public RetryExecutor setExceptionMapper(Function v) { + toUnchecked = v; + return this; + } + + public RetryExecutor setSleepFunction(Consumer v) { + sleepFunction = v; + return this; + } + + final public RetryExecutor mutate(Consumer> mutator) { + mutator.accept(this); + return this; + } + + public T execute() throws E { + var curExecutable = executable(); + T result = null; + var attemptIter = new DefaultContext(); + while (attemptIter.hasNext()) { + attemptIter.next(); + try { + result = curExecutable.apply(attemptIter); + break; + } catch (Exception ex) { + if (!exceptionType.isInstance(ex)) { + throw ExceptionBox.toUnchecked(ex); + } else if (attemptIter.isLastAttempt()) { + // No more attempts left. This is fatal. + throw exceptionType.cast(ex); + } else { + curExecutable = executable(); + } + } + + sleep(); + } + + return result; + } + + final public T executeUnchecked() { + try { + return execute(); + } catch (Error | RuntimeException t) { + throw t; + } catch (Exception ex) { + if (exceptionType.isInstance(ex)) { + throw Optional.ofNullable(toUnchecked).orElse(ExceptionBox::toUnchecked).apply(exceptionType.cast(ex)); + } else { + // Unreachable unless it is a direct subclass of Throwable, + // which is not Error or Exception which should not happen. + throw ExceptionBox.reachedUnreachable(); + } + } + } + + public interface Context { + boolean isLastAttempt(); + int attempt(); + T executor(); + } + + private final class DefaultContext implements Context>, Iterator { + + @Override + public boolean isLastAttempt() { + return !hasNext(); + } + + @Override + public int attempt() { + return attempt; + } + + @Override + public boolean hasNext() { + return (attempts - attempt) > 1; + } + + @Override + public Void next() { + attempt++; + return null; + } + + @Override + public RetryExecutor executor() { + return RetryExecutor.this; + } + + private int attempt = -1; + } + + private ThrowingFunction>, T, E> executable() { + return Optional.ofNullable(executable).orElseThrow(() -> { + return new IllegalStateException("No executable"); + }); + } + + private void sleep() { + Optional.ofNullable(timeout).ifPresent(Optional.ofNullable(sleepFunction).orElseGet(() -> { + return toConsumer(Thread::sleep); + })); + } + + private final Class exceptionType; + private ThrowingFunction>, T, E> executable; + private int attempts; + private Duration timeout; + private Function toUnchecked; + private Consumer sleepFunction; +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/RootedPath.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/RootedPath.java new file mode 100644 index 00000000000..21d3b6b17b0 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/RootedPath.java @@ -0,0 +1,185 @@ +/* + * 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal.util; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.CopyOption; +import java.nio.file.FileVisitResult; +import java.nio.file.FileVisitor; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Stream; + +/** + * A relative path (branch) rooted at the root. + */ +public sealed interface RootedPath { + + Path root(); + Path branch(); + + default Path fullPath() { + return root().resolve(branch()); + } + + public static Function toRootedPath(Path root) { + return path -> { + if (!path.startsWith(root)) { + throw new IllegalArgumentException(String.format("Expected path [%s] to start with [%s] root", path, root)); + } + return new Details.DefaultRootedPath(root, root.relativize(path), Files.isDirectory(path)); + }; + } + + public static void copy(Stream rootedPaths, Path dest, CopyOption...options) throws IOException { + Objects.requireNonNull(rootedPaths); + Objects.requireNonNull(dest); + + var marks = new HashMap(); + + // Preset marks for the preexisting paths. + Files.walkFileTree(dest, new FileVisitor() { + + @Override + public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { + marks.put(dir, new Details.PathMark(true, true)); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + marks.put(file, new Details.PathMark(false, true)); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { + return FileVisitResult.TERMINATE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + return FileVisitResult.CONTINUE; + } + + }); + + var replacePreexisting = Set.of(options).contains(StandardCopyOption.REPLACE_EXISTING); + + Predicate canReplace = v -> { + return v.isPreexisting() && replacePreexisting; + }; + + try { + rootedPaths.sequential().map(Details.DefaultRootedPath.class::cast).forEach(rootedPath -> { + + final var dstPath = dest.resolve(rootedPath.branch()); + + var dstPathMark = marks.get(dstPath); + + if (!Optional.ofNullable(dstPathMark).map(canReplace::test).orElse(true)) { + // Destination path can not be replaced, bail out. + return; + } + + // Check the ancestors of the destination path. + for (var ancestor : Details.ancestorPaths(rootedPath.branch())) { + var mark = Optional.ofNullable(marks.get(dest.resolve(ancestor))); + + if (!mark.map(Details.PathMark::isDirectory).orElse(true)) { + // `ancestor` is a file, don't overwrite it. + return; + } + } + + dstPathMark = rootedPath.createPathMark(); + marks.put(dstPath, dstPathMark); + + try { + if (replacePreexisting && (rootedPath.isDirectory() != dstPathMark.isDirectory())) { + FileUtils.deleteRecursive(dstPath); + } + + if (rootedPath.isDirectory()) { + Files.createDirectories(dstPath); + } else { + Files.createDirectories(dstPath.getParent()); + Files.copy(rootedPath.fullPath(), dstPath, options); + } + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + }); + } catch (UncheckedIOException ex) { + throw ex.getCause(); + } + } + + static final class Details { + + private Details() { + } + + private record DefaultRootedPath(Path root, Path branch, boolean isDirectory) implements RootedPath { + + DefaultRootedPath { + Objects.requireNonNull(root); + Objects.requireNonNull(branch); + if (branch.isAbsolute()) { + throw new IllegalArgumentException(); + } + } + + PathMark createPathMark() { + return new PathMark(isDirectory); + } + } + + private record PathMark(boolean isDirectory, boolean isPreexisting) { + PathMark(boolean isDirectory) { + this(isDirectory, false); + } + } + + private static List ancestorPaths(Path path) { + var ancestors = new ArrayList(); + while ((path = path.getParent()) != null) { + ancestors.add(path); + } + return ancestors; + } + } +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/SetBuilder.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/SetBuilder.java index 18736b4ed7e..d3d677cba50 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/SetBuilder.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/SetBuilder.java @@ -31,7 +31,7 @@ import java.util.Set; public final class SetBuilder { - public static SetBuilder build(Class type) { + public static SetBuilder build() { return new SetBuilder<>(); } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/TeeOutputStream.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/TeeOutputStream.java new file mode 100644 index 00000000000..db098eb2b48 --- /dev/null +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/TeeOutputStream.java @@ -0,0 +1,89 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.jpackage.internal.util; + +import java.io.Closeable; +import java.io.Flushable; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Objects; +import jdk.jpackage.internal.util.function.ThrowingConsumer; + +public final class TeeOutputStream extends OutputStream { + + public TeeOutputStream(Iterable items) { + items.forEach(Objects::requireNonNull); + this.items = items; + } + + @Override + public void write(int b) throws IOException { + for (final var item : items) { + item.write(b); + } + } + + @Override + public void write(byte[] b) throws IOException { + for (final var item : items) { + item.write(b); + } + } + + @Override + public void write(byte[] b, int off, int len) throws IOException { + for (final var item : items) { + item.write(b, off, len); + } + } + + @Override + public void flush() throws IOException { + forEach(Flushable::flush); + } + + @Override + public void close() throws IOException { + forEach(Closeable::close); + } + + private void forEach(ThrowingConsumer c) throws IOException { + IOException firstEx = null; + for (final var item : items) { + try { + c.accept(item); + } catch (IOException e) { + if (firstEx == null) { + firstEx = e; + } + } + } + if (firstEx != null) { + throw firstEx; + } + } + + private final Iterable items; +} diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java index c8761259254..f62ffee9260 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java @@ -24,7 +24,7 @@ */ package jdk.jpackage.internal.util; -import static jdk.jpackage.internal.util.function.ExceptionBox.rethrowUnchecked; +import static jdk.jpackage.internal.util.function.ExceptionBox.toUnchecked; import java.io.IOException; import java.io.Writer; @@ -80,7 +80,7 @@ public final class XmlUtils { xml.flush(); xml.close(); } catch (XMLStreamException ex) { - throw rethrowUnchecked(ex); + throw toUnchecked(ex); } } @@ -101,7 +101,7 @@ public final class XmlUtils { xml.flush(); xml.close(); } catch (XMLStreamException ex) { - throw rethrowUnchecked(ex); + throw toUnchecked(ex); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java index 8428d5d1e7f..40503469873 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.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 @@ -30,23 +30,55 @@ public class ExceptionBox extends RuntimeException { private static final long serialVersionUID = 1L; - public static RuntimeException rethrowUnchecked(Throwable throwable) { - if (throwable instanceof RuntimeException err) { - throw err; + public static RuntimeException toUnchecked(Exception ex) { + switch (ex) { + case RuntimeException rex -> { + return rex; + } + case InvocationTargetException itex -> { + var t = itex.getCause(); + if (t instanceof Exception cause) { + return toUnchecked(cause); + } else { + throw (Error)t; + } + } + case InterruptedException _ -> { + Thread.currentThread().interrupt(); + return new ExceptionBox(ex); + } + default -> { + return new ExceptionBox(ex); + } } - - if (throwable instanceof Error err) { - throw err; - } - - if (throwable instanceof InvocationTargetException err) { - throw rethrowUnchecked(err.getCause()); - } - - throw new ExceptionBox(throwable); } - private ExceptionBox(Throwable throwable) { - super(throwable); + public static Exception unbox(Throwable t) { + switch (t) { + case ExceptionBox ex -> { + return unbox(ex.getCause()); + } + case InvocationTargetException ex -> { + return unbox(ex.getCause()); + } + case Exception ex -> { + return ex; + } + case Error err -> { + throw err; + } + default -> { + // Unreachable + throw reachedUnreachable(); + } + } + } + + public static Error reachedUnreachable() { + return new AssertionError("Reached unreachable!"); + } + + private ExceptionBox(Exception ex) { + super(ex); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiConsumer.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiConsumer.java index 3ed0fd67d84..374eaf803d9 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiConsumer.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiConsumer.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,17 +27,17 @@ package jdk.jpackage.internal.util.function; import java.util.function.BiConsumer; @FunctionalInterface -public interface ThrowingBiConsumer { +public interface ThrowingBiConsumer { - void accept(T t, U u) throws Throwable; + void accept(T t, U u) throws E; public static BiConsumer toBiConsumer( - ThrowingBiConsumer v) { + ThrowingBiConsumer v) { return (t, u) -> { try { v.accept(t, u); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiFunction.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiFunction.java index 8c2df773eb5..13b0b53c887 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiFunction.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiFunction.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,17 +27,17 @@ package jdk.jpackage.internal.util.function; import java.util.function.BiFunction; @FunctionalInterface -public interface ThrowingBiFunction { +public interface ThrowingBiFunction { - R apply(T t, U u) throws Throwable; + R apply(T t, U u) throws E; public static BiFunction toBiFunction( - ThrowingBiFunction v) { + ThrowingBiFunction v) { return (t, u) -> { try { return v.apply(t, u); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingConsumer.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingConsumer.java index ef1b0a61df7..38342a361c0 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingConsumer.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingConsumer.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,16 +27,16 @@ package jdk.jpackage.internal.util.function; import java.util.function.Consumer; @FunctionalInterface -public interface ThrowingConsumer { +public interface ThrowingConsumer { - void accept(T t) throws Throwable; + void accept(T t) throws E; - public static Consumer toConsumer(ThrowingConsumer v) { + public static Consumer toConsumer(ThrowingConsumer v) { return o -> { try { v.accept(o); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingFunction.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingFunction.java index 2b5eae43842..5bbfb254858 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingFunction.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingFunction.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,16 +27,16 @@ package jdk.jpackage.internal.util.function; import java.util.function.Function; @FunctionalInterface -public interface ThrowingFunction { +public interface ThrowingFunction { - R apply(T t) throws Throwable; + R apply(T t) throws E; - public static Function toFunction(ThrowingFunction v) { + public static Function toFunction(ThrowingFunction v) { return t -> { try { return v.apply(t); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingRunnable.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingRunnable.java index 7c75c4d9753..f3ce5affbbf 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingRunnable.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingRunnable.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 @@ -25,16 +25,16 @@ package jdk.jpackage.internal.util.function; @FunctionalInterface -public interface ThrowingRunnable { +public interface ThrowingRunnable { - void run() throws Throwable; + void run() throws E; - public static Runnable toRunnable(ThrowingRunnable v) { + public static Runnable toRunnable(ThrowingRunnable v) { return () -> { try { v.run(); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingSupplier.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingSupplier.java index c69c4729190..4f194a0f4d2 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingSupplier.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingSupplier.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,16 +27,16 @@ package jdk.jpackage.internal.util.function; import java.util.function.Supplier; @FunctionalInterface -public interface ThrowingSupplier { +public interface ThrowingSupplier { - T get() throws Throwable; + T get() throws E; - public static Supplier toSupplier(ThrowingSupplier v) { + public static Supplier toSupplier(ThrowingSupplier v) { return () -> { try { return v.get(); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingUnaryOperator.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingUnaryOperator.java index 7a2a0fd67cf..3d757bbec48 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingUnaryOperator.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingUnaryOperator.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,17 +27,17 @@ package jdk.jpackage.internal.util.function; import java.util.function.UnaryOperator; @FunctionalInterface -public interface ThrowingUnaryOperator { +public interface ThrowingUnaryOperator { - T apply(T t) throws Throwable; + T apply(T t) throws E; public static UnaryOperator toUnaryOperator( - ThrowingUnaryOperator v) { + ThrowingUnaryOperator v) { return t -> { try { return v.apply(t); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/native/applauncher/PackageFile.cpp b/src/jdk.jpackage/share/native/applauncher/PackageFile.cpp index 31b431215d5..4bf51348d6d 100644 --- a/src/jdk.jpackage/share/native/applauncher/PackageFile.cpp +++ b/src/jdk.jpackage/share/native/applauncher/PackageFile.cpp @@ -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 diff --git a/src/jdk.jpackage/share/native/common/Dll.h b/src/jdk.jpackage/share/native/common/Dll.h index c84242373a7..bfe9e25238e 100644 --- a/src/jdk.jpackage/share/native/common/Dll.h +++ b/src/jdk.jpackage/share/native/common/Dll.h @@ -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 diff --git a/src/jdk.jpackage/share/native/common/app.cpp b/src/jdk.jpackage/share/native/common/app.cpp index d9492785f06..a64e84b70fb 100644 --- a/src/jdk.jpackage/share/native/common/app.cpp +++ b/src/jdk.jpackage/share/native/common/app.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/share/native/common/tstrings.cpp b/src/jdk.jpackage/share/native/common/tstrings.cpp index b38c811e8bd..7ceb87edfa1 100644 --- a/src/jdk.jpackage/share/native/common/tstrings.cpp +++ b/src/jdk.jpackage/share/native/common/tstrings.cpp @@ -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 diff --git a/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java b/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java index e1e02ba7850..b196a5805a0 100644 --- a/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java +++ b/src/jdk.jpackage/unix/classes/jdk/jpackage/internal/UnixLaunchersAsServices.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2025, 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 @@ -24,8 +24,6 @@ */ package jdk.jpackage.internal; -import jdk.jpackage.internal.model.Launcher; -import jdk.jpackage.internal.model.Application; import java.io.IOException; import java.nio.file.Path; import java.util.Collections; @@ -36,6 +34,9 @@ import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.jpackage.internal.model.Application; +import jdk.jpackage.internal.model.Launcher; +import jdk.jpackage.internal.util.Enquoter; /** * Helper to install launchers as services for Unix installers. diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinBundlingEnvironment.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinBundlingEnvironment.java index 38547999290..de52a222d7d 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinBundlingEnvironment.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinBundlingEnvironment.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 @@ -24,29 +24,30 @@ */ package jdk.jpackage.internal; -import static jdk.jpackage.internal.WinFromOpions.createWinApplication; +import static jdk.jpackage.internal.WinFromOptions.createWinApplication; import static jdk.jpackage.internal.WinPackagingPipeline.APPLICATION_LAYOUT; import static jdk.jpackage.internal.cli.StandardBundlingOperation.CREATE_WIN_APP_IMAGE; import static jdk.jpackage.internal.cli.StandardBundlingOperation.CREATE_WIN_EXE; import static jdk.jpackage.internal.cli.StandardBundlingOperation.CREATE_WIN_MSI; import jdk.jpackage.internal.cli.Options; -import jdk.jpackage.internal.util.Result; public class WinBundlingEnvironment extends DefaultBundlingEnvironment { public WinBundlingEnvironment() { - super(build() - .defaultOperation(CREATE_WIN_EXE) - .bundler(CREATE_WIN_APP_IMAGE, WinBundlingEnvironment::createAppImage) - .bundler(CREATE_WIN_EXE, LazyLoad::sysEnv, WinBundlingEnvironment::createExePackage) - .bundler(CREATE_WIN_MSI, LazyLoad::sysEnv, WinBundlingEnvironment::createMsiPackage)); + super(build().mutate(builder -> { + var sysEnv = runOnce(WinSystemEnvironment::create); + + builder + .bundler(CREATE_WIN_EXE, sysEnv, WinBundlingEnvironment::createExePackage) + .bundler(CREATE_WIN_MSI, sysEnv, WinBundlingEnvironment::createMsiPackage); + }).defaultOperation(CREATE_WIN_EXE).bundler(CREATE_WIN_APP_IMAGE, WinBundlingEnvironment::createAppImage)); } private static void createMsiPackage(Options options, WinSystemEnvironment sysEnv) { createNativePackage(options, - WinFromOpions::createWinMsiPackage, + WinFromOptions.createWinMsiPackage(options), buildEnv()::create, WinPackagingPipeline.build(), (env, pkg, outputDir) -> { @@ -60,7 +61,7 @@ public class WinBundlingEnvironment extends DefaultBundlingEnvironment { private static void createExePackage(Options options, WinSystemEnvironment sysEnv) { createNativePackage(options, - WinFromOpions::createWinExePackage, + WinFromOptions.createWinExePackage(options), buildEnv()::create, WinPackagingPipeline.build(), (env, pkg, outputDir) -> { @@ -98,12 +99,4 @@ public class WinBundlingEnvironment extends DefaultBundlingEnvironment { } } - private static final class LazyLoad { - - static Result sysEnv() { - return SYS_ENV; - } - - private static final Result SYS_ENV = WinSystemEnvironment.create(); - } } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExePackager.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExePackager.java index 9a13a0f954d..21f941eedf5 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExePackager.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinExePackager.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 @@ -52,7 +52,7 @@ final record WinExePackager(BuildEnv env, WinExePackage pkg, Path outputDir, Pat @Override public void accept(PackagingPipeline.Builder pipelineBuilder) { - pipelineBuilder.excludeDirFromCopying(outputDir) + pipelineBuilder .task(ExePackageTaskID.RUN_POST_MSI_USER_SCRIPT) .action(this::runPostMsiScript) .addDependency(PackageTaskID.CREATE_PACKAGE_FILE) @@ -79,8 +79,6 @@ final record WinExePackager(BuildEnv env, WinExePackage pkg, Path outputDir, Pat private void wrapMsiInExe() throws IOException { - Log.verbose(I18N.format("message.outputting-to-location", outputDir.toAbsolutePath())); - final var msi = msi(); // Copy template msi wrapper next to msi file @@ -102,7 +100,5 @@ final record WinExePackager(BuildEnv env, WinExePackage pkg, Path outputDir, Pat Files.copy(exePath, dstExePath, StandardCopyOption.REPLACE_EXISTING); dstExePath.toFile().setExecutable(true); - - Log.verbose(I18N.format("message.output-location", outputDir.toAbsolutePath())); } } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOpions.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOptions.java similarity index 99% rename from src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOpions.java rename to src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOptions.java index 6fd6d0a7b96..6009e2f6724 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOpions.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOptions.java @@ -49,7 +49,7 @@ import jdk.jpackage.internal.model.WinLauncher; import jdk.jpackage.internal.model.WinLauncherMixin; import jdk.jpackage.internal.model.WinMsiPackage; -final class WinFromOpions { +final class WinFromOptions { static WinApplication createWinApplication(Options options) { diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiPackager.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiPackager.java index 915d034bd82..c72b14a76d5 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiPackager.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinMsiPackager.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 @@ -162,7 +162,7 @@ final class WinMsiPackager implements Consumer { @Override public void accept(PackagingPipeline.Builder pipelineBuilder) { - pipelineBuilder.excludeDirFromCopying(outputDir) + pipelineBuilder .task(PackagingPipeline.PackageTaskID.CREATE_CONFIG_FILES) .action(this::prepareConfigFiles) .add() @@ -315,7 +315,6 @@ final class WinMsiPackager implements Consumer { private void buildPackage() throws IOException { final var msiOut = outputDir.resolve(pkg.packageFileNameWithSuffix()); - Log.verbose(I18N.format("message.generating-msi", msiOut.toAbsolutePath())); wixPipeline.buildMsi(msiOut.toAbsolutePath()); } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinSystemEnvironment.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinSystemEnvironment.java index ab0cc37b9fe..c0bea444e00 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinSystemEnvironment.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinSystemEnvironment.java @@ -34,6 +34,6 @@ record WinSystemEnvironment(WixToolset wixToolset) implements SystemEnvironment } static Result create() { - return Result.create(WixTool::createToolset).map(WinSystemEnvironment::new); + return Result.of(WixTool::createToolset).map(WinSystemEnvironment::new); } } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixLauncherAsService.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixLauncherAsService.java index 833219eaa10..0755a920fd2 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixLauncherAsService.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixLauncherAsService.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 diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixTool.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixTool.java index e2ed175fbf3..c4f8610312a 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixTool.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2025, 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 @@ -233,10 +233,10 @@ public enum WixTool { // Detect FIPS mode var fips = false; try { - final var exec = Executor.of(toolPath.toString(), "-?").setQuiet(true).saveOutput(true); - final var exitCode = exec.execute(); + final var result = Executor.of(toolPath.toString(), "-?").setQuiet(true).saveOutput(true).execute(); + final var exitCode = result.getExitCode(); if (exitCode != 0 /* 308 */) { - final var output = exec.getOutput(); + final var output = result.getOutput(); if (!output.isEmpty() && output.get(0).contains("error CNDL0308")) { fips = true; } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplicationMixin.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplicationMixin.java index 283b5d84ae3..fde29980599 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplicationMixin.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplicationMixin.java @@ -30,7 +30,15 @@ public interface WinApplicationMixin { record Stub(DottedVersion winVersion) implements WinApplicationMixin { public Stub(Application app) { - this(DottedVersion.greedy(app.version())); + this(parse(app.version())); + } + + private static DottedVersion parse(String strVersion) { + try { + return DottedVersion.greedy(strVersion); + } catch (IllegalArgumentException ex) { + throw new JPackageException(ex.getMessage(), ex); + } } } } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties index 1f485e6c6c8..38d0bd02bbb 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources.properties @@ -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 @@ -56,13 +56,9 @@ error.missing-service-installer.advice=Add 'service-installer.exe' service insta message.icon-not-ico=The specified icon "{0}" is not an ICO file and will not be used. The default icon will be used in it's place. message.potential.windows.defender.issue=Warning: Windows Defender may prevent jpackage from functioning. If there is an issue, it can be addressed by either disabling realtime monitoring, or adding an exclusion for the directory "{0}". -message.outputting-to-location=Generating EXE for installer to: {0}. -message.output-location=Installer (.exe) saved to: {0} message.tool-version=Detected [{0}] version [{1}]. message.wrong-tool-version=Detected [{0}] version {1} but version {2} is required. message.use-wix36-features=WiX {0} detected. Enabling advanced cleanup action. message.product-code=MSI ProductCode: {0}. message.upgrade-code=MSI UpgradeCode: {0}. message.preparing-msi-config=Preparing MSI config: {0}. -message.generating-msi=Generating MSI: {0}. - diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties index 3e6f8e30d6a..baaba64b398 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties @@ -23,15 +23,9 @@ # questions. # # - -app.bundler.name=Windows-Anwendungsimage -exe.bundler.name=EXE-Installationsprogrammpackage -msi.bundler.name=MSI-Installationsprogrammpackage - param.menu-group.default=Unbekannt resource.executable-properties-template=Vorlage für das Erstellen der ausführbaren Eigenschaftendatei -resource.setup-icon=Symbol für Dialogfeld "Setup" resource.post-msi-script=Auszuführendes Skript nach dem Erstellen der MSI-Datei für das EXE-Installationsprogramm resource.wxl-file=WiX-Lokalisierungsdatei resource.main-wix-file=Haupt-WiX-Projektdatei @@ -65,12 +59,10 @@ message.potential.windows.defender.issue=Warnung: Windows Defender verhindert ev message.outputting-to-location=EXE für Installationsprogramm wird generiert in: {0}. message.output-location=Installationsprogramm (.exe) gespeichert in: {0} message.tool-version=[{0}]-Version [{1}] erkannt. -message.creating-association-with-null-extension=Verknüpfung mit Nullerweiterung wird erstellt. message.wrong-tool-version=[{0}]-Version {1} wurde erkannt. Erforderlich ist jedoch Version {2}. message.use-wix36-features=WiX {0} erkannt. Erweiterte Bereinigungsaktion wird aktiviert. message.product-code=MSI-ProductCode: {0}. message.upgrade-code=MSI-UpgradeCode: {0}. message.preparing-msi-config=MSI-Konfiguration wird vorbereitet: {0}. message.generating-msi=MSI wird generiert: {0}. -message.invalid.install.dir=Warnung: Ungültiges Installationsverzeichnis {0}. Installationsverzeichnis muss ein relativer Unterpfad unter dem Standardinstallationsverzeichnis wie "Programme" sein. Der Anwendungsname "{1}" wird als Standardwert verwendet. diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties index 07604dc9980..119c7532b1f 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties @@ -23,15 +23,9 @@ # questions. # # - -app.bundler.name=Windowsアプリケーション・イメージ -exe.bundler.name=EXEインストーラ・パッケージ -msi.bundler.name=MSIインストーラ・パッケージ - param.menu-group.default=不明 resource.executable-properties-template=実行可能なプロパティ・ファイル作成用のテンプレート -resource.setup-icon=設定ダイアログ・アイコン resource.post-msi-script=exeインストーラのmsiファイルが作成された後に実行するスクリプト resource.wxl-file=WiXローカリゼーション・ファイル resource.main-wix-file=メインWiXプロジェクト・ファイル @@ -65,12 +59,10 @@ message.potential.windows.defender.issue=警告: Windows Defenderが原因でjpa message.outputting-to-location=インストーラのEXEを次に生成しています: {0} message.output-location=インストーラ(.exe)は次に保存されました: {0} message.tool-version=[{0}]バージョン[{1}]が検出されました。 -message.creating-association-with-null-extension=null拡張子との関連付けを作成しています。 message.wrong-tool-version=[{0}]バージョン{1}が検出されましたが、バージョン{2}が必要です。 message.use-wix36-features=WiX {0}が検出されました。拡張クリーンアップ・アクションを有効化しています。 message.product-code=MSI ProductCode: {0}。 message.upgrade-code=MSI UpgradeCode: {0}。 message.preparing-msi-config=MSI構成を準備しています: {0} message.generating-msi=MSIを生成しています: {0}。 -message.invalid.install.dir=警告: インストール・ディレクトリ{0}が無効です。インストール・ディレクトリはデフォルトのインストール場所("プログラム・ファイル"など)の下の相対サブパスである必要があります。アプリケーション名"{1}"にデフォルト設定されています。 diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties index 7eae69fba2f..66d8a9d8b96 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties @@ -23,15 +23,9 @@ # questions. # # - -app.bundler.name=Windows 应用程序映像 -exe.bundler.name=EXE 安装程序包 -msi.bundler.name=MSI 安装程序包 - param.menu-group.default=未知 resource.executable-properties-template=用于创建可执行属性文件的模板 -resource.setup-icon=设置对话框图标 resource.post-msi-script=在为 exe 安装程序创建 msi 文件之后要运行的脚本 resource.wxl-file=WiX 本地化文件 resource.main-wix-file=主 WiX 项目文件 @@ -65,12 +59,10 @@ message.potential.windows.defender.issue=警告:Windows Defender 可能会阻 message.outputting-to-location=正在为安装程序生成 EXE, 位置: {0}。 message.output-location=安装程序 (.exe) 已保存到: {0} message.tool-version=检测到 [{0}] 版本 [{1}]。 -message.creating-association-with-null-extension=正在使用空扩展名创建关联。 message.wrong-tool-version=检测到 [{0}] 版本 {1}, 但需要版本 {2}。 message.use-wix36-features=检测到 WiX {0}。正在启用高级清除操作。 message.product-code=MSI ProductCode:{0}。 message.upgrade-code=MSI UpgradeCode:{0}。 message.preparing-msi-config=正在准备 MSI 配置: {0}。 message.generating-msi=正在生成 MSI: {0}。 -message.invalid.install.dir=警告:安装目录 {0} 无效。安装目录应当是默认安装位置(如 "Program Files")下面的相对子路径。默认为应用程序名称 "{1}"。 diff --git a/src/jdk.jpackage/windows/native/common/MsiUtils.h b/src/jdk.jpackage/windows/native/common/MsiUtils.h index 26fa9f91045..d501174268d 100644 --- a/src/jdk.jpackage/windows/native/common/MsiUtils.h +++ b/src/jdk.jpackage/windows/native/common/MsiUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/windows/native/libjpackage/VersionInfo.cpp b/src/jdk.jpackage/windows/native/libjpackage/VersionInfo.cpp index 122757b3ac3..aa977be8a82 100644 --- a/src/jdk.jpackage/windows/native/libjpackage/VersionInfo.cpp +++ b/src/jdk.jpackage/windows/native/libjpackage/VersionInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jpackage/windows/native/libmsica/Version.cpp b/src/jdk.jpackage/windows/native/libmsica/Version.cpp index 293f2dd36be..f8c570a1349 100644 --- a/src/jdk.jpackage/windows/native/libmsica/Version.cpp +++ b/src/jdk.jpackage/windows/native/libmsica/Version.cpp @@ -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 diff --git a/src/jdk.jpackage/windows/native/libmsica/Version.h b/src/jdk.jpackage/windows/native/libmsica/Version.h index 4ef176d382f..6f91a36765e 100644 --- a/src/jdk.jpackage/windows/native/libmsica/Version.h +++ b/src/jdk.jpackage/windows/native/libmsica/Version.h @@ -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 diff --git a/src/jdk.jpackage/windows/native/libmsica/libmsica.cpp b/src/jdk.jpackage/windows/native/libmsica/libmsica.cpp index edfea6dc136..f338c8ab103 100644 --- a/src/jdk.jpackage/windows/native/libmsica/libmsica.cpp +++ b/src/jdk.jpackage/windows/native/libmsica/libmsica.cpp @@ -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 diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java index e6d43bb346e..d662b62c157 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 795321253fd..9a030f7e46b 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 @@ -3362,7 +3362,19 @@ public class JShellTool implements MessageHandler { // error occurred, already reported return false; } - try (BufferedWriter writer = Files.newBufferedWriter(toPathResolvingUserHome(filename), + // Create missing parent directories before writing to target file + Path target; + try { + target = toPathResolvingUserHome(filename); + Path parent = target.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } + } catch (Exception e) { + errormsg("jshell.err.file.exception", "/save", filename, e); + return false; + } + try (BufferedWriter writer = Files.newBufferedWriter(target, Charset.defaultCharset(), CREATE, TRUNCATE_EXISTING, WRITE)) { if (at.hasOption("-history")) { diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java index f2472ee5623..9925a0141f1 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 351a0f812ad..e9918a7f628 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 @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties index cb93ae4ed57..744e71db667 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties index fa84c3f38fb..becf6854a74 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties index 879e9633e6a..c175db36da6 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jshell/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java b/src/jdk.jshell/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java index 099aba26968..7a1dd6c9877 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java +++ b/src/jdk.jshell/share/classes/jdk/internal/shellsupport/doc/JavadocHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jshell/share/classes/jdk/jshell/OuterWrapMap.java b/src/jdk.jshell/share/classes/jdk/jshell/OuterWrapMap.java index 61fb3bdfc9a..ca1d7cc8fd3 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/OuterWrapMap.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/OuterWrapMap.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 diff --git a/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java b/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java index 0219fa0eaf8..11fe05fbb98 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java @@ -75,9 +75,8 @@ class ReplParser extends JavacParser { com.sun.tools.javac.parser.Lexer S, boolean keepDocComments, boolean keepLineMap, - boolean keepEndPositions, boolean forceExpression) { - super(fac, S, keepDocComments, keepLineMap, keepEndPositions); + super(fac, S, keepDocComments, keepLineMap); this.forceExpression = forceExpression; this.source = fac.source; } @@ -103,7 +102,7 @@ class ReplParser extends JavacParser { boolean firstTypeDecl = true; while (token.kind != EOF) { - if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) { + if (token.pos > 0 && token.pos <= errorEndPos) { // error recovery skip(true, false, false, false); if (token.kind == EOF) { @@ -141,7 +140,6 @@ class ReplParser extends JavacParser { storeEnd(toplevel, S.prevToken().endPos); } toplevel.lineMap = S.getLineMap(); - toplevel.endPositions = this.endPosTable; return toplevel; } diff --git a/src/jdk.jshell/share/classes/jdk/jshell/ReplParserFactory.java b/src/jdk.jshell/share/classes/jdk/jshell/ReplParserFactory.java index 5c02561807b..3a3b25dade0 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/ReplParserFactory.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/ReplParserFactory.java @@ -60,13 +60,8 @@ class ReplParserFactory extends ParserFactory { } @Override - public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap) { + public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepLineMap, boolean parseModuleInfo) { com.sun.tools.javac.parser.Lexer lexer = scannerFactory.newScanner(input, keepDocComments); - return new ReplParser(this, lexer, keepDocComments, keepLineMap, keepEndPos, forceExpression); - } - - @Override - public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap, boolean parseModuleInfo) { - return newParser(input, keepDocComments, keepEndPos, keepLineMap); + return new ReplParser(this, lexer, keepDocComments, keepLineMap, forceExpression); } } diff --git a/src/jdk.jshell/share/classes/jdk/jshell/SnippetMaps.java b/src/jdk.jshell/share/classes/jdk/jshell/SnippetMaps.java index 992d97a7040..dc82d1d06a1 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/SnippetMaps.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/SnippetMaps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java index d5b44b569a4..1cf0c85702f 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2025, 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 @@ -43,7 +43,6 @@ import com.sun.source.tree.NewClassTree; import com.sun.source.tree.Scope; import com.sun.source.tree.Tree; import com.sun.source.tree.Tree.Kind; -import static com.sun.source.tree.Tree.Kind.METHOD; import com.sun.source.tree.TypeParameterTree; import com.sun.source.tree.VariableTree; import com.sun.source.tree.YieldTree; @@ -81,6 +80,7 @@ import java.util.Iterator; import java.util.List; import java.util.Objects; import java.util.function.Predicate; +import java.util.TreeSet; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; @@ -114,7 +114,6 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Optional; import java.util.Set; -import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.BiConsumer; @@ -149,14 +148,10 @@ import javax.tools.JavaFileManager.Location; import javax.tools.StandardLocation; import jdk.jshell.ExpressionToTypeInfo.ExpressionInfo; -import static jdk.jshell.Util.REPL_DOESNOTMATTER_CLASS_NAME; import static jdk.jshell.SourceCodeAnalysis.Completeness.DEFINITELY_INCOMPLETE; import static jdk.jshell.TreeDissector.printType; import static java.util.stream.Collectors.joining; -import static javax.lang.model.element.ElementKind.CONSTRUCTOR; -import static javax.lang.model.element.ElementKind.MODULE; -import static javax.lang.model.element.ElementKind.PACKAGE; import javax.lang.model.type.IntersectionType; import javax.lang.model.util.Elements; @@ -815,7 +810,7 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis { }; String wrappedCode = codeWrap.wrapped(); return this.proc.taskFactory.analyze(codeWrap, task -> { - List result = new ArrayList<>(); + TreeSet result = new TreeSet<>(Comparator.comparing(Highlight::start).thenComparing(Highlight::end)); CompilationUnitTree cut = task.cuTrees().iterator().next(); Trees trees = task.trees(); SourcePositions sp = trees.getSourcePositions(); @@ -1050,8 +1045,7 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis { } }.scan(cut, null); result.removeIf(h -> h.start() == h.end()); - Collections.sort(result, (h1, h2) -> h1.start() - h2.start()); - return result; + return new ArrayList<>(result); }); } diff --git a/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java b/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java index 13c07ea32c0..0de0e27ec07 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java @@ -819,9 +819,9 @@ class TaskFactory { } @Override - public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepEndPos, boolean keepLineMap, boolean parseModuleInfo) { + public JavacParser newParser(CharSequence input, boolean keepDocComments, boolean keepLineMap, boolean parseModuleInfo) { com.sun.tools.javac.parser.Lexer lexer = scannerFactory.newScanner(input, keepDocComments); - return new JavacParser(this, lexer, keepDocComments, keepLineMap, keepEndPos, parseModuleInfo) { + return new JavacParser(this, lexer, keepDocComments, keepLineMap, parseModuleInfo) { @Override public JCExpression parseType(boolean allowVar, com.sun.tools.javac.util.List annotations) { int pos = token.pos; diff --git a/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java b/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java index 526580988ab..1df6dc5191b 100644 --- a/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java +++ b/src/jdk.jshell/share/classes/jdk/jshell/execution/JdiDefaultExecutionControl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java b/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java index d5fedf93855..994757f17c3 100644 --- a/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java +++ b/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.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 @@ -135,7 +135,7 @@ import javax.management.DynamicMBean; * * * dcmd.enabledboolean - * True if the diagnostic command is enabled, false otherwise + * This field is always true -- diagnostic commands cannot be disabled. * * * dcmd.argumentsDescriptor diff --git a/src/jdk.management/share/classes/com/sun/management/internal/HotSpotAOTCacheImpl.java b/src/jdk.management/share/classes/com/sun/management/internal/HotSpotAOTCacheImpl.java new file mode 100644 index 00000000000..4bb556455ea --- /dev/null +++ b/src/jdk.management/share/classes/com/sun/management/internal/HotSpotAOTCacheImpl.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025, Microsoft, Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.management.internal; + +import javax.management.ObjectName; +import jdk.management.HotSpotAOTCacheMXBean; +import sun.management.Util; +import sun.management.VMManagement; + +/** + * Implementation class for the AOT Cache subsystem. + * + * ManagementFactory.getRuntimeMXBean() returns an instance + * of this class. + */ +public class HotSpotAOTCacheImpl implements HotSpotAOTCacheMXBean { + + private final VMManagement jvm; + /** + * Constructor of HotSpotAOTCacheImpl class. + */ + HotSpotAOTCacheImpl(VMManagement vm) { + this.jvm = vm; + } + + public boolean endRecording() { + return jvm.endAOTRecording(); + } + + public ObjectName getObjectName() { + return Util.newObjectName("jdk.management:type=HotSpotAOTCache"); + } +} \ No newline at end of file diff --git a/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java b/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java index 3a64fe6b858..b000516e626 100644 --- a/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java +++ b/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.management.DynamicMBean; +import jdk.management.HotSpotAOTCacheMXBean; import jdk.management.VirtualThreadSchedulerMXBean; import sun.management.ManagementFactoryHelper; import sun.management.spi.PlatformMBeanProvider; @@ -159,6 +160,41 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { } }); + /** + * HotSpotAOTCacheMXBean. + */ + initMBeanList.add(new PlatformComponent() { + private final Set> mbeanInterfaces = + Set.of(HotSpotAOTCacheMXBean.class); + private final Set mbeanInterfaceNames = + Set.of(HotSpotAOTCacheMXBean.class.getName()); + private HotSpotAOTCacheMXBean impl; + + @Override + public Set> mbeanInterfaces() { + return mbeanInterfaces; + } + + @Override + public Set mbeanInterfaceNames() { + return mbeanInterfaceNames; + } + + @Override + public String getObjectNamePattern() { + return "jdk.management:type=HotSpotAOTCache"; + } + + @Override + public Map nameToMBeanMap() { + HotSpotAOTCacheMXBean impl = this.impl; + if (impl == null) { + this.impl = impl = new HotSpotAOTCacheImpl(ManagementFactoryHelper.getVMManagement()); + } + return Map.of("jdk.management:type=HotSpotAOTCache", impl); + } + }); + /** * VirtualThreadSchedulerMXBean. */ diff --git a/src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java b/src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java new file mode 100644 index 00000000000..f8e1e5a7f05 --- /dev/null +++ b/src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2025, Microsoft, Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.management; + +import java.lang.management.ManagementFactory; +import java.lang.management.PlatformManagedObject; +import javax.management.MBeanServer; +import javax.management.ObjectName; + +/** + * Management interface for the JDK's Ahead of Time (AOT) Cache. + * + *

    The management interface is registered with the platform {@link MBeanServer + * MBeanServer}. The {@link ObjectName ObjectName} that uniquely identifies the management + * interface within the {@code MBeanServer} is {@code jdk.management:type=HotSpotAOTCache}. + * + *

    Direct access to the MXBean interface can be obtained with + * {@link ManagementFactory#getPlatformMXBean(Class)}. + * + * @since 26 + */ +public interface HotSpotAOTCacheMXBean extends PlatformManagedObject { + /** + * If an AOT recording is in progress, ends the recording. This method returns + * after the AOT artifacts have been completely written. + * + *

    The JVM will start recording AOT artifacts upon start-up if appropriate JVM options are + * given in the command-line. The recording will stop when the JVM exits, or when + * the {@code endRecording} method is called. Examples: + * + *

    ${@code java -XX:AOTCacheOutput=app.aot ....} + * + *

    + * The JVM records optimization information for the current application in the AOT cache file + * {@code app.aot}. In a future run of the application, the option {@code -XX:AOTCache=app.aot} will + * cause the JVM to use the cache to improve the application's startup and warmup performance. + *
    + * + *

    ${@code java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconfig ....} + * + *

    + * The JVM records optimization information for the current application in the AOT configuration + * file {@code app.aotconfig}. Subsequently, an AOT cache file can be created with the command: + * + *

    ${@code java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconfig -XX:AOTCache=app.aot ...} + *

    + * + *

    For more information about creating and using the AOT artifacts, and detailed + * specification of the corresponding JVM command-line options, please refer + * to JEP 483 and JEP 514. + * + *

    Currently there are no APIs to start an AOT recording. AOT recordings must be + * started using JVM command-line options such as {@code -XX:AOTCacheOutput}. + * There are also no APIs to query whether an AOT recording is in progress, or what AOT + * artifacts are being recorded. + * + *

    This method enables an application to end its own AOT recording + * programatically, but that is not necessarily the best approach. Doing so + * requires changing the application’s code, which might not be + * feasible. Even when it is feasible, injecting training-specific logic + * into the application reduces the similarity between training runs and + * production runs, potentially making the AOT cache less effective. It may + * be better to arrange for an external agent to end the training run, + * thereby creating an AOT cache without interfering with the application’s + * code. + * + * @return {@code true} if a recording was in progress and has been ended + * successfully; {@code false} otherwise. + */ + public boolean endRecording(); +} diff --git a/src/jdk.management/share/classes/jdk/management/VirtualThreadSchedulerMXBean.java b/src/jdk.management/share/classes/jdk/management/VirtualThreadSchedulerMXBean.java index 556c5184ffe..358ab23ca93 100644 --- a/src/jdk.management/share/classes/jdk/management/VirtualThreadSchedulerMXBean.java +++ b/src/jdk.management/share/classes/jdk/management/VirtualThreadSchedulerMXBean.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 @@ -76,7 +76,7 @@ public interface VirtualThreadSchedulerMXBean extends PlatformManagedObject { * @throws IllegalArgumentException if size is less than the minimum, or * greater than the maximum, supported by the scheduler * @throws UnsupportedOperationException if changing the target - * parallelism is not suppored by the scheduler + * parallelism is not supported by the scheduler * * @see ForkJoinPool#setParallelism(int) */ diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java index 485ebf13f2c..263aa58e098 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java @@ -84,9 +84,9 @@ public class SctpChannelImpl extends SctpChannel private final int fdVal; - /* IDs of native threads doing send and receive, for signalling */ - private volatile long receiverThread; - private volatile long senderThread; + /* Threads doing send and receive, for signalling */ + private volatile Thread receiverThread; + private volatile Thread senderThread; /* Lock held by current receiving or connecting thread */ private final Object receiveLock = new Object(); @@ -326,7 +326,7 @@ public class SctpChannelImpl extends SctpChannel private void receiverCleanup() throws IOException { synchronized (stateLock) { - receiverThread = 0; + receiverThread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -334,7 +334,7 @@ public class SctpChannelImpl extends SctpChannel private void senderCleanup() throws IOException { synchronized (stateLock) { - senderThread = 0; + senderThread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -367,7 +367,7 @@ public class SctpChannelImpl extends SctpChannel if (!isOpen()) { return false; } - receiverThread = NativeThread.current(); + receiverThread = NativeThread.threadToSignal(); } for (;;) { InetAddress ia = isa.getAddress(); @@ -472,7 +472,7 @@ public class SctpChannelImpl extends SctpChannel if (!isOpen()) { return false; } - receiverThread = NativeThread.current(); + receiverThread = NativeThread.threadToSignal(); } if (!isBlocking()) { connected = Net.pollConnect(fd, 0); @@ -484,7 +484,7 @@ public class SctpChannelImpl extends SctpChannel } } finally { synchronized (stateLock) { - receiverThread = 0; + receiverThread = null; if (state == ChannelState.KILLPENDING) { kill(); connected = false; @@ -541,10 +541,10 @@ public class SctpChannelImpl extends SctpChannel if (state != ChannelState.KILLED) SctpNet.preClose(fdVal); - if (receiverThread != 0) + if (receiverThread != null) NativeThread.signal(receiverThread); - if (senderThread != 0) + if (senderThread != null) NativeThread.signal(senderThread); if (!isRegistered()) @@ -644,7 +644,7 @@ public class SctpChannelImpl extends SctpChannel /* Postpone the kill if there is a waiting reader * or writer thread. */ - if (receiverThread == 0 && senderThread == 0) { + if (receiverThread == null && senderThread == null) { state = ChannelState.KILLED; SctpNet.close(fdVal); } else { @@ -743,7 +743,7 @@ public class SctpChannelImpl extends SctpChannel synchronized (stateLock) { if(!isOpen()) return null; - receiverThread = NativeThread.current(); + receiverThread = NativeThread.threadToSignal(); } do { @@ -936,7 +936,7 @@ public class SctpChannelImpl extends SctpChannel synchronized (stateLock) { if(!isOpen()) return 0; - senderThread = NativeThread.current(); + senderThread = NativeThread.threadToSignal(); } do { @@ -1031,7 +1031,7 @@ public class SctpChannelImpl extends SctpChannel ensureSendOpen(); SctpNet.shutdown(fdVal, -1); - if (senderThread != 0) + if (senderThread != null) NativeThread.signal(senderThread); isShutdown = true; } diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java index 31e83d72f96..c08c6dc88d0 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java @@ -81,9 +81,9 @@ public class SctpMultiChannelImpl extends SctpMultiChannel private final int fdVal; - /* IDs of native threads doing send and receives, for signalling */ - private volatile long receiverThread; - private volatile long senderThread; + /* Threads doing send and receives, for signalling */ + private volatile Thread receiverThread; + private volatile Thread senderThread; /* Lock held by current receiving thread */ private final Object receiveLock = new Object(); @@ -265,7 +265,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel private void receiverCleanup() throws IOException { synchronized (stateLock) { - receiverThread = 0; + receiverThread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -273,7 +273,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel private void senderCleanup() throws IOException { synchronized (stateLock) { - senderThread = 0; + senderThread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -290,10 +290,10 @@ public class SctpMultiChannelImpl extends SctpMultiChannel if (state != ChannelState.KILLED) SctpNet.preClose(fdVal); - if (receiverThread != 0) + if (receiverThread != null) NativeThread.signal(receiverThread); - if (senderThread != 0) + if (senderThread != null) NativeThread.signal(senderThread); if (!isRegistered()) @@ -378,7 +378,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel assert !isOpen() && !isRegistered(); /* Postpone the kill if there is a thread sending or receiving. */ - if (receiverThread == 0 && senderThread == 0) { + if (receiverThread == null && senderThread == null) { state = ChannelState.KILLED; SctpNet.close(fdVal); } else { @@ -484,7 +484,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel synchronized (stateLock) { if(!isOpen()) return null; - receiverThread = NativeThread.current(); + receiverThread = NativeThread.threadToSignal(); } do { @@ -765,7 +765,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel synchronized (stateLock) { if(!isOpen()) return 0; - senderThread = NativeThread.current(); + senderThread = NativeThread.threadToSignal(); /* Determine what address or association to send to */ Association assoc = messageInfo.association(); diff --git a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java index 4b2be742c6d..f72e0938eb5 100644 --- a/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java +++ b/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,8 +58,8 @@ public class SctpServerChannelImpl extends SctpServerChannel private final int fdVal; - /* IDs of native thread doing accept, for signalling */ - private volatile long thread; + /* thread doing accept, for signalling */ + private volatile Thread thread; /* Lock held by thread currently blocked in this channel */ private final Object lock = new Object(); @@ -200,7 +200,7 @@ public class SctpServerChannelImpl extends SctpServerChannel private void acceptCleanup() throws IOException { synchronized (stateLock) { - thread = 0; + thread = null; if (state == ChannelState.KILLPENDING) kill(); } @@ -222,7 +222,7 @@ public class SctpServerChannelImpl extends SctpServerChannel begin(); if (!isOpen()) return null; - thread = NativeThread.current(); + thread = NativeThread.threadToSignal(); for (;;) { n = Net.accept(fd, newfd, isaa); if ((n == IOStatus.INTERRUPTED) && isOpen()) @@ -253,7 +253,7 @@ public class SctpServerChannelImpl extends SctpServerChannel synchronized (stateLock) { if (state != ChannelState.KILLED) SctpNet.preClose(fdVal); - if (thread != 0) + if (thread != null) NativeThread.signal(thread); if (!isRegistered()) kill(); @@ -273,7 +273,7 @@ public class SctpServerChannelImpl extends SctpServerChannel assert !isOpen() && !isRegistered(); // Postpone the kill if there is a thread in accept - if (thread == 0) { + if (thread == null) { state = ChannelState.KILLED; SctpNet.close(fdVal); } else { diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java index 785b178e296..4f6d8ca25ef 100644 --- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java +++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixLoginModule.java @@ -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 @@ -26,7 +26,6 @@ package com.sun.security.auth.module; import java.util.*; -import java.io.IOException; import javax.security.auth.*; import javax.security.auth.callback.*; import javax.security.auth.login.*; @@ -34,6 +33,7 @@ import javax.security.auth.spi.*; import com.sun.security.auth.UnixPrincipal; import com.sun.security.auth.UnixNumericUserPrincipal; import com.sun.security.auth.UnixNumericGroupPrincipal; +import jdk.internal.util.OperatingSystem; /** * This {@code LoginModule} imports a user's Unix @@ -121,20 +121,34 @@ public class UnixLoginModule implements LoginModule { */ public boolean login() throws LoginException { - long[] unixGroups = null; + // Fail immediately on Windows to avoid cygwin-like functions + // being loaded, which are not supported. + if (OperatingSystem.isWindows()) { + throw new FailedLoginException + ("Failed in attempt to import " + + "the underlying system identity information" + + " on " + System.getProperty("os.name")); + } try { ss = new UnixSystem(); - } catch (UnsatisfiedLinkError ule) { + } catch (ExceptionInInitializerError | UnsatisfiedLinkError ule) { + // Errors could happen in either static blocks or the constructor, + // both have a cause. succeeded = false; - throw new FailedLoginException + var error = new FailedLoginException ("Failed in attempt to import " + "the underlying system identity information" + " on " + System.getProperty("os.name")); + if (ule.getCause() != null) { + error.initCause(ule.getCause()); + } + throw error; } userPrincipal = new UnixPrincipal(ss.getUsername()); UIDPrincipal = new UnixNumericUserPrincipal(ss.getUid()); GIDPrincipal = new UnixNumericGroupPrincipal(ss.getGid(), true); + long[] unixGroups = null; if (ss.getGroups() != null && ss.getGroups().length > 0) { unixGroups = ss.getGroups(); for (int i = 0; i < unixGroups.length; i++) { @@ -150,9 +164,11 @@ public class UnixLoginModule implements LoginModule { "succeeded importing info: "); System.out.println("\t\t\tuid = " + ss.getUid()); System.out.println("\t\t\tgid = " + ss.getGid()); - unixGroups = ss.getGroups(); - for (int i = 0; i < unixGroups.length; i++) { - System.out.println("\t\t\tsupp gid = " + unixGroups[i]); + System.out.println("\t\t\tusername = " + ss.getUsername()); + if (unixGroups != null) { + for (int i = 0; i < unixGroups.length; i++) { + System.out.println("\t\t\tsupp gid = " + unixGroups[i]); + } } } succeeded = true; diff --git a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java index f3741c10404..c0e47fafc2c 100644 --- a/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java +++ b/src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java @@ -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 @@ -25,38 +25,194 @@ package com.sun.security.auth.module; +import jdk.internal.util.Architecture; +import jdk.internal.util.OperatingSystem; + +import java.lang.foreign.AddressLayout; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.GroupLayout; +import java.lang.foreign.Linker; +import java.lang.foreign.MemoryLayout; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.StructLayout; +import java.lang.foreign.SymbolLookup; +import java.lang.foreign.ValueLayout; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; + /** * This class implementation retrieves and makes available Unix * UID/GID/groups information for the current user. * * @since 1.4 */ +@SuppressWarnings("restricted") public class UnixSystem { - private native void getUnixInfo(); - - // Warning: the following 4 fields are used by Unix.c - - /** The current username. */ + /** + * The current username. + */ protected String username; - /** The current user ID. */ + /** + * The current user ID. + */ protected long uid; - /** The current group ID. */ + /** + * The current group ID. + */ protected long gid; - /** The current list of groups. */ + /** + * The current list of groups. + */ protected long[] groups; + private static final Linker LINKER = Linker.nativeLinker(); + private static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup() + .or(LINKER.defaultLookup()); + + private static final ValueLayout.OfByte C_CHAR + = (ValueLayout.OfByte) LINKER.canonicalLayouts().get("char"); + private static final ValueLayout.OfInt C_INT + = (ValueLayout.OfInt) LINKER.canonicalLayouts().get("int"); + private static final ValueLayout.OfLong C_LONG + = (ValueLayout.OfLong) LINKER.canonicalLayouts().get("long"); + private static final AddressLayout C_POINTER + = ((AddressLayout) LINKER.canonicalLayouts().get("void*")) + .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, C_CHAR)); + private static final ValueLayout C_SIZE_T + = (ValueLayout) LINKER.canonicalLayouts().get("size_t"); + + private static final StructLayout CAPTURE_STATE_LAYOUT + = Linker.Option.captureStateLayout(); + private static final VarHandle VH_errno = CAPTURE_STATE_LAYOUT.varHandle( + MemoryLayout.PathElement.groupElement("errno")); + + private static final MethodHandle MH_strerror + = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow("strerror"), + FunctionDescriptor.of(C_POINTER, C_INT)); + + private static final MethodHandle MH_getgroups + = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow("getgroups"), + FunctionDescriptor.of(C_INT, C_INT, C_POINTER), + Linker.Option.captureCallState("errno")); + private static final MethodHandle MH_getuid + = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow("getuid"), + FunctionDescriptor.of(C_INT)); + + // Some architectures require appropriate zero or sign extension to 64 bit. + // Use long directly before https://bugs.openjdk.org/browse/JDK-8336664 is resolved. + private static final boolean calling_convention_requires_int_as_long + = Architecture.isPPC64() || Architecture.isPPC64LE() || Architecture.isS390(); + + // getpwuid_r does not work on AIX, instead we use another similar function + // extern int _posix_getpwuid_r(uid_t, struct passwd *, char *, int, struct passwd **) + private static final MethodHandle MH_getpwuid_r + = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow( + OperatingSystem.isAix() ? "_posix_getpwuid_r" : "getpwuid_r"), + FunctionDescriptor.of(C_INT, + calling_convention_requires_int_as_long ? C_LONG : C_INT, + C_POINTER, C_POINTER, + OperatingSystem.isAix() ? C_INT : C_SIZE_T, + C_POINTER)); + + private static final GroupLayout ML_passwd = MemoryLayout.structLayout( + C_POINTER.withName("pw_name"), + C_POINTER.withName("pw_passwd"), + C_INT.withName("pw_uid"), + C_INT.withName("pw_gid"), + // Different platforms have different fields in `struct passwd`. + // While we don't need those fields here, the struct needs to be + // big enough to avoid buffer overflow when `getpwuid_r` is called. + MemoryLayout.paddingLayout(100)); + + private static final VarHandle VH_pw_uid + = ML_passwd.varHandle(groupElement("pw_uid")); + private static final VarHandle VH_pw_gid + = ML_passwd.varHandle(groupElement("pw_gid")); + private static final VarHandle VH_pw_name + = ML_passwd.varHandle(groupElement("pw_name")); + + // The buffer size for the getpwuid_r function: + // 1. sysconf(_SC_GETPW_R_SIZE_MAX) on macOS is 4096 and 1024 on Linux, + // so we choose a bigger one. + // 2. We do not call sysconf() here because even _SC_GETPW_R_SIZE_MAX + // could be different on different platforms. + // 3. We choose int instead of long because the buffer_size argument + // might be `int` or `long` and converting from `long` to `int` + // requires an explicit cast. + private static final int GETPW_R_SIZE_MAX = 4096; + /** * Instantiate a {@code UnixSystem} and load * the native library to access the underlying system information. */ - @SuppressWarnings("restricted") public UnixSystem() { - System.loadLibrary("jaas"); - getUnixInfo(); + // The FFM code has only been tested on multiple platforms + // (including macOS, Linux, AIX, etc) and might fail on other + // *nix systems. Especially, the `passwd` struct could be defined + // differently. I've checked several and an extra 100 chars at the + // end seems enough. + try (Arena scope = Arena.ofConfined()) { + MemorySegment capturedState = scope.allocate(CAPTURE_STATE_LAYOUT); + int groupnum = (int) MH_getgroups.invokeExact(capturedState, 0, MemorySegment.NULL); + if (groupnum == -1) { + throw new RuntimeException("getgroups returns " + groupnum); + } + + var gs = scope.allocate(C_INT, groupnum); + groupnum = (int) MH_getgroups.invokeExact(capturedState, groupnum, gs); + if (groupnum == -1) { + var errno = (int) VH_errno.get(capturedState, 0L); + var errMsg = (MemorySegment) MH_strerror.invokeExact(errno); + throw new RuntimeException("getgroups returns " + groupnum + + ". Reason: " + errMsg.reinterpret(Long.MAX_VALUE).getString(0)); + } + + groups = new long[groupnum]; + for (int i = 0; i < groupnum; i++) { + groups[i] = Integer.toUnsignedLong(gs.getAtIndex(C_INT, i)); + } + + var pwd = scope.allocate(ML_passwd); + var result = scope.allocate(C_POINTER); + var buffer = scope.allocate(GETPW_R_SIZE_MAX); + + long tmpUid = Integer.toUnsignedLong((int) MH_getuid.invokeExact()); + + // Do not call invokeExact because the type of buffer_size is not + // always long in the underlying system. + int out; + if (calling_convention_requires_int_as_long) { + out = (int) MH_getpwuid_r.invoke( + tmpUid, pwd, buffer, GETPW_R_SIZE_MAX, result); + } else { + out = (int) MH_getpwuid_r.invoke( + (int) tmpUid, pwd, buffer, GETPW_R_SIZE_MAX, result); + } + if (out != 0) { + // If ERANGE (Result too large) is detected in a new platform, + // consider adjusting GETPW_R_SIZE_MAX. + var err = (MemorySegment) MH_strerror.invokeExact(out); + throw new RuntimeException(err.reinterpret(Long.MAX_VALUE).getString(0)); + } else if (result.get(ValueLayout.ADDRESS, 0).equals(MemorySegment.NULL)) { + throw new RuntimeException("the requested entry is not found"); + } else { + // uid_t and gid_t were defined unsigned. + uid = Integer.toUnsignedLong((int) VH_pw_uid.get(pwd, 0L)); + gid = Integer.toUnsignedLong((int) VH_pw_gid.get(pwd, 0L)); + username = ((MemorySegment) VH_pw_name.get(pwd, 0L)).getString(0); + } + } catch (Throwable t) { + var error = new UnsatisfiedLinkError("FFM calls failed"); + error.initCause(t); + throw error; + } } /** diff --git a/src/jdk.security.auth/unix/native/libjaas/Unix.c b/src/jdk.security.auth/unix/native/libjaas/Unix.c deleted file mode 100644 index 3a93df9ffc9..00000000000 --- a/src/jdk.security.auth/unix/native/libjaas/Unix.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include -#include "jni_util.h" -#include "com_sun_security_auth_module_UnixSystem.h" -#include -#include -#include -#include -#include - -#include - -/* - * Declare library specific JNI_Onload entry if static build - */ -DEF_STATIC_JNI_OnLoad - -JNIEXPORT void JNICALL -Java_com_sun_security_auth_module_UnixSystem_getUnixInfo - (JNIEnv *env, jobject obj) { - - int i; - char pwd_buf[1024]; - struct passwd *pwd = NULL; - struct passwd resbuf; - jfieldID userNameID; - jfieldID userID; - jfieldID groupID; - jfieldID supplementaryGroupID; - - jstring jstr; - jlongArray jgroups; - jlong *jgroupsAsArray; - jsize numSuppGroups; - gid_t *groups; - jclass cls; - - numSuppGroups = getgroups(0, NULL); - if (numSuppGroups == -1) { - return; - } - groups = (gid_t *)calloc(numSuppGroups, sizeof(gid_t)); - if (groups == NULL) { - jclass cls = (*env)->FindClass(env,"java/lang/OutOfMemoryError"); - if (cls != NULL) { - (*env)->ThrowNew(env, cls, NULL); - } - return; - } - - cls = (*env)->GetObjectClass(env, obj); - - supplementaryGroupID = (*env)->GetFieldID(env, cls, "groups", "[J"); - if (supplementaryGroupID == 0) { - goto cleanUpAndReturn; - } - - if (getgroups(numSuppGroups, groups) != -1) { - jgroups = (*env)->NewLongArray(env, numSuppGroups); - if (jgroups == NULL) { - goto cleanUpAndReturn; - } - jgroupsAsArray = (*env)->GetLongArrayElements(env, jgroups, 0); - if (jgroupsAsArray == NULL) { - goto cleanUpAndReturn; - } - for (i = 0; i < numSuppGroups; i++) { - jgroupsAsArray[i] = groups[i]; - } - (*env)->ReleaseLongArrayElements(env, jgroups, jgroupsAsArray, 0); - (*env)->SetObjectField(env, obj, supplementaryGroupID, jgroups); - } - - userNameID = (*env)->GetFieldID(env, cls, "username", "Ljava/lang/String;"); - if (userNameID == 0) { - goto cleanUpAndReturn; - } - - userID = (*env)->GetFieldID(env, cls, "uid", "J"); - if (userID == 0) { - goto cleanUpAndReturn; - } - - groupID = (*env)->GetFieldID(env, cls, "gid", "J"); - if (groupID == 0) { - goto cleanUpAndReturn; - } - - memset(pwd_buf, 0, sizeof(pwd_buf)); - if (getpwuid_r(getuid(), &resbuf, pwd_buf, sizeof(pwd_buf), &pwd) == 0 && - pwd != NULL) { - (*env)->SetLongField(env, obj, userID, pwd->pw_uid); - (*env)->SetLongField(env, obj, groupID, pwd->pw_gid); - jstr = (*env)->NewStringUTF(env, pwd->pw_name); - if (jstr == NULL) { - goto cleanUpAndReturn; - } - (*env)->SetObjectField(env, obj, userNameID, jstr); - } else { - (*env)->SetLongField(env, obj, userID, getuid()); - (*env)->SetLongField(env, obj, groupID, getgid()); - } -cleanUpAndReturn: - free(groups); - return; -} diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/FreeInteractiveLayoutManager.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/FreeInteractiveLayoutManager.java index 7aec57ec2a0..ab334007ced 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/FreeInteractiveLayoutManager.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/FreeInteractiveLayoutManager.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 diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java index cb9487ae828..a73d7bb6dde 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/HierarchicalLayoutManager.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 diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutGraph.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutGraph.java index 956d72924b9..9c285886e71 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutGraph.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutGraph.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 diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutMover.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutMover.java index 48599d78d75..3126a8dba9e 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutMover.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutMover.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 diff --git a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutNode.java b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutNode.java index 2816115080e..2ef3211a3b0 100644 --- a/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutNode.java +++ b/src/utils/IdealGraphVisualizer/HierarchicalLayout/src/main/java/com/sun/hotspot/igv/hierarchicallayout/LayoutNode.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 diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableFreeLayoutAction.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableFreeLayoutAction.java index 201fc51e15e..6af8bb851e2 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableFreeLayoutAction.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/actions/EnableFreeLayoutAction.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 diff --git a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/LineWidget.java b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/LineWidget.java index 01ebb8ed9e3..0c9f636e373 100644 --- a/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/LineWidget.java +++ b/src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/LineWidget.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 diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java index 61cbc054200..9a806a85552 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2021, 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 diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java index d230f1b4336..3a9a6c2cbef 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/MakeNotEntrantEvent.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 diff --git a/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/GroupJavacBenchmark.java b/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/GroupJavacBenchmark.java index 5ca3f0bf648..9eb6c893cc6 100644 --- a/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/GroupJavacBenchmark.java +++ b/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/GroupJavacBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/JavacBenchmark.java b/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/JavacBenchmark.java index 28c5c57a073..565ea4038c7 100644 --- a/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/JavacBenchmark.java +++ b/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/JavacBenchmark.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 diff --git a/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/SingleJavacBenchmark.java b/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/SingleJavacBenchmark.java index 2cc5c1a7c83..00c5bd7ee92 100644 --- a/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/SingleJavacBenchmark.java +++ b/test/benchmarks/micros-javac/src/main/java/org/openjdk/bench/langtools/javac/SingleJavacBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/docs/ProblemList.txt b/test/docs/ProblemList.txt index 4df8bbcc53c..d856f9c955e 100644 --- a/test/docs/ProblemList.txt +++ b/test/docs/ProblemList.txt @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2024, 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,15 @@ # ############################################################################# -jdk/javadoc/doccheck/checks/jdkCheckLinks.java 8370249 generic-all -jdk/javadoc/doccheck/checks/jdkCheckHtml.java 8370970 generic-all -jdk/javadoc/doccheck/checks/jdkDoctypeBadcharsCheck.java 8370970 generic-all +############################################################################# + +# Preview project specific failures go here at the end of the file. +# +# These are NOT failures that occur with the '--enable-preview' option +# specified; those go in the appropriate ProblemList-enable-preview.txt file. +# These are failures that occur WITHOUT the '--enable-preview' option +# specified AND occur because of some issue with preview project code, +# in either implementation or test code. + +############################################################################# + diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlPage.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlPage.java index d8fd13fdd7c..af28135e673 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlPage.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlPage.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 @@ -23,19 +23,50 @@ package jdk.test.failurehandler; +import java.io.FileWriter; +import java.io.IOException; import java.io.PrintWriter; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Objects; public class HtmlPage implements AutoCloseable { + static final String STYLE_SHEET_FILENAME = "failure-handler-style.css"; + static final String SCRIPT_FILENAME = "failure-handler-script.js"; + private final PrintWriter writer; private final HtmlSection rootSection; - public HtmlPage(PrintWriter writer) { - Objects.requireNonNull(writer, "writer cannot be null"); - this.writer = writer; + /** + * Constructs a {@code HtmlPage} + * + * @param dir The directory into which the HTML file and related resources will be created + * @param htmlFileName The HTML file name + * @param append if {@code true} then the content will be appended to the file represented + * by the {@code htmlFileName}, else the {@code htmlFileName} will be overwritten + * with the new content + * @throws IllegalArgumentException if {@code dir} is not a directory or if the + * {@code htmlFileName} is {@linkplain String#isBlank() blank} + * @throws IOException if there is an error constructing file resource(s) for this HTML page + */ + public HtmlPage(final Path dir, final String htmlFileName, final boolean append) + throws IOException { + Objects.requireNonNull(dir, "directory cannot be null"); + Objects.requireNonNull(htmlFileName, "HTML file name cannot be null"); + if (!Files.isDirectory(dir)) { + throw new IllegalArgumentException(dir + " is not a directory"); + } + if (htmlFileName.isBlank()) { + throw new IllegalArgumentException("HTML file name cannot be blank"); + } + final FileWriter fileWriter = new FileWriter(dir.resolve(htmlFileName).toFile(), append); + this.writer = new PrintWriter(fileWriter, true); + createScriptFile(dir); + createStyleSheetFile(dir); rootSection = new HtmlSection(writer); } + @Override public void close() { writer.close(); @@ -44,4 +75,71 @@ public class HtmlPage implements AutoCloseable { public HtmlSection getRootSection() { return rootSection; } + + private static void createStyleSheetFile(final Path destDir) throws IOException { + final Path styleSheet = destDir.resolve(STYLE_SHEET_FILENAME); + if (Files.exists(styleSheet)) { + return; + } + final String content = """ + div { display:none;} + """; + Files.writeString(styleSheet, content); + } + + private static void createScriptFile(final Path destDir) throws IOException { + final Path script = destDir.resolve(SCRIPT_FILENAME); + if (Files.exists(script)) { + return; + } + final String content = """ + function doShow(e) { + while (e != null) { + if (e.tagName == 'DIV') { + e.style.display = 'block'; + } + e = e.parentNode; + } + } + + function showHandler(event) { + elementId = this.dataset.show; + elementToShow = document.getElementById(elementId); + doShow(elementToShow); + } + + function toggleHandler(event) { + toggleElementId = this.dataset.toggle; + elementToToggle = document.getElementById(toggleElementId); + d = elementToToggle.style.display; + if (d == 'block') { + elementToToggle.style.display = 'none'; + } else { + doShow(elementToToggle); + } + } + + function bodyLoadHandler() { + const index = location.href.indexOf("#"); + if (index != -1) { + doShow(document.getElementById(location.href.substring(index + 1))); + } + // elements that require the "toggleHandler" function to be registered + // as an event handler for the onclick event + const requiringToggleHandler = document.querySelectorAll("[data-toggle]"); + for (const e of requiringToggleHandler) { + e.addEventListener("click", toggleHandler); + } + // elements that require the "showHandler" function to be registered + // as an event handler for the onclick event + const requiringShowHandler = document.querySelectorAll("[data-show]"); + for (const e of requiringShowHandler) { + e.addEventListener("click", showHandler); + } + } + // register a onload event handler + window.addEventListener("DOMContentLoaded", bodyLoadHandler); + """; + Files.writeString(script, content); + } } diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java index 141caf450bd..53ffab95a1e 100644 --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.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 @@ -57,41 +57,15 @@ public class HtmlSection { if (rootSection == null) { this.rootSection = this; this.pw.println(""); - this.pw.println("\n" - + "\n" - + "\n" - + ""); - this.pw.println(""); + this.pw.println(""); + this.pw.println( + ""); + this.pw.println( + ""); + this.pw.println(""); + + this.pw.println(""); } else { this.rootSection = rootSection; this.pw.print("

      "); @@ -146,7 +120,7 @@ public class HtmlSection { } else if (child != null) { path = String.format("%s.%s", path, child); } - pw.printf("%2$s%n", + pw.printf("%2$s%n", path, name); } @@ -188,7 +162,7 @@ public class HtmlSection { : String.format("%s.%s", parent.id, name), name, rootSection); this.parent = parent; - pw.printf("
    • %2$s
      ",
      +            pw.printf("
    • %2$s
      ",
                           id, name);
               }
       
      diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java
      index 96c5f4f2858..32dbedb5159 100644
      --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java
      +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2015, 2021, 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
      @@ -29,13 +29,14 @@ import com.sun.javatest.TestResult;
       import com.sun.javatest.regtest.config.RegressionParameters;
       import jdk.test.failurehandler.*;
       
      -import java.io.File;
       import java.io.FileWriter;
       import java.io.IOException;
       import java.io.PrintWriter;
       import java.nio.file.Files;
       import java.nio.file.Path;
       import java.nio.file.Paths;
      +import java.util.List;
      +import java.util.stream.Stream;
       
       /**
        * The jtreg test execution observer, which gathers info about
      @@ -85,11 +86,15 @@ public class GatherDiagnosticInfoObserver implements Harness.Observer {
                           testJdk, compileJdk);
                   gatherEnvInfo(workDir, name, log,
                           gathererFactory.getEnvironmentInfoGatherer());
      -            Files.walk(workDir)
      -                    .filter(Files::isRegularFile)
      -                    .filter(f -> (f.getFileName().toString().contains("core") || f.getFileName().toString().contains("mdmp")))
      -                    .forEach(core -> gatherCoreInfo(workDir, name,
      -                            core, log, gathererFactory.getCoreInfoGatherer()));
      +            // generate a cores.html file after parsing the core dump files (if any)
      +            List coreFiles;
      +            try (Stream paths = Files.walk(workDir)) {
      +                coreFiles = paths.filter(Files::isRegularFile)
      +                        .filter(f -> (f.getFileName().toString().contains("core")
      +                                || f.getFileName().toString().contains("mdmp")))
      +                        .toList();
      +            }
      +            gatherCoreInfo(workDir, name, coreFiles, log, gathererFactory.getCoreInfoGatherer());
               } catch (Throwable e) {
                   log.printf("ERROR: exception in observer %s:", name);
                   e.printStackTrace(log);
      @@ -103,27 +108,29 @@ public class GatherDiagnosticInfoObserver implements Harness.Observer {
               }
           }
       
      -    private void gatherCoreInfo(Path workDir, String name, Path core, PrintWriter log,
      -                               CoreInfoGatherer gatherer) {
      -        File output = workDir.resolve(CORES_OUTPUT).toFile();
      -        try (HtmlPage html = new HtmlPage(new PrintWriter(
      -                new FileWriter(output, true), true))) {
      +    private void gatherCoreInfo(Path workDir, String name, List coreFiles,
      +                                PrintWriter log, CoreInfoGatherer gatherer) {
      +        if (coreFiles.isEmpty()) {
      +            return;
      +        }
      +        try (HtmlPage html = new HtmlPage(workDir, CORES_OUTPUT, true)) {
                   try (ElapsedTimePrinter timePrinter
                                = new ElapsedTimePrinter(new Stopwatch(), name, log)) {
      -                gatherer.gatherCoreInfo(html.getRootSection(), core);
      +                // gather information from the contents of each core file
      +                for (Path coreFile : coreFiles) {
      +                    gatherer.gatherCoreInfo(html.getRootSection(), coreFile);
      +                }
                   }
               } catch (Throwable e) {
      -            log.printf("ERROR: exception in observer on getting environment "
      -                    + "information %s:", name);
      +            log.printf("ERROR: exception in %s observer while gathering information from"
      +                    + " core dump file", name);
                   e.printStackTrace(log);
               }
           }
       
           private void gatherEnvInfo(Path workDir, String name, PrintWriter log,
                                      EnvironmentInfoGatherer gatherer) {
      -        File output = workDir.resolve(ENVIRONMENT_OUTPUT).toFile();
      -        try (HtmlPage html = new HtmlPage(new PrintWriter(
      -                new FileWriter(output, true), true))) {
      +        try (HtmlPage html = new HtmlPage(workDir, ENVIRONMENT_OUTPUT, true)) {
                   try (ElapsedTimePrinter timePrinter
                                = new ElapsedTimePrinter(new Stopwatch(), name, log)) {
                       gatherer.gatherEnvironmentInfo(html.getRootSection());
      diff --git a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java
      index 63ed7e5f2c7..c1f1ddfb69f 100644
      --- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java
      +++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2015, 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
      @@ -69,16 +69,7 @@ public class GatherProcessInfoTimeoutHandler extends TimeoutHandler {
               }
               try {
                   actionsLog.printf("%s ---%n", name);
      -
      -            File output = workDir.resolve(OUTPUT_FILENAME).toFile();
      -            try {
      -                PrintWriter pw = new PrintWriter(new FileWriter(output, true), true);
      -                runGatherer(name, workDir, actionsLog, pw, pid);
      -            } catch (IOException e) {
      -                actionsLog.printf("IOException: cannot open output file[%s] : %s",
      -                        output, e.getMessage());
      -                e.printStackTrace(actionsLog);
      -            }
      +            runGatherer(name, actionsLog, pid);
               } finally {
                   actionsLog.printf("--- %s%n", name);
                   // don't close jtreg log
      @@ -90,9 +81,9 @@ public class GatherProcessInfoTimeoutHandler extends TimeoutHandler {
               }
           }
       
      -    private void runGatherer(String name, Path workDir, PrintWriter log,
      -                             PrintWriter out, long pid) {
      -        try (HtmlPage html = new HtmlPage(out)) {
      +    private void runGatherer(String name, PrintWriter log, long pid) {
      +        Path workDir = outputDir.toPath();
      +        try (HtmlPage html = new HtmlPage(workDir, OUTPUT_FILENAME, true)) {
                   ProcessInfoGatherer gatherer = new GathererFactory(
                           OS.current().family,
                           workDir, log, testJdk.toPath()).getProcessInfoGatherer();
      diff --git a/test/failure_handler/src/share/conf/mac.properties b/test/failure_handler/src/share/conf/mac.properties
      index e04b49e0fcf..6a4ada31e98 100644
      --- a/test/failure_handler/src/share/conf/mac.properties
      +++ b/test/failure_handler/src/share/conf/mac.properties
      @@ -1,5 +1,5 @@
       #
      -# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
      +# Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
       # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       #
       # This code is free software; you can redistribute it and/or modify it
      diff --git a/test/hotspot/gtest/aarch64/aarch64-asmtest.py b/test/hotspot/gtest/aarch64/aarch64-asmtest.py
      index 48b19acaa05..1ac2e1a89cd 100644
      --- a/test/hotspot/gtest/aarch64/aarch64-asmtest.py
      +++ b/test/hotspot/gtest/aarch64/aarch64-asmtest.py
      @@ -1871,6 +1871,12 @@ generate(ThreeRegNEONOp,
                 ["sminp", "sminp", "8B"], ["sminp", "sminp", "16B"],
                 ["sminp", "sminp", "4H"], ["sminp", "sminp", "8H"],
                 ["sminp", "sminp", "2S"], ["sminp", "sminp", "4S"],
      +          ["uminp", "uminp", "8B"], ["uminp", "uminp", "16B"],
      +          ["uminp", "uminp", "4H"], ["uminp", "uminp", "8H"],
      +          ["uminp", "uminp", "2S"], ["uminp", "uminp", "4S"],
      +          ["umaxp", "umaxp", "8B"], ["umaxp", "umaxp", "16B"],
      +          ["umaxp", "umaxp", "4H"], ["umaxp", "umaxp", "8H"],
      +          ["umaxp", "umaxp", "2S"], ["umaxp", "umaxp", "4S"],
                 ["sqdmulh", "sqdmulh", "4H"], ["sqdmulh", "sqdmulh", "8H"],
                 ["sqdmulh", "sqdmulh", "2S"], ["sqdmulh", "sqdmulh", "4S"],
                 ["shsubv", "shsub", "8B"], ["shsubv", "shsub", "16B"],
      @@ -2252,7 +2258,7 @@ generate(SVEVectorOp, [["add", "ZZZ"],
                              ["uqsub", "ZPZ", "m", "dn"],
                             ])
       
      -generate(SVEReductionOp, [["andv", 0], ["orv", 0], ["eorv", 0], ["smaxv", 0], ["sminv", 0],
      +generate(SVEReductionOp, [["andv", 0], ["orv", 0], ["eorv", 0], ["smaxv", 0], ["sminv", 0], ["umaxv", 0], ["uminv", 0],
                                 ["fminv", 2], ["fmaxv", 2], ["fadda", 2], ["uaddv", 0]])
       
       generate(AddWideNEONOp,
      diff --git a/test/hotspot/gtest/aarch64/asmtest.out.h b/test/hotspot/gtest/aarch64/asmtest.out.h
      index 34a5f8ca68e..22bb6c57784 100644
      --- a/test/hotspot/gtest/aarch64/asmtest.out.h
      +++ b/test/hotspot/gtest/aarch64/asmtest.out.h
      @@ -826,107 +826,119 @@
           __ sminp(v10, __ T8H, v11, v12);                   //       sminp   v10.8H, v11.8H, v12.8H
           __ sminp(v20, __ T2S, v21, v22);                   //       sminp   v20.2S, v21.2S, v22.2S
           __ sminp(v10, __ T4S, v11, v12);                   //       sminp   v10.4S, v11.4S, v12.4S
      -    __ sqdmulh(v4, __ T4H, v5, v6);                    //       sqdmulh v4.4H, v5.4H, v6.4H
      -    __ sqdmulh(v24, __ T8H, v25, v26);                 //       sqdmulh v24.8H, v25.8H, v26.8H
      -    __ sqdmulh(v17, __ T2S, v18, v19);                 //       sqdmulh v17.2S, v18.2S, v19.2S
      -    __ sqdmulh(v17, __ T4S, v18, v19);                 //       sqdmulh v17.4S, v18.4S, v19.4S
      -    __ shsubv(v22, __ T8B, v23, v24);                  //       shsub   v22.8B, v23.8B, v24.8B
      -    __ shsubv(v3, __ T16B, v4, v5);                    //       shsub   v3.16B, v4.16B, v5.16B
      -    __ shsubv(v29, __ T4H, v30, v31);                  //       shsub   v29.4H, v30.4H, v31.4H
      -    __ shsubv(v15, __ T8H, v16, v17);                  //       shsub   v15.8H, v16.8H, v17.8H
      -    __ shsubv(v22, __ T2S, v23, v24);                  //       shsub   v22.2S, v23.2S, v24.2S
      -    __ shsubv(v19, __ T4S, v20, v21);                  //       shsub   v19.4S, v20.4S, v21.4S
      +    __ uminp(v4, __ T8B, v5, v6);                      //       uminp   v4.8B, v5.8B, v6.8B
      +    __ uminp(v24, __ T16B, v25, v26);                  //       uminp   v24.16B, v25.16B, v26.16B
      +    __ uminp(v17, __ T4H, v18, v19);                   //       uminp   v17.4H, v18.4H, v19.4H
      +    __ uminp(v17, __ T8H, v18, v19);                   //       uminp   v17.8H, v18.8H, v19.8H
      +    __ uminp(v22, __ T2S, v23, v24);                   //       uminp   v22.2S, v23.2S, v24.2S
      +    __ uminp(v3, __ T4S, v4, v5);                      //       uminp   v3.4S, v4.4S, v5.4S
      +    __ umaxp(v29, __ T8B, v30, v31);                   //       umaxp   v29.8B, v30.8B, v31.8B
      +    __ umaxp(v15, __ T16B, v16, v17);                  //       umaxp   v15.16B, v16.16B, v17.16B
      +    __ umaxp(v22, __ T4H, v23, v24);                   //       umaxp   v22.4H, v23.4H, v24.4H
      +    __ umaxp(v19, __ T8H, v20, v21);                   //       umaxp   v19.8H, v20.8H, v21.8H
      +    __ umaxp(v19, __ T2S, v20, v21);                   //       umaxp   v19.2S, v20.2S, v21.2S
      +    __ umaxp(v22, __ T4S, v23, v24);                   //       umaxp   v22.4S, v23.4S, v24.4S
      +    __ sqdmulh(v2, __ T4H, v3, v4);                    //       sqdmulh v2.4H, v3.4H, v4.4H
      +    __ sqdmulh(v15, __ T8H, v16, v17);                 //       sqdmulh v15.8H, v16.8H, v17.8H
      +    __ sqdmulh(v6, __ T2S, v7, v8);                    //       sqdmulh v6.2S, v7.2S, v8.2S
      +    __ sqdmulh(v12, __ T4S, v13, v14);                 //       sqdmulh v12.4S, v13.4S, v14.4S
      +    __ shsubv(v16, __ T8B, v17, v18);                  //       shsub   v16.8B, v17.8B, v18.8B
      +    __ shsubv(v11, __ T16B, v12, v13);                 //       shsub   v11.16B, v12.16B, v13.16B
      +    __ shsubv(v13, __ T4H, v14, v15);                  //       shsub   v13.4H, v14.4H, v15.4H
      +    __ shsubv(v23, __ T8H, v24, v25);                  //       shsub   v23.8H, v24.8H, v25.8H
      +    __ shsubv(v1, __ T2S, v2, v3);                     //       shsub   v1.2S, v2.2S, v3.2S
      +    __ shsubv(v30, __ T4S, v31, v0);                   //       shsub   v30.4S, v31.4S, v0.4S
           __ fmin(v19, __ T2S, v20, v21);                    //       fmin    v19.2S, v20.2S, v21.2S
      -    __ fmin(v22, __ T4S, v23, v24);                    //       fmin    v22.4S, v23.4S, v24.4S
      -    __ fmin(v2, __ T2D, v3, v4);                       //       fmin    v2.2D, v3.2D, v4.2D
      -    __ fmin(v15, __ T4H, v16, v17);                    //       fmin    v15.4H, v16.4H, v17.4H
      -    __ fmin(v6, __ T8H, v7, v8);                       //       fmin    v6.8H, v7.8H, v8.8H
      -    __ facgt(v12, __ T2S, v13, v14);                   //       facgt   v12.2S, v13.2S, v14.2S
      -    __ facgt(v16, __ T4S, v17, v18);                   //       facgt   v16.4S, v17.4S, v18.4S
      -    __ facgt(v11, __ T2D, v12, v13);                   //       facgt   v11.2D, v12.2D, v13.2D
      -    __ facgt(v13, __ T4H, v14, v15);                   //       facgt   v13.4H, v14.4H, v15.4H
      -    __ facgt(v23, __ T8H, v24, v25);                   //       facgt   v23.8H, v24.8H, v25.8H
      +    __ fmin(v5, __ T4S, v6, v7);                       //       fmin    v5.4S, v6.4S, v7.4S
      +    __ fmin(v17, __ T2D, v18, v19);                    //       fmin    v17.2D, v18.2D, v19.2D
      +    __ fmin(v2, __ T4H, v3, v4);                       //       fmin    v2.4H, v3.4H, v4.4H
      +    __ fmin(v16, __ T8H, v17, v18);                    //       fmin    v16.8H, v17.8H, v18.8H
      +    __ facgt(v22, __ T2S, v23, v24);                   //       facgt   v22.2S, v23.2S, v24.2S
      +    __ facgt(v13, __ T4S, v14, v15);                   //       facgt   v13.4S, v14.4S, v15.4S
      +    __ facgt(v10, __ T2D, v11, v12);                   //       facgt   v10.2D, v11.2D, v12.2D
      +    __ facgt(v21, __ T4H, v22, v23);                   //       facgt   v21.4H, v22.4H, v23.4H
      +    __ facgt(v29, __ T8H, v30, v31);                   //       facgt   v29.8H, v30.8H, v31.8H
       
       // VectorScalarNEONInstruction
      -    __ fmlavs(v15, __ T2S, v0, v1, 0);                 //       fmla    v15.2S, v0.2S, v1.S[0]
      -    __ mulvs(v2, __ T4S, v3, v4, 2);                   //       mul     v2.4S, v3.4S, v4.S[2]
      -    __ fmlavs(v1, __ T2D, v2, v3, 1);                  //       fmla    v1.2D, v2.2D, v3.D[1]
      -    __ fmlsvs(v11, __ T2S, v12, v13, 1);               //       fmls    v11.2S, v12.2S, v13.S[1]
      -    __ mulvs(v5, __ T4S, v6, v7, 1);                   //       mul     v5.4S, v6.4S, v7.S[1]
      -    __ fmlsvs(v14, __ T2D, v15, v16, 1);               //       fmls    v14.2D, v15.2D, v16.D[1]
      -    __ fmulxvs(v6, __ T2S, v7, v8, 1);                 //       fmulx   v6.2S, v7.2S, v8.S[1]
      +    __ fmlavs(v6, __ T2S, v7, v8, 1);                  //       fmla    v6.2S, v7.2S, v8.S[1]
           __ mulvs(v1, __ T4S, v2, v3, 3);                   //       mul     v1.4S, v2.4S, v3.S[3]
      -    __ fmulxvs(v15, __ T2D, v0, v1, 0);                //       fmulx   v15.2D, v0.2D, v1.D[0]
      -    __ mulvs(v9, __ T4H, v10, v11, 3);                 //       mul     v9.4H, v10.4H, v11.H[3]
      -    __ mulvs(v4, __ T8H, v5, v6, 4);                   //       mul     v4.8H, v5.8H, v6.H[4]
      -    __ mulvs(v13, __ T2S, v14, v15, 1);                //       mul     v13.2S, v14.2S, v15.S[1]
      -    __ mulvs(v3, __ T4S, v4, v5, 1);                   //       mul     v3.4S, v4.4S, v5.S[1]
      +    __ fmlavs(v15, __ T2D, v0, v1, 0);                 //       fmla    v15.2D, v0.2D, v1.D[0]
      +    __ fmlsvs(v9, __ T2S, v10, v11, 1);                //       fmls    v9.2S, v10.2S, v11.S[1]
      +    __ mulvs(v4, __ T4S, v5, v6, 2);                   //       mul     v4.4S, v5.4S, v6.S[2]
      +    __ fmlsvs(v13, __ T2D, v14, v15, 1);               //       fmls    v13.2D, v14.2D, v15.D[1]
      +    __ fmulxvs(v3, __ T2S, v4, v5, 0);                 //       fmulx   v3.2S, v4.2S, v5.S[0]
      +    __ mulvs(v11, __ T4S, v12, v13, 2);                //       mul     v11.4S, v12.4S, v13.S[2]
      +    __ fmulxvs(v12, __ T2D, v13, v14, 1);              //       fmulx   v12.2D, v13.2D, v14.D[1]
      +    __ mulvs(v15, __ T4H, v0, v1, 0);                  //       mul     v15.4H, v0.4H, v1.H[0]
      +    __ mulvs(v9, __ T8H, v10, v11, 6);                 //       mul     v9.8H, v10.8H, v11.H[6]
      +    __ mulvs(v11, __ T2S, v12, v13, 0);                //       mul     v11.2S, v12.2S, v13.S[0]
      +    __ mulvs(v1, __ T4S, v2, v3, 2);                   //       mul     v1.4S, v2.4S, v3.S[2]
       
       // NEONVectorCompare
      -    __ cm(Assembler::GT, v21, __ T8B, v22, v23);       //       cmgt    v21.8B, v22.8B, v23.8B
      -    __ cm(Assembler::GT, v23, __ T16B, v24, v25);      //       cmgt    v23.16B, v24.16B, v25.16B
      -    __ cm(Assembler::GT, v31, __ T4H, v0, v1);         //       cmgt    v31.4H, v0.4H, v1.4H
      -    __ cm(Assembler::GT, v25, __ T8H, v26, v27);       //       cmgt    v25.8H, v26.8H, v27.8H
      -    __ cm(Assembler::GT, v2, __ T2S, v3, v4);          //       cmgt    v2.2S, v3.2S, v4.2S
      -    __ cm(Assembler::GT, v31, __ T4S, v0, v1);         //       cmgt    v31.4S, v0.4S, v1.4S
      -    __ cm(Assembler::GT, v27, __ T2D, v28, v29);       //       cmgt    v27.2D, v28.2D, v29.2D
      -    __ cm(Assembler::GE, v18, __ T8B, v19, v20);       //       cmge    v18.8B, v19.8B, v20.8B
      -    __ cm(Assembler::GE, v10, __ T16B, v11, v12);      //       cmge    v10.16B, v11.16B, v12.16B
      -    __ cm(Assembler::GE, v23, __ T4H, v24, v25);       //       cmge    v23.4H, v24.4H, v25.4H
      -    __ cm(Assembler::GE, v19, __ T8H, v20, v21);       //       cmge    v19.8H, v20.8H, v21.8H
      -    __ cm(Assembler::GE, v3, __ T2S, v4, v5);          //       cmge    v3.2S, v4.2S, v5.2S
      -    __ cm(Assembler::GE, v18, __ T4S, v19, v20);       //       cmge    v18.4S, v19.4S, v20.4S
      -    __ cm(Assembler::GE, v0, __ T2D, v1, v2);          //       cmge    v0.2D, v1.2D, v2.2D
      -    __ cm(Assembler::EQ, v25, __ T8B, v26, v27);       //       cmeq    v25.8B, v26.8B, v27.8B
      -    __ cm(Assembler::EQ, v26, __ T16B, v27, v28);      //       cmeq    v26.16B, v27.16B, v28.16B
      -    __ cm(Assembler::EQ, v23, __ T4H, v24, v25);       //       cmeq    v23.4H, v24.4H, v25.4H
      -    __ cm(Assembler::EQ, v2, __ T8H, v3, v4);          //       cmeq    v2.8H, v3.8H, v4.8H
      -    __ cm(Assembler::EQ, v18, __ T2S, v19, v20);       //       cmeq    v18.2S, v19.2S, v20.2S
      -    __ cm(Assembler::EQ, v12, __ T4S, v13, v14);       //       cmeq    v12.4S, v13.4S, v14.4S
      -    __ cm(Assembler::EQ, v4, __ T2D, v5, v6);          //       cmeq    v4.2D, v5.2D, v6.2D
      -    __ cm(Assembler::HI, v28, __ T8B, v29, v30);       //       cmhi    v28.8B, v29.8B, v30.8B
      -    __ cm(Assembler::HI, v30, __ T16B, v31, v0);       //       cmhi    v30.16B, v31.16B, v0.16B
      -    __ cm(Assembler::HI, v29, __ T4H, v30, v31);       //       cmhi    v29.4H, v30.4H, v31.4H
      -    __ cm(Assembler::HI, v16, __ T8H, v17, v18);       //       cmhi    v16.8H, v17.8H, v18.8H
      -    __ cm(Assembler::HI, v27, __ T2S, v28, v29);       //       cmhi    v27.2S, v28.2S, v29.2S
      -    __ cm(Assembler::HI, v6, __ T4S, v7, v8);          //       cmhi    v6.4S, v7.4S, v8.4S
      -    __ cm(Assembler::HI, v9, __ T2D, v10, v11);        //       cmhi    v9.2D, v10.2D, v11.2D
      -    __ cm(Assembler::HS, v29, __ T8B, v30, v31);       //       cmhs    v29.8B, v30.8B, v31.8B
      -    __ cm(Assembler::HS, v18, __ T16B, v19, v20);      //       cmhs    v18.16B, v19.16B, v20.16B
      -    __ cm(Assembler::HS, v7, __ T4H, v8, v9);          //       cmhs    v7.4H, v8.4H, v9.4H
      -    __ cm(Assembler::HS, v4, __ T8H, v5, v6);          //       cmhs    v4.8H, v5.8H, v6.8H
      -    __ cm(Assembler::HS, v7, __ T2S, v8, v9);          //       cmhs    v7.2S, v8.2S, v9.2S
      +    __ cm(Assembler::GT, v18, __ T8B, v19, v20);       //       cmgt    v18.8B, v19.8B, v20.8B
      +    __ cm(Assembler::GT, v0, __ T16B, v1, v2);         //       cmgt    v0.16B, v1.16B, v2.16B
      +    __ cm(Assembler::GT, v25, __ T4H, v26, v27);       //       cmgt    v25.4H, v26.4H, v27.4H
      +    __ cm(Assembler::GT, v26, __ T8H, v27, v28);       //       cmgt    v26.8H, v27.8H, v28.8H
      +    __ cm(Assembler::GT, v23, __ T2S, v24, v25);       //       cmgt    v23.2S, v24.2S, v25.2S
      +    __ cm(Assembler::GT, v2, __ T4S, v3, v4);          //       cmgt    v2.4S, v3.4S, v4.4S
      +    __ cm(Assembler::GT, v18, __ T2D, v19, v20);       //       cmgt    v18.2D, v19.2D, v20.2D
      +    __ cm(Assembler::GE, v12, __ T8B, v13, v14);       //       cmge    v12.8B, v13.8B, v14.8B
      +    __ cm(Assembler::GE, v4, __ T16B, v5, v6);         //       cmge    v4.16B, v5.16B, v6.16B
      +    __ cm(Assembler::GE, v28, __ T4H, v29, v30);       //       cmge    v28.4H, v29.4H, v30.4H
      +    __ cm(Assembler::GE, v30, __ T8H, v31, v0);        //       cmge    v30.8H, v31.8H, v0.8H
      +    __ cm(Assembler::GE, v29, __ T2S, v30, v31);       //       cmge    v29.2S, v30.2S, v31.2S
      +    __ cm(Assembler::GE, v16, __ T4S, v17, v18);       //       cmge    v16.4S, v17.4S, v18.4S
      +    __ cm(Assembler::GE, v27, __ T2D, v28, v29);       //       cmge    v27.2D, v28.2D, v29.2D
      +    __ cm(Assembler::EQ, v6, __ T8B, v7, v8);          //       cmeq    v6.8B, v7.8B, v8.8B
      +    __ cm(Assembler::EQ, v9, __ T16B, v10, v11);       //       cmeq    v9.16B, v10.16B, v11.16B
      +    __ cm(Assembler::EQ, v29, __ T4H, v30, v31);       //       cmeq    v29.4H, v30.4H, v31.4H
      +    __ cm(Assembler::EQ, v18, __ T8H, v19, v20);       //       cmeq    v18.8H, v19.8H, v20.8H
      +    __ cm(Assembler::EQ, v7, __ T2S, v8, v9);          //       cmeq    v7.2S, v8.2S, v9.2S
      +    __ cm(Assembler::EQ, v4, __ T4S, v5, v6);          //       cmeq    v4.4S, v5.4S, v6.4S
      +    __ cm(Assembler::EQ, v7, __ T2D, v8, v9);          //       cmeq    v7.2D, v8.2D, v9.2D
      +    __ cm(Assembler::HI, v15, __ T8B, v16, v17);       //       cmhi    v15.8B, v16.8B, v17.8B
      +    __ cm(Assembler::HI, v9, __ T16B, v10, v11);       //       cmhi    v9.16B, v10.16B, v11.16B
      +    __ cm(Assembler::HI, v23, __ T4H, v24, v25);       //       cmhi    v23.4H, v24.4H, v25.4H
      +    __ cm(Assembler::HI, v8, __ T8H, v9, v10);         //       cmhi    v8.8H, v9.8H, v10.8H
      +    __ cm(Assembler::HI, v2, __ T2S, v3, v4);          //       cmhi    v2.2S, v3.2S, v4.2S
      +    __ cm(Assembler::HI, v28, __ T4S, v29, v30);       //       cmhi    v28.4S, v29.4S, v30.4S
      +    __ cm(Assembler::HI, v21, __ T2D, v22, v23);       //       cmhi    v21.2D, v22.2D, v23.2D
      +    __ cm(Assembler::HS, v31, __ T8B, v0, v1);         //       cmhs    v31.8B, v0.8B, v1.8B
      +    __ cm(Assembler::HS, v5, __ T16B, v6, v7);         //       cmhs    v5.16B, v6.16B, v7.16B
      +    __ cm(Assembler::HS, v27, __ T4H, v28, v29);       //       cmhs    v27.4H, v28.4H, v29.4H
      +    __ cm(Assembler::HS, v0, __ T8H, v1, v2);          //       cmhs    v0.8H, v1.8H, v2.8H
      +    __ cm(Assembler::HS, v17, __ T2S, v18, v19);       //       cmhs    v17.2S, v18.2S, v19.2S
           __ cm(Assembler::HS, v15, __ T4S, v16, v17);       //       cmhs    v15.4S, v16.4S, v17.4S
      -    __ cm(Assembler::HS, v9, __ T2D, v10, v11);        //       cmhs    v9.2D, v10.2D, v11.2D
      -    __ fcm(Assembler::EQ, v23, __ T2S, v24, v25);      //       fcmeq   v23.2S, v24.2S, v25.2S
      +    __ cm(Assembler::HS, v4, __ T2D, v5, v6);          //       cmhs    v4.2D, v5.2D, v6.2D
      +    __ fcm(Assembler::EQ, v26, __ T2S, v27, v28);      //       fcmeq   v26.2S, v27.2S, v28.2S
           __ fcm(Assembler::EQ, v8, __ T4S, v9, v10);        //       fcmeq   v8.4S, v9.4S, v10.4S
      -    __ fcm(Assembler::EQ, v2, __ T2D, v3, v4);         //       fcmeq   v2.2D, v3.2D, v4.2D
      -    __ fcm(Assembler::GT, v28, __ T2S, v29, v30);      //       fcmgt   v28.2S, v29.2S, v30.2S
      -    __ fcm(Assembler::GT, v21, __ T4S, v22, v23);      //       fcmgt   v21.4S, v22.4S, v23.4S
      -    __ fcm(Assembler::GT, v31, __ T2D, v0, v1);        //       fcmgt   v31.2D, v0.2D, v1.2D
      -    __ fcm(Assembler::GE, v5, __ T2S, v6, v7);         //       fcmge   v5.2S, v6.2S, v7.2S
      -    __ fcm(Assembler::GE, v27, __ T4S, v28, v29);      //       fcmge   v27.4S, v28.4S, v29.4S
      +    __ fcm(Assembler::EQ, v28, __ T2D, v29, v30);      //       fcmeq   v28.2D, v29.2D, v30.2D
      +    __ fcm(Assembler::GT, v22, __ T2S, v23, v24);      //       fcmgt   v22.2S, v23.2S, v24.2S
      +    __ fcm(Assembler::GT, v27, __ T4S, v28, v29);      //       fcmgt   v27.4S, v28.4S, v29.4S
      +    __ fcm(Assembler::GT, v27, __ T2D, v28, v29);      //       fcmgt   v27.2D, v28.2D, v29.2D
      +    __ fcm(Assembler::GE, v25, __ T2S, v26, v27);      //       fcmge   v25.2S, v26.2S, v27.2S
      +    __ fcm(Assembler::GE, v23, __ T4S, v24, v25);      //       fcmge   v23.4S, v24.4S, v25.4S
           __ fcm(Assembler::GE, v0, __ T2D, v1, v2);         //       fcmge   v0.2D, v1.2D, v2.2D
       
       // SVEComparisonWithZero
      -    __ sve_fcm(Assembler::EQ, p8, __ S, p6, z15, 0.0); //       fcmeq   p8.s, p6/z, z15.s, #0.0
      -    __ sve_fcm(Assembler::GT, p4, __ D, p6, z28, 0.0); //       fcmgt   p4.d, p6/z, z28.d, #0.0
      -    __ sve_fcm(Assembler::GE, p13, __ D, p0, z25, 0.0); //      fcmge   p13.d, p0/z, z25.d, #0.0
      -    __ sve_fcm(Assembler::LT, p2, __ D, p0, z6, 0.0);  //       fcmlt   p2.d, p0/z, z6.d, #0.0
      -    __ sve_fcm(Assembler::LE, p2, __ S, p2, z15, 0.0); //       fcmle   p2.s, p2/z, z15.s, #0.0
      -    __ sve_fcm(Assembler::NE, p3, __ S, p7, z5, 0.0);  //       fcmne   p3.s, p7/z, z5.s, #0.0
      +    __ sve_fcm(Assembler::EQ, p2, __ D, p0, z6, 0.0);  //       fcmeq   p2.d, p0/z, z6.d, #0.0
      +    __ sve_fcm(Assembler::GT, p2, __ S, p2, z15, 0.0); //       fcmgt   p2.s, p2/z, z15.s, #0.0
      +    __ sve_fcm(Assembler::GE, p3, __ S, p7, z5, 0.0);  //       fcmge   p3.s, p7/z, z5.s, #0.0
      +    __ sve_fcm(Assembler::LT, p3, __ D, p5, z20, 0.0); //       fcmlt   p3.d, p5/z, z20.d, #0.0
      +    __ sve_fcm(Assembler::LE, p3, __ S, p4, z11, 0.0); //       fcmle   p3.s, p4/z, z11.s, #0.0
      +    __ sve_fcm(Assembler::NE, p15, __ D, p0, z6, 0.0); //       fcmne   p15.d, p0/z, z6.d, #0.0
       
       // SVEComparisonWithImm
      -    __ sve_cmp(Assembler::EQ, p3, __ S, p5, z20, -10); //       cmpeq   p3.s, p5/z, z20.s, #-10
      -    __ sve_cmp(Assembler::GT, p5, __ S, p7, z8, -10);  //       cmpgt   p5.s, p7/z, z8.s, #-10
      -    __ sve_cmp(Assembler::GE, p8, __ H, p7, z2, 13);   //       cmpge   p8.h, p7/z, z2.h, #13
      -    __ sve_cmp(Assembler::LT, p1, __ S, p7, z27, -2);  //       cmplt   p1.s, p7/z, z27.s, #-2
      -    __ sve_cmp(Assembler::LE, p6, __ S, p6, z28, -11); //       cmple   p6.s, p6/z, z28.s, #-11
      -    __ sve_cmp(Assembler::NE, p1, __ H, p4, z14, -5);  //       cmpne   p1.h, p4/z, z14.h, #-5
      -    __ sve_cmp(Assembler::HS, p13, __ H, p1, z23, 90); //       cmphs   p13.h, p1/z, z23.h, #90
      -    __ sve_cmp(Assembler::HI, p8, __ B, p4, z4, 66);   //       cmphi   p8.b, p4/z, z4.b, #66
      -    __ sve_cmp(Assembler::LS, p9, __ H, p3, z13, 11);  //       cmpls   p9.h, p3/z, z13.h, #11
      -    __ sve_cmp(Assembler::LO, p8, __ S, p5, z3, 21);   //       cmplo   p8.s, p5/z, z3.s, #21
      +    __ sve_cmp(Assembler::EQ, p6, __ D, p0, z30, 11);  //       cmpeq   p6.d, p0/z, z30.d, #11
      +    __ sve_cmp(Assembler::GT, p11, __ H, p3, z29, 12); //       cmpgt   p11.h, p3/z, z29.h, #12
      +    __ sve_cmp(Assembler::GE, p8, __ B, p0, z24, -2);  //       cmpge   p8.b, p0/z, z24.b, #-2
      +    __ sve_cmp(Assembler::LT, p5, __ H, p6, z16, 7);   //       cmplt   p5.h, p6/z, z16.h, #7
      +    __ sve_cmp(Assembler::LE, p6, __ S, p4, z4, -12);  //       cmple   p6.s, p4/z, z4.s, #-12
      +    __ sve_cmp(Assembler::NE, p0, __ S, p4, z19, -3);  //       cmpne   p0.s, p4/z, z19.s, #-3
      +    __ sve_cmp(Assembler::HS, p7, __ B, p4, z12, 15);  //       cmphs   p7.b, p4/z, z12.b, #15
      +    __ sve_cmp(Assembler::HI, p10, __ B, p1, z23, 30); //       cmphi   p10.b, p1/z, z23.b, #30
      +    __ sve_cmp(Assembler::LS, p9, __ D, p4, z13, 67);  //       cmpls   p9.d, p4/z, z13.d, #67
      +    __ sve_cmp(Assembler::LO, p3, __ D, p0, z2, 16);   //       cmplo   p3.d, p0/z, z2.d, #16
       
       // SpecialCases
           __ ccmn(zr, zr, 3u, Assembler::LE);                //       ccmn    xzr, xzr, #3, LE
      @@ -1198,239 +1210,241 @@
           __ fmovd(v0, -1.0625);                             //       fmov d0, #-1.0625
       
       // LSEOp
      -    __ swp(Assembler::xword, r6, r7, r19);             //       swp     x6, x7, [x19]
      -    __ ldadd(Assembler::xword, r13, r28, r17);         //       ldadd   x13, x28, [x17]
      -    __ ldbic(Assembler::xword, r16, r6, r2);           //       ldclr   x16, x6, [x2]
      -    __ ldeor(Assembler::xword, r29, r3, r4);           //       ldeor   x29, x3, [x4]
      -    __ ldorr(Assembler::xword, r6, r16, r20);          //       ldset   x6, x16, [x20]
      -    __ ldsmin(Assembler::xword, r13, r12, r20);        //       ldsmin  x13, x12, [x20]
      -    __ ldsmax(Assembler::xword, r8, r25, r20);         //       ldsmax  x8, x25, [x20]
      -    __ ldumin(Assembler::xword, r19, r0, r11);         //       ldumin  x19, x0, [x11]
      -    __ ldumax(Assembler::xword, r24, r6, r20);         //       ldumax  x24, x6, [x20]
      +    __ swp(Assembler::xword, r6, r16, r20);            //       swp     x6, x16, [x20]
      +    __ ldadd(Assembler::xword, r13, r12, r20);         //       ldadd   x13, x12, [x20]
      +    __ ldbic(Assembler::xword, r8, r25, r20);          //       ldclr   x8, x25, [x20]
      +    __ ldeor(Assembler::xword, r19, r0, r11);          //       ldeor   x19, x0, [x11]
      +    __ ldorr(Assembler::xword, r24, r6, r20);          //       ldset   x24, x6, [x20]
      +    __ ldsmin(Assembler::xword, zr, r14, r16);         //       ldsmin  xzr, x14, [x16]
      +    __ ldsmax(Assembler::xword, r6, r0, r7);           //       ldsmax  x6, x0, [x7]
      +    __ ldumin(Assembler::xword, r15, r19, r26);        //       ldumin  x15, x19, [x26]
      +    __ ldumax(Assembler::xword, r9, r10, r23);         //       ldumax  x9, x10, [x23]
       
       // LSEOp
      -    __ swpa(Assembler::xword, zr, r14, r16);           //       swpa    xzr, x14, [x16]
      -    __ ldadda(Assembler::xword, r6, r0, r7);           //       ldadda  x6, x0, [x7]
      -    __ ldbica(Assembler::xword, r15, r19, r26);        //       ldclra  x15, x19, [x26]
      -    __ ldeora(Assembler::xword, r9, r10, r23);         //       ldeora  x9, x10, [x23]
      -    __ ldorra(Assembler::xword, r21, r22, r28);        //       ldseta  x21, x22, [x28]
      -    __ ldsmina(Assembler::xword, r2, r3, r15);         //       ldsmina x2, x3, [x15]
      -    __ ldsmaxa(Assembler::xword, r19, r20, r7);        //       ldsmaxa x19, x20, [x7]
      -    __ ldumina(Assembler::xword, r4, r29, r7);         //       ldumina x4, x29, [x7]
      -    __ ldumaxa(Assembler::xword, r0, r9, r16);         //       ldumaxa x0, x9, [x16]
      +    __ swpa(Assembler::xword, r21, r22, r28);          //       swpa    x21, x22, [x28]
      +    __ ldadda(Assembler::xword, r2, r3, r15);          //       ldadda  x2, x3, [x15]
      +    __ ldbica(Assembler::xword, r19, r20, r7);         //       ldclra  x19, x20, [x7]
      +    __ ldeora(Assembler::xword, r4, r29, r7);          //       ldeora  x4, x29, [x7]
      +    __ ldorra(Assembler::xword, r0, r9, r16);          //       ldseta  x0, x9, [x16]
      +    __ ldsmina(Assembler::xword, r20, r23, r4);        //       ldsmina x20, x23, [x4]
      +    __ ldsmaxa(Assembler::xword, r16, r10, r23);       //       ldsmaxa x16, x10, [x23]
      +    __ ldumina(Assembler::xword, r11, r25, r6);        //       ldumina x11, x25, [x6]
      +    __ ldumaxa(Assembler::xword, zr, r16, r13);        //       ldumaxa xzr, x16, [x13]
       
       // LSEOp
      -    __ swpal(Assembler::xword, r20, r23, r4);          //       swpal   x20, x23, [x4]
      -    __ ldaddal(Assembler::xword, r16, r10, r23);       //       ldaddal x16, x10, [x23]
      -    __ ldbical(Assembler::xword, r11, r25, r6);        //       ldclral x11, x25, [x6]
      -    __ ldeoral(Assembler::xword, zr, r16, r13);        //       ldeoral xzr, x16, [x13]
      -    __ ldorral(Assembler::xword, r23, r12, r1);        //       ldsetal x23, x12, [x1]
      -    __ ldsminal(Assembler::xword, r14, r9, r21);       //       ldsminal        x14, x9, [x21]
      -    __ ldsmaxal(Assembler::xword, r16, r26, r15);      //       ldsmaxal        x16, x26, [x15]
      -    __ lduminal(Assembler::xword, r4, r4, r15);        //       lduminal        x4, x4, [x15]
      -    __ ldumaxal(Assembler::xword, r8, r6, r30);        //       ldumaxal        x8, x6, [x30]
      +    __ swpal(Assembler::xword, r23, r12, r1);          //       swpal   x23, x12, [x1]
      +    __ ldaddal(Assembler::xword, r14, r9, r21);        //       ldaddal x14, x9, [x21]
      +    __ ldbical(Assembler::xword, r16, r26, r15);       //       ldclral x16, x26, [x15]
      +    __ ldeoral(Assembler::xword, r4, r4, r15);         //       ldeoral x4, x4, [x15]
      +    __ ldorral(Assembler::xword, r8, r6, r30);         //       ldsetal x8, x6, [x30]
      +    __ ldsminal(Assembler::xword, r4, r29, r17);       //       ldsminal        x4, x29, [x17]
      +    __ ldsmaxal(Assembler::xword, r29, r26, r9);       //       ldsmaxal        x29, x26, [x9]
      +    __ lduminal(Assembler::xword, r15, r2, r11);       //       lduminal        x15, x2, [x11]
      +    __ ldumaxal(Assembler::xword, r29, r3, r7);        //       ldumaxal        x29, x3, [x7]
       
       // LSEOp
      -    __ swpl(Assembler::xword, r4, r29, r17);           //       swpl    x4, x29, [x17]
      -    __ ldaddl(Assembler::xword, r29, r26, r9);         //       ldaddl  x29, x26, [x9]
      -    __ ldbicl(Assembler::xword, r15, r2, r11);         //       ldclrl  x15, x2, [x11]
      -    __ ldeorl(Assembler::xword, r29, r3, r7);          //       ldeorl  x29, x3, [x7]
      -    __ ldorrl(Assembler::xword, r1, r27, r21);         //       ldsetl  x1, x27, [x21]
      -    __ ldsminl(Assembler::xword, r16, r14, r8);        //       ldsminl x16, x14, [x8]
      -    __ ldsmaxl(Assembler::xword, r16, r22, r25);       //       ldsmaxl x16, x22, [x25]
      -    __ lduminl(Assembler::xword, r5, r20, r21);        //       lduminl x5, x20, [x21]
      -    __ ldumaxl(Assembler::xword, r16, r23, r16);       //       ldumaxl x16, x23, [x16]
      +    __ swpl(Assembler::xword, r1, r27, r21);           //       swpl    x1, x27, [x21]
      +    __ ldaddl(Assembler::xword, r16, r14, r8);         //       ldaddl  x16, x14, [x8]
      +    __ ldbicl(Assembler::xword, r16, r22, r25);        //       ldclrl  x16, x22, [x25]
      +    __ ldeorl(Assembler::xword, r5, r20, r21);         //       ldeorl  x5, x20, [x21]
      +    __ ldorrl(Assembler::xword, r16, r23, r16);        //       ldsetl  x16, x23, [x16]
      +    __ ldsminl(Assembler::xword, r30, r20, r20);       //       ldsminl x30, x20, [x20]
      +    __ ldsmaxl(Assembler::xword, r0, r4, r19);         //       ldsmaxl x0, x4, [x19]
      +    __ lduminl(Assembler::xword, r24, r4, r20);        //       lduminl x24, x4, [x20]
      +    __ ldumaxl(Assembler::xword, r4, r24, r26);        //       ldumaxl x4, x24, [x26]
       
       // LSEOp
      -    __ swp(Assembler::word, r30, r20, r20);            //       swp     w30, w20, [x20]
      -    __ ldadd(Assembler::word, r0, r4, r19);            //       ldadd   w0, w4, [x19]
      -    __ ldbic(Assembler::word, r24, r4, r20);           //       ldclr   w24, w4, [x20]
      -    __ ldeor(Assembler::word, r4, r24, r26);           //       ldeor   w4, w24, [x26]
      -    __ ldorr(Assembler::word, r19, r2, r8);            //       ldset   w19, w2, [x8]
      -    __ ldsmin(Assembler::word, r8, r14, r24);          //       ldsmin  w8, w14, [x24]
      -    __ ldsmax(Assembler::word, r16, zr, r22);          //       ldsmax  w16, wzr, [x22]
      -    __ ldumin(Assembler::word, r4, zr, r1);            //       ldumin  w4, wzr, [x1]
      -    __ ldumax(Assembler::word, r10, r20, r12);         //       ldumax  w10, w20, [x12]
      +    __ swp(Assembler::word, r19, r2, r8);              //       swp     w19, w2, [x8]
      +    __ ldadd(Assembler::word, r8, r14, r24);           //       ldadd   w8, w14, [x24]
      +    __ ldbic(Assembler::word, r16, zr, r22);           //       ldclr   w16, wzr, [x22]
      +    __ ldeor(Assembler::word, r4, zr, r1);             //       ldeor   w4, wzr, [x1]
      +    __ ldorr(Assembler::word, r10, r20, r12);          //       ldset   w10, w20, [x12]
      +    __ ldsmin(Assembler::word, r0, r9, r7);            //       ldsmin  w0, w9, [x7]
      +    __ ldsmax(Assembler::word, r24, r16, r4);          //       ldsmax  w24, w16, [x4]
      +    __ ldumin(Assembler::word, r27, r6, r10);          //       ldumin  w27, w6, [x10]
      +    __ ldumax(Assembler::word, r27, r24, r13);         //       ldumax  w27, w24, [x13]
       
       // LSEOp
      -    __ swpa(Assembler::word, r0, r9, r7);              //       swpa    w0, w9, [x7]
      -    __ ldadda(Assembler::word, r24, r16, r4);          //       ldadda  w24, w16, [x4]
      -    __ ldbica(Assembler::word, r27, r6, r10);          //       ldclra  w27, w6, [x10]
      -    __ ldeora(Assembler::word, r27, r24, r13);         //       ldeora  w27, w24, [x13]
      -    __ ldorra(Assembler::word, r16, zr, r22);          //       ldseta  w16, wzr, [x22]
      -    __ ldsmina(Assembler::word, r22, r20, sp);         //       ldsmina w22, w20, [sp]
      -    __ ldsmaxa(Assembler::word, r29, r9, r14);         //       ldsmaxa w29, w9, [x14]
      -    __ ldumina(Assembler::word, r20, r7, r20);         //       ldumina w20, w7, [x20]
      -    __ ldumaxa(Assembler::word, r28, r9, r11);         //       ldumaxa w28, w9, [x11]
      +    __ swpa(Assembler::word, r16, zr, r22);            //       swpa    w16, wzr, [x22]
      +    __ ldadda(Assembler::word, r22, r20, sp);          //       ldadda  w22, w20, [sp]
      +    __ ldbica(Assembler::word, r29, r9, r14);          //       ldclra  w29, w9, [x14]
      +    __ ldeora(Assembler::word, r20, r7, r20);          //       ldeora  w20, w7, [x20]
      +    __ ldorra(Assembler::word, r28, r9, r11);          //       ldseta  w28, w9, [x11]
      +    __ ldsmina(Assembler::word, r14, r12, r20);        //       ldsmina w14, w12, [x20]
      +    __ ldsmaxa(Assembler::word, r1, r24, r9);          //       ldsmaxa w1, w24, [x9]
      +    __ ldumina(Assembler::word, r19, r13, r19);        //       ldumina w19, w13, [x19]
      +    __ ldumaxa(Assembler::word, r16, r16, r5);         //       ldumaxa w16, w16, [x5]
       
       // LSEOp
      -    __ swpal(Assembler::word, r14, r12, r20);          //       swpal   w14, w12, [x20]
      -    __ ldaddal(Assembler::word, r1, r24, r9);          //       ldaddal w1, w24, [x9]
      -    __ ldbical(Assembler::word, r19, r13, r19);        //       ldclral w19, w13, [x19]
      -    __ ldeoral(Assembler::word, r16, r16, r5);         //       ldeoral w16, w16, [x5]
      -    __ ldorral(Assembler::word, r0, r3, r12);          //       ldsetal w0, w3, [x12]
      -    __ ldsminal(Assembler::word, r8, r15, r15);        //       ldsminal        w8, w15, [x15]
      -    __ ldsmaxal(Assembler::word, r16, r4, r15);        //       ldsmaxal        w16, w4, [x15]
      -    __ lduminal(Assembler::word, r30, r5, r0);         //       lduminal        w30, w5, [x0]
      -    __ ldumaxal(Assembler::word, r10, r22, r27);       //       ldumaxal        w10, w22, [x27]
      +    __ swpal(Assembler::word, r0, r3, r12);            //       swpal   w0, w3, [x12]
      +    __ ldaddal(Assembler::word, r8, r15, r15);         //       ldaddal w8, w15, [x15]
      +    __ ldbical(Assembler::word, r16, r4, r15);         //       ldclral w16, w4, [x15]
      +    __ ldeoral(Assembler::word, r30, r5, r0);          //       ldeoral w30, w5, [x0]
      +    __ ldorral(Assembler::word, r10, r22, r27);        //       ldsetal w10, w22, [x27]
      +    __ ldsminal(Assembler::word, r3, r0, r9);          //       ldsminal        w3, w0, [x9]
      +    __ ldsmaxal(Assembler::word, r19, r29, r10);       //       ldsmaxal        w19, w29, [x10]
      +    __ lduminal(Assembler::word, r24, r4, r20);        //       lduminal        w24, w4, [x20]
      +    __ ldumaxal(Assembler::word, r7, r24, r29);        //       ldumaxal        w7, w24, [x29]
       
       // LSEOp
      -    __ swpl(Assembler::word, r3, r0, r9);              //       swpl    w3, w0, [x9]
      -    __ ldaddl(Assembler::word, r19, r29, r10);         //       ldaddl  w19, w29, [x10]
      -    __ ldbicl(Assembler::word, r24, r4, r20);          //       ldclrl  w24, w4, [x20]
      -    __ ldeorl(Assembler::word, r7, r24, r29);          //       ldeorl  w7, w24, [x29]
      -    __ ldorrl(Assembler::word, r14, r21, r11);         //       ldsetl  w14, w21, [x11]
      -    __ ldsminl(Assembler::word, r27, r13, r15);        //       ldsminl w27, w13, [x15]
      -    __ ldsmaxl(Assembler::word, zr, r17, r14);         //       ldsmaxl wzr, w17, [x14]
      -    __ lduminl(Assembler::word, r3, r30, r16);         //       lduminl w3, w30, [x16]
      -    __ ldumaxl(Assembler::word, r22, r20, r7);         //       ldumaxl w22, w20, [x7]
      +    __ swpl(Assembler::word, r14, r21, r11);           //       swpl    w14, w21, [x11]
      +    __ ldaddl(Assembler::word, r27, r13, r15);         //       ldaddl  w27, w13, [x15]
      +    __ ldbicl(Assembler::word, zr, r17, r14);          //       ldclrl  wzr, w17, [x14]
      +    __ ldeorl(Assembler::word, r3, r30, r16);          //       ldeorl  w3, w30, [x16]
      +    __ ldorrl(Assembler::word, r22, r20, r7);          //       ldsetl  w22, w20, [x7]
      +    __ ldsminl(Assembler::word, r20, r3, r1);          //       ldsminl w20, w3, [x1]
      +    __ ldsmaxl(Assembler::word, r26, r19, r9);         //       ldsmaxl w26, w19, [x9]
      +    __ lduminl(Assembler::word, r16, r17, r21);        //       lduminl w16, w17, [x21]
      +    __ ldumaxl(Assembler::word, r0, r4, r2);           //       ldumaxl w0, w4, [x2]
       
       // SHA3SIMDOp
      -    __ bcax(v20, __ T16B, v3, v1, v26);                //       bcax            v20.16B, v3.16B, v1.16B, v26.16B
      -    __ eor3(v19, __ T16B, v9, v16, v17);               //       eor3            v19.16B, v9.16B, v16.16B, v17.16B
      -    __ rax1(v21, __ T2D, v0, v4);                      //       rax1            v21.2D, v0.2D, v4.2D
      -    __ xar(v2, __ T2D, v24, v14, 12);                  //       xar             v2.2D, v24.2D, v14.2D, #12
      +    __ bcax(v24, __ T16B, v14, v6, v11);               //       bcax            v24.16B, v14.16B, v6.16B, v11.16B
      +    __ eor3(v21, __ T16B, v14, v17, v30);              //       eor3            v21.16B, v14.16B, v17.16B, v30.16B
      +    __ rax1(v12, __ T2D, v3, v3);                      //       rax1            v12.2D, v3.2D, v3.2D
      +    __ xar(v23, __ T2D, v9, v3, 49);                   //       xar             v23.2D, v9.2D, v3.2D, #49
       
       // SHA512SIMDOp
      -    __ sha512h(v11, __ T2D, v21, v14);                 //       sha512h         q11, q21, v14.2D
      -    __ sha512h2(v17, __ T2D, v30, v12);                //       sha512h2                q17, q30, v12.2D
      -    __ sha512su0(v3, __ T2D, v3);                      //       sha512su0               v3.2D, v3.2D
      -    __ sha512su1(v23, __ T2D, v9, v3);                 //       sha512su1               v23.2D, v9.2D, v3.2D
      +    __ sha512h(v28, __ T2D, v3, v19);                  //       sha512h         q28, q3, v19.2D
      +    __ sha512h2(v23, __ T2D, v7, v26);                 //       sha512h2                q23, q7, v26.2D
      +    __ sha512su0(v21, __ T2D, v14);                    //       sha512su0               v21.2D, v14.2D
      +    __ sha512su1(v5, __ T2D, v8, v26);                 //       sha512su1               v5.2D, v8.2D, v26.2D
       
       // SVEBinaryImmOp
      -    __ sve_add(z24, __ D, 26u);                        //       add     z24.d, z24.d, #0x1a
      -    __ sve_sub(z19, __ S, 62u);                        //       sub     z19.s, z19.s, #0x3e
      -    __ sve_and(z26, __ S, 917504u);                    //       and     z26.s, z26.s, #0xe0000
      -    __ sve_eor(z8, __ D, 18442240474082197503u);       //       eor     z8.d, z8.d, #0xfff0000000003fff
      -    __ sve_orr(z18, __ S, 253952u);                    //       orr     z18.s, z18.s, #0x3e000
      +    __ sve_add(z5, __ S, 146u);                        //       add     z5.s, z5.s, #0x92
      +    __ sve_sub(z17, __ B, 31u);                        //       sub     z17.b, z17.b, #0x1f
      +    __ sve_and(z9, __ S, 16744448u);                   //       and     z9.s, z9.s, #0xff8000
      +    __ sve_eor(z12, __ H, 33279u);                     //       eor     z12.h, z12.h, #0x81ff
      +    __ sve_orr(z11, __ H, 49663u);                     //       orr     z11.h, z11.h, #0xc1ff
       
       // SVEBinaryImmOp
      -    __ sve_add(z9, __ S, 97u);                         //       add     z9.s, z9.s, #0x61
      -    __ sve_sub(z8, __ H, 118u);                        //       sub     z8.h, z8.h, #0x76
      -    __ sve_and(z19, __ S, 1056980736u);                //       and     z19.s, z19.s, #0x3f003f00
      -    __ sve_eor(z25, __ S, 3758350339u);                //       eor     z25.s, z25.s, #0xe003e003
      -    __ sve_orr(z9, __ S, 4294459391u);                 //       orr     z9.s, z9.s, #0xfff83fff
      +    __ sve_add(z31, __ S, 72u);                        //       add     z31.s, z31.s, #0x48
      +    __ sve_sub(z16, __ H, 218u);                       //       sub     z16.h, z16.h, #0xda
      +    __ sve_and(z23, __ D, 562675075514368u);           //       and     z23.d, z23.d, #0x1ffc000000000
      +    __ sve_eor(z8, __ B, 243u);                        //       eor     z8.b, z8.b, #0xf3
      +    __ sve_orr(z10, __ B, 239u);                       //       orr     z10.b, z10.b, #0xef
       
       // SVEBinaryImmOp
      -    __ sve_add(z23, __ D, 183u);                       //       add     z23.d, z23.d, #0xb7
      -    __ sve_sub(z8, __ H, 41u);                         //       sub     z8.h, z8.h, #0x29
      -    __ sve_and(z28, __ D, 8064u);                      //       and     z28.d, z28.d, #0x1f80
      -    __ sve_eor(z15, __ D, 18428729675200069887u);      //       eor     z15.d, z15.d, #0xffc00000000000ff
      -    __ sve_orr(z0, __ B, 239u);                        //       orr     z0.b, z0.b, #0xef
      +    __ sve_add(z22, __ S, 5u);                         //       add     z22.s, z22.s, #0x5
      +    __ sve_sub(z3, __ S, 209u);                        //       sub     z3.s, z3.s, #0xd1
      +    __ sve_and(z5, __ D, 17870287719452639231u);       //       and     z5.d, z5.d, #0xf80003ffffffffff
      +    __ sve_eor(z17, __ B, 128u);                       //       eor     z17.b, z17.b, #0x80
      +    __ sve_orr(z30, __ H, 49663u);                     //       orr     z30.h, z30.h, #0xc1ff
       
       // SVEBinaryImmOp
      -    __ sve_add(z5, __ D, 243u);                        //       add     z5.d, z5.d, #0xf3
      -    __ sve_sub(z19, __ S, 8u);                         //       sub     z19.s, z19.s, #0x8
      -    __ sve_and(z13, __ H, 32256u);                     //       and     z13.h, z13.h, #0x7e00
      -    __ sve_eor(z0, __ S, 4294967293u);                 //       eor     z0.s, z0.s, #0xfffffffd
      -    __ sve_orr(z21, __ S, 4294965263u);                //       orr     z21.s, z21.s, #0xfffff80f
      +    __ sve_add(z2, __ D, 168u);                        //       add     z2.d, z2.d, #0xa8
      +    __ sve_sub(z23, __ S, 240u);                       //       sub     z23.s, z23.s, #0xf0
      +    __ sve_and(z12, __ H, 1u);                         //       and     z12.h, z12.h, #0x1
      +    __ sve_eor(z15, __ S, 1u);                         //       eor     z15.s, z15.s, #0x1
      +    __ sve_orr(z19, __ D, 18446532967477018623u);      //       orr     z19.d, z19.d, #0xffff3fffffffffff
       
       // SVEBinaryImmOp
      -    __ sve_add(z12, __ H, 20u);                        //       add     z12.h, z12.h, #0x14
      -    __ sve_sub(z0, __ H, 190u);                        //       sub     z0.h, z0.h, #0xbe
      -    __ sve_and(z23, __ B, 239u);                       //       and     z23.b, z23.b, #0xef
      -    __ sve_eor(z27, __ D, 18442240474082197503u);      //       eor     z27.d, z27.d, #0xfff0000000003fff
      -    __ sve_orr(z22, __ B, 124u);                       //       orr     z22.b, z22.b, #0x7c
      +    __ sve_add(z13, __ S, 179u);                       //       add     z13.s, z13.s, #0xb3
      +    __ sve_sub(z2, __ B, 88u);                         //       sub     z2.b, z2.b, #0x58
      +    __ sve_and(z20, __ H, 57855u);                     //       and     z20.h, z20.h, #0xe1ff
      +    __ sve_eor(z24, __ H, 33279u);                     //       eor     z24.h, z24.h, #0x81ff
      +    __ sve_orr(z20, __ S, 917504u);                    //       orr     z20.s, z20.s, #0xe0000
       
       // SVEBinaryImmOp
      -    __ sve_add(z20, __ H, 165u);                       //       add     z20.h, z20.h, #0xa5
      -    __ sve_sub(z24, __ D, 72u);                        //       sub     z24.d, z24.d, #0x48
      -    __ sve_and(z31, __ S, 4026535935u);                //       and     z31.s, z31.s, #0xf0000fff
      -    __ sve_eor(z21, __ B, 128u);                       //       eor     z21.b, z21.b, #0x80
      -    __ sve_orr(z30, __ S, 4294967293u);                //       orr     z30.s, z30.s, #0xfffffffd
      +    __ sve_add(z21, __ H, 247u);                       //       add     z21.h, z21.h, #0xf7
      +    __ sve_sub(z22, __ D, 253u);                       //       sub     z22.d, z22.d, #0xfd
      +    __ sve_and(z26, __ S, 1610637312u);                //       and     z26.s, z26.s, #0x60006000
      +    __ sve_eor(z11, __ H, 51199u);                     //       eor     z11.h, z11.h, #0xc7ff
      +    __ sve_orr(z5, __ B, 128u);                        //       orr     z5.b, z5.b, #0x80
       
       // SVEVectorOp
      -    __ sve_add(z26, __ H, z18, z19);                   //       add     z26.h, z18.h, z19.h
      -    __ sve_sub(z11, __ S, z13, z29);                   //       sub     z11.s, z13.s, z29.s
      -    __ sve_fadd(z5, __ S, z1, z14);                    //       fadd    z5.s, z1.s, z14.s
      -    __ sve_fmul(z2, __ S, z7, z10);                    //       fmul    z2.s, z7.s, z10.s
      -    __ sve_fsub(z19, __ S, z4, z26);                   //       fsub    z19.s, z4.s, z26.s
      -    __ sve_sqadd(z2, __ B, z3, z30);                   //       sqadd   z2.b, z3.b, z30.b
      -    __ sve_sqsub(z20, __ D, z5, z20);                  //       sqsub   z20.d, z5.d, z20.d
      -    __ sve_uqadd(z29, __ H, z13, z13);                 //       uqadd   z29.h, z13.h, z13.h
      -    __ sve_uqsub(z14, __ H, z30, z1);                  //       uqsub   z14.h, z30.h, z1.h
      -    __ sve_abs(z28, __ D, p0, z3);                     //       abs     z28.d, p0/m, z3.d
      -    __ sve_add(z9, __ B, p6, z9);                      //       add     z9.b, p6/m, z9.b, z9.b
      -    __ sve_and(z26, __ B, p2, z14);                    //       and     z26.b, p2/m, z26.b, z14.b
      -    __ sve_asr(z20, __ D, p6, z7);                     //       asr     z20.d, p6/m, z20.d, z7.d
      -    __ sve_bic(z20, __ D, p4, z6);                     //       bic     z20.d, p4/m, z20.d, z6.d
      -    __ sve_clz(z13, __ H, p0, z29);                    //       clz     z13.h, p0/m, z29.h
      -    __ sve_cnt(z9, __ B, p0, z1);                      //       cnt     z9.b, p0/m, z1.b
      -    __ sve_eor(z27, __ B, p6, z15);                    //       eor     z27.b, p6/m, z27.b, z15.b
      -    __ sve_lsl(z4, __ D, p7, z17);                     //       lsl     z4.d, p7/m, z4.d, z17.d
      -    __ sve_lsr(z2, __ B, p0, z24);                     //       lsr     z2.b, p0/m, z2.b, z24.b
      -    __ sve_mul(z26, __ B, p7, z13);                    //       mul     z26.b, p7/m, z26.b, z13.b
      -    __ sve_neg(z22, __ D, p3, z16);                    //       neg     z22.d, p3/m, z16.d
      -    __ sve_not(z17, __ D, p1, z11);                    //       not     z17.d, p1/m, z11.d
      -    __ sve_orr(z16, __ B, p0, z16);                    //       orr     z16.b, p0/m, z16.b, z16.b
      -    __ sve_rbit(z28, __ D, p1, z23);                   //       rbit    z28.d, p1/m, z23.d
      -    __ sve_revb(z28, __ D, p4, z10);                   //       revb    z28.d, p4/m, z10.d
      -    __ sve_smax(z17, __ S, p7, z7);                    //       smax    z17.s, p7/m, z17.s, z7.s
      -    __ sve_smin(z4, __ H, p3, z24);                    //       smin    z4.h, p3/m, z4.h, z24.h
      -    __ sve_umax(z9, __ B, p2, z11);                    //       umax    z9.b, p2/m, z9.b, z11.b
      -    __ sve_umin(z4, __ S, p5, z22);                    //       umin    z4.s, p5/m, z4.s, z22.s
      -    __ sve_sub(z4, __ H, p0, z15);                     //       sub     z4.h, p0/m, z4.h, z15.h
      -    __ sve_fabs(z4, __ D, p7, z26);                    //       fabs    z4.d, p7/m, z26.d
      -    __ sve_fadd(z5, __ S, p5, z26);                    //       fadd    z5.s, p5/m, z5.s, z26.s
      -    __ sve_fdiv(z31, __ S, p0, z25);                   //       fdiv    z31.s, p0/m, z31.s, z25.s
      -    __ sve_fmax(z8, __ D, p1, z3);                     //       fmax    z8.d, p1/m, z8.d, z3.d
      -    __ sve_fmin(z7, __ D, p6, z24);                    //       fmin    z7.d, p6/m, z7.d, z24.d
      -    __ sve_fmul(z24, __ S, p7, z17);                   //       fmul    z24.s, p7/m, z24.s, z17.s
      -    __ sve_fneg(z10, __ S, p3, z30);                   //       fneg    z10.s, p3/m, z30.s
      -    __ sve_frintm(z8, __ S, p6, z29);                  //       frintm  z8.s, p6/m, z29.s
      -    __ sve_frintn(z31, __ D, p5, z31);                 //       frintn  z31.d, p5/m, z31.d
      -    __ sve_frintp(z0, __ D, p5, z7);                   //       frintp  z0.d, p5/m, z7.d
      -    __ sve_fsqrt(z29, __ S, p6, z22);                  //       fsqrt   z29.s, p6/m, z22.s
      -    __ sve_fsub(z29, __ S, p6, z20);                   //       fsub    z29.s, p6/m, z29.s, z20.s
      -    __ sve_fmad(z6, __ D, p4, z18, z13);               //       fmad    z6.d, p4/m, z18.d, z13.d
      -    __ sve_fmla(z21, __ S, p2, z0, z19);               //       fmla    z21.s, p2/m, z0.s, z19.s
      -    __ sve_fmls(z28, __ D, p1, z17, z6);               //       fmls    z28.d, p1/m, z17.d, z6.d
      -    __ sve_fmsb(z20, __ D, p6, z28, z14);              //       fmsb    z20.d, p6/m, z28.d, z14.d
      -    __ sve_fnmad(z14, __ S, p4, z10, z26);             //       fnmad   z14.s, p4/m, z10.s, z26.s
      -    __ sve_fnmsb(z24, __ D, p0, z11, z15);             //       fnmsb   z24.d, p0/m, z11.d, z15.d
      -    __ sve_fnmla(z23, __ D, p5, z20, z28);             //       fnmla   z23.d, p5/m, z20.d, z28.d
      -    __ sve_fnmls(z20, __ D, p7, z24, z0);              //       fnmls   z20.d, p7/m, z24.d, z0.d
      -    __ sve_mla(z6, __ B, p5, z13, z12);                //       mla     z6.b, p5/m, z13.b, z12.b
      -    __ sve_mls(z13, __ S, p7, z26, z23);               //       mls     z13.s, p7/m, z26.s, z23.s
      -    __ sve_and(z6, z2, z29);                           //       and     z6.d, z2.d, z29.d
      -    __ sve_eor(z0, z29, z23);                          //       eor     z0.d, z29.d, z23.d
      -    __ sve_orr(z4, z5, z8);                            //       orr     z4.d, z5.d, z8.d
      -    __ sve_bic(z13, z17, z13);                         //       bic     z13.d, z17.d, z13.d
      -    __ sve_uzp1(z8, __ H, z10, z8);                    //       uzp1    z8.h, z10.h, z8.h
      -    __ sve_uzp2(z19, __ S, z0, z29);                   //       uzp2    z19.s, z0.s, z29.s
      -    __ sve_fabd(z16, __ D, p3, z23);                   //       fabd    z16.d, p3/m, z16.d, z23.d
      -    __ sve_bext(z23, __ B, z30, z13);                  //       bext    z23.b, z30.b, z13.b
      -    __ sve_bdep(z25, __ H, z22, z0);                   //       bdep    z25.h, z22.h, z0.h
      -    __ sve_eor3(z25, z30, z11);                        //       eor3    z25.d, z25.d, z30.d, z11.d
      -    __ sve_sqadd(z14, __ H, p5, z22);                  //       sqadd   z14.h, p5/m, z14.h, z22.h
      -    __ sve_sqsub(z5, __ H, p4, z0);                    //       sqsub   z5.h, p4/m, z5.h, z0.h
      -    __ sve_uqadd(z9, __ D, p0, z3);                    //       uqadd   z9.d, p0/m, z9.d, z3.d
      -    __ sve_uqsub(z14, __ H, p1, z29);                  //       uqsub   z14.h, p1/m, z14.h, z29.h
      +    __ sve_add(z2, __ H, z7, z10);                     //       add     z2.h, z7.h, z10.h
      +    __ sve_sub(z19, __ H, z4, z26);                    //       sub     z19.h, z4.h, z26.h
      +    __ sve_fadd(z2, __ S, z3, z30);                    //       fadd    z2.s, z3.s, z30.s
      +    __ sve_fmul(z20, __ D, z5, z20);                   //       fmul    z20.d, z5.d, z20.d
      +    __ sve_fsub(z29, __ S, z13, z13);                  //       fsub    z29.s, z13.s, z13.s
      +    __ sve_sqadd(z14, __ H, z30, z1);                  //       sqadd   z14.h, z30.h, z1.h
      +    __ sve_sqsub(z28, __ D, z3, z3);                   //       sqsub   z28.d, z3.d, z3.d
      +    __ sve_uqadd(z9, __ B, z25, z9);                   //       uqadd   z9.b, z25.b, z9.b
      +    __ sve_uqsub(z26, __ B, z10, z14);                 //       uqsub   z26.b, z10.b, z14.b
      +    __ sve_abs(z20, __ D, p6, z7);                     //       abs     z20.d, p6/m, z7.d
      +    __ sve_add(z20, __ D, p4, z6);                     //       add     z20.d, p4/m, z20.d, z6.d
      +    __ sve_and(z13, __ H, p0, z29);                    //       and     z13.h, p0/m, z13.h, z29.h
      +    __ sve_asr(z9, __ B, p0, z1);                      //       asr     z9.b, p0/m, z9.b, z1.b
      +    __ sve_bic(z27, __ B, p6, z15);                    //       bic     z27.b, p6/m, z27.b, z15.b
      +    __ sve_clz(z4, __ D, p7, z17);                     //       clz     z4.d, p7/m, z17.d
      +    __ sve_cnt(z2, __ B, p0, z24);                     //       cnt     z2.b, p0/m, z24.b
      +    __ sve_eor(z26, __ B, p7, z13);                    //       eor     z26.b, p7/m, z26.b, z13.b
      +    __ sve_lsl(z22, __ D, p3, z16);                    //       lsl     z22.d, p3/m, z22.d, z16.d
      +    __ sve_lsr(z17, __ D, p1, z11);                    //       lsr     z17.d, p1/m, z17.d, z11.d
      +    __ sve_mul(z16, __ B, p0, z16);                    //       mul     z16.b, p0/m, z16.b, z16.b
      +    __ sve_neg(z28, __ D, p1, z23);                    //       neg     z28.d, p1/m, z23.d
      +    __ sve_not(z28, __ S, p4, z10);                    //       not     z28.s, p4/m, z10.s
      +    __ sve_orr(z17, __ S, p7, z7);                     //       orr     z17.s, p7/m, z17.s, z7.s
      +    __ sve_rbit(z4, __ H, p3, z24);                    //       rbit    z4.h, p3/m, z24.h
      +    __ sve_revb(z9, __ H, p2, z11);                    //       revb    z9.h, p2/m, z11.h
      +    __ sve_smax(z4, __ S, p5, z22);                    //       smax    z4.s, p5/m, z4.s, z22.s
      +    __ sve_smin(z4, __ H, p0, z15);                    //       smin    z4.h, p0/m, z4.h, z15.h
      +    __ sve_umax(z4, __ D, p7, z26);                    //       umax    z4.d, p7/m, z4.d, z26.d
      +    __ sve_umin(z5, __ H, p5, z26);                    //       umin    z5.h, p5/m, z5.h, z26.h
      +    __ sve_sub(z31, __ B, p0, z25);                    //       sub     z31.b, p0/m, z31.b, z25.b
      +    __ sve_fabs(z8, __ D, p1, z3);                     //       fabs    z8.d, p1/m, z3.d
      +    __ sve_fadd(z7, __ D, p6, z24);                    //       fadd    z7.d, p6/m, z7.d, z24.d
      +    __ sve_fdiv(z24, __ S, p7, z17);                   //       fdiv    z24.s, p7/m, z24.s, z17.s
      +    __ sve_fmax(z10, __ S, p3, z30);                   //       fmax    z10.s, p3/m, z10.s, z30.s
      +    __ sve_fmin(z8, __ S, p6, z29);                    //       fmin    z8.s, p6/m, z8.s, z29.s
      +    __ sve_fmul(z31, __ D, p5, z31);                   //       fmul    z31.d, p5/m, z31.d, z31.d
      +    __ sve_fneg(z0, __ D, p5, z7);                     //       fneg    z0.d, p5/m, z7.d
      +    __ sve_frintm(z29, __ S, p6, z22);                 //       frintm  z29.s, p6/m, z22.s
      +    __ sve_frintn(z29, __ S, p6, z20);                 //       frintn  z29.s, p6/m, z20.s
      +    __ sve_frintp(z6, __ S, p4, z18);                  //       frintp  z6.s, p4/m, z18.s
      +    __ sve_fsqrt(z26, __ S, p5, z8);                   //       fsqrt   z26.s, p5/m, z8.s
      +    __ sve_fsub(z19, __ S, p2, z28);                   //       fsub    z19.s, p2/m, z19.s, z28.s
      +    __ sve_fmad(z17, __ D, p1, z30, z20);              //       fmad    z17.d, p1/m, z30.d, z20.d
      +    __ sve_fmla(z28, __ D, p3, z17, z14);              //       fmla    z28.d, p3/m, z17.d, z14.d
      +    __ sve_fmls(z10, __ S, p6, z11, z24);              //       fmls    z10.s, p6/m, z11.s, z24.s
      +    __ sve_fmsb(z11, __ D, p3, z28, z23);              //       fmsb    z11.d, p3/m, z28.d, z23.d
      +    __ sve_fnmad(z20, __ D, p7, z23, z20);             //       fnmad   z20.d, p7/m, z23.d, z20.d
      +    __ sve_fnmsb(z24, __ D, p0, z27, z6);              //       fnmsb   z24.d, p0/m, z27.d, z6.d
      +    __ sve_fnmla(z13, __ D, p3, z4, z13);              //       fnmla   z13.d, p3/m, z4.d, z13.d
      +    __ sve_fnmls(z26, __ S, p5, z20, z6);              //       fnmls   z26.s, p5/m, z20.s, z6.s
      +    __ sve_mla(z29, __ S, p7, z0, z29);                //       mla     z29.s, p7/m, z0.s, z29.s
      +    __ sve_mls(z3, __ D, p1, z5, z8);                  //       mls     z3.d, p1/m, z5.d, z8.d
      +    __ sve_and(z13, z17, z13);                         //       and     z13.d, z17.d, z13.d
      +    __ sve_eor(z8, z10, z8);                           //       eor     z8.d, z10.d, z8.d
      +    __ sve_orr(z19, z0, z29);                          //       orr     z19.d, z0.d, z29.d
      +    __ sve_bic(z16, z13, z23);                         //       bic     z16.d, z13.d, z23.d
      +    __ sve_uzp1(z23, __ B, z30, z13);                  //       uzp1    z23.b, z30.b, z13.b
      +    __ sve_uzp2(z25, __ H, z22, z0);                   //       uzp2    z25.h, z22.h, z0.h
      +    __ sve_fabd(z25, __ S, p7, z11);                   //       fabd    z25.s, p7/m, z25.s, z11.s
      +    __ sve_bext(z14, __ H, z23, z22);                  //       bext    z14.h, z23.h, z22.h
      +    __ sve_bdep(z5, __ H, z18, z0);                    //       bdep    z5.h, z18.h, z0.h
      +    __ sve_eor3(z9, z2, z3);                           //       eor3    z9.d, z9.d, z2.d, z3.d
      +    __ sve_sqadd(z14, __ H, p1, z29);                  //       sqadd   z14.h, p1/m, z14.h, z29.h
      +    __ sve_sqsub(z14, __ D, p5, z4);                   //       sqsub   z14.d, p5/m, z14.d, z4.d
      +    __ sve_uqadd(z27, __ S, p3, z22);                  //       uqadd   z27.s, p3/m, z27.s, z22.s
      +    __ sve_uqsub(z31, __ S, p6, z11);                  //       uqsub   z31.s, p6/m, z31.s, z11.s
       
       // SVEReductionOp
      -    __ sve_andv(v14, __ D, p5, z4);                    //       andv d14, p5, z4.d
      -    __ sve_orv(v27, __ S, p3, z22);                    //       orv s27, p3, z22.s
      -    __ sve_eorv(v31, __ S, p6, z11);                   //       eorv s31, p6, z11.s
      -    __ sve_smaxv(v12, __ B, p4, z28);                  //       smaxv b12, p4, z28.b
      -    __ sve_sminv(v28, __ D, p4, z4);                   //       sminv d28, p4, z4.d
      -    __ sve_fminv(v6, __ D, p0, z15);                   //       fminv d6, p0, z15.d
      -    __ sve_fmaxv(v1, __ D, p5, z18);                   //       fmaxv d1, p5, z18.d
      -    __ sve_fadda(v2, __ S, p2, z4);                    //       fadda s2, p2, s2, z4.s
      -    __ sve_uaddv(v11, __ S, p2, z28);                  //       uaddv d11, p2, z28.s
      +    __ sve_andv(v12, __ B, p4, z28);                   //       andv b12, p4, z28.b
      +    __ sve_orv(v28, __ D, p4, z4);                     //       orv d28, p4, z4.d
      +    __ sve_eorv(v6, __ S, p0, z15);                    //       eorv s6, p0, z15.s
      +    __ sve_smaxv(v1, __ S, p5, z18);                   //       smaxv s1, p5, z18.s
      +    __ sve_sminv(v2, __ H, p2, z4);                    //       sminv h2, p2, z4.h
      +    __ sve_umaxv(v11, __ S, p2, z28);                  //       umaxv s11, p2, z28.s
      +    __ sve_uminv(v3, __ H, p5, z31);                   //       uminv h3, p5, z31.h
      +    __ sve_fminv(v24, __ S, p5, z15);                  //       fminv s24, p5, z15.s
      +    __ sve_fmaxv(v6, __ S, p3, z8);                    //       fmaxv s6, p3, z8.s
      +    __ sve_fadda(v21, __ D, p7, z4);                   //       fadda d21, p7, d21, z4.d
      +    __ sve_uaddv(v24, __ B, p5, z6);                   //       uaddv d24, p5, z6.b
       
       // AddWideNEONOp
      -    __ saddwv(v3, v4, __ T8H, v5, __ T8B);             //       saddw   v3.8H, v4.8H, v5.8B
      -    __ saddwv2(v21, v22, __ T8H, v23, __ T16B);        //       saddw2  v21.8H, v22.8H, v23.16B
      -    __ saddwv(v31, v0, __ T4S, v1, __ T4H);            //       saddw   v31.4S, v0.4S, v1.4H
      -    __ saddwv2(v11, v12, __ T4S, v13, __ T8H);         //       saddw2  v11.4S, v12.4S, v13.8H
      -    __ saddwv(v24, v25, __ T2D, v26, __ T2S);          //       saddw   v24.2D, v25.2D, v26.2S
      -    __ saddwv2(v21, v22, __ T2D, v23, __ T4S);         //       saddw2  v21.2D, v22.2D, v23.4S
      -    __ uaddwv(v15, v16, __ T8H, v17, __ T8B);          //       uaddw   v15.8H, v16.8H, v17.8B
      -    __ uaddwv2(v12, v13, __ T8H, v14, __ T16B);        //       uaddw2  v12.8H, v13.8H, v14.16B
      -    __ uaddwv(v6, v7, __ T4S, v8, __ T4H);             //       uaddw   v6.4S, v7.4S, v8.4H
      -    __ uaddwv2(v13, v14, __ T4S, v15, __ T8H);         //       uaddw2  v13.4S, v14.4S, v15.8H
      -    __ uaddwv(v8, v9, __ T2D, v10, __ T2S);            //       uaddw   v8.2D, v9.2D, v10.2S
      -    __ uaddwv2(v15, v16, __ T2D, v17, __ T4S);         //       uaddw2  v15.2D, v16.2D, v17.4S
      +    __ saddwv(v4, v5, __ T8H, v6, __ T8B);             //       saddw   v4.8H, v5.8H, v6.8B
      +    __ saddwv2(v10, v11, __ T8H, v12, __ T16B);        //       saddw2  v10.8H, v11.8H, v12.16B
      +    __ saddwv(v9, v10, __ T4S, v11, __ T4H);           //       saddw   v9.4S, v10.4S, v11.4H
      +    __ saddwv2(v25, v26, __ T4S, v27, __ T8H);         //       saddw2  v25.4S, v26.4S, v27.8H
      +    __ saddwv(v10, v11, __ T2D, v12, __ T2S);          //       saddw   v10.2D, v11.2D, v12.2S
      +    __ saddwv2(v5, v6, __ T2D, v7, __ T4S);            //       saddw2  v5.2D, v6.2D, v7.4S
      +    __ uaddwv(v31, v0, __ T8H, v1, __ T8B);            //       uaddw   v31.8H, v0.8H, v1.8B
      +    __ uaddwv2(v22, v23, __ T8H, v24, __ T16B);        //       uaddw2  v22.8H, v23.8H, v24.16B
      +    __ uaddwv(v25, v26, __ T4S, v27, __ T4H);          //       uaddw   v25.4S, v26.4S, v27.4H
      +    __ uaddwv2(v15, v16, __ T4S, v17, __ T8H);         //       uaddw2  v15.4S, v16.4S, v17.8H
      +    __ uaddwv(v3, v4, __ T2D, v5, __ T2S);             //       uaddw   v3.2D, v4.2D, v5.2S
      +    __ uaddwv2(v18, v19, __ T2D, v20, __ T4S);         //       uaddw2  v18.2D, v19.2D, v20.4S
       
           __ bind(forth);
       
      @@ -1449,30 +1463,30 @@
           0x9101a1a0,     0xb10a5cc8,     0xd10810aa,     0xf10fd061,
           0x120cb166,     0x321764bc,     0x52174681,     0x720c0227,
           0x9241018e,     0xb25a2969,     0xd278b411,     0xf26aad01,
      -    0x14000000,     0x17ffffd7,     0x140004bb,     0x94000000,
      -    0x97ffffd4,     0x940004b8,     0x3400000a,     0x34fffa2a,
      -    0x340096aa,     0x35000008,     0x35fff9c8,     0x35009648,
      -    0xb400000b,     0xb4fff96b,     0xb40095eb,     0xb500001d,
      -    0xb5fff91d,     0xb500959d,     0x10000013,     0x10fff8b3,
      -    0x10009533,     0x90000013,     0x36300016,     0x3637f836,
      -    0x363094b6,     0x3758000c,     0x375ff7cc,     0x3758944c,
      +    0x14000000,     0x17ffffd7,     0x140004c9,     0x94000000,
      +    0x97ffffd4,     0x940004c6,     0x3400000a,     0x34fffa2a,
      +    0x3400986a,     0x35000008,     0x35fff9c8,     0x35009808,
      +    0xb400000b,     0xb4fff96b,     0xb40097ab,     0xb500001d,
      +    0xb5fff91d,     0xb500975d,     0x10000013,     0x10fff8b3,
      +    0x100096f3,     0x90000013,     0x36300016,     0x3637f836,
      +    0x36309676,     0x3758000c,     0x375ff7cc,     0x3758960c,
           0x128313a0,     0x528a32c7,     0x7289173b,     0x92ab3acc,
           0xd2a0bf94,     0xf2c285e8,     0x9358722f,     0x330e652f,
           0x53067f3b,     0x93577c53,     0xb34a1aac,     0xd35a4016,
           0x13946c63,     0x93c3dbc8,     0x54000000,     0x54fff5a0,
      -    0x54009220,     0x54000001,     0x54fff541,     0x540091c1,
      -    0x54000002,     0x54fff4e2,     0x54009162,     0x54000002,
      -    0x54fff482,     0x54009102,     0x54000003,     0x54fff423,
      -    0x540090a3,     0x54000003,     0x54fff3c3,     0x54009043,
      -    0x54000004,     0x54fff364,     0x54008fe4,     0x54000005,
      -    0x54fff305,     0x54008f85,     0x54000006,     0x54fff2a6,
      -    0x54008f26,     0x54000007,     0x54fff247,     0x54008ec7,
      -    0x54000008,     0x54fff1e8,     0x54008e68,     0x54000009,
      -    0x54fff189,     0x54008e09,     0x5400000a,     0x54fff12a,
      -    0x54008daa,     0x5400000b,     0x54fff0cb,     0x54008d4b,
      -    0x5400000c,     0x54fff06c,     0x54008cec,     0x5400000d,
      -    0x54fff00d,     0x54008c8d,     0x5400000e,     0x54ffefae,
      -    0x54008c2e,     0x5400000f,     0x54ffef4f,     0x54008bcf,
      +    0x540093e0,     0x54000001,     0x54fff541,     0x54009381,
      +    0x54000002,     0x54fff4e2,     0x54009322,     0x54000002,
      +    0x54fff482,     0x540092c2,     0x54000003,     0x54fff423,
      +    0x54009263,     0x54000003,     0x54fff3c3,     0x54009203,
      +    0x54000004,     0x54fff364,     0x540091a4,     0x54000005,
      +    0x54fff305,     0x54009145,     0x54000006,     0x54fff2a6,
      +    0x540090e6,     0x54000007,     0x54fff247,     0x54009087,
      +    0x54000008,     0x54fff1e8,     0x54009028,     0x54000009,
      +    0x54fff189,     0x54008fc9,     0x5400000a,     0x54fff12a,
      +    0x54008f6a,     0x5400000b,     0x54fff0cb,     0x54008f0b,
      +    0x5400000c,     0x54fff06c,     0x54008eac,     0x5400000d,
      +    0x54fff00d,     0x54008e4d,     0x5400000e,     0x54ffefae,
      +    0x54008dee,     0x5400000f,     0x54ffef4f,     0x54008d8f,
           0xd40658e1,     0xd4014d22,     0xd4046543,     0xd4273f60,
           0xd44cad80,     0xd503201f,     0xd503203f,     0xd503205f,
           0xd503209f,     0xd50320bf,     0xd503219f,     0xd50323bf,
      @@ -1613,30 +1627,33 @@
           0x0eb26e30,     0x4eae6dac,     0x2e2d6d8b,     0x6e2b6d49,
           0x2e686ce6,     0x6e606ffe,     0x2eb36e51,     0x6ebd6f9b,
           0x0e3eafbc,     0x4e20affe,     0x0e69ad07,     0x4e6cad6a,
      -    0x0eb6aeb4,     0x4eacad6a,     0x0e66b4a4,     0x4e7ab738,
      -    0x0eb3b651,     0x4eb3b651,     0x0e3826f6,     0x4e252483,
      -    0x0e7f27dd,     0x4e71260f,     0x0eb826f6,     0x4eb52693,
      -    0x0eb5f693,     0x4eb8f6f6,     0x4ee4f462,     0x0ed1360f,
      -    0x4ec834e6,     0x2eaeedac,     0x6eb2ee30,     0x6eeded8b,
      -    0x2ecf2dcd,     0x6ed92f17,     0x0f81100f,     0x4f848862,
      -    0x4fc31841,     0x0fad518b,     0x4fa780c5,     0x4fd059ee,
      -    0x2fa890e6,     0x4fa38841,     0x6fc1900f,     0x0f7b8149,
      -    0x4f4688a4,     0x0faf81cd,     0x4fa58083,     0x0e3736d5,
      -    0x4e393717,     0x0e61341f,     0x4e7b3759,     0x0ea43462,
      -    0x4ea1341f,     0x4efd379b,     0x0e343e72,     0x4e2c3d6a,
      -    0x0e793f17,     0x4e753e93,     0x0ea53c83,     0x4eb43e72,
      -    0x4ee23c20,     0x2e3b8f59,     0x6e3c8f7a,     0x2e798f17,
      -    0x6e648c62,     0x2eb48e72,     0x6eae8dac,     0x6ee68ca4,
      -    0x2e3e37bc,     0x6e2037fe,     0x2e7f37dd,     0x6e723630,
      -    0x2ebd379b,     0x6ea834e6,     0x6eeb3549,     0x2e3f3fdd,
      -    0x6e343e72,     0x2e693d07,     0x6e663ca4,     0x2ea93d07,
      -    0x6eb13e0f,     0x6eeb3d49,     0x0e39e717,     0x4e2ae528,
      -    0x4e64e462,     0x2ebee7bc,     0x6eb7e6d5,     0x6ee1e41f,
      -    0x2e27e4c5,     0x6e3de79b,     0x6e62e420,     0x659239e8,
      -    0x65d03b94,     0x65d0232d,     0x65d120c2,     0x659129f2,
      -    0x65933ca3,     0x25969683,     0x25961d15,     0x254d1c48,
      -    0x259e3f61,     0x25953b96,     0x255b91d1,     0x247686ed,
      -    0x24309098,     0x2462edb9,     0x24a57468,     0xba5fd3e3,
      +    0x0eb6aeb4,     0x4eacad6a,     0x2e26aca4,     0x6e3aaf38,
      +    0x2e73ae51,     0x6e73ae51,     0x2eb8aef6,     0x6ea5ac83,
      +    0x2e3fa7dd,     0x6e31a60f,     0x2e78a6f6,     0x6e75a693,
      +    0x2eb5a693,     0x6eb8a6f6,     0x0e64b462,     0x4e71b60f,
      +    0x0ea8b4e6,     0x4eaeb5ac,     0x0e322630,     0x4e2d258b,
      +    0x0e6f25cd,     0x4e792717,     0x0ea32441,     0x4ea027fe,
      +    0x0eb5f693,     0x4ea7f4c5,     0x4ef3f651,     0x0ec43462,
      +    0x4ed23630,     0x2eb8eef6,     0x6eafedcd,     0x6eeced6a,
      +    0x2ed72ed5,     0x6edf2fdd,     0x0fa810e6,     0x4fa38841,
      +    0x4fc1100f,     0x0fab5149,     0x4f8688a4,     0x4fcf59cd,
      +    0x2f859083,     0x4f8d898b,     0x6fce99ac,     0x0f41800f,
      +    0x4f6b8949,     0x0f8d818b,     0x4f838841,     0x0e343672,
      +    0x4e223420,     0x0e7b3759,     0x4e7c377a,     0x0eb93717,
      +    0x4ea43462,     0x4ef43672,     0x0e2e3dac,     0x4e263ca4,
      +    0x0e7e3fbc,     0x4e603ffe,     0x0ebf3fdd,     0x4eb23e30,
      +    0x4efd3f9b,     0x2e288ce6,     0x6e2b8d49,     0x2e7f8fdd,
      +    0x6e748e72,     0x2ea98d07,     0x6ea68ca4,     0x6ee98d07,
      +    0x2e31360f,     0x6e2b3549,     0x2e793717,     0x6e6a3528,
      +    0x2ea43462,     0x6ebe37bc,     0x6ef736d5,     0x2e213c1f,
      +    0x6e273cc5,     0x2e7d3f9b,     0x6e623c20,     0x2eb33e51,
      +    0x6eb13e0f,     0x6ee63ca4,     0x0e3ce77a,     0x4e2ae528,
      +    0x4e7ee7bc,     0x2eb8e6f6,     0x6ebde79b,     0x6efde79b,
      +    0x2e3be759,     0x6e39e717,     0x6e62e420,     0x65d220c2,
      +    0x659029f2,     0x65903ca3,     0x65d13683,     0x65913173,
      +    0x65d320cf,     0x25cb83c6,     0x254c0fbb,     0x251e0308,
      +    0x25473a05,     0x25943096,     0x259d9270,     0x2423d187,
      +    0x242786fa,     0x24f0f1b9,     0x24e42043,     0xba5fd3e3,
           0x3a5f03e5,     0xfa411be4,     0x7a42cbe2,     0x93df03ff,
           0xc820ffff,     0x8822fc7f,     0xc8247cbf,     0x88267fff,
           0x4e010fe0,     0x5e040420,     0x4e081fe1,     0x4e0c1fe1,
      @@ -1703,55 +1720,55 @@
           0x1e741000,     0x1e743000,     0x1e761000,     0x1e763000,
           0x1e781000,     0x1e783000,     0x1e7a1000,     0x1e7a3000,
           0x1e7c1000,     0x1e7c3000,     0x1e7e1000,     0x1e7e3000,
      -    0xf8268267,     0xf82d023c,     0xf8301046,     0xf83d2083,
      -    0xf8263290,     0xf82d528c,     0xf8284299,     0xf8337160,
      -    0xf8386286,     0xf8bf820e,     0xf8a600e0,     0xf8af1353,
      -    0xf8a922ea,     0xf8b53396,     0xf8a251e3,     0xf8b340f4,
      -    0xf8a470fd,     0xf8a06209,     0xf8f48097,     0xf8f002ea,
      -    0xf8eb10d9,     0xf8ff21b0,     0xf8f7302c,     0xf8ee52a9,
      -    0xf8f041fa,     0xf8e471e4,     0xf8e863c6,     0xf864823d,
      -    0xf87d013a,     0xf86f1162,     0xf87d20e3,     0xf86132bb,
      -    0xf870510e,     0xf8704336,     0xf86572b4,     0xf8706217,
      -    0xb83e8294,     0xb8200264,     0xb8381284,     0xb8242358,
      -    0xb8333102,     0xb828530e,     0xb83042df,     0xb824703f,
      -    0xb82a6194,     0xb8a080e9,     0xb8b80090,     0xb8bb1146,
      -    0xb8bb21b8,     0xb8b032df,     0xb8b653f4,     0xb8bd41c9,
      -    0xb8b47287,     0xb8bc6169,     0xb8ee828c,     0xb8e10138,
      -    0xb8f3126d,     0xb8f020b0,     0xb8e03183,     0xb8e851ef,
      -    0xb8f041e4,     0xb8fe7005,     0xb8ea6376,     0xb8638120,
      -    0xb873015d,     0xb8781284,     0xb86723b8,     0xb86e3175,
      -    0xb87b51ed,     0xb87f41d1,     0xb863721e,     0xb87660f4,
      -    0xce216874,     0xce104533,     0xce648c15,     0xce8e3302,
      -    0xce6e82ab,     0xce6c87d1,     0xcec08063,     0xce638937,
      -    0x25e0c358,     0x25a1c7d3,     0x0580785a,     0x05426328,
      -    0x05009892,     0x25a0cc29,     0x2561cec8,     0x058044b3,
      -    0x05401c99,     0x05006b49,     0x25e0d6f7,     0x2561c528,
      -    0x0583c8bc,     0x0542522f,     0x05001ec0,     0x25e0de65,
      -    0x25a1c113,     0x05803cad,     0x0540f3c0,     0x0500ab15,
      -    0x2560c28c,     0x2561d7c0,     0x05801ed7,     0x0542633b,
      -    0x05003696,     0x2560d4b4,     0x25e1c918,     0x058021ff,
      -    0x05400e15,     0x0500f3de,     0x0473025a,     0x04bd05ab,
      -    0x658e0025,     0x658a08e2,     0x659a0493,     0x043e1062,
      -    0x04f418b4,     0x046d15bd,     0x04611fce,     0x04d6a07c,
      -    0x04001929,     0x041a09da,     0x04d098f4,     0x04db10d4,
      -    0x0459a3ad,     0x041aa029,     0x041919fb,     0x04d39e24,
      -    0x04118302,     0x04101dba,     0x04d7ae16,     0x04dea571,
      -    0x04180210,     0x05e786fc,     0x05e4915c,     0x04881cf1,
      -    0x044a0f04,     0x04090969,     0x048b16c4,     0x044101e4,
      -    0x04dcbf44,     0x65809745,     0x658d833f,     0x65c68468,
      -    0x65c79b07,     0x65829e38,     0x049dafca,     0x6582bba8,
      -    0x65c0b7ff,     0x65c1b4e0,     0x658dbadd,     0x65819a9d,
      -    0x65ed9246,     0x65b30815,     0x65e6263c,     0x65eebb94,
      -    0x65bad14e,     0x65efe178,     0x65fc5697,     0x65e07f14,
      -    0x040c55a6,     0x04977f4d,     0x043d3046,     0x04b733a0,
      -    0x046830a4,     0x04ed322d,     0x05686948,     0x05bd6c13,
      -    0x65c88ef0,     0x450db3d7,     0x4540b6d9,     0x043e3979,
      -    0x445896ce,     0x445a9005,     0x44d98069,     0x445b87ae,
      -    0x04da348e,     0x04982edb,     0x0499397f,     0x0408338c,
      -    0x04ca309c,     0x65c721e6,     0x65c63641,     0x65982882,
      -    0x04812b8b,     0x0e251083,     0x4e3712d5,     0x0e61101f,
      -    0x4e6d118b,     0x0eba1338,     0x4eb712d5,     0x2e31120f,
      -    0x6e2e11ac,     0x2e6810e6,     0x6e6f11cd,     0x2eaa1128,
      -    0x6eb1120f,
      +    0xf8268290,     0xf82d028c,     0xf8281299,     0xf8332160,
      +    0xf8383286,     0xf83f520e,     0xf82640e0,     0xf82f7353,
      +    0xf82962ea,     0xf8b58396,     0xf8a201e3,     0xf8b310f4,
      +    0xf8a420fd,     0xf8a03209,     0xf8b45097,     0xf8b042ea,
      +    0xf8ab70d9,     0xf8bf61b0,     0xf8f7802c,     0xf8ee02a9,
      +    0xf8f011fa,     0xf8e421e4,     0xf8e833c6,     0xf8e4523d,
      +    0xf8fd413a,     0xf8ef7162,     0xf8fd60e3,     0xf86182bb,
      +    0xf870010e,     0xf8701336,     0xf86522b4,     0xf8703217,
      +    0xf87e5294,     0xf8604264,     0xf8787284,     0xf8646358,
      +    0xb8338102,     0xb828030e,     0xb83012df,     0xb824203f,
      +    0xb82a3194,     0xb82050e9,     0xb8384090,     0xb83b7146,
      +    0xb83b61b8,     0xb8b082df,     0xb8b603f4,     0xb8bd11c9,
      +    0xb8b42287,     0xb8bc3169,     0xb8ae528c,     0xb8a14138,
      +    0xb8b3726d,     0xb8b060b0,     0xb8e08183,     0xb8e801ef,
      +    0xb8f011e4,     0xb8fe2005,     0xb8ea3376,     0xb8e35120,
      +    0xb8f3415d,     0xb8f87284,     0xb8e763b8,     0xb86e8175,
      +    0xb87b01ed,     0xb87f11d1,     0xb863221e,     0xb87630f4,
      +    0xb8745023,     0xb87a4133,     0xb87072b1,     0xb8606044,
      +    0xce262dd8,     0xce1179d5,     0xce638c6c,     0xce83c537,
      +    0xce73807c,     0xce7a84f7,     0xcec081d5,     0xce7a8905,
      +    0x25a0d245,     0x2521c3f1,     0x05808909,     0x05400d2c,
      +    0x0500154b,     0x25a0c91f,     0x2561db50,     0x0582d157,
      +    0x054026a8,     0x05001eca,     0x25a0c0b6,     0x25a1da23,
      +    0x05822dc5,     0x05400e11,     0x0500155e,     0x25e0d502,
      +    0x25a1de17,     0x0580040c,     0x0540000f,     0x050287b3,
      +    0x25a0d66d,     0x2521cb02,     0x05801d74,     0x05400d38,
      +    0x05007854,     0x2560def5,     0x25e1dfb6,     0x05801c3a,
      +    0x0540158b,     0x05000e05,     0x046a00e2,     0x047a0493,
      +    0x659e0062,     0x65d408b4,     0x658d05bd,     0x046113ce,
      +    0x04e3187c,     0x04291729,     0x042e1d5a,     0x04d6b8f4,
      +    0x04c010d4,     0x045a03ad,     0x04108029,     0x041b19fb,
      +    0x04d9be24,     0x041aa302,     0x04191dba,     0x04d38e16,
      +    0x04d18571,     0x04100210,     0x04d7a6fc,     0x049eb15c,
      +    0x04981cf1,     0x05678f04,     0x05648969,     0x048816c4,
      +    0x044a01e4,     0x04c91f44,     0x044b1745,     0x0401033f,
      +    0x04dca468,     0x65c09b07,     0x658d9e38,     0x65868fca,
      +    0x65879ba8,     0x65c297ff,     0x04ddb4e0,     0x6582badd,
      +    0x6580ba9d,     0x6581b246,     0x658db51a,     0x65818b93,
      +    0x65f487d1,     0x65ee0e3c,     0x65b8396a,     0x65f7af8b,
      +    0x65f4def4,     0x65e6e378,     0x65ed4c8d,     0x65a6769a,
      +    0x049d5c1d,     0x04c864a3,     0x042d322d,     0x04a83148,
      +    0x047d3013,     0x04f731b0,     0x052d6bd7,     0x05606ed9,
      +    0x65889d79,     0x4556b2ee,     0x4540b645,     0x04223869,
      +    0x445887ae,     0x44da948e,     0x44998edb,     0x449b997f,
      +    0x041a338c,     0x04d8309c,     0x049921e6,     0x04883641,
      +    0x044a2882,     0x04892b8b,     0x044b37e3,     0x658735f8,
      +    0x65862d06,     0x65d83c95,     0x040134d8,     0x0e2610a4,
      +    0x4e2c116a,     0x0e6b1149,     0x4e7b1359,     0x0eac116a,
      +    0x4ea710c5,     0x2e21101f,     0x6e3812f6,     0x2e7b1359,
      +    0x6e71120f,     0x2ea51083,     0x6eb41272,
         };
       // END  Generated code -- do not edit
      diff --git a/test/hotspot/gtest/cds/test_archiveWorkers.cpp b/test/hotspot/gtest/cds/test_archiveWorkers.cpp
      index 55c3528f0c2..87e55b80b94 100644
      --- a/test/hotspot/gtest/cds/test_archiveWorkers.cpp
      +++ b/test/hotspot/gtest/cds/test_archiveWorkers.cpp
      @@ -1,4 +1,5 @@
       /*
      + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
        * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
      @@ -23,20 +24,21 @@
        */
       
       #include "cds/archiveUtils.hpp"
      +#include "runtime/atomic.hpp"
       #include "unittest.hpp"
       
       class TestArchiveWorkerTask : public ArchiveWorkerTask {
       private:
      -  volatile int _sum;
      -  int _max;
      +  Atomic _sum;
      +  Atomic _max;
       public:
         TestArchiveWorkerTask() : ArchiveWorkerTask("Test"), _sum(0), _max(0) {}
         void work(int chunk, int max_chunks) override {
      -    AtomicAccess::add(&_sum, chunk);
      -    AtomicAccess::store(&_max, max_chunks);
      +    _sum.add_then_fetch(chunk);
      +    _max.store_relaxed(max_chunks);
         }
      -  int sum() { return AtomicAccess::load(&_sum); }
      -  int max() { return AtomicAccess::load(&_max); }
      +  int sum() { return _sum.load_relaxed(); }
      +  int max() { return _max.load_relaxed(); }
       };
       
       // Test a repeated cycle of workers init/shutdown without task works.
      diff --git a/test/hotspot/gtest/gc/g1/test_g1BatchedGangTask.cpp b/test/hotspot/gtest/gc/g1/test_g1BatchedGangTask.cpp
      index 902406eaf65..08df547585a 100644
      --- a/test/hotspot/gtest/gc/g1/test_g1BatchedGangTask.cpp
      +++ b/test/hotspot/gtest/gc/g1/test_g1BatchedGangTask.cpp
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2021, 2025, 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,9 +22,10 @@
        *
        */
       
      +#include "cppstdlib/new.hpp"
       #include "gc/g1/g1BatchedTask.hpp"
       #include "gc/shared/workerThread.hpp"
      -#include "runtime/atomicAccess.hpp"
      +#include "runtime/atomic.hpp"
       #include "unittest.hpp"
       
       class G1BatchedTaskWorkers : AllStatic {
      @@ -49,26 +50,26 @@ WorkerThreads* G1BatchedTaskWorkers::_workers = nullptr;
       
       class G1TestSubTask : public G1AbstractSubTask {
         mutable uint _phase;
      -  volatile uint _num_do_work; // Amount of do_work() has been called.
      +  Atomic _num_do_work; // Amount of do_work() has been called.
       
         void check_and_inc_phase(uint expected) const {
           ASSERT_EQ(_phase, expected);
           _phase++;
         }
       
      -  bool volatile* _do_work_called_by;
      +  Atomic* _do_work_called_by;
       
       protected:
         uint _max_workers;
       
         void do_work_called(uint worker_id) {
      -    AtomicAccess::inc(&_num_do_work);
      -    bool orig_value = AtomicAccess::cmpxchg(&_do_work_called_by[worker_id], false, true);
      +    _num_do_work.add_then_fetch(1u);
      +    bool orig_value = _do_work_called_by[worker_id].compare_exchange(false, true);
           ASSERT_EQ(orig_value, false);
         }
       
         void verify_do_work_called_by(uint num_workers) {
      -    ASSERT_EQ(AtomicAccess::load(&_num_do_work), num_workers);
      +    ASSERT_EQ(_num_do_work.load_relaxed(), num_workers);
           // Do not need to check the _do_work_called_by array. The count is already verified
           // by above statement, and we already check that a given flag is only set once.
         }
      @@ -86,7 +87,7 @@ public:
       
         ~G1TestSubTask() {
           check_and_inc_phase(3);
      -    FREE_C_HEAP_ARRAY(bool, _do_work_called_by);
      +    FREE_C_HEAP_ARRAY(Atomic, _do_work_called_by);
         }
       
         double worker_cost() const override {
      @@ -100,9 +101,9 @@ public:
           assert(max_workers >= 1, "must be");
           check_and_inc_phase(2);
       
      -    _do_work_called_by = NEW_C_HEAP_ARRAY(bool, max_workers, mtInternal);
      +    _do_work_called_by = NEW_C_HEAP_ARRAY(Atomic, max_workers, mtInternal);
           for (uint i = 0; i < max_workers; i++) {
      -      _do_work_called_by[i] = false;
      +      ::new (&_do_work_called_by[i]) Atomic{false};
           }
           _max_workers = max_workers;
         }
      diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp
      index 70a70dc069f..c2de96bea4f 100644
      --- a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp
      +++ b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2021, 2025, 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
      @@ -30,6 +30,7 @@
       #include "gc/shared/workerThread.hpp"
       #include "logging/log.hpp"
       #include "memory/allocation.hpp"
      +#include "runtime/atomic.hpp"
       #include "unittest.hpp"
       #include "utilities/powerOfTwo.hpp"
       
      @@ -385,8 +386,8 @@ void G1CardSetTest::cardset_basic_test() {
       class G1CardSetMtTestTask : public WorkerTask {
         G1CardSet* _card_set;
       
      -  size_t _added;
      -  size_t _found;
      +  Atomic _added;
      +  Atomic _found;
       
       public:
         G1CardSetMtTestTask(G1CardSet* card_set) :
      @@ -413,12 +414,12 @@ public:
               found++;
             }
           }
      -    AtomicAccess::add(&_added, added);
      -    AtomicAccess::add(&_found, found);
      +    _added.add_then_fetch(added);
      +    _found.add_then_fetch(found);
         }
       
      -  size_t added() const { return _added; }
      -  size_t found() const { return _found; }
      +  size_t added() const { return _added.load_relaxed(); }
      +  size_t found() const { return _found.load_relaxed(); }
       };
       
       void G1CardSetTest::cardset_mt_test() {
      diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp
      index d83d8ffeef6..91951b35405 100644
      --- a/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp
      +++ b/test/hotspot/gtest/gc/g1/test_g1CardSetContainers.cpp
      @@ -25,6 +25,7 @@
       #include "gc/g1/g1HeapRegionBounds.inline.hpp"
       #include "gc/shared/cardTable.hpp"
       #include "memory/allocation.inline.hpp"
      +#include "runtime/atomic.hpp"
       #include "utilities/globalDefinitions.hpp"
       #include "utilities/powerOfTwo.hpp"
       #include "unittest.hpp"
      @@ -82,48 +83,48 @@ void G1CardSetContainersTest::cardset_inlineptr_test(uint bits_per_card) {
       
         G1AddCardResult res;
       
      -  G1CardSet::ContainerPtr value = G1CardSetInlinePtr();
      +  Atomic value{};
       
         for (uint i = 0; i < CardsPerSet; i++) {
           {
      -      G1CardSetInlinePtr cards(&value, value);
      +      G1CardSetInlinePtr cards(&value, value.load_relaxed());
             res = cards.add(i + 1, bits_per_card, CardsPerSet);
             ASSERT_TRUE(res == Added);
           }
           {
      -      G1CardSetInlinePtr cards(&value, value);
      +      G1CardSetInlinePtr cards(&value, value.load_relaxed());
             ASSERT_TRUE(cards.contains(i + 1, bits_per_card));
           }
         }
       
         for (uint i = 0; i < CardsPerSet; i++) {
      -    G1CardSetInlinePtr cards(value);
      +    G1CardSetInlinePtr cards(value.load_relaxed());
           ASSERT_TRUE(cards.contains(i + 1, bits_per_card));
         }
       
         // Try to add again, should all return that the card had been added.
         for (uint i = 0; i < CardsPerSet; i++) {
      -    G1CardSetInlinePtr cards(&value, value);
      +    G1CardSetInlinePtr cards(&value, value.load_relaxed());
           res = cards.add(i + 1, bits_per_card, CardsPerSet);
           ASSERT_TRUE(res == Found);
         }
       
         // Should be no more space in set.
         {
      -    G1CardSetInlinePtr cards(&value, value);
      +    G1CardSetInlinePtr cards(&value, value.load_relaxed());
           res = cards.add(CardsPerSet + 1, bits_per_card, CardsPerSet);
           ASSERT_TRUE(res == Overflow);
         }
       
         // Cards should still be in the set.
         for (uint i = 0; i < CardsPerSet; i++) {
      -    G1CardSetInlinePtr cards(value);
      +    G1CardSetInlinePtr cards(value.load_relaxed());
           ASSERT_TRUE(cards.contains(i + 1, bits_per_card));
         }
       
         // Boundary cards should not be in the set.
         {
      -    G1CardSetInlinePtr cards(value);
      +    G1CardSetInlinePtr cards(value.load_relaxed());
           ASSERT_TRUE(!cards.contains(0, bits_per_card));
           ASSERT_TRUE(!cards.contains(CardsPerSet + 1, bits_per_card));
         }
      @@ -131,7 +132,7 @@ void G1CardSetContainersTest::cardset_inlineptr_test(uint bits_per_card) {
         // Verify iteration finds all cards too and only those.
         {
           G1FindCardsInRange found(1, CardsPerSet);
      -    G1CardSetInlinePtr cards(value);
      +    G1CardSetInlinePtr cards(value.load_relaxed());
           cards.iterate(found, bits_per_card);
           found.verify_all_found();
         }
      diff --git a/test/hotspot/gtest/gc/g1/test_heapRegion.cpp b/test/hotspot/gtest/gc/g1/test_heapRegion.cpp
      index ec7722ad384..8dc609ca69e 100644
      --- a/test/hotspot/gtest/gc/g1/test_heapRegion.cpp
      +++ b/test/hotspot/gtest/gc/g1/test_heapRegion.cpp
      @@ -79,7 +79,6 @@ void VM_HeapRegionApplyToMarkedObjectsTest::doit() {
         bitmap->par_mark(region->bottom() + MARK_OFFSET_1);
         bitmap->par_mark(region->bottom() + MARK_OFFSET_2);
         bitmap->par_mark(region->bottom() + MARK_OFFSET_3);
      -  bitmap->par_mark(region->end());
       
         VerifyAndCountMarkClosure cl(bitmap);
       
      diff --git a/test/hotspot/gtest/gc/g1/test_stressCommitUncommit.cpp b/test/hotspot/gtest/gc/g1/test_stressCommitUncommit.cpp
      index 6b3e9fd50bc..ce6a4f8819e 100644
      --- a/test/hotspot/gtest/gc/g1/test_stressCommitUncommit.cpp
      +++ b/test/hotspot/gtest/gc/g1/test_stressCommitUncommit.cpp
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2020, 2025, 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
      @@ -26,7 +26,7 @@
       #include "gc/g1/g1RegionToSpaceMapper.hpp"
       #include "gc/shared/workerThread.hpp"
       #include "memory/memoryReserver.hpp"
      -#include "runtime/atomicAccess.hpp"
      +#include "runtime/atomic.hpp"
       #include "runtime/os.hpp"
       #include "unittest.hpp"
       
      @@ -51,7 +51,7 @@ WorkerThreads* G1MapperWorkers::_workers = nullptr;
       
       class G1TestCommitUncommit : public WorkerTask {
         G1RegionToSpaceMapper* _mapper;
      -  uint _claim_id;
      +  Atomic _claim_id;
       public:
         G1TestCommitUncommit(G1RegionToSpaceMapper* mapper) :
             WorkerTask("Stress mapper"),
      @@ -59,7 +59,7 @@ public:
             _claim_id(0) { }
       
         void work(uint worker_id) {
      -    uint index = AtomicAccess::fetch_then_add(&_claim_id, 1u);
      +    uint index = _claim_id.fetch_then_add(1u);
       
           for (int i = 0; i < 100000; i++) {
             // Stress commit and uncommit of a single region. The same
      diff --git a/test/hotspot/gtest/gc/shared/test_bufferNodeAllocator.cpp b/test/hotspot/gtest/gc/shared/test_bufferNodeAllocator.cpp
      index ec72ce404e3..edcea03d696 100644
      --- a/test/hotspot/gtest/gc/shared/test_bufferNodeAllocator.cpp
      +++ b/test/hotspot/gtest/gc/shared/test_bufferNodeAllocator.cpp
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2018, 2025, 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,7 +24,7 @@
       
       #include "gc/shared/bufferNode.hpp"
       #include "memory/allocation.hpp"
      -#include "runtime/atomicAccess.hpp"
      +#include "runtime/atomic.hpp"
       #include "runtime/interfaceSupport.inline.hpp"
       #include "runtime/semaphore.inline.hpp"
       #include "runtime/thread.hpp"
      @@ -116,16 +116,16 @@ public:
       class BufferNode::TestSupport::AllocatorThread : public JavaTestThread {
         BufferNode::Allocator* _allocator;
         CompletedList* _cbl;
      -  volatile size_t* _total_allocations;
      -  volatile bool* _continue_running;
      +  Atomic* _total_allocations;
      +  Atomic* _continue_running;
         size_t _allocations;
       
       public:
         AllocatorThread(Semaphore* post,
                         BufferNode::Allocator* allocator,
                         CompletedList* cbl,
      -                  volatile size_t* total_allocations,
      -                  volatile bool* continue_running) :
      +                  Atomic* total_allocations,
      +                  Atomic* continue_running) :
           JavaTestThread(post),
           _allocator(allocator),
           _cbl(cbl),
      @@ -135,14 +135,14 @@ public:
         {}
       
         virtual void main_run() {
      -    while (AtomicAccess::load_acquire(_continue_running)) {
      +    while (_continue_running->load_acquire()) {
             BufferNode* node = _allocator->allocate();
             _cbl->push(node);
             ++_allocations;
             ThreadBlockInVM tbiv(this); // Safepoint check.
           }
           tty->print_cr("allocations: %zu", _allocations);
      -    AtomicAccess::add(_total_allocations, _allocations);
      +    _total_allocations->add_then_fetch(_allocations);
         }
       };
       
      @@ -151,13 +151,13 @@ public:
       class BufferNode::TestSupport::ProcessorThread : public JavaTestThread {
         BufferNode::Allocator* _allocator;
         CompletedList* _cbl;
      -  volatile bool* _continue_running;
      +  Atomic* _continue_running;
       
       public:
         ProcessorThread(Semaphore* post,
                         BufferNode::Allocator* allocator,
                         CompletedList* cbl,
      -                  volatile bool* continue_running) :
      +                  Atomic* continue_running) :
           JavaTestThread(post),
           _allocator(allocator),
           _cbl(cbl),
      @@ -172,7 +172,7 @@ public:
               _allocator->release(node);
             } else if (shutdown_requested) {
               return;
      -      } else if (!AtomicAccess::load_acquire(_continue_running)) {
      +      } else if (!_continue_running->load_acquire()) {
               // To avoid a race that could leave buffers in the list after this
               // thread has shut down, continue processing until the list is empty
               // *after* the shut down request has been received.
      @@ -193,9 +193,9 @@ static void run_test(BufferNode::Allocator* allocator, CompletedList* cbl) {
         constexpr uint milliseconds_to_run = 1000;
       
         Semaphore post;
      -  volatile size_t total_allocations = 0;
      -  volatile bool allocator_running = true;
      -  volatile bool processor_running = true;
      +  Atomic total_allocations{0};
      +  Atomic allocator_running{true};
      +  Atomic processor_running{true};
       
         ProcessorThread* proc_threads[num_processor_threads] = {};
         for (uint i = 0; i < num_processor_threads; ++i) {
      @@ -222,18 +222,18 @@ static void run_test(BufferNode::Allocator* allocator, CompletedList* cbl) {
           ThreadInVMfromNative invm(this_thread);
           this_thread->sleep(milliseconds_to_run);
         }
      -  AtomicAccess::release_store(&allocator_running, false);
      +  allocator_running.release_store(false);
         for (uint i = 0; i < num_allocator_threads; ++i) {
           ThreadInVMfromNative invm(this_thread);
           post.wait_with_safepoint_check(this_thread);
         }
      -  AtomicAccess::release_store(&processor_running, false);
      +  processor_running.release_store(false);
         for (uint i = 0; i < num_processor_threads; ++i) {
           ThreadInVMfromNative invm(this_thread);
           post.wait_with_safepoint_check(this_thread);
         }
         ASSERT_TRUE(BufferNode::TestSupport::try_transfer_pending(allocator));
      -  tty->print_cr("total allocations: %zu", total_allocations);
      +  tty->print_cr("total allocations: %zu", total_allocations.load_relaxed());
         tty->print_cr("allocator free count: %zu", allocator->free_count());
       }
       
      diff --git a/test/hotspot/gtest/gc/shenandoah/test_shenandoahCollectorPolicy.cpp b/test/hotspot/gtest/gc/shenandoah/test_shenandoahCollectorPolicy.cpp
      index b5c974f65ad..70d458ec5e5 100644
      --- a/test/hotspot/gtest/gc/shenandoah/test_shenandoahCollectorPolicy.cpp
      +++ b/test/hotspot/gtest/gc/shenandoah/test_shenandoahCollectorPolicy.cpp
      @@ -28,7 +28,7 @@
       TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_sanity) {
         ShenandoahCollectorPolicy policy;
         EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 0UL);
      -  EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false);
      +  EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false);
       }
       
       TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_no_upgrade) {
      @@ -36,7 +36,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_no_upgrade) {
         policy.record_degenerated(true, true, true);
         policy.record_degenerated(true, true, true);
         EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 2UL);
      -  EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false);
      +  EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false);
       }
       
       TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_upgrade) {
      @@ -44,7 +44,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_upgrade) {
         policy.record_degenerated(true, true, false);
         policy.record_degenerated(true, true, false);
         EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 2UL);
      -  EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), true);
      +  EXPECT_EQ(policy.should_upgrade_degenerated_gc(), true);
       }
       
       TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_reset_progress) {
      @@ -52,7 +52,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_reset_progress) {
         policy.record_degenerated(true, true, false);
         policy.record_degenerated(true, true, true);
         EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 2UL);
      -  EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false);
      +  EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false);
       }
       
       TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_full_reset) {
      @@ -60,7 +60,7 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_full_reset) {
         policy.record_degenerated(true, true, false);
         policy.record_success_full();
         EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 0UL);
      -  EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false);
      +  EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false);
       }
       
       TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_reset) {
      @@ -68,5 +68,5 @@ TEST(ShenandoahCollectorPolicyTest, track_degen_cycles_reset) {
         policy.record_degenerated(true, true, false);
         policy.record_success_concurrent(true, true);
         EXPECT_EQ(policy.consecutive_degenerated_gc_count(), 0UL);
      -  EXPECT_EQ(policy.generational_should_upgrade_degenerated_gc(), false);
      +  EXPECT_EQ(policy.should_upgrade_degenerated_gc(), false);
       }
      diff --git a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldGeneration.cpp b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldGeneration.cpp
      index b2491226e5c..4167e33b706 100644
      --- a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldGeneration.cpp
      +++ b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldGeneration.cpp
      @@ -165,35 +165,12 @@ TEST_VM_F(ShenandoahOldGenerationTest, test_actual_size_exceeds_promotion_reserv
         EXPECT_FALSE(promotions_enabled()) << "New plab can only be used for evacuations";
       }
       
      -TEST_VM_F(ShenandoahOldGenerationTest, test_shared_expends_promoted_but_does_not_change_plab) {
      +TEST_VM_F(ShenandoahOldGenerationTest, test_expend_promoted_should_increase_expended) {
         SKIP_IF_NOT_SHENANDOAH();
      -  ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared_gc(128, ShenandoahAffiliation::OLD_GENERATION, true);
      -  req.set_actual_size(128);
      -  size_t actual_size = req.actual_size() * HeapWordSize;
      -
         size_t expended_before = old->get_promoted_expended();
      -  old->configure_plab_for_current_thread(req);
      +  old->expend_promoted(128);
         size_t expended_after = old->get_promoted_expended();
      -
      -  EXPECT_EQ(expended_before + actual_size, expended_after) << "Shared promotion still expends promotion";
      -  EXPECT_EQ(plab_promoted(), INITIAL_PLAB_PROMOTED) << "Shared promotion should not count in plab";
      -  EXPECT_EQ(plab_size(), INITIAL_PLAB_SIZE) << "Shared promotion should not change size of plab";
      -  EXPECT_FALSE(promotions_enabled());
      -}
      -
      -TEST_VM_F(ShenandoahOldGenerationTest, test_shared_evacuation_has_no_side_effects) {
      -  SKIP_IF_NOT_SHENANDOAH();
      -  ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared_gc(128, ShenandoahAffiliation::OLD_GENERATION, false);
      -  req.set_actual_size(128);
      -
      -  size_t expended_before = old->get_promoted_expended();
      -  old->configure_plab_for_current_thread(req);
      -  size_t expended_after = old->get_promoted_expended();
      -
      -  EXPECT_EQ(expended_before, expended_after) << "Not a promotion, should not expend promotion reserve";
      -  EXPECT_EQ(plab_promoted(), INITIAL_PLAB_PROMOTED) << "Not a plab, should not have touched plab";
      -  EXPECT_EQ(plab_size(), INITIAL_PLAB_SIZE) << "Not a plab, should not have touched plab";
      -  EXPECT_FALSE(promotions_enabled());
      +  EXPECT_EQ(expended_before + 128, expended_after) << "Should expend promotion";
       }
       
       #undef SKIP_IF_NOT_SHENANDOAH
      diff --git a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
      index b184b19ce6c..c0ec1bcf3c9 100644
      --- a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
      +++ b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
      @@ -201,7 +201,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, prime_one_old_region) {
       
         size_t garbage = make_garbage_above_collection_threshold(10);
         _heuristics->prepare_for_old_collections();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_TRUE(collection_set_is(10UL));
         EXPECT_EQ(garbage, _collection_set->get_old_garbage());
      @@ -214,7 +216,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, prime_many_old_regions) {
         size_t g1 = make_garbage_above_collection_threshold(100);
         size_t g2 = make_garbage_above_collection_threshold(101);
         _heuristics->prepare_for_old_collections();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_TRUE(collection_set_is(100UL, 101UL));
         EXPECT_EQ(g1 + g2, _collection_set->get_old_garbage());
      @@ -226,7 +230,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, require_multiple_mixed_evacuations) {
       
         size_t garbage = create_too_much_garbage_for_one_mixed_evacuation();
         _heuristics->prepare_for_old_collections();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_LT(_collection_set->get_old_garbage(), garbage);
         EXPECT_GT(_heuristics->unprocessed_old_collection_candidates(), 0UL);
      @@ -248,7 +254,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, skip_pinned_regions) {
         ASSERT_EQ(3UL, _heuristics->unprocessed_old_collection_candidates());
       
         // Here the region is still pinned, so it cannot be added to the collection set.
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         // The two unpinned regions should be added to the collection set and the pinned
         // region should be retained at the front of the list of candidates as it would be
      @@ -261,7 +269,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, skip_pinned_regions) {
         // the now unpinned region should be added to the collection set.
         make_unpinned(1);
         _collection_set->clear();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_EQ(_collection_set->get_old_garbage(), g2);
         EXPECT_TRUE(collection_set_is(1UL));
      @@ -278,14 +288,18 @@ TEST_VM_F(ShenandoahOldHeuristicTest, pinned_region_is_first) {
       
         make_pinned(0);
         _heuristics->prepare_for_old_collections();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_TRUE(collection_set_is(1UL, 2UL));
         EXPECT_EQ(_heuristics->unprocessed_old_collection_candidates(), 1UL);
       
         make_unpinned(0);
         _collection_set->clear();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_TRUE(collection_set_is(0UL));
         EXPECT_EQ(_heuristics->unprocessed_old_collection_candidates(), 0UL);
      @@ -301,7 +315,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, pinned_region_is_last) {
       
         make_pinned(2);
         _heuristics->prepare_for_old_collections();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_TRUE(collection_set_is(0UL, 1UL));
         EXPECT_EQ(_collection_set->get_old_garbage(), g1 + g2);
      @@ -309,7 +325,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, pinned_region_is_last) {
       
         make_unpinned(2);
         _collection_set->clear();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_TRUE(collection_set_is(2UL));
         EXPECT_EQ(_collection_set->get_old_garbage(), g3);
      @@ -327,7 +345,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, unpinned_region_is_middle) {
         make_pinned(0);
         make_pinned(2);
         _heuristics->prepare_for_old_collections();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_TRUE(collection_set_is(1UL));
         EXPECT_EQ(_collection_set->get_old_garbage(), g2);
      @@ -336,7 +356,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, unpinned_region_is_middle) {
         make_unpinned(0);
         make_unpinned(2);
         _collection_set->clear();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         EXPECT_TRUE(collection_set_is(0UL, 2UL));
         EXPECT_EQ(_collection_set->get_old_garbage(), g1 + g3);
      @@ -354,7 +376,9 @@ TEST_VM_F(ShenandoahOldHeuristicTest, all_candidates_are_pinned) {
         make_pinned(1);
         make_pinned(2);
         _heuristics->prepare_for_old_collections();
      -  _heuristics->prime_collection_set(_collection_set);
      +  if (_heuristics->prime_collection_set(_collection_set)) {
      +    _heuristics->finalize_mixed_evacs();
      +  }
       
         // In the case when all candidates are pinned, we want to abandon
         // this set of mixed collection candidates so that another old collection
      diff --git a/test/hotspot/gtest/gc/z/test_zForwarding.cpp b/test/hotspot/gtest/gc/z/test_zForwarding.cpp
      index 5275b78fb82..6b66d43ae7f 100644
      --- a/test/hotspot/gtest/gc/z/test_zForwarding.cpp
      +++ b/test/hotspot/gtest/gc/z/test_zForwarding.cpp
      @@ -44,11 +44,12 @@ using namespace testing;
       class ZForwardingTest : public ZTest {
       public:
         // Setup and tear down
      -  ZHeap*            _old_heap;
      -  ZGenerationOld*   _old_old;
      -  ZGenerationYoung* _old_young;
      -  ZAddressReserver  _zaddress_reserver;
      -  zoffset           _page_offset;
      +  ZHeap*                       _old_heap;
      +  ZGenerationOld*              _old_old;
      +  ZGenerationYoung*            _old_young;
      +  ZAddressReserver             _zaddress_reserver;
      +  ZPhysicalMemoryBackingMocker _physical_backing;
      +  zoffset                      _page_offset;
       
         virtual void SetUp() {
           _old_heap = ZHeap::_heap;
      @@ -73,8 +74,16 @@ public:
             GTEST_SKIP() << "Unable to reserve memory";
           }
       
      -    char* const addr = (char*)untype(ZOffset::address_unsafe(_page_offset));
      -    os::commit_memory(addr, ZGranuleSize, /* executable */ false);
      +    // Setup backing storage
      +    _physical_backing.SetUp(ZGranuleSize);
      +
      +    size_t committed = _physical_backing()->commit(zbacking_offset(0), ZGranuleSize, 0);
      +
      +    if (committed != ZGranuleSize) {
      +      GTEST_SKIP() << "Unable to commit memory";
      +    }
      +
      +    _physical_backing()->map(ZOffset::address_unsafe(_page_offset), ZGranuleSize, zbacking_offset(0));
         }
       
         virtual void TearDown() {
      @@ -84,10 +93,12 @@ public:
           ZGeneration::_young = _old_young;
       
           if (_page_offset != zoffset::invalid) {
      -      char* const addr = (char*)untype(ZOffset::address_unsafe(_page_offset));
      -      os::uncommit_memory(addr, ZGranuleSize, false /* executable */);
      +      _physical_backing()->unmap(ZOffset::address_unsafe(_page_offset), ZGranuleSize);
      +      _physical_backing()->uncommit(zbacking_offset(0), ZGranuleSize);
           }
       
      +    _physical_backing.TearDown();
      +
           _zaddress_reserver.TearDown();
         }
       
      diff --git a/test/hotspot/gtest/gc/z/zunittest.hpp b/test/hotspot/gtest/gc/z/zunittest.hpp
      index 2464f821380..13a8eb10f8a 100644
      --- a/test/hotspot/gtest/gc/z/zunittest.hpp
      +++ b/test/hotspot/gtest/gc/z/zunittest.hpp
      @@ -28,6 +28,7 @@
       #include "gc/z/zArguments.hpp"
       #include "gc/z/zInitialize.hpp"
       #include "gc/z/zNUMA.hpp"
      +#include "gc/z/zPhysicalMemoryManager.hpp"
       #include "gc/z/zRangeRegistry.hpp"
       #include "gc/z/zVirtualMemory.inline.hpp"
       #include "gc/z/zVirtualMemoryManager.hpp"
      @@ -104,6 +105,54 @@ public:
             }
         };
       
      +  class ZPhysicalMemoryBackingMocker {
      +    size_t                  _old_max;
      +    ZPhysicalMemoryBacking* _backing;
      +    bool                    _active;
      +
      +    static size_t set_max(size_t max_capacity) {
      +      size_t old_max = ZBackingOffsetMax;
      +
      +      ZBackingOffsetMax = max_capacity;
      +      ZBackingIndexMax = checked_cast(ZBackingOffsetMax >> ZGranuleSizeShift);
      +
      +      return old_max;
      +    }
      +
      +  public:
      +    ZPhysicalMemoryBackingMocker()
      +      : _old_max(0),
      +        _backing(nullptr),
      +        _active(false) {}
      +
      +    void SetUp(size_t max_capacity) {
      +      GTEST_EXPECT_FALSE(_active) << "SetUp called twice without a TearDown";
      +
      +      _old_max = set_max(max_capacity);
      +
      +      char* const mem = (char*)os::malloc(sizeof(ZPhysicalMemoryBacking), mtTest);
      +      _backing = new (mem) ZPhysicalMemoryBacking(ZGranuleSize);
      +
      +      _active = true;
      +    }
      +
      +    void TearDown() {
      +      GTEST_EXPECT_TRUE(_active) << "TearDown called without a preceding SetUp";
      +
      +      _active = false;
      +
      +      _backing->~ZPhysicalMemoryBacking();
      +      os::free(_backing);
      +      _backing = nullptr;
      +
      +      set_max(_old_max);
      +    }
      +
      +    ZPhysicalMemoryBacking* operator()() {
      +      return _backing;
      +    }
      +  };
      +
       private:
         ZAddressOffsetMaxSetter _zaddress_offset_max_setter;
         unsigned int _rand_seed;
      diff --git a/test/hotspot/gtest/gtestMain.cpp b/test/hotspot/gtest/gtestMain.cpp
      index 842b6547b48..a1869ab5499 100644
      --- a/test/hotspot/gtest/gtestMain.cpp
      +++ b/test/hotspot/gtest/gtestMain.cpp
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2016, 2025, 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
      @@ -22,6 +22,7 @@
        *
        */
       
      +#include "cppstdlib/cstdlib.hpp"
       #include "jni.h"
       #include "runtime/os.hpp"
       #include "runtime/thread.inline.hpp"
      @@ -31,7 +32,6 @@
       
       #include 
       #include 
      -#include 
       #ifdef __APPLE__
       #include 
       #endif
      diff --git a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp
      index 69548b06e51..8625f64099d 100644
      --- a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp
      +++ b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp
      @@ -34,13 +34,12 @@
       
       #include "jfr/utilities/jfrAllocation.hpp"
       #include "jfr/utilities/jfrRandom.inline.hpp"
      -#include "jfr/utilities/jfrSpinlockHelper.hpp"
       #include "jfr/utilities/jfrTime.hpp"
       #include "jfr/utilities/jfrTimeConverter.hpp"
       #include "jfr/utilities/jfrTryLock.hpp"
       #include "logging/log.hpp"
      -#include "runtime/atomicAccess.hpp"
       #include "utilities/globalDefinitions.hpp"
      +#include "utilities/spinCriticalSection.hpp"
       #include "unittest.hpp"
       
       #include 
      diff --git a/test/hotspot/gtest/metaspace/test_blocktree.cpp b/test/hotspot/gtest/metaspace/test_blocktree.cpp
      index 6d1e8d2884d..3bcd79c98ad 100644
      --- a/test/hotspot/gtest/metaspace/test_blocktree.cpp
      +++ b/test/hotspot/gtest/metaspace/test_blocktree.cpp
      @@ -74,7 +74,7 @@ TEST_VM(metaspace, BlockTree_basic) {
         MetaWord* p = nullptr;
         MetaWord arr[10000];
       
      -  ASSERT_LE(BlockTree::MinWordSize, (size_t)6); // Sanity check. Adjust if Node is changed.
      +  ASSERT_LE(BlockTree::MinWordSize, (size_t)7); // Sanity check. Adjust if Node is changed.
       
         const size_t minws = BlockTree::MinWordSize;
       
      diff --git a/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp b/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp
      index 5752d6df75d..c65808d3f4d 100644
      --- a/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp
      +++ b/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp
      @@ -32,8 +32,6 @@
       #include "unittest.hpp"
       #include "testutils.hpp"
       
      -#if !INCLUDE_ASAN
      -
       // This prefix shows up on any c heap corruption NMT detects. If unsure which assert will
       // come, just use this one.
       #define COMMON_NMT_HEAP_CORRUPTION_MESSAGE_PREFIX "NMT has detected a memory corruption bug."
      @@ -52,6 +50,8 @@
       
       ///////
       
      +#if !INCLUDE_ASAN
      +
       static void test_overwrite_front() {
         address p = (address) os::malloc(1, mtTest);
         *(p - 1) = 'a';
      @@ -190,4 +190,78 @@ TEST_VM_FATAL_ERROR_MSG(NMT, memory_corruption_call_stack, ".*header canary.*")
         os::free(p);
       }
       
      +#else // ASAN is enabled
      +
      +#define DEFINE_ASAN_TEST(test_function)  \
      +  DEFINE_TEST(test_function, ".*AddressSanitizer.*")
      +
      +static void test_write_header() {
      +  const size_t SIZE = 10;
      +  char* p = (char*)os::malloc(SIZE, mtTest);
      +  // sizeof(MallocHeader) == 16, pick anywheree in [p - 16, p)
      +  *(uint16_t*)((char*)p - 5) = 1;
      +}
      +
      +static void test_read_header() {
      +  const size_t SIZE = 10;
      +  char* p = (char*)os::malloc(SIZE, mtTest);
      +  // sizeof(MallocHeader) == 16, pick anywheree in [p - 16, p)
      +  uint16_t read_canary = *(uint16_t*)((char*)p - 5);
      +}
      +
      +static void test_write_footer() {
      +  const size_t SIZE = 10;
      +  char* p = (char*)os::malloc(SIZE, mtTest);
      +  uint16_t* footer_ptr = (uint16_t*)(p + SIZE);
      +  *footer_ptr = 1;
      +}
      +
      +static void test_read_footer() {
      +  const size_t SIZE = 10;
      +  char* p = (char*)os::malloc(SIZE, mtTest);
      +  uint16_t* footer_ptr = (uint16_t*)(p + SIZE);
      +  uint16_t read_footer = *footer_ptr;
      +}
      +
      +static void test_write_header_after_realloc() {
      +  const size_t SIZE = 10;
      +  char* p = (char*)os::malloc(SIZE, mtTest);
      +  p = (char*)os::realloc(p, 2 * SIZE, mtTest);
      +  // sizeof(MallocHeader) == 16, pick anywheree in [p - 16, p)
      +  *(uint16_t*)((char*)p - 5) = 1;
      +}
      +
      +static void test_read_header_after_realloc() {
      +  const size_t SIZE = 10;
      +  char* p = (char*)os::malloc(SIZE, mtTest);
      +  p = (char*)os::realloc(p, 2 * SIZE, mtTest);
      +  // sizeof(MallocHeader) == 16, pick anywheree in [p - 16, p)
      +  uint16_t read_canary = *(uint16_t*)((char*)p - 5);
      +}
      +
      +static void test_write_footer_after_realloc() {
      +  const size_t SIZE = 10;
      +  char* p = (char*)os::malloc(SIZE, mtTest);
      +  p = (char*)os::realloc(p, 2 * SIZE, mtTest);
      +  uint16_t* footer_ptr = (uint16_t*)(p + 2 * SIZE);
      +  *footer_ptr = 1;
      +}
      +
      +static void test_read_footer_after_realloc() {
      +  const size_t SIZE = 10;
      +  char* p = (char*)os::malloc(SIZE, mtTest);
      +  p = (char*)os::realloc(p, 2 * SIZE, mtTest);
      +  uint16_t* footer_ptr = (uint16_t*)(p + 2 * SIZE);
      +  uint16_t read_footer = *footer_ptr;
      +}
      +
      +DEFINE_ASAN_TEST(test_write_header);
      +DEFINE_ASAN_TEST(test_read_header);
      +DEFINE_ASAN_TEST(test_write_footer);
      +DEFINE_ASAN_TEST(test_read_footer);
      +DEFINE_ASAN_TEST(test_write_header_after_realloc);
      +DEFINE_ASAN_TEST(test_read_header_after_realloc);
      +DEFINE_ASAN_TEST(test_write_footer_after_realloc);
      +DEFINE_ASAN_TEST(test_read_footer_after_realloc);
      +
       #endif // !INCLUDE_ASAN
      diff --git a/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp b/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp
      index d1da65cb396..24ab9888521 100644
      --- a/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp
      +++ b/test/hotspot/gtest/nmt/test_nmt_cornercases.cpp
      @@ -88,7 +88,6 @@ TEST_VM(NMT, realloc_failure_overflowing_size) {
       TEST_VM(NMT, realloc_failure_gigantic_size) {
         check_failing_realloc(SIZE_MAX - M);
       }
      -#endif // !INCLUDE_ASAN
       
       static void* do_realloc(void* p, size_t old_size, size_t new_size, uint8_t old_content, bool check_nmt_header) {
       
      @@ -154,8 +153,8 @@ TEST_VM(NMT, HeaderKeepsIntegrityAfterRevival) {
         size_t some_size = 16;
         void* p = os::malloc(some_size, mtTest);
         ASSERT_NOT_NULL(p) << "Failed to malloc()";
      -  MallocHeader* hdr = MallocTracker::malloc_header(p);
      -  hdr->mark_block_as_dead();
      -  hdr->revive();
      +  MallocHeader* hdr = MallocHeader::kill_block(p);
      +  MallocHeader::revive_block(p);
         check_expected_malloc_header(p, mtTest, some_size);
       }
      +#endif // !INCLUDE_ASAN
      \ No newline at end of file
      diff --git a/test/hotspot/gtest/nmt/test_regions_tree.cpp b/test/hotspot/gtest/nmt/test_regions_tree.cpp
      index a7f4a6962ca..7465c84aa72 100644
      --- a/test/hotspot/gtest/nmt/test_regions_tree.cpp
      +++ b/test/hotspot/gtest/nmt/test_regions_tree.cpp
      @@ -48,7 +48,7 @@ TEST_VM_F(NMTRegionsTreeTest, ReserveCommitTwice) {
         }
         {
           VMATree::SummaryDiff diff, not_used;
      -    rt.commit_region(0, 50, ncs, not_used);
      +    rt.commit_region(nullptr, 50, ncs, not_used);
           rt.reserve_mapping(0, 100, rd, diff);
           EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve);
           EXPECT_EQ(-50, diff.tag[NMTUtil::tag_to_index(mtTest)].commit);
      @@ -62,10 +62,10 @@ TEST_VM_F(NMTRegionsTreeTest, ReserveCommitTwice) {
       
         {
           VMATree::SummaryDiff diff1, diff2;
      -    rt.commit_region(0, 50, ncs, diff1);
      +    rt.commit_region(nullptr, 50, ncs, diff1);
           EXPECT_EQ(0, diff1.tag[NMTUtil::tag_to_index(mtGC)].reserve);
           EXPECT_EQ(50, diff1.tag[NMTUtil::tag_to_index(mtGC)].commit);
      -    rt.commit_region(0, 50, ncs, diff2);
      +    rt.commit_region(nullptr, 50, ncs, diff2);
           EXPECT_EQ(0, diff2.tag[NMTUtil::tag_to_index(mtTest)].reserve);
           EXPECT_EQ(0, diff2.tag[NMTUtil::tag_to_index(mtTest)].commit);
         }
      @@ -78,7 +78,7 @@ TEST_VM_F(NMTRegionsTreeTest, CommitUncommitRegion) {
         rt.reserve_mapping(0, 100, rd, not_used);
         {
           VMATree::SummaryDiff diff;
      -    rt.commit_region(0, 50, ncs, diff);
      +    rt.commit_region(nullptr, 50, ncs, diff);
           EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve);
           EXPECT_EQ(50, diff.tag[NMTUtil::tag_to_index(mtTest)].commit);
         }
      @@ -90,7 +90,7 @@ TEST_VM_F(NMTRegionsTreeTest, CommitUncommitRegion) {
         }
         {
           VMATree::SummaryDiff diff;
      -    rt.uncommit_region(0, 50, diff);
      +    rt.uncommit_region(nullptr, 50, diff);
           EXPECT_EQ(0, diff.tag[NMTUtil::tag_to_index(mtTest)].reserve);
           EXPECT_EQ(-50, diff.tag[NMTUtil::tag_to_index(mtTest)].commit);
         }
      @@ -153,4 +153,4 @@ TEST_VM_F(NMTRegionsTreeTest, VisitCommittedRegions) {
           return true;
         });
         EXPECT_EQ(count, 4UL);
      -}
      \ No newline at end of file
      +}
      diff --git a/test/hotspot/gtest/oops/test_compressedKlass.cpp b/test/hotspot/gtest/oops/test_compressedKlass.cpp
      index 5badd9ecae5..5a7323edc03 100644
      --- a/test/hotspot/gtest/oops/test_compressedKlass.cpp
      +++ b/test/hotspot/gtest/oops/test_compressedKlass.cpp
      @@ -1,6 +1,6 @@
       /*
        * Copyright (c) 2024, 2025, Red Hat, Inc. All rights reserved.
      - * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2024, 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,6 @@
       #include "unittest.hpp"
       
       TEST_VM(CompressedKlass, basics) {
      -  ASSERT_LE((address)0, CompressedKlassPointers::base());
         ASSERT_LE(CompressedKlassPointers::base(), CompressedKlassPointers::klass_range_start());
         ASSERT_LT(CompressedKlassPointers::klass_range_start(), CompressedKlassPointers::klass_range_end());
         ASSERT_LE(CompressedKlassPointers::klass_range_end(), CompressedKlassPointers::encoding_range_end());
      @@ -47,7 +46,7 @@ TEST_VM(CompressedKlass, basics) {
           ASSERT_EQ(CompressedKlassPointers::encoding_range_end() - CompressedKlassPointers::base(), (ptrdiff_t)expected_size);
         }
       #else
      -  ASSERT_EQ(CompressedKlassPointers::base(), (address)0);
      +  ASSERT_EQ(CompressedKlassPointers::base(), nullptr);
         ASSERT_EQ(CompressedKlassPointers::encoding_range_end(), (address)(UINT_MAX));
       #endif // _LP64
       }
      diff --git a/test/hotspot/gtest/opto/test_rangeinference.cpp b/test/hotspot/gtest/opto/test_rangeinference.cpp
      index 1a62941a486..fd49050d022 100644
      --- a/test/hotspot/gtest/opto/test_rangeinference.cpp
      +++ b/test/hotspot/gtest/opto/test_rangeinference.cpp
      @@ -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
      @@ -25,15 +25,16 @@
       #include "opto/rangeinference.hpp"
       #include "opto/type.hpp"
       #include "runtime/os.hpp"
      -#include "utilities/intn_t.hpp"
       #include "unittest.hpp"
      +#include "utilities/intn_t.hpp"
      +#include "utilities/rbTree.hpp"
      +#include 
      +#include 
      +#include 
       
       template 
      -static U uniform_random();
      -
      -template <>
      -juint uniform_random() {
      -  return os::random();
      +static U uniform_random() {
      +  return U(juint(os::random()));
       }
       
       template <>
      @@ -212,3 +213,413 @@ TEST_VM(opto, canonicalize_constraints) {
         test_canonicalize_constraints_random();
         test_canonicalize_constraints_random();
       }
      +
      +// Implementations of TypeIntMirror methods for testing purposes
      +template 
      +TypeIntMirror TypeIntMirror::make(const TypeIntMirror& t, int widen) {
      +  return t;
      +}
      +
      +template 
      +const TypeIntMirror* TypeIntMirror::operator->() const {
      +  return this;
      +}
      +
      +template 
      +bool TypeIntMirror::contains(U u) const {
      +  S s = S(u);
      +  return s >= _lo && s <= _hi && u >= _ulo && u <= _uhi && _bits.is_satisfied_by(u);
      +}
      +
      +template 
      +bool TypeIntMirror::contains(const TypeIntMirror& o) const {
      +  return TypeIntHelper::int_type_is_subset(*this, o);
      +}
      +
      +template 
      +bool TypeIntMirror::operator==(const TypeIntMirror& o) const {
      +  return TypeIntHelper::int_type_is_equal(*this, o);
      +}
      +
      +template 
      +template 
      +TypeIntMirror TypeIntMirror::cast() const {
      +  static_assert(std::is_same_v);
      +  return *this;
      +}
      +
      +// The number of TypeIntMirror instances for integral types with a few bits. These values are
      +// calculated once and written down for usage in constexpr contexts.
      +template 
      +static constexpr size_t all_instances_size() {
      +  using U = decltype(CTP::_ulo);
      +  constexpr juint max_unsigned = juint(std::numeric_limits::max());
      +  if constexpr (max_unsigned == 1U) {
      +    // 1 bit
      +    return 3;
      +  } else if constexpr (max_unsigned == 3U) {
      +    // 2 bits
      +    return 15;
      +  } else if constexpr (max_unsigned == 7U) {
      +    // 3 bits
      +    return 134;
      +  } else {
      +    // 4 bits
      +    static_assert(max_unsigned == 15U);
      +    // For more than 4 bits, the number of instances is too large and it is not realistic to
      +    // compute all of them.
      +    return 1732;
      +  }
      +}
      +
      +template 
      +static std::array()> compute_all_instances() {
      +  using S = decltype(CTP::_lo);
      +  using U = decltype(CTP::_ulo);
      +
      +  class CTPComparator {
      +  public:
      +    static RBTreeOrdering cmp(const CTP& x, const RBNode* node) {
      +      // Quick helper for the tediousness below
      +      auto f = [](auto x, auto y) {
      +        assert(x != y, "we only handle lt and gt cases");
      +        return x < y ? RBTreeOrdering::LT : RBTreeOrdering::GT;
      +      };
      +
      +      const CTP& y = node->key();
      +      if (x._lo != y._lo) {
      +        return f(x._lo, y._lo);
      +      } else if (x._hi != y._hi) {
      +        return f(x._hi, y._hi);
      +      } else if (x._ulo != y._ulo) {
      +        return f(x._ulo, y._ulo);
      +      } else if (x._uhi != y._uhi) {
      +        return f(x._uhi, y._uhi);
      +      } else if (x._bits._zeros != y._bits._zeros) {
      +        return f(x._bits._zeros, y._bits._zeros);
      +      } else if (x._bits._ones != y._bits._ones) {
      +        return f(x._bits._ones, y._bits._ones);
      +      } else {
      +        return RBTreeOrdering::EQ;
      +      }
      +    }
      +  };
      +
      +  RBTreeCHeap collector;
      +  for (jint lo = jint(std::numeric_limits::min()); lo <= jint(std::numeric_limits::max()); lo++) {
      +    for (jint hi = lo; hi <= jint(std::numeric_limits::max()); hi++) {
      +      for (juint ulo = 0; ulo <= juint(std::numeric_limits::max()); ulo++) {
      +        for (juint uhi = ulo; uhi <= juint(std::numeric_limits::max()); uhi++) {
      +          for (juint zeros = 0; zeros <= juint(std::numeric_limits::max()); zeros++) {
      +            for (juint ones = 0; ones <= juint(std::numeric_limits::max()); ones++) {
      +              TypeIntPrototype t{{S(lo), S(hi)}, {U(ulo), U(uhi)}, {U(zeros), U(ones)}};
      +              auto canonicalized_t = t.canonicalize_constraints();
      +              if (canonicalized_t.empty()) {
      +                continue;
      +              }
      +
      +              TypeIntPrototype ct = canonicalized_t._data;
      +              collector.upsert(CTP{ct._srange._lo, ct._srange._hi, ct._urange._lo, ct._urange._hi, ct._bits}, 0);
      +            }
      +          }
      +        }
      +      }
      +    }
      +  }
      +
      +  assert(collector.size() == all_instances_size(), "unexpected size of all_instance, expected %d, actual %d", jint(all_instances_size()), jint(collector.size()));
      +  std::array()> res;
      +  size_t idx = 0;
      +  collector.visit_in_order([&](RBNode* node) {
      +    res[idx] = node->key();
      +    idx++;
      +    return true;
      +  });
      +  return res;
      +}
      +
      +template 
      +static const std::array()>& all_instances() {
      +  static std::array()> res = compute_all_instances();
      +  static_assert(std::is_trivially_destructible_v);
      +  return res;
      +}
      +
      +// Check the correctness, that is, if v1 is an element of input1, v2 is an element of input2, then
      +// op(v1, v2) must be an element of infer(input1, input2). This version does the check exhaustively
      +// on all elements of input1 and input2.
      +template 
      +static void test_binary_instance_correctness_exhaustive(Operation op, Inference infer, const InputType& input1, const InputType& input2) {
      +  using S = std::remove_const_t_lo)>;
      +  using U = std::remove_const_t_ulo)>;
      +  InputType result = infer(input1, input2);
      +
      +  for (juint v1 = juint(std::numeric_limits::min()); v1 <= juint(std::numeric_limits::max()); v1++) {
      +    if (!input1.contains(U(v1))) {
      +      continue;
      +    }
      +
      +    for (juint v2 = juint(std::numeric_limits::min()); v2 <= juint(std::numeric_limits::max()); v2++) {
      +      if (!input2.contains(U(v2))) {
      +        continue;
      +      }
      +
      +      U r = op(U(v1), U(v2));
      +      ASSERT_TRUE(result.contains(r));
      +    }
      +  }
      +}
      +
      +// Check the correctness, that is, if v1 is an element of input1, v2 is an element of input2, then
      +// op(v1, v2) must be an element of infer(input1, input2). This version does the check randomly on
      +// a number of elements in input1 and input2.
      +template 
      +static void test_binary_instance_correctness_samples(Operation op, Inference infer, const InputType& input1, const InputType& input2) {
      +  using U = std::remove_const_t_ulo)>;
      +  auto result = infer(input1, input2);
      +
      +  constexpr size_t sample_count = 6;
      +  U input1_samples[sample_count] {U(input1._lo), U(input1._hi), input1._ulo, input1._uhi, input1._ulo, input1._ulo};
      +  U input2_samples[sample_count] {U(input2._lo), U(input2._hi), input2._ulo, input2._uhi, input2._ulo, input2._ulo};
      +
      +  auto random_sample = [](U* samples, const InputType& input) {
      +    constexpr size_t max_tries = 100;
      +    constexpr size_t start_random_idx = 4;
      +    for (size_t tries = 0, idx = start_random_idx; tries < max_tries && idx < sample_count; tries++) {
      +      U n = uniform_random();
      +      if (input.contains(n)) {
      +        samples[idx] = n;
      +        idx++;
      +      }
      +    }
      +  };
      +  random_sample(input1_samples, input1);
      +  random_sample(input2_samples, input2);
      +
      +  for (size_t i = 0; i < sample_count; i++) {
      +    for (size_t j = 0; j < sample_count; j++) {
      +      U r = op(input1_samples[i], input2_samples[j]);
      +      ASSERT_TRUE(result.contains(r));
      +    }
      +  }
      +}
      +
      +// Check the monotonicity, that is, if input1 is a subset of super1, input2 is a subset of super2,
      +// then infer(input1, input2) must be a subset of infer(super1, super2). This version does the
      +// check exhaustively on all supersets of input1 and input2.
      +template 
      +static void test_binary_instance_monotonicity_exhaustive(Inference infer, const InputType& input1, const InputType& input2) {
      +  InputType result = infer(input1, input2);
      +
      +  for (const InputType& super1 : all_instances()) {
      +    if (!super1.contains(input1) || super1 == input1) {
      +      continue;
      +    }
      +
      +    for (const InputType& super2 : all_instances()) {
      +      if (!super2.contains(input2) || super2 == input2) {
      +        continue;
      +      }
      +
      +      ASSERT_TRUE(infer(input1, super2).contains(result));
      +      ASSERT_TRUE(infer(super1, input2).contains(result));
      +      ASSERT_TRUE(infer(super1, super2).contains(result));
      +    }
      +  }
      +}
      +
      +// Check the monotonicity, that is, if input1 is a subset of super1, input2 is a subset of super2,
      +// then infer(input1, input2) must be a subset of infer(super1, super2). This version does the
      +// check randomly on a number of supersets of input1 and input2.
      +template 
      +static void test_binary_instance_monotonicity_samples(Inference infer, const InputType& input1, const InputType& input2) {
      +  using S = std::remove_const_t_lo)>;
      +  using U = std::remove_const_t_ulo)>;
      +  auto result = infer(input1, input2);
      +
      +  // The set that is a superset of all other sets
      +  InputType universe = InputType{std::numeric_limits::min(), std::numeric_limits::max(), U(0), U(-1), {U(0), U(0)}};
      +  ASSERT_TRUE(infer(universe, input2).contains(result));
      +  ASSERT_TRUE(infer(input1, universe).contains(result));
      +  ASSERT_TRUE(infer(universe, universe).contains(result));
      +
      +  auto random_superset = [](const InputType& input) {
      +    S lo = MIN2(input->_lo, S(uniform_random()));
      +    S hi = MAX2(input->_hi, S(uniform_random()));
      +    U ulo = MIN2(input->_ulo, uniform_random());
      +    U uhi = MAX2(input->_uhi, uniform_random());
      +    U zeros = input->_bits._zeros & uniform_random();
      +    U ones = input->_bits._ones & uniform_random();
      +    InputType super = InputType::make(TypeIntPrototype{{lo, hi}, {ulo, uhi}, {zeros, ones}}, 0);
      +    assert(super.contains(input), "impossible");
      +    return super;
      +  };
      +
      +  InputType super1 = random_superset(input1);
      +  InputType super2 = random_superset(input2);
      +  ASSERT_TRUE(infer(super1, input2).contains(result));
      +  ASSERT_TRUE(infer(input1, super2).contains(result));
      +  ASSERT_TRUE(infer(super1, super2).contains(result));
      +}
      +
      +// Verify the correctness and monotonicity of an inference function by exhautively analyzing all
      +// instances of InputType
      +template 
      +static void test_binary_exhaustive(Operation op, Inference infer) {
      +  for (const InputType& input1 : all_instances()) {
      +    for (const InputType& input2 : all_instances()) {
      +      test_binary_instance_correctness_exhaustive(op, infer, input1, input2);
      +      if (all_instances().size() < 100) {
      +        // This effectively covers the cases up to uintn_t<2>
      +        test_binary_instance_monotonicity_exhaustive(infer, input1, input2);
      +      } else {
      +        // This effectively covers the cases of uintn_t<3>
      +        test_binary_instance_monotonicity_samples(infer, input1, input2);
      +      }
      +    }
      +  }
      +}
      +
      +// Verify the correctness and monotonicity of an inference function by randomly sampling instances
      +// of InputType
      +template 
      +static void test_binary_random(Operation op, Inference infer) {
      +  using S = std::remove_const_t;
      +  using U = std::remove_const_t;
      +
      +  constexpr size_t sample_count = 100;
      +  InputType samples[sample_count];
      +
      +  // Fill with {0}
      +  for (size_t i = 0; i < sample_count; i++) {
      +    samples[i] = InputType::make(TypeIntPrototype{{S(0), S(0)}, {U(0), U(0)}, {U(0), U(0)}}, 0);
      +  }
      +
      +  // {1}
      +  samples[1] = InputType::make(TypeIntPrototype{{S(1), S(1)}, {U(1), U(1)}, {U(0), U(0)}}, 0);
      +  // {-1}
      +  samples[2] = InputType::make(TypeIntPrototype{{S(-1), S(-1)}, {U(-1), U(-1)}, {U(0), U(0)}}, 0);
      +  // {0, 1}
      +  samples[3] = InputType::make(TypeIntPrototype{{S(0), S(1)}, {U(0), U(1)}, {U(0), U(0)}}, 0);
      +  // {-1, 0, 1}
      +  samples[4] = InputType::make(TypeIntPrototype{{S(-1), S(1)}, {U(0), U(-1)}, {U(0), U(0)}}, 0);
      +  // {-1, 1}
      +  samples[5] = InputType::make(TypeIntPrototype{{S(-1), S(1)}, {U(1), U(-1)}, {U(0), U(0)}}, 0);
      +  // {0, 1, 2}
      +  samples[6] = InputType::make(TypeIntPrototype{{S(0), S(2)}, {U(0), U(2)}, {U(0), U(0)}}, 0);
      +  // {0, 2}
      +  samples[7] = InputType::make(TypeIntPrototype{{S(0), S(2)}, {U(0), U(2)}, {U(1), U(0)}}, 0);
      +  // [min_signed, max_signed]
      +  samples[8] = InputType::make(TypeIntPrototype{{std::numeric_limits::min(), std::numeric_limits::max()}, {U(0), U(-1)}, {U(0), U(0)}}, 0);
      +  // [0, max_signed]
      +  samples[9] = InputType::make(TypeIntPrototype{{S(0), std::numeric_limits::max()}, {U(0), U(-1)}, {U(0), U(0)}}, 0);
      +  // [min_signed, 0)
      +  samples[10] = InputType::make(TypeIntPrototype{{std::numeric_limits::min(), S(-1)}, {U(0), U(-1)}, {U(0), U(0)}}, 0);
      +
      +  constexpr size_t max_tries = 1000;
      +  constexpr size_t start_random_idx = 11;
      +  for (size_t tries = 0, idx = start_random_idx; tries < max_tries && idx < sample_count; tries++) {
      +    // Try to have lo < hi
      +    S signed_bound1 = S(uniform_random());
      +    S signed_bound2 = S(uniform_random());
      +    S lo = MIN2(signed_bound1, signed_bound2);
      +    S hi = MAX2(signed_bound1, signed_bound2);
      +
      +    // Try to have ulo < uhi
      +    U unsigned_bound1 = uniform_random();
      +    U unsigned_bound2 = uniform_random();
      +    U ulo = MIN2(unsigned_bound1, unsigned_bound2);
      +    U uhi = MAX2(unsigned_bound1, unsigned_bound2);
      +
      +    // Try to have (zeros & ones) == 0
      +    U zeros = uniform_random();
      +    U ones = uniform_random();
      +    U common = zeros & ones;
      +    zeros = zeros ^ common;
      +    ones = ones ^ common;
      +
      +    TypeIntPrototype t{{lo, hi}, {ulo, uhi}, {zeros, ones}};
      +    auto canonicalized_t = t.canonicalize_constraints();
      +    if (canonicalized_t.empty()) {
      +      continue;
      +    }
      +
      +    samples[idx] = TypeIntMirror{canonicalized_t._data._srange._lo, canonicalized_t._data._srange._hi,
      +                                       canonicalized_t._data._urange._lo, canonicalized_t._data._urange._hi,
      +                                       canonicalized_t._data._bits};
      +    idx++;
      +  }
      +
      +  for (size_t i = 0; i < sample_count; i++) {
      +    for (size_t j = 0; j < sample_count; j++) {
      +      test_binary_instance_correctness_samples(op, infer, samples[i], samples[j]);
      +      test_binary_instance_monotonicity_samples(infer, samples[i], samples[j]);
      +    }
      +  }
      +}
      +
      +template