diff --git a/.hgtags b/.hgtags
index b5ffdaee57d..744ce58f2fe 100644
--- a/.hgtags
+++ b/.hgtags
@@ -343,3 +343,4 @@ f242d4332f563648426a1b0fa02d8741beba19ef jdk9-b92
d00ad2d9049ac60815f70bff445e95df85648bd2 jdk-9+98
f9bcdce2df26678c3fe468130b535c0342c69b89 jdk-9+99
4379223f8806626852c46c52d4e7a27a584b406e jdk-9+100
+80f67512daa15cf37b4825c1c62a675d524d7c49 jdk-9+101
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 67085b3ac37..ad5eaa36b36 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -343,3 +343,4 @@ cf1dc4c035fb84693d4ae5ad818785cb4d1465d1 jdk9-b90
48987460c7d49a29013963ee44d090194396bb61 jdk-9+98
7c0577bea4c65d69c5bef67023a89d2efa4fb2f7 jdk-9+99
c1f30ac14db0eaff398429c04cd9fab92e1b4b2a jdk-9+100
+c4d72a1620835b5d657b7b6792c2879367d0154f jdk-9+101
diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4
index f6b11c8a3bf..be85de751eb 100644
--- a/common/autoconf/basics.m4
+++ b/common/autoconf/basics.m4
@@ -23,6 +23,74 @@
# questions.
#
+# Create a function/macro that takes a series of named arguments. The call is
+# similar to AC_DEFUN, but the setup of the function looks like this:
+# BASIC_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [
+# ... do something
+# AC_MSG_NOTICE([Value of BAR is ARG_BAR])
+# ])
+# A star (*) in front of a named argument means that it is required and it's
+# presence will be verified. To pass e.g. the first value as a normal indexed
+# argument, use [m4_shift($@)] as the third argument instead of [$@]. These
+# arguments are referenced in the function by their name prefixed by ARG_, e.g.
+# "ARG_FOO".
+#
+# The generated function can be called like this:
+# MYFUNC(FOO: [foo-val], BAR:
+# [
+# $ECHO hello world
+# ])
+#
+#
+# Argument 1: Name of the function to define
+# Argument 2: List of legal named arguments, with a * prefix for required arguments
+# Argument 3: Argument array to treat as named, typically $@
+# Argument 4: The main function body
+AC_DEFUN([BASIC_DEFUN_NAMED],
+[
+ AC_DEFUN($1, [
+ m4_foreach(arg, m4_split($2), [
+ m4_if(m4_bregexp(arg, [^\*]), -1,
+ [
+ m4_set_add(legal_named_args, arg)
+ ],
+ [
+ m4_set_add(legal_named_args, m4_substr(arg, 1))
+ m4_set_add(required_named_args, m4_substr(arg, 1))
+ ]
+ )
+ ])
+
+ m4_foreach([arg], [$3], [
+ m4_define(arg_name, m4_substr(arg, 0, m4_bregexp(arg, [: ])))
+ m4_set_contains(legal_named_args, arg_name, [],[AC_MSG_ERROR([Internal error: arg_name is not a valid named argument to [$1]. Valid arguments are 'm4_set_contents(legal_named_args, [ ])'.])])
+ m4_set_remove(required_named_args, arg_name)
+ m4_set_remove(legal_named_args, arg_name)
+ m4_pushdef([ARG_][]arg_name, m4_substr(arg, m4_incr(m4_incr(m4_bregexp(arg, [: ])))))
+ m4_set_add(defined_args, arg_name)
+ m4_undefine([arg_name])
+ ])
+ m4_set_empty(required_named_args, [], [
+ AC_MSG_ERROR([Internal error: Required named arguments are missing for [$1]. Missing arguments: 'm4_set_contents(required_named_args, [ ])'])
+ ])
+ m4_foreach([arg], m4_indir([m4_dquote]m4_set_listc([legal_named_args])), [
+ m4_pushdef([ARG_][]arg, [])
+ m4_set_add(defined_args, arg)
+ ])
+ m4_set_delete(legal_named_args)
+ m4_set_delete(required_named_args)
+
+ # Execute function body
+ $4
+
+ m4_foreach([arg], m4_indir([m4_dquote]m4_set_listc([defined_args])), [
+ m4_popdef([ARG_][]arg)
+ ])
+
+ m4_set_delete(defined_args)
+ ])
+])
+
# Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
# If so, then append $1 to $2 \
# Also set JVM_ARG_OK to true/false depending on outcome.
@@ -1122,7 +1190,6 @@ AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
# Move configure.log from current directory to the build output root
if test -e ./configure.log; then
- echo found it
$MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
fi
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index 927bb522bcd..b34b2fb7a85 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -425,7 +425,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
# Add runtime stack smashing and undefined behavior checks.
# Not all versions of gcc support -fstack-protector
STACK_PROTECTOR_CFLAG="-fstack-protector-all"
- FLAGS_COMPILER_CHECK_ARGUMENTS([$STACK_PROTECTOR_CFLAG], [], [STACK_PROTECTOR_CFLAG=""])
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
@@ -742,7 +742,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
-I${JDK_TOPDIR}/src/java.base/share/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
- -I${JDK_TOPDIR}/src/java.base/share/native/libjava \
+ -I${JDK_TOPDIR}/src/java.base/share/native/libjava \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava"
# The shared libraries are compiled using the picflag.
@@ -896,17 +896,18 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
AC_SUBST(LDFLAGS_TESTEXE)
])
-# FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-# [RUN-IF-FALSE])
+# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+# IF_FALSE: [RUN-IF-FALSE])
# ------------------------------------------------------------
# Check that the c and c++ compilers support an argument
-AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS],
+BASIC_DEFUN_NAMED([FLAGS_COMPILER_CHECK_ARGUMENTS],
+ [*ARGUMENT IF_TRUE IF_FALSE], [$@],
[
- AC_MSG_CHECKING([if compiler supports "$1"])
+ AC_MSG_CHECKING([if compiler supports "ARG_ARGUMENT"])
supports=yes
saved_cflags="$CFLAGS"
- CFLAGS="$CFLAGS $1"
+ CFLAGS="$CFLAGS ARG_ARGUMENT"
AC_LANG_PUSH([C])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
[supports=no])
@@ -914,7 +915,7 @@ AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS],
CFLAGS="$saved_cflags"
saved_cxxflags="$CXXFLAGS"
- CXXFLAGS="$CXXFLAG $1"
+ CXXFLAGS="$CXXFLAG ARG_ARGUMENT"
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int i;]])], [],
[supports=no])
@@ -923,23 +924,26 @@ AC_DEFUN([FLAGS_COMPILER_CHECK_ARGUMENTS],
AC_MSG_RESULT([$supports])
if test "x$supports" = "xyes" ; then
- m4_ifval([$2], [$2], [:])
+ :
+ ARG_IF_TRUE
else
- m4_ifval([$3], [$3], [:])
+ :
+ ARG_IF_FALSE
fi
])
-# FLAGS_LINKER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-# [RUN-IF-FALSE])
+# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+# IF_FALSE: [RUN-IF-FALSE])
# ------------------------------------------------------------
# Check that the linker support an argument
-AC_DEFUN([FLAGS_LINKER_CHECK_ARGUMENTS],
+BASIC_DEFUN_NAMED([FLAGS_LINKER_CHECK_ARGUMENTS],
+ [*ARGUMENT IF_TRUE IF_FALSE], [$@],
[
- AC_MSG_CHECKING([if linker supports "$1"])
+ AC_MSG_CHECKING([if linker supports "ARG_ARGUMENT"])
supports=yes
saved_ldflags="$LDFLAGS"
- LDFLAGS="$LDFLAGS $1"
+ LDFLAGS="$LDFLAGS ARG_ARGUMENT"
AC_LANG_PUSH([C])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[], [supports=no])
@@ -948,9 +952,11 @@ AC_DEFUN([FLAGS_LINKER_CHECK_ARGUMENTS],
AC_MSG_RESULT([$supports])
if test "x$supports" = "xyes" ; then
- m4_ifval([$2], [$2], [:])
+ :
+ ARG_IF_TRUE
else
- m4_ifval([$3], [$3], [:])
+ :
+ ARG_IF_FALSE
fi
])
@@ -965,14 +971,14 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
*)
ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
esac
- FLAGS_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$ZERO_ARCHFLAG], IF_FALSE: [ZERO_ARCHFLAG=""])
AC_SUBST(ZERO_ARCHFLAG)
# Check that the compiler supports -mX (or -qX on AIX) flags
# Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
- FLAGS_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
- [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
- [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
+ IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
+ IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
@@ -1013,9 +1019,9 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
;;
gcc)
# Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
- FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
- [GCC_CAN_DISABLE_WARNINGS=true],
- [GCC_CAN_DISABLE_WARNINGS=false]
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
+ IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
+ IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
)
if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
DISABLE_WARNING_PREFIX="-Wno-"
@@ -1026,9 +1032,9 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_MISC],
# Repeate the check for the BUILD_CC
CC_OLD="$CC"
CC="$BUILD_CC"
- FLAGS_COMPILER_CHECK_ARGUMENTS([-Wno-this-is-a-warning-that-do-not-exist],
- [BUILD_CC_CAN_DISABLE_WARNINGS=true],
- [BUILD_CC_CAN_DISABLE_WARNINGS=false]
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
+ IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
+ IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
)
if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index de0cce655ce..5ecfef8e2af 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -3451,6 +3451,31 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# questions.
#
+# Create a function/macro that takes a series of named arguments. The call is
+# similar to AC_DEFUN, but the setup of the function looks like this:
+# BASIC_DEFUN_NAMED([MYFUNC], [FOO *BAR], [$@], [
+# ... do something
+# AC_MSG_NOTICE([Value of BAR is ARG_BAR])
+# ])
+# A star (*) in front of a named argument means that it is required and it's
+# presence will be verified. To pass e.g. the first value as a normal indexed
+# argument, use [m4_shift($@)] as the third argument instead of [$@]. These
+# arguments are referenced in the function by their name prefixed by ARG_, e.g.
+# "ARG_FOO".
+#
+# The generated function can be called like this:
+# MYFUNC(FOO: [foo-val], BAR:
+# [
+# $ECHO hello world
+# ])
+#
+#
+# Argument 1: Name of the function to define
+# Argument 2: List of legal named arguments, with a * prefix for required arguments
+# Argument 3: Argument array to treat as named, typically $@
+# Argument 4: The main function body
+
+
# Test if $1 is a valid argument to $3 (often is $JAVA passed as $3)
# If so, then append $1 to $2 \
# Also set JVM_ARG_OK to true/false depending on outcome.
@@ -3886,20 +3911,24 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
-# FLAGS_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-# [RUN-IF-FALSE])
+# FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+# IF_FALSE: [RUN-IF-FALSE])
# ------------------------------------------------------------
# Check that the c and c++ compilers support an argument
-# FLAGS_LINKER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE],
-# [RUN-IF-FALSE])
+
+
+# FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [ARGUMENT], IF_TRUE: [RUN-IF-TRUE],
+# IF_FALSE: [RUN-IF-FALSE])
# ------------------------------------------------------------
# Check that the linker support an argument
+
+
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4810,7 +4839,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1452261921
+DATE_WHEN_GENERATED=1452780299
###############################################################################
#
@@ -45358,6 +45387,54 @@ $as_echo "$as_me: Rewriting BUILD_AR to \"$new_complete\"" >&6;}
# "-Og" suppported for GCC 4.8 and later
CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Execute function body
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$CFLAG_OPTIMIZE_DEBUG_FLAG\"" >&5
$as_echo_n "checking if compiler supports \"$CFLAG_OPTIMIZE_DEBUG_FLAG\"... " >&6; }
supports=yes
@@ -45417,15 +45494,76 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
$as_echo "$supports" >&6; }
if test "x$supports" = "xyes" ; then
+ :
HAS_CFLAG_OPTIMIZE_DEBUG=true
else
+ :
HAS_CFLAG_OPTIMIZE_DEBUG=false
fi
+
+
+
+
+
+
+
+
+
+
+
# "-z relro" supported in GNU binutils 2.17 and later
LINKER_RELRO_FLAG="-Wl,-z,relro"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Execute function body
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker supports \"$LINKER_RELRO_FLAG\"" >&5
$as_echo_n "checking if linker supports \"$LINKER_RELRO_FLAG\"... " >&6; }
supports=yes
@@ -45467,15 +45605,76 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
$as_echo "$supports" >&6; }
if test "x$supports" = "xyes" ; then
+ :
HAS_LINKER_RELRO=true
else
+ :
HAS_LINKER_RELRO=false
fi
+
+
+
+
+
+
+
+
+
+
+
# "-z now" supported in GNU binutils 2.11 and later
LINKER_NOW_FLAG="-Wl,-z,now"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Execute function body
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker supports \"$LINKER_NOW_FLAG\"" >&5
$as_echo_n "checking if linker supports \"$LINKER_NOW_FLAG\"... " >&6; }
supports=yes
@@ -45517,11 +45716,24 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
$as_echo "$supports" >&6; }
if test "x$supports" = "xyes" ; then
+ :
HAS_LINKER_NOW=true
else
+ :
HAS_LINKER_NOW=false
fi
+
+
+
+
+
+
+
+
+
+
+
fi
# Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
@@ -46842,6 +47054,49 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
# Not all versions of gcc support -fstack-protector
STACK_PROTECTOR_CFLAG="-fstack-protector-all"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Execute function body
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$STACK_PROTECTOR_CFLAG\"" >&5
$as_echo_n "checking if compiler supports \"$STACK_PROTECTOR_CFLAG\"... " >&6; }
supports=yes
@@ -46902,11 +47157,24 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
$as_echo "$supports" >&6; }
if test "x$supports" = "xyes" ; then
:
+
else
+ :
STACK_PROTECTOR_CFLAG=""
fi
+
+
+
+
+
+
+
+
+
+
+
CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
;;
@@ -47384,6 +47652,49 @@ $as_echo "$supports" >&6; }
ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Execute function body
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"$ZERO_ARCHFLAG\"" >&5
$as_echo_n "checking if compiler supports \"$ZERO_ARCHFLAG\"... " >&6; }
supports=yes
@@ -47444,15 +47755,76 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
$as_echo "$supports" >&6; }
if test "x$supports" = "xyes" ; then
:
+
else
+ :
ZERO_ARCHFLAG=""
fi
+
+
+
+
+
+
+
+
+
+
+
# Check that the compiler supports -mX (or -qX on AIX) flags
# Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Execute function body
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"" >&5
$as_echo_n "checking if compiler supports \"${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}\"... " >&6; }
supports=yes
@@ -47512,13 +47884,26 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
$as_echo "$supports" >&6; }
if test "x$supports" = "xyes" ; then
+ :
COMPILER_SUPPORTS_TARGET_BITS_FLAG=true
else
+ :
COMPILER_SUPPORTS_TARGET_BITS_FLAG=false
fi
+
+
+
+
+
+
+
+
+
+
+
# Check whether --enable-warnings-as-errors was given.
if test "${enable_warnings_as_errors+set}" = set; then :
enableval=$enable_warnings_as_errors;
@@ -47565,6 +47950,54 @@ $as_echo "yes (default)" >&6; }
gcc)
# Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Execute function body
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"" >&5
$as_echo_n "checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"... " >&6; }
supports=yes
@@ -47624,12 +48057,25 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
$as_echo "$supports" >&6; }
if test "x$supports" = "xyes" ; then
+ :
GCC_CAN_DISABLE_WARNINGS=true
else
+ :
GCC_CAN_DISABLE_WARNINGS=false
fi
+
+
+
+
+
+
+
+
+
+
+
if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
DISABLE_WARNING_PREFIX="-Wno-"
else
@@ -47640,6 +48086,54 @@ $as_echo "$supports" >&6; }
CC_OLD="$CC"
CC="$BUILD_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ # Execute function body
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"" >&5
$as_echo_n "checking if compiler supports \"-Wno-this-is-a-warning-that-do-not-exist\"... " >&6; }
supports=yes
@@ -47699,12 +48193,25 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $supports" >&5
$as_echo "$supports" >&6; }
if test "x$supports" = "xyes" ; then
+ :
BUILD_CC_CAN_DISABLE_WARNINGS=true
else
+ :
BUILD_CC_CAN_DISABLE_WARNINGS=false
fi
+
+
+
+
+
+
+
+
+
+
+
if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
else
@@ -61523,7 +62030,6 @@ fi
# Move configure.log from current directory to the build output root
if test -e ./configure.log; then
- echo found it
$MV -f ./configure.log "$OUTPUT_ROOT/configure.log" 2> /dev/null
fi
diff --git a/common/autoconf/toolchain.m4 b/common/autoconf/toolchain.m4
index 3f5750dcc89..4254d86a4fb 100644
--- a/common/autoconf/toolchain.m4
+++ b/common/autoconf/toolchain.m4
@@ -75,8 +75,8 @@ AC_DEFUN([TOOLCHAIN_SETUP_FILENAME_PATTERNS],
# For full static builds, we're overloading the SHARED_LIBRARY
# variables in order to limit the amount of changes required.
# It would be better to remove SHARED and just use LIBRARY and
- # LIBRARY_SUFFIX for libraries that can be built either
- # shared or static and use STATIC_* for libraries that are
+ # LIBRARY_SUFFIX for libraries that can be built either
+ # shared or static and use STATIC_* for libraries that are
# always built statically.
if test "x$STATIC_BUILD" = xtrue; then
SHARED_LIBRARY='lib[$]1.a'
@@ -824,21 +824,21 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
# "-Og" suppported for GCC 4.8 and later
CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
- FLAGS_COMPILER_CHECK_ARGUMENTS([$CFLAG_OPTIMIZE_DEBUG_FLAG],
- [HAS_CFLAG_OPTIMIZE_DEBUG=true],
- [HAS_CFLAG_OPTIMIZE_DEBUG=false])
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CFLAG_OPTIMIZE_DEBUG_FLAG],
+ IF_TRUE: [HAS_CFLAG_OPTIMIZE_DEBUG=true],
+ IF_FALSE: [HAS_CFLAG_OPTIMIZE_DEBUG=false])
# "-z relro" supported in GNU binutils 2.17 and later
LINKER_RELRO_FLAG="-Wl,-z,relro"
- FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_RELRO_FLAG],
- [HAS_LINKER_RELRO=true],
- [HAS_LINKER_RELRO=false])
+ FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_RELRO_FLAG],
+ IF_TRUE: [HAS_LINKER_RELRO=true],
+ IF_FALSE: [HAS_LINKER_RELRO=false])
# "-z now" supported in GNU binutils 2.11 and later
LINKER_NOW_FLAG="-Wl,-z,now"
- FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_NOW_FLAG],
- [HAS_LINKER_NOW=true],
- [HAS_LINKER_NOW=false])
+ FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_NOW_FLAG],
+ IF_TRUE: [HAS_LINKER_NOW=true],
+ IF_FALSE: [HAS_LINKER_NOW=false])
fi
# Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
diff --git a/corba/.hgtags b/corba/.hgtags
index 4a5ada00d4a..621cce92dcc 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -343,3 +343,4 @@ feb1bd85d7990dcf5584ca9e53104269c01db006 jdk-9+96
ea285530245cf4e0edf0479121a41347d3030eba jdk-9+98
180212ee1d8710691ba9944593dfc1ff3e4f1532 jdk-9+99
791d0d3ac0138faeb6110bd840a4545bc1950df2 jdk-9+100
+30dfb3bd3d06b4bb80a087babc0d1841edba187b jdk-9+101
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 271e5408b1a..2861744a267 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -503,3 +503,4 @@ de592ea5f7ba0f8a8c5afc03bd169f7690c72b6f jdk-9+97
e5b1a23be1e105417ba1c4c576ab373eb3fa2c2b jdk-9+98
f008e8cc10d5b3212fb22d58c96fa01d38654f19 jdk-9+99
bdb0acafc63c42e84d9d8195bf2e2b25ee9c3306 jdk-9+100
+9f45d3d57d6948cf526fbc2e2891a9a74ac6941a jdk-9+101
diff --git a/hotspot/src/share/vm/prims/nativeLookup.cpp b/hotspot/src/share/vm/prims/nativeLookup.cpp
index fecef0a5055..d54f711c67d 100644
--- a/hotspot/src/share/vm/prims/nativeLookup.cpp
+++ b/hotspot/src/share/vm/prims/nativeLookup.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,7 @@ static JNINativeMethod lookup_special_native_methods[] = {
{ CC"Java_jdk_internal_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
{ CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) },
{ CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
- { CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) },
+ { CC"Java_jdk_internal_perf_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) },
{ CC"Java_sun_hotspot_WhiteBox_registerNatives", NULL, FN_PTR(JVM_RegisterWhiteBoxMethods) },
#if INCLUDE_JVMCI
{ CC"Java_jdk_vm_ci_runtime_JVMCI_initializeRuntime", NULL, FN_PTR(JVM_GetJVMCIRuntime) },
diff --git a/hotspot/src/share/vm/prims/perf.cpp b/hotspot/src/share/vm/prims/perf.cpp
index 435cb0146cb..1cbb9568298 100644
--- a/hotspot/src/share/vm/prims/perf.cpp
+++ b/hotspot/src/share/vm/prims/perf.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
#include "runtime/perfMemory.hpp"
/*
- * Implementation of class sun.misc.Perf
+ * Implementation of class jdk.internal.perf.Perf
*/
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index b016abbf315..89a01eeb6d6 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -343,3 +343,4 @@ c8d0845877a811ab4350935892f826929359a3ff jdk-9+95
52b01339235f24c93b679bd6b8fb36a1072ad0ac jdk-9+98
52774b544850c791f1d1c67db2601b33739b18c9 jdk-9+99
d45bcd374f6057851e3c2dcd45607cd362afadfa jdk-9+100
+d3e834ff74e724a2b92a558e18e8cbf81c6dbc59 jdk-9+101
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java
index ee6a29bfa26..7be69b9ea29 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java
@@ -32,7 +32,6 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
@@ -43,6 +42,7 @@ import java.util.stream.StreamSupport;
import static javax.xml.catalog.BaseEntry.CatalogEntryType;
import static javax.xml.catalog.CatalogFeatures.DEFER_TRUE;
import javax.xml.catalog.CatalogFeatures.Feature;
+import static javax.xml.catalog.CatalogMessages.formatMessage;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
@@ -109,25 +109,20 @@ class CatalogImpl extends GroupEntry implements Catalog {
*/
public CatalogImpl(CatalogImpl parent, CatalogFeatures f, String... file) throws CatalogException {
super(CatalogEntryType.CATALOG);
- this.parent = parent;
- if (parent == null) {
- level = 0;
- } else {
- level = parent.level + 1;
- }
if (f == null) {
- this.features = CatalogFeatures.defaults();
- } else {
- this.features = f;
+ throw new NullPointerException(
+ formatMessage(CatalogMessages.ERR_NULL_ARGUMENT, new Object[]{"CatalogFeatures"}));
}
- setPrefer(features.get(Feature.PREFER));
- setDeferred(features.get(Feature.DEFER));
- setResolve(features.get(Feature.RESOLVE));
+
+ if (file.length > 0) {
+ CatalogMessages.reportNPEOnNull("The path to the catalog file", file[0]);
+ }
+
+ init(parent, f);
//Path of catalog files
String[] catalogFile = file;
- if (level == 0
- && (file == null || (file.length == 0 || file[0] == null))) {
+ if (level == 0 && file.length == 0) {
String files = features.get(Feature.FILES);
if (files != null) {
catalogFile = files.split(";[ ]*");
@@ -166,6 +161,23 @@ class CatalogImpl extends GroupEntry implements Catalog {
}
}
+ private void init(CatalogImpl parent, CatalogFeatures f) {
+ this.parent = parent;
+ if (parent == null) {
+ level = 0;
+ } else {
+ level = parent.level + 1;
+ }
+ if (f == null) {
+ this.features = CatalogFeatures.defaults();
+ } else {
+ this.features = f;
+ }
+ setPrefer(features.get(Feature.PREFER));
+ setDeferred(features.get(Feature.DEFER));
+ setResolve(features.get(Feature.RESOLVE));
+ }
+
/**
* Resets the Catalog instance to its initial state.
*/
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java
index 7539ec00be9..2e3c5b4f74b 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java
@@ -38,33 +38,38 @@ public final class CatalogManager {
}
/**
- * Creates a Catalog object using the specified feature settings and path to
- * a catalog file. If the features is null, the default features will be used.
- * If the path is empty, System property {@code javax.xml.catalog.files} will
- * be read to locate the initial list of catalog files.
+ * Creates a {@code Catalog} object using the specified feature settings and
+ * path to one or more catalog files.
*
- * If more than one catalog files are specified through the path argument or
+ * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
+ * will be read to locate the initial list of catalog files.
+ *
+ * If more than one catalog files are specified through the paths argument or
* {@code javax.xml.catalog.files} property, the first entry is considered
* the main catalog, while others are treated as alternative catalogs after
* those referenced by the {@code nextCatalog} elements in the main catalog.
+ *
+ * As specified in
+ *
+ * XML Catalogs, OASIS Standard V1.1, invalid path entries will be ignored.
+ * No error will be reported. In case all entries are invalid, the resolver
+ * will return as no mapping is found.
*
* @param features the catalog features
- * @param path path(s) to one or more catalogs.
+ * @param paths path(s) to one or more catalogs.
*
- * @return a catalog instance
- * @throws CatalogException If no catalog can be found whether through the
- * specified path or the System property {@code javax.xml.catalog.files}, or
- * an error occurs while parsing the catalog
+ * @return an instance of a {@code Catalog}
+ * @throws CatalogException If an error occurs while parsing the catalog
*/
- public static Catalog catalog(CatalogFeatures features, String... path) {
- return new CatalogImpl(features, path);
+ public static Catalog catalog(CatalogFeatures features, String... paths) {
+ return new CatalogImpl(features, paths);
}
/**
- * Creates an instance of a CatalogResolver using the specified catalog.
+ * Creates an instance of a {@code CatalogResolver} using the specified catalog.
*
* @param catalog the catalog instance
- * @return an instance of a CatalogResolver
+ * @return an instance of a {@code CatalogResolver}
*/
public static CatalogResolver catalogResolver(Catalog catalog) {
if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null);
@@ -72,10 +77,10 @@ public final class CatalogManager {
}
/**
- * Creates an instance of a CatalogUriResolver using the specified catalog.
+ * Creates an instance of a {@code CatalogUriResolver} using the specified catalog.
*
* @param catalog the catalog instance
- * @return an instance of a CatalogResolver
+ * @return an instance of a {@code CatalogResolver}
*/
public static CatalogUriResolver catalogUriResolver(Catalog catalog) {
if (catalog == null) CatalogMessages.reportNPEOnNull("catalog", null);
@@ -83,50 +88,60 @@ public final class CatalogManager {
}
/**
- * Creates an instance of a CatalogResolver using the specified feature settings
- * and path to a catalog file. If the features is null, the default features will
- * be used. If the path is empty, System property {@code javax.xml.catalog.files}
+ * Creates an instance of a {@code CatalogResolver} using the specified feature
+ * settings and path to one or more catalog files.
+ *
+ * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
* will be read to locate the initial list of catalog files.
*
- * If more than one catalog files are specified through the path argument or
+ * If more than one catalog files are specified through the paths argument or
* {@code javax.xml.catalog.files} property, the first entry is considered
* the main catalog, while others are treated as alternative catalogs after
* those referenced by the {@code nextCatalog} elements in the main catalog.
+ *
+ * As specified in
+ *
+ * XML Catalogs, OASIS Standard V1.1, invalid path entries will be ignored.
+ * No error will be reported. In case all entries are invalid, the resolver
+ * will return as no mapping is found.
*
* @param features the catalog features
- * @param path the path(s) to one or more catalogs
+ * @param paths the path(s) to one or more catalogs
*
- * @return an instance of a CatalogResolver
- * @throws CatalogException If no catalog can be found whether through the
- * specified path or the System property {@code javax.xml.catalog.files}, or
- * an error occurs while parsing the catalog
+ * @return an instance of a {@code CatalogResolver}
+ * @throws CatalogException If an error occurs while parsing the catalog
*/
- public static CatalogResolver catalogResolver(CatalogFeatures features, String... path) {
- Catalog catalog = catalog(features, path);
+ public static CatalogResolver catalogResolver(CatalogFeatures features, String... paths) {
+ Catalog catalog = catalog(features, paths);
return new CatalogResolverImpl(catalog);
}
/**
- * Creates an instance of a CatalogUriResolver using the specified feature settings
- * and path to a catalog file. If the features is null, the default features will
- * be used. If the path is empty, System property {@code javax.xml.catalog.files}
+ * Creates an instance of a {@code CatalogUriResolver} using the specified
+ * feature settings and path to one or more catalog files.
+ *
+ * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
* will be read to locate the initial list of catalog files.
*
- * If more than one catalog files are specified through the path argument or
+ * If more than one catalog files are specified through the paths argument or
* {@code javax.xml.catalog.files} property, the first entry is considered
* the main catalog, while others are treated as alternative catalogs after
* those referenced by the {@code nextCatalog} elements in the main catalog.
+ *
+ * As specified in
+ *
+ * XML Catalogs, OASIS Standard V1.1, invalid path entries will be ignored.
+ * No error will be reported. In case all entries are invalid, the resolver
+ * will return as no mapping is found.
*
* @param features the catalog features
- * @param path the path(s) to one or more catalogs
+ * @param paths the path(s) to one or more catalogs
*
- * @return an instance of a CatalogResolver
- * @throws CatalogException If no catalog can be found whether through the
- * specified path or the System property {@code javax.xml.catalog.files}, or
- * an error occurs while parsing the catalog
+ * @return an instance of a {@code CatalogUriResolver}
+ * @throws CatalogException If an error occurs while parsing the catalog
*/
- public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... path) {
- Catalog catalog = catalog(features, path);
+ public static CatalogUriResolver catalogUriResolver(CatalogFeatures features, String... paths) {
+ Catalog catalog = catalog(features, paths);
return new CatalogUriResolverImpl(catalog);
}
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java
index 13c0e3791e4..76ba60dd2eb 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogUriResolver.java
@@ -43,9 +43,9 @@ public interface CatalogUriResolver extends URIResolver {
* absolute if the absolute URI is required
*
* @return a {@link javax.xml.transform.Source} object if a mapping is found.
- * If no mapping is found, returns a {@link javax.xml.transform.Source} object
- * containing an empty {@link java.io.Reader} if the
- * {@code javax.xml.catalog.resolve} property is set to {@code ignore};
+ * If no mapping is found, returns an empty {@link javax.xml.transform.Source}
+ * object if the {@code javax.xml.catalog.resolve} property is set to
+ * {@code ignore};
* returns a {@link javax.xml.transform.Source} object with the original URI
* (href, or href resolved with base if base is not null) if the
* {@code javax.xml.catalog.resolve} property is set to {@code continue}.
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteSystem.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteSystem.java
index cf136f2cd59..f3f470243d5 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteSystem.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteSystem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -72,6 +72,7 @@ final class RewriteSystem extends BaseEntry {
public String getSystemIdStartString () {
return systemIdStartString;
}
+
/**
* Get the rewritePrefix attribute.
* @return The rewritePrefix attribute value.
@@ -80,7 +81,6 @@ final class RewriteSystem extends BaseEntry {
return rewritePrefix;
}
-
/**
* Try to match the specified systemId with the entry. Return the match if it
* is successful and the length of the systemIdStartString is longer than the
@@ -91,14 +91,20 @@ final class RewriteSystem extends BaseEntry {
* @return The replacement URI if the match is successful, null if not.
*/
public String match(String systemId, int currentMatch) {
- if (systemIdStartString.length() <= systemId.length() &&
+ if (systemIdStartString.length() < systemId.length() &&
systemIdStartString.equals(systemId.substring(0, systemIdStartString.length()))) {
if (currentMatch < systemIdStartString.length()) {
String prefix = rewritePrefix.toExternalForm();
- if (!prefix.endsWith(SLASH) && !systemId.startsWith(SLASH)) {
- return prefix + SLASH + systemId.substring(systemIdStartString.length());
+ String sysId;
+ if (systemIdStartString.endsWith(SLASH)) {
+ sysId = systemId.substring(systemIdStartString.length());
} else {
- return prefix + systemId.substring(systemIdStartString.length());
+ sysId = systemId.substring(systemIdStartString.length() + 1);
+ }
+ if (prefix.endsWith(SLASH)) {
+ return prefix + sysId;
+ } else {
+ return prefix + SLASH + sysId;
}
}
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java b/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java
index 0aec4e41d29..f5c60b06730 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/RewriteUri.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -72,6 +72,7 @@ final class RewriteUri extends BaseEntry {
public String getURIStartString () {
return uriStartString;
}
+
/**
* Get the rewritePrefix attribute.
* @return The rewritePrefix attribute value.
@@ -91,14 +92,20 @@ final class RewriteUri extends BaseEntry {
*/
@Override
public String match(String systemId, int currentMatch) {
- if (uriStartString.length() <= systemId.length() &&
+ if (uriStartString.length() < systemId.length() &&
uriStartString.equals(systemId.substring(0, uriStartString.length()))) {
if (currentMatch < uriStartString.length()) {
String prefix = rewritePrefix.toExternalForm();
- if (!prefix.endsWith(SLASH) && !systemId.startsWith(SLASH)) {
- return prefix + SLASH + systemId.substring(uriStartString.length());
+ String sysId;
+ if (uriStartString.endsWith(SLASH)) {
+ sysId = systemId.substring(uriStartString.length());
} else {
- return prefix + systemId.substring(uriStartString.length());
+ sysId = systemId.substring(uriStartString.length() + 1);
+ }
+ if (prefix.endsWith(SLASH)) {
+ return prefix + sysId;
+ } else {
+ return prefix + SLASH + sysId;
}
}
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/Source.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/Source.java
index fe3d7111439..a9b75f2c42f 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/Source.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/Source.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,4 +52,17 @@ public interface Source {
* if setSystemId was not called.
*/
public String getSystemId();
+
+ /**
+ * Indicates whether the {@code Source} object is empty. Empty means
+ * that there is no input available from this Source.
+ *
+ * @implSpec The default implementation of this method throws
+ * {@link UnsupportedOperationException}.
+ *
+ * @return true if the {@code Source} object is empty, false otherwise
+ */
+ default boolean isEmpty() {
+ throw new UnsupportedOperationException("The isEmpty method is not supported.");
+ }
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/DOMSource.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/DOMSource.java
index dc4e93e07f1..b977c14f035 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/DOMSource.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/dom/DOMSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -122,6 +122,7 @@ public class DOMSource implements Source {
*
* @param systemID Base URL for this DOM tree.
*/
+ @Override
public void setSystemId(String systemID) {
this.systemID = systemID;
}
@@ -132,7 +133,25 @@ public class DOMSource implements Source {
*
* @return Base URL for this DOM tree.
*/
+ @Override
public String getSystemId() {
return this.systemID;
}
+
+ /**
+ * Indicates whether the {@code DOMSource} object is empty. Empty is
+ * defined as follows:
+ *
+ *
if the system identifier and node are {@code null};
+ *
+ *
if the system identifier is null, and the {@code node} has no child nodes.
+ *
+ *
+ *
+ * @return true if the {@code DOMSource} object is empty, false otherwise
+ */
+ @Override
+ public boolean isEmpty() {
+ return systemID == null && (node == null || !node.hasChildNodes());
+ }
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java
index 0d573780e56..1829042e899 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/sax/SAXSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -147,6 +147,7 @@ public class SAXSource implements Source {
*
* @param systemId The system identifier as a URI string.
*/
+ @Override
public void setSystemId(String systemId) {
if (null == inputSource) {
@@ -162,6 +163,7 @@ public class SAXSource implements Source {
*
* @return Base URL for the Source, or null.
*/
+ @Override
public String getSystemId() {
if (inputSource == null) {
@@ -207,4 +209,22 @@ public class SAXSource implements Source {
return null;
}
}
+
+ /**
+ * Indicates whether the {@code SAXSource} object is empty. Empty is
+ * defined as follows:
+ *
+ *
if the system identifier and {@code InputSource} are {@code null};
+ *
+ *
if the system identifier is {@code null}, and the {@code InputSource}
+ * is empty.
+ *
+ *
+ *
+ * @return true if the {@code SAXSource} object is empty, false otherwise
+ */
+ @Override
+ public boolean isEmpty() {
+ return getSystemId() == null && (inputSource == null || inputSource.isEmpty());
+ }
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/StAXSource.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/StAXSource.java
index dd04b63fb69..43e17c6e14e 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/StAXSource.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/stax/StAXSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -209,6 +209,7 @@ public class StAXSource implements Source {
* @throws UnsupportedOperationException Is always
* thrown by this method.
*/
+ @Override
public void setSystemId(final String systemId) {
throw new UnsupportedOperationException(
@@ -229,8 +230,21 @@ public class StAXSource implements Source {
*
* @return System identifier used by this StAXSource.
*/
+ @Override
public String getSystemId() {
return systemId;
}
+
+ /**
+ * Indicates whether the {@code StAXSource} object is empty. Since a
+ * {@code StAXSource} object can never be empty, this method always returns
+ * false.
+ *
+ * @return unconditionally false
+ */
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
}
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/StreamSource.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/StreamSource.java
index 7627d5e3b55..a708db3017d 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/StreamSource.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/stream/StreamSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,10 @@
package javax.xml.transform.stream;
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import javax.xml.transform.Result;
import javax.xml.transform.Source;
@@ -233,6 +235,7 @@ public class StreamSource implements Source {
*
* @param systemId The system identifier as a URL string.
*/
+ @Override
public void setSystemId(String systemId) {
this.systemId = systemId;
}
@@ -243,6 +246,7 @@ public class StreamSource implements Source {
* @return The system identifier that was set with setSystemId, or null
* if setSystemId was not called.
*/
+ @Override
public String getSystemId() {
return systemId;
}
@@ -259,6 +263,59 @@ public class StreamSource implements Source {
this.systemId = f.toURI().toASCIIString();
}
+ /**
+ * Indicates whether the {@code StreamSource} object is empty. Empty is
+ * defined as follows:
+ *
+ *
All of the input sources, including the public identifier, system
+ * identifier, byte stream, and character stream, are {@code null}.
+ *
+ *
The public identifier and system identifier are {@code null}, and
+ * byte and character stream are either {@code null} or contain no byte or
+ * character.
+ *
+ * Note that this method will reset the byte stream if it is provided, or
+ * the character stream if the byte stream is not provided.
+ *
+ *
+ *
+ * In case of error while checking the byte or character stream, the method
+ * will return false to allow the XML processor to handle the error.
+ *
+ * @return true if the {@code StreamSource} object is empty, false otherwise
+ */
+ @Override
+ public boolean isEmpty() {
+ return (publicId == null && systemId == null && isStreamEmpty());
+ }
+
+ private boolean isStreamEmpty() {
+ boolean empty = true;
+ try {
+ if (inputStream != null) {
+ inputStream.reset();
+ int bytesRead = inputStream.available();
+ if (bytesRead > 0) {
+ return false;
+ }
+ }
+
+ if (reader != null) {
+ reader.reset();
+ int c = reader.read();
+ reader.reset();
+ if (c != -1) {
+ return false;
+ }
+ }
+ } catch (IOException ex) {
+ //in case of error, return false
+ return false;
+ }
+
+ return empty;
+ }
+
//////////////////////////////////////////////////////////////////////
// Internal state.
//////////////////////////////////////////////////////////////////////
diff --git a/jaxp/src/java.xml/share/classes/org/xml/sax/InputSource.java b/jaxp/src/java.xml/share/classes/org/xml/sax/InputSource.java
index 9498da395c7..f05d23f5108 100644
--- a/jaxp/src/java.xml/share/classes/org/xml/sax/InputSource.java
+++ b/jaxp/src/java.xml/share/classes/org/xml/sax/InputSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
package org.xml.sax;
+import java.io.IOException;
import java.io.Reader;
import java.io.InputStream;
@@ -343,8 +344,57 @@ public class InputSource {
return characterStream;
}
+ /**
+ * Indicates whether the {@code InputSource} object is empty. Empty is
+ * defined as follows:
+ *
+ *
All of the input sources, including the public identifier, system
+ * identifier, byte stream, and character stream, are {@code null}.
+ *
+ *
The public identifier and system identifier are {@code null}, and
+ * byte and character stream are either {@code null} or contain no byte
+ * or character.
+ *
+ * Note that this method will reset the byte stream if it is provided, or
+ * the character stream if the byte stream is not provided.
+ *
+ *
+ *
+ * In case of error while checking the byte or character stream, the method
+ * will return false to allow the XML processor to handle the error.
+ *
+ * @return true if the {@code InputSource} object is empty, false otherwise
+ */
+ public boolean isEmpty() {
+ return (publicId == null && systemId == null && isStreamEmpty());
+ }
+ private boolean isStreamEmpty() {
+ boolean empty = true;
+ try {
+ if (byteStream != null) {
+ byteStream.reset();
+ int bytesRead = byteStream.available();
+ if (bytesRead > 0) {
+ return false;
+ }
+ }
+ if (characterStream != null) {
+ characterStream.reset();
+ int c = characterStream.read();
+ characterStream.reset();
+ if (c != -1) {
+ return false;
+ }
+ }
+ } catch (IOException ex) {
+ //in case of error, return false
+ return false;
+ }
+
+ return empty;
+ }
////////////////////////////////////////////////////////////////////
// Internal state.
////////////////////////////////////////////////////////////////////
diff --git a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
index cde6fafa8cc..a0066a9a0e5 100644
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
@@ -56,23 +56,14 @@ public class DeferFeatureTest {
@DataProvider(name = "catalog-countOfLoadedCatalogFile")
private Object[][] data() {
- return new Object[][] {
- // This catalog specifies null catalog explicitly,
- // and the count of loaded catalogs should be 0.
- { createCatalog(null), 0 },
-
- // This catalog specifies null catalog implicitly,
- // and the count of loaded catalogs should be 0.
- { createCatalog(CatalogFeatures.defaults()), 0 },
-
- // This catalog loads null catalog with true DEFER,
- // and the count of loaded catalogs should be 0.
- { createCatalog(createDeferFeature(DEFER_TRUE)), 0 },
-
- // This catalog loads null catalog with false DEFER.
- // It should load all of none-current catalogs and the
- // count of loaded catalogs should be 3.
- { createCatalog(createDeferFeature(DEFER_FALSE)), 3 } };
+ return new Object[][]{
+ // By default, alternative catalogs are not loaded.
+ {createCatalog(CatalogFeatures.defaults()), 0},
+ // Alternative catalogs are not loaded when DEFER is set to true.
+ {createCatalog(createDeferFeature(DEFER_TRUE)), 0},
+ // The 3 alternative catalogs are not pre-loaded
+ //when DEFER is set to false.
+ {createCatalog(createDeferFeature(DEFER_FALSE)), 3}};
}
private CatalogFeatures createDeferFeature(String defer) {
diff --git a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
index 291d86d02c0..0e0ff9f194c 100644
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
@@ -83,7 +83,7 @@ final class CatalogTestUtils {
* Creates CatalogResolver with a set of catalogs.
*/
static CatalogResolver catalogResolver(String... catalogName) {
- return catalogResolver(null, catalogName);
+ return catalogResolver(CatalogFeatures.defaults(), catalogName);
}
/*
@@ -91,15 +91,16 @@ final class CatalogTestUtils {
*/
static CatalogResolver catalogResolver(CatalogFeatures features,
String... catalogName) {
- return CatalogManager.catalogResolver(features,
- getCatalogPaths(catalogName));
+ return (catalogName == null) ?
+ CatalogManager.catalogResolver(features) :
+ CatalogManager.catalogResolver(features, getCatalogPaths(catalogName));
}
/*
* Creates catalogUriResolver with a set of catalogs.
*/
static CatalogUriResolver catalogUriResolver(String... catalogName) {
- return catalogUriResolver(null, catalogName);
+ return catalogUriResolver(CatalogFeatures.defaults(), catalogName);
}
/*
@@ -107,8 +108,9 @@ final class CatalogTestUtils {
*/
static CatalogUriResolver catalogUriResolver(
CatalogFeatures features, String... catalogName) {
- return CatalogManager.catalogUriResolver(features,
- getCatalogPaths(catalogName));
+ return (catalogName == null) ?
+ CatalogManager.catalogUriResolver(features) :
+ CatalogManager.catalogUriResolver(features, getCatalogPaths(catalogName));
}
// Gets the paths of the specified catalogs.
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java
index a7f18083d30..8269f05eee1 100644
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPTestUtilities.java
@@ -89,7 +89,7 @@ public class JAXPTestUtilities {
/**
* BOM table for storing BOM header.
*/
- private final static Map bom = new HashMap();
+ private final static Map bom = new HashMap<>();
/**
* Initialize all BOM headers.
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java
index a9515da6676..08830042132 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,14 +27,13 @@ import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogFeatures.Feature;
import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import static jaxp.library.JAXPTestUtilities.getPathByClassName;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -42,11 +41,65 @@ import org.xml.sax.XMLReader;
import org.xml.sax.ext.DefaultHandler2;
/*
- * @bug 8081248
+ * @bug 8081248, 8144966, 8146606
* @summary Tests basic Catalog functions.
*/
public class CatalogTest {
+ /*
+ @bug 8146606
+ Verifies that the resulting systemId does not contain duplicate slashes
+ */
+ public void testRewriteSystem() {
+ String catalog = getClass().getResource("rewriteCatalog.xml").getFile();
+
+ try {
+ CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
+ String actualSystemId = resolver.resolveEntity(null, "http://remote.com/dtd/book.dtd").getSystemId();
+ Assert.assertTrue(!actualSystemId.contains("//"), "result contains duplicate slashes");
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+
+ }
+
+ /*
+ @bug 8146606
+ Verifies that the resulting systemId does not contain duplicate slashes
+ */
+ public void testRewriteUri() {
+ String catalog = getClass().getResource("rewriteCatalog.xml").getFile();
+
+ try {
+
+ CatalogUriResolver resolver = CatalogManager.catalogUriResolver(CatalogFeatures.defaults(), catalog);
+ String actualSystemId = resolver.resolve("http://remote.com/import/import.xsl", null).getSystemId();
+ Assert.assertTrue(!actualSystemId.contains("//"), "result contains duplicate slashes");
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ /*
+ @bug 8144966
+ Verifies that passing null as CatalogFeatures will result in a NPE.
+ */
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testFeatureNull() {
+ CatalogResolver resolver = CatalogManager.catalogResolver(null, "");
+
+ }
+
+ /*
+ @bug 8144966
+ Verifies that passing null as the path will result in a NPE.
+ */
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testPathNull() {
+ String path = null;
+ CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), path);
+ }
+
/*
Tests basic catalog feature by using a CatalogResolver instance to
resolve a DTD reference to a locally specified DTD file. If the resolution
@@ -61,7 +114,7 @@ public class CatalogTest {
}
String url = getClass().getResource(xml).getFile();
try {
- CatalogResolver cr = CatalogManager.catalogResolver(null, catalog);
+ CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
XMLReader reader = saxParser.getXMLReader();
reader.setEntityResolver(cr);
MyHandler handler = new MyHandler(saxParser);
@@ -84,7 +137,7 @@ public class CatalogTest {
String test = "testInvalidCatalog";
try {
- CatalogResolver resolver = CatalogManager.catalogResolver(null, catalog);
+ CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
String actualSystemId = resolver.resolveEntity(null, "http://remote/xml/dtd/sys/alice/docAlice.dtd").getSystemId();
} catch (Exception e) {
String msg = e.getMessage();
diff --git a/jaxp/test/javax/xml/jaxp/unittest/catalog/rewriteCatalog.xml b/jaxp/test/javax/xml/jaxp/unittest/catalog/rewriteCatalog.xml
new file mode 100644
index 00000000000..8ef5c9b0117
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/rewriteCatalog.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java b/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java
new file mode 100644
index 00000000000..f3deba62395
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/Sources.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package common;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * @bug 8144967
+ * @summary Tests related to the javax.xml.transform.Source
+ * and org.xml.sax.InputSource
+ */
+public class Sources {
+
+ /**
+ * @bug 8144967
+ * Tests whether a Source object is empty
+ * @param source the Source object
+ */
+ @Test(dataProvider = "emptySources")
+ public void testIsEmpty(Source source) {
+ Assert.assertTrue(source.isEmpty(), "The source is not empty");
+ }
+
+ /**
+ * @bug 8144967
+ * Tests that the source is not empty
+ * @param source the Source object
+ */
+ @Test(dataProvider = "nonEmptySources")
+ public void testIsNotEmpty(Source source) {
+ Assert.assertTrue(!source.isEmpty(), "The source is empty");
+ }
+
+ /**
+ * @bug 8144967
+ * Tests whether an InputSource object is empty
+ * @param source the InputSource object
+ */
+ @Test(dataProvider = "emptyInputSource")
+ public void testISIsEmpty(InputSource source) {
+ Assert.assertTrue(source.isEmpty(), "The source is not empty");
+ }
+
+ /*
+ * DataProvider: sources that are empty
+ */
+ @DataProvider(name = "emptySources")
+ Object[][] getSources() throws URISyntaxException {
+
+ return new Object[][]{
+ {new DOMSource()},
+ {new DOMSource(getDocument())},
+ {new SAXSource()},
+ {new SAXSource(new InputSource(new StringReader("")))},
+ {new SAXSource(getXMLReader(), new InputSource(new StringReader("")))},
+ {new StreamSource()},
+ {new StreamSource(new ByteArrayInputStream("".getBytes()))},
+ {new StreamSource(new StringReader(""))},
+ {new StreamSource(new StringReader(""), null)},
+ {new StreamSource((String) null)}
+ };
+ }
+
+ /*
+ * DataProvider: sources that are not empty
+ */
+ @DataProvider(name = "nonEmptySources")
+ Object[][] getSourcesEx() throws URISyntaxException {
+ StAXSource ss = null;
+ try {
+ ss = new StAXSource(getXMLEventReader());
+ } catch (XMLStreamException ex) {}
+
+ return new Object[][]{
+ //This will set a non-null systemId on the resulting StreamSource
+ {new StreamSource(new File(""))},
+ //Can't tell because XMLStreamReader is a pull parser, cursor advancement
+ //would have been required in order to examine the reader.
+ {new StAXSource(getXMLStreamReader())},
+ {ss}
+ };
+ }
+
+ /*
+ * DataProvider: sources that are empty
+ */
+ @DataProvider(name = "emptyInputSource")
+ Object[][] getInputSources() throws URISyntaxException {
+ byte[] utf8Bytes = null;
+ try {
+ utf8Bytes = "".getBytes("UTF8");
+ } catch (UnsupportedEncodingException ex) {
+ throw new RuntimeException(ex.getMessage());
+ }
+ return new Object[][]{
+ {new InputSource()},
+ {new InputSource(new ByteArrayInputStream(utf8Bytes))},
+ {new InputSource(new StringReader(""))},
+ {new InputSource((String) null)}
+ };
+ }
+
+ /**
+ * Returns an instance of Document.
+ *
+ * @return an instance of Document.
+ */
+ private Document getDocument() {
+ Document doc = null;
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ doc = dbf.newDocumentBuilder().newDocument();
+ } catch (ParserConfigurationException ex) {}
+ return doc;
+ }
+
+ /**
+ * Returns an instance of XMLReader.
+ *
+ * @return an instance of XMLReader.
+ */
+ private XMLReader getXMLReader() {
+ XMLReader reader = null;
+ try {
+ reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
+ } catch (ParserConfigurationException | SAXException ex) {}
+ return reader;
+ }
+
+ /**
+ * Returns an instance of XMLStreamReader.
+ *
+ * @return an instance of XMLStreamReader.
+ */
+ private XMLStreamReader getXMLStreamReader() {
+ XMLStreamReader r = null;
+ try {
+ XMLInputFactory xif = XMLInputFactory.newInstance();
+ r = xif.createXMLStreamReader(new ByteArrayInputStream("".getBytes()));
+ } catch (XMLStreamException ex) {}
+
+ return r;
+ }
+
+ /**
+ * Returns an instance of XMLEventReader.
+ *
+ * @return an instance of XMLEventReader.
+ */
+ private XMLEventReader getXMLEventReader() {
+ XMLEventReader r = null;
+ try {
+ r = XMLInputFactory.newInstance().createXMLEventReader(
+ new ByteArrayInputStream("".getBytes()));
+ } catch (XMLStreamException ex) {}
+
+ return r;
+ }
+}
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 4f84f88fb74..5450b82df39 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -346,3 +346,4 @@ b55cebc47555293cf9c2aefb3bf63c56e847ab19 jdk-9+96
67c84077edc3db6b24998b35970b37c01aae985e jdk-9+98
97b31ca0dd77483cf20ff99a033a455673639578 jdk-9+99
d0a97e57d2336238edf6a4cd60aafe67deb7258d jdk-9+100
+3e99318616da903e0dc8f07f9f9203dc1bd49921 jdk-9+101
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 9608d22d83d..9f1d47685fb 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -343,3 +343,5 @@ fdd84b2265ddce7f50e084b7c8635189bba6f012 jdk-9+97
f86ee68d1107dad41a27efc34306e0e56244a12e jdk-9+98
e1a789be1535741274c9779f4d4ca3495196b5c3 jdk-9+99
3d452840f48299a36842760d17c0c8402f0e1266 jdk-9+100
+5e8370fb3ed925335164afe340d1e54beab2d4d5 jdk-9+101
+6eb3c8132e489dab81adde4ce29844904ce15482 jdk-9+102
diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk
index 73f3edff8a0..ac2ce41de82 100644
--- a/jdk/make/CompileDemos.gmk
+++ b/jdk/make/CompileDemos.gmk
@@ -38,7 +38,8 @@ include TextFileProcessing.gmk
include ZipArchive.gmk
# Prepare the find cache.
-$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src))
+$(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/demo \
+ $(JDK_TOPDIR)/src/*/demo)))
# Append demo goals to this variable.
TARGETS =
diff --git a/jdk/make/CompileTools.gmk b/jdk/make/CompileTools.gmk
new file mode 100644
index 00000000000..27aaffaafdb
--- /dev/null
+++ b/jdk/make/CompileTools.gmk
@@ -0,0 +1,83 @@
+#
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include SetupJavaCompilers.gmk
+
+################################################################################
+
+JIMAGE_PKGS := \
+ jdk/internal/jimage \
+ jdk/internal/jrtfs \
+ #
+
+$(eval $(call SetupJavaCompilation,BUILD_INTERIM_JIMAGE, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+ INCLUDES := $(JIMAGE_PKGS), \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes))
+
+TARGETS += $(BUILD_INTERIM_JIMAGE)
+
+# Because of the explicit INCLUDES in the compilation setup above, the service provider
+# file will not be copied unless META-INF/services would also be added to the INCLUDES.
+# Adding META-INF/services would include all files in that directory when only the one
+# is needed, which is why this explicit copy is defined instead.
+$(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
+ SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+ DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
+ FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
+
+TARGETS += $(COPY_JIMAGE_SERVICE_PROVIDER)
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
+ $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+ $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
+ SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
+ COPY := boot.modules ext.modules))
+
+$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
+
+TARGETS += $(BUILD_TOOLS_JDK)
+
+$(eval $(call SetupCopyFiles,COPY_NIMBUS_TEMPLATES, \
+ SRC := $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus, \
+ DEST := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources, \
+ FILES := $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template)))
+
+TARGETS += $(COPY_NIMBUS_TEMPLATES)
+
+################################################################################
+
+all: $(TARGETS)
diff --git a/jdk/make/CopySamples.gmk b/jdk/make/CopySamples.gmk
index be20f92fd17..09d0bf7ba44 100644
--- a/jdk/make/CopySamples.gmk
+++ b/jdk/make/CopySamples.gmk
@@ -28,41 +28,38 @@ default: all
include $(SPEC)
include MakeBase.gmk
+################################################################################
+
SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample/image
SAMPLE_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/share
-SAMPLE_CLOSED_SOURCE_DIR := $(JDK_TOPDIR)/src/closed/sample/share
SAMPLE_SOLARIS_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/solaris
# Exclude the vm directory
-SAMPLE_FIND_FILTER := -name vm -prune -o
+$(eval $(call SetupCopyFiles, COPY_SHARE_SAMPLES, \
+ SRC := $(SAMPLE_SOURCE_DIR), \
+ DEST := $(SAMPLE_TARGET_DIR), \
+ FILES := $(filter-out $(SAMPLE_SOURCE_DIR)/vm/%, \
+ $(call CacheFind, $(SAMPLE_SOURCE_DIR))), \
+))
-SAMPLE_SOURCE := $(shell $(FIND) $(SAMPLE_SOURCE_DIR) $(SAMPLE_FIND_FILTER) -type f -print)
-SAMPLE_TARGET := $(subst $(SAMPLE_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_SOURCE))
-
-ifndef OPENJDK
-# Exclude Main.java in EbayClient dir
- SAMPLE_CLOSED_SOURCE := $(shell $(FIND) $(SAMPLE_CLOSED_SOURCE_DIR) -type f -print | $(GREP) -v EbayClient/Main.java)
- SAMPLE_CLOSED_TARGET := $(subst $(SAMPLE_CLOSED_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_CLOSED_SOURCE))
- SAMPLE_TARGET += $(SAMPLE_CLOSED_TARGET)
-endif
+TARGETS += $(COPY_SHARE_SAMPLES)
ifneq (, $(filter $(OPENJDK_TARGET_OS), solaris macosx))
- SAMPLE_SOLARIS_SOURCE := $(shell $(FIND) $(SAMPLE_SOLARIS_SOURCE_DIR) -type f -print)
- SAMPLE_SOLARIS_TARGET := $(subst $(SAMPLE_SOLARIS_SOURCE_DIR),$(SAMPLE_TARGET_DIR),$(SAMPLE_SOLARIS_SOURCE))
- SAMPLE_TARGET += $(SAMPLE_SOLARIS_TARGET)
+ $(eval $(call SetupCopyFiles, COPY_SOLARIS_SAMPLES, \
+ SRC := $(SAMPLE_SOLARIS_SOURCE_DIR), \
+ DEST := $(SAMPLE_TARGET_DIR), \
+ FILES := $(call CacheFind, $(SAMPLE_SOLARIS_SOURCE_DIR)), \
+ ))
+
+ TARGETS += $(COPY_SOLARIS_SAMPLES)
endif
-$(SAMPLE_TARGET_DIR)/dtrace/%: $(SAMPLE_SOLARIS_SOURCE_DIR)/dtrace/%
- $(call install-file)
+################################################################################
-$(SAMPLE_TARGET_DIR)/webservices/%: $(SAMPLE_CLOSED_SOURCE_DIR)/webservices/%
- $(call install-file)
+$(eval $(call IncludeCustomExtension, jdk, CopySamples.gmk))
-$(SAMPLE_TARGET_DIR)/%: $(SAMPLE_SOURCE_DIR)/%
- $(call install-file)
+################################################################################
-COPY_FILES += $(SAMPLE_TARGET)
+all: $(TARGETS)
-all: $(COPY_FILES)
-
-.PHONY: all
+.PHONY: all default
diff --git a/jdk/make/Import.gmk b/jdk/make/Import.gmk
index d4c5654aeac..42155494fb2 100644
--- a/jdk/make/Import.gmk
+++ b/jdk/make/Import.gmk
@@ -48,7 +48,7 @@ endif
ifneq ($(STATIC_BUILD), true)
JSIG_IMPORT = jsig.*
else
- JSIG_IMPORT =
+ JSIG_IMPORT =
endif
HOTSPOT_BASE_IMPORT_FILES := \
diff --git a/jdk/make/Tools.gmk b/jdk/make/Tools.gmk
index 7668928ff65..cd8d7e867a1 100644
--- a/jdk/make/Tools.gmk
+++ b/jdk/make/Tools.gmk
@@ -26,31 +26,14 @@
ifndef _TOOLS_GMK
_TOOLS_GMK := 1
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
include JavaCompilation.gmk
-include NativeCompilation.gmk
-include SetupJavaCompilers.gmk
################################################################################
-
-$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
- SETUP := GENERATE_OLDBYTECODE, \
- ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
- $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
- $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
- SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
- BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
- COPY := boot.modules ext.modules))
-
-$(eval $(call SetupCopyFiles,COPY_NIMBUS_TEMPLATES, \
- SRC := $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus, \
- DEST := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources, \
- FILES := $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template)))
-
-BUILD_TOOLS_JDK += $(COPY_NIMBUS_TEMPLATES)
+# To avoid reevaluating the compilation setup for the tools each time this file
+# is included, the actual compilation is handled by CompileTools.gmk. The
+# following trick is used to be able to declare a dependency on the built tools.
+BUILD_TOOLS_JDK := $(call SetupJavaCompilationCompileTarget, \
+ BUILD_TOOLS_JDK, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes)
################################################################################
@@ -135,34 +118,4 @@ TOOL_IMAGEBUILDER = $(JAVA_SMALL) -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/inte
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
build.tools.module.ImageBuilder
-##########################################################################################
-
-JIMAGE_PKGS := \
- jdk/internal/jimage \
- jdk/internal/jrtfs \
- #
-
-$(eval $(call SetupJavaCompilation,BUILD_INTERIM_JIMAGE, \
- SETUP := GENERATE_OLDBYTECODE, \
- SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
- INCLUDES := $(JIMAGE_PKGS), \
- BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes))
-
-# Because of the explicit INCLUDES in the compilation setup above, the service provider
-# file will not be copied unless META-INF/services would also be added to the INCLUDES.
-# Adding META-INF/services would include all files in that directory when only the one
-# is needed, which is why this explicit copy is defined instead.
-$(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
- SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
- DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
- FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
-
-##########################################################################################
-
-$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
-
-java-tools: $(BUILD_TOOLS_JDK)
-
-all: java-tools
-
endif # _TOOLS_GMK
diff --git a/jdk/make/copy/Copy-java.base.gmk b/jdk/make/copy/Copy-java.base.gmk
index 46687333361..ed8e42ae272 100644
--- a/jdk/make/copy/Copy-java.base.gmk
+++ b/jdk/make/copy/Copy-java.base.gmk
@@ -187,27 +187,31 @@ TARGETS += $(POLICY_DST)
ifeq ($(CACERTS_FILE), )
CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
endif
+
CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
$(CACERTS_DST): $(CACERTS_FILE)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
$(call install-file)
TARGETS += $(CACERTS_DST)
################################################################################
-$(CONF_DST_DIR)/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
- $(ECHO) $(LOG_INFO) Copying $(@F)
- $(call install-file)
+$(eval $(call SetupCopyFiles, COPY_NET_PROPERTIES, \
+ FILES := $(JDK_TOPDIR)/src/java.base/share/conf/net.properties, \
+ DEST := $(CONF_DST_DIR), \
+))
-TARGETS += $(CONF_DST_DIR)/net.properties
+TARGETS += $(COPY_NET_PROPERTIES)
ifeq ($(OPENJDK_TARGET_OS), solaris)
- $(CONF_DST_DIR)/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template
- $(ECHO) $(LOG_INFO) Copying $(@F)
- $(call install-file)
+ $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \
+ FILES := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \
+ DEST := $(CONF_DST_DIR)/sdp, \
+ ))
- TARGETS += $(CONF_DST_DIR)/sdp/sdp.conf.template
+ TARGETS += $(COPY_SDP_CONF)
endif
################################################################################
diff --git a/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem b/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem
index db1c077ccb0..191e94e12a5 100644
--- a/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem
+++ b/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem
@@ -725,3 +725,26 @@ v9qpeC45ZA/jelxV11HKbQnVF194gDb7D2H9OsAsRUy8HVKbXEcc/8dKvwOqb+BC
DBabJH1vJ9Gd+KwxMCmBZ6pQPl28JDimhJhI2LNqU349uADQVV0HJosddN/ARyyI
LSIQO7BnNVKVG9Iujf33bvPNeg0qNz5qw+rKKq97Pqeum+L5oKU=
-----END CERTIFICATE-----
+
+// Subject: CN=eDellRoot
+// Issuer: CN=eDellRoot
+// Serial Number:
+// 6b:c5:7b:95:18:93:aa:97:4b:62:4a:c0:88:fc:3b:b6
+-----BEGIN CERTIFICATE-----
+MIIC8zCCAd+gAwIBAgIQa8V7lRiTqpdLYkrAiPw7tjAJBgUrDgMCHQUAMBQxEjAQ
+BgNVBAMTCWVEZWxsUm9vdDAeFw0xNTA0MDcxMDIzMjdaFw0zOTEyMzEyMzU5NTla
+MBQxEjAQBgNVBAMTCWVEZWxsUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBAL3RJg1uzVuEX0Hw4XWGzs6oI9W+o7HZdVdBMMVb4Gzb4uZjCTNjbPx4
+b8LNFL1uArUt+5VVMQDsOTY3Lg/Xe/UNukY2b+0llUOzzBYYpbsFcco4n6SsTvDh
+Ni5t+kPo7c23ZrYBPmOu82eEJ6cavs/t39u+wFOkXXwvRCiHA/lWyNWNEPh17+bC
+EP3q5N+JrV+6Ho3zQPEv5QUJYdmXsMmD2CMQojeQUj68J91P5w5BKjurG0xjivzh
+Soie9ym7VRwLFjWScRuw/9XV6CLqTyL5xrqiiDp1uTOuqNj3uxyts9ocbsoJXuxj
+5iEYkSM1nvLupEv+lgy9WqzIEFMm1l8CAwEAAaNJMEcwRQYDVR0BBD4wPIAQYA/f
+EzPwmaRcZuSaa/VZ1KEWMBQxEjAQBgNVBAMTCWVEZWxsUm9vdIIQa8V7lRiTqpdL
+YkrAiPw7tjAJBgUrDgMCHQUAA4IBAQArfdcScsezj8ooJ92UwwnPgg36noOgiUs5
+XzPLP4h0JpUYQVKB9hY1WTDwRUfTKGh7oNOowd027a/rVSb/TNeoiJIvMKn4gbvV
+CWAiHhO8u2u0RkHCDVsa7e0i4ncpueWsihjn6jBrY8T+7eDYwiFT/F03A8NJ7mK5
+lZA8SFd5CTDy3EBUU5UwzXUc5HoIRUxXSPycu3aIBWawg3sCdKiAoikScPAWj0bM
+0vmsP/8QSlTOBqO+QFQ6R82BtTvBNU3qbVICV4QObsxib++FAFL56NApPqskg7Vz
+LfNIAjKabHUcjbuZkmg6jr4BfYW7+oQDHCsYgADjjKGdKz/8U/fP
+-----END CERTIFICATE-----
diff --git a/jdk/make/gendata/GendataBreakIterator.gmk b/jdk/make/gendata/GendataBreakIterator.gmk
index 38bf0e537bb..b2827da2f0f 100644
--- a/jdk/make/gendata/GendataBreakIterator.gmk
+++ b/jdk/make/gendata/GendataBreakIterator.gmk
@@ -68,8 +68,8 @@ BIFILES_TH := $(LD_DATA_PKG_DIR)/th/WordBreakIteratorData_th \
$(BIFILES): $(BASE_DATA_PKG_DIR)/_the.bifiles
$(BASE_DATA_PKG_DIR)/_the.bifiles: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
$(BASE_DATA_PKG_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
- $(ECHO) $(LOG_INFO) "Generating BreakIteratorData"
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating BreakIteratorData)
+ $(call MakeDir, $(@D))
$(RM) $(BIFILES)
$(TOOL_GENERATEBREAKITERATORDATA) \
-o $(@D) \
@@ -79,8 +79,8 @@ $(BASE_DATA_PKG_DIR)/_the.bifiles: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKIT
$(BIFILES_TH): $(LD_DATA_PKG_DIR)/_the.bifiles_th
$(LD_DATA_PKG_DIR)/_the.bifiles_th: JAVA_FLAGS += -Xbootclasspath/p:$(BREAK_ITERATOR_CLASSES)
$(LD_DATA_PKG_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKITERATOR)
- $(ECHO) $(LOG_INFO) "Generating BreakIteratorData_th"
- $(MKDIR) -p $(@D)/th
+ $(call LogInfo, Generating BreakIteratorData_th)
+ $(call MakeDir, $(@D)/th)
$(RM) $(BIFILES_TH)
$(TOOL_GENERATEBREAKITERATORDATA) \
-o $(@D) \
diff --git a/jdk/make/gendata/GendataHtml32dtd.gmk b/jdk/make/gendata/GendataHtml32dtd.gmk
index 1adb85ad0aa..2bc0e708673 100644
--- a/jdk/make/gendata/GendataHtml32dtd.gmk
+++ b/jdk/make/gendata/GendataHtml32dtd.gmk
@@ -27,7 +27,7 @@ GENDATA_HTML32DTD :=
HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
$(HTML32DTD): $(BUILD_TOOLS_JDK)
- $(ECHO) "Generating HTML DTD file"
+ $(call LogInfo, Generating HTML DTD file)
$(MKDIR) -p $(@D)
$(RM) $@
($(TOOL_DTDBUILDER) $(LOG_INFO) html32 > $@) || exit 1
diff --git a/jdk/make/gendata/GendataPolicyJars.gmk b/jdk/make/gendata/GendataPolicyJars.gmk
index 82e2e424446..ffed629f011 100644
--- a/jdk/make/gendata/GendataPolicyJars.gmk
+++ b/jdk/make/gendata/GendataPolicyJars.gmk
@@ -87,8 +87,7 @@ $(eval $(call SetupJarArchive, BUILD_US_EXPORT_POLICY_JAR, \
$(US_EXPORT_POLICY_JAR_LIMITED): \
$(US_EXPORT_POLICY_JAR_UNLIMITED)
- $(ECHO) $(LOG_INFO) \
- Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED) $(US_EXPORT_POLICY_JAR_UNLIMITED)
@@ -99,7 +98,7 @@ ifeq ($(UNLIMITED_CRYPTO), true)
else
$(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED)
$(install-file)
-endif
+endif
ifndef OPENJDK
ifneq ($(UNLIMITED_CRYPTO), true)
diff --git a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk
index fc6c481f523..c5f79ce54c9 100644
--- a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk
@@ -46,30 +46,34 @@ $(CHARSET_DONE_CS)-extcs: $(CHARSET_DATA_DIR)/charsets \
$(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
$(CHARSET_TEMPLATES) $(CHARSET_EXTENDED_JAVA_TEMPLATES) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating jdk.charsets extcs)
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) \
extcs charsets $(CHARSET_STANDARD_OS) \
$(CHARSET_EXTENDED_JAVA_TEMPLATES) \
$(CHARSET_EXTENDED_JAVA_DIR) \
$(CHARSET_COPYRIGHT_HEADER) \
- $(LOG_INFO)
+ $(LOG_DEBUG)
$(TOUCH) '$@'
$(CHARSET_DONE_CS)-hkscs: $(CHARSET_COPYRIGHT_HEADER)/HKSCS.java \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating jdk.charsets hkscs)
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) hkscs '$<'
$(TOUCH) '$@'
$(CHARSET_DONE_CS)-euctw: $(CHARSET_COPYRIGHT_HEADER)/EUC_TW.java \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating jdk.charsets euctw)
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_CS) euctw '$<'
$(TOUCH) '$@'
$(CHARSET_GENSRC_JAVA_DIR_CS)/sjis0213.dat: $(CHARSET_DATA_DIR)/sjis0213.map \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) '$<' '$@' sjis0213
GENSRC_JDK_CHARSETS += \
@@ -86,4 +90,3 @@ jdk.charsets: $(GENSRC_JDK_CHARSETS)
all: jdk.charsets
.PHONY: all jdk.charsets
-
diff --git a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
index 9fd609f5fb0..21186f3af08 100644
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
@@ -40,19 +40,18 @@ $(HEADER_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK)
# Touch the target of this rule at the end to avoid triggering false rebuilds
$(JAVA_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) $(HEADER_FILE)
- $(MKDIR) -p $(@D)
- $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent
+ $(call LogInfo, Creating JDWP.java and JDWPCommands.h from jdwp.spec)
+ $(call MakeDir, $(@D) $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent)
$(RM) $@ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
- $(ECHO) $(LOG_INFO) Creating JDWP.java and JDWPCommands.h from jdwp.spec
$(TOOL_JDWPGEN) $< -jdi $@ -include \
$(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
$(TOUCH) $@
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Creating $(@F) from jdwp.spec)
+ $(call MakeDir, $(@D))
$(RM) $@
- $(ECHO) $(LOG_INFO) Creating $(@F) from jdwp.spec
$(TOOL_JDWPGEN) $< -doc $@
GENSRC_JDWP := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
@@ -63,14 +62,14 @@ GENSRC_JDK_JDI += $(GENSRC_JDWP)
################################################################################
define process-provider
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
$(CAT) $^ | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $@
endef
# Filter com.sun.jdi.connect.Connector
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
$(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
- $(HOTSPOT_TOPDIR)/agent/src/share/classes/META-INF/services/com.sun.jdi.connect.Connector
+ $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/META-INF/services/com.sun.jdi.connect.Connector
$(process-provider)
# Copy the same service file into jdk.hotspot.agent so that they are kept the same.
diff --git a/jdk/make/gensrc/GensrcBuffer.gmk b/jdk/make/gensrc/GensrcBuffer.gmk
index 2f5d789cd60..34c67125aea 100644
--- a/jdk/make/gensrc/GensrcBuffer.gmk
+++ b/jdk/make/gensrc/GensrcBuffer.gmk
@@ -23,7 +23,7 @@
# questions.
#
-GENSRC_BUFFER :=
+GENSRC_BUFFER :=
GENSRC_BUFFER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
@@ -31,9 +31,9 @@ GENSRC_BUFFER_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/java/nio
###
-$(GENSRC_BUFFER_DST)/_the.buffer.dir:
- $(ECHO) "Generating buffer classes"
- $(MKDIR) -p $(@D)
+$(GENSRC_BUFFER_DST)/_the.buffer.dir:
+ $(call LogInfo, Generating buffer classes)
+ $(call MakeDir, $(@D))
$(TOUCH) $@
define fixRw
diff --git a/jdk/make/gensrc/GensrcCharacterData.gmk b/jdk/make/gensrc/GensrcCharacterData.gmk
index b0b5eddacde..3994902edb2 100644
--- a/jdk/make/gensrc/GensrcCharacterData.gmk
+++ b/jdk/make/gensrc/GensrcCharacterData.gmk
@@ -35,8 +35,8 @@ UNICODEDATA = $(JDK_TOPDIR)/make/data/unicodedata
define SetupCharacterData
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: \
$(CHARACTERDATA)/$1.java.template
- $(MKDIR) -p $$(@D)
- $(ECHO) $(LOG_INFO) Generating $1.java
+ $$(call LogInfo, Generating $1.java)
+ $$(call MakeDir, $$(@D))
$(TOOL_GENERATECHARACTER) $2 \
-template $(CHARACTERDATA)/$1.java.template \
-spec $(UNICODEDATA)/UnicodeData.txt \
@@ -56,7 +56,7 @@ $(eval $(call SetupCharacterData,CharacterData0E, -plane 14, 11 4 1))
# Copy two Java files that need no preprocessing.
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template
- $(ECHO) $(LOG_INFO) Generating $(@F)
+ $(call LogInfo, Generating $(@F))
$(call install-file)
GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataUndefined.java \
diff --git a/jdk/make/gensrc/GensrcCharsetMapping.gmk b/jdk/make/gensrc/GensrcCharsetMapping.gmk
index 0218d4a1039..c904c54de23 100644
--- a/jdk/make/gensrc/GensrcCharsetMapping.gmk
+++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk
@@ -44,13 +44,13 @@ $(CHARSET_DONE_BASE)-stdcs: $(CHARSET_DATA_DIR)/charsets \
$(wildcard $(CHARSET_DATA_DIR)/$(CHARSET_STANDARD_OS)) \
$(CHARSET_TEMPLATES) $(CHARSET_STANDARD_JAVA_TEMPLATES) \
$(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating java.base charset mapping)
+ $(call MakeDir, $(@D))
$(TOOL_CHARSETMAPPING) $(CHARSET_DATA_DIR) $(CHARSET_GENSRC_JAVA_DIR_BASE) \
stdcs charsets $(CHARSET_STANDARD_OS) \
$(CHARSET_STANDARD_JAVA_TEMPLATES) $(CHARSET_EXTSRC_DIR) \
$(CHARSET_COPYRIGHT_HEADER) \
- $(LOG_INFO)
+ $(LOG_DEBUG)
$(TOUCH) '$@'
GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-stdcs
-
diff --git a/jdk/make/gensrc/GensrcExceptions.gmk b/jdk/make/gensrc/GensrcExceptions.gmk
index 398a8857963..947cd019eec 100644
--- a/jdk/make/gensrc/GensrcExceptions.gmk
+++ b/jdk/make/gensrc/GensrcExceptions.gmk
@@ -32,21 +32,12 @@ GENSRC_EXCEPTIONS_CMD := $(JDK_TOPDIR)/make/scripts/genExceptions.sh
GENSRC_EXCEPTIONS_SRC_DIRS := . charset channels
-###
-
-$(GENSRC_EXCEPTIONS_DST)/_the.exceptions.dir:
- $(ECHO) "Generating exceptions classes"
- $(MKDIR) -p $(@D)
- $(TOUCH) $@
-
-
-###
-
$(GENSRC_EXCEPTIONS_DST)/_the.%.marker: $(GENSRC_EXCEPTIONS_SRC)/%/exceptions \
- $(GENSRC_EXCEPTIONS_CMD) \
- $(GENSRC_EXCEPTIONS_DST)/_the.exceptions.dir
- $(MKDIR) -p $(@D)/$*
- SCRIPTS="$(JDK_TOPDIR)/make/scripts" NAWK="$(NAWK)" SH="$(SH)" $(SH) $(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_INFO)
+ $(GENSRC_EXCEPTIONS_CMD)
+ $(call LogInfo, Generating exceptions java.nio $*)
+ $(call MakeDir, $(@D)/$*)
+ SCRIPTS="$(JDK_TOPDIR)/make/scripts" NAWK="$(NAWK)" SH="$(SH)" $(SH) \
+ $(GENSRC_EXCEPTIONS_CMD) $< $(@D)/$* $(LOG_DEBUG)
$(TOUCH) $@
GENSRC_EXCEPTIONS += $(foreach D,$(GENSRC_EXCEPTIONS_SRC_DIRS),$(GENSRC_EXCEPTIONS_DST)/_the.$(D).marker)
diff --git a/jdk/make/gensrc/GensrcIcons.gmk b/jdk/make/gensrc/GensrcIcons.gmk
index 6e1b5df596f..32ab58a3137 100644
--- a/jdk/make/gensrc/GensrcIcons.gmk
+++ b/jdk/make/gensrc/GensrcIcons.gmk
@@ -65,8 +65,8 @@ GENSRC_AWT_ICONS_DST_NAME = AWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))
################################################################################
$(GENSRC_AWT_ICONS_TMP)/_the.icons.dir:
- $(ECHO) Generating icon classes
- $(MKDIR) -p $(GENSRC_AWT_ICONS_DST)
+ $(call LogInfo, Generating icon classes)
+ $(call MakeDir, $(GENSRC_AWT_ICONS_DST))
$(TOUCH) $@
################################################################################
@@ -121,8 +121,9 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
endif
$(GENSRC_OSX_ICONS): $(GENSRC_OSX_ICONS_SRC) $(BUILD_TOOLS_JDK)
+ $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call MakeDir, $(@D))
$(RM) $@ $@.tmp
- $(MKDIR) -p $(dir $@)
$(ECHO) "static unsigned char sAWTIconData[] = { " >> $@.tmp
$(CAT) $< | $(TOOL_OSX_TOBIN) >> $@.tmp
$(ECHO) "};" >> $@.tmp
diff --git a/jdk/make/gensrc/GensrcLocaleData.gmk b/jdk/make/gensrc/GensrcLocaleData.gmk
index 71b091bac8a..602a4f4752f 100644
--- a/jdk/make/gensrc/GensrcLocaleData.gmk
+++ b/jdk/make/gensrc/GensrcLocaleData.gmk
@@ -28,8 +28,9 @@
# into LocaleDataMetaInfo.java
# First go look for all locale files
-LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/java.base/share/classes \
- $(JDK_TOPDIR)/src/jdk.localedata/share/classes \
+LOCALE_FILES := $(shell $(FIND) \
+ $(JDK_TOPDIR)/src/$(MODULE)/share/classes/sun/text/resources \
+ $(JDK_TOPDIR)/src/$(MODULE)/share/classes/sun/util/resources \
-name "FormatData_*.java" -o -name "FormatData_*.properties" -o \
-name "CollationData_*.java" -o -name "CollationData_*.properties" -o \
-name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \
@@ -42,17 +43,21 @@ LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/java.base/share/classes \
LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
# Include the list of resources found during the previous compile.
--include $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+-include $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.locale_resources
MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES))
NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES))
ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES))
# There is a difference in the number of supported resources. Trigger a regeneration.
- $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java \
- $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java \
- $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java \
- $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java)
+ ifeq ($(MODULE), java.base)
+ $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java)
+ endif
+ ifeq ($(MODULE), jdk.localedata)
+ $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java \
+ $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java)
+ endif
endif
# The base locales
@@ -121,18 +126,18 @@ SED_NONBASEARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_NON
$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
+ $(call LogInfo, Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
$(MKDIR) -p $(@D)
- $(ECHO) Creating sun/util/locale/provider/BaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
- > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+ > $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources
$(SED) $(SED_BASEARGS) $< > $@
$(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java: \
$(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
+ $(call LogInfo, Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources)
$(MKDIR) -p $(@D)
- $(ECHO) Creating sun/util/resources/provider/NonBaseLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
- > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
+ > $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources
$(SED) $(SED_NONBASEARGS) $< > $@
GENSRC_BASELOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/BaseLocaleDataMetaInfo.java
diff --git a/jdk/make/gensrc/GensrcMisc.gmk b/jdk/make/gensrc/GensrcMisc.gmk
index 6e3cc38950d..bc70e0e01f0 100644
--- a/jdk/make/gensrc/GensrcMisc.gmk
+++ b/jdk/make/gensrc/GensrcMisc.gmk
@@ -50,7 +50,7 @@ GENSRC_SOR_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSocketOptionRegistry
SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
-$(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOR_EXE, \
+$(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOR_EXE, \
SRC := $(GENSRC_SOR_SRC), \
INCLUDE_FILES := $(GENSRC_SOR_SRC_FILE), \
TOOLCHAIN := TOOLCHAIN_BUILD, \
@@ -86,7 +86,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
- $(eval $(call SetupNativeCompilation,BUILD_GENSRC_UC_EXE, \
+ $(eval $(call SetupNativeCompilation, BUILD_GENSRC_UC_EXE, \
SRC := $(GENSRC_UC_SRC), \
INCLUDE_FILES := $(GENSRC_UC_SRC_FILE), \
TOOLCHAIN := TOOLCHAIN_BUILD, \
@@ -124,7 +124,7 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
- $(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOL_EXE, \
+ $(eval $(call SetupNativeCompilation, BUILD_GENSRC_SOL_EXE, \
SRC := $(GENSRC_SOL_SRC), \
INCLUDE_FILES := $(GENSRC_SOL_SRC_FILE), \
TOOLCHAIN := TOOLCHAIN_BUILD, \
diff --git a/jdk/make/gensrc/GensrcProperties.gmk b/jdk/make/gensrc/GensrcProperties.gmk
index 2cc6231175e..7293a19bbeb 100644
--- a/jdk/make/gensrc/GensrcProperties.gmk
+++ b/jdk/make/gensrc/GensrcProperties.gmk
@@ -75,7 +75,7 @@ define SetupCompilePropertiesBody
# Convert .../src//share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
# to .../support/gensrc//com/sun/tools/javac/resources/javac_zh_CN.java
- # Strip away prefix and suffix, leaving for example only:
+ # Strip away prefix and suffix, leaving for example only:
# "/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
$1_JAVAS := $$(patsubst $$($1_MODULE_PATH_ROOT)/%, \
$(SUPPORT_OUTPUTDIR)/gensrc/%, \
diff --git a/jdk/make/gensrc/GensrcSwing.gmk b/jdk/make/gensrc/GensrcSwing.gmk
index 2f643d4abc2..eee0c044f2f 100644
--- a/jdk/make/gensrc/GensrcSwing.gmk
+++ b/jdk/make/gensrc/GensrcSwing.gmk
@@ -31,12 +31,11 @@ NIMBUS_GENSRC_DIR = $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/javax/swing/plaf/ni
NIMBUS_SKIN_FILE = $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
+ $(call LogInfo, Generating Nimbus source files)
$(MKDIR) -p $(@D)
- $(ECHO) "Generating Nimbus source files"
- $(TOOL_GENERATENIMBUS) $(LOG_INFO) \
+ $(TOOL_GENERATENIMBUS) $(LOG_DEBUG) \
-skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \
-packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus
- $(ECHO) $(LOG_INFO) "Finished generating Nimbus source files"
$(TOUCH) $@
GENSRC_SWING_NIMBUS := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus
diff --git a/jdk/make/gensrc/GensrcX11Wrappers.gmk b/jdk/make/gensrc/GensrcX11Wrappers.gmk
index b9823c36be5..e4e3bba5745 100644
--- a/jdk/make/gensrc/GensrcX11Wrappers.gmk
+++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk
@@ -63,14 +63,14 @@ GENSRC_X11_SIZES_USED := $(addprefix $(GENSRC_X11WRAPPERS_TMP)/sizes., $(GENSRC_
# Copy only the sizes.* files that are actually needed. WrapperGenerator picks up any it finds from the
# file prefix it is given so those not needed need to be hidden.
$(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.%
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
$(RM) '$@'
$(SORT) $< > $@
# Run the tool on the offset files copied from the source repository to generate several Java classes
# used in awt.
$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
- $(MKDIR) -p $(GENSRC_X11WRAPPERS_DST)
+ $(call MakeDir, $(GENSRC_X11WRAPPERS_DST))
$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
$(TOUCH) $@
@@ -82,8 +82,8 @@ ifneq ($(COMPILE_TYPE), cross)
# Generate the C code for the program that will output the offset file.
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.c: $(GENSRC_SIZER_DIR)/xlibtypes.txt $(BUILD_TOOLS_JDK)
- $(ECHO) "Generating X11 wrapper ($*-bit version)"
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Generating X11 wrapper ($*-bit version))
+ $(call MakeDir, $(@D))
$(TOOL_WRAPPERGENERATOR) $(@D) $(GENSRC_SIZER_DIR)/xlibtypes.txt "sizer" $*
# use -m32/-m64 only if the compiler supports it
@@ -103,7 +103,7 @@ ifneq ($(COMPILE_TYPE), cross)
# Compile the C code into an executable.
$(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.c
- $(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
(cd $(@D) && $(CC) $(MEMORY_MODEL_FLAG) -o $@ $< \
$(X_CFLAGS) \
$(X_LIBS) \
@@ -114,9 +114,9 @@ ifneq ($(COMPILE_TYPE), cross)
# Run the executable create the offset file and check that it is identical
# to the offset file in the source code repository.
$(GENSRC_X11WRAPPERS_TMP)/sizes.%.verification: $(GENSRC_X11WRAPPERS_TMP)/sizer.%.exe
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Verifying X11 wrapper sizes)
+ $(call MakeDir, $(@D))
$(GENSRC_X11WRAPPERS_TMP)/sizer.$*.exe | $(SORT) > $@.tmp
- $(ECHO) Verifying $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp to $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
$(DIFF) $(GENSRC_X11WRAPPERS_TMP)/sizes.$*.verification.tmp $(GENSRC_X11WRAPPERS_TMP)/sizes.$*
mv $@.tmp $@
diff --git a/jdk/make/launcher/Launcher-java.base.gmk b/jdk/make/launcher/Launcher-java.base.gmk
index 4214de4ec22..77d241405c3 100644
--- a/jdk/make/launcher/Launcher-java.base.gmk
+++ b/jdk/make/launcher/Launcher-java.base.gmk
@@ -130,7 +130,6 @@ ifneq ($(BUILD_JEXEC_SRC), )
LDFLAGS := $(LDFLAGS_JDKEXE), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jexec_obj, \
OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
- DEBUG_SYMBOLS := true, \
PROGRAM := jexec))
TARGETS += $(BUILD_JEXEC)
diff --git a/jdk/make/launcher/Launcher-jdk.accessibility.gmk b/jdk/make/launcher/Launcher-jdk.accessibility.gmk
index e954e550f30..6815e6d378d 100644
--- a/jdk/make/launcher/Launcher-jdk.accessibility.gmk
+++ b/jdk/make/launcher/Launcher-jdk.accessibility.gmk
@@ -45,7 +45,6 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jabswitch, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
PROGRAM := jabswitch, \
- DEBUG_SYMBOLS := true, \
VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRC)/AccessBridgeStatusWindow.RC, \
RC_FLAGS := $(RC_FLAGS) \
-D "JDK_FNAME=jabswitch.exe" \
@@ -79,7 +78,6 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jaccessinspector$1, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
PROGRAM := jaccessinspector$1, \
- DEBUG_SYMBOLS := true, \
VERSIONINFO_RESOURCE := $(TOPDIR)/jaccessinspector/jaccessinspectorWindow.rc, \
RC_FLAGS := $$(RC_FLAGS) \
-D "JDK_FNAME=jaccessinspector$1.exe" \
@@ -107,7 +105,6 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jaccesswalker$1, \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
PROGRAM := jaccesswalker$1, \
- DEBUG_SYMBOLS := true, \
VERSIONINFO_RESOURCE := $(TOPDIR)/jaccesswalker/jaccesswalkerWindow.rc, \
RC_FLAGS := $$(RC_FLAGS) \
-D "JDK_FNAME=jaccesswalker$1.exe" \
diff --git a/jdk/make/launcher/Launcher-jdk.pack200.gmk b/jdk/make/launcher/Launcher-jdk.pack200.gmk
index 55c03865f71..818828a2929 100644
--- a/jdk/make/launcher/Launcher-jdk.pack200.gmk
+++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk
@@ -100,7 +100,6 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
-D "JDK_FNAME=unpack200.exe" \
-D "JDK_INTERNAL_NAME=unpack200" \
-D "JDK_FTYPE=0x1L", \
- DEBUG_SYMBOLS := true, \
MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest, \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
))
diff --git a/jdk/make/launcher/LauncherCommon.gmk b/jdk/make/launcher/LauncherCommon.gmk
index aeee54a2d0a..8e79d758693 100644
--- a/jdk/make/launcher/LauncherCommon.gmk
+++ b/jdk/make/launcher/LauncherCommon.gmk
@@ -25,15 +25,6 @@
include NativeCompilation.gmk
-# SetupNativeCompilation now supports debug symbols on macosx for hotspot.
-# Disable it here for the jdk binaries until we decide to enable them.
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- ENABLE_DEBUG_SYMBOLS := false
-endif
-
-# Prepare the find cache.
-$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
-
ifeq ($(OPENJDK_TARGET_OS), macosx)
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
else
@@ -124,7 +115,7 @@ define SetupBuildLauncherBody
$1_LDFLAGS += -exported_symbols_list \
$(SUPPORT_OUTPUTDIR)/build-static/exported.symbols
$1_LIBS += \
- $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
+ $$(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs/java.base -name "*.a") \
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libdt_socket.a \
$(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/libjdwp.a \
$(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX) \
@@ -174,8 +165,7 @@ define SetupBuildLauncherBody
endif
$$(eval $$(call SetupNativeCompilation, BUILD_LAUNCHER_$1, \
- SRC := $(LAUNCHER_SRC), \
- INCLUDE_FILES := main.c, \
+ EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
OPTIMIZATION := $$($1_OPTIMIZATION), \
CFLAGS := $$($1_CFLAGS) \
$(LAUNCHER_CFLAGS) \
@@ -204,7 +194,6 @@ define SetupBuildLauncherBody
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs, \
OUTPUT_DIR := $$($1_OUTPUT_DIR), \
PROGRAM := $1, \
- DEBUG_SYMBOLS := true, \
VERSIONINFO_RESOURCE := $$($1_VERSION_INFO_RESOURCE), \
RC_FLAGS := $$(RC_FLAGS) \
-D "JDK_FNAME=$1$(EXE_SUFFIX)" \
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index 08cd4d774ab..abd7edc0021 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -69,7 +69,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE, \
-D "JDK_INTERNAL_NAME=mlib_image" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
@@ -134,7 +134,7 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := -ljava -ljvm -lc $(BUILD_LIBMLIB_LDLIBS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image_v, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
@@ -279,7 +279,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
-D "JDK_INTERNAL_NAME=awt" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBAWT): $(call FindLib, java.base, java)
@@ -369,7 +369,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
-D "JDK_INTERNAL_NAME=xawt" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_xawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
@@ -433,7 +433,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
-D "JDK_INTERNAL_NAME=lcms" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/liblcms, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBLCMS)
@@ -509,7 +509,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
-D "JDK_FTYPE=0x2L", \
REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavajpeg, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java)
@@ -578,7 +578,7 @@ ifeq ($(BUILD_HEADLESS), true)
LIBS_linux := -lm $(LIBDL), \
LIBS_solaris := -lm $(LIBDL) $(LIBCXX) -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
@@ -700,7 +700,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
-D "JDK_INTERNAL_NAME=fontmanager" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
@@ -745,12 +745,13 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-D "JDK_INTERNAL_NAME=jawt" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBJAWT): $(BUILD_LIBAWT)
$(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
- $(ECHO) Copying $(@F)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%, %, $@))
+ $(call MakeDir, $(@D))
$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
TARGETS += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
@@ -804,7 +805,7 @@ else # OPENJDK_TARGET_OS not windows
LIBS_solaris := $(X_LIBS) -lXrender, \
LIBS_macosx := -framework Cocoa, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
ifndef BUILD_HEADLESS_ONLY
$(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
@@ -926,7 +927,7 @@ ifndef BUILD_HEADLESS_ONLY
-D "JDK_INTERNAL_NAME=splashscreen" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBSPLASHSCREEN)
@@ -1002,7 +1003,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
-framework OpenGL \
-framework QuartzCore -ljava, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBAWT_LWAWT)
@@ -1044,7 +1045,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
-framework JavaRuntimeSupport \
-ljava -ljvm, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBOSXUI)
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
index ace022c0d87..5cbeb4b03f7 100644
--- a/jdk/make/lib/CoreLibraries.gmk
+++ b/jdk/make/lib/CoreLibraries.gmk
@@ -25,6 +25,10 @@
WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/CoreLibraries.gmk))
+
+
##########################################################################################
# libfdlibm is statically linked with libjava below and not delivered into the
# product on its own.
@@ -51,7 +55,7 @@ ifneq ($(OPENJDK_TARGET_OS), macosx)
DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
else
@@ -64,7 +68,7 @@ else
CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
LDFLAGS := -nostdlib -r -arch x86_64, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
BUILD_LIBFDLIBM := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
$(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
@@ -82,7 +86,7 @@ endif
LIBVERIFY_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBVERIFY_OPTIMIZATION := LOW
endif
endif
@@ -106,7 +110,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \
-D "JDK_FTYPE=0x2L", \
REORDER := $(BUILD_LIBVERIFY_REORDER), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify, \
- DEBUG_SYMBOLS := true))
+))
TARGETS += $(BUILD_LIBVERIFY)
@@ -119,6 +123,9 @@ LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
+# Make it possible to override this variable
+LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
+
ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
@@ -146,7 +153,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
System.c_CFLAGS := $(VERSION_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
- MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
+ MAPFILE := $(LIBJAVA_MAPFILE), \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
@@ -171,7 +178,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
-D "JDK_FTYPE=0x2L", \
REORDER := $(LIBJAVA_REORDER), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBJAVA)
@@ -228,8 +235,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
-D "JDK_INTERNAL_NAME=zip" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libzip, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
+))
$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
@@ -273,7 +279,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \
-D "JDK_INTERNAL_NAME=jimage" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjimage, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA)
@@ -389,7 +395,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
-D "JDK_INTERNAL_NAME=jli" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBJLI)
@@ -407,7 +413,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
ARFLAGS := $(ARFLAGS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBJLI_STATIC)
@@ -426,7 +432,7 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx)
CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
LDFLAGS := -nostdlib -r, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
ifeq ($(STATIC_BUILD), true)
TARGETS += $(BUILD_LIBJLI_STATIC)
diff --git a/jdk/make/lib/Lib-java.base.gmk b/jdk/make/lib/Lib-java.base.gmk
index 0699a42dd34..345fda65908 100644
--- a/jdk/make/lib/Lib-java.base.gmk
+++ b/jdk/make/lib/Lib-java.base.gmk
@@ -49,7 +49,7 @@ ifeq ($(STATIC_BUILD), true)
JAVA_BASE_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/java.base.symbols
$(JAVA_BASE_EXPORT_SYMBOL_FILE): $(JAVA_BASE_EXPORT_SYMBOLS_SRC)
- $(ECHO) $(LOG_INFO) "Generating java.base.symbols file"
+ $(call LogInfo, Generating java.base.symbols file)
$(CAT) $^ > $@
# The individual symbol files is generated when the respective lib is built
diff --git a/jdk/make/lib/Lib-java.instrument.gmk b/jdk/make/lib/Lib-java.instrument.gmk
index 834cdc2850d..02df76073af 100644
--- a/jdk/make/lib/Lib-java.instrument.gmk
+++ b/jdk/make/lib/Lib-java.instrument.gmk
@@ -84,7 +84,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
-D "JDK_INTERNAL_NAME=instrument" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libinstrument, \
- DEBUG_SYMBOLS := true))
+))
ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows aix))
$(BUILD_LIBINSTRUMENT): $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk
index e2b30c8dae9..2533f786ec3 100644
--- a/jdk/make/lib/Lib-java.management.gmk
+++ b/jdk/make/lib/Lib-java.management.gmk
@@ -40,7 +40,7 @@ LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include
LIBMANAGEMENT_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBMANAGEMENT_OPTIMIZATION := LOW
endif
endif
@@ -64,7 +64,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \
-D "JDK_INTERNAL_NAME=management" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java)
diff --git a/jdk/make/lib/Lib-java.prefs.gmk b/jdk/make/lib/Lib-java.prefs.gmk
index a34083510e6..4652415c0c5 100644
--- a/jdk/make/lib/Lib-java.prefs.gmk
+++ b/jdk/make/lib/Lib-java.prefs.gmk
@@ -55,7 +55,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBPREFS, \
-D "JDK_INTERNAL_NAME=prefs" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libprefs, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBPREFS): $(call FindLib, java.base, java)
diff --git a/jdk/make/lib/Lib-java.security.jgss.gmk b/jdk/make/lib/Lib-java.security.jgss.gmk
index 5d84a22a050..6f37b623288 100644
--- a/jdk/make/lib/Lib-java.security.jgss.gmk
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk
@@ -46,7 +46,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
LIBS := $(LIBDL), \
LIBS_solaris := -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2gss, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBJ2GSS)
endif
@@ -92,7 +92,7 @@ ifneq ($(BUILD_CRYPTO), no)
-D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libkrb5, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBKRB5)
endif
diff --git a/jdk/make/lib/Lib-java.smartcardio.gmk b/jdk/make/lib/Lib-java.smartcardio.gmk
index a078e5f03e3..e013203d4e9 100644
--- a/jdk/make/lib/Lib-java.smartcardio.gmk
+++ b/jdk/make/lib/Lib-java.smartcardio.gmk
@@ -52,7 +52,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
-D "JDK_INTERNAL_NAME=j2pcsc" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pcsc, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBJ2PCSC)
diff --git a/jdk/make/lib/Lib-jdk.accessibility.gmk b/jdk/make/lib/Lib-jdk.accessibility.gmk
index 66cee50e40b..565b76a9e8a 100644
--- a/jdk/make/lib/Lib-jdk.accessibility.gmk
+++ b/jdk/make/lib/Lib-jdk.accessibility.gmk
@@ -61,7 +61,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-D "JDK_INTERNAL_NAME=javaaccessbridge$1" \
-D "JDK_FTYPE=0x02L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavaaccessbridge$1, \
- DEBUG_SYMBOLS := true)
+ )
$$(BUILD_JAVAACCESSBRIDGE$1): $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib
@@ -91,7 +91,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-D "JDK_INTERNAL_NAME=windowsaccessbridge$1" \
-D "JDK_FTYPE=0x02L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libwindowsaccessbridge$1, \
- DEBUG_SYMBOLS := true)
+ )
TARGETS += $$(BUILD_WINDOWSACCESSBRIDGE$1)
@@ -113,7 +113,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-D "JDK_INTERNAL_NAME=jabsysinfo" \
-D "JDK_FTYPE=0x02L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lib/libjabsysinfo, \
- DEBUG_SYMBOLS := true)
+ )
TARGETS += $$(BUILD_ACCESSBRIDGESYSINFO)
diff --git a/jdk/make/lib/Lib-jdk.attach.gmk b/jdk/make/lib/Lib-jdk.attach.gmk
index c227414646d..552b855594a 100644
--- a/jdk/make/lib/Lib-jdk.attach.gmk
+++ b/jdk/make/lib/Lib-jdk.attach.gmk
@@ -56,7 +56,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \
LIBS_solaris := -ldoor, \
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libattach, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBATTACH): $(call FindLib, java.base, java)
diff --git a/jdk/make/lib/Lib-jdk.crypto.ec.gmk b/jdk/make/lib/Lib-jdk.crypto.ec.gmk
index 6c62ba68011..fa0d1ff8893 100644
--- a/jdk/make/lib/Lib-jdk.crypto.ec.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk
@@ -68,7 +68,7 @@ ifeq ($(ENABLE_INTREE_EC), yes)
-D "JDK_INTERNAL_NAME=sunec" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunec, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBSUNEC)
endif
diff --git a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
index 8a3bb4e9ccf..ea73c1c55e4 100644
--- a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
@@ -47,7 +47,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-D "JDK_INTERNAL_NAME=sunmscapi" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunmscapi, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBSUNMSCAPI)
endif
diff --git a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
index 21c19b9e5d4..c74f77960bb 100644
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
@@ -51,7 +51,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
-D "JDK_INTERNAL_NAME=j2pkcs11" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pkcs11, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBJ2PKCS11)
diff --git a/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk b/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk
index c71634166b2..31c39f1bb69 100644
--- a/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk
@@ -44,7 +44,7 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
LIBS := $(LIBDL), \
LIBS_solaris := -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2ucrypto, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
diff --git a/jdk/make/lib/Lib-jdk.deploy.osx.gmk b/jdk/make/lib/Lib-jdk.deploy.osx.gmk
index 08125ce9d23..881a387e14d 100644
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk
@@ -57,7 +57,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
-framework SystemConfiguration \
$(JDKLIB_LIBS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBOSX)
diff --git a/jdk/make/lib/Lib-jdk.internal.le.gmk b/jdk/make/lib/Lib-jdk.internal.le.gmk
index 7aeeac3711d..cd9eaba1923 100644
--- a/jdk/make/lib/Lib-jdk.internal.le.gmk
+++ b/jdk/make/lib/Lib-jdk.internal.le.gmk
@@ -51,7 +51,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-D "JDK_INTERNAL_NAME=le" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lible, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBLE)
diff --git a/jdk/make/lib/Lib-jdk.jdi.gmk b/jdk/make/lib/Lib-jdk.jdi.gmk
index 0c7de8144df..8bed1f9abd1 100644
--- a/jdk/make/lib/Lib-jdk.jdi.gmk
+++ b/jdk/make/lib/Lib-jdk.jdi.gmk
@@ -55,7 +55,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-D "JDK_INTERNAL_NAME=dt_shmem" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_shmem, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBDT_SHMEM)
diff --git a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
index 14784d3796a..198dc2c2433 100644
--- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
+++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
@@ -56,7 +56,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SOCKET, \
-D "JDK_INTERNAL_NAME=dt_socket" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_socket, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBDT_SOCKET): $(call FindLib, java.base, java)
@@ -95,7 +95,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \
-D "JDK_INTERNAL_NAME=jdwp" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjdwp, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBJDWP): $(call FindLib, java.base, java)
@@ -111,7 +111,7 @@ ifeq ($(STATIC_BUILD), true)
JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.jdwp.agent/jdk.jdwp.agent.symbols
$(JDK_JDWP_AGENT_EXPORT_SYMBOL_FILE): $(JDK_JDWP_AGENT_EXPORT_SYMBOLS_SRC)
- $(ECHO) $(LOG_INFO) "Generating jdk.jdwp.agent symbols file"
+ $(call LogInfo, Generating jdk.jdwp.agent symbols file)
$(CAT) $^ > $@
# The individual symbol files is generated when the respective lib is built
diff --git a/jdk/make/lib/Lib-jdk.management.gmk b/jdk/make/lib/Lib-jdk.management.gmk
index da9e15bd2be..7f38553c61e 100644
--- a/jdk/make/lib/Lib-jdk.management.gmk
+++ b/jdk/make/lib/Lib-jdk.management.gmk
@@ -48,7 +48,7 @@ endif
LIBMANAGEMENT_EXT_OPTIMIZATION := HIGH
ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
LIBMANAGEMENT_EXT_OPTIMIZATION := LOW
endif
endif
@@ -73,7 +73,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT_EXT, \
-D "JDK_INTERNAL_NAME=management_ext" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement_ext, \
- DEBUG_SYMBOLS := true))
+))
$(BUILD_LIBMANAGEMENT_EXT): $(call FindLib, java.base, java)
diff --git a/jdk/make/lib/Lib-jdk.pack200.gmk b/jdk/make/lib/Lib-jdk.pack200.gmk
index 824fabdb343..7f942fcfb41 100644
--- a/jdk/make/lib/Lib-jdk.pack200.gmk
+++ b/jdk/make/lib/Lib-jdk.pack200.gmk
@@ -52,7 +52,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
-D "JDK_FNAME=unpack.dll" \
-D "JDK_INTERNAL_NAME=unpack" \
-D "JDK_FTYPE=0x2L", \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
diff --git a/jdk/make/lib/Lib-jdk.sctp.gmk b/jdk/make/lib/Lib-jdk.sctp.gmk
index 574bc0e9841..e527aa8d9c5 100644
--- a/jdk/make/lib/Lib-jdk.sctp.gmk
+++ b/jdk/make/lib/Lib-jdk.sctp.gmk
@@ -53,7 +53,7 @@ ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
LIBS_linux := -lpthread $(LIBDL), \
LIBS_solaris := -lsocket -lc, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsctp, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBSCTP)
diff --git a/jdk/make/lib/Lib-jdk.security.auth.gmk b/jdk/make/lib/Lib-jdk.security.auth.gmk
index 2b1b62b6702..e37e327266c 100644
--- a/jdk/make/lib/Lib-jdk.security.auth.gmk
+++ b/jdk/make/lib/Lib-jdk.security.auth.gmk
@@ -55,7 +55,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \
-D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjaas, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBJAAS): $(call FindLib, java.base, java)
diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk
index 68bdcc0a414..ae47377c712 100644
--- a/jdk/make/lib/LibCommon.gmk
+++ b/jdk/make/lib/LibCommon.gmk
@@ -23,40 +23,24 @@
# questions.
#
-include $(SPEC)
-include MakeBase.gmk
include NativeCompilation.gmk
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, jdk, lib/LibCommon.gmk))
+
+################################################################################
+
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
# elegant solution to this.
WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
-ifdef OPENJDK
- # Build everything with debugging on OpenJDK
- DEBUG_ALL_BINARIES := true
-else
- # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
- # not on other platforms.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- DEBUG_ALL_BINARIES := true
- else
- DEBUG_ALL_BINARIES := false
- endif
-endif
-
-# SetupNativeCompilation now supports debug symbols on macosx for hotspot.
-# Disable it here for the jdk libraries until we decide to enable them.
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- ENABLE_DEBUG_SYMBOLS := false
-endif
-
################################################################################
# Find the default set of src dirs for a native library.
# Param 1 - module name
# Param 2 - library name
-FindSrcDirsForLib = \
+FindSrcDirsForLib += \
$(call uniq, $(wildcard \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
@@ -87,3 +71,5 @@ ifeq ($(USE_EXTERNAL_LIBZ), true)
else
ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
endif
+
+###############################################################################
diff --git a/jdk/make/lib/NetworkingLibraries.gmk b/jdk/make/lib/NetworkingLibraries.gmk
index df04c8087c1..6b110f8d72e 100644
--- a/jdk/make/lib/NetworkingLibraries.gmk
+++ b/jdk/make/lib/NetworkingLibraries.gmk
@@ -52,7 +52,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
-D "JDK_INTERNAL_NAME=net" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBNET): $(BUILD_LIBJAVA)
diff --git a/jdk/make/lib/NioLibraries.gmk b/jdk/make/lib/NioLibraries.gmk
index 6b7d305f914..de2cdea0727 100644
--- a/jdk/make/lib/NioLibraries.gmk
+++ b/jdk/make/lib/NioLibraries.gmk
@@ -91,7 +91,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
-D "JDK_INTERNAL_NAME=nio" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnio, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
TARGETS += $(BUILD_LIBNIO)
diff --git a/jdk/make/lib/PlatformLibraries.gmk b/jdk/make/lib/PlatformLibraries.gmk
index c8850ac27c3..85038b91714 100644
--- a/jdk/make/lib/PlatformLibraries.gmk
+++ b/jdk/make/lib/PlatformLibraries.gmk
@@ -54,7 +54,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
-framework IOSurface \
-framework QuartzCore, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxapp, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
TARGETS += $(BUILD_LIBOSXAPP)
diff --git a/jdk/make/lib/SecurityLibraries.gmk b/jdk/make/lib/SecurityLibraries.gmk
index 9c1c65211ca..be73c528c6b 100644
--- a/jdk/make/lib/SecurityLibraries.gmk
+++ b/jdk/make/lib/SecurityLibraries.gmk
@@ -54,7 +54,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
-framework Security \
$(JDKLIB_LIBS), \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxsecurity, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBOSXSECURITY): $(BUILD_LIBJAVA)
diff --git a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk
index 9204afd36bf..f5877d3f876 100644
--- a/jdk/make/lib/SoundLibraries.gmk
+++ b/jdk/make/lib/SoundLibraries.gmk
@@ -138,7 +138,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
-D "JDK_INTERNAL_NAME=jsound" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+))
$(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
@@ -173,7 +173,7 @@ ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(ALSA_LIBS) -ljava -ljvm, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
@@ -204,7 +204,7 @@ ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), )
-D "JDK_INTERNAL_NAME=jsoundds" \
-D "JDK_FTYPE=0x2L", \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+ ))
$(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
diff --git a/jdk/make/src/classes/build/tools/spp/Spp.java b/jdk/make/src/classes/build/tools/spp/Spp.java
index 0e3ca8da0b9..9bbebe6f34e 100644
--- a/jdk/make/src/classes/build/tools/spp/Spp.java
+++ b/jdk/make/src/classes/build/tools/spp/Spp.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,10 @@ import java.util.regex.*;
* Spp: A simple regex-based stream preprocessor based on Mark Reinhold's
* sed-based spp.sh
*
- * Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... out
+ * Usage: java build.tools.spp.Spp [-be] [-nel] [-Kkey] -Dvar=value ... out
*
- * Source-file constructs
+ * If -nel is declared then empty lines will not be substituted for lines of
+ * text in the template that do not appear in the output.
*
* Meaningful only at beginning of line, works with any number of keys:
*
@@ -64,9 +65,10 @@ import java.util.regex.*;
public class Spp {
public static void main(String args[]) throws Exception {
- Map vars = new HashMap();
- Set keys = new HashSet();
+ Map vars = new HashMap<>();
+ Set keys = new HashSet<>();
boolean be = false;
+ boolean el = true;
for (String arg:args) {
if (arg.startsWith("-D")) {
@@ -76,8 +78,10 @@ public class Spp {
keys.add(arg.substring(2));
} else if ("-be".equals(arg)) {
be = true;
+ } else if ("-nel".equals(arg)) {
+ el = false;
} else {
- System.err.println("Usage: java build.tools.spp.Spp [-be] [-Kkey] -Dvar=value ... out");
+ System.err.println("Usage: java build.tools.spp.Spp [-be] [-nel] [-Kkey] -Dvar=value ... out");
System.exit(-1);
}
}
@@ -85,7 +89,7 @@ public class Spp {
StringBuffer out = new StringBuffer();
new Spp().spp(new Scanner(System.in),
out, "",
- keys, vars, be,
+ keys, vars, be, el,
false);
System.out.print(out.toString());
}
@@ -93,7 +97,7 @@ public class Spp {
static final String LNSEP = System.getProperty("line.separator");
static final String KEY = "([a-zA-Z0-9]+)";
static final String VAR = "([a-zA-Z0-9_\\-]+)";
- static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\$]+)"; // $ -- hack embedded $var$
+ static final String TEXT = "([a-zA-Z0-9&;,.<>/#() \\?\\[\\]\\$]+)"; // $ -- hack embedded $var$
static final int GN_NOT = 1;
static final int GN_KEY = 2;
@@ -101,11 +105,11 @@ public class Spp {
static final int GN_NO = 5;
static final int GN_VAR = 6;
- Matcher ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
- Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
- Matcher endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
- Matcher vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
- Matcher vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
+ final Matcher ifkey = Pattern.compile("^#if\\[(!)?" + KEY + "\\]").matcher("");
+ final Matcher elsekey = Pattern.compile("^#else\\[(!)?" + KEY + "\\]").matcher("");
+ final Matcher endkey = Pattern.compile("^#end\\[(!)?" + KEY + "\\]").matcher("");
+ final Matcher vardef = Pattern.compile("\\{#if\\[(!)?" + KEY + "\\]\\?" + TEXT + "(:"+ TEXT + ")?\\}|\\$" + VAR + "\\$").matcher("");
+ final Matcher vardef2 = Pattern.compile("\\$" + VAR + "\\$").matcher("");
void append(StringBuffer buf, String ln,
Set keys, Map vars) {
@@ -135,7 +139,7 @@ public class Spp {
// return true if #end[key], #end or EOF reached
boolean spp(Scanner in, StringBuffer buf, String key,
Set keys, Map vars,
- boolean be, boolean skip) {
+ boolean be, boolean el, boolean skip) {
while (in.hasNextLine()) {
String ln = in.nextLine();
if (be) {
@@ -154,9 +158,9 @@ public class Spp {
boolean test = keys.contains(k);
if (ifkey.group(GN_NOT) != null)
test = !test;
- buf.append(LNSEP);
- if (!spp(in, buf, k, keys, vars, be, skip || !test)) {
- spp(in, buf, k, keys, vars, be, skip || test);
+ if (el) buf.append(LNSEP);
+ if (!spp(in, buf, k, keys, vars, be, el, skip || !test)) {
+ spp(in, buf, k, keys, vars, be, el, skip || test);
}
continue;
}
@@ -164,14 +168,14 @@ public class Spp {
if (!key.equals(elsekey.group(GN_KEY))) {
throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
}
- buf.append(LNSEP);
+ if (el) buf.append(LNSEP);
return false;
}
if (endkey.reset(ln).find()) {
if (!key.equals(endkey.group(GN_KEY))) {
throw new Error("Mis-matched #if-else-end at line <" + ln + ">");
}
- buf.append(LNSEP);
+ if (el) buf.append(LNSEP);
return true;
}
if (ln.startsWith("#warn")) {
@@ -181,8 +185,9 @@ public class Spp {
}
if (!skip) {
append(buf, ln, keys, vars);
+ if (!el) buf.append(LNSEP);
}
- buf.append(LNSEP);
+ if (el) buf.append(LNSEP);
}
return true;
}
diff --git a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
index 4c92ee9a8af..488a1add46d 100644
--- a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
@@ -60,7 +60,7 @@ import java.time.zone.ZoneRulesException;
* @author Stephen Colebourne
* @author Michael Nascimento Santos
*
- * @since 1.9
+ * @since 9
*/
class TzdbZoneRulesProvider {
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java
index af52bd74474..684be4f0d76 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/CounterMode.java
@@ -26,7 +26,9 @@
package com.sun.crypto.provider;
import java.security.InvalidKeyException;
+import java.util.Objects;
+import jdk.internal.HotSpotIntrinsicCandidate;
/**
* This class represents ciphers in counter (CTR) mode.
@@ -138,7 +140,7 @@ final class CounterMode extends FeedbackCipher {
* cipherOffset.
*
* @param in the buffer with the input data to be encrypted
- * @param inOffset the offset in plain
+ * @param inOff the offset in plain
* @param len the length of the input data
* @param out the buffer for the result
* @param outOff the offset in cipher
@@ -170,6 +172,15 @@ final class CounterMode extends FeedbackCipher {
* are encrypted on demand.
*/
private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
+
+ cryptBlockCheck(in, inOff, len);
+ cryptBlockCheck(out, outOff, len);
+ return implCrypt(in, inOff, len, out, outOff);
+ }
+
+ // Implementation of crpyt() method. Possibly replaced with a compiler intrinsic.
+ @HotSpotIntrinsicCandidate
+ private int implCrypt(byte[] in, int inOff, int len, byte[] out, int outOff) {
int result = len;
while (len-- > 0) {
if (used >= blockSize) {
@@ -181,4 +192,23 @@ final class CounterMode extends FeedbackCipher {
}
return result;
}
+
+ // Used to perform all checks required by the Java semantics
+ // (i.e., null checks and bounds checks) on the input parameters to crypt().
+ // Normally, the Java Runtime performs these checks, however, as crypt() is
+ // possibly replaced with compiler intrinsic, the JDK performs the
+ // required checks instead.
+ // Does not check accesses to class-internal (private) arrays.
+ private static void cryptBlockCheck(byte[] array, int offset, int len) {
+ Objects.requireNonNull(array);
+
+ if (offset < 0 || len < 0 || offset >= array.length) {
+ throw new ArrayIndexOutOfBoundsException(offset);
+ }
+
+ int largestIndex = offset + len - 1;
+ if (largestIndex < 0 || largestIndex >= array.length) {
+ throw new ArrayIndexOutOfBoundsException(largestIndex);
+ }
+ }
}
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java
index 51c49b500ab..37873666eba 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -263,7 +263,7 @@ abstract class PBES2Core extends CipherSpi {
passwdChars[i] = (char) (passwdBytes[i] & 0x7f);
PBEKeySpec pbeSpec =
- new PBEKeySpec(passwdChars, salt, iCount, blkSize * 8);
+ new PBEKeySpec(passwdChars, salt, iCount, keyLength);
// password char[] was cloned in PBEKeySpec constructor,
// so we can zero it out here
java.util.Arrays.fill(passwdChars, ' ');
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
index ef2d6351dde..8aa652255de 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
@@ -76,11 +76,14 @@ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
"TlsRsaPremasterSecretGenerator must be initialized");
}
- if (random == null) {
- random = new SecureRandom();
+ byte[] b = spec.getEncodedSecret();
+ if (b == null) {
+ if (random == null) {
+ random = new SecureRandom();
+ }
+ b = new byte[48];
+ random.nextBytes(b);
}
- byte[] b = new byte[48];
- random.nextBytes(b);
b[0] = (byte)spec.getMajorVersion();
b[1] = (byte)spec.getMinorVersion();
diff --git a/jdk/src/java.base/share/classes/java/io/InputStream.java b/jdk/src/java.base/share/classes/java/io/InputStream.java
index 67946b19b1a..c1e4a8e1d60 100644
--- a/jdk/src/java.base/share/classes/java/io/InputStream.java
+++ b/jdk/src/java.base/share/classes/java/io/InputStream.java
@@ -228,7 +228,7 @@ public abstract class InputStream implements Closeable {
* allocated. For example, if an array larger than {@code 2GB} would
* be required to store the bytes.
*
- * @since 1.9
+ * @since 9
*/
public byte[] readAllBytes() throws IOException {
byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
@@ -298,7 +298,7 @@ public abstract class InputStream implements Closeable {
* @throws IndexOutOfBoundsException If {@code off} is negative, {@code len}
* is negative, or {@code len} is greater than {@code b.length - off}
*
- * @since 1.9
+ * @since 9
*/
public int readNBytes(byte[] b, int off, int len) throws IOException {
Objects.requireNonNull(b);
@@ -514,7 +514,7 @@ public abstract class InputStream implements Closeable {
* @throws IOException if an I/O error occurs when reading or writing
* @throws NullPointerException if {@code out} is {@code null}
*
- * @since 1.9
+ * @since 9
*/
public long transferTo(OutputStream out) throws IOException {
Objects.requireNonNull(out, "out");
diff --git a/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java b/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java
index 619b7de278a..f1691969666 100644
--- a/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java
+++ b/jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java
@@ -1526,7 +1526,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public IntStream chars() {
@@ -1543,7 +1543,7 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public IntStream codePoints() {
diff --git a/jdk/src/java.base/share/classes/java/lang/Character.java b/jdk/src/java.base/share/classes/java/lang/Character.java
index ae3d1ef6bd8..42fc39dd183 100644
--- a/jdk/src/java.base/share/classes/java/lang/Character.java
+++ b/jdk/src/java.base/share/classes/java/lang/Character.java
@@ -493,25 +493,25 @@ class Character implements java.io.Serializable, Comparable {
/**
* Weak bidirectional character type "LRI" in the Unicode specification.
- * @since 1.9
+ * @since 9
*/
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE = 19;
/**
* Weak bidirectional character type "RLI" in the Unicode specification.
- * @since 1.9
+ * @since 9
*/
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE = 20;
/**
* Weak bidirectional character type "FSI" in the Unicode specification.
- * @since 1.9
+ * @since 9
*/
public static final byte DIRECTIONALITY_FIRST_STRONG_ISOLATE = 21;
/**
* Weak bidirectional character type "PDI" in the Unicode specification.
- * @since 1.9
+ * @since 9
*/
public static final byte DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE = 22;
@@ -2590,7 +2590,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Combining Diacritical Marks Extended" Unicode
* character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS_EXTENDED =
new UnicodeBlock("COMBINING_DIACRITICAL_MARKS_EXTENDED",
@@ -2599,7 +2599,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Myanmar Extended-B" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MYANMAR_EXTENDED_B =
new UnicodeBlock("MYANMAR_EXTENDED_B",
@@ -2608,7 +2608,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Latin Extended-E" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock LATIN_EXTENDED_E =
new UnicodeBlock("LATIN_EXTENDED_E",
@@ -2617,7 +2617,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Coptic Epact Numbers" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock COPTIC_EPACT_NUMBERS =
new UnicodeBlock("COPTIC_EPACT_NUMBERS",
@@ -2626,7 +2626,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Old Permic" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock OLD_PERMIC =
new UnicodeBlock("OLD_PERMIC",
@@ -2635,14 +2635,14 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Elbasan" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock ELBASAN =
new UnicodeBlock("ELBASAN");
/**
* Constant for the "Caucasian Albanian" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock CAUCASIAN_ALBANIAN =
new UnicodeBlock("CAUCASIAN_ALBANIAN",
@@ -2651,7 +2651,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Linear A" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock LINEAR_A =
new UnicodeBlock("LINEAR_A",
@@ -2660,21 +2660,21 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Palmyrene" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock PALMYRENE =
new UnicodeBlock("PALMYRENE");
/**
* Constant for the "Nabataean" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock NABATAEAN =
new UnicodeBlock("NABATAEAN");
/**
* Constant for the "Old North Arabian" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock OLD_NORTH_ARABIAN =
new UnicodeBlock("OLD_NORTH_ARABIAN",
@@ -2683,14 +2683,14 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Manichaean" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MANICHAEAN =
new UnicodeBlock("MANICHAEAN");
/**
* Constant for the "Psalter Pahlavi" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock PSALTER_PAHLAVI =
new UnicodeBlock("PSALTER_PAHLAVI",
@@ -2699,14 +2699,14 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Mahajani" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MAHAJANI =
new UnicodeBlock("MAHAJANI");
/**
* Constant for the "Sinhala Archaic Numbers" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SINHALA_ARCHAIC_NUMBERS =
new UnicodeBlock("SINHALA_ARCHAIC_NUMBERS",
@@ -2715,49 +2715,49 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Khojki" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock KHOJKI =
new UnicodeBlock("KHOJKI");
/**
* Constant for the "Khudawadi" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock KHUDAWADI =
new UnicodeBlock("KHUDAWADI");
/**
* Constant for the "Grantha" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock GRANTHA =
new UnicodeBlock("GRANTHA");
/**
* Constant for the "Tirhuta" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock TIRHUTA =
new UnicodeBlock("TIRHUTA");
/**
* Constant for the "Siddham" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SIDDHAM =
new UnicodeBlock("SIDDHAM");
/**
* Constant for the "Modi" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MODI =
new UnicodeBlock("MODI");
/**
* Constant for the "Warang Citi" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock WARANG_CITI =
new UnicodeBlock("WARANG_CITI",
@@ -2766,7 +2766,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Pau Cin Hau" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock PAU_CIN_HAU =
new UnicodeBlock("PAU_CIN_HAU",
@@ -2775,14 +2775,14 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Mro" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MRO =
new UnicodeBlock("MRO");
/**
* Constant for the "Bassa Vah" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock BASSA_VAH =
new UnicodeBlock("BASSA_VAH",
@@ -2791,7 +2791,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Pahawh Hmong" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock PAHAWH_HMONG =
new UnicodeBlock("PAHAWH_HMONG",
@@ -2800,14 +2800,14 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Duployan" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock DUPLOYAN =
new UnicodeBlock("DUPLOYAN");
/**
* Constant for the "Shorthand Format Controls" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SHORTHAND_FORMAT_CONTROLS =
new UnicodeBlock("SHORTHAND_FORMAT_CONTROLS",
@@ -2816,7 +2816,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Mende Kikakui" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MENDE_KIKAKUI =
new UnicodeBlock("MENDE_KIKAKUI",
@@ -2825,7 +2825,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Ornamental Dingbats" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock ORNAMENTAL_DINGBATS =
new UnicodeBlock("ORNAMENTAL_DINGBATS",
@@ -2834,7 +2834,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Geometric Shapes Extended" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock GEOMETRIC_SHAPES_EXTENDED =
new UnicodeBlock("GEOMETRIC_SHAPES_EXTENDED",
@@ -2843,7 +2843,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Supplemental Arrows-C" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SUPPLEMENTAL_ARROWS_C =
new UnicodeBlock("SUPPLEMENTAL_ARROWS_C",
@@ -2852,7 +2852,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Cherokee Supplement" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock CHEROKEE_SUPPLEMENT =
new UnicodeBlock("CHEROKEE_SUPPLEMENT",
@@ -2861,14 +2861,14 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Hatran" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock HATRAN =
new UnicodeBlock("HATRAN");
/**
* Constant for the "Old Hungarian" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock OLD_HUNGARIAN =
new UnicodeBlock("OLD_HUNGARIAN",
@@ -2877,21 +2877,21 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Multani" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock MULTANI =
new UnicodeBlock("MULTANI");
/**
* Constant for the "Ahom" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock AHOM =
new UnicodeBlock("AHOM");
/**
* Constant for the "Early Dynastic Cuneiform" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock EARLY_DYNASTIC_CUNEIFORM =
new UnicodeBlock("EARLY_DYNASTIC_CUNEIFORM",
@@ -2900,7 +2900,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Anatolian Hieroglyphs" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock ANATOLIAN_HIEROGLYPHS =
new UnicodeBlock("ANATOLIAN_HIEROGLYPHS",
@@ -2909,7 +2909,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Sutton SignWriting" Unicode character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SUTTON_SIGNWRITING =
new UnicodeBlock("SUTTON_SIGNWRITING",
@@ -2919,7 +2919,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "Supplemental Symbols and Pictographs" Unicode
* character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS =
new UnicodeBlock("SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS",
@@ -2929,7 +2929,7 @@ class Character implements java.io.Serializable, Comparable {
/**
* Constant for the "CJK Unified Ideographs Extension E" Unicode
* character block.
- * @since 1.9
+ * @since 9
*/
public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E =
new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E",
@@ -4189,175 +4189,175 @@ class Character implements java.io.Serializable, Comparable {
/**
* Unicode script "Caucasian Albanian".
- * @since 1.9
+ * @since 9
*/
CAUCASIAN_ALBANIAN,
/**
* Unicode script "Bassa Vah".
- * @since 1.9
+ * @since 9
*/
BASSA_VAH,
/**
* Unicode script "Duployan".
- * @since 1.9
+ * @since 9
*/
DUPLOYAN,
/**
* Unicode script "Elbasan".
- * @since 1.9
+ * @since 9
*/
ELBASAN,
/**
* Unicode script "Grantha".
- * @since 1.9
+ * @since 9
*/
GRANTHA,
/**
* Unicode script "Pahawh Hmong".
- * @since 1.9
+ * @since 9
*/
PAHAWH_HMONG,
/**
* Unicode script "Khojki".
- * @since 1.9
+ * @since 9
*/
KHOJKI,
/**
* Unicode script "Linear A".
- * @since 1.9
+ * @since 9
*/
LINEAR_A,
/**
* Unicode script "Mahajani".
- * @since 1.9
+ * @since 9
*/
MAHAJANI,
/**
* Unicode script "Manichaean".
- * @since 1.9
+ * @since 9
*/
MANICHAEAN,
/**
* Unicode script "Mende Kikakui".
- * @since 1.9
+ * @since 9
*/
MENDE_KIKAKUI,
/**
* Unicode script "Modi".
- * @since 1.9
+ * @since 9
*/
MODI,
/**
* Unicode script "Mro".
- * @since 1.9
+ * @since 9
*/
MRO,
/**
* Unicode script "Old North Arabian".
- * @since 1.9
+ * @since 9
*/
OLD_NORTH_ARABIAN,
/**
* Unicode script "Nabataean".
- * @since 1.9
+ * @since 9
*/
NABATAEAN,
/**
* Unicode script "Palmyrene".
- * @since 1.9
+ * @since 9
*/
PALMYRENE,
/**
* Unicode script "Pau Cin Hau".
- * @since 1.9
+ * @since 9
*/
PAU_CIN_HAU,
/**
* Unicode script "Old Permic".
- * @since 1.9
+ * @since 9
*/
OLD_PERMIC,
/**
* Unicode script "Psalter Pahlavi".
- * @since 1.9
+ * @since 9
*/
PSALTER_PAHLAVI,
/**
* Unicode script "Siddham".
- * @since 1.9
+ * @since 9
*/
SIDDHAM,
/**
* Unicode script "Khudawadi".
- * @since 1.9
+ * @since 9
*/
KHUDAWADI,
/**
* Unicode script "Tirhuta".
- * @since 1.9
+ * @since 9
*/
TIRHUTA,
/**
* Unicode script "Warang Citi".
- * @since 1.9
+ * @since 9
*/
WARANG_CITI,
/**
* Unicode script "Ahom".
- * @since 1.9
+ * @since 9
*/
AHOM,
/**
* Unicode script "Anatolian Hieroglyphs".
- * @since 1.9
+ * @since 9
*/
ANATOLIAN_HIEROGLYPHS,
/**
* Unicode script "Hatran".
- * @since 1.9
+ * @since 9
*/
HATRAN,
/**
* Unicode script "Multani".
- * @since 1.9
+ * @since 9
*/
MULTANI,
/**
* Unicode script "Old Hungarian".
- * @since 1.9
+ * @since 9
*/
OLD_HUNGARIAN,
/**
* Unicode script "SignWriting".
- * @since 1.9
+ * @since 9
*/
SIGNWRITING,
diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
index 76cdd25dcd7..1bb15800454 100644
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java
@@ -50,6 +50,8 @@ import java.util.Vector;
import java.util.Hashtable;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
+
+import jdk.internal.perf.PerfCounter;
import sun.misc.Resource;
import sun.misc.URLClassPath;
import sun.reflect.CallerSensitive;
@@ -423,9 +425,9 @@ public abstract class ClassLoader {
c = findClass(name);
// this is the defining class loader; record the stats
- sun.misc.PerfCounter.getParentDelegationTime().addTime(t1 - t0);
- sun.misc.PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
- sun.misc.PerfCounter.getFindClasses().increment();
+ PerfCounter.getParentDelegationTime().addTime(t1 - t0);
+ PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
+ PerfCounter.getFindClasses().increment();
}
}
if (resolve) {
diff --git a/jdk/src/java.base/share/classes/java/lang/Integer.java b/jdk/src/java.base/share/classes/java/lang/Integer.java
index 11afbef0d47..5302091fb39 100644
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java
@@ -716,7 +716,7 @@ public final class Integer extends Number implements Comparable {
* {@code radix}, or if {@code radix} is either smaller than
* {@link java.lang.Character#MIN_RADIX} or larger than
* {@link java.lang.Character#MAX_RADIX}.
- * @since 1.9
+ * @since 9
*/
public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix)
throws NumberFormatException {
@@ -899,7 +899,7 @@ public final class Integer extends Number implements Comparable {
* {@code radix}, or if {@code radix} is either smaller than
* {@link java.lang.Character#MIN_RADIX} or larger than
* {@link java.lang.Character#MAX_RADIX}.
- * @since 1.9
+ * @since 9
*/
public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, int radix)
throws NumberFormatException {
diff --git a/jdk/src/java.base/share/classes/java/lang/Long.java b/jdk/src/java.base/share/classes/java/lang/Long.java
index d7d232f23b0..191ae2071d4 100644
--- a/jdk/src/java.base/share/classes/java/lang/Long.java
+++ b/jdk/src/java.base/share/classes/java/lang/Long.java
@@ -747,7 +747,7 @@ public final class Long extends Number implements Comparable {
* {@code radix}, or if {@code radix} is either smaller than
* {@link java.lang.Character#MIN_RADIX} or larger than
* {@link java.lang.Character#MAX_RADIX}.
- * @since 1.9
+ * @since 9
*/
public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix)
throws NumberFormatException {
@@ -993,7 +993,7 @@ public final class Long extends Number implements Comparable {
* {@code radix}, or if {@code radix} is either smaller than
* {@link java.lang.Character#MIN_RADIX} or larger than
* {@link java.lang.Character#MAX_RADIX}.
- * @since 1.9
+ * @since 9
*/
public static long parseUnsignedLong(CharSequence s, int beginIndex, int endIndex, int radix)
throws NumberFormatException {
diff --git a/jdk/src/java.base/share/classes/java/lang/Process.java b/jdk/src/java.base/share/classes/java/lang/Process.java
index b537bb416d3..3f0ec640a6b 100644
--- a/jdk/src/java.base/share/classes/java/lang/Process.java
+++ b/jdk/src/java.base/share/classes/java/lang/Process.java
@@ -304,7 +304,7 @@ public abstract class Process {
* otherwise, {@link #destroy} forcibly terminates the process
* @throws UnsupportedOperationException if the Process implementation
* does not support this operation
- * @since 1.9
+ * @since 9
*/
public boolean supportsNormalTermination() {
throw new UnsupportedOperationException(this.getClass()
@@ -340,7 +340,7 @@ public abstract class Process {
* @return the native process id of the process
* @throws UnsupportedOperationException if the Process implementation
* does not support this operation
- * @since 1.9
+ * @since 9
*/
public long getPid() {
return toHandle().getPid();
@@ -409,7 +409,7 @@ public abstract class Process {
*
* @return a new {@code CompletableFuture} for the Process
*
- * @since 1.9
+ * @since 9
*/
public CompletableFuture onExit() {
return CompletableFuture.supplyAsync(this::waitForInternal);
@@ -471,7 +471,7 @@ public abstract class Process {
* does not support this operation
* @throws SecurityException if a security manager has been installed and
* it denies RuntimePermission("manageProcess")
- * @since 1.9
+ * @since 9
*/
public ProcessHandle toHandle() {
throw new UnsupportedOperationException(this.getClass()
@@ -491,7 +491,7 @@ public abstract class Process {
* @return a snapshot of information about the process, always non-null
* @throws UnsupportedOperationException if the Process implementation
* does not support this operation
- * @since 1.9
+ * @since 9
*/
public ProcessHandle.Info info() {
return toHandle().info();
@@ -516,7 +516,7 @@ public abstract class Process {
* does not support this operation
* @throws SecurityException if a security manager has been installed and
* it denies RuntimePermission("manageProcess")
- * @since 1.9
+ * @since 9
*/
public Stream children() {
return toHandle().children();
@@ -542,7 +542,7 @@ public abstract class Process {
* does not support this operation
* @throws SecurityException if a security manager has been installed and
* it denies RuntimePermission("manageProcess")
- * @since 1.9
+ * @since 9
*/
public Stream descendants() {
return toHandle().descendants();
diff --git a/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java b/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java
index a7e650fee04..fbf5cfba252 100644
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandle.java
@@ -89,7 +89,7 @@ import java.util.stream.Stream;
* {@link #compareTo(ProcessHandle) compareTo} methods to compare ProcessHandles.
*
* @see Process
- * @since 1.9
+ * @since 9
*/
public interface ProcessHandle extends Comparable {
@@ -215,7 +215,7 @@ public interface ProcessHandle extends Comparable {
* by the operating system privileges of the process making the request.
* The return types are {@code Optional} allowing explicit tests
* and actions if the value is available.
- * @since 1.9
+ * @since 9
*/
public interface Info {
/**
diff --git a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java
index 0019b5724cf..d31a80d740c 100644
--- a/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessHandleImpl.java
@@ -50,7 +50,7 @@ import static java.security.AccessController.doPrivileged;
* ProcessHandleImpl is the implementation of ProcessHandle.
*
* @see Process
- * @since 1.9
+ * @since 9
*/
final class ProcessHandleImpl implements ProcessHandle {
/**
@@ -338,7 +338,7 @@ final class ProcessHandleImpl implements ProcessHandle {
*
* @return {@code true} if the process represented by this
* {@code ProcessHandle} object has not yet terminated.
- * @since 1.9
+ * @since 9
*/
@Override
public boolean isAlive() {
diff --git a/jdk/src/java.base/share/classes/java/lang/StackWalker.java b/jdk/src/java.base/share/classes/java/lang/StackWalker.java
index 2950ca23252..f628459dfb3 100644
--- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java
+++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java
@@ -81,7 +81,7 @@ import java.util.stream.Stream;
* will cause a {@link NullPointerException NullPointerException}
* to be thrown.
*
- * @since 1.9
+ * @since 9
*/
public final class StackWalker {
/**
@@ -92,7 +92,7 @@ public final class StackWalker {
* by the {@linkplain Option stack walking options} of a {@linkplain
* StackWalker stack walker}.
*
- * @since 1.9
+ * @since 9
* @jvms 2.6
*/
public static interface StackFrame {
@@ -185,7 +185,7 @@ public final class StackWalker {
* Stack walker option to configure the {@linkplain StackFrame stack frame}
* information obtained by a {@code StackWalker}.
*
- * @since 1.9
+ * @since 9
*/
public enum Option {
/**
diff --git a/jdk/src/java.base/share/classes/java/lang/String.java b/jdk/src/java.base/share/classes/java/lang/String.java
index 63946f2e301..86ec043d5b1 100644
--- a/jdk/src/java.base/share/classes/java/lang/String.java
+++ b/jdk/src/java.base/share/classes/java/lang/String.java
@@ -2674,7 +2674,7 @@ public final class String
* point is passed through uninterpreted.
*
* @return an IntStream of char values from this sequence
- * @since 1.9
+ * @since 9
*/
@Override
public IntStream chars() {
@@ -2694,7 +2694,7 @@ public final class String
* {@code int} values which are then passed to the stream.
*
* @return an IntStream of Unicode code points from this sequence
- * @since 1.9
+ * @since 9
*/
@Override
public IntStream codePoints() {
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
index f385d95c4c9..90d0d590697 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/BoundMethodHandle.java
@@ -25,25 +25,25 @@
package java.lang.invoke;
-import static jdk.internal.org.objectweb.asm.Opcodes.*;
-import static java.lang.invoke.LambdaForm.*;
-import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.MethodHandleStatics.*;
+import jdk.internal.vm.annotation.Stable;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.FieldVisitor;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import sun.invoke.util.ValueConversions;
+import sun.invoke.util.Wrapper;
import java.lang.invoke.LambdaForm.NamedFunction;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.Field;
import java.util.Arrays;
-import java.util.function.Function;
-import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.function.Function;
-import jdk.internal.org.objectweb.asm.FieldVisitor;
-import sun.invoke.util.ValueConversions;
-import sun.invoke.util.Wrapper;
-
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
+import static java.lang.invoke.LambdaForm.BasicType;
+import static java.lang.invoke.LambdaForm.BasicType.*;
+import static java.lang.invoke.MethodHandleStatics.*;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
/**
* The flavor of method handle which emulates an invoke instruction
@@ -459,7 +459,7 @@ import jdk.internal.org.objectweb.asm.MethodVisitor;
static final String BMH_SIG = "L"+BMH+";";
static final String SPECIES_DATA = "java/lang/invoke/BoundMethodHandle$SpeciesData";
static final String SPECIES_DATA_SIG = "L"+SPECIES_DATA+";";
- static final String STABLE_SIG = "Ljava/lang/invoke/Stable;";
+ static final String STABLE_SIG = "Ljdk/internal/vm/annotation/Stable;";
static final String SPECIES_PREFIX_NAME = "Species_";
static final String SPECIES_PREFIX_PATH = BMH + "$" + SPECIES_PREFIX_NAME;
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
index 54cbb4b3038..21e45d85663 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java
@@ -26,20 +26,24 @@
package java.lang.invoke;
import jdk.internal.misc.Unsafe;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import sun.invoke.util.VerifyAccess;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
-import static java.lang.invoke.LambdaForm.*;
-import static java.lang.invoke.MethodTypeForm.*;
-import static java.lang.invoke.MethodHandleStatics.*;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
-import java.util.Objects;
+import jdk.internal.vm.annotation.ForceInline;
import sun.invoke.util.ValueConversions;
+import sun.invoke.util.VerifyAccess;
import sun.invoke.util.VerifyType;
import sun.invoke.util.Wrapper;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Objects;
+
+import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.MethodHandleStatics.UNSAFE;
+import static java.lang.invoke.MethodHandleStatics.newInternalError;
+import static java.lang.invoke.MethodTypeForm.*;
+
/**
* The flavor of method handle which implements a constant reference
* to a class member.
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
index 08c53447a80..2d7a9f5ff1c 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java
@@ -625,9 +625,9 @@ class InvokerBytecodeGenerator {
if (lambdaForm.forceInline) {
// Force inlining of this invoker method.
- mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+ mv.visitAnnotation("Ljdk/internal/vm/annotation/ForceInline;", true);
} else {
- mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+ mv.visitAnnotation("Ljdk/internal/vm/annotation/DontInline;", true);
}
if (lambdaForm.customized != null) {
@@ -1309,7 +1309,7 @@ class InvokerBytecodeGenerator {
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
// Don't inline the interpreter entry.
- mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
+ mv.visitAnnotation("Ljdk/internal/vm/annotation/DontInline;", true);
// create parameter array
emitIconstInsn(invokerType.parameterCount());
@@ -1368,7 +1368,7 @@ class InvokerBytecodeGenerator {
mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);
// Force inlining of this invoker method.
- mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
+ mv.visitAnnotation("Ljdk/internal/vm/annotation/ForceInline;", true);
// Load receiver
emitAloadInsn(0);
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
index add42889bac..32a96ebea7e 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java
@@ -25,6 +25,10 @@
package java.lang.invoke;
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.ForceInline;
+import jdk.internal.vm.annotation.Stable;
+
import java.lang.reflect.Array;
import java.util.Arrays;
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
index 438b4256c09..45818bbf24a 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
@@ -25,18 +25,24 @@
package java.lang.invoke;
-import java.lang.annotation.*;
+import jdk.internal.vm.annotation.DontInline;
+import jdk.internal.vm.annotation.Stable;
+import sun.invoke.util.Wrapper;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.util.List;
import java.util.Arrays;
import java.util.HashMap;
-
-import sun.invoke.util.Wrapper;
-import java.lang.reflect.Field;
+import java.util.List;
import static java.lang.invoke.LambdaForm.BasicType.*;
-import static java.lang.invoke.MethodHandleStatics.*;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
+import static java.lang.invoke.MethodHandleStatics.debugEnabled;
+import static java.lang.invoke.MethodHandleStatics.newInternalError;
/**
* The symbolic, non-executable form of a method handle's invocation semantics.
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
index 51d6b0665e2..ebaf2a393ad 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -33,6 +33,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.function.Function;
+import jdk.internal.vm.annotation.Stable;
import sun.invoke.empty.Empty;
import sun.invoke.util.ValueConversions;
import sun.invoke.util.VerifyType;
@@ -1487,7 +1488,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
}
private static final int LEFT_ARGS = FILL_ARRAYS_COUNT - 1;
- private static final @Stable MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY+1];
+ private static final @Stable MethodHandle[] FILL_ARRAY_TO_RIGHT = new MethodHandle[MAX_ARITY + 1];
/** fill_array_to_right(N).invoke(a, argL..arg[N-1])
* fills a[L]..a[N-1] with corresponding arguments,
* and then returns a. The value L is a global constant (LEFT_ARGS).
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 1448ded8b03..4925829a985 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3120,6 +3120,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
MethodHandle handler) {
MethodType ttype = target.type();
MethodType htype = handler.type();
+ if (!Throwable.class.isAssignableFrom(exType))
+ throw new ClassCastException(exType.getName());
if (htype.parameterCount() < 1 ||
!htype.parameterType(0).isAssignableFrom(exType))
throw newIllegalArgumentException("handler does not accept exception type "+exType);
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java
index d75bad58a36..71690e5c439 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java
@@ -25,6 +25,7 @@
package java.lang.invoke;
+import jdk.internal.vm.annotation.Stable;
import sun.invoke.util.Wrapper;
import java.lang.ref.WeakReference;
import java.lang.ref.Reference;
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
index 0c4cf9bd4e1..e988252c8bc 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
@@ -25,6 +25,7 @@
package java.lang.invoke;
+import jdk.internal.vm.annotation.Stable;
import sun.invoke.util.Wrapper;
import java.lang.ref.SoftReference;
import static java.lang.invoke.MethodHandleStatics.*;
diff --git a/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java
index 88fe8fe9fa1..b79e3385a7f 100644
--- a/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java
+++ b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,23 +29,20 @@ package java.lang.ref;
/**
* Phantom reference objects, which are enqueued after the collector
* determines that their referents may otherwise be reclaimed. Phantom
- * references are most often used for scheduling pre-mortem cleanup actions in
- * a more flexible way than is possible with the Java finalization mechanism.
+ * references are most often used to schedule post-mortem cleanup actions.
*
- *
If the garbage collector determines at a certain point in time that the
- * referent of a phantom reference is phantom reachable, then at that
- * time or at some later time it will enqueue the reference.
+ *
Suppose the garbage collector determines at a certain point in time
+ * that an object is
+ * phantom reachable. At that time it will atomically clear
+ * all phantom references to that object and all phantom references to
+ * any other phantom-reachable objects from which that object is reachable.
+ * At the same time or at some later time it will enqueue those newly-cleared
+ * phantom references that are registered with reference queues.
*
*
In order to ensure that a reclaimable object remains so, the referent of
* a phantom reference may not be retrieved: The {@code get} method of a
* phantom reference always returns {@code null}.
*
- *
Unlike soft and weak references, phantom references are not
- * automatically cleared by the garbage collector as they are enqueued. An
- * object that is reachable via phantom references will remain so until all
- * such references are cleared or themselves become unreachable.
- *
* @author Mark Reinhold
* @since 1.2
*/
@@ -69,8 +66,8 @@ public class PhantomReference extends Reference {
*
*
It is possible to create a phantom reference with a {@code null}
* queue, but such a reference is completely useless: Its {@code get}
- * method will always return null and, since it does not have a queue, it
- * will never be enqueued.
+ * method will always return {@code null} and, since it does not have a queue,
+ * it will never be enqueued.
*
* @param referent the object the new phantom reference will refer to
* @param q the queue with which the reference is to be registered,
diff --git a/jdk/src/java.base/share/classes/java/lang/ref/Reference.java b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java
index b8b9c432848..0f06a6c937f 100644
--- a/jdk/src/java.base/share/classes/java/lang/ref/Reference.java
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java
@@ -25,6 +25,7 @@
package java.lang.ref;
+import jdk.internal.vm.annotation.DontInline;
import sun.misc.Cleaner;
import jdk.internal.HotSpotIntrinsicCandidate;
import jdk.internal.misc.JavaLangRefAccess;
@@ -310,4 +311,120 @@ public abstract class Reference {
this.queue = (queue == null) ? ReferenceQueue.NULL : queue;
}
+ /**
+ * Ensures that the object referenced by the given reference remains
+ * strongly reachable,
+ * regardless of any prior actions of the program that might otherwise cause
+ * the object to become unreachable; thus, the referenced object is not
+ * reclaimable by garbage collection at least until after the invocation of
+ * this method. Invocation of this method does not itself initiate garbage
+ * collection or finalization.
+ *
+ *
This method establishes an ordering for
+ * strong reachability
+ * with respect to garbage collection. It controls relations that are
+ * otherwise only implicit in a program -- the reachability conditions
+ * triggering garbage collection. This method is designed for use in
+ * uncommon situations of premature finalization where using
+ * {@code synchronized} blocks or methods, or using other synchronization
+ * facilities are not possible or do not provide the desired control. This
+ * method is applicable only when reclamation may have visible effects,
+ * which is possible for objects with finalizers (See
+ *
+ * Section 12.6 17 of The Java™ Language Specification)
+ * that are implemented in ways that rely on ordering control for correctness.
+ *
+ * @apiNote
+ * Finalization may occur whenever the virtual machine detects that no
+ * reference to an object will ever be stored in the heap: The garbage
+ * collector may reclaim an object even if the fields of that object are
+ * still in use, so long as the object has otherwise become unreachable.
+ * This may have surprising and undesirable effects in cases such as the
+ * following example in which the bookkeeping associated with a class is
+ * managed through array indices. Here, method {@code action} uses a
+ * {@code reachabilityFence} to ensure that the {@code Resource} object is
+ * not reclaimed before bookkeeping on an associated
+ * {@code ExternalResource} has been performed; in particular here, to
+ * ensure that the array slot holding the {@code ExternalResource} is not
+ * nulled out in method {@link Object#finalize}, which may otherwise run
+ * concurrently.
+ *
+ *
+ *
+ * Here, the invocation of {@code reachabilityFence} is nonintuitively
+ * placed after the call to {@code update}, to ensure that the
+ * array slot is not nulled out by {@link Object#finalize} before the
+ * update, even if the call to {@code action} was the last use of this
+ * object. This might be the case if, for example a usage in a user program
+ * had the form {@code new Resource().action();} which retains no other
+ * reference to this {@code Resource}. While probably overkill here,
+ * {@code reachabilityFence} is placed in a {@code finally} block to ensure
+ * that it is invoked across all paths in the method. In a method with more
+ * complex control paths, you might need further precautions to ensure that
+ * {@code reachabilityFence} is encountered along all of them.
+ *
+ *
It is sometimes possible to better encapsulate use of
+ * {@code reachabilityFence}. Continuing the above example, if it were
+ * acceptable for the call to method {@code update} to proceed even if the
+ * finalizer had already executed (nulling out slot), then you could
+ * localize use of {@code reachabilityFence}:
+ *
+ *
Method {@code reachabilityFence} is not required in constructions
+ * that themselves ensure reachability. For example, because objects that
+ * are locked cannot, in general, be reclaimed, it would suffice if all
+ * accesses of the object, in all methods of class {@code Resource}
+ * (including {@code finalize}) were enclosed in {@code synchronized (this)}
+ * blocks. (Further, such blocks must not include infinite loops, or
+ * themselves be unreachable, which fall into the corner case exceptions to
+ * the "in general" disclaimer.) However, method {@code reachabilityFence}
+ * remains a better option in cases where this approach is not as efficient,
+ * desirable, or possible; for example because it would encounter deadlock.
+ *
+ * @param ref the reference. If {@code null}, this method has no effect.
+ * @since 9
+ */
+ @DontInline
+ public static void reachabilityFence(Object ref) {
+ // Does nothing, because this method is annotated with @DontInline
+ // HotSpot needs to retain the ref and not GC it before a call to this
+ // method
+ }
+
}
diff --git a/jdk/src/java.base/share/classes/java/lang/ref/package-info.java b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java
index 32a58f36828..1ee769d16cc 100644
--- a/jdk/src/java.base/share/classes/java/lang/ref/package-info.java
+++ b/jdk/src/java.base/share/classes/java/lang/ref/package-info.java
@@ -66,9 +66,9 @@
* object with a reference queue at the time the reference
* object is created. Some time after the garbage collector
* determines that the reachability of the referent has changed to the
- * value corresponding to the type of the reference, it will add the
- * reference to the associated queue. At this point, the reference is
- * considered to be enqueued. The program may remove
+ * value corresponding to the type of the reference, it will clear the
+ * reference and add it to the associated queue. At this point, the
+ * reference is considered to be enqueued. The program may remove
* references from a queue either by polling or by blocking until a
* reference becomes available. Reference queues are implemented by
* the {@link java.lang.ref.ReferenceQueue} class.
@@ -94,16 +94,6 @@
* structure, this check will add little overhead to the hashtable
* access methods.
*
- *
Automatically-cleared references
- *
- * Soft and weak references are automatically cleared by the collector
- * before being added to the queues with which they are registered, if
- * any. Therefore soft and weak references need not be registered
- * with a queue in order to be useful, while phantom references do.
- * An object that is reachable via phantom references will remain so
- * until all such references are cleared or themselves become
- * unreachable.
- *
*
*
Reachability
*
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java
index 747769e33b2..d9b8223c758 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedArrayType.java
@@ -53,7 +53,7 @@ public interface AnnotatedArrayType extends AnnotatedType {
*
* @return {@code null}
*
- * @since 1.9
+ * @since 9
*/
@Override
AnnotatedType getAnnotatedOwnerType();
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java
index bb96e6347ed..b42530ef82e 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedParameterizedType.java
@@ -59,7 +59,7 @@ public interface AnnotatedParameterizedType extends AnnotatedType {
* refers to a parameterized type that cannot be instantiated
* for any reason
*
- * @since 1.9
+ * @since 9
*/
@Override
AnnotatedType getAnnotatedOwnerType();
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java
index 8ef6130834e..79a8cd15fdd 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedType.java
@@ -60,7 +60,7 @@ public interface AnnotatedType extends AnnotatedElement {
* refers to a parameterized type that cannot be instantiated
* for any reason
*
- * @since 1.9
+ * @since 9
*/
default AnnotatedType getAnnotatedOwnerType() {
return null;
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java
index c1d8e37482f..cab83f361c3 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedTypeVariable.java
@@ -54,7 +54,7 @@ public interface AnnotatedTypeVariable extends AnnotatedType {
*
* @return {@code null}
*
- * @since 1.9
+ * @since 9
*/
@Override
AnnotatedType getAnnotatedOwnerType();
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java
index 84e44f52e41..d46d269d343 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AnnotatedWildcardType.java
@@ -65,7 +65,7 @@ public interface AnnotatedWildcardType extends AnnotatedType {
*
* @return {@code null}
*
- * @since 1.9
+ * @since 9
*/
@Override
AnnotatedType getAnnotatedOwnerType();
diff --git a/jdk/src/java.base/share/classes/java/math/BigInteger.java b/jdk/src/java.base/share/classes/java/math/BigInteger.java
index c77731b2418..6ef44a5f6f8 100644
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java
@@ -297,7 +297,7 @@ public class BigInteger extends Number implements Comparable {
* @throws IndexOutOfBoundsException if the provided array offset and
* length would cause an index into the byte array to be
* negative or greater than or equal to the array length.
- * @since 1.9
+ * @since 9
*/
public BigInteger(byte[] val, int off, int len) {
if (val.length == 0) {
@@ -385,7 +385,7 @@ public class BigInteger extends Number implements Comparable {
* @throws IndexOutOfBoundsException if the provided array offset and
* length would cause an index into the byte array to be
* negative or greater than or equal to the array length.
- * @since 1.9
+ * @since 9
*/
public BigInteger(int signum, byte[] magnitude, int off, int len) {
if (signum < -1 || signum > 1) {
@@ -2424,7 +2424,7 @@ public class BigInteger extends Number implements Comparable {
* {@code (i * sqrt(-val))} where i is the
* imaginary unit and is equal to
* {@code sqrt(-1)}.)
- * @since 1.9
+ * @since 9
*/
public BigInteger sqrt() {
if (this.signum < 0) {
@@ -2447,7 +2447,7 @@ public class BigInteger extends Number implements Comparable {
* imaginary unit and is equal to
* {@code sqrt(-1)}.)
* @see #sqrt()
- * @since 1.9
+ * @since 9
*/
public BigInteger[] sqrtAndRemainder() {
BigInteger s = sqrt();
diff --git a/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java b/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java
index 65eca1e743d..2d7ababd042 100644
--- a/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java
+++ b/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java
@@ -1878,7 +1878,7 @@ class MutableBigInteger {
* @throws ArithmeticException if the value returned by {@code bitLength()}
* overflows the range of {@code int}.
* @return the integer square root of {@code this}
- * @since 1.9
+ * @since 9
*/
MutableBigInteger sqrt() {
// Special cases.
diff --git a/jdk/src/java.base/share/classes/java/net/DatagramSocket.java b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java
index 3c0e5c66a9b..7a447cb0acd 100644
--- a/jdk/src/java.base/share/classes/java/net/DatagramSocket.java
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java
@@ -1338,7 +1338,7 @@ class DatagramSocket implements java.io.Closeable {
*
* @throws NullPointerException if name is {@code null}
*
- * @since 1.9
+ * @since 9
*/
public DatagramSocket setOption(SocketOption name, T value)
throws IOException
@@ -1368,7 +1368,7 @@ class DatagramSocket implements java.io.Closeable {
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
public T getOption(SocketOption name) throws IOException {
return getImpl().getOption(name);
@@ -1386,7 +1386,7 @@ class DatagramSocket implements java.io.Closeable {
* @return A set of the socket options supported by this socket. This set
* may be empty if the socket's DatagramSocketImpl cannot be created.
*
- * @since 1.9
+ * @since 9
*/
public Set> supportedOptions() {
synchronized(DatagramSocket.class) {
diff --git a/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java b/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java
index 0726dc4cce7..97526bc3712 100644
--- a/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocketImpl.java
@@ -278,7 +278,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
*
* @throws NullPointerException if name is {@code null}
* @throws IOException if an I/O problem occurs while attempting to set the option
- * @since 1.9
+ * @since 9
*/
protected void setOption(SocketOption name, T value) throws IOException {
if (name == StandardSocketOptions.SO_SNDBUF) {
@@ -319,7 +319,7 @@ public abstract class DatagramSocketImpl implements SocketOptions {
* @throws NullPointerException if name is {@code null}
* @throws IOException if an I/O problem occurs while attempting to set the option
*
- * @since 1.9
+ * @since 9
*/
@SuppressWarnings("unchecked")
protected T getOption(SocketOption name) throws IOException {
diff --git a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java
index 8e5ec293646..f505bc48a82 100644
--- a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java
+++ b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java
@@ -130,7 +130,7 @@ public final class NetworkInterface {
*
* @return a Stream object with all or a subset of the InetAddresses
* bound to this network interface
- * @since 1.9
+ * @since 9
*/
public Stream inetAddresses() {
return streamFromArray(getCheckedInetAddresses());
@@ -208,7 +208,7 @@ public final class NetworkInterface {
*
* @return a Stream object with all of the subinterfaces
* of this network interface
- * @since 1.9
+ * @since 9
*/
public Stream subInterfaces() {
return streamFromArray(childs);
@@ -362,7 +362,7 @@ public final class NetworkInterface {
*
* @return a Stream of NetworkInterfaces found on this machine
* @exception SocketException if an I/O error occurs.
- * @since 1.9
+ * @since 9
*/
public static Stream networkInterfaces()
throws SocketException {
diff --git a/jdk/src/java.base/share/classes/java/net/ServerSocket.java b/jdk/src/java.base/share/classes/java/net/ServerSocket.java
index af0c5152d9a..a86fca6af3c 100644
--- a/jdk/src/java.base/share/classes/java/net/ServerSocket.java
+++ b/jdk/src/java.base/share/classes/java/net/ServerSocket.java
@@ -946,7 +946,7 @@ class ServerSocket implements java.io.Closeable {
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
public ServerSocket setOption(SocketOption name, T value)
throws IOException
@@ -976,7 +976,7 @@ class ServerSocket implements java.io.Closeable {
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
public T getOption(SocketOption name) throws IOException {
return getImpl().getOption(name);
@@ -994,7 +994,7 @@ class ServerSocket implements java.io.Closeable {
* @return A set of the socket options supported by this socket. This set
* may be empty if the socket's SocketImpl cannot be created.
*
- * @since 1.9
+ * @since 9
*/
public Set> supportedOptions() {
synchronized (ServerSocket.class) {
diff --git a/jdk/src/java.base/share/classes/java/net/Socket.java b/jdk/src/java.base/share/classes/java/net/Socket.java
index 43e1c5db6bd..47971df5fbb 100644
--- a/jdk/src/java.base/share/classes/java/net/Socket.java
+++ b/jdk/src/java.base/share/classes/java/net/Socket.java
@@ -1756,7 +1756,7 @@ class Socket implements java.io.Closeable {
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
public Socket setOption(SocketOption name, T value) throws IOException {
getImpl().setOption(name, value);
@@ -1784,7 +1784,7 @@ class Socket implements java.io.Closeable {
* {@link java.net.StandardSocketOptions StandardSocketOptions}
* do not require any security permission.
*
- * @since 1.9
+ * @since 9
*/
@SuppressWarnings("unchecked")
public T getOption(SocketOption name) throws IOException {
@@ -1803,7 +1803,7 @@ class Socket implements java.io.Closeable {
* @return A set of the socket options supported by this socket. This set
* may be empty if the socket's SocketImpl cannot be created.
*
- * @since 1.9
+ * @since 9
*/
public Set> supportedOptions() {
synchronized (Socket.class) {
diff --git a/jdk/src/java.base/share/classes/java/net/SocketImpl.java b/jdk/src/java.base/share/classes/java/net/SocketImpl.java
index 600c68457af..eef92f30b6e 100644
--- a/jdk/src/java.base/share/classes/java/net/SocketImpl.java
+++ b/jdk/src/java.base/share/classes/java/net/SocketImpl.java
@@ -373,22 +373,26 @@ public abstract class SocketImpl implements SocketOptions {
*
* @throws IOException if an I/O error occurs, or if the socket is closed.
*
- * @since 1.9
+ * @since 9
*/
protected void setOption(SocketOption name, T value) throws IOException {
- if (name == StandardSocketOptions.SO_KEEPALIVE) {
+ if (name == StandardSocketOptions.SO_KEEPALIVE &&
+ (getSocket() != null)) {
setOption(SocketOptions.SO_KEEPALIVE, value);
- } else if (name == StandardSocketOptions.SO_SNDBUF) {
+ } else if (name == StandardSocketOptions.SO_SNDBUF &&
+ (getSocket() != null)) {
setOption(SocketOptions.SO_SNDBUF, value);
} else if (name == StandardSocketOptions.SO_RCVBUF) {
setOption(SocketOptions.SO_RCVBUF, value);
} else if (name == StandardSocketOptions.SO_REUSEADDR) {
setOption(SocketOptions.SO_REUSEADDR, value);
- } else if (name == StandardSocketOptions.SO_LINGER) {
+ } else if (name == StandardSocketOptions.SO_LINGER &&
+ (getSocket() != null)) {
setOption(SocketOptions.SO_LINGER, value);
} else if (name == StandardSocketOptions.IP_TOS) {
setOption(SocketOptions.IP_TOS, value);
- } else if (name == StandardSocketOptions.TCP_NODELAY) {
+ } else if (name == StandardSocketOptions.TCP_NODELAY &&
+ (getSocket() != null)) {
setOption(SocketOptions.TCP_NODELAY, value);
} else {
throw new UnsupportedOperationException("unsupported option");
@@ -408,23 +412,27 @@ public abstract class SocketImpl implements SocketOptions {
*
* @throws IOException if an I/O error occurs, or if the socket is closed.
*
- * @since 1.9
+ * @since 9
*/
@SuppressWarnings("unchecked")
protected T getOption(SocketOption name) throws IOException {
- if (name == StandardSocketOptions.SO_KEEPALIVE) {
+ if (name == StandardSocketOptions.SO_KEEPALIVE &&
+ (getSocket() != null)) {
return (T)getOption(SocketOptions.SO_KEEPALIVE);
- } else if (name == StandardSocketOptions.SO_SNDBUF) {
+ } else if (name == StandardSocketOptions.SO_SNDBUF &&
+ (getSocket() != null)) {
return (T)getOption(SocketOptions.SO_SNDBUF);
} else if (name == StandardSocketOptions.SO_RCVBUF) {
return (T)getOption(SocketOptions.SO_RCVBUF);
} else if (name == StandardSocketOptions.SO_REUSEADDR) {
return (T)getOption(SocketOptions.SO_REUSEADDR);
- } else if (name == StandardSocketOptions.SO_LINGER) {
+ } else if (name == StandardSocketOptions.SO_LINGER &&
+ (getSocket() != null)) {
return (T)getOption(SocketOptions.SO_LINGER);
} else if (name == StandardSocketOptions.IP_TOS) {
return (T)getOption(SocketOptions.IP_TOS);
- } else if (name == StandardSocketOptions.TCP_NODELAY) {
+ } else if (name == StandardSocketOptions.TCP_NODELAY &&
+ (getSocket() != null)) {
return (T)getOption(SocketOptions.TCP_NODELAY);
} else {
throw new UnsupportedOperationException("unsupported option");
diff --git a/jdk/src/java.base/share/classes/java/net/URL.java b/jdk/src/java.base/share/classes/java/net/URL.java
index e8a694116fd..2235a4edd2a 100644
--- a/jdk/src/java.base/share/classes/java/net/URL.java
+++ b/jdk/src/java.base/share/classes/java/net/URL.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,10 @@ import java.net.spi.URLStreamHandlerProvider;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Hashtable;
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
+import java.io.ObjectStreamField;
+import java.io.ObjectInputStream.GetField;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.ServiceConfigurationError;
@@ -142,6 +146,7 @@ import sun.security.util.SecurityConstants;
*/
public final class URL implements java.io.Serializable {
+ static final String BUILTIN_HANDLERS_PREFIX = "sun.net.www.protocol";
static final long serialVersionUID = -7627629688361524110L;
/**
@@ -226,6 +231,8 @@ public final class URL implements java.io.Serializable {
*/
private int hashCode = -1;
+ private transient UrlDeserializedState tempState;
+
/**
* Creates a {@code URL} object from the specified
* {@code protocol}, {@code host}, {@code port}
@@ -1353,6 +1360,31 @@ public final class URL implements java.io.Serializable {
return handler;
}
+ /**
+ * @serialField protocol String
+ *
+ * @serialField host String
+ *
+ * @serialField port int
+ *
+ * @serialField authority String
+ *
+ * @serialField file String
+ *
+ * @serialField ref String
+ *
+ * @serialField hashCode int
+ *
+ */
+ private static final ObjectStreamField[] serialPersistentFields = {
+ new ObjectStreamField("protocol", String.class),
+ new ObjectStreamField("host", String.class),
+ new ObjectStreamField("port", int.class),
+ new ObjectStreamField("authority", String.class),
+ new ObjectStreamField("file", String.class),
+ new ObjectStreamField("ref", String.class),
+ new ObjectStreamField("hashCode", int.class), };
+
/**
* WriteObject is called to save the state of the URL to an
* ObjectOutputStream. The handler is not saved since it is
@@ -1375,16 +1407,67 @@ public final class URL implements java.io.Serializable {
* stream handler.
*/
private synchronized void readObject(java.io.ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- s.defaultReadObject(); // read the fields
- if ((handler = getURLStreamHandler(protocol)) == null) {
+ throws IOException, ClassNotFoundException {
+ GetField gf = s.readFields();
+ String protocol = (String)gf.get("protocol", null);
+ if (getURLStreamHandler(protocol) == null) {
throw new IOException("unknown protocol: " + protocol);
}
+ String host = (String)gf.get("host", null);
+ int port = gf.get("port", -1);
+ String authority = (String)gf.get("authority", null);
+ String file = (String)gf.get("file", null);
+ String ref = (String)gf.get("ref", null);
+ int hashCode = gf.get("hashCode", -1);
+ if (authority == null
+ && ((host != null && host.length() > 0) || port != -1)) {
+ if (host == null)
+ host = "";
+ authority = (port == -1) ? host : host + ":" + port;
+ }
+ tempState = new UrlDeserializedState(protocol, host, port, authority,
+ file, ref, hashCode);
+ }
+
+ /**
+ * Replaces the de-serialized object with an URL object.
+ *
+ * @return a newly created object from deserialized data
+ *
+ * @throws ObjectStreamException if a new object replacing this
+ * object could not be created
+ */
+
+ private Object readResolve() throws ObjectStreamException {
+
+ URLStreamHandler handler = null;
+ // already been checked in readObject
+ handler = getURLStreamHandler(tempState.getProtocol());
+
+ URL replacementURL = null;
+ if (isBuiltinStreamHandler(handler.getClass().getName())) {
+ replacementURL = fabricateNewURL();
+ } else {
+ replacementURL = setDeserializedFields(handler);
+ }
+ return replacementURL;
+ }
+
+ private URL setDeserializedFields(URLStreamHandler handler) {
+ URL replacementURL;
+ String userInfo = null;
+ String protocol = tempState.getProtocol();
+ String host = tempState.getHost();
+ int port = tempState.getPort();
+ String authority = tempState.getAuthority();
+ String file = tempState.getFile();
+ String ref = tempState.getRef();
+ int hashCode = tempState.getHashCode();
+
// Construct authority part
- if (authority == null &&
- ((host != null && host.length() > 0) || port != -1)) {
+ if (authority == null
+ && ((host != null && host.length() > 0) || port != -1)) {
if (host == null)
host = "";
authority = (port == -1) ? host : host + ":" + port;
@@ -1403,8 +1486,8 @@ public final class URL implements java.io.Serializable {
}
// Construct path and query part
- path = null;
- query = null;
+ String path = null;
+ String query = null;
if (file != null) {
// Fix: only do this if hierarchical?
int q = file.lastIndexOf('?');
@@ -1414,6 +1497,67 @@ public final class URL implements java.io.Serializable {
} else
path = file;
}
+
+ if (port == -1) {
+ port = 0;
+ }
+ // Set the object fields.
+ this.protocol = protocol;
+ this.host = host;
+ this.port = port;
+ this.file = file;
+ this.authority = authority;
+ this.ref = ref;
+ this.hashCode = hashCode;
+ this.handler = handler;
+ this.query = query;
+ this.path = path;
+ this.userInfo = userInfo;
+ replacementURL = this;
+ return replacementURL;
+ }
+
+ private URL fabricateNewURL()
+ throws InvalidObjectException {
+ // create URL string from deserialized object
+ URL replacementURL = null;
+ String urlString = tempState.reconstituteUrlString();
+
+ try {
+ replacementURL = new URL(urlString);
+ } catch (MalformedURLException mEx) {
+ resetState();
+ InvalidObjectException invoEx = new InvalidObjectException(
+ "Malformed URL: " + urlString);
+ invoEx.initCause(mEx);
+ throw invoEx;
+ }
+ replacementURL.setSerializedHashCode(tempState.getHashCode());
+ resetState();
+ return replacementURL;
+ }
+
+ private boolean isBuiltinStreamHandler(String handlerClassName) {
+ return (handlerClassName.startsWith(BUILTIN_HANDLERS_PREFIX));
+ }
+
+ private void resetState() {
+ this.protocol = null;
+ this.host = null;
+ this.port = -1;
+ this.file = null;
+ this.authority = null;
+ this.ref = null;
+ this.hashCode = -1;
+ this.handler = null;
+ this.query = null;
+ this.path = null;
+ this.userInfo = null;
+ this.tempState = null;
+ }
+
+ private void setSerializedHashCode(int hc) {
+ this.hashCode = hc;
}
}
@@ -1445,3 +1589,82 @@ class Parts {
return ref;
}
}
+
+final class UrlDeserializedState {
+ private final String protocol;
+ private final String host;
+ private final int port;
+ private final String authority;
+ private final String file;
+ private final String ref;
+ private final int hashCode;
+
+ public UrlDeserializedState(String protocol,
+ String host, int port,
+ String authority, String file,
+ String ref, int hashCode) {
+ this.protocol = protocol;
+ this.host = host;
+ this.port = port;
+ this.authority = authority;
+ this.file = file;
+ this.ref = ref;
+ this.hashCode = hashCode;
+ }
+
+ String getProtocol() {
+ return protocol;
+ }
+
+ String getHost() {
+ return host;
+ }
+
+ String getAuthority () {
+ return authority;
+ }
+
+ int getPort() {
+ return port;
+ }
+
+ String getFile () {
+ return file;
+ }
+
+ String getRef () {
+ return ref;
+ }
+
+ int getHashCode () {
+ return hashCode;
+ }
+
+ String reconstituteUrlString() {
+
+ // pre-compute length of StringBuffer
+ int len = protocol.length() + 1;
+ if (authority != null && authority.length() > 0)
+ len += 2 + authority.length();
+ if (file != null) {
+ len += file.length();
+ }
+ if (ref != null)
+ len += 1 + ref.length();
+ StringBuilder result = new StringBuilder(len);
+ result.append(protocol);
+ result.append(":");
+ if (authority != null && authority.length() > 0) {
+ result.append("//");
+ result.append(authority);
+ }
+ if (file != null) {
+ result.append(file);
+ }
+ if (ref != null) {
+ result.append("#");
+ result.append(ref);
+ }
+ return result.toString();
+ }
+}
diff --git a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java
index 05ebeed39a5..1cf064d1afa 100644
--- a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java
+++ b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java
@@ -52,6 +52,7 @@ import java.util.jar.Manifest;
import jdk.internal.misc.JavaNetAccess;
import jdk.internal.misc.SharedSecrets;
+import jdk.internal.perf.PerfCounter;
import sun.misc.Resource;
import sun.misc.URLClassPath;
import sun.net.www.ParseUtil;
@@ -459,14 +460,14 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
// Use (direct) ByteBuffer:
CodeSigner[] signers = res.getCodeSigners();
CodeSource cs = new CodeSource(url, signers);
- sun.misc.PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
+ PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
return defineClass(name, bb, cs);
} else {
byte[] b = res.getBytes();
// must read certificates AFTER reading bytes.
CodeSigner[] signers = res.getCodeSigners();
CodeSource cs = new CodeSource(url, signers);
- sun.misc.PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
+ PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
return defineClass(name, b, 0, b.length, cs);
}
}
diff --git a/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java b/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java
index 0d6b424205e..b8f2c09bb89 100644
--- a/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java
+++ b/jdk/src/java.base/share/classes/java/net/spi/URLStreamHandlerProvider.java
@@ -44,7 +44,7 @@ import java.net.URLStreamHandlerFactory;
*
URL stream handler providers are located at runtime, as specified in the
* {@linkplain java.net.URL#URL(String,String,int,String) URL constructor}.
*
- * @since 1.9
+ * @since 9
*/
public abstract class URLStreamHandlerProvider
implements URLStreamHandlerFactory
diff --git a/jdk/src/java.base/share/classes/java/net/spi/package-info.java b/jdk/src/java.base/share/classes/java/net/spi/package-info.java
index 06ddeccb00d..5a1b2e555af 100644
--- a/jdk/src/java.base/share/classes/java/net/spi/package-info.java
+++ b/jdk/src/java.base/share/classes/java/net/spi/package-info.java
@@ -29,7 +29,7 @@
*
Only developers who are defining new URL stream handler providers
* should need to make direct use of this package.
*
- * @since 1.9
+ * @since 9
*/
package java.net.spi;
diff --git a/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java b/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java
index a9c6005d28c..838cc40a09a 100644
--- a/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java
+++ b/jdk/src/java.base/share/classes/java/nio/MappedByteBuffer.java
@@ -213,7 +213,7 @@ public abstract class MappedByteBuffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer position(int newPosition) {
@@ -223,7 +223,7 @@ public abstract class MappedByteBuffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer limit(int newLimit) {
@@ -233,7 +233,7 @@ public abstract class MappedByteBuffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer mark() {
@@ -243,7 +243,7 @@ public abstract class MappedByteBuffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer reset() {
@@ -253,7 +253,7 @@ public abstract class MappedByteBuffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer clear() {
@@ -263,7 +263,7 @@ public abstract class MappedByteBuffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer flip() {
@@ -273,7 +273,7 @@ public abstract class MappedByteBuffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public final MappedByteBuffer rewind() {
diff --git a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template
index d34f975526c..72efc279778 100644
--- a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template
+++ b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template
@@ -1064,7 +1064,7 @@ public abstract class $Type$Buffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1078,7 +1078,7 @@ public abstract class $Type$Buffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1092,7 +1092,7 @@ public abstract class $Type$Buffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1106,7 +1106,7 @@ public abstract class $Type$Buffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1120,7 +1120,7 @@ public abstract class $Type$Buffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1134,7 +1134,7 @@ public abstract class $Type$Buffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
@@ -1148,7 +1148,7 @@ public abstract class $Type$Buffer
/**
* {@inheritDoc}
- * @since 1.9
+ * @since 9
*/
@Override
public
diff --git a/jdk/src/java.base/share/classes/java/security/KeyStore.java b/jdk/src/java.base/share/classes/java/security/KeyStore.java
index 40df29cdd6c..39721622fc2 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java
@@ -1666,7 +1666,7 @@ public class KeyStore {
*
* @see Provider
*
- * @since 1.9
+ * @since 9
*/
public static final KeyStore getInstance(File file, char[] password)
throws KeyStoreException, IOException, NoSuchAlgorithmException,
@@ -1722,7 +1722,7 @@ public class KeyStore {
*
* @see Provider
*
- * @since 1.9
+ * @since 9
*/
public static final KeyStore getInstance(File file,
LoadStoreParameter param) throws KeyStoreException, IOException,
@@ -2006,7 +2006,7 @@ public class KeyStore {
* of either PasswordProtection or CallbackHandlerProtection; or
* if file does not exist or does not refer to a normal file
*
- * @since 1.9
+ * @since 9
*/
public static Builder newInstance(File file,
ProtectionParameter protection) {
diff --git a/jdk/src/java.base/share/classes/java/security/PermissionCollection.java b/jdk/src/java.base/share/classes/java/security/PermissionCollection.java
index 0aa6ce74bc4..1aa41cab022 100644
--- a/jdk/src/java.base/share/classes/java/security/PermissionCollection.java
+++ b/jdk/src/java.base/share/classes/java/security/PermissionCollection.java
@@ -144,7 +144,7 @@ public abstract class PermissionCollection implements java.io.Serializable {
* the enumeration returned from a call to {@link #elements()}.
*
* @return a stream of all the Permissions.
- * @since 1.9
+ * @since 9
*/
public Stream elementsAsStream() {
int characteristics = isReadOnly()
diff --git a/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java b/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java
index 203ec8eed41..c7a0893b7d3 100644
--- a/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java
+++ b/jdk/src/java.base/share/classes/java/security/ProtectionDomain.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,12 @@ package java.security;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
-import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import jdk.internal.misc.JavaSecurityAccess;
import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
@@ -472,11 +472,15 @@ public class ProtectionDomain {
*
* This class stores ProtectionDomains as weak keys in a ConcurrentHashMap
* with additional support for checking and removing weak keys that are no
- * longer in use.
+ * longer in use. There can be cases where the permission collection may
+ * have a chain of strong references back to the ProtectionDomain, which
+ * ordinarily would prevent the entry from being removed from the map. To
+ * address that, we wrap the permission collection in a SoftReference so
+ * that it can be reclaimed by the garbage collector due to memory demand.
*/
private static class PDCache implements ProtectionDomainCache {
private final ConcurrentHashMap
+ SoftReference>
pdMap = new ConcurrentHashMap<>();
private final ReferenceQueue queue = new ReferenceQueue<>();
@@ -485,15 +489,15 @@ public class ProtectionDomain {
processQueue(queue, pdMap);
WeakProtectionDomainKey weakPd =
new WeakProtectionDomainKey(pd, queue);
- pdMap.putIfAbsent(weakPd, pc);
+ pdMap.put(weakPd, new SoftReference<>(pc));
}
@Override
public PermissionCollection get(ProtectionDomain pd) {
processQueue(queue, pdMap);
- WeakProtectionDomainKey weakPd =
- new WeakProtectionDomainKey(pd, queue);
- return pdMap.get(weakPd);
+ WeakProtectionDomainKey weakPd = new WeakProtectionDomainKey(pd);
+ SoftReference sr = pdMap.get(weakPd);
+ return (sr == null) ? null : sr.get();
}
/**
@@ -533,11 +537,20 @@ public class ProtectionDomain {
this((pd == null ? NULL_KEY : pd.key), rq);
}
+ WeakProtectionDomainKey(ProtectionDomain pd) {
+ this(pd == null ? NULL_KEY : pd.key);
+ }
+
private WeakProtectionDomainKey(Key key, ReferenceQueue rq) {
super(key, rq);
hash = key.hashCode();
}
+ private WeakProtectionDomainKey(Key key) {
+ super(key);
+ hash = key.hashCode();
+ }
+
/**
* Returns the identity hash code of the original referent.
*/
diff --git a/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java b/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java
index 3b6418e4dc2..d8b05485d2d 100644
--- a/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java
+++ b/jdk/src/java.base/share/classes/java/security/cert/URICertStoreParameters.java
@@ -43,7 +43,7 @@ import java.net.URI;
* provide the necessary locking. Multiple threads each manipulating
* separate objects need not synchronize.
*
- * @since 1.9
+ * @since 9
* @see CertStore
* @see java.net.URI
*/
diff --git a/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java
index b43887b4cb0..5aca225d2b2 100644
--- a/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java
+++ b/jdk/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java
@@ -74,7 +74,7 @@ public abstract class EncodedKeySpec implements KeySpec {
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
- * @since 1.9
+ * @since 9
*/
protected EncodedKeySpec(byte[] encodedKey, String algorithm) {
if (algorithm == null) {
@@ -93,7 +93,7 @@ public abstract class EncodedKeySpec implements KeySpec {
* Returns the name of the algorithm of the encoded key.
*
* @return the name of the algorithm, or null if not specified
- * @since 1.9
+ * @since 9
*/
public String getAlgorithm() {
return algorithmName;
diff --git a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
index 89bf11d94ae..198ca604b8c 100644
--- a/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
+++ b/jdk/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
@@ -92,7 +92,7 @@ public class PKCS8EncodedKeySpec extends EncodedKeySpec {
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
- * @since 1.9
+ * @since 9
*/
public PKCS8EncodedKeySpec(byte[] encodedKey, String algorithm) {
super(encodedKey, algorithm);
diff --git a/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java
index 0ddb97f3ac4..2d23570fe3d 100644
--- a/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java
+++ b/jdk/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java
@@ -82,7 +82,7 @@ public class X509EncodedKeySpec extends EncodedKeySpec {
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
- * @since 1.9
+ * @since 9
*/
public X509EncodedKeySpec(byte[] encodedKey, String algorithm) {
super(encodedKey, algorithm);
diff --git a/jdk/src/java.base/share/classes/java/util/Arrays.java b/jdk/src/java.base/share/classes/java/util/Arrays.java
index af64264b3f3..cc7b19de64e 100644
--- a/jdk/src/java.base/share/classes/java/util/Arrays.java
+++ b/jdk/src/java.base/share/classes/java/util/Arrays.java
@@ -110,7 +110,7 @@ public class Arrays {
* Checks that {@code fromIndex} and {@code toIndex} are in
* the range and throws an exception if they aren't.
*/
- private static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
+ static void rangeCheck(int arrayLength, int fromIndex, int toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException(
"fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
@@ -2579,11 +2579,7 @@ public class Arrays {
if (a2.length != length)
return false;
- for (int i=0; i= 0) {
+ return Boolean.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -5880,11 +5819,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- boolean va = a[aFromIndex++];
- boolean vb = b[bFromIndex++];
- if (va != vb) return Boolean.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Boolean.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -5939,9 +5878,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Byte.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Byte.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6014,11 +5954,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- byte va = a[aFromIndex++];
- byte vb = b[bFromIndex++];
- if (va != vb) return Byte.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Byte.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6066,9 +6006,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Byte.compareUnsigned(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Byte.compareUnsigned(a[i], b[i]);
}
return a.length - b.length;
@@ -6133,11 +6074,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- byte va = a[aFromIndex++];
- byte vb = b[bFromIndex++];
- if (va != vb) return Byte.compareUnsigned(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Byte.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6192,9 +6133,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Short.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Short.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6267,11 +6209,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- short va = a[aFromIndex++];
- short vb = b[bFromIndex++];
- if (va != vb) return Short.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Short.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6319,9 +6261,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Short.compareUnsigned(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Short.compareUnsigned(a[i], b[i]);
}
return a.length - b.length;
@@ -6385,11 +6328,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- short va = a[aFromIndex++];
- short vb = b[bFromIndex++];
- if (va != vb) return Short.compareUnsigned(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Short.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6444,9 +6387,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Character.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Character.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6519,11 +6463,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- char va = a[aFromIndex++];
- char vb = b[bFromIndex++];
- if (va != vb) return Character.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Character.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6578,9 +6522,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Integer.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Integer.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6653,11 +6598,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- int va = a[aFromIndex++];
- int vb = b[bFromIndex++];
- if (va != vb) return Integer.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Integer.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6705,9 +6650,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Integer.compareUnsigned(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Integer.compareUnsigned(a[i], b[i]);
}
return a.length - b.length;
@@ -6771,11 +6717,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- int va = a[aFromIndex++];
- int vb = b[bFromIndex++];
- if (va != vb) return Integer.compareUnsigned(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Integer.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6830,9 +6776,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Long.compare(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Long.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -6905,11 +6852,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- long va = a[aFromIndex++];
- long vb = b[bFromIndex++];
- if (va != vb) return Long.compare(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Long.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -6957,9 +6904,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return Long.compareUnsigned(a[i], b[i]);
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Long.compareUnsigned(a[i], b[i]);
}
return a.length - b.length;
@@ -7023,11 +6971,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- long va = a[aFromIndex++];
- long vb = b[bFromIndex++];
- if (va != vb) return Long.compareUnsigned(va, vb);
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Long.compareUnsigned(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -7082,13 +7030,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- float va = a[i], vb = b[i];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
- int c = Float.compare(va, vb);
- if (c != 0) return c;
- }
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Float.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -7161,13 +7106,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- float va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb)) {
- int c = Float.compare(va, vb);
- if (c != 0) return c;
- }
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Float.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -7222,13 +7165,10 @@ public class Arrays {
if (a == null || b == null)
return a == null ? -1 : 1;
- int length = Math.min(a.length, b.length);
- for (int i = 0; i < length; i++) {
- double va = a[i], vb = b[i];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
- int c = Double.compare(va, vb);
- if (c != 0) return c;
- }
+ int i = ArraysSupport.mismatch(a, b,
+ Math.min(a.length, b.length));
+ if (i >= 0) {
+ return Double.compare(a[i], b[i]);
}
return a.length - b.length;
@@ -7301,13 +7241,11 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
- int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- double va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb)) {
- int c = Double.compare(va, vb);
- if (c != 0) return c;
- }
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ Math.min(aLength, bLength));
+ if (i >= 0) {
+ return Double.compare(a[aFromIndex + i], b[bFromIndex + i]);
}
return aLength - bLength;
@@ -7673,11 +7611,8 @@ public class Arrays {
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -7749,11 +7684,10 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch byte
@@ -7804,11 +7738,8 @@ public class Arrays {
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -7880,11 +7811,10 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch char
@@ -7935,11 +7865,8 @@ public class Arrays {
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8011,11 +7938,10 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch short
@@ -8066,11 +7992,8 @@ public class Arrays {
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8142,11 +8065,10 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch int
@@ -8197,11 +8119,8 @@ public class Arrays {
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8273,11 +8192,10 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch long
@@ -8328,11 +8246,8 @@ public class Arrays {
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- if (a[i] != b[i]) return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8404,11 +8319,10 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- if (a[aFromIndex++] != b[bFromIndex++]) return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch float
@@ -8459,14 +8373,8 @@ public class Arrays {
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- float va = a[i], vb = b[i];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
- if (!Float.isNaN(va) || !Float.isNaN(vb))
- return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8538,14 +8446,10 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- float va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Float.floatToRawIntBits(va) != Float.floatToRawIntBits(vb))
- if (!Float.isNaN(va) || !Float.isNaN(vb))
- return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch double
@@ -8596,14 +8500,8 @@ public class Arrays {
if (a == b)
return -1;
- for (int i = 0; i < length; i++) {
- double va = a[i], vb = b[i];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
- if (!Double.isNaN(va) || !Double.isNaN(vb))
- return i;
- }
-
- return a.length != b.length ? length : -1;
+ int i = ArraysSupport.mismatch(a, b, length);
+ return (i < 0 && a.length != b.length) ? length : i;
}
/**
@@ -8675,14 +8573,10 @@ public class Arrays {
int aLength = aToIndex - aFromIndex;
int bLength = bToIndex - bFromIndex;
int length = Math.min(aLength, bLength);
- for (int i = 0; i < length; i++) {
- double va = a[aFromIndex++], vb = b[bFromIndex++];
- if (Double.doubleToRawLongBits(va) != Double.doubleToRawLongBits(vb))
- if (!Double.isNaN(va) || !Double.isNaN(vb))
- return i;
- }
-
- return aLength != bLength ? length : -1;
+ int i = ArraysSupport.mismatch(a, aFromIndex,
+ b, bFromIndex,
+ length);
+ return (i < 0 && aLength != bLength) ? length : i;
}
// Mismatch objects
diff --git a/jdk/src/java.base/share/classes/java/util/ArraysSupport.java b/jdk/src/java.base/share/classes/java/util/ArraysSupport.java
new file mode 100644
index 00000000000..31612a7d4f8
--- /dev/null
+++ b/jdk/src/java.base/share/classes/java/util/ArraysSupport.java
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util;
+
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.Unsafe;
+
+/**
+ * Utility methods to find a mismatch between two primitive arrays.
+ *
+ *
Array equality and lexicographical comparison can be built on top of
+ * array mismatch functionality.
+ *
+ *
The mismatch method implementation, {@link #vectorizedMismatch}, leverages
+ * vector-based techniques to access and compare the contents of two arrays.
+ * The Java implementation uses {@code Unsafe.getLongUnaligned} to access the
+ * content of an array, thus access is supported on platforms that do not
+ * support unaligned access. For a byte[] array, 8 bytes (64 bits) can be
+ * accessed and compared as a unit rather than individually, which increases
+ * the performance when the method is compiled by the HotSpot VM. On supported
+ * platforms the mismatch implementation is intrinsified to leverage SIMD
+ * instructions. So for a byte[] array, 16 bytes (128 bits), 32 bytes
+ * (256 bits), and perhaps in the future even 64 bytes (512 bits), platform
+ * permitting, can be accessed and compared as a unit, which further increases
+ * the performance over the Java implementation.
+ *
+ *
None of the mismatch methods perform array bounds checks. It is the
+ * responsibility of the caller (direct or otherwise) to perform such checks
+ * before calling this method.
+ */
+class ArraysSupport {
+ static final Unsafe U = Unsafe.getUnsafe();
+
+ private static final boolean BIG_ENDIAN = U.isBigEndian();
+
+ private static final int LOG2_ARRAY_BOOLEAN_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BOOLEAN_INDEX_SCALE);
+ private static final int LOG2_ARRAY_BYTE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_BYTE_INDEX_SCALE);
+ private static final int LOG2_ARRAY_CHAR_INDEX_SCALE = exactLog2(Unsafe.ARRAY_CHAR_INDEX_SCALE);
+ private static final int LOG2_ARRAY_SHORT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_SHORT_INDEX_SCALE);
+ private static final int LOG2_ARRAY_INT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_INT_INDEX_SCALE);
+ private static final int LOG2_ARRAY_LONG_INDEX_SCALE = exactLog2(Unsafe.ARRAY_LONG_INDEX_SCALE);
+ private static final int LOG2_ARRAY_FLOAT_INDEX_SCALE = exactLog2(Unsafe.ARRAY_FLOAT_INDEX_SCALE);
+ private static final int LOG2_ARRAY_DOUBLE_INDEX_SCALE = exactLog2(Unsafe.ARRAY_DOUBLE_INDEX_SCALE);
+
+ private static final int LOG2_BYTE_BIT_SIZE = exactLog2(Byte.SIZE);
+
+ private static int exactLog2(int scale) {
+ if ((scale & (scale - 1)) != 0)
+ throw new Error("data type scale not a power of two");
+ return Integer.numberOfTrailingZeros(scale);
+ }
+
+ private ArraysSupport() {}
+
+ /**
+ * Find the relative index of the first mismatching pair of elements in two
+ * primitive arrays of the same component type. Pairs of elements will be
+ * tested in order relative to given offsets into both arrays.
+ *
+ *
This method does not perform type checks or bounds checks. It is the
+ * responsibility of the caller to perform such checks before calling this
+ * method.
+ *
+ *
The given offsets, in bytes, need not be aligned according to the
+ * given log2 size the array elements. More specifically, an
+ * offset modulus the size need not be zero.
+ *
+ * @param a the first array to be tested for mismatch, or {@code null} for
+ * direct memory access
+ * @param aOffset the relative offset, in bytes, from the base address of
+ * the first array to test from, otherwise if the first array is
+ * {@code null}, an absolute address pointing to the first element to test.
+ * @param b the second array to be tested for mismatch, or {@code null} for
+ * direct memory access
+ * @param bOffset the relative offset, in bytes, from the base address of
+ * the second array to test from, otherwise if the second array is
+ * {@code null}, an absolute address pointing to the first element to test.
+ * @param length the number of array elements to test
+ * @param log2ArrayIndexScale log2 of the array index scale, that
+ * corresponds to the size, in bytes, of an array element.
+ * @return if a mismatch is found a relative index, between 0 (inclusive)
+ * and {@code length} (exclusive), of the first mismatching pair of elements
+ * in the two arrays. Otherwise, if a mismatch is not found the bitwise
+ * compliment of the number of remaining pairs of elements to be checked in
+ * the tail of the two arrays.
+ */
+ @HotSpotIntrinsicCandidate
+ static int vectorizedMismatch(Object a, long aOffset,
+ Object b, long bOffset,
+ int length,
+ int log2ArrayIndexScale) {
+ // assert a.getClass().isArray();
+ // assert b.getClass().isArray();
+ // assert 0 <= length <= sizeOf(a)
+ // assert 0 <= length <= sizeOf(b)
+ // assert 0 <= log2ArrayIndexScale <= 3
+
+ int log2ValuesPerWidth = LOG2_ARRAY_LONG_INDEX_SCALE - log2ArrayIndexScale;
+ int wi = 0;
+ for (; wi < length >> log2ValuesPerWidth; wi++) {
+ long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+ long av = U.getLongUnaligned(a, aOffset + bi);
+ long bv = U.getLongUnaligned(b, bOffset + bi);
+ if (av != bv) {
+ long x = av ^ bv;
+ int o = BIG_ENDIAN
+ ? Long.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+ : Long.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+ return (wi << log2ValuesPerWidth) + o;
+ }
+ }
+
+ // Calculate the tail of remaining elements to check
+ int tail = length - (wi << log2ValuesPerWidth);
+
+ if (log2ArrayIndexScale < LOG2_ARRAY_INT_INDEX_SCALE) {
+ int wordTail = 1 << (LOG2_ARRAY_INT_INDEX_SCALE - log2ArrayIndexScale);
+ // Handle 4 bytes or 2 chars in the tail using int width
+ if (tail >= wordTail) {
+ long bi = ((long) wi) << LOG2_ARRAY_LONG_INDEX_SCALE;
+ int av = U.getIntUnaligned(a, aOffset + bi);
+ int bv = U.getIntUnaligned(b, bOffset + bi);
+ if (av != bv) {
+ int x = av ^ bv;
+ int o = BIG_ENDIAN
+ ? Integer.numberOfLeadingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale)
+ : Integer.numberOfTrailingZeros(x) >> (LOG2_BYTE_BIT_SIZE + log2ArrayIndexScale);
+ return (wi << log2ValuesPerWidth) + o;
+ }
+ tail -= wordTail;
+ }
+ return ~tail;
+ }
+ else {
+ return ~tail;
+ }
+ }
+
+ // Booleans
+ // Each boolean element takes up one byte
+
+ static int mismatch(boolean[] a,
+ boolean[] b,
+ int length) {
+ int i = 0;
+ if (length > 7) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+ b, Unsafe.ARRAY_BOOLEAN_BASE_OFFSET,
+ length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(boolean[] a, int aFromIndex,
+ boolean[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 7) {
+ int aOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + aFromIndex;
+ int bOffset = Unsafe.ARRAY_BOOLEAN_BASE_OFFSET + bFromIndex;
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_BOOLEAN_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Bytes
+
+ /**
+ * Find the index of a mismatch between two arrays.
+ *
+ *
This method does not perform bounds checks. It is the responsibility
+ * of the caller to perform such bounds checks before calling this method.
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param b the second array to be tested for a mismatch
+ * @param length the number of bytes from each array to check
+ * @return the index of a mismatch between the two arrays, otherwise -1 if
+ * no mismatch. The index will be within the range of (inclusive) 0 to
+ * (exclusive) the smaller of the two array lengths.
+ */
+ static int mismatch(byte[] a,
+ byte[] b,
+ int length) {
+ // ISSUE: defer to index receiving methods if performance is good
+ // assert length <= a.length
+ // assert length <= b.length
+
+ int i = 0;
+ if (length > 7) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+ b, Unsafe.ARRAY_BYTE_BASE_OFFSET,
+ length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ // Align to tail
+ i = length - ~i;
+// assert i >= 0 && i <= 7;
+ }
+ // Tail < 8 bytes
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Find the relative index of a mismatch between two arrays starting from
+ * given indexes.
+ *
+ *
This method does not perform bounds checks. It is the responsibility
+ * of the caller to perform such bounds checks before calling this method.
+ *
+ * @param a the first array to be tested for a mismatch
+ * @param aFromIndex the index of the first element (inclusive) in the first
+ * array to be compared
+ * @param b the second array to be tested for a mismatch
+ * @param bFromIndex the index of the first element (inclusive) in the
+ * second array to be compared
+ * @param length the number of bytes from each array to check
+ * @return the relative index of a mismatch between the two arrays,
+ * otherwise -1 if no mismatch. The index will be within the range of
+ * (inclusive) 0 to (exclusive) the smaller of the two array bounds.
+ */
+ static int mismatch(byte[] a, int aFromIndex,
+ byte[] b, int bFromIndex,
+ int length) {
+ // assert 0 <= aFromIndex < a.length
+ // assert 0 <= aFromIndex + length <= a.length
+ // assert 0 <= bFromIndex < b.length
+ // assert 0 <= bFromIndex + length <= b.length
+ // assert length >= 0
+
+ int i = 0;
+ if (length > 7) {
+ int aOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + aFromIndex;
+ int bOffset = Unsafe.ARRAY_BYTE_BASE_OFFSET + bFromIndex;
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_BYTE_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Chars
+
+ static int mismatch(char[] a,
+ char[] b,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+ b, Unsafe.ARRAY_CHAR_BASE_OFFSET,
+ length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(char[] a, int aFromIndex,
+ char[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ int aOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_CHAR_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_CHAR_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_CHAR_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Shorts
+
+ static int mismatch(short[] a,
+ short[] b,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+ b, Unsafe.ARRAY_SHORT_BASE_OFFSET,
+ length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(short[] a, int aFromIndex,
+ short[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 3) {
+ int aOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_SHORT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_SHORT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_SHORT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Ints
+
+ static int mismatch(int[] a,
+ int[] b,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ i = vectorizedMismatch(
+ a, Unsafe.ARRAY_INT_BASE_OFFSET,
+ b, Unsafe.ARRAY_INT_BASE_OFFSET,
+ length, LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[i] != b[i])
+ return i;
+ }
+ return -1;
+ }
+
+ static int mismatch(int[] a, int aFromIndex,
+ int[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ int aOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_INT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_INT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_INT_INDEX_SCALE);
+ if (i >= 0)
+ return i;
+ i = length - ~i;
+ }
+ for (; i < length; i++) {
+ if (a[aFromIndex + i] != b[bFromIndex + i])
+ return i;
+ }
+ return -1;
+ }
+
+
+ // Floats
+
+ static int mismatch(float[] a,
+ float[] b,
+ int length) {
+ return mismatch(a, 0, b, 0, length);
+ }
+
+ static int mismatch(float[] a, int aFromIndex,
+ float[] b, int bFromIndex,
+ int length) {
+ int i = 0;
+ if (length > 1) {
+ int aOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_FLOAT_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_FLOAT_INDEX_SCALE);
+ // Mismatched
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values
+ if (!Float.isNaN(a[aFromIndex + i]) || !Float.isNaN(b[bFromIndex + i]))
+ return i;
+
+ // Mismatch on two different NaN values that are normalized to match
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ }
+ // Matched
+ else {
+ i = length - ~i;
+ }
+ }
+ for (; i < length; i++) {
+ if (Float.floatToIntBits(a[aFromIndex + i]) != Float.floatToIntBits(b[bFromIndex + i]))
+ return i;
+ }
+ return -1;
+ }
+
+ // 64 bit sizes
+
+ // Long
+
+ static int mismatch(long[] a,
+ long[] b,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int i = vectorizedMismatch(
+ a, Unsafe.ARRAY_LONG_BASE_OFFSET,
+ b, Unsafe.ARRAY_LONG_BASE_OFFSET,
+ length, LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+
+ static int mismatch(long[] a, int aFromIndex,
+ long[] b, int bFromIndex,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int aOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_LONG_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_LONG_INDEX_SCALE);
+ int i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_LONG_INDEX_SCALE);
+ return i >= 0 ? i : -1;
+ }
+
+
+ // Double
+
+ static int mismatch(double[] a,
+ double[] b,
+ int length) {
+ return mismatch(a, 0, b, 0, length);
+ }
+
+ static int mismatch(double[] a, int aFromIndex,
+ double[] b, int bFromIndex,
+ int length) {
+ if (length == 0) {
+ return -1;
+ }
+ int aOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (aFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ int bOffset = Unsafe.ARRAY_DOUBLE_BASE_OFFSET + (bFromIndex << LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ int i = vectorizedMismatch(
+ a, aOffset,
+ b, bOffset,
+ length, LOG2_ARRAY_DOUBLE_INDEX_SCALE);
+ if (i >= 0) {
+ // Check if mismatch is not associated with two NaN values
+ if (!Double.isNaN(a[aFromIndex + i]) || !Double.isNaN(b[bFromIndex + i]))
+ return i;
+
+ // Mismatch on two different NaN values that are normalized to match
+ // Fall back to slow mechanism
+ // ISSUE: Consider looping over vectorizedMismatch adjusting ranges
+ // However, requires that returned value be relative to input ranges
+ i++;
+ for (; i < length; i++) {
+ if (Double.doubleToLongBits(a[aFromIndex + i]) != Double.doubleToLongBits(b[bFromIndex + i]))
+ return i;
+ }
+ }
+
+ return -1;
+ }
+}
diff --git a/jdk/src/java.base/share/classes/java/util/Enumeration.java b/jdk/src/java.base/share/classes/java/util/Enumeration.java
index 2cf2a2708ce..96aa3a90076 100644
--- a/jdk/src/java.base/share/classes/java/util/Enumeration.java
+++ b/jdk/src/java.base/share/classes/java/util/Enumeration.java
@@ -112,7 +112,7 @@ public interface Enumeration {
*
* @return an Iterator representing the remaining elements of this Enumeration
*
- * @since 1.9
+ * @since 9
*/
default Iterator asIterator() {
return new Iterator<>() {
diff --git a/jdk/src/java.base/share/classes/java/util/Locale.java b/jdk/src/java.base/share/classes/java/util/Locale.java
index 25697ca0c9d..2d121e2e7ef 100644
--- a/jdk/src/java.base/share/classes/java/util/Locale.java
+++ b/jdk/src/java.base/share/classes/java/util/Locale.java
@@ -3144,6 +3144,18 @@ public final class Locale implements Cloneable, Serializable {
&& range.equals(other.range)
&& weight == other.weight;
}
+
+ /**
+ * Returns an informative string representation of this {@code LanguageRange}
+ * object, consisting of language range and weight if the range is
+ * weighted and the weight is less than the max weight.
+ *
+ * @return a string representation of this {@code LanguageRange} object.
+ */
+ @Override
+ public String toString() {
+ return (weight == MAX_WEIGHT) ? range : range + ";q=" + weight;
+ }
}
/**
diff --git a/jdk/src/java.base/share/classes/java/util/Scanner.java b/jdk/src/java.base/share/classes/java/util/Scanner.java
index 1fb17bc65bf..b2f41aecb54 100644
--- a/jdk/src/java.base/share/classes/java/util/Scanner.java
+++ b/jdk/src/java.base/share/classes/java/util/Scanner.java
@@ -2684,7 +2684,7 @@ public final class Scanner implements Iterator, Closeable {
*
* @return a sequential stream of token strings
* @throws IllegalStateException if this scanner is closed
- * @since 1.9
+ * @since 9
*/
public Stream tokens() {
ensureOpen();
@@ -2770,7 +2770,7 @@ public final class Scanner implements Iterator, Closeable {
* @return a sequential stream of match results
* @throws NullPointerException if pattern is null
* @throws IllegalStateException if this scanner is closed
- * @since 1.9
+ * @since 9
*/
public Stream findAll(Pattern pattern) {
Objects.requireNonNull(pattern);
@@ -2792,7 +2792,7 @@ public final class Scanner implements Iterator, Closeable {
* @throws NullPointerException if patString is null
* @throws IllegalStateException if this scanner is closed
* @throws PatternSyntaxException if the regular expression's syntax is invalid
- * @since 1.9
+ * @since 9
* @see java.util.regex.Pattern
*/
public Stream findAll(String patString) {
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java
index 45389ac9109..dd24b82f2cc 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java
@@ -2429,7 +2429,7 @@ public class CompletableFuture implements Future, CompletionStage {
*
* @param the type of the value
* @return a new CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture newIncompleteFuture() {
return new CompletableFuture();
@@ -2444,7 +2444,7 @@ public class CompletableFuture implements Future, CompletionStage {
* an Executor that provides at least one independent thread.
*
* @return the executor
- * @since 1.9
+ * @since 9
*/
public Executor defaultExecutor() {
return ASYNC_POOL;
@@ -2462,7 +2462,7 @@ public class CompletableFuture implements Future, CompletionStage {
* arrange dependent actions.
*
* @return the new CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture copy() {
return uniCopyStage();
@@ -2479,7 +2479,7 @@ public class CompletableFuture implements Future, CompletionStage {
* cause.
*
* @return the new CompletionStage
- * @since 1.9
+ * @since 9
*/
public CompletionStage minimalCompletionStage() {
return uniAsMinimalStage();
@@ -2494,7 +2494,7 @@ public class CompletableFuture implements Future, CompletionStage {
* to complete this CompletableFuture
* @param executor the executor to use for asynchronous execution
* @return this CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture completeAsync(Supplier extends T> supplier,
Executor executor) {
@@ -2512,7 +2512,7 @@ public class CompletableFuture implements Future, CompletionStage {
* @param supplier a function returning the value to be used
* to complete this CompletableFuture
* @return this CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture completeAsync(Supplier extends T> supplier) {
return completeAsync(supplier, defaultExecutor());
@@ -2528,7 +2528,7 @@ public class CompletableFuture implements Future, CompletionStage {
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return this CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture orTimeout(long timeout, TimeUnit unit) {
if (unit == null)
@@ -2549,7 +2549,7 @@ public class CompletableFuture implements Future, CompletionStage {
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return this CompletableFuture
- * @since 1.9
+ * @since 9
*/
public CompletableFuture completeOnTimeout(T value, long timeout,
TimeUnit unit) {
@@ -2573,7 +2573,7 @@ public class CompletableFuture implements Future, CompletionStage {
* {@code delay} parameter
* @param executor the base executor
* @return the new delayed executor
- * @since 1.9
+ * @since 9
*/
public static Executor delayedExecutor(long delay, TimeUnit unit,
Executor executor) {
@@ -2592,7 +2592,7 @@ public class CompletableFuture implements Future, CompletionStage {
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code delay} parameter
* @return the new delayed executor
- * @since 1.9
+ * @since 9
*/
public static Executor delayedExecutor(long delay, TimeUnit unit) {
if (unit == null)
@@ -2608,7 +2608,7 @@ public class CompletableFuture implements Future, CompletionStage {
* @param value the value
* @param the type of the value
* @return the completed CompletionStage
- * @since 1.9
+ * @since 9
*/
public static CompletionStage completedStage(U value) {
return new MinimalStage((value == null) ? NIL : value);
@@ -2621,7 +2621,7 @@ public class CompletableFuture implements Future, CompletionStage {
* @param ex the exception
* @param the type of the value
* @return the exceptionally completed CompletableFuture
- * @since 1.9
+ * @since 9
*/
public static CompletableFuture failedFuture(Throwable ex) {
if (ex == null) throw new NullPointerException();
@@ -2636,7 +2636,7 @@ public class CompletableFuture implements Future, CompletionStage {
* @param ex the exception
* @param the type of the value
* @return the exceptionally completed CompletionStage
- * @since 1.9
+ * @since 9
*/
public static CompletionStage failedStage(Throwable ex) {
if (ex == null) throw new NullPointerException();
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java b/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java
index c1418ffc0d6..fe137386d45 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/Flow.java
@@ -161,7 +161,7 @@ package java.util.concurrent;
* }}
*
* @author Doug Lea
- * @since 1.9
+ * @since 9
*/
public final class Flow {
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java
index 2b714dff9b4..888794e8e40 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java
@@ -1301,7 +1301,7 @@ public abstract class ForkJoinTask implements Future, Serializable {
* support extensions, and is unlikely to be useful otherwise.
*
* @return a task, or {@code null} if none are available
- * @since 1.9
+ * @since 9
*/
protected static ForkJoinTask> pollSubmission() {
Thread t;
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java b/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java
index 286c31b86a3..d3c4518a3b6 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java
@@ -154,7 +154,7 @@ import java.util.function.Consumer;
*
* @param the published item type
* @author Doug Lea
- * @since 1.9
+ * @since 9
*/
public class SubmissionPublisher implements Flow.Publisher,
AutoCloseable {
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java b/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
index 5a79376d340..a90e4fdd629 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
@@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.concurrent.TimeUnit;
+import jdk.internal.vm.annotation.ReservedStackAccess;
/**
* Provides a framework for implementing blocking locks and related
@@ -886,6 +887,7 @@ public abstract class AbstractQueuedSynchronizer
* @param arg the acquire argument
* @return {@code true} if interrupted while waiting
*/
+ @ReservedStackAccess
final boolean acquireQueued(final Node node, int arg) {
try {
boolean interrupted = false;
@@ -1218,6 +1220,7 @@ public abstract class AbstractQueuedSynchronizer
* {@link #tryAcquire} but is otherwise uninterpreted and
* can represent anything you like.
*/
+ @ReservedStackAccess
public final void acquire(int arg) {
if (!tryAcquire(arg) &&
acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
@@ -1281,6 +1284,7 @@ public abstract class AbstractQueuedSynchronizer
* can represent anything you like.
* @return the value returned from {@link #tryRelease}
*/
+ @ReservedStackAccess
public final boolean release(int arg) {
if (tryRelease(arg)) {
Node h = head;
@@ -1361,6 +1365,7 @@ public abstract class AbstractQueuedSynchronizer
* and can represent anything you like.
* @return the value returned from {@link #tryReleaseShared}
*/
+ @ReservedStackAccess
public final boolean releaseShared(int arg) {
if (tryReleaseShared(arg)) {
doReleaseShared();
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java b/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java
index 9df25057041..c39c94724e7 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java
@@ -37,6 +37,7 @@ package java.util.concurrent.locks;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
+import jdk.internal.vm.annotation.ReservedStackAccess;
/**
* A reentrant mutual exclusion {@link Lock} with the same basic
@@ -127,6 +128,7 @@ public class ReentrantLock implements Lock, java.io.Serializable {
* Performs non-fair tryLock. tryAcquire is implemented in
* subclasses, but both need nonfair try for trylock method.
*/
+ @ReservedStackAccess
final boolean nonfairTryAcquire(int acquires) {
final Thread current = Thread.currentThread();
int c = getState();
@@ -146,6 +148,7 @@ public class ReentrantLock implements Lock, java.io.Serializable {
return false;
}
+ @ReservedStackAccess
protected final boolean tryRelease(int releases) {
int c = getState() - releases;
if (Thread.currentThread() != getExclusiveOwnerThread())
@@ -203,6 +206,7 @@ public class ReentrantLock implements Lock, java.io.Serializable {
* Performs lock. Try immediate barge, backing up to normal
* acquire on failure.
*/
+ @ReservedStackAccess
final void lock() {
if (compareAndSetState(0, 1))
setExclusiveOwnerThread(Thread.currentThread());
@@ -229,6 +233,7 @@ public class ReentrantLock implements Lock, java.io.Serializable {
* Fair version of tryAcquire. Don't grant access unless
* recursive call or no waiters or is first.
*/
+ @ReservedStackAccess
protected final boolean tryAcquire(int acquires) {
final Thread current = Thread.currentThread();
int c = getState();
diff --git a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
index f8231e83e53..7f030af704a 100644
--- a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
+++ b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java
@@ -974,7 +974,7 @@ public final class Matcher implements MatchResult {
* @throws IndexOutOfBoundsException
* If the replacement string refers to a capturing group
* that does not exist in the pattern
- * @since 1.9
+ * @since 9
*/
public Matcher appendReplacement(StringBuilder sb, String replacement) {
// If no match, return error
@@ -1117,7 +1117,7 @@ public final class Matcher implements MatchResult {
*
* @return The target string builder
*
- * @since 1.9
+ * @since 9
*/
public StringBuilder appendTail(StringBuilder sb) {
sb.append(text, lastAppendPosition, getTextLength());
@@ -1229,7 +1229,7 @@ public final class Matcher implements MatchResult {
* @throws ConcurrentModificationException if it is detected, on a
* best-effort basis, that the replacer function modified this
* matcher's state
- * @since 1.9
+ * @since 9
*/
public String replaceAll(Function replacer) {
Objects.requireNonNull(replacer);
@@ -1273,7 +1273,7 @@ public final class Matcher implements MatchResult {
* modification is detected.
*
* @return a sequential stream of match results.
- * @since 1.9
+ * @since 9
*/
public Stream results() {
class MatchResultIterator implements Iterator {
@@ -1451,7 +1451,7 @@ public final class Matcher implements MatchResult {
* @throws ConcurrentModificationException if it is detected, on a
* best-effort basis, that the replacer function modified this
* matcher's state
- * @since 1.9
+ * @since 9
*/
public String replaceFirst(Function replacer) {
Objects.requireNonNull(replacer);
diff --git a/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java
index 79ad66e5b87..574e4f17fc7 100644
--- a/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java
+++ b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java
@@ -329,7 +329,7 @@ public interface DoubleStream extends BaseStream {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default DoubleStream takeWhile(DoublePredicate predicate) {
Objects.requireNonNull(predicate);
@@ -396,7 +396,7 @@ public interface DoubleStream extends BaseStream {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default DoubleStream dropWhile(DoublePredicate predicate) {
Objects.requireNonNull(predicate);
diff --git a/jdk/src/java.base/share/classes/java/util/stream/IntStream.java b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java
index 2da8629e901..91ddad2b2a8 100644
--- a/jdk/src/java.base/share/classes/java/util/stream/IntStream.java
+++ b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java
@@ -326,7 +326,7 @@ public interface IntStream extends BaseStream {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default IntStream takeWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
@@ -392,7 +392,7 @@ public interface IntStream extends BaseStream {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default IntStream dropWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
diff --git a/jdk/src/java.base/share/classes/java/util/stream/LongStream.java b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java
index 7468a2715b2..c1a89eb4b76 100644
--- a/jdk/src/java.base/share/classes/java/util/stream/LongStream.java
+++ b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java
@@ -327,7 +327,7 @@ public interface LongStream extends BaseStream {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default LongStream takeWhile(LongPredicate predicate) {
Objects.requireNonNull(predicate);
@@ -394,7 +394,7 @@ public interface LongStream extends BaseStream {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default LongStream dropWhile(LongPredicate predicate) {
Objects.requireNonNull(predicate);
diff --git a/jdk/src/java.base/share/classes/java/util/stream/Stream.java b/jdk/src/java.base/share/classes/java/util/stream/Stream.java
index 0ca9e3d2ef2..aef2581d0eb 100644
--- a/jdk/src/java.base/share/classes/java/util/stream/Stream.java
+++ b/jdk/src/java.base/share/classes/java/util/stream/Stream.java
@@ -533,7 +533,7 @@ public interface Stream extends BaseStream> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default Stream takeWhile(Predicate super T> predicate) {
Objects.requireNonNull(predicate);
@@ -599,7 +599,7 @@ public interface Stream extends BaseStream> {
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
- * @since 1.9
+ * @since 9
*/
default Stream dropWhile(Predicate super T> predicate) {
Objects.requireNonNull(predicate);
@@ -1146,7 +1146,7 @@ public interface Stream extends BaseStream> {
* @param the type of stream elements
* @return a stream with a single element if the specified element
* is non-null, otherwise an empty stream
- * @since 1.9
+ * @since 9
*/
public static Stream ofNullable(T t) {
return t == null ? Stream.empty()
diff --git a/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java b/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java
index cabe6883528..1288333df01 100644
--- a/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java
+++ b/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java
@@ -43,7 +43,7 @@ import java.util.function.Predicate;
* Factory for instances of a takeWhile and dropWhile operations
* that produce subsequences of their input stream.
*
- * @since 1.9
+ * @since 9
*/
final class WhileOps {
diff --git a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
index 2d82625780e..3b414954417 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
@@ -44,7 +44,7 @@ import sun.nio.ch.DirectBuffer;
* {@link NullPointerException} to be thrown.
*
*
- * @since 1.9
+ * @since 9
*/
public final class CRC32C implements Checksum {
diff --git a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java
index 121b687df0b..eb681861785 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java
@@ -51,7 +51,7 @@ public interface Checksum {
* @throws NullPointerException
* if {@code b} is {@code null}
*
- * @since 1.9
+ * @since 9
*/
default public void update(byte[] b) {
update(b, 0, b.length);
@@ -99,7 +99,7 @@ public interface Checksum {
* @throws NullPointerException
* if {@code buffer} is {@code null}
*
- * @since 1.9
+ * @since 9
*/
default public void update(ByteBuffer buffer) {
int pos = buffer.position();
diff --git a/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java
index c380058356b..ee91cee3ed8 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipEntry.java
@@ -220,7 +220,7 @@ class ZipEntry implements ZipConstants, Cloneable {
* The last modification time of the entry in local date-time
*
* @see #getTimeLocal()
- * @since 1.9
+ * @since 9
*/
public void setTimeLocal(LocalDateTime time) {
int year = time.getYear() - 1980;
@@ -259,7 +259,7 @@ class ZipEntry implements ZipConstants, Cloneable {
* @return The last modification time of the entry in local date-time
*
* @see #setTimeLocal(LocalDateTime)
- * @since 1.9
+ * @since 9
*/
public LocalDateTime getTimeLocal() {
if (mtime != null) {
diff --git a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java
index 31ff8eaf329..1cba038d6e5 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java
@@ -54,6 +54,7 @@ import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import jdk.internal.misc.JavaUtilZipFileAccess;
import jdk.internal.misc.SharedSecrets;
+import jdk.internal.perf.PerfCounter;
import static java.util.zip.ZipConstants.*;
import static java.util.zip.ZipConstants64.*;
@@ -210,8 +211,8 @@ class ZipFile implements ZipConstants, Closeable {
this.name = name;
long t0 = System.nanoTime();
this.zsrc = Source.get(file, (mode & OPEN_DELETE) != 0);
- sun.misc.PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
- sun.misc.PerfCounter.getZipFileCount().increment();
+ PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
+ PerfCounter.getZipFileCount().increment();
}
/**
diff --git a/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java b/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java
index 95ea0b44b87..8f3661fbfa3 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/HotSpotIntrinsicCandidate.java
@@ -117,7 +117,7 @@ import java.lang.annotation.*;
* and that (2) for all methods of that class annotated with
* {@code @HotSpotIntrinsicCandidate} there is an intrinsic in the list.
*
- * @since 1.9
+ * @since 9
*/
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.RUNTIME)
diff --git a/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java b/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java
index 28c622d4cde..46b571aa137 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/logger/package-info.java
@@ -63,6 +63,6 @@
* @see sun.util.logging.PlatformLogger.Bridge
* @see sun.util.logging.internal
*
- * @since 1.9
+ * @since 9
*/
package jdk.internal.logger;
diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
index 9176784def0..f130d383a84 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
@@ -1081,7 +1081,7 @@ public final class Unsafe {
* @return the value fetched from the indicated object
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
- * @since 1.9
+ * @since 9
*/
@HotSpotIntrinsicCandidate
public final long getLongUnaligned(Object o, long offset) {
@@ -1115,7 +1115,7 @@ public final class Unsafe {
* @param offset The offset in bytes from the start of the object
* @param bigEndian The endianness of the value
* @return the value fetched from the indicated object
- * @since 1.9
+ * @since 9
*/
public final long getLongUnaligned(Object o, long offset, boolean bigEndian) {
return convEndian(bigEndian, getLongUnaligned(o, offset));
@@ -1193,7 +1193,7 @@ public final class Unsafe {
* @param x the value to store
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
- * @since 1.9
+ * @since 9
*/
@HotSpotIntrinsicCandidate
public final void putLongUnaligned(Object o, long offset, long x) {
@@ -1231,7 +1231,7 @@ public final class Unsafe {
* @param bigEndian The endianness of the value
* @throws RuntimeException No defined exceptions are thrown, not even
* {@link NullPointerException}
- * @since 1.9
+ * @since 9
*/
public final void putLongUnaligned(Object o, long offset, long x, boolean bigEndian) {
putLongUnaligned(o, offset, convEndian(bigEndian, x));
diff --git a/jdk/src/java.base/share/classes/sun/misc/Perf.java b/jdk/src/java.base/share/classes/jdk/internal/perf/Perf.java
similarity index 94%
rename from jdk/src/java.base/share/classes/sun/misc/Perf.java
rename to jdk/src/java.base/share/classes/jdk/internal/perf/Perf.java
index 311e92c8f64..e660cdf3ebe 100644
--- a/jdk/src/java.base/share/classes/sun/misc/Perf.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/perf/Perf.java
@@ -22,13 +22,14 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package sun.misc;
+package jdk.internal.perf;
import java.nio.ByteBuffer;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import jdk.internal.ref.CleanerFactory;
/**
* The Perf class provides the ability to attach to an instrumentation
@@ -46,7 +47,7 @@ import java.io.UnsupportedEncodingException;
* @author Brian Doherty
* @since 1.4.2
* @see #getPerf
- * @see sun.misc.Perf$GetPerfAction
+ * @see jdk.internal.perf.Perf.GetPerfAction
* @see java.nio.ByteBuffer
*/
public final class Perf {
@@ -123,10 +124,10 @@ public final class Perf {
* Please note that the "sun.misc.Perf.getPerf" permission
* is not a JDK specified permission.
*
- * @return A reference to the singleton Perf instance.
- * @throws AccessControlException if a security manager exists and
- * its checkPermission method doesn't allow
- * access to the "sun.misc.Perf.getPerf" target.
+ * @return A reference to the singleton Perf instance.
+ * @throws SecurityException if a security manager exists and its
+ * checkPermission method doesn't allow access
+ * to the "jdk.internal.perf.Perf.getPerf"" target.
* @see java.lang.RuntimePermission
* @see #attach
*/
@@ -134,7 +135,7 @@ public final class Perf {
{
SecurityManager security = System.getSecurityManager();
if (security != null) {
- Permission perm = new RuntimePermission("sun.misc.Perf.getPerf");
+ Permission perm = new RuntimePermission("jdk.internal.perf.Perf.getPerf");
security.checkPermission(perm);
}
@@ -277,27 +278,35 @@ public final class Perf {
// This is an instrumentation buffer for another Java virtual
// machine with native resources that need to be managed. We
// create a duplicate of the native ByteBuffer and manage it
- // with a Cleaner object (PhantomReference). When the duplicate
- // becomes only phantomly reachable, the native resources will
- // be released.
+ // with a Cleaner. When the duplicate becomes phantom reachable,
+ // the native resources will be released.
final ByteBuffer dup = b.duplicate();
- Cleaner.create(dup, new Runnable() {
- public void run() {
- try {
- instance.detach(b);
- }
- catch (Throwable th) {
- // avoid crashing the reference handler thread,
- // but provide for some diagnosability
- assert false : th.toString();
- }
- }
- });
+
+ CleanerFactory.cleaner()
+ .register(dup, new CleanerAction(instance, b));
return dup;
}
}
+ private static class CleanerAction implements Runnable {
+ private final ByteBuffer bb;
+ private final Perf perf;
+ CleanerAction(Perf perf, ByteBuffer bb) {
+ this.perf = perf;
+ this.bb = bb;
+ }
+ public void run() {
+ try {
+ perf.detach(bb);
+ } catch (Throwable th) {
+ // avoid crashing the reference handler thread,
+ // but provide for some diagnosability
+ assert false : th.toString();
+ }
+ }
+ }
+
/**
* Native method to perform the implementation specific attach mechanism.
*
@@ -341,7 +350,7 @@ public final class Perf {
* machine running this method (lvmid=0, for example), then the detach
* request is silently ignored.
*
- * @param ByteBuffer A direct allocated byte buffer created by the
+ * @param bb A direct allocated byte buffer created by the
* attach method.
* @see java.nio.ByteBuffer
* @see #attach
diff --git a/jdk/src/java.base/share/classes/sun/misc/PerfCounter.java b/jdk/src/java.base/share/classes/jdk/internal/perf/PerfCounter.java
similarity index 99%
rename from jdk/src/java.base/share/classes/sun/misc/PerfCounter.java
rename to jdk/src/java.base/share/classes/jdk/internal/perf/PerfCounter.java
index aa054707937..1c0d0a1f341 100644
--- a/jdk/src/java.base/share/classes/sun/misc/PerfCounter.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/perf/PerfCounter.java
@@ -23,7 +23,7 @@
* questions.
*/
-package sun.misc;
+package jdk.internal.perf;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
diff --git a/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java b/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java
index 7e177b1e4f4..bbcf99483c1 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java
@@ -26,6 +26,7 @@
package jdk.internal.ref;
import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
import java.lang.ref.PhantomReference;
import java.util.Objects;
@@ -66,9 +67,9 @@ public abstract class PhantomCleanable extends PhantomReference
this.list = CleanerImpl.getCleanerImpl(cleaner).phantomCleanableList;
insert();
- // TODO: Replace getClass() with ReachabilityFence when it is available
- cleaner.getClass();
- referent.getClass();
+ // Ensure referent and cleaner remain accessible
+ Reference.reachabilityFence(referent);
+ Reference.reachabilityFence(cleaner);
}
/**
diff --git a/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java b/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java
index 45ddf85863b..5463720d561 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/SoftCleanable.java
@@ -26,6 +26,7 @@
package jdk.internal.ref;
import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.util.Objects;
@@ -66,9 +67,9 @@ public abstract class SoftCleanable extends SoftReference
list = CleanerImpl.getCleanerImpl(cleaner).softCleanableList;
insert();
- // TODO: Replace getClass() with ReachabilityFence when it is available
- cleaner.getClass();
- referent.getClass();
+ // Ensure referent and cleaner remain accessible
+ Reference.reachabilityFence(referent);
+ Reference.reachabilityFence(cleaner);
}
/**
diff --git a/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java b/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java
index 40dd22af25c..90c62cf3ce3 100644
--- a/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/ref/WeakCleanable.java
@@ -26,6 +26,7 @@ package jdk.internal.ref;
*/
import java.lang.ref.Cleaner;
+import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
import java.util.Objects;
@@ -66,9 +67,10 @@ public abstract class WeakCleanable extends WeakReference
list = CleanerImpl.getCleanerImpl(cleaner).weakCleanableList;
insert();
- // TODO: Replace getClass() with ReachabilityFence when it is available
- cleaner.getClass();
- referent.getClass();
+ // Ensure referent and cleaner remain accessible
+ Reference.reachabilityFence(referent);
+ Reference.reachabilityFence(cleaner);
+
}
/**
diff --git a/jdk/src/java.base/share/classes/sun/misc/JarFilter.java b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/DontInline.java
similarity index 51%
rename from jdk/src/java.base/share/classes/sun/misc/JarFilter.java
rename to jdk/src/java.base/share/classes/jdk/internal/vm/annotation/DontInline.java
index 9036ecaed87..d39dccffbad 100644
--- a/jdk/src/java.base/share/classes/sun/misc/JarFilter.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/DontInline.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,23 +23,28 @@
* questions.
*/
-package sun.misc;
+package jdk.internal.vm.annotation;
-import java.io.File;
-import java.io.FilenameFilter;
+import java.lang.annotation.*;
/**
- * This class checks that only jar and zip files are included in the file list.
- * This class is used in extension installation support (ExtensionDependency).
+ * A method or constructor may be annotated as "don't inline" if the inlining of
+ * this method should not be performed by the HotSpot VM.
+ *
+ * This annotation must be used sparingly. It is useful when the only
+ * reasonable alternative is to bind the name of a specific method or
+ * constructor into the HotSpot VM for special handling by the inlining policy.
+ * This annotation must not be relied on as an alternative to avoid tuning the
+ * VM's inlining policy. In a few cases, it may act as a temporary workaround
+ * until the profiling and inlining performed by the HotSpot VM is sufficiently
+ * improved.
*
- * @deprecated this class will be removed in a future release.
- * @author Michael Colburn
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader. Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
*/
-@Deprecated
-public class JarFilter implements FilenameFilter {
-
- public boolean accept(File dir, String name) {
- String lower = name.toLowerCase();
- return lower.endsWith(".jar") || lower.endsWith(".zip");
- }
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DontInline {
}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ForceInline.java b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ForceInline.java
new file mode 100644
index 00000000000..e8253db04a1
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ForceInline.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A method or constructor may be annotated as "force inline" if the standard
+ * inlining metrics are to be ignored when the HotSpot VM inlines the method
+ * or constructor.
+ *
+ * This annotation must be used sparingly. It is useful when the only
+ * reasonable alternative is to bind the name of a specific method or
+ * constructor into the HotSpot VM for special handling by the inlining policy.
+ * This annotation must not be relied on as an alternative to avoid tuning the
+ * VM's inlining policy. In a few cases, it may act as a temporary workaround
+ * until the profiling and inlining performed by the HotSpot VM is sufficiently
+ * improved.
+ *
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader. Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ForceInline {
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ReservedStackAccess.java b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ReservedStackAccess.java
new file mode 100644
index 00000000000..72ddc4c30f6
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/ReservedStackAccess.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.vm.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
An annotation expressing that a method is especially sensitive
+ * to stack overflows. This is a hint the JVM can use to grant access to
+ * extra stack space when executing this code if such feature is supported
+ * by the JVM. The JVM is free to ignore this annotation.
+ *
+ * A possible way for the JVM to improve the execution context for methods
+ * with this annotation is to reserve part of the thread's execution stack
+ * for them. Access to this section of the stack would be denied by default
+ * but could be granted if the JVM detects a possible stack overflow and
+ * the thread's call stack includes at least one annotated method. Even if
+ * access to this reserved area has been granted, the JVM might decide to
+ * throw a delayed StackOverflowError when the thread exits the annotated
+ * method.
+ *
+ * @since 1.9
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+public @interface ReservedStackAccess { }
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/Stable.java b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java
similarity index 65%
rename from jdk/src/java.base/share/classes/java/lang/invoke/Stable.java
rename to jdk/src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java
index a0a413e2a79..2ba6e992adf 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/Stable.java
+++ b/jdk/src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java
@@ -23,7 +23,7 @@
* questions.
*/
-package java.lang.invoke;
+package jdk.internal.vm.annotation;
import java.lang.annotation.*;
@@ -57,17 +57,34 @@ import java.lang.annotation.*;
*
* Fields which are declared {@code final} may also be annotated as stable.
* Since final fields already behave as stable values, such an annotation
- * indicates no additional information, unless the type of the field is
- * an array type.
+ * conveys no additional information regarding change of the field's value, but
+ * still conveys information regarding change of additional components values if
+ * the type of the field is an array type (as described above).
+ *
+ * The HotSpot VM relies on this annotation to promote a non-null (resp.,
+ * non-zero) component value to a constant, thereby enabling superior
+ * optimizations of code depending on such a value (such as constant folding).
+ * More specifically, the HotSpot VM will process non-null stable fields (final
+ * or otherwise) in a similar manner to static final fields with respect to
+ * promoting the field's value to a constant. Thus, placing aside the
+ * differences for null/non-null values and arrays, a final stable field is
+ * treated as if it is really final from both the Java language and the HotSpot
+ * VM.
*
* It is (currently) undefined what happens if a field annotated as stable
- * is given a third value. In practice, if the JVM relies on this annotation
- * to promote a field reference to a constant, it may be that the Java memory
- * model would appear to be broken, if such a constant (the second value of the field)
- * is used as the value of the field even after the field value has changed.
+ * is given a third value (by explicitly updating a stable field, a component of
+ * a stable array, or a final stable field via reflection or other means).
+ * Since the HotSpot VM promotes a non-null component value to constant, it may
+ * be that the Java memory model would appear to be broken, if such a constant
+ * (the second value of the field) is used as the value of the field even after
+ * the field value has changed (to a third value).
+ *
+ * @implNote
+ * This annotation only takes effect for fields of classes loaded by the boot
+ * loader. Annoations on fields of classes loaded outside of the boot loader
+ * are ignored.
*/
-/* package-private */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
-@interface Stable {
+public @interface Stable {
}
diff --git a/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java b/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java
deleted file mode 100644
index 6c5cb3f5563..00000000000
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Anonymous class loader. Will load any valid classfile, producing
- * a {@link Class} metaobject, without installing that class in the
- * system dictionary. Therefore, {@link Class#forName(String)} will never
- * produce a reference to an anonymous class.
- *
- * The access permissions of the anonymous class are borrowed from
- * a host class. The new class behaves as if it were an
- * inner class of the host class. It can access the host's private
- * members, if the creator of the class loader has permission to
- * do so (or to create accessible reflective objects).
- *
- * When the anonymous class is loaded, elements of its constant pool
- * can be patched to new values. This provides a hook to pre-resolve
- * named classes in the constant pool to other classes, including
- * anonymous ones. Also, string constants can be pre-resolved to
- * any reference. (The verifier treats non-string, non-class reference
- * constants as plain objects.)
- *
- * Why include the patching function? It makes some use cases much easier.
- * Second, the constant pool needed some internal patching anyway,
- * to anonymize the loaded class itself. Finally, if you are going
- * to use this seriously, you'll want to build anonymous classes
- * on top of pre-existing anonymous classes, and that requires patching.
- *
- *
%%% TO-DO:
- *
- *
needs better documentation
- *
needs more security work (for safe delegation)
- *
needs a clearer story about error processing
- *
patch member references also (use ';' as delimiter char)
- *
patch method references to (conforming) method handles
- *
- *
- * @author jrose
- * @author Remi Forax
- * @see
- * http://blogs.sun.com/jrose/entry/anonymous_classes_in_the_vm
- */
-
-public class AnonymousClassLoader {
- final Class> hostClass;
-
- // Privileged constructor.
- private AnonymousClassLoader(Class> hostClass) {
- this.hostClass = hostClass;
- }
-
- public static AnonymousClassLoader make(jdk.internal.misc.Unsafe unsafe, Class> hostClass) {
- if (unsafe == null) throw new NullPointerException();
- return new AnonymousClassLoader(hostClass);
- }
-
- public Class> loadClass(byte[] classFile) {
- if (defineAnonymousClass == null) {
- // no JVM support; try to fake an approximation
- try {
- return fakeLoadClass(new ConstantPoolParser(classFile).createPatch());
- } catch (InvalidConstantPoolFormatException ee) {
- throw new IllegalArgumentException(ee);
- }
- }
- return loadClass(classFile, null);
- }
-
- public Class> loadClass(ConstantPoolPatch classPatch) {
- if (defineAnonymousClass == null) {
- // no JVM support; try to fake an approximation
- return fakeLoadClass(classPatch);
- }
- Object[] patches = classPatch.patchArray;
- // Convert class names (this late in the game)
- // to use slash '/' instead of dot '.'.
- // Java likes dots, but the JVM likes slashes.
- for (int i = 0; i < patches.length; i++) {
- Object value = patches[i];
- if (value != null) {
- byte tag = classPatch.getTag(i);
- switch (tag) {
- case ConstantPoolVisitor.CONSTANT_Class:
- if (value instanceof String) {
- if (patches == classPatch.patchArray)
- patches = patches.clone();
- patches[i] = ((String)value).replace('.', '/');
- }
- break;
- case ConstantPoolVisitor.CONSTANT_Fieldref:
- case ConstantPoolVisitor.CONSTANT_Methodref:
- case ConstantPoolVisitor.CONSTANT_InterfaceMethodref:
- case ConstantPoolVisitor.CONSTANT_NameAndType:
- // When/if the JVM supports these patches,
- // we'll probably need to reformat them also.
- // Meanwhile, let the class loader create the error.
- break;
- }
- }
- }
- return loadClass(classPatch.outer.classFile, classPatch.patchArray);
- }
-
- private Class> loadClass(byte[] classFile, Object[] patchArray) {
- try {
- return (Class>)
- defineAnonymousClass.invoke(unsafe,
- hostClass, classFile, patchArray);
- } catch (Exception ex) {
- throwReflectedException(ex);
- throw new RuntimeException("error loading into "+hostClass, ex);
- }
- }
-
- private static void throwReflectedException(Exception ex) {
- if (ex instanceof InvocationTargetException) {
- Throwable tex = ((InvocationTargetException)ex).getTargetException();
- if (tex instanceof Error)
- throw (Error) tex;
- ex = (Exception) tex;
- }
- if (ex instanceof RuntimeException) {
- throw (RuntimeException) ex;
- }
- }
-
- private Class> fakeLoadClass(ConstantPoolPatch classPatch) {
- // Implementation:
- // 1. Make up a new name nobody has used yet.
- // 2. Inspect the tail-header of the class to find the this_class index.
- // 3. Patch the CONSTANT_Class for this_class to the new name.
- // 4. Add other CP entries required by (e.g.) string patches.
- // 5. Flatten Class constants down to their names, making sure that
- // the host class loader can pick them up again accurately.
- // 6. Generate the edited class file bytes.
- //
- // Potential limitations:
- // * The class won't be truly anonymous, and may interfere with others.
- // * Flattened class constants might not work, because of loader issues.
- // * Pseudo-string constants will not flatten down to real strings.
- // * Method handles will (of course) fail to flatten to linkage strings.
- if (true) throw new UnsupportedOperationException("NYI");
- Object[] cpArray;
- try {
- cpArray = classPatch.getOriginalCP();
- } catch (InvalidConstantPoolFormatException ex) {
- throw new RuntimeException(ex);
- }
- int thisClassIndex = classPatch.getParser().getThisClassIndex();
- String thisClassName = (String) cpArray[thisClassIndex];
- synchronized (AnonymousClassLoader.class) {
- thisClassName = thisClassName+"\\|"+(++fakeNameCounter);
- }
- classPatch.putUTF8(thisClassIndex, thisClassName);
- byte[] classFile = null;
- return unsafe.defineClass(null, classFile, 0, classFile.length,
- hostClass.getClassLoader(),
- hostClass.getProtectionDomain());
- }
- private static int fakeNameCounter = 99999;
-
- // ignore two warnings on this line:
- private static jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
- // preceding line requires that this class be on the boot class path
-
- private static final Method defineAnonymousClass;
- static {
- Method dac = null;
- Class extends jdk.internal.misc.Unsafe> unsafeClass = unsafe.getClass();
- try {
- dac = unsafeClass.getMethod("defineAnonymousClass",
- Class.class,
- byte[].class,
- Object[].class);
- } catch (Exception ee) {
- dac = null;
- }
- defineAnonymousClass = dac;
- }
-
- private static void noJVMSupport() {
- throw new UnsupportedOperationException("no JVM support for anonymous classes");
- }
-
-
- private static native Class> loadClassInternal(Class> hostClass,
- byte[] classFile,
- Object[] patchArray);
-
- public static byte[] readClassFile(Class> templateClass) throws IOException {
- String templateName = templateClass.getName();
- int lastDot = templateName.lastIndexOf('.');
- java.net.URL url = templateClass.getResource(templateName.substring(lastDot+1)+".class");
- java.net.URLConnection connection = url.openConnection();
- int contentLength = connection.getContentLength();
- if (contentLength < 0)
- throw new IOException("invalid content length "+contentLength);
-
- byte[] b = connection.getInputStream().readAllBytes();
- if (b.length != contentLength)
- throw new EOFException("Expected:" + contentLength + ", read:" + b.length);
-
- return b;
- }
-}
diff --git a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolParser.java b/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolParser.java
deleted file mode 100644
index 441ba957336..00000000000
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolParser.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-
-import static sun.invoke.anon.ConstantPoolVisitor.*;
-
-/** A constant pool parser.
- */
-public class ConstantPoolParser {
- final byte[] classFile;
- final byte[] tags;
- final char[] firstHeader; // maghi, maglo, minor, major, cplen
-
- // these are filled in on first parse:
- int endOffset;
- char[] secondHeader; // flags, this_class, super_class, intlen
-
- // used to decode UTF8 array
- private char[] charArray = new char[80];
-
- /** Creates a constant pool parser.
- * @param classFile an array of bytes containing a class.
- * @throws InvalidConstantPoolFormatException if the header of the class has errors.
- */
- public ConstantPoolParser(byte[] classFile) throws InvalidConstantPoolFormatException {
- this.classFile = classFile;
- this.firstHeader = parseHeader(classFile);
- this.tags = new byte[firstHeader[4]];
- }
-
- /** Create a constant pool parser by loading the bytecodes of the
- * class taken as argument.
- *
- * @param templateClass the class to parse.
- *
- * @throws IOException raised if an I/O occurs when loading
- * the bytecode of the template class.
- * @throws InvalidConstantPoolFormatException if the header of the class has errors.
- *
- * @see #ConstantPoolParser(byte[])
- * @see AnonymousClassLoader#readClassFile(Class)
- */
- public ConstantPoolParser(Class> templateClass) throws IOException, InvalidConstantPoolFormatException {
- this(AnonymousClassLoader.readClassFile(templateClass));
- }
-
- /** Creates an empty patch to patch the class file
- * used by the current parser.
- * @return a new class patch.
- */
- public ConstantPoolPatch createPatch() {
- return new ConstantPoolPatch(this);
- }
-
- /** Report the tag of the indicated CP entry.
- * @param index
- * @return one of {@link ConstantPoolVisitor#CONSTANT_Utf8}, etc.
- */
- public byte getTag(int index) {
- getEndOffset(); // trigger an exception if we haven't parsed yet
- return tags[index];
- }
-
- /** Report the length of the constant pool. */
- public int getLength() {
- return firstHeader[4];
- }
-
- /** Report the offset, within the class file, of the start of the constant pool. */
- public int getStartOffset() {
- return firstHeader.length * 2;
- }
-
- /** Report the offset, within the class file, of the end of the constant pool. */
- public int getEndOffset() {
- if (endOffset == 0)
- throw new IllegalStateException("class file has not yet been parsed");
- return endOffset;
- }
-
- /** Report the CP index of this class's own name. */
- public int getThisClassIndex() {
- getEndOffset(); // provoke exception if not yet parsed
- return secondHeader[1];
- }
-
- /** Report the total size of the class file. */
- public int getTailLength() {
- return classFile.length - getEndOffset();
- }
-
- /** Write the head (header plus constant pool)
- * of the class file to the indicated stream.
- */
- public void writeHead(OutputStream out) throws IOException {
- out.write(classFile, 0, getEndOffset());
- }
-
- /** Write the head (header plus constant pool)
- * of the class file to the indicated stream,
- * incorporating the non-null entries of the given array
- * as patches.
- */
- void writePatchedHead(OutputStream out, Object[] patchArray) {
- // this will be useful to partially emulate the class loader on old JVMs
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- /** Write the tail (everything after the constant pool)
- * of the class file to the indicated stream.
- */
- public void writeTail(OutputStream out) throws IOException {
- out.write(classFile, getEndOffset(), getTailLength());
- }
-
- private static char[] parseHeader(byte[] classFile) throws InvalidConstantPoolFormatException {
- char[] result = new char[5];
- ByteBuffer buffer = ByteBuffer.wrap(classFile);
- for (int i = 0; i < result.length; i++)
- result[i] = (char) getUnsignedShort(buffer);
- int magic = result[0] << 16 | result[1] << 0;
- if (magic != 0xCAFEBABE)
- throw new InvalidConstantPoolFormatException("invalid magic number "+magic);
- // skip major, minor version
- int len = result[4];
- if (len < 1)
- throw new InvalidConstantPoolFormatException("constant pool length < 1");
- return result;
- }
-
- /** Parse the constant pool of the class
- * calling a method visit* each time a constant pool entry is parsed.
- *
- * The order of the calls to visit* is not guaranteed to be the same
- * than the order of the constant pool entry in the bytecode array.
- *
- * @param visitor
- * @throws InvalidConstantPoolFormatException
- */
- public void parse(ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
- ByteBuffer buffer = ByteBuffer.wrap(classFile);
- buffer.position(getStartOffset()); //skip header
-
- Object[] values = new Object[getLength()];
- try {
- parseConstantPool(buffer, values, visitor);
- } catch(BufferUnderflowException e) {
- throw new InvalidConstantPoolFormatException(e);
- }
- if (endOffset == 0) {
- endOffset = buffer.position();
- secondHeader = new char[4];
- for (int i = 0; i < secondHeader.length; i++) {
- secondHeader[i] = (char) getUnsignedShort(buffer);
- }
- }
- resolveConstantPool(values, visitor);
- }
-
- private char[] getCharArray(int utfLength) {
- if (utfLength <= charArray.length)
- return charArray;
- return charArray = new char[utfLength];
- }
-
- private void parseConstantPool(ByteBuffer buffer, Object[] values, ConstantPoolVisitor visitor) throws InvalidConstantPoolFormatException {
- for (int i = 1; i < tags.length; ) {
- byte tag = (byte) getUnsignedByte(buffer);
- assert(tags[i] == 0 || tags[i] == tag);
- tags[i] = tag;
- switch (tag) {
- case CONSTANT_Utf8:
- int utfLen = getUnsignedShort(buffer);
- String value = getUTF8(buffer, utfLen, getCharArray(utfLen));
- visitor.visitUTF8(i, CONSTANT_Utf8, value);
- tags[i] = tag;
- values[i++] = value;
- break;
- case CONSTANT_Integer:
- visitor.visitConstantValue(i, tag, buffer.getInt());
- i++;
- break;
- case CONSTANT_Float:
- visitor.visitConstantValue(i, tag, buffer.getFloat());
- i++;
- break;
- case CONSTANT_Long:
- visitor.visitConstantValue(i, tag, buffer.getLong());
- i+=2;
- break;
- case CONSTANT_Double:
- visitor.visitConstantValue(i, tag, buffer.getDouble());
- i+=2;
- break;
-
- case CONSTANT_Class: // fall through:
- case CONSTANT_String:
- tags[i] = tag;
- values[i++] = new int[] { getUnsignedShort(buffer) };
- break;
-
- case CONSTANT_Fieldref: // fall through:
- case CONSTANT_Methodref: // fall through:
- case CONSTANT_InterfaceMethodref: // fall through:
- case CONSTANT_NameAndType:
- tags[i] = tag;
- values[i++] = new int[] { getUnsignedShort(buffer), getUnsignedShort(buffer) };
- break;
- default:
- throw new AssertionError("invalid constant "+tag);
- }
- }
- }
-
- private void resolveConstantPool(Object[] values, ConstantPoolVisitor visitor) {
- // clean out the int[] values, which are temporary
- for (int beg = 1, end = values.length-1, beg2, end2;
- beg <= end;
- beg = beg2, end = end2) {
- beg2 = end; end2 = beg-1;
- //System.out.println("CP resolve pass: "+beg+".."+end);
- for (int i = beg; i <= end; i++) {
- Object value = values[i];
- if (!(value instanceof int[]))
- continue;
- int[] array = (int[]) value;
- byte tag = tags[i];
- switch (tag) {
- case CONSTANT_String:
- String stringBody = (String) values[array[0]];
- visitor.visitConstantString(i, tag, stringBody, array[0]);
- values[i] = null;
- break;
- case CONSTANT_Class: {
- String className = (String) values[array[0]];
- // use the external form favored by Class.forName:
- className = className.replace('/', '.');
- visitor.visitConstantString(i, tag, className, array[0]);
- values[i] = className;
- break;
- }
- case CONSTANT_NameAndType: {
- String memberName = (String) values[array[0]];
- String signature = (String) values[array[1]];
- visitor.visitDescriptor(i, tag, memberName, signature,
- array[0], array[1]);
- values[i] = new String[] {memberName, signature};
- break;
- }
- case CONSTANT_Fieldref: // fall through:
- case CONSTANT_Methodref: // fall through:
- case CONSTANT_InterfaceMethodref: {
- Object className = values[array[0]];
- Object nameAndType = values[array[1]];
- if (!(className instanceof String) ||
- !(nameAndType instanceof String[])) {
- // one more pass is needed
- if (beg2 > i) beg2 = i;
- if (end2 < i) end2 = i;
- continue;
- }
- String[] nameAndTypeArray = (String[]) nameAndType;
- visitor.visitMemberRef(i, tag,
- (String)className,
- nameAndTypeArray[0],
- nameAndTypeArray[1],
- array[0], array[1]);
- values[i] = null;
- }
- break;
- default:
- continue;
- }
- }
- }
- }
-
- private static int getUnsignedByte(ByteBuffer buffer) {
- return buffer.get() & 0xFF;
- }
-
- private static int getUnsignedShort(ByteBuffer buffer) {
- int b1 = getUnsignedByte(buffer);
- int b2 = getUnsignedByte(buffer);
- return (b1 << 8) + (b2 << 0);
- }
-
- private static String getUTF8(ByteBuffer buffer, int utfLen, char[] charArray) throws InvalidConstantPoolFormatException {
- int utfLimit = buffer.position() + utfLen;
- int index = 0;
- while (buffer.position() < utfLimit) {
- int c = buffer.get() & 0xff;
- if (c > 127) {
- buffer.position(buffer.position() - 1);
- return getUTF8Extended(buffer, utfLimit, charArray, index);
- }
- charArray[index++] = (char)c;
- }
- return new String(charArray, 0, index);
- }
-
- private static String getUTF8Extended(ByteBuffer buffer, int utfLimit, char[] charArray, int index) throws InvalidConstantPoolFormatException {
- int c, c2, c3;
- while (buffer.position() < utfLimit) {
- c = buffer.get() & 0xff;
- switch (c >> 4) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- /* 0xxxxxxx*/
- charArray[index++] = (char)c;
- break;
- case 12: case 13:
- /* 110x xxxx 10xx xxxx*/
- c2 = buffer.get();
- if ((c2 & 0xC0) != 0x80)
- throw new InvalidConstantPoolFormatException(
- "malformed input around byte " + buffer.position());
- charArray[index++] = (char)(((c & 0x1F) << 6) |
- (c2 & 0x3F));
- break;
- case 14:
- /* 1110 xxxx 10xx xxxx 10xx xxxx */
- c2 = buffer.get();
- c3 = buffer.get();
- if (((c2 & 0xC0) != 0x80) || ((c3 & 0xC0) != 0x80))
- throw new InvalidConstantPoolFormatException(
- "malformed input around byte " + (buffer.position()));
- charArray[index++] = (char)(((c & 0x0F) << 12) |
- ((c2 & 0x3F) << 6) |
- ((c3 & 0x3F) << 0));
- break;
- default:
- /* 10xx xxxx, 1111 xxxx */
- throw new InvalidConstantPoolFormatException(
- "malformed input around byte " + buffer.position());
- }
- }
- // The number of chars produced may be less than utflen
- return new String(charArray, 0, index);
- }
-}
diff --git a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java b/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java
deleted file mode 100644
index 416a918ba8d..00000000000
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.invoke.anon;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-import static sun.invoke.anon.ConstantPoolVisitor.*;
-
-/** A class and its patched constant pool.
- *
- * This class allow to modify (patch) a constant pool
- * by changing the value of its entry.
- * Entry are referenced using index that can be get
- * by parsing the constant pool using
- * {@link ConstantPoolParser#parse(ConstantPoolVisitor)}.
- *
- * @see ConstantPoolVisitor
- * @see ConstantPoolParser#createPatch()
- */
-public class ConstantPoolPatch {
- final ConstantPoolParser outer;
- final Object[] patchArray;
-
- ConstantPoolPatch(ConstantPoolParser outer) {
- this.outer = outer;
- this.patchArray = new Object[outer.getLength()];
- }
-
- /** Create a {@link ConstantPoolParser} and
- * a {@link ConstantPoolPatch} in one step.
- * Equivalent to {@code new ConstantPoolParser(classFile).createPatch()}.
- *
- * @param classFile an array of bytes containing a class.
- * @see #ConstantPoolParser(Class)
- */
- public ConstantPoolPatch(byte[] classFile) throws InvalidConstantPoolFormatException {
- this(new ConstantPoolParser(classFile));
- }
-
- /** Create a {@link ConstantPoolParser} and
- * a {@link ConstantPoolPatch} in one step.
- * Equivalent to {@code new ConstantPoolParser(templateClass).createPatch()}.
- *
- * @param templateClass the class to parse.
- * @see #ConstantPoolParser(Class)
- */
- public ConstantPoolPatch(Class> templateClass) throws IOException, InvalidConstantPoolFormatException {
- this(new ConstantPoolParser(templateClass));
- }
-
-
- /** Creates a patch from an existing patch.
- * All changes are copied from that patch.
- * @param patch a patch
- *
- * @see ConstantPoolParser#createPatch()
- */
- public ConstantPoolPatch(ConstantPoolPatch patch) {
- outer = patch.outer;
- patchArray = patch.patchArray.clone();
- }
-
- /** Which parser built this patch? */
- public ConstantPoolParser getParser() {
- return outer;
- }
-
- /** Report the tag at the given index in the constant pool. */
- public byte getTag(int index) {
- return outer.getTag(index);
- }
-
- /** Report the current patch at the given index of the constant pool.
- * Null means no patch will be made.
- * To observe the unpatched entry at the given index, use
- * {@link #getParser()}{@code .}@link ConstantPoolParser#parse(ConstantPoolVisitor)}
- */
- public Object getPatch(int index) {
- Object value = patchArray[index];
- if (value == null) return null;
- switch (getTag(index)) {
- case CONSTANT_Fieldref:
- case CONSTANT_Methodref:
- case CONSTANT_InterfaceMethodref:
- if (value instanceof String)
- value = stripSemis(2, (String) value);
- break;
- case CONSTANT_NameAndType:
- if (value instanceof String)
- value = stripSemis(1, (String) value);
- break;
- }
- return value;
- }
-
- /** Clear all patches. */
- public void clear() {
- Arrays.fill(patchArray, null);
- }
-
- /** Clear one patch. */
- public void clear(int index) {
- patchArray[index] = null;
- }
-
- /** Produce the patches as an array. */
- public Object[] getPatches() {
- return patchArray.clone();
- }
-
- /** Produce the original constant pool as an array. */
- public Object[] getOriginalCP() throws InvalidConstantPoolFormatException {
- return getOriginalCP(0, patchArray.length, -1);
- }
-
- /** Walk the constant pool, applying patches using the given map.
- *
- * @param utf8Map Utf8 strings to modify, if encountered
- * @param classMap Classes (or their names) to modify, if encountered
- * @param valueMap Constant values to modify, if encountered
- * @param deleteUsedEntries if true, delete map entries that are used
- */
- public void putPatches(final Map utf8Map,
- final Map classMap,
- final Map