diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 678f5a038e2..85f89eea8ac 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -55,7 +55,7 @@ on: jobs: build-macos: name: build - runs-on: macos-12 + runs-on: macos-13 strategy: fail-fast: false @@ -98,6 +98,7 @@ jobs: --with-jtreg=${{ steps.jtreg.outputs.path }} --enable-jtreg-failure-handler --with-zlib=system + --disable-warnings-as-errors ${{ 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 46cae3afbfb..0ab8c42c6a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -223,7 +223,7 @@ jobs: uses: ./.github/workflows/build-macos.yml with: platform: macos-x64 - xcode-toolset-version: '13.4.1' + xcode-toolset-version: '14.3.1' configure-arguments: ${{ github.event.inputs.configure-arguments }} make-arguments: ${{ github.event.inputs.make-arguments }} if: needs.select.outputs.macos-x64 == 'true' @@ -234,7 +234,7 @@ jobs: uses: ./.github/workflows/build-macos.yml with: platform: macos-aarch64 - xcode-toolset-version: '13.4.1' + xcode-toolset-version: '14.3.1' extra-conf-options: '--openjdk-target=aarch64-apple-darwin' configure-arguments: ${{ github.event.inputs.configure-arguments }} make-arguments: ${{ github.event.inputs.make-arguments }} @@ -298,7 +298,7 @@ jobs: with: platform: macos-x64 bootjdk-platform: macos-x64 - runs-on: macos-12 + runs-on: macos-13 test-windows-x64: name: windows-x64 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dacf8eaba11..c3560f2135c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -127,7 +127,7 @@ jobs: run: | # On macOS we need to install some dependencies for testing brew install make - sudo xcode-select --switch /Applications/Xcode_13.4.1.app/Contents/Developer + sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer # This will make GNU make available as 'make' and not only as 'gmake' echo '/usr/local/opt/make/libexec/gnubin' >> $GITHUB_PATH if: runner.os == 'macOS' diff --git a/.jcheck/conf b/.jcheck/conf index 5e870e3f5d6..868e54bc32e 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1,7 +1,7 @@ [general] project=jdk-updates jbs=JDK -version=11.0.26 +version=11.0.27 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists diff --git a/closed/OpenJ9.gmk b/closed/OpenJ9.gmk index 9fada4c217a..e052e35a05e 100644 --- a/closed/OpenJ9.gmk +++ b/closed/OpenJ9.gmk @@ -1,5 +1,5 @@ # =========================================================================== -# (c) Copyright IBM Corp. 2017, 2024 All Rights Reserved +# (c) Copyright IBM Corp. 2017, 2025 All Rights Reserved # =========================================================================== # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as @@ -78,21 +78,10 @@ else OPENJ9_VERSION_STRING := $(OPENJ9_BRANCH)-$(OPENJ9_SHA) endif -ifeq (true,$(OPENJ9_ENABLE_CMAKE)) - # If a logging level was specified that shows commands, tell cmake to do likewise. - ifneq (,$(or $(filter true,$(LOG_CMDLINES)),$(filter debug trace,$(LOG_LEVEL)))) - MAKE_ARGS += VERBOSE=ON - endif -else - # MAKEFLAGS, as inherited from openjdk, includes options (e.g. '-r' and '-R') - # that don't work well with OpenJ9 and OMR when not using cmake. - unexport MAKEFLAGS - # Filter out unwanted make flags. - MAKE_ARGS := $(filter-out -R -r -s,$(MAKE_ARGS)) - ifneq (,$(JOBS)) - MAKE_ARGS += -j $(JOBS) - endif -endif # OPENJ9_ENABLE_CMAKE +# If a logging level was specified that shows commands, tell cmake to do likewise. +ifneq (,$(or $(filter true,$(LOG_CMDLINES)),$(filter debug trace,$(LOG_LEVEL)))) + MAKE_ARGS += VERBOSE=ON +endif # Propagate configure option '--disable-warnings-as-errors-omr' to OMR. ifeq (false,$(WARNINGS_AS_ERRORS_OMR)) @@ -124,31 +113,8 @@ endif clean-openj9-thirdparty-binaries \ openj9-config-headers \ run-preprocessors-j9 \ - stage-j9 \ # -# openj9_copy_tree -# ---------------- -# $1 = The target directory to create or update. -# $2 = The source directory to copy. -openj9_copy_tree = $(call openj9_copy_tree_impl,$(strip $1),$(strip $2)) - -OPENJ9_MARKER_FILE := .up-to-date - -# Use '-m' to update file modification times ('-m' is equivalent to '--touch' in some implementations of tar). -define openj9_copy_tree_impl - @$(MKDIR) -p $1 - @$(TAR) --create --directory=$2 $(if $(wildcard $1/$(OPENJ9_MARKER_FILE)),--newer=$1/$(OPENJ9_MARKER_FILE)) --exclude=.git . \ - | $(TAR) --extract --directory=$1 -m - @$(TOUCH) $1/$(OPENJ9_MARKER_FILE) -endef - -ifeq (true,$(OPENJ9_ENABLE_CMAKE)) - CONFIG_HEADERS := j9cfg.h omr/omrcfg.h -else - CONFIG_HEADERS := include/j9cfg.h omr/include_core/omrcfg.h -endif - define openj9_config_header_rules openj9-config-headers : $(SUPPORT_OUTPUTDIR)/openj9_include/$(notdir $1) @@ -157,7 +123,7 @@ define openj9_config_header_rules endef $(foreach file, \ - $(CONFIG_HEADERS), \ + j9cfg.h omr/omrcfg.h, \ $(eval $(call openj9_config_header_rules, $(OPENJ9_VM_BUILD_DIR)/$(file)))) # openj9_test_image_rules @@ -227,121 +193,6 @@ $(foreach file, \ $(if $(wildcard $(file)), \ $(eval $(call openj9_test_image_rules, $(file))))) -# Comments for stage-j9 -# Currently there is a staged location where j9 is built. This is due to a number of reasons: -# 1. make currently leaves output files in current directory -# 2. generated source and header files -# 3. repo layout compared to source.zip layout -# See issue 49 for more information and actions to correct this action. - -# Functions to generate sed program fragments. -# $1 - name of flag to be enabled or disabled. -SedDisable = -e '/"$(strip $1)"/s/"true"/"false"/g' -SedEnable = -e '/"$(strip $1)"/s/"false"/"true"/g' - -# Adjust features based on our configuration. -ifeq (true,$(OPENJ9_ENABLE_CUDA)) - FEATURE_SED_SCRIPT := $(call SedEnable,opt_cuda) -else - FEATURE_SED_SCRIPT := $(call SedDisable,opt_cuda) -endif - -# Function to generate sed program fragment. -# $1 - name of make macro to use instead of a hard-coded tool reference. -# $2 - suffix of uma_make_cmd property name to be adjusted. -SedUmaCommand = -e '/ $$@ - else ifeq (.spec,$(suffix $1)) - @$(SED) $(SPEC_SED_SCRIPT) < $$< > $$@ - else - @$(CP) $$< $$@ - endif -endef - -$(foreach file, \ - $(notdir $(wildcard $(OPENJ9_TOPDIR)/buildspecs/*)), \ - $(eval $(call openj9_stage_buildspec_file,$(file)))) - -stage-j9 : - @$(ECHO) Staging OpenJ9 runtime in $(OUTPUTDIR)/vm - $(call openj9_copy_tree,$(OUTPUTDIR)/vm,$(OPENJ9_TOPDIR)/runtime) - - @$(ECHO) Staging OpenJ9 OMR in $(OUTPUTDIR)/vm - $(call openj9_copy_tree,$(OUTPUTDIR)/vm/omr,$(OPENJ9OMR_TOPDIR)) - OPENJ9_VERSION_VARS := \ COMPANY_NAME \ COMPILER_VERSION_STRING \ @@ -392,9 +243,7 @@ run-preprocessors-j9 : \ $(OPENJ9_VM_BUILD_DIR)/compiler/jit.version \ $(OPENJ9_VM_BUILD_DIR)/include/openj9_version_info.h -ifeq (true,$(OPENJ9_ENABLE_CMAKE)) - - CMAKE_ARGS := \ +CMAKE_ARGS := \ -C $(OPENJ9_TOPDIR)/runtime/cmake/caches/$(patsubst %_cross,%,$(OPENJ9_BUILDSPEC)).cmake \ -DBOOT_JDK="$(BOOT_JDK)" \ -DBUILD_ID=$(BUILD_ID) \ @@ -408,101 +257,101 @@ ifeq (true,$(OPENJ9_ENABLE_CMAKE)) -DOPENJDK_VERSION_NUMBER_FOUR_POSITIONS=$(VERSION_NUMBER_FOUR_POSITIONS) \ # - # Windows can't specify compiler overrides since we already generated wrapper scripts. - ifneq (windows,$(OPENJDK_TARGET_OS)) - # Override the compilers if an OPENJ9_* value is specified. - # Otherwise, toolchain.cmake has the default values. - ifneq (,$(OPENJ9_CC)) - CMAKE_ARGS += -DCMAKE_C_COMPILER="$(OPENJ9_CC)" - endif - ifneq (,$(OPENJ9_CXX)) - CMAKE_ARGS += -DCMAKE_CXX_COMPILER="$(OPENJ9_CXX)" - endif - endif # windows - - ifneq (,$(CCACHE)) - # openjdk makefiles add a bunch of environemnt variables to the ccache command. - # CMake will not parse this properly, so we wrap the whole thing in the env command. - # We also need to add semicolons between arguments or else cmake will treat the whole - # thing as one long command name. - - # Note: We remove the CCACHE_COMPRESS option that openjdk adds, because it significantly - # slows down the build (to the point of erasing any gains from using ccache). - CCACHE_NOCOMPRESS := $(filter-out CCACHE_COMPRESS=1,$(CCACHE)) - ESCAPED_CCACHE := env$(subst $(SPACE),,$(addprefix ;,$(CCACHE_NOCOMPRESS))) - - CMAKE_ARGS += -DCMAKE_C_COMPILER_LAUNCHER="$(ESCAPED_CCACHE)" - CMAKE_ARGS += -DCMAKE_CXX_COMPILER_LAUNCHER="$(ESCAPED_CCACHE)" - endif # CCACHE - - ifeq (true,$(OPENJ9_ENABLE_JFR)) - CMAKE_ARGS += -DJ9VM_OPT_JFR=ON - else # OPENJ9_ENABLE_JFR - CMAKE_ARGS += -DJ9VM_OPT_JFR=OFF - endif # OPENJ9_ENABLE_JFR - - ifeq (true,$(OPENJ9_ENABLE_JITSERVER)) - CMAKE_ARGS += -DJ9VM_OPT_JITSERVER=ON - - ifneq (,$(OPENSSL_CFLAGS)) - CMAKE_ARGS += -DOPENSSL_CFLAGS="$(OPENSSL_CFLAGS)" - endif - - ifneq (,$(OPENSSL_DIR)) - CMAKE_ARGS += -DOPENSSL_DIR="$(OPENSSL_DIR)" - endif - - ifneq (,$(OPENSSL_BUNDLE_LIB_PATH)) - CMAKE_ARGS += -DOPENSSL_BUNDLE_LIB_PATH="$(OPENSSL_BUNDLE_LIB_PATH)" - endif - else - CMAKE_ARGS += -DJ9VM_OPT_JITSERVER=OFF - endif # OPENJ9_ENABLE_JITSERVER - - ifeq (true,$(OPENJ9_ENABLE_CUDA)) - CMAKE_ARGS += -DJ9VM_OPT_CUDA=ON -DOMR_CUDA_HOME="$(call UnixPath,$(CUDA_HOME))" - else # OPENJ9_ENABLE_CUDA - CMAKE_ARGS += -DJ9VM_OPT_CUDA=OFF - endif # OPENJ9_ENABLE_CUDA - - ifeq (true,$(OPENJ9_ENABLE_CRAC_SUPPORT)) - CMAKE_ARGS += -DJ9VM_OPT_CRAC_SUPPORT=ON - else # OPENJ9_ENABLE_CRAC_SUPPORT - CMAKE_ARGS += -DJ9VM_OPT_CRAC_SUPPORT=OFF - endif # OPENJ9_ENABLE_CRAC_SUPPORT - - ifeq (true,$(OPENJ9_ENABLE_CRIU_SUPPORT)) - CMAKE_ARGS += -DJ9VM_OPT_CRIU_SUPPORT=ON - else # OPENJ9_ENABLE_CRIU_SUPPORT - CMAKE_ARGS += -DJ9VM_OPT_CRIU_SUPPORT=OFF - endif # OPENJ9_ENABLE_CRIU_SUPPORT - - ifeq (true,$(OPENJ9_ENABLE_OPENJDK_METHODHANDLES)) - CMAKE_ARGS += -DJ9VM_OPT_METHOD_HANDLE=OFF - CMAKE_ARGS += -DJ9VM_OPT_OPENJDK_METHODHANDLE=ON - else # OPENJ9_ENABLE_OPENJDK_METHODHANDLES - CMAKE_ARGS += -DJ9VM_OPT_METHOD_HANDLE=ON - CMAKE_ARGS += -DJ9VM_OPT_OPENJDK_METHODHANDLE=OFF - endif # OPENJ9_ENABLE_OPENJDK_METHODHANDLES - - ifeq (true,$(OPENJ9_ENABLE_SNAPSHOTS)) - CMAKE_ARGS += -DJ9VM_OPT_SNAPSHOTS=ON - else # OPENJ9_ENABLE_SNAPSHOTS - CMAKE_ARGS += -DJ9VM_OPT_SNAPSHOTS=OFF - endif # OPENJ9_ENABLE_SNAPSHOTS - - # Propagate configure option '--disable-warnings-as-errors-omr' to OMR. - ifeq (false,$(WARNINGS_AS_ERRORS_OMR)) - CMAKE_ARGS += -DOMR_WARNINGS_AS_ERRORS=OFF +# Windows can't specify compiler overrides since we already generated wrapper scripts. +ifneq (windows,$(OPENJDK_TARGET_OS)) + # Override the compilers if an OPENJ9_* value is specified. + # Otherwise, toolchain.cmake has the default values. + ifneq (,$(OPENJ9_CC)) + CMAKE_ARGS += -DCMAKE_C_COMPILER="$(OPENJ9_CC)" + endif + ifneq (,$(OPENJ9_CXX)) + CMAKE_ARGS += -DCMAKE_CXX_COMPILER="$(OPENJ9_CXX)" + endif +endif # windows + +ifneq (,$(CCACHE)) + # openjdk makefiles add a bunch of environemnt variables to the ccache command. + # CMake will not parse this properly, so we wrap the whole thing in the env command. + # We also need to add semicolons between arguments or else cmake will treat the whole + # thing as one long command name. + + # Note: We remove the CCACHE_COMPRESS option that openjdk adds, because it significantly + # slows down the build (to the point of erasing any gains from using ccache). + CCACHE_NOCOMPRESS := $(filter-out CCACHE_COMPRESS=1,$(CCACHE)) + ESCAPED_CCACHE := env$(subst $(SPACE),,$(addprefix ;,$(CCACHE_NOCOMPRESS))) + + CMAKE_ARGS += -DCMAKE_C_COMPILER_LAUNCHER="$(ESCAPED_CCACHE)" + CMAKE_ARGS += -DCMAKE_CXX_COMPILER_LAUNCHER="$(ESCAPED_CCACHE)" +endif # CCACHE + +ifeq (true,$(OPENJ9_ENABLE_JFR)) + CMAKE_ARGS += -DJ9VM_OPT_JFR=ON +else # OPENJ9_ENABLE_JFR + CMAKE_ARGS += -DJ9VM_OPT_JFR=OFF +endif # OPENJ9_ENABLE_JFR + +ifeq (true,$(OPENJ9_ENABLE_JITSERVER)) + CMAKE_ARGS += -DJ9VM_OPT_JITSERVER=ON + + ifneq (,$(OPENSSL_CFLAGS)) + CMAKE_ARGS += -DOPENSSL_CFLAGS="$(OPENSSL_CFLAGS)" + endif + + ifneq (,$(OPENSSL_DIR)) + CMAKE_ARGS += -DOPENSSL_DIR="$(OPENSSL_DIR)" endif - # Propagate configure option '--disable-warnings-as-errors-openj9' to OpenJ9. - ifeq (false,$(WARNINGS_AS_ERRORS_OPENJ9)) - CMAKE_ARGS += -DJ9VM_WARNINGS_AS_ERRORS=OFF - endif + ifneq (,$(OPENSSL_BUNDLE_LIB_PATH)) + CMAKE_ARGS += -DOPENSSL_BUNDLE_LIB_PATH="$(OPENSSL_BUNDLE_LIB_PATH)" + endif +else + CMAKE_ARGS += -DJ9VM_OPT_JITSERVER=OFF +endif # OPENJ9_ENABLE_JITSERVER - # Do this last so extra args take precedence. - CMAKE_ARGS += $(EXTRA_CMAKE_ARGS) +ifeq (true,$(OPENJ9_ENABLE_CUDA)) + CMAKE_ARGS += -DJ9VM_OPT_CUDA=ON -DOMR_CUDA_HOME="$(call UnixPath,$(CUDA_HOME))" +else # OPENJ9_ENABLE_CUDA + CMAKE_ARGS += -DJ9VM_OPT_CUDA=OFF +endif # OPENJ9_ENABLE_CUDA + +ifeq (true,$(OPENJ9_ENABLE_CRAC_SUPPORT)) + CMAKE_ARGS += -DJ9VM_OPT_CRAC_SUPPORT=ON +else # OPENJ9_ENABLE_CRAC_SUPPORT + CMAKE_ARGS += -DJ9VM_OPT_CRAC_SUPPORT=OFF +endif # OPENJ9_ENABLE_CRAC_SUPPORT + +ifeq (true,$(OPENJ9_ENABLE_CRIU_SUPPORT)) + CMAKE_ARGS += -DJ9VM_OPT_CRIU_SUPPORT=ON +else # OPENJ9_ENABLE_CRIU_SUPPORT + CMAKE_ARGS += -DJ9VM_OPT_CRIU_SUPPORT=OFF +endif # OPENJ9_ENABLE_CRIU_SUPPORT + +ifeq (true,$(OPENJ9_ENABLE_OPENJDK_METHODHANDLES)) + CMAKE_ARGS += -DJ9VM_OPT_METHOD_HANDLE=OFF + CMAKE_ARGS += -DJ9VM_OPT_OPENJDK_METHODHANDLE=ON +else # OPENJ9_ENABLE_OPENJDK_METHODHANDLES + CMAKE_ARGS += -DJ9VM_OPT_METHOD_HANDLE=ON + CMAKE_ARGS += -DJ9VM_OPT_OPENJDK_METHODHANDLE=OFF +endif # OPENJ9_ENABLE_OPENJDK_METHODHANDLES + +ifeq (true,$(OPENJ9_ENABLE_SNAPSHOTS)) + CMAKE_ARGS += -DJ9VM_OPT_SNAPSHOTS=ON +else # OPENJ9_ENABLE_SNAPSHOTS + CMAKE_ARGS += -DJ9VM_OPT_SNAPSHOTS=OFF +endif # OPENJ9_ENABLE_SNAPSHOTS + +# Propagate configure option '--disable-warnings-as-errors-omr' to OMR. +ifeq (false,$(WARNINGS_AS_ERRORS_OMR)) + CMAKE_ARGS += -DOMR_WARNINGS_AS_ERRORS=OFF +endif + +# Propagate configure option '--disable-warnings-as-errors-openj9' to OpenJ9. +ifeq (false,$(WARNINGS_AS_ERRORS_OPENJ9)) + CMAKE_ARGS += -DJ9VM_WARNINGS_AS_ERRORS=OFF +endif + +# Do this last so extra args take precedence. +CMAKE_ARGS += $(EXTRA_CMAKE_ARGS) $(OUTPUTDIR)/vm/cmake.stamp : @$(MKDIR) -p $(@D) @@ -511,27 +360,6 @@ $(OUTPUTDIR)/vm/cmake.stamp : run-preprocessors-j9 : $(OUTPUTDIR)/vm/cmake.stamp -else # OPENJ9_ENABLE_CMAKE - -run-preprocessors-j9 : stage-j9 - @$(ECHO) Running OpenJ9 preprocessors with OPENJ9_BUILDSPEC: $(OPENJ9_BUILDSPEC) - +BOOT_JDK=$(BOOT_JDK) $(EXPORT_COMPILER_ENV_VARS) OPENJDK_VERSION_NUMBER_FOUR_POSITIONS=$(VERSION_NUMBER_FOUR_POSITIONS) \ - $(MAKE) $(MAKE_ARGS) -C $(OUTPUTDIR)/vm -f $(OPENJ9_TOPDIR)/runtime/buildtools.mk \ - BUILD_ID=$(BUILD_ID) \ - DEST_DIR=$(call MixedPath,$(J9TOOLS_DIR)) \ - EXTRA_CONFIGURE_ARGS=$(OMR_EXTRA_CONFIGURE_ARGS) \ - FREEMARKER_JAR="$(FREEMARKER_JAR)" \ - J9VM_SHA=$(OPENJ9_SHA) \ - JAVA_HOME=$(BOOT_JDK) \ - OMR_DIR=$(OUTPUTDIR)/vm/omr \ - SOURCETOOLS_DIR=$(call MixedPath,$(OPENJ9_TOPDIR))/sourcetools \ - SPEC=$(OPENJ9_BUILDSPEC) \ - UMA_OPTIONS_EXTRA="-buildDate $(shell date +'%Y%m%d')" \ - VERSION_MAJOR=$(VERSION_FEATURE) \ - tools - -endif # OPENJ9_ENABLE_CMAKE - CUSTOM_COMPILER_ENV_VARS := ifneq (,$(OPENJ9_CC)) @@ -543,31 +371,11 @@ endif ifneq (,$(OPENJ9_DEVELOPER_DIR)) CUSTOM_COMPILER_ENV_VARS += DEVELOPER_DIR="$(OPENJ9_DEVELOPER_DIR)" endif -ifeq (true,$(OPENJ9_ENABLE_JITSERVER)) - ifneq (true,$(OPENJ9_ENABLE_CMAKE)) - CUSTOM_COMPILER_ENV_VARS += J9VM_OPT_JITSERVER=1 - - ifneq (,$(OPENSSL_CFLAGS)) - CUSTOM_COMPILER_ENV_VARS += OPENSSL_CFLAGS="$(OPENSSL_CFLAGS)" - endif - - ifneq (,$(OPENSSL_DIR)) - CUSTOM_COMPILER_ENV_VARS += OPENSSL_DIR="$(OPENSSL_DIR)" - endif - - ifneq (,$(OPENSSL_BUNDLE_LIB_PATH)) - CUSTOM_COMPILER_ENV_VARS += OPENSSL_BUNDLE_LIB_PATH="$(OPENSSL_BUNDLE_LIB_PATH)" - endif - endif # OPENJ9_ENABLE_CMAKE -endif # OPENJ9_ENABLE_JITSERVER ifneq (true,$(OPENJ9_ENABLE_DDR)) DDR_COMMAND := -else ifeq (true,$(OPENJ9_ENABLE_CMAKE)) - DDR_COMMAND := $(EXPORT_COMPILER_ENV_VARS) $(MAKE) $(MAKE_ARGS) -C $(OPENJ9_VM_BUILD_DIR) j9ddr else - DDR_COMMAND := CC="$(CC)" CXX="$(CXX)" $(EXPORT_COMPILER_ENV_VARS) \ - $(MAKE) $(MAKE_ARGS) -C $(OUTPUTDIR)/vm/ddr -f run_omrddrgen.mk + DDR_COMMAND := $(EXPORT_COMPILER_ENV_VARS) $(MAKE) $(MAKE_ARGS) -C $(OPENJ9_VM_BUILD_DIR) j9ddr endif # OPENJ9_ENABLE_DDR build-j9 : run-preprocessors-j9 diff --git a/closed/autoconf/custom-hook.m4 b/closed/autoconf/custom-hook.m4 index e18989b2c19..cd355eb7151 100644 --- a/closed/autoconf/custom-hook.m4 +++ b/closed/autoconf/custom-hook.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# (c) Copyright IBM Corp. 2017, 2024 All Rights Reserved +# (c) Copyright IBM Corp. 2017, 2025 All Rights Reserved # =========================================================================== # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as @@ -38,7 +38,6 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK], OPENJ9_BASIC_SETUP_FUNDAMENTAL_TOOLS OPENJ9_PLATFORM_SETUP - OPENJ9_CONFIGURE_CMAKE OPENJ9_CONFIGURE_COMPILERS OPENJ9_CONFIGURE_CRAC_AND_CRIU_SUPPORT OPENJ9_CONFIGURE_CUDA @@ -51,44 +50,13 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK], OPENJ9_CONFIGURE_OPENJDK_METHODHANDLES OPENJ9_CONFIGURE_SNAPSHOTS OPENJ9_CONFIGURE_WARNINGS - OPENJ9_THIRD_PARTY_REQUIREMENTS OPENJ9_CHECK_NASM_VERSION OPENJCEPLUS_SETUP ]) -AC_DEFUN([OPENJ9_CONFIGURE_CMAKE], -[ - AC_ARG_WITH(cmake, [AS_HELP_STRING([--with-cmake], [enable building openJ9 with CMake])], - [ - if test "x$with_cmake" = xyes -o "x$with_cmake" = x ; then - with_cmake=cmake - fi - ], - [ - with_cmake=cmake - ]) - # at this point with_cmake should either be no, or the name of the cmake command - if test "x$with_cmake" = xno ; then - OPENJ9_ENABLE_CMAKE=false - - # Currently, mixedrefs mode is only available with CMake enabled - if test "x$OMR_MIXED_REFERENCES_MODE" != xoff ; then - AC_MSG_ERROR([[--with-mixedrefs=[static|dynamic] requires --with-cmake]]) - fi - else - OPENJ9_ENABLE_CMAKE=true - if AS_EXECUTABLE_P(["$with_cmake"]) ; then - CMAKE="$with_cmake" - else - UTIL_REQUIRE_PROGS([CMAKE], [$with_cmake]) - fi - fi - - AC_SUBST(OPENJ9_ENABLE_CMAKE) -]) - AC_DEFUN([OPENJ9_BASIC_SETUP_FUNDAMENTAL_TOOLS], [ + UTIL_REQUIRE_PROGS(CMAKE, cmake) UTIL_REQUIRE_PROGS(M4, m4) ]) @@ -672,52 +640,6 @@ AC_DEFUN([OPENJ9_CHECK_NASM_VERSION], fi ]) -AC_DEFUN([OPENJ9_THIRD_PARTY_REQUIREMENTS], -[ - # check 3rd party library requirement for UMA - AC_ARG_WITH(freemarker-jar, [AS_HELP_STRING([--with-freemarker-jar], - [path to freemarker.jar (used to build OpenJ9 build tools)])]) - - FREEMARKER_JAR= - if test "x$OPENJ9_ENABLE_CMAKE" != xtrue ; then - AC_MSG_CHECKING([that freemarker location is set]) - if test "x$with_freemarker_jar" = x -o "x$with_freemarker_jar" = xno ; then - AC_MSG_RESULT([no]) - printf "\n" - printf "The FreeMarker library is required to build the OpenJ9 build tools\n" - printf "and has to be provided during configure process.\n" - printf "\n" - printf "Download the FreeMarker library and unpack it into an arbitrary directory:\n" - printf "\n" - printf "wget https://sourceforge.net/projects/freemarker/files/freemarker/2.3.8/freemarker-2.3.8.tar.gz/download -O freemarker-2.3.8.tar.gz\n" - printf "\n" - printf "tar -xzf freemarker-2.3.8.tar.gz\n" - printf "\n" - printf "Then run configure with '--with-freemarker-jar='\n" - printf "\n" - - AC_MSG_ERROR([Cannot continue]) - else - AC_MSG_RESULT([yes]) - AC_MSG_CHECKING([checking that '$with_freemarker_jar' exists]) - if test -f "$with_freemarker_jar" ; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_ERROR([freemarker.jar not found at '$with_freemarker_jar']) - fi - fi - - if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin ; then - FREEMARKER_JAR=`$PATHTOOL -m "$with_freemarker_jar"` - else - FREEMARKER_JAR=$with_freemarker_jar - fi - fi - - AC_SUBST(FREEMARKER_JAR) -]) - AC_DEFUN_ONCE([CUSTOM_LATE_HOOK], [ # Configure for openssl build diff --git a/closed/autoconf/custom-spec.gmk.in b/closed/autoconf/custom-spec.gmk.in index fd4bd3bb477..b35155b6de1 100644 --- a/closed/autoconf/custom-spec.gmk.in +++ b/closed/autoconf/custom-spec.gmk.in @@ -1,5 +1,5 @@ # =========================================================================== -# (c) Copyright IBM Corp. 2017, 2024 All Rights Reserved +# (c) Copyright IBM Corp. 2017, 2025 All Rights Reserved # =========================================================================== # This code is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 only, as @@ -74,10 +74,7 @@ J9JDK_EXT_NAME := Extensions for OpenJDK for Eclipse OpenJ9 # required by CMake CMAKE := @CMAKE@ -OPENJ9_ENABLE_CMAKE := @OPENJ9_ENABLE_CMAKE@ -# required by UMA -FREEMARKER_JAR := @FREEMARKER_JAR@ OPENJ9_BUILDSPEC := @OPENJ9_BUILDSPEC@ # required by JPP @@ -155,11 +152,7 @@ PERL := @PERL@ WITH_OPENSSL := @WITH_OPENSSL@ # Use '=' instead of ':=' because bootcycle-spec.gmk overrides OUTPUTDIR. -ifeq (true,$(OPENJ9_ENABLE_CMAKE)) - OPENJ9_VM_BUILD_DIR = $(OUTPUTDIR)/vm/runtime -else - OPENJ9_VM_BUILD_DIR = $(OUTPUTDIR)/vm -endif +OPENJ9_VM_BUILD_DIR = $(OUTPUTDIR)/vm/runtime # Enable use of j9cfg.h in openjdk native code. $(foreach var, \ diff --git a/closed/openjdk-tag.gmk b/closed/openjdk-tag.gmk index 824fdb482f1..3a2d258d350 100644 --- a/closed/openjdk-tag.gmk +++ b/closed/openjdk-tag.gmk @@ -1 +1 @@ -OPENJDK_TAG := jdk-11.0.26+4 +OPENJDK_TAG := jdk-11.0.27+1 diff --git a/closed/src/java.base/aix/native/libjncrypto/NativeCrypto_md.c b/closed/src/java.base/aix/native/libjncrypto/NativeCrypto_md.c deleted file mode 100644 index 2d29cc3c518..00000000000 --- a/closed/src/java.base/aix/native/libjncrypto/NativeCrypto_md.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * =========================================================================== - * (c) Copyright IBM Corp. 2019, 2023 All Rights Reserved - * =========================================================================== - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * IBM designates this particular file as subject to the "Classpath" exception - * as provided by IBM 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, see . - * - * =========================================================================== - */ - -#include -#include -#include -#include -#include -#include "NativeCrypto_md.h" - -/* Load the crypto library (return NULL on error) */ -void * load_crypto_library(jboolean traceEnabled) { - void * result = NULL; - const char *libname3_a_64 = "libcrypto.a(libcrypto64.so.3)"; - const char *libname3_64 = "libcrypto64.so.3"; - const char *libname3_a = "libcrypto.a(libcrypto.so.3)"; - const char *libname3 = "libcrypto.so.3"; - const char *libname111 = "libcrypto.a(libcrypto64.so.1.1)"; - const char *libname110 = "libcrypto.so.1.1"; - const char *libname102 = "libcrypto.so.1.0.0"; - const char *symlink = "libcrypto.a(libcrypto64.so)"; - - result = dlopen (libname3_a_64, RTLD_NOW | RTLD_MEMBER); - if (result == NULL) { - result = dlopen (libname3_64, RTLD_NOW); - if (result == NULL) { - result = dlopen (libname3_a, RTLD_NOW | RTLD_MEMBER); - if (result == NULL) { - result = dlopen (libname3, RTLD_NOW); - if (result == NULL) { - result = dlopen (libname111, RTLD_NOW | RTLD_MEMBER); - if (result == NULL) { - result = dlopen (libname110, RTLD_NOW); - if (result == NULL) { - result = dlopen (libname102, RTLD_NOW); - if (result == NULL) { - result = dlopen (symlink, RTLD_NOW | RTLD_MEMBER); - } - } - } - } - } - } - } - return result; -} - -/* Unload the crypto library */ -void unload_crypto_library(void *handle) { - (void)dlclose(handle); -} - -/* Find the symbol in the crypto library (return NULL if not found) */ -void * find_crypto_symbol(void *handle, const char *symname) { - return dlsym(handle, symname); -} diff --git a/closed/src/java.base/macosx/native/libjncrypto/NativeCrypto_md.c b/closed/src/java.base/macosx/native/libjncrypto/NativeCrypto_md.c deleted file mode 100644 index 4b42a130ed7..00000000000 --- a/closed/src/java.base/macosx/native/libjncrypto/NativeCrypto_md.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * =========================================================================== - * (c) Copyright IBM Corp. 2019, 2023 All Rights Reserved - * =========================================================================== - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * IBM designates this particular file as subject to the "Classpath" exception - * as provided by IBM 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, see . - * - * =========================================================================== - */ - -#include -#include -#include -#include -#include -#include "NativeCrypto_md.h" - -/* Load the crypto library (return NULL on error) */ -void * load_crypto_library(jboolean traceEnabled) { - void * result = NULL; - - const char *libname3 = "libcrypto.3.dylib"; - const char *libname = "libcrypto.1.1.dylib"; - const char *oldname = "libcrypto.1.0.0.dylib"; - const char *symlink = "libcrypto.dylib"; - - result = dlopen (libname3, RTLD_NOW); - if (result == NULL) { - result = dlopen (libname, RTLD_NOW); - if (result == NULL) { - result = dlopen (oldname, RTLD_NOW); - if (result == NULL) { - result = dlopen (symlink, RTLD_NOW); - } - } - } - - return result; -} - -/* Unload the crypto library */ -void unload_crypto_library(void *handle) { - (void)dlclose(handle); -} - -/* Find the symbol in the crypto library (return NULL if not found) */ -void * find_crypto_symbol(void *handle, const char *symname) { - return dlsym(handle, symname); -} diff --git a/closed/src/java.base/share/classes/jdk/crypto/jniprovider/NativeCrypto.java b/closed/src/java.base/share/classes/jdk/crypto/jniprovider/NativeCrypto.java index d2132df6398..423a97d6a6c 100644 --- a/closed/src/java.base/share/classes/jdk/crypto/jniprovider/NativeCrypto.java +++ b/closed/src/java.base/share/classes/jdk/crypto/jniprovider/NativeCrypto.java @@ -1,6 +1,6 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2018, 2024 All Rights Reserved + * (c) Copyright IBM Corp. 2018, 2025 All Rights Reserved * =========================================================================== * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ import jdk.internal.ref.CleanerFactory; import jdk.internal.reflect.Reflection; import jdk.internal.reflect.CallerSensitive; +import jdk.internal.util.StaticProperty; import sun.security.action.GetPropertyAction; @@ -81,16 +82,31 @@ private static final class InstanceHolder { private final boolean isOpenSSLFIPS; + @SuppressWarnings("restricted") private static long loadCryptoLibraries() { long osslVersion; try { - // load jncrypto JNI library + // Load jncrypto JNI library. System.loadLibrary("jncrypto"); - // load OpenSSL crypto library dynamically - osslVersion = loadCrypto(traceEnabled); - if (traceEnabled && (osslVersion != -1)) { - System.err.println("Native crypto library load succeeded - using native crypto library."); + + // Get user-specified OpenSSL library to use, if available. + String nativeLibName = + GetPropertyAction.privilegedGetProperty("jdk.native.openssl.lib", ""); + + // Get the JDK location. + String javaHome = StaticProperty.javaHome(); + + // Load OpenSSL crypto library dynamically. + osslVersion = loadCrypto(traceEnabled, nativeLibName, javaHome); + if (osslVersion != -1) { + if (traceEnabled) { + System.err.println("Native crypto library load succeeded - using native crypto library."); + } + } else { + if (!nativeLibName.isEmpty()) { + throw new RuntimeException(nativeLibName + " is not available, crypto libraries are not loaded"); + } } } catch (UnsatisfiedLinkError usle) { if (traceEnabled) { @@ -98,7 +114,7 @@ private static long loadCryptoLibraries() { System.err.println("Warning: Native crypto library load failed." + " Using Java crypto implementation."); } - // signal load failure + // Signal load failure. osslVersion = -1; } return osslVersion; @@ -253,14 +269,18 @@ public void run() { }); } - /* Native digest interfaces */ + /* OpenSSL utility interfaces */ - private static final native long loadCrypto(boolean trace); + private static final native long loadCrypto(boolean trace, + String libName, + String javaHome); public static final native boolean isMD5Available(); private static final native boolean isOpenSSLFIPS(); + /* Native digest interfaces */ + public final native long DigestCreateContext(long nativeBuffer, int algoIndex); diff --git a/closed/src/java.base/share/native/libjncrypto/NativeCrypto.c b/closed/src/java.base/share/native/libjncrypto/NativeCrypto.c index f37b70f2d94..c28822a0a68 100644 --- a/closed/src/java.base/share/native/libjncrypto/NativeCrypto.c +++ b/closed/src/java.base/share/native/libjncrypto/NativeCrypto.c @@ -1,6 +1,6 @@ /* * =========================================================================== - * (c) Copyright IBM Corp. 2018, 2024 All Rights Reserved + * (c) Copyright IBM Corp. 2018, 2025 All Rights Reserved * =========================================================================== * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,20 @@ * =========================================================================== */ +#if defined(_AIX) +#include +#include +#define DLFCN_LDINFO_SIZE (sizeof(struct ld_info) + _XOPEN_PATH_MAX + _XOPEN_NAME_MAX) +#elif defined(__APPLE__) /* defined(_AIX) */ +#include +#include +#elif defined(__linux__) /* defined(__APPLE__) */ +#include +#include +#elif defined(_WIN32) /* defined(__linux__) */ +#include +#endif /* defined(_AIX) */ + #include #include #include @@ -37,7 +51,6 @@ #include #include "jdk_crypto_jniprovider_NativeCrypto.h" -#include "NativeCrypto_md.h" #define OPENSSL_VERSION_CODE(major, minor, fix, patch) \ ((((jlong)(major)) << 28) | ((minor) << 20) | ((fix) << 12) | (patch)) @@ -56,7 +69,7 @@ #define OPENSSL_SAME_MODE (-1) /* needed for OpenSSL 1.0.2 Thread handling routines */ -# define CRYPTO_LOCK 1 +#define CRYPTO_LOCK 1 #if defined(WINDOWS) # include @@ -64,6 +77,11 @@ # include #endif /* defined(WINDOWS) */ +/* Header for NativeCrypto loading methods. */ +static void * find_crypto_symbol(void *handle, const char *symname); +static void * find_crypto_library(jboolean traceEnabled, const char *chomepath); +static void unload_crypto_library(void *handle); + /* Header for RSA algorithm using 1.0.2 OpenSSL. */ int OSSL102_RSA_set0_key(RSA *, BIGNUM *, BIGNUM *, BIGNUM *); int OSSL102_RSA_set0_factors(RSA *, BIGNUM *, BIGNUM *); @@ -71,15 +89,15 @@ int OSSL102_RSA_set0_crt_params(RSA *, BIGNUM *, BIGNUM *, BIGNUM *); /* Define literals from OpenSSL 1.1.x so that it compiles with OpenSSL 1.0.x. */ #ifndef EVP_CTRL_AEAD_GET_TAG -# define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG +#define EVP_CTRL_AEAD_GET_TAG EVP_CTRL_GCM_GET_TAG #endif #ifndef EVP_CTRL_AEAD_SET_IVLEN -# define EVP_CTRL_AEAD_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN +#define EVP_CTRL_AEAD_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN #endif #ifndef EVP_CTRL_AEAD_SET_TAG -# define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG +#define EVP_CTRL_AEAD_SET_TAG EVP_CTRL_GCM_SET_TAG #endif /* Whether loaded library is in FIPS mode. */ @@ -328,12 +346,12 @@ typedef struct OpenSSLMDContext { } OpenSSLMDContext; /* Handle errors from OpenSSL calls. */ -static void printErrors(void) { +static void printErrors(void) +{ unsigned long errCode = 0; fprintf(stderr, "An OpenSSL error occurred\n"); - while(0 != (errCode = (*OSSL_get_error)())) - { + while (0 != (errCode = (*OSSL_get_error)())) { char err_str[120]; (*OSSL_error_string_n)(errCode, err_str, (sizeof(err_str) / sizeof(char))); fprintf(stderr, "%s\n", err_str); @@ -380,30 +398,114 @@ JNIEXPORT jboolean JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_isOpenSSLFIP return OSSL_IS_FIPS; } -/* - * Class: jdk_crypto_jniprovider_NativeCrypto - * Method: loadCrypto - * Signature: (Z)J - */ -JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto - (JNIEnv *env, jclass thisObj, jboolean traceEnabled) +/* Unload the crypto library. */ +static void +unload_crypto_library(void *crypto_library) { - typedef const char* OSSL_version_t(int); +#if defined(_WIN32) + FreeLibrary(crypto_library); +#else /* defined(_WIN32) */ + (void)dlclose(crypto_library); +#endif /* defined(_WIN32) */ +} - /* Determine the version of OpenSSL. */ - OSSL_version_t* OSSL_version; - const char * openssl_version; - jlong ossl_ver = 0; +/* Find the symbol in the crypto library (return NULL if not found). */ +static void * +find_crypto_symbol(void *crypto_library, const char *symname) +{ +#if defined(_WIN32) + return GetProcAddress(crypto_library, symname); +#else /* defined(_WIN32) */ + return dlsym(crypto_library, symname); +#endif /* defined(_WIN32) */ +} - /* Load OpenSSL Crypto library */ - crypto_library = load_crypto_library(traceEnabled); - if (NULL == crypto_library) { - if (traceEnabled) { - fprintf(stderr, " :FAILED TO LOAD OPENSSL CRYPTO LIBRARY\n"); - fflush(stderr); +static void +log_crypto_library_path(jboolean traceEnabled, void *crypto_library, const char *message) +{ + if (traceEnabled && (NULL != crypto_library)) { +#if defined(_AIX) + int rc = 0; + /* Initialize the buffer with maximum size for L_GETINFO. */ + char *buffer = (char *)malloc(DLFCN_LDINFO_SIZE); + if (NULL == buffer) { + return; } - return -1; + /* Get the list of all object files loaded by this process. */ + rc = loadquery(L_GETINFO, buffer, DLFCN_LDINFO_SIZE); + + /* Parse the list of all object files and print the OPENSSL library path. */ + if (0 == rc) { + char *buf = buffer; + for (;;) { + struct ld_info *cur_info = (struct ld_info *)buf; + const char *path = cur_info->ldinfo_filename; + const char *member_name = path + strlen(cur_info->ldinfo_filename) + 1; + if (('\0' != *member_name) && (NULL != strstr(path, "/libcrypto"))) { + fprintf(stdout, "%s: %s(%s)\n", message, path, member_name); + fflush(stdout); + break; + } + if (0 == cur_info->ldinfo_next) { + break; + } + buf += cur_info->ldinfo_next; + } + } + free(buffer); +#elif defined(__APPLE__) /* defined(_AIX) */ + /* Since we know the image we want will always be near the end of the list, start there and go backwards. */ + uint32_t i = _dyld_image_count() - 1; + for (; i >= 0; i--) { + const char *image_name = _dyld_get_image_name(i); + void *probe_handle = NULL; + jboolean same_handle = JNI_FALSE; + if (NULL == image_name) { + continue; + } + + /* Why dlopen doesn't affect _dyld stuff: if an image is already loaded, it returns the existing handle. */ + probe_handle = dlopen(image_name, RTLD_LAZY); + if (NULL == probe_handle) { + continue; + } + if (crypto_library == probe_handle) { + same_handle = JNI_TRUE; + } + dlclose(probe_handle); + + if (same_handle) { + fprintf(stdout, "OpenSSL was loaded from - %s\n", image_name); + fflush(stdout); + break; + } + } +#elif defined(_WIN32) /* defined(__APPLE__) */ + char path[MAX_PATH]; + DWORD written = GetModuleFileName(crypto_library, path, MAX_PATH); + if (0 != written) { + fprintf(stdout, "OpenSSL was loaded from - %s\n", path); + fflush(stdout); + } +#else /* defined(_WIN32) */ + struct link_map *map = NULL; + int ret = dlinfo(crypto_library, RTLD_DI_LINKMAP, &map); + if ((0 == ret) && (NULL != map)) { + fprintf(stdout, "OpenSSL was loaded from - %s\n", map->l_name); + fflush(stdout); + } +#endif /* defined(_AIX) */ } +} + +/* Get the version for the crypto library. */ +static jlong +get_crypto_library_version(jboolean traceEnabled, void *crypto_library, const char *message) +{ + typedef const char *OSSL_version_t(int); + OSSL_version_t *OSSL_version = NULL; + const char *openssl_version = NULL; + jlong ossl_ver = 0; /* * Different symbols are used by OpenSSL with 1.0 and 1.1 and later. @@ -413,12 +515,12 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto */ OSSL_version = (OSSL_version_t*)find_crypto_symbol(crypto_library, "OpenSSL_version"); - if (NULL == OSSL_version) { + if (NULL == OSSL_version) { OSSL_version = (OSSL_version_t*)find_crypto_symbol(crypto_library, "SSLeay_version"); - if (NULL == OSSL_version) { + if (NULL == OSSL_version) { if (traceEnabled) { - fprintf(stderr, "Only OpenSSL 1.0.x, 1.1.x and 3.x are supported\n"); + fprintf(stderr, "Error loading OpenSSL: Error finding the OpenSSL version symbol in the crypto library\n"); fflush(stderr); } unload_crypto_library(crypto_library); @@ -430,7 +532,7 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto ossl_ver = extractVersionToJlong(openssl_version); if (!((OPENSSL_VERSION_1_0_0 <= ossl_ver) && (ossl_ver < OPENSSL_VERSION_1_1_0))) { if (traceEnabled) { - fprintf(stderr, "Unsupported OpenSSL version: %s\n", openssl_version); + fprintf(stderr, "Error loading OpenSSL: Incompatible OpenSSL version found: %s\n", openssl_version); fflush(stderr); } unload_crypto_library(crypto_library); @@ -442,11 +544,11 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto openssl_version = (*OSSL_version)(0); /* get OPENSSL_VERSION */ /* Ensure the OpenSSL version is "OpenSSL 1.1.x" or "OpenSSL 3.x.x". */ ossl_ver = extractVersionToJlong(openssl_version); - if (!((OPENSSL_VERSION_1_1_0 <= ossl_ver) && (ossl_ver < OPENSSL_VERSION_2_0_0)) - && !((OPENSSL_VERSION_3_0_0 <= ossl_ver) && (ossl_ver < OPENSSL_VERSION_4_0_0)) + if (!(((OPENSSL_VERSION_1_1_0 <= ossl_ver) && (ossl_ver < OPENSSL_VERSION_2_0_0)) + || ((OPENSSL_VERSION_3_0_0 <= ossl_ver) && (ossl_ver < OPENSSL_VERSION_4_0_0))) ) { if (traceEnabled) { - fprintf(stderr, "Unsupported OpenSSL version: %s\n", openssl_version); + fprintf(stderr, "Error loading OpenSSL: Incompatible OpenSSL version found: %s\n", openssl_version); fflush(stderr); } unload_crypto_library(crypto_library); @@ -455,11 +557,6 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto } } - if (traceEnabled) { - fprintf(stderr, "Supported OpenSSL version: %s\n", openssl_version); - fflush(stderr); - } - /* Check whether the loaded OpenSSL library is in FIPS mode. */ if (ossl_ver >= OPENSSL_VERSION_3_0_0) { typedef int OSSL_fipsmode_t(OSSL_LIB_CTX *); @@ -479,13 +576,302 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto } } + if (traceEnabled) { + fprintf(stdout, "%s: %s\n", message, openssl_version); + fflush(stdout); + } + + return ossl_ver; +} + +static void * +load_crypto_library(jboolean traceEnabled, const char *libName) +{ + void *result = NULL; + if ((NULL != libName) && ('\0' != *libName)) { +#if defined(_AIX) + int flags = RTLD_NOW; + if (NULL != strrchr(libName, '(')) { + flags |= RTLD_MEMBER; + } + result = dlopen(libName, flags); +#elif defined(_WIN32) /* defined(_AIX) */ + result = LoadLibrary(libName); +#else /* defined(_WIN32) */ + result = dlopen(libName, RTLD_NOW); +#endif /* defined(_AIX) */ + } + return result; +} + +/* Look for a crypto library in java.home or the system. + * NULL is returned when an appropriate crypto library + * cannot be found. + */ +static void * +find_crypto_library(jboolean traceEnabled, const char *chomepath) +{ + /* Library names for OpenSSL 1.1.1, 1.1.0 and symbolic links: + * It is important to preserve the order!!! + * + * Since there is no indication of the version of a symlink, + * they have to be loaded first, so as to compare with other + * available options. + * Note: On macOS 11 or later, loading the general symlink causes + * a fatal warning and associated abort by default, so it is + * omitted. + * + * The rest of the libraries are listed in descending order, + * which allows us to do two things: + * - Stop if a general symlink is loaded and we then find a + * specific version that is higher. + * - Stop immediately if a specific version is loaded, as + * anything after that will be a lower version. + */ + static const char * const libNames[] = { +#if defined(_AIX) + "libcrypto.a(libcrypto64.so)", /* general symlink library name from archive file */ + "libcrypto64.so", /* general symlink library name */ + "libcrypto.a(libcrypto.so)", /* general symlink library name from archive file */ + "libcrypto.so", /* general symlink library name */ + "libcrypto.a(libcrypto64.so.3)", /* 3.x library name from archive file */ + "libcrypto64.so.3", /* 3.x library name */ + "libcrypto.a(libcrypto.so.3)", /* 3.x library name from archive file */ + "libcrypto.so.3", /* 3.x library name */ + "libcrypto.a(libcrypto64.so.1.1)", /* 1.1.x library name from archive file */ + "libcrypto.so.1.1", /* 1.1.x library name */ + "libcrypto.a(libcrypto.so.1.0.0)", /* 1.0.x library name from archive file */ + "libcrypto.so.1.0.0", /* 1.0.x library name */ +#elif defined(__APPLE__) /* defined(_AIX) */ + "libcrypto.3.dylib", /* 3.x library name */ + "libcrypto.1.1.dylib", /* 1.1.x library name */ + "libcrypto.1.0.0.dylib", /* 1.0.x library name */ +#elif defined(_WIN32) /* defined(__APPLE__) */ + "libcrypto-3-x64.dll", /* 3.x library name */ + "libcrypto-1_1-x64.dll", /* 1.1.x library name */ + "libeay32.dll", /* old library name */ +#else /* defined(_WIN32) */ + "libcrypto.so", /* general symlink library name */ + "libcrypto.so.3", /* 3.x library name */ + "libcrypto.so.1.1", /* 1.1.x library name */ + "libcrypto.so.1.0.0", /* 1.0.x library name */ + "libcrypto.so.10", /* old library name */ +#endif /* defined(_AIX) */ + }; + + const size_t numOfLibs = sizeof(libNames) / sizeof(libNames[0]); +#if defined(_AIX) + const size_t num_of_generic = 4; +#elif defined(__linux__) /* defined(_AIX) */ + const size_t num_of_generic = 1; +#else /* defined(__linux__) */ + const size_t num_of_generic = 0; +#endif /* defined(_AIX) */ + + void *result = NULL; + void *prevResult = NULL; + size_t i = 0; + long tempVersion = 0; + long previousVersion = 0; + + /* If JAVA_HOME is not null or empty and no library has been loaded yet, try there. */ + if ((NULL != chomepath) && ('\0' != *chomepath) && (NULL == crypto_library)) { +#if defined(_WIN32) + static const char pathSuffix[] = "\\bin\\"; +#else /* defined(_WIN32) */ + static const char pathSuffix[] = "/lib/"; +#endif /* defined(_WIN32) */ + + size_t path_len = strlen(chomepath) + sizeof(pathSuffix) - 1; + char *libPath = malloc(path_len + 1); + + if (NULL == libPath) { + if (traceEnabled) { + fprintf(stderr, "\tFailed to allocate memory for path.\n"); + } + return NULL; + } + strcpy(libPath, chomepath); + + /* Append the proper directory using a slash or backslash, depending on the operating system. */ + strcat(libPath, pathSuffix); + + if (traceEnabled) { + fprintf(stdout, "Attempting to load library bundled with JDK from: %s\n", libPath); + } + + for (i = 0; i < numOfLibs; i++) { + size_t file_len = strlen(libNames[i]); + /* Allocate memory for the new file name with the path. */ + char *libNameWithPath = (char *)malloc(path_len + file_len + 1); + + if (NULL == libNameWithPath) { + if (traceEnabled) { + fprintf(stderr, "\tFailed to allocate memory for file name with path.\n"); + } + continue; + } + + strcpy(libNameWithPath, libPath); + strcat(libNameWithPath, libNames[i]); + + /* Load OpenSSL Crypto library bundled with JDK. */ + if (traceEnabled) { + fprintf(stdout, "\tAttempting to load: %s\n", libNames[i]); + } + result = load_crypto_library(traceEnabled, libNameWithPath); + + free(libNameWithPath); + + if (NULL == result) { + continue; + } + + /* Identify and load the latest version from the potential libraries. + * This logic depends upon the order in which libnames are defined. + * Libraries are listed in descending order w.r.t version. + * Since only one library is bundled with the JDK, once any library is + * loaded, this is the only available and we can stop. + */ + tempVersion = get_crypto_library_version(traceEnabled, result, "\t\tLoaded OpenSSL version"); + if (tempVersion > 0) { + free(libPath); + return result; + } + } + free(libPath); + } + + /* The attempt to load from property and OpenSSL bundled with JDK failed. + * Try loading the libraries in the order set out above, and retain the latest library. + */ + for (i = 0; i < numOfLibs; i++) { + if (traceEnabled) { + fprintf(stdout, "Attempting to load libname from OS: %s\n", libNames[i]); + } + result = load_crypto_library(traceEnabled, libNames[i]); + + if (NULL == result) { + continue; + } + + /* Identify and load the latest version from the available libraries. + * This logic depends upon the order in which libnames are defined. + * It only loads the libraries which can possibly be the latest versions. + */ + log_crypto_library_path(traceEnabled, result, "\tLibrary to be potentially used was loaded from"); + tempVersion = get_crypto_library_version(traceEnabled, result, "\tLoaded OpenSSL version"); + + if (tempVersion <= 0) { + continue; + } + + if (tempVersion > previousVersion) { + if (0 != previousVersion) { + unload_crypto_library(prevResult); + } + previousVersion = tempVersion; + prevResult = result; + } else { + unload_crypto_library(result); + } + + /* If library checked is not a generic one, there is no need to check further. */ + if (i >= num_of_generic) { + break; + } + } + + /* If we reach here, it means that none of the non-generic libraries + * where found. However, a generic one might have been found in the + * process and, if so, it will be in the prevResult variable. + */ + return prevResult; +} + +/* + * Class: jdk_crypto_jniprovider_NativeCrypto + * Method: loadCrypto + * Signature: (ZLjava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto + (JNIEnv * env, jobject jobj, jboolean traceEnabled, jstring jlibname, jstring jhomepath) +{ + const char *chomepath = ""; + jlong ossl_ver = 0; + + if (NULL != jlibname) { + const char *clibname = (*env)->GetStringUTFChars(env, jlibname, NULL); + if (NULL == clibname) { + if (traceEnabled) { + fprintf(stderr, "Failed to get jdk.native.openssl.lib value.\n"); + fflush(stderr); + } + return -1; + } + if ('\0' == clibname[0]) { + if (traceEnabled) { + fprintf(stderr, "The jdk.native.openssl.lib property is not set.\n"); + fflush(stderr); + } + } else { + crypto_library = load_crypto_library(traceEnabled, clibname); + if (NULL == crypto_library) { + if (traceEnabled) { + fprintf(stderr, "OpenSSL library specified in jdk.openssl.lib couldn't be loaded.\n"); + fflush(stderr); + } + (*env)->ReleaseStringUTFChars(env, jlibname, clibname); + return -1; + } + } + (*env)->ReleaseStringUTFChars(env, jlibname, clibname); + } + + if (NULL != jhomepath) { + chomepath = (*env)->GetStringUTFChars(env, jhomepath, NULL); + if (NULL == chomepath) { + if (traceEnabled) { + fprintf(stderr, "Failed to get java.home value.\n"); + fflush(stderr); + } + return -1; + } + } + + /* If the jdk.native.openssl.lib property was not set, attempt + * to find an OpenSSL library from java.home or OS Library path. + */ + if (NULL == crypto_library) { + crypto_library = find_crypto_library(traceEnabled, chomepath); + } + + if (NULL != jhomepath) { + (*env)->ReleaseStringUTFChars(env, jhomepath, chomepath); + } + + /* If an OpenSSL library was not loaded from any of the potential + * sources, fail loading native crypto. + */ + if (NULL == crypto_library) { + if (traceEnabled) { + fprintf(stderr, "FAILED TO LOAD OPENSSL CRYPTO LIBRARY\n"); + fflush(stderr); + } + return -1; + } + + log_crypto_library_path(traceEnabled, crypto_library, "OpenSSL to be used was loaded from"); + ossl_ver = get_crypto_library_version(traceEnabled, crypto_library, "Version of OpenSSL library that is used"); + /* Load the function symbols for OpenSSL errors. */ OSSL_error_string_n = (OSSL_error_string_n_t*)find_crypto_symbol(crypto_library, "ERR_error_string_n"); OSSL_error_string = (OSSL_error_string_t*)find_crypto_symbol(crypto_library, "ERR_error_string"); OSSL_get_error = (OSSL_get_error_t*)find_crypto_symbol(crypto_library, "ERR_get_error"); - /* Load Threading routines for OpenSSL 1.0.2 */ - if(ossl_ver < OPENSSL_VERSION_1_1_0) { + /* Load Threading routines for OpenSSL 1.0.2. */ + if (ossl_ver < OPENSSL_VERSION_1_1_0) { OSSL_CRYPTO_num_locks = (OSSL_CRYPTO_num_locks_t*)find_crypto_symbol(crypto_library, "CRYPTO_num_locks"); OSSL_CRYPTO_THREADID_set_numeric = (OSSL_CRYPTO_THREADID_set_numeric_t*)find_crypto_symbol(crypto_library, "CRYPTO_THREADID_set_numeric"); OSSL_OPENSSL_malloc = (OSSL_OPENSSL_malloc_t*)find_crypto_symbol(crypto_library, "CRYPTO_malloc"); @@ -502,7 +888,7 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto OSSL_sha384 = (OSSL_sha_t*)find_crypto_symbol(crypto_library, "EVP_sha384"); OSSL_sha512 = (OSSL_sha_t*)find_crypto_symbol(crypto_library, "EVP_sha512"); - if(ossl_ver >= OPENSSL_VERSION_1_1_0) { + if (ossl_ver >= OPENSSL_VERSION_1_1_0) { OSSL_MD_CTX_new = (OSSL_MD_CTX_new_t*)find_crypto_symbol(crypto_library, "EVP_MD_CTX_new"); OSSL_MD_CTX_reset = (OSSL_MD_CTX_reset_t*)find_crypto_symbol(crypto_library, "EVP_MD_CTX_reset"); OSSL_MD_CTX_free = (OSSL_MD_CTX_free_t*)find_crypto_symbol(crypto_library, "EVP_MD_CTX_free"); @@ -536,7 +922,7 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto OSSL_DecryptFinal = (OSSL_DecryptFinal_t*)find_crypto_symbol(crypto_library, "EVP_DecryptFinal"); /* Load the functions symbols for OpenSSL ChaCha20 algorithms. (Need OpenSSL 1.1.x or above) */ - if(ossl_ver >= OPENSSL_VERSION_1_1_0) { + if (ossl_ver >= OPENSSL_VERSION_1_1_0) { OSSL_chacha20 = (OSSL_cipher_t*)find_crypto_symbol(crypto_library, "EVP_chacha20"); OSSL_chacha20_poly1305 = (OSSL_cipher_t*)find_crypto_symbol(crypto_library, "EVP_chacha20_poly1305"); } else { @@ -547,7 +933,7 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto /* Load the functions symbols for OpenSSL RSA algorithm. */ OSSL_RSA_new = (OSSL_RSA_new_t*)find_crypto_symbol(crypto_library, "RSA_new"); - if(ossl_ver >= OPENSSL_VERSION_1_1_0) { + if (ossl_ver >= OPENSSL_VERSION_1_1_0) { OSSL_RSA_set0_key = (OSSL_RSA_set0_key_t*)find_crypto_symbol(crypto_library, "RSA_set0_key"); OSSL_RSA_set0_factors = (OSSL_RSA_set0_factors_t*)find_crypto_symbol(crypto_library, "RSA_set0_factors"); OSSL_RSA_set0_crt_params = (OSSL_RSA_set0_key_t*)find_crypto_symbol(crypto_library, "RSA_set0_crt_params"); @@ -768,19 +1154,26 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_loadCrypto ((NULL == OSSL_CRYPTO_THREADID_set_callback) && (ossl_ver < OPENSSL_VERSION_1_1_0)) || ((NULL == OSSL_CRYPTO_set_locking_callback) && (ossl_ver < OPENSSL_VERSION_1_1_0)) ) { - /* fprintf(stderr, "One or more of the required symbols are missing in the crypto library\n"); */ - /* fflush(stderr); */ + if (traceEnabled) { + fprintf(stderr, "Error loading OpenSSL: One or more of the required symbols are missing."); + } unload_crypto_library(crypto_library); crypto_library = NULL; return -1; } else { - if(ossl_ver < OPENSSL_VERSION_1_1_0) { + if (ossl_ver < OPENSSL_VERSION_1_1_0) { if (0 != thread_setup()) { + if (traceEnabled) { + fprintf(stderr, "Error loading OpenSSL: Thread setup was unsuccessful."); + } unload_crypto_library(crypto_library); crypto_library = NULL; return -1; } } + if (traceEnabled) { + fprintf(stderr, "OpenSSL library loaded successfully.\n"); + } return ossl_ver; } } @@ -943,8 +1336,8 @@ JNIEXPORT jboolean JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_isMD5Availab * Signature: (JI)J */ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestCreateContext - (JNIEnv *env, jclass thisObj, jlong copyContext, jint algoIdx) { - + (JNIEnv *env, jclass thisObj, jlong copyContext, jint algoIdx) +{ EVP_MD_CTX *ctx = NULL; const EVP_MD *digestAlg = NULL; OpenSSLMDContext *context = NULL; @@ -1031,8 +1424,8 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestCreateCon * Signature: (J)I */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestDestroyContext - (JNIEnv *env, jclass thisObj, jlong c) { - + (JNIEnv *env, jclass thisObj, jlong c) +{ OpenSSLMDContext *context = (OpenSSLMDContext*)(intptr_t) c; if (NULL == context) { return -1; @@ -1060,8 +1453,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestDestroyCon */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestUpdate (JNIEnv *env, jclass thisObj, jlong c, jbyteArray message, jint messageOffset, - jint messageLen) { - + jint messageLen) +{ OpenSSLMDContext *context = (OpenSSLMDContext*)(intptr_t) c; unsigned char* messageNative = NULL; @@ -1096,8 +1489,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestUpdate */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestComputeAndReset (JNIEnv *env, jclass thisObj, jlong c, jbyteArray message, jint messageOffset, jint messageLen, - jbyteArray digest, jint digestOffset, jint digestLen) { - + jbyteArray digest, jint digestOffset, jint digestLen) +{ OpenSSLMDContext *context = (OpenSSLMDContext*)(intptr_t) c; unsigned int size = 0; @@ -1166,8 +1559,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestComputeAnd * Signature: (J)I */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestReset - (JNIEnv *env, jclass thisObj, jlong c) { - + (JNIEnv *env, jclass thisObj, jlong c) +{ OpenSSLMDContext *context = (OpenSSLMDContext*)(intptr_t) c; if ((NULL == context) || (NULL == context->ctx) || (NULL == context->cachedInitializedDigestContext)) { @@ -1203,8 +1596,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DigestReset * Signature: ()J */ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_CreateContext - (JNIEnv *env, jclass thisObj) { - + (JNIEnv *env, jclass thisObj) +{ EVP_CIPHER_CTX *ctx = NULL; /* Create and initialise the context */ @@ -1222,8 +1615,8 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_CreateContext * Signature: (J)I */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DestroyContext - (JNIEnv *env, jclass thisObj, jlong c) { - + (JNIEnv *env, jclass thisObj, jlong c) +{ EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX*)(intptr_t) c; if (NULL == ctx) { return -1; @@ -1241,8 +1634,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_DestroyContext */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_CBCInit (JNIEnv *env, jclass thisObj, jlong c, jint mode, jbyteArray iv, jint iv_len, - jbyteArray key, jint key_len, jboolean doReset) { - + jbyteArray key, jint key_len, jboolean doReset) +{ EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX*)(intptr_t) c; unsigned char* ivNative = NULL; unsigned char* keyNative = NULL; @@ -1303,8 +1696,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_CBCInit */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_CBCUpdate (JNIEnv *env, jclass thisObj, jlong c, jbyteArray input, jint inputOffset, jint inputLen, - jbyteArray output, jint outputOffset) { - + jbyteArray output, jint outputOffset) +{ EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX*)(intptr_t) c; int outputLen = 0; @@ -1348,8 +1741,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_CBCUpdate */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_CBCFinalEncrypt (JNIEnv *env, jclass thisObj, jlong c, jbyteArray input, jint inputOffset, jint inputLen, - jbyteArray output, jint outputOffset) { - + jbyteArray output, jint outputOffset) +{ EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX*)(intptr_t) c; if (NULL == ctx) { @@ -1634,7 +2027,7 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_GCMDecrypt } if (inLen - tagLen > 0) { - if(0 == (*OSSL_DecryptUpdate)(ctx, outputNative + outOffset, &len, inputNative + inOffset, inLen - tagLen)) { + if (0 == (*OSSL_DecryptUpdate)(ctx, outputNative + outOffset, &len, inputNative + inOffset, inLen - tagLen)) { printErrors(); goto cleanup; } @@ -1685,8 +2078,8 @@ BIGNUM* convertJavaBItoBN(unsigned char* in, int len); * Signature: ([BI[BI)J */ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_createRSAPublicKey - (JNIEnv *env, jclass obj, jbyteArray n, jint nLen, jbyteArray e, jint eLen) { - + (JNIEnv *env, jclass obj, jbyteArray n, jint nLen, jbyteArray e, jint eLen) +{ unsigned char* nNative = NULL; unsigned char* eNative = NULL; RSA* publicRSAKey = NULL; @@ -1736,7 +2129,8 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_createRSAPublic * Signature: ([BI[BI[BI[BI[BI[BI[BI[BI)J */ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_createRSAPrivateCrtKey - (JNIEnv *env, jclass obj, jbyteArray n, jint nLen, jbyteArray d, jint dLen, jbyteArray e, jint eLen, jbyteArray p, jint pLen, jbyteArray q, jint qLen, jbyteArray dp, jint dpLen, jbyteArray dq, jint dqLen, jbyteArray qinv, jint qinvLen) { + (JNIEnv *env, jclass obj, jbyteArray n, jint nLen, jbyteArray d, jint dLen, jbyteArray e, jint eLen, jbyteArray p, jint pLen, jbyteArray q, jint qLen, jbyteArray dp, jint dpLen, jbyteArray dq, jint dqLen, jbyteArray qinv, jint qinvLen) +{ unsigned char* nNative = NULL; unsigned char* dNative = NULL; unsigned char* eNative = NULL; @@ -1903,7 +2297,8 @@ JNIEXPORT jlong JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_createRSAPrivat * Signature: (J)V */ JNIEXPORT void JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_destroyRSAKey - (JNIEnv *env, jclass obj, jlong rsaKey) { + (JNIEnv *env, jclass obj, jlong rsaKey) +{ RSA* rsaKey2 = (RSA*)(intptr_t)rsaKey; if (NULL != rsaKey2) { (*OSSL_RSA_free)(rsaKey2); @@ -1918,8 +2313,8 @@ JNIEXPORT void JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_destroyRSAKey * Signature: ([BI[BJ)I */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_RSAEP - (JNIEnv *env, jclass obj, jbyteArray k, jint kLen, jbyteArray m, jlong publicRSAKey) { - + (JNIEnv *env, jclass obj, jbyteArray k, jint kLen, jbyteArray m, jlong publicRSAKey) +{ unsigned char* kNative = NULL; unsigned char* mNative = NULL; RSA* rsaKey = NULL; @@ -1955,8 +2350,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_RSAEP * Signature: ([BI[BIJ)I */ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_RSADP - (JNIEnv *env, jclass obj, jbyteArray k, jint kLen, jbyteArray m, jint verify, jlong privateRSAKey) { - + (JNIEnv *env, jclass obj, jbyteArray k, jint kLen, jbyteArray m, jint verify, jlong privateRSAKey) +{ unsigned char* kNative = NULL; unsigned char* mNative = NULL; int msg_len = 0; @@ -2007,7 +2402,7 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_RSADP } } } - } else { // if verify == kLen + } else { /* if verify == kLen */ for (i = 0; i < verify; i++) { if (kNative[i] != k2[i]) { msg_len = -2; @@ -2037,7 +2432,8 @@ JNIEXPORT jint JNICALL Java_jdk_crypto_jniprovider_NativeCrypto_RSADP * Converts 2's complement representation of a big integer * into an OpenSSL BIGNUM */ -BIGNUM* convertJavaBItoBN(unsigned char* in, int len) { +BIGNUM* convertJavaBItoBN(unsigned char* in, int len) +{ /* first bit is neg */ int neg = (in[0] & 0x80); int c = 1; /* carry bit */ @@ -2522,7 +2918,7 @@ Java_jdk_crypto_jniprovider_NativeCrypto_ECGenerateKeyPair goto cleanup; } - // to translate the public key to java format, we need to extract the public key coordinates: xBN, yBN + /* to translate the public key to java format, we need to extract the public key coordinates: xBN, yBN */ ctx = (*OSSL_BN_CTX_new)(); if (NULL == ctx) { goto cleanup; @@ -2554,7 +2950,7 @@ Java_jdk_crypto_jniprovider_NativeCrypto_ECGenerateKeyPair goto cleanup; } - // to translate the private key to java format, we need the private key BIGNUM + /* to translate the private key to java format, we need the private key BIGNUM */ sBN = (*OSSL_EC_KEY_get0_private_key)(nativeKey); ret = getArrayFromBN(sBN, nativeS, sLen); @@ -3269,13 +3665,13 @@ Java_jdk_crypto_jniprovider_NativeCrypto_ECDSAVerify } if (NULL != signature) { - // The BIGNUM structs will be freed by the signature. + /* The BIGNUM structs will be freed by the signature. */ sBN = NULL; rBN = NULL; (*OSSL_ECDSA_SIG_free)(signature); } - // In case the BIGNUM structs weren't freed by the signature. + /* In case the BIGNUM structs weren't freed by the signature. */ if (NULL != sBN) { (*OSSL_BN_free)(sBN); } @@ -3311,7 +3707,7 @@ Java_jdk_crypto_jniprovider_NativeCrypto_XDHCreateKeys unsigned char *privateKeyArray = NULL; unsigned char *publicKeyArray = NULL; - // Create PKEY (public/private pair) based on curve type (X25519 or X448) + /* Create PKEY (public/private pair) based on curve type (X25519 or X448). */ pctx = (*OSSL_EVP_PKEY_CTX_new_id)(curveType, NULL); if (NULL == pctx) { @@ -3325,7 +3721,7 @@ Java_jdk_crypto_jniprovider_NativeCrypto_XDHCreateKeys goto cleanup; } - // Separate private and public and store into arrays + /* Separate private and public and store into arrays. */ privateKeyArray = (unsigned char *)((*env)->GetPrimitiveArrayCritical(env, privateKey, 0)); if (NULL == privateKeyArray) { goto cleanup; @@ -3394,7 +3790,7 @@ Java_jdk_crypto_jniprovider_NativeCrypto_XDHGenerateSecret goto cleanup; } - // Setup EVP_PKEY instances for user private and peer public keys + /* Setup EVP_PKEY instances for user private and peer public keys. */ pkey = (*OSSL_EVP_PKEY_new_raw_private_key)(curveType, NULL, privateKeyArray, privateKey_len); peerkey = (*OSSL_EVP_PKEY_new_raw_public_key)(curveType, NULL, publicKeyArray, publicKey_len); @@ -3402,23 +3798,23 @@ Java_jdk_crypto_jniprovider_NativeCrypto_XDHGenerateSecret goto cleanup; } - // Create key agreement context + /* Create key agreement context. */ pctx = (*OSSL_EVP_PKEY_CTX_new)(pkey, NULL); if (NULL == pctx) { goto cleanup; } - // Initialize with user private key + /* Initialize with user private key. */ if (0 >= (*OSSL_EVP_PKEY_derive_init)(pctx)) { goto cleanup; } - // Set peer's public key + /* Set peer's public key. */ if (0 >= (*OSSL_EVP_PKEY_derive_set_peer)(pctx, peerkey)) { goto cleanup; } - // Derive shared secret and save in sharedKeyArray + /* Derive shared secret and save in sharedKeyArray. */ sharedKeyArray = (unsigned char *)((*env)->GetPrimitiveArrayCritical(env, sharedKey, 0)); if (NULL == sharedKeyArray) { goto cleanup; diff --git a/closed/src/java.base/share/native/libjncrypto/NativeCrypto_md.h b/closed/src/java.base/share/native/libjncrypto/NativeCrypto_md.h deleted file mode 100644 index 4cf9edc0da4..00000000000 --- a/closed/src/java.base/share/native/libjncrypto/NativeCrypto_md.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * =========================================================================== - * (c) Copyright IBM Corp. 2019, 2022 All Rights Reserved - * =========================================================================== - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * IBM designates this particular file as subject to the "Classpath" exception - * as provided by IBM 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, see . - * - * =========================================================================== - */ - -#ifndef NATIVECRYPTO_MD_H -#define NATIVECRYPTO_MD_H - -#include - -void * load_crypto_library(jboolean traceEnabled); -void unload_crypto_library(void *handle); -void * find_crypto_symbol(void *handle, const char *symname); - -#endif /* NATIVECRYPTO_MD_H */ diff --git a/closed/src/java.base/unix/native/libjncrypto/NativeCrypto_md.c b/closed/src/java.base/unix/native/libjncrypto/NativeCrypto_md.c deleted file mode 100644 index 8258c1864d8..00000000000 --- a/closed/src/java.base/unix/native/libjncrypto/NativeCrypto_md.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * =========================================================================== - * (c) Copyright IBM Corp. 2019, 2022 All Rights Reserved - * =========================================================================== - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * IBM designates this particular file as subject to the "Classpath" exception - * as provided by IBM 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, see . - * - * =========================================================================== - */ - -#include -#include -#include -#include -#include -#include -#include "NativeCrypto_md.h" - -/* Load the crypto library (return NULL on error) */ -void * load_crypto_library(jboolean traceEnabled) -{ - void * result = NULL; - size_t i = 0; - - // Library names for OpenSSL 3.x, 1.1.1, 1.1.0, 1.0.2 and symbolic links - static const char * const libNames[] = { - "libcrypto.so.3", // 3.x library name - "libcrypto.so.1.1", // 1.1.x library name - "libcrypto.so.1.0.0", // 1.0.x library name - "libcrypto.so.10", // 1.0.x library name on RHEL - "libcrypto.so" // general symlink library name - }; - - // Check to see if we can load the libraries in the order set out above - for (i = 0; (NULL == result) && (i < sizeof(libNames) / sizeof(libNames[0])); i++) { - const char * libName = libNames[i]; - - // Check to see if we can load the library - result = dlopen (libName, RTLD_NOW); - } - - if (traceEnabled && (NULL != result)) { - struct link_map *map = NULL; - dlinfo(result, RTLD_DI_LINKMAP, &map); - fprintf(stderr, "Attempt to load OpenSSL %s\n", map->l_name); - fflush(stderr); - } - return result; -} - -/* Unload the crypto library */ -void unload_crypto_library(void *handle) { - (void)dlclose(handle); -} - -/* Find the symbol in the crypto library (return NULL if not found) */ -void * find_crypto_symbol(void *handle, const char *symname) { - return dlsym(handle, symname); -} diff --git a/closed/src/java.base/windows/native/libjncrypto/NativeCrypto_md.c b/closed/src/java.base/windows/native/libjncrypto/NativeCrypto_md.c deleted file mode 100644 index 26b47d4c870..00000000000 --- a/closed/src/java.base/windows/native/libjncrypto/NativeCrypto_md.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * =========================================================================== - * (c) Copyright IBM Corp. 2019, 2023 All Rights Reserved - * =========================================================================== - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * IBM designates this particular file as subject to the "Classpath" exception - * as provided by IBM 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, see . - * - * =========================================================================== - */ - -#include - -#include "NativeCrypto_md.h" - -/* Load the crypto library (return NULL on error) */ -void * load_crypto_library(jboolean traceEnabled) { - void * result = NULL; - const char *libname3 = "libcrypto-3-x64.dll"; - const char *libname = "libcrypto-1_1-x64.dll"; - const char *oldname = "libeay32.dll"; - - result = LoadLibrary(libname3); - if (result == NULL) { - result = LoadLibrary(libname); - if (result == NULL) { - result = LoadLibrary(oldname); - } - } - - return result; -} - -/* Unload the crypto library */ -void unload_crypto_library(void *handle) { - FreeLibrary(handle); -} - -/* Find the symbol in the crypto library (return NULL if not found) */ -void * find_crypto_symbol(void *handle, const char *symname) { - void * symptr; - - symptr = GetProcAddress(handle, symname); - - return symptr; -} diff --git a/make/autoconf/version-numbers b/make/autoconf/version-numbers index d723ce0ae09..3c78c31486e 100644 --- a/make/autoconf/version-numbers +++ b/make/autoconf/version-numbers @@ -28,16 +28,16 @@ DEFAULT_VERSION_FEATURE=11 DEFAULT_VERSION_INTERIM=0 -DEFAULT_VERSION_UPDATE=26 +DEFAULT_VERSION_UPDATE=27 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2025-01-21 +DEFAULT_VERSION_DATE=2025-04-15 DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11" -DEFAULT_PROMOTED_VERSION_PRE= +DEFAULT_PROMOTED_VERSION_PRE=ea LAUNCHER_NAME=openjdk PRODUCT_NAME=OpenJDK diff --git a/make/data/lsrdata/language-subtag-registry.txt b/make/data/lsrdata/language-subtag-registry.txt index 3079d77ed8b..b00ea67e7e8 100644 --- a/make/data/lsrdata/language-subtag-registry.txt +++ b/make/data/lsrdata/language-subtag-registry.txt @@ -1,4 +1,4 @@ -File-Date: 2024-06-14 +File-Date: 2024-11-19 %% Type: language Subtag: aa @@ -47991,6 +47991,16 @@ Added: 2008-10-14 Prefix: kw %% Type: variant +Subtag: kleinsch +Description: Kleinschmidt orthography +Description: Allattaasitaamut +Added: 2024-07-20 +Prefix: kl +Prefix: kl-tunumiit +Comments: Orthography for Greenlandic designed by Samuel Kleinschmidt, + used from 1851 to 1973. +%% +Type: variant Subtag: kociewie Description: The Kociewie dialect of Polish Added: 2014-11-27 diff --git a/src/java.base/windows/native/libjava/java_props_md.c b/src/java.base/windows/native/libjava/java_props_md.c index 340b2b0a56d..2362bd74670 100644 --- a/src/java.base/windows/native/libjava/java_props_md.c +++ b/src/java.base/windows/native/libjava/java_props_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -487,6 +487,8 @@ GetJavaProperties(JNIEnv* env) * where (buildNumber > 17762) * Windows Server 2022 10 0 (!VER_NT_WORKSTATION) * where (buildNumber > 20347) + * Windows Server 2025 10 0 (!VER_NT_WORKSTATION) + * where (buildNumber > 26039) * * This mapping will presumably be augmented as new Windows * versions are released. @@ -570,7 +572,10 @@ GetJavaProperties(JNIEnv* env) case 0: /* Windows server 2019 GA 10/2018 build number is 17763 */ /* Windows server 2022 build number is 20348 */ - if (buildNumber > 20347) { + /* Windows server 2025 Preview build is 26040 */ + if (buildNumber > 26039) { + sprops.os_name = "Windows Server 2025"; + } else if (buildNumber > 20347) { sprops.os_name = "Windows Server 2022"; } else if (buildNumber > 17676) { sprops.os_name = "Windows Server 2019"; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m index 1bf9feda7f4..387314bfbbb 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m @@ -39,6 +39,9 @@ // keyboard layout static NSString *kbdLayout; +// Constant for keyman layouts +#define KEYMAN_LAYOUT "keyman" + @interface AWTView() @property (retain) CDropTarget *_dropTarget; @property (retain) CDragSource *_dragSource; @@ -281,7 +284,7 @@ - (void) scrollWheel: (NSEvent*) event { - (void) keyDown: (NSEvent *)event { fProcessingKeystroke = YES; - fKeyEventsNeeded = YES; + fKeyEventsNeeded = ![(NSString *)kbdLayout containsString:@KEYMAN_LAYOUT]; // Allow TSM to look at the event and potentially send back NSTextInputClient messages. [self interpretKeyEvents:[NSArray arrayWithObject:event]]; @@ -989,7 +992,7 @@ - (void) insertText:(id)aString replacementRange:(NSRange)replacementRange if ((utf16Length > 2) || ((utf8Length > 1) && [self isCodePointInUnicodeBlockNeedingIMEvent:codePoint]) || - ((codePoint == 0x5c) && ([(NSString *)kbdLayout containsString:@"Kotoeri"]))) { + [(NSString *)kbdLayout containsString:@KEYMAN_LAYOUT]) { aStringIsComplex = YES; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java index 4ade741a590..ecb63fcd2c1 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java @@ -140,25 +140,6 @@ private List collect(JCTree tree, List res) { return res.append(tree); } - /** - * If the type is not accessible from current context, try to figure out the - * sharpest accessible supertype. - * - * @param originalType type to sharpen - * @return sharped type - */ - Type sharpestAccessible(Type originalType) { - if (originalType.hasTag(ARRAY)) { - return types.makeArrayType(sharpestAccessible(types.elemtype(originalType))); - } - - Type type = originalType; - while (!rs.isAccessible(gen.getAttrEnv(), type.asElement())) { - type = types.supertype(type); - } - return type; - } - /** * "Legacy" bytecode flavor: emit the StringBuilder.append chains for string * concatenation. @@ -303,6 +284,14 @@ protected List> split(List args) { return splits.toList(); } + + /** + * Returns true if the argument should be converted to a string eagerly, to preserve + * possible side-effects. + */ + protected boolean shouldConvertToStringEagerly(Type argType) { + return !types.unboxedTypeOrType(argType).isPrimitive() && argType.tsym != syms.stringType.tsym; + } } /** @@ -331,14 +320,18 @@ protected void emit(JCDiagnostic.DiagnosticPosition pos, List args, bool for (JCTree arg : t) { Object constVal = arg.type.constValue(); if ("".equals(constVal)) continue; - if (arg.type == syms.botType) { - dynamicArgs.add(types.boxedClass(syms.voidType).type); - } else { - dynamicArgs.add(sharpestAccessible(arg.type)); + Type argType = arg.type; + if (argType == syms.botType) { + argType = types.boxedClass(syms.voidType).type; } if (!first || generateFirstArg) { gen.genExpr(arg, arg.type).load(); } + if (shouldConvertToStringEagerly(argType)) { + gen.callMethod(pos, syms.stringType, names.valueOf, List.of(syms.objectType), true); + argType = syms.stringType; + } + dynamicArgs.add(argType); first = false; } doCall(type, pos, dynamicArgs.toList()); @@ -438,10 +431,15 @@ protected void emit(JCDiagnostic.DiagnosticPosition pos, List args, bool } else { // Ordinary arguments come through the dynamic arguments. recipe.append(TAG_ARG); - dynamicArgs.add(sharpestAccessible(arg.type)); + Type argType = arg.type; if (!first || generateFirstArg) { gen.genExpr(arg, arg.type).load(); } + if (shouldConvertToStringEagerly(argType)) { + gen.callMethod(pos, syms.stringType, names.valueOf, List.of(syms.objectType), true); + argType = syms.stringType; + } + dynamicArgs.add(argType); first = false; } } diff --git a/test/hotspot/jtreg/runtime/modules/AccessCheck/MethodAccessReadTwice.java b/test/hotspot/jtreg/runtime/modules/AccessCheck/MethodAccessReadTwice.java index 29bbe7f39b0..d6b85ced257 100644 --- a/test/hotspot/jtreg/runtime/modules/AccessCheck/MethodAccessReadTwice.java +++ b/test/hotspot/jtreg/runtime/modules/AccessCheck/MethodAccessReadTwice.java @@ -29,8 +29,8 @@ * after the module read edge is added. * @compile ModuleLibrary.java * p2/c2.java - * p5/c5.java - * p7/c7.java + * p5/c5.jasm + * p7/c7.jasm * @run main/othervm MethodAccessReadTwice */ diff --git a/test/hotspot/jtreg/runtime/modules/AccessCheck/p5/c5.jasm b/test/hotspot/jtreg/runtime/modules/AccessCheck/p5/c5.jasm new file mode 100644 index 00000000000..69a8143deff --- /dev/null +++ b/test/hotspot/jtreg/runtime/modules/AccessCheck/p5/c5.jasm @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2021, Google LLC. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Test input for the fix for JDK-8174954, which checks for an expected + * IllegalAccessError when the parameter type of an invokedynamic is + * inaccessible. + * + * The test assumes that given the string concatenation expression "" + param, + * javac generates an invokedynamic that uses the specific type of param. The + * fix for JDK-8273914 make javac eagerly convert param to a String before + * passing it to the invokedynamic call, which avoids the accessibility issue + * the test is trying to exercise. + * + * This jasm file contains the bytecode javac generated before the fix for + * JDK-8273914, to continue to exercise the invokedynamic behaviour that + * JDK-8174954 is testing. + */ + +package p5; + +super public class c5 + version 55:0 +{ + public Method "":"()V" + stack 1 locals 1 + { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + public Method method5:"(Lp2/c2;)V" + stack 2 locals 2 + { + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + aload_1; + invokedynamic InvokeDynamic REF_invokeStatic:Method java/lang/invoke/StringConcatFactory.makeConcatWithConstants:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;":makeConcatWithConstants:"(Lp2/c2;)Ljava/lang/String;" { + String "In c5\'s method5 with param = " + }; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + return; + } + public Method methodAddReadEdge:"(Ljava/lang/Module;)V" + stack 2 locals 2 + { + ldc class c5; + invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/Module;"; + aload_1; + invokevirtual Method java/lang/Module.addReads:"(Ljava/lang/Module;)Ljava/lang/Module;"; + pop; + return; + } + + public static final InnerClass Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles; + +} // end Class c5 diff --git a/test/hotspot/jtreg/runtime/modules/AccessCheck/p7/c7.jasm b/test/hotspot/jtreg/runtime/modules/AccessCheck/p7/c7.jasm new file mode 100644 index 00000000000..fd8783f4c24 --- /dev/null +++ b/test/hotspot/jtreg/runtime/modules/AccessCheck/p7/c7.jasm @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2021, Google LLC. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Test input for the fix for JDK-8174954, which checks for an expected + * IllegalAccessError when the parameter type of an invokedynamic is + * inaccessible. + * + * The test assumes that given the string concatenation expression "" + param, + * javac generates an invokedynamic that uses the specific type of param. The + * fix for JDK-8273914 make javac eagerly convert param to a String before + * passing it to the invokedynamic call, which avoids the accessibility issue + * the test is trying to exercise. + * + * This jasm file contains the bytecode javac generated before the fix for + * JDK-8273914, to continue to exercise the invokedynamic behaviour that + * JDK-8174954 is testing. + */ + +package p7; + +super public class c7 + version 55:0 +{ + public Method "":"()V" + stack 1 locals 1 + { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + public Method method7:"(Lp2/c2;Ljava/lang/Module;)V" + stack 3 locals 4 + { + try t0; + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + aload_1; + invokedynamic InvokeDynamic REF_invokeStatic:Method java/lang/invoke/StringConcatFactory.makeConcatWithConstants:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;":makeConcatWithConstants:"(Lp2/c2;)Ljava/lang/String;" { + String "In c7\'s method7 with param = " + }; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + new class java/lang/RuntimeException; + dup; + ldc String "c7 failed to throw expected IllegalAccessError"; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + endtry t0; + catch t0 java/lang/IllegalAccessError; + stack_frame_type stack1; + stack_map class java/lang/IllegalAccessError; + astore_3; + aload_0; + aload_2; + invokevirtual Method methodAddReadEdge:"(Ljava/lang/Module;)V"; + try t1; + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + aload_1; + invokedynamic InvokeDynamic REF_invokeStatic:Method java/lang/invoke/StringConcatFactory.makeConcatWithConstants:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;":makeConcatWithConstants:"(Lp2/c2;)Ljava/lang/String;" { + String "In c7\'s method7 with param = " + }; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + endtry t1; + goto L61; + catch t1 java/lang/IllegalAccessError; + stack_frame_type stack1; + stack_map class java/lang/IllegalAccessError; + astore_3; + new class java/lang/RuntimeException; + dup; + aload_3; + invokevirtual Method java/lang/IllegalAccessError.getMessage:"()Ljava/lang/String;"; + invokedynamic InvokeDynamic REF_invokeStatic:Method java/lang/invoke/StringConcatFactory.makeConcatWithConstants:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;":makeConcatWithConstants:"(Ljava/lang/String;)Ljava/lang/String;" { + String "Unexpected IllegalAccessError: " + }; + invokespecial Method java/lang/RuntimeException."":"(Ljava/lang/String;)V"; + athrow; + L61: stack_frame_type same; + return; + } + public Method methodAddReadEdge:"(Ljava/lang/Module;)V" + stack 2 locals 2 + { + ldc class c7; + invokevirtual Method java/lang/Class.getModule:"()Ljava/lang/Module;"; + aload_1; + invokevirtual Method java/lang/Module.addReads:"(Ljava/lang/Module;)Ljava/lang/Module;"; + pop; + return; + } + + public static final InnerClass Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles; + +} // end Class c7 diff --git a/test/jdk/java/lang/invoke/PrivateInvokeTest.java b/test/jdk/java/lang/invoke/PrivateInvokeTest.java index 12edf8e3263..8ae78d96713 100644 --- a/test/jdk/java/lang/invoke/PrivateInvokeTest.java +++ b/test/jdk/java/lang/invoke/PrivateInvokeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,8 +67,6 @@ public class PrivateInvokeTest { String vstr = System.getProperty(THIS_CLASS.getSimpleName()+".verbose"); if (vstr == null) vstr = System.getProperty(THIS_CLASS.getName()+".verbose"); - if (vstr == null) - vstr = System.getProperty("test.verbose"); if (vstr != null) verbose = Integer.parseInt(vstr); } private static int referenceKind(Method m) { diff --git a/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java b/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java index cb3d4dde914..d143e025dd5 100644 --- a/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java +++ b/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java @@ -25,9 +25,9 @@ * @test * @bug 8025703 8040211 8191404 8203872 8222980 8225435 8241082 8242010 8247432 * 8258795 8267038 8287180 8302512 8304761 8306031 8308021 8313702 8318322 - * 8327631 8332424 8334418 + * 8327631 8332424 8334418 8344589 * @summary Checks the IANA language subtag registry data update - * (LSR Revision: 2024-06-14) with Locale and Locale.LanguageRange + * (LSR Revision: 2024-11-19) with Locale and Locale.LanguageRange * class methods. * @run main LanguageSubtagRegistryTest */ diff --git a/test/langtools/tools/javac/StringConcat/StringAppendEvaluatesInOrder.java b/test/langtools/tools/javac/StringConcat/StringAppendEvaluatesInOrder.java new file mode 100644 index 00000000000..b2bd47acde0 --- /dev/null +++ b/test/langtools/tools/javac/StringConcat/StringAppendEvaluatesInOrder.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2021, Google LLC. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8273914 + * @summary Indy string concat changes order of operations + * + * @clean * + * @compile -XDstringConcat=indy StringAppendEvaluatesInOrder.java + * @run main StringAppendEvaluatesInOrder + * + * @clean * + * @compile -XDstringConcat=indyWithConstants StringAppendEvaluatesInOrder.java + * @run main StringAppendEvaluatesInOrder + * + * @clean * + * @compile -XDstringConcat=inline StringAppendEvaluatesInOrder.java + * @run main StringAppendEvaluatesInOrder + */ + +public class StringAppendEvaluatesInOrder { + static String test() { + StringBuilder builder = new StringBuilder("foo"); + int i = 15; + return "Test: " + i + " " + (++i) + builder + builder.append("bar"); + } + + static String compoundAssignment() { + StringBuilder builder2 = new StringBuilder("foo"); + Object oo = builder2; + oo += "" + builder2.append("bar"); + return oo.toString(); + } + + public static void main(String[] args) throws Exception { + assertEquals(test(), "Test: 15 16foofoobar"); + assertEquals(compoundAssignment(), "foofoobar"); + } + + private static void assertEquals(String actual, String expected) { + if (!actual.equals(expected)) { + throw new AssertionError("expected: " + expected + ", actual: " + actual); + } + } +} diff --git a/test/langtools/tools/javac/StringConcat/WellKnownTypeSignatures.java b/test/langtools/tools/javac/StringConcat/WellKnownTypeSignatures.java new file mode 100644 index 00000000000..07cdeef4956 --- /dev/null +++ b/test/langtools/tools/javac/StringConcat/WellKnownTypeSignatures.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2021, Google LLC. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.ConstantPool.*; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/* + * @test + * @bug 8273914 + * @summary Indy string concat changes order of operations + * @modules jdk.jdeps/com.sun.tools.classfile + * + * @clean * + * @compile -XDstringConcat=indy WellKnownTypeSignatures.java + * @run main WellKnownTypeSignatures + * + * @clean * + * @compile -XDstringConcat=indyWithConstants WellKnownTypeSignatures.java + * @run main WellKnownTypeSignatures + */ + +public class WellKnownTypeSignatures { + static List actualTypes; + + static int idx = 0; + + static boolean z = true; + static char c = (char) 42; + static short s = (short) 42; + static byte b = (byte) 42; + static int i = 42; + static long l = 42L; + static float f = 42.0f; + static double d = 42.0; + + public static void main(String[] argv) throws Exception { + readIndyTypes(); + + test("" + WellKnownTypeSignatures.class, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); + test("" + Boolean.valueOf(z), idx++, "(Ljava/lang/Boolean;)Ljava/lang/String;"); + test("" + Character.valueOf(c), idx++, "(Ljava/lang/Character;)Ljava/lang/String;"); + test("" + Byte.valueOf(b), idx++, "(Ljava/lang/Byte;)Ljava/lang/String;"); + test("" + Short.valueOf(s), idx++, "(Ljava/lang/Short;)Ljava/lang/String;"); + test("" + Integer.valueOf(i), idx++, "(Ljava/lang/Integer;)Ljava/lang/String;"); + test("" + Long.valueOf(l), idx++, "(Ljava/lang/Long;)Ljava/lang/String;"); + test("" + Double.valueOf(d), idx++, "(Ljava/lang/Double;)Ljava/lang/String;"); + test("" + Float.valueOf(f), idx++, "(Ljava/lang/Float;)Ljava/lang/String;"); + test("" + z, idx++, "(Z)Ljava/lang/String;"); + test("" + c, idx++, "(C)Ljava/lang/String;"); + test("" + b, idx++, "(B)Ljava/lang/String;"); + test("" + s, idx++, "(S)Ljava/lang/String;"); + test("" + i, idx++, "(I)Ljava/lang/String;"); + test("" + l, idx++, "(J)Ljava/lang/String;"); + test("" + d, idx++, "(D)Ljava/lang/String;"); + test("" + f, idx++, "(F)Ljava/lang/String;"); + } + + public static void test(String actual, int index, String expectedType) { + String actualType = actualTypes.get(index); + if (!actualType.equals(expectedType)) { + throw new IllegalStateException( + index + + " Unexpected type: expected = " + + expectedType + + ", actual = " + + actualType); + } + } + + public static void readIndyTypes() throws Exception { + actualTypes = new ArrayList(); + + ClassFile classFile = + ClassFile.read( + new File( + System.getProperty("test.classes", "."), + WellKnownTypeSignatures.class.getName() + ".class")); + ConstantPool constantPool = classFile.constant_pool; + + for (Method method : classFile.methods) { + if (method.getName(constantPool).equals("main")) { + Code_attribute code = (Code_attribute) method.attributes.get(Attribute.Code); + for (Instruction i : code.getInstructions()) { + if (i.getOpcode() == Opcode.INVOKEDYNAMIC) { + CONSTANT_InvokeDynamic_info indyInfo = + (CONSTANT_InvokeDynamic_info) + constantPool.get(i.getUnsignedShort(1)); + CONSTANT_NameAndType_info natInfo = indyInfo.getNameAndTypeInfo(); + actualTypes.add(natInfo.getType()); + } + } + } + } + } +} diff --git a/test/langtools/tools/javac/StringConcat/WellKnownTypes.java b/test/langtools/tools/javac/StringConcat/WellKnownTypes.java new file mode 100644 index 00000000000..39150cfc4da --- /dev/null +++ b/test/langtools/tools/javac/StringConcat/WellKnownTypes.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2021, Google LLC. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import com.sun.tools.classfile.*; +import com.sun.tools.classfile.ConstantPool.*; + +/* + * @test + * @bug 8273914 + * @summary Indy string concat changes order of operations + * @modules jdk.jdeps/com.sun.tools.classfile + * + * @compile -XDstringConcat=indy WellKnownTypes.java + * @run main WellKnownTypes + * + * @compile -XDstringConcat=indyWithConstants WellKnownTypes.java + * @run main WellKnownTypes + * + * @compile -XDstringConcat=inline WellKnownTypes.java + * @run main WellKnownTypes + */ + +public class WellKnownTypes { + static int idx = 0; + + static boolean z = true; + static char c = (char) 42; + static byte b = (byte) 43; + static short s = (short) 44; + static int i = 45; + static long l = 46L; + static float f = 47.0f; + static double d = 48.0; + + public static void main(String[] argv) throws Exception { + test("" + WellKnownTypes.class, idx++, "class WellKnownTypes"); + test("" + Boolean.valueOf(z), idx++, "true"); + test("" + Character.valueOf(c), idx++, "*"); + test("" + Byte.valueOf(b), idx++, "43"); + test("" + Short.valueOf(s), idx++, "44"); + test("" + Integer.valueOf(i), idx++, "45"); + test("" + Long.valueOf(l), idx++, "46"); + test("" + Float.valueOf(f), idx++, "47.0"); + test("" + Double.valueOf(d), idx++, "48.0"); + test("" + z, idx++, "true"); + test("" + c, idx++, "*"); + test("" + b, idx++, "43"); + test("" + s, idx++, "44"); + test("" + i, idx++, "45"); + test("" + l, idx++, "46"); + test("" + f, idx++, "47.0"); + test("" + d, idx++, "48.0"); + } + + public static void test(String actual, int index, String expected) { + if (!actual.equals(expected)) { + throw new IllegalStateException( + index + " Unexpected: expected = " + expected + ", actual = " + actual); + } + } +} diff --git a/test/langtools/tools/javac/StringConcat/access/Test.java b/test/langtools/tools/javac/StringConcat/access/Test.java index 72237e8b4ef..578bbddb118 100644 --- a/test/langtools/tools/javac/StringConcat/access/Test.java +++ b/test/langtools/tools/javac/StringConcat/access/Test.java @@ -56,109 +56,109 @@ public static void main(String[] argv) throws Exception { // ---------------------------------------------------------------------------- // public Private_PublicClass c1 = new Private_PublicClass(); - test("" + holder.c1, idx++, "(Lp1/PublicClass;)Ljava/lang/String;"); + test("" + holder.c1, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PublicInterface c2 = new Private_PublicInterface(); - test("" + holder.c2, idx++, "(Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.c2, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PrivateInterface1 c3 = new Private_PrivateInterface1(); - test("" + holder.c3, idx++, "(Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.c3, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PrivateInterface2 c4 = new Private_PrivateInterface2(); - test("" + holder.c4, idx++, "(Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.c4, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PublicClass c5 = new Public_PublicClass(); - test("" + holder.c5, idx++, "(Lp1/Public_PublicClass;)Ljava/lang/String;"); + test("" + holder.c5, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PublicInterface c6 = new Public_PublicInterface(); - test("" + holder.c6, idx++, "(Lp1/Public_PublicInterface;)Ljava/lang/String;"); + test("" + holder.c6, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PrivateInterface1 c7 = new Public_PrivateInterface1(); - test("" + holder.c7, idx++, "(Lp1/Public_PrivateInterface1;)Ljava/lang/String;"); + test("" + holder.c7, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PrivateInterface2 c8 = new Public_PrivateInterface2(); - test("" + holder.c8, idx++, "(Lp1/Public_PrivateInterface2;)Ljava/lang/String;"); + test("" + holder.c8, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // ---------------------------------------------------------------------------- // public Private_PublicClass[] ac1 = new Private_PublicClass[0]; - test("" + holder.ac1, idx++, "([Lp1/PublicClass;)Ljava/lang/String;"); + test("" + holder.ac1, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PublicInterface[] ac2 = new Private_PublicInterface[0]; - test("" + holder.ac2, idx++, "([Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.ac2, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PrivateInterface1[] ac3 = new Private_PrivateInterface1[0]; - test("" + holder.ac3, idx++, "([Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.ac3, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PrivateInterface2[] ac4 = new Private_PrivateInterface2[0]; - test("" + holder.ac4, idx++, "([Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.ac4, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PublicClass[] ac5 = new Public_PublicClass[0]; - test("" + holder.ac5, idx++, "([Lp1/Public_PublicClass;)Ljava/lang/String;"); + test("" + holder.ac5, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PublicInterface[] ac6 = new Public_PublicInterface[0]; - test("" + holder.ac6, idx++, "([Lp1/Public_PublicInterface;)Ljava/lang/String;"); + test("" + holder.ac6, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PrivateInterface1[] ac7 = new Public_PrivateInterface1[0]; - test("" + holder.ac7, idx++, "([Lp1/Public_PrivateInterface1;)Ljava/lang/String;"); + test("" + holder.ac7, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PrivateInterface2[] ac8 = new Public_PrivateInterface2[0]; - test("" + holder.ac8, idx++, "([Lp1/Public_PrivateInterface2;)Ljava/lang/String;"); + test("" + holder.ac8, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // ---------------------------------------------------------------------------- // public Private_PublicClass[][] aac1 = new Private_PublicClass[0][]; - test("" + holder.aac1, idx++, "([[Lp1/PublicClass;)Ljava/lang/String;"); + test("" + holder.aac1, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PublicInterface[][] aac2 = new Private_PublicInterface[0][]; - test("" + holder.aac2, idx++, "([[Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.aac2, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PrivateInterface1[][] aac3 = new Private_PrivateInterface1[0][]; - test("" + holder.aac3, idx++, "([[Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.aac3, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Private_PrivateInterface2[][] aac4 = new Private_PrivateInterface2[0][]; - test("" + holder.aac4, idx++, "([[Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.aac4, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PublicClass[][] aac5 = new Public_PublicClass[0][]; - test("" + holder.aac5, idx++, "([[Lp1/Public_PublicClass;)Ljava/lang/String;"); + test("" + holder.aac5, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PublicInterface[][] aac6 = new Public_PublicInterface[0][]; - test("" + holder.aac6, idx++, "([[Lp1/Public_PublicInterface;)Ljava/lang/String;"); + test("" + holder.aac6, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PrivateInterface1[][] aac7 = new Public_PrivateInterface1[0][]; - test("" + holder.aac7, idx++, "([[Lp1/Public_PrivateInterface1;)Ljava/lang/String;"); + test("" + holder.aac7, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public Public_PrivateInterface2[][] aac8 = new Public_PrivateInterface2[0][]; - test("" + holder.aac8, idx++, "([[Lp1/Public_PrivateInterface2;)Ljava/lang/String;"); + test("" + holder.aac8, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // ---------------------------------------------------------------------------- // public PublicInterface i1 = new Private_PublicInterface(); - test("" + holder.i1, idx++, "(Lp1/PublicInterface;)Ljava/lang/String;"); + test("" + holder.i1, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public PrivateInterface1 i2 = new Private_PrivateInterface1(); - test("" + holder.i2, idx++, "(Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.i2, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public PrivateInterface2 i3 = new Private_PrivateInterface2(); - test("" + holder.i3, idx++, "(Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.i3, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public PublicInterface[] ai1 = new Private_PublicInterface[0]; - test("" + holder.ai1, idx++, "([Lp1/PublicInterface;)Ljava/lang/String;"); + test("" + holder.ai1, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public PrivateInterface1[] ai2 = new Private_PrivateInterface1[0]; - test("" + holder.ai2, idx++, "([Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.ai2, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public PrivateInterface2[] ai3 = new Private_PrivateInterface2[0]; - test("" + holder.ai3, idx++, "([Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.ai3, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public PublicInterface[][] aai1 = new Private_PublicInterface[0][]; - test("" + holder.aai1, idx++, "([[Lp1/PublicInterface;)Ljava/lang/String;"); + test("" + holder.aai1, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public PrivateInterface1[][] aai2 = new Private_PrivateInterface1[0][]; - test("" + holder.aai2, idx++, "([[Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.aai2, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); // public PrivateInterface2[][] aai3 = new Private_PrivateInterface2[0][]; - test("" + holder.aai3, idx++, "([[Ljava/lang/Object;)Ljava/lang/String;"); + test("" + holder.aai3, idx++, "(Ljava/lang/String;)Ljava/lang/String;"); }